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 |
|---|---|---|---|---|---|---|
PUT /fault_books/1 PUT /fault_books/1.json
|
def update
@fault_book = FaultBook.find(params[:id])
respond_to do |format|
if @fault_book.update_attributes(params[:fault_book])
format.html { redirect_to @fault_book, notice: 'Fault book was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @fault_book.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end",
"def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fault_book = FaultBook.new(params[:fault_book])\n @fault_book.truck_fleet_id = @fault_book.fleet.truck_fleet_id\n \n respond_to do |format|\n if @fault_book.save\n s = Serviceable.find_by_fleet_id(params['fault_book']['fleet_id'])\n s.next_service_date = @fault_book.fault_date \n s.save\n format.html { redirect_to @fault_book, notice: 'Fault book was successfully created.' }\n format.json { render json: @fault_book, status: :created, location: @fault_book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fault_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t\t@book.titlelong = book.title\n\t\t\t@book.description = strip_tags(book.description)\n\t\t\t@book.title = book.work.original_title\n\t\t\t@book.pages = book.num_pages\n\t\t\t@book.bookrating = book.average_rating\n\t\t\t@book.author = book.authors.author.name\n\t\t\t@book.publisher = book.publisher\n\t\t\t@book.save\n\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\tformat.json { render :show, status: :ok, location: @book }\n\t\tend\n end",
"def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @cookbook = Cookbook.find(params[:id])\n\n respond_to do |format|\n if @cookbook.update_attributes(params[:cookbook])\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n if @library_book.update_attributes(params[:library_book])\n format.html { redirect_to @library_book, notice: 'Library book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_book\n @book = Book.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: book_not_found, :status => 404\n rescue\n render json: internal_server_error, :status => 500\n end",
"def set_book\n @book = Book.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render json: { object: 'Book'}, status: :not_found\n end",
"def update\n respond_to do |format|\n if @lib_book.update(lib_book_params)\n format.html { redirect_to university_library_lib_books_path, notice: 'Lib book was successfully updated.' }\n format.json { render :show, status: :ok, location: @lib_book }\n else\n format.html { render :edit }\n format.json { render json: @lib_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n add_title_to_book\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @fault_books = FaultBook.where(:truck_fleet_id => current_user.truck_fleet.id)\n @fault_books = FaultBook.belongs_to_truck_fleet(current_user.truck_fleet, @fault_books) if current_user.admin?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fault_books }\n end\n end",
"def update\n respond_to do |format|\n if @library_book.update(library_book_params)\n format.html { redirect_to @library_book, notice: 'Library book was successfully updated.' }\n format.json { render :show, status: :ok, location: @library_book }\n else\n format.html { render :edit }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @library_book.update(library_book_params)\n format.html { redirect_to @library_book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @library_book }\n else\n format.html { render :edit }\n format.json { render json: @library_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @realistic_fiction_book.update(realistic_fiction_book_params)\n format.html { redirect_to @realistic_fiction_book, notice: \"Realistic fiction review was successfully updated.\" }\n format.json { render :show, status: :ok, location: @realistic_fiction_book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @realistic_fiction_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find_by_id(params[:id])\n\n if @book.present?\n if @book.update(book_params)\n render json: {\n type: 'success',\n result: @book\n }, status: :created\n else\n render json: {\n type: 'failed',\n message: @book.errors,\n result: {}\n }, status: :bad_request\n end\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to manage_books_path, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n if @cook_book.update_attributes(params[:cook_book])\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book,\n notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n\n @books = Book.all\n ActionCable.server.broadcast 'books',\n html: render_to_string('library/index', layout: false)\n else\n format.html { render :edit }\n format.json { render json: @book.errors,\n status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.xml { head :ok }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if _create_or_update()\n\tformat.xml { render :xml => {:success=>true} }\n format.html { redirect_to @book_series, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n\tformat.xml { head :fail }\n format.json { render :json => @book_series.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @book.update(book_params)\n respond_with(@book, :flash => true)\n end",
"def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to @cookbook, notice: 'Cookbook was successfully updated.' }\n format.json { render :show, status: :ok, location: @cookbook }\n else\n format.html { render :edit }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_book\n @book = Book.includes(:price_reduction).find_by(id: params[:id])\n render json: {status: \"not ok\", message: \"Book not found.\"}, status: :not_found unless @book\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_book.update(order_book_params)\n format.html { redirect_to @order_book, notice: 'Order book was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_book }\n else\n format.html { render :edit }\n format.json { render json: @order_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book_issue.update(book_issue_params)\n format.html { redirect_to @book_issue, notice: 'Book issue was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_issue }\n else\n format.html { render :edit }\n format.json { render json: @book_issue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resort_orders\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end",
"def update\n @user_book = UserBook.find(params[:id])\n\n respond_to do |format|\n if @user_book.update_attributes(params[:user_book])\n format.html { redirect_to new_user_book_path, notice: 'Your book was successfully updated. You can add more or go back to your shelf' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n if @authors_book.update_attributes(params[:authors_book])\n format.html { redirect_to @authors_book, notice: 'Authors book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @authors_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @science_fiction_book.update(science_fiction_book_params)\n format.html { redirect_to @science_fiction_book, notice: \"Science fiction review was successfully updated.\" }\n format.json { render :show, status: :ok, location: @science_fiction_book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @science_fiction_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @title = \"Edit Book\"\n\n process_publisher\n\n process_authors\n\n process_subjects\n \n bookParams = params[:book]\n\n params.each {|key, value| \n if key.match(/remove_authorship_/) \n if value == \"on\"\n authorship_id = key.split('_')[2]\n authorship = Authorship.find(authorship_id) \n authorship.destroy if authorship\n end\n elsif key.match(/remove_subject_/)\n subject_id = key.split('_')[2]\n subject = Subject.find(subject_id)\n @book.subjects.delete(subject) if subject\n end\n }\n respond_to do |format|\n if @book.update_attributes(bookParams)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:book][:category_ids] = nil if params[:book][:category_ids].nil?\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_url, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@book = Book.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @book.update_attributes(params[:book])\n\t\t\t\tformat.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n\t\t\t\tformat.json { head :ok }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.json { render :json => @book.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @tags_book.update(tags_book_params)\n format.html { redirect_to @tags_book, notice: \"Tags book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @tags_book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @tags_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @book.update(book_params)\r\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @book }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @cook_book.update(cook_book_params)\n format.html { redirect_to @cook_book, notice: 'Cook book was successfully updated.' }\n format.json { render :show, status: :ok, location: @cook_book }\n else\n format.html { render :edit }\n format.json { render json: @cook_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n rewriteParams\n @book = Book.find(params[:id])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @instance_fault = InstanceFault.find(params[:id])\n\n respond_to do |format|\n if @instance_fault.update_attributes(params[:instance_fault])\n format.html { redirect_to @instance_fault, notice: 'Instance fault was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instance_fault.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n handle_book_categories\n format.html { redirect_to @book, notice: I18n.t(:changes_updated_successfully) }\n format.json { head :no_content }\n else\n @book_categories = {}\n BookCategory.all.order(:category_name).collect {|bc| @book_categories[bc.category_name] = bc.id }\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_path }\n else\n format.html { render :edit, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @twilio_book.update(twilio_book_params)\n format.html { redirect_to @twilio_book, notice: 'Twilio book was successfully updated.' }\n format.json { render :show, status: :ok, location: @twilio_book }\n else\n format.html { render :edit }\n format.json { render json: @twilio_book.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.637154",
"0.6333977",
"0.63282835",
"0.6258963",
"0.62080014",
"0.61578",
"0.6074195",
"0.59866476",
"0.5945467",
"0.5931477",
"0.5911134",
"0.58998066",
"0.5891074",
"0.5872732",
"0.58627915",
"0.585701",
"0.5834952",
"0.5825856",
"0.5819932",
"0.5819932",
"0.5819932",
"0.5819932",
"0.5819932",
"0.5819932",
"0.5819932",
"0.5819932",
"0.5819932",
"0.5814018",
"0.5813238",
"0.5811833",
"0.58091515",
"0.5780685",
"0.5775143",
"0.57749635",
"0.57645124",
"0.57607216",
"0.5754785",
"0.5751698",
"0.57466084",
"0.57461756",
"0.57387584",
"0.5735605",
"0.57276446",
"0.5725134",
"0.5720061",
"0.56967115",
"0.5689949",
"0.5689949",
"0.5686623",
"0.56851566",
"0.5684586",
"0.5684586",
"0.5684586",
"0.5684586",
"0.5684091",
"0.5671324",
"0.5656354",
"0.5653274",
"0.56430465",
"0.5627648",
"0.5624481",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.5622185",
"0.56180316",
"0.56174636",
"0.5605481",
"0.5600505",
"0.55994624",
"0.5594366",
"0.5591201",
"0.55863166",
"0.5570159",
"0.5565334",
"0.55628055",
"0.55575603",
"0.5556557",
"0.55500674"
] |
0.7264373
|
0
|
DELETE /fault_books/1 DELETE /fault_books/1.json
|
def destroy
@fault_book = FaultBook.find(params[:id])
@fault_book.destroy
if (params[:from_calendar])
UserMailer.cancel_service(current_user, @fault_book.fleet, "Fault Book Service", @fault_book.fault_date).deliver
redirect_to controller: :calendar, action: :index
else
respond_to do |format|
format.html { redirect_to fault_books_url }
format.json { head :no_content }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @api_book.destroy\n\n head :no_content\n end",
"def destroy\n book = Book.find(params[:id])\n book.destroy\n \n render json: {}, status: 204\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n \n format.json { render json: @book, status: :created, location: @book }\n end\n end",
"def destroy\n @cookbook = Cookbook.find(params[:id])\n @cookbook.destroy\n\n respond_to do |format|\n format.html { redirect_to cookbooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @book_shelf = BookShelf.find(params[:id])\n @book_shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to book_shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end \n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @cookbook.destroy\n respond_to do |format|\n format.html { redirect_to cookbooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :ok }\r\n end\r\n end",
"def destroy\n @cook_book = CookBook.find(params[:id])\n @cook_book.destroy\n\n respond_to do |format|\n format.html { redirect_to cook_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @title = \"Destroy Book\"\n\n # @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @realistic_fiction_book.destroy\n respond_to do |format|\n format.html { redirect_to realistic_fiction_books_url, notice: \"Realistic fiction book was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end \n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_uri, notice: '本を削除しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n head :no_content\n end",
"def destroy\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/books\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: '削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book1.destroy\n respond_to do |format|\n format.html { redirect_to book1s_url, notice: \"Book1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @death_record_book = DeathRecordBook.find(params[:id])\n @death_record_book.destroy\n\n respond_to do |format|\n format.html { redirect_to death_record_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: '書籍が削除されました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to book_series_collection_books_path(@book_series, @collection) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n resort_orders\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @library_book = LibraryBook.find(params[:id])\n @library_book.destroy\n\n respond_to do |format|\n format.html { redirect_to library_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @businessbook = Businessbook.find(params[:id])\n @businessbook.destroy\n\n respond_to do |format|\n format.html { redirect_to businessbooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ebooks.destroy :id\n respond_to do |format|\n format.html { redirect_to ebooks_url, notice: 'Ebook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to user_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = current_user.books.find(params[:id])\n @book.destroy\n render json { head :no_content }\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @book_progress.destroy\n respond_to do |format|\n format.html { redirect_to book_progresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_path, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: \"Book was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @readbook.destroy\n respond_to do |format|\n format.html { redirect_to readbooks_url, notice: 'Readbook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: @book.title + ' の削除に成功しました。' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to book_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n AuthorsBook.where(:book_id => @book.id).each do |ab| # destroy sharing links of this note\n ab.destroy\n end\n\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lib_book.destroy\n respond_to do |format|\n format.html { redirect_to university_library_lib_books_path, notice: 'Lib book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cook_book.destroy\n respond_to do |format|\n format.html { redirect_to cook_books_url, notice: 'Cook book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to admin_books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to admin_books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @confirmation_book = ConfirmationBook.find(params[:id])\n @confirmation_book.destroy\n\n respond_to do |format|\n format.html { redirect_to confirmation_books_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.73746705",
"0.7044132",
"0.7023974",
"0.69840664",
"0.69713706",
"0.6962778",
"0.6962778",
"0.6962778",
"0.6962778",
"0.6962778",
"0.6962778",
"0.6962778",
"0.6962778",
"0.6962778",
"0.6962778",
"0.6962778",
"0.6962778",
"0.69505024",
"0.69505024",
"0.69491005",
"0.69344777",
"0.69344777",
"0.69344777",
"0.69344777",
"0.69344777",
"0.69344777",
"0.69344777",
"0.69308627",
"0.6913603",
"0.68939453",
"0.6893586",
"0.6886453",
"0.6875359",
"0.6871184",
"0.6852642",
"0.6836669",
"0.68352944",
"0.68352944",
"0.6834592",
"0.68185765",
"0.6813378",
"0.68065053",
"0.68063486",
"0.6784552",
"0.677653",
"0.6775467",
"0.6767273",
"0.6761446",
"0.6756823",
"0.6749433",
"0.67411035",
"0.67410016",
"0.67361283",
"0.67298037",
"0.6727167",
"0.6717481",
"0.671187",
"0.669593",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66954064",
"0.66946226",
"0.6693008",
"0.6693008",
"0.6693008",
"0.668679",
"0.668463",
"0.6672841",
"0.66721004",
"0.6664023",
"0.66607946",
"0.6658165",
"0.6658165",
"0.6655668",
"0.6653675"
] |
0.0
|
-1
|
number: Accepts 3 parameters name, twilio, and area code. twilio determines if Twilio will be used to generate a real phone number. Name is used when setting the friendly name of a Twilio phone number. Area code is used when search for local Twilio numbers. End result a phone number.
|
def number(twilio=false, name=nil, area_code=nil)
if twilio
# Check if twilio configuration exists. If not throw and errors because twilio was passed as true.
if !@config[:configuration][:twilio].blank? and (!@config[:configuration][:twilio][:account_id].blank? and !@config[:configuration][:twilio][:api_key].blank?)
account = @config[:configuration][:twilio][:account_id]
key = @config[:configuration][:twilio][:api_key]
# Initialize twilio client.
twilio = Twilio::REST::Client.new account, key
# If any area code is provide look for local numbers, if not get a toll free.
if area_code.blank?
available_numbers = twilio.account.available_phone_numbers.get('US').toll_free.list
else
available_numbers = twilio.account.available_phone_numbers.get('US').local.list(area_code: area_code) unless area_code.blank?
end
# Select the first number available.
available_number = available_numbers.first
# If available numbers is blank throw an error because something went wrong.
if available_numbers.blank?
raise StandardError, "No Available Numbers"
else
# Convert the phone number into something a artificial voice can say.
phone_number = available_number.phone_number.gsub("+1","")
phone_number = "#{phone_number[0..2]}-#{phone_number[3..5]}-#{phone_number[6..10]}"
# Setting the transciption email
# email = @config[:configuration][:twilio][:transcription_email].blank? ? "developers%40level.agency" : @config[:configuration][:twilio][:transcription_email]
email = "developers%40level.agency"
# Put together the voicemail Twimil.
voice_message = "http://twimlets.com/voicemail?Email=#{email}&Message=You%20reached%20the%20voicemail%20box%20of%20#{phone_number}.%20%20Please%20leave%20a%20message%20after%20the%20beep.&Transcribe=true&"
# Here we buy the number, set the voice_url to the voicemail Twimil and set the
# sms_url to echo so Twilio will capture the message but not reply to it.
number = twilio.account.incoming_phone_numbers.create({
phone_number: available_number.phone_number,
friendly_name: name,
voice_url: voice_message,
voice_method: "GET",
sms_url: "http://twimlets.com/echo?Twiml=%3CResponse%3E%3C%2FResponse%3E",
sms_method: "GET"
})
# If number is blank throw and error because something went wrong.
if number.blank?
raise StandardError, "Unable to allocate Twilio number"
else
number.phone_number
end
end
else
raise ArgumentError, "Cannot find Twilio Account ID and API key in configuration"
end
else
Faker::PhoneNumber.phone_number
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @number = Number.new(number_params)\n\n if !@number.business_number.blank?\n @number.business_number = \"+1\"+Phony.normalize(@number.business_number) \n end\n\n begin \n @client = Twilio::REST::Client.new BwCallTracking::Application.config.account_sid, BwCallTracking::Application.config.auth_token \n number = @client.account.incoming_phone_numbers.create(:area_code => @number.area_code[1..3], :voice_url => BwCallTracking::Application.config.voice_url, :status_callback => BwCallTracking::Application.config.voice_url)\n @number.tracking_number = number.phone_number\n rescue StandardError => e\n puts \"ERROR: \"+e.message \n end \n\n respond_to do |format|\n if @number.save\n format.html { redirect_to numbers_url, notice: 'Number was successfully created.' }\n format.json { render :show, status: :created, location: @number }\n else\n format.html { render :new }\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n 'POST',\n t)\n resp.error! unless resp.kind_of? Net::HTTPSuccess\n rescue StandardError => bang\n #This area will be called if an error happens with the Twilio API\n flash[:alert] = \"Bad number.\"\n redirect_to({ :action => :home })\n \n return\n end\n\n redirect_to({ :action => :home, :alert => \"SMS sent.\" })\n end",
"def shape_phone_number\n self.phone_number = twilio_format phone_number\n end",
"def phone(no)\n if no\n number_to_phone(no, :area_code => false)\n else\n no\n end\n end",
"def make_phone_call(number, international_code = '+254', area_code = 7)\n puts \"calling #{international_code}-#{area_code}#{number}\"\nend",
"def phone_number\n \"(#{Helpers::FakeIt.area_code}) #{Helpers::FakeIt.exchange_code}-#{Helpers::FakeIt.subscriber_number}\"\n end",
"def make_phone_call(number, international_code = 1, area_code = 646)\n puts \"Calling #{international_code}-#{area_code}-#{number}\"\nend",
"def phone_number\n element_with_value('PhoneNumber', opts[:phone_number])\n end",
"def phone_number; end",
"def phone_number; end",
"def phone_to(phone_number, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end",
"def make_phone_call(number, international_code = 1, area_code = 342)\n puts \"Calling #{international_code} - #{area_code} - #{number}\"\nend",
"def make_phone(num, code = 1, area = 10)\n puts \"calling #{num}, whit code #{code} - #{area}\"\nend",
"def dialNumber\n\t\tprint countryCode\n\t\tprint cityCode\n\t\tprint phoneNumber\n\tend",
"def phone_number\n element_with_value('PhoneNumber', opts[:phone_number][0..14])\n end",
"def set_PhoneNumber(value)\n set_input(\"PhoneNumber\", value)\n end",
"def buy_number(business, number)\n phone_request = {\n :phone_number => number,\n :sms_method => 'GET',\n :voice_method => 'GET',\n :sms_url => \"#{ENV['PROTOCOL'].downcase}://#{ENV['HOST']}/twilio/sms\",\n :voice_url => \"#{ENV['PROTOCOL'].downcase}://#{ENV['HOST']}/twilio/voice\"\n }\n response = sub_account(business).incoming_phone_numbers.create(phone_request)\n Rails.logger.info \"Skej::Twilio#buy_number(#{business}, #{number})\"\n\n response\n end",
"def phone_number(nr)\n country_code = AppConfig['contact_info.default_country_code'].to_s\n Phone.parse(nr, :country_code => country_code).format(:europe)\n rescue\n return nr\n end",
"def add_tel(s=nil, number: s)\n @to_s = 'tel:' + number\n end",
"def create\n @number = Number.new(number_params)\n\n if !@number.business_number.blank?\n @number.business_number = \"+1\"+Phony.normalize(@number.business_number) \n end\n\n begin \n\n numbers = Bandwidth::AvailableNumber.search_local({:area_code => @number.area_code[1..3]})\n \n if numbers.count > 0\n # buy the phone number\n number = Bandwidth::PhoneNumber.create({:number => numbers[0][:number], :applicationId => ENV[\"BANDWIDTH_APP_ID\"]})\n\n # assign the phone number to your app id\n @number.tracking_number = number.number\n @number.bw_id = number.id\n \n end\n\n rescue StandardError => e\n puts \"ERROR: \"+e.message\n raise \"There was a problem setting up your number. Try again.\" \n end \n\n respond_to do |format|\n if @number.save\n format.html { redirect_to numbers_url, notice: 'Number was successfully created.' }\n format.json { render :show, status: :created, location: @number }\n else\n format.html { render :new }\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def match_phone_number(number)\n /\\A\\s*\\(?\\s*?(?<area_code>\\d{3})\\s*\\)?[-.\\s]*(?<exchange>\\d{3})[-.\\s]*(?<number>\\d{4})([xX\\s]*(?<ext>\\d+))?\\s*\\z/\n .match(number)\n end",
"def phone_number\n\t\t\trecipient.phone_number\n\t\tend",
"def phone_number\n '+18773289677'\n end",
"def make_call (number, international_code = 1, area_code = 646)\n puts \"Calling #{international_code}-#{area_code}-#{number}\"\n end",
"def phone_number\n '+18009977777'\n end",
"def mobile_phone=(n)\n pull unless @details\n pn = Quickbooks::Model::TelephoneNumber.new\n pn.free_form_number = n\n @details.mobile_phone = pn\n #update our locally stored number too\n update_mobile_phone_number\n end",
"def phone_number(area_code = nil)\n area_code ||= CITIES.rand[1]\n length = 10 - area_code.length\n \"#{area_code} #{numerify('#' * length)}\"\n end",
"def get_phone_no\n phone_no = params[:phone_no] if params[:phone_no].present?\n @phone = phone_no.respond_to?(\"strip\") ? phone_no.strip : nil\n end",
"def getToolsProcess_phone( number)\n params = Hash.new\n params['number'] = number\n return doCurl(\"get\",\"/tools/process_phone\",params)\n end",
"def phone_number\n get_attribute(Yoti::Attribute::PHONE_NUMBER)\n end",
"def phone_number\n if self[:phone_number] == nil\n return nil\n end\n phone_number = self[:phone_number]\n return PhoneNumberHandler.format_phone_number(phone_number)\n end",
"def phone_number\n if self[:phone_number] == nil\n return nil\n end\n phone_number = self[:phone_number]\n return PhoneNumberHandler.format_phone_number(phone_number)\n end",
"def phoneme(number)\n number.gsub(/-+|\\s+/, '').gsub(/(\\d{2,2})(\\d{2,2})(\\d{2,2})(\\d{2,2})/, '\\\\1 \\\\2 \\\\3 \\\\4')\n end",
"def initialize(number)\n @raw_number = number\n @number = CnPhoneNumber.clean(number)\n # assume okay until shown otherwise\n @reason = :ok\n #puts \"number = #{@number}\"\n\n # TODO too short or too long\n\n # let's determine the basic type: landline, mobile, magic, or unknown\n # source: TODO\n if CnPhoneNumber.is_magic_number?(@number)\n @type = :magic\n # a very basic length check: at least 7 digits, assuming no area or provider code\n elsif @number.length >= 7\n if @number[0] == '1'\n # at this point, it's either: Beijing's city code, OR ...\n if @number[1] == '0'\n @type = :landline\n # no known mobile providers have '19...'\n elsif @number[1] != '9'\n @type = :mobile\n else\n @type = :unknown\n end\n else\n @type = :landline\n end\n else\n @type = :unknown\n @reason = :unknown_type\n end\n #puts \"type = #{@type}\"\n\n if @type == :mobile\n # see if we can find a provider, and strip it from @number if found\n @provider = :unknown\n @provider_number = nil\n\n # all mobile numbers must be length 11. there are two cases:\n # a) 3 digit provider code + 8 digit local extension\n # b) 4 digit provider code (134X) + 7 digit local extension\n length_check_passed = @number.length == 11\n\n if length_check_passed\n Providers.all.each_pair do | area_code, provider |\n if @number[0, area_code.length] == area_code\n @provider = provider\n @provider_number = area_code\n @number = @number[area_code.length, @number.length]\n break\n end\n end\n end\n elsif @type == :landline\n # try to find the city, and strip it from @number if found\n @city = :unknown\n @city_number = nil\n Provinces.all.each_pair do | area_code, city |\n #puts area_code, city, @number[0, area_code.length]\n # all landline numbers must be >= length 7 (minus the provider code)\n if @number[0, area_code.length] == area_code && @number.length - area_code.length >= 7\n @city = city\n @city_number = area_code\n @number = @number[area_code.length, @number.length]\n break\n end\n end\n else\n @provider = :unknown\n @provider_number = nil\n @city = :unknown\n @city_number = nil\n end\n\n end",
"def get_telephone\n area_code = @rand.rand(1000).to_s.rjust(3, '0')\n last_four_digits = @rand.rand(10000).to_s.rjust(4, '0')\n \"(\" + area_code + \") 555-\" + last_four_digits\n end",
"def parse_number(number)\n\n match = number.to_s.strip.match(/^\\+?(1?)[\\s\\.\\-]*\\(?([\\d]{3})\\)?[\\s\\-\\.]*([\\d]{3}[\\s\\-\\.]{0,1}[\\d]{4})$/)\n\n if match.nil? || match[3].match(/^555/)\n raise ArgumentError.new(\"'#{number}' is not a valid phone number or is in the wrong format.\")\n end\n\n derp, country_code, area_code, phone_number = match.to_a\n country_code = '1' if country_code == ''\n\n country_code + area_code + phone_number.gsub(/[^\\d]/,'')\nend",
"def tw_phone_params\n params.require(:tw_phone).permit(:nickname, :code, :number)\n end",
"def mobile_phone_number\n FFaker.numerify(\"#{mobile_phone_prefix}## ### ###\")\n end",
"def verifyphonenumber\n tc = Twilio::REST::Client.new tsid, tauthtoken\n # Ref: https://www.twilio.com/docs/api/rest/outgoing-caller-ids\n call_delay_in_sec = 45 # Can be 0 to 60 seconds\n caller_id = tc.outgoing_caller_ids.create(:phone_number => params[:PhoneNumber], :call_delay => call_delay_in_sec)\n respond_to do |format|\n format.json { render :json => {:verification_code => caller_id.validation_code},\n :status => :ok }\n end\n end",
"def phone_number_with_country_code; end",
"def get_routing_sms_phonenumber_with_http_info(address_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.get_routing_sms_phonenumber ...\"\n end\n \n \n # verify the required parameter 'address_id' is set\n fail ArgumentError, \"Missing the required parameter 'address_id' when calling RoutingApi.get_routing_sms_phonenumber\" if address_id.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/sms/phonenumbers/{addressId}\".sub('{format}','json').sub('{' + 'addressId' + '}', address_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SmsPhoneNumber')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#get_routing_sms_phonenumber\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def phone_number_field\n $tracer.trace(__method__)\n #unit_test_no_generate: phone_number_field, input.id(\"PhoneNumber\")\n return ToolTag.new(input.id(\"PhoneNumber\"), __method__, self)\n end",
"def internationalized_phone_number(phone_number)\n \t\"+1#{phone_number}\"\n end",
"def sms_to(phone_number, name = T.unsafe(nil), html_options = T.unsafe(nil), &block); end",
"def set_Phone(value)\n set_input(\"Phone\", value)\n end",
"def makecall\n \n client = Twilio::REST::Client.new(TWILIO_CONFIG['sid'], TWILIO_CONFIG['token'])\n @call = client.account.calls.create(\n :from => TWILIO_CONFIG['from'], # From your Twilio number\n :to => '+19493228496', # To any number\n # Fetch instructions from this URL when the call connects\n :url => 'http://snipit.herokuapp.com/voicein'\n )\n end",
"def phone_number\n case rand(0..2)\n when 0 then fixed_line_number\n when 1 then mobile_number\n when 2 then mobile_or_pager_number\n end\n end",
"def place_call\n client = Twilio::REST::Client.new(Settings.twilio.account_sid, Settings.twilio.auth_token)\n params = {\n from: call.caller_id,\n to: call.member_phone_number,\n url: call_start_url(call),\n status_callback: member_call_event_url(call),\n status_callback_method: 'POST',\n status_callback_event: %w[initiated ringing answered completed]\n }\n client.calls.create params\n rescue Twilio::REST::RestError => e\n # 13223: Dial: Invalid phone number format\n # 13224: Dial: Invalid phone number\n # 13225: Dial: Forbidden phone number\n # 13226: Dial: Invalid country code\n # 21211: Invalid 'To' Phone Number\n # 21214: 'To' phone number cannot be reached\n call.action.destroy!\n call.update!(twilio_error_code: e.code, status: 'failed', action_id: nil)\n if (e.code >= 13_223 && e.code <= 13_226) || [21_211, 21_214].include?(e.code)\n add_error(:member_phone_number, I18n.t('call_tool.errors.phone_number.cant_connect'))\n else\n Rails.logger.error(\"Twilio Error: API responded with code #{e.code} for #{call.attributes.inspect}\")\n add_error(:base, I18n.t('call_tool.errors.unknown'))\n end\n end",
"def getToolsFormatPhone( number, country)\n params = Hash.new\n params['number'] = number\n params['country'] = country\n return doCurl(\"get\",\"/tools/format/phone\",params)\n end",
"def mutate_phone_number(_)\n Faker::PhoneNumber.phone_number\n end",
"def purchase!(opts={})\n Twilio::IncomingPhoneNumber.create opts.update :phone_number => phone_number\n end",
"def phone_number_with_country_code\n \"#{country_code} #{phone_number}\"\n end",
"def phone_with_parantheses(number)\n number.to_s(:phone, area_code: true)\n end",
"def phone_number\n case rand(0..1)\n when 0 then home_work_phone_number\n when 1 then mobile_phone_number\n end\n end",
"def phone_number\n value = Faker::PhoneNumber.phone_number\n remove_extension(value)\n end",
"def phone_number\n value = Faker::PhoneNumber.phone_number\n remove_extension(value)\n end",
"def outboundcall\n # This FromPhoneNumber should have been verified in the associated sub-account\n render_twiml generateTwiml(params[:FromPhoneNumber], params[:ToPhoneNumber])\n end",
"def add_phone_number(phone_number)\n return if self.has_number?(phone_number)\n puts \"adding number: \" + phone_number.number \n self.save\n self.list_memberships.create! :phone_number_id => phone_number.id\n if(self.use_welcome_message?)\n puts \"has welcome message, and creating outgoing message\"\n welcome_message = self.custom_welcome_message\n create_outgoing_message( phone_number, welcome_message )\n end \n end",
"def phone_without_area_code(phone_number)\n number_to_phone(phone_number.sub(/^0121/, ''))\n end",
"def mobile_number\n \"#{mobile_phone_prefix}-#{short_phone_number}\"\n end",
"def normalize_phone_number(num)\n number = Phoner::Phone.parse(num)\n # Formats as (area code) XXX XXXX\n number = number.format('(%a) %f %l')\nend",
"def createPhoneNumber(numbers)\n phone_num = numbers.join(\",\").to_s.gsub(\",\",\"\")\n return \"(#{$1})#{$2}-#{$3}\" if phone_num =~ /^(\\d{3})(\\d{3})(\\d{4})$/\nend",
"def number_fetch(number)\n Number.new(number_request(:get, \"phone-numbers/#{number}\"))\n end",
"def cell_phone; end",
"def put_routing_sms_phonenumber_with_http_info(address_id, body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RoutingApi.put_routing_sms_phonenumber ...\"\n end\n \n \n # verify the required parameter 'address_id' is set\n fail ArgumentError, \"Missing the required parameter 'address_id' when calling RoutingApi.put_routing_sms_phonenumber\" if address_id.nil?\n \n \n \n \n \n \n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling RoutingApi.put_routing_sms_phonenumber\" if body.nil?\n \n \n \n \n \n # resource path\n local_var_path = \"/api/v2/routing/sms/phonenumbers/{addressId}\".sub('{format}','json').sub('{' + 'addressId' + '}', address_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n \n auth_names = ['PureCloud OAuth']\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 => 'SmsPhoneNumber')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: RoutingApi#put_routing_sms_phonenumber\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_telephone_number(account_number, telephone_number)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/dids/{telephone_number}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number,\r\n 'telephone_number' => telephone_number\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.get query_url, headers: headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def show\n @phonenumber = Phonenumber.find(params[:id])\n end",
"def huzzah\n # ===========================================================================\n # 6. Send an SMS Message to 415-555-1212\n # uses a HTTP POST, and a new variable t for the information (because it needs \"Body\")\n \n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n \n t = {\n 'From' => CALLER_ID,\n 'To' => phone,\n 'Body' => message\n }\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n \"POST\", t)\n end",
"def mobile_phone\n return unless @user.loa3?\n\n dig_out('telephones', 'phone_type', VAProfile::Models::Telephone::MOBILE)\n end",
"def reminderCall\n @twilio_number = ENV['TWILIO_NUMBER']\n @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n call = @client.account.calls.create(\n :from => @twilio_number,\n :to => self.phone_number,\n :url => 'https://clockairos.herokuapp.com/twilio/call',\n :method => 'POST',\n :fallback_method => 'GET',\n :status_callback_method => 'GET',\n :if_machine => 'Hangup',\n :timeout => '30',\n :record => 'false'\n )\n puts call.to\n end",
"def name_phone\n \"#{name} #{phone}\"\n end",
"def incoming\n from = params[\"From\"]\n\n if Number.find_by(number: from).blank?\n Number.create(number:from)\n end\n\n number = Number.find_by(number: from)\n\n if number.user.blank? && number.skip_sign_up == false\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"If you would like to register your name so we can give you credit for your pictures, send a text with 'Register' followed by your name :)\"\n )\n\n number.update(skip_sign_up: true)\n end\n body = params[\"Body\"]\n split = body.split(\" \")\n\n if split[0]&.downcase == 'register'\n if number.user.blank?\n User.create(\n name: split.drop(1).join(\" \"),\n number: number\n )\n\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"Successfully registered #{from} to #{number.user.name}\"\n )\n elsif number.user.present?\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"#{from} is already registered to #{number.user.name}. Text William @ 4046801732 if this isn't right.\"\n )\n end\n elsif params[\"MediaUrl0\"].present?\n Pic.create(\n number: number,\n description: params[\"Body\"],\n path: params[\"MediaUrl0\"]\n )\n reply_body = \"Thanks for for sending the pics of the party!\"\n if number.user.present?\n reply_body = \"#{number.user.name}, Thanks for sending pics!\"\n end\n\n from_number = params[\"From\"]\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from_number,\n body: reply_body\n )\n end\n end",
"def new\n @phone_number = @kontact_information.phone_numbers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.mobile\n format.xml { render :xml => @phone_number }\n end\n end",
"def format_phone\n if @phone != nil\n @phone = self.phone.scan(/[0-9]/).join\n self.phone = @phone.length == 7 ? ActionController::Base.helpers.number_to_phone(@phone) : \n @phone.length == 10 ? ActionController::Base.helpers.number_to_phone(@phone, area_code: true) :\n @phone\n\n end\n end",
"def record()\n # Staying in Germany for now:\n country_code = '+49'\n # Between 2 and 5 digits area codes (max 2 + 3):\n area_digits_quantity = 2 + rand(4)\n # Area code has no trailing zeros. E.g. with 4 digits minimum is 1000.\n min_area_code = 10 ** (area_digits_quantity - 1)\n # Biggest 5 digit area code is 99999, i.e. 10**5 - 1\n max_area_code = 10 ** area_digits_quantity - 1\n # Get a random number in the range min_area_code to max_area_code:\n area_code = min_area_code + rand( max_area_code - min_area_code + 1 )\n # Today area code and subscriber line are 10 digits in total.\n subscriber_digits_quantity = 10 - area_digits_quantity\n min_subscriber_number = 10 ** (subscriber_digits_quantity - 1)\n max_subscriber_number = 10 ** subscriber_digits_quantity - 1\n subscriber_number = min_subscriber_number + rand( max_subscriber_number - min_subscriber_number + 1 )\n PhoneNumber.new( country_code, area_code, subscriber_number )\n end",
"def phone_number\n @phone.number\n end",
"def create\n flash[:notice] = 'The phone number was successfully added.' if phone_number.save\n respond_with(phone_number)\n end",
"def phone_params\n params.require(:phone).permit(:id, :code, :number, :description)\n end",
"def phone_number=(phone_number)\n\n if !phone_number.nil? && phone_number.to_s.length > 30\n fail ArgumentError, \"invalid value for 'phone_number', the character length must be smaller than or equal to 30.\"\n end\n\n @phone_number = phone_number\n end",
"def phone_number=(phone_number)\n\n if !phone_number.nil? && phone_number.to_s.length > 30\n fail ArgumentError, \"invalid value for 'phone_number', the character length must be smaller than or equal to 30.\"\n end\n\n @phone_number = phone_number\n end",
"def formatted_phone_number\n Phonelib.parse(phone_number).local_number\n end",
"def formatted_phone_number\n Phonelib.parse(phone_number).local_number\n end",
"def formatted_phone_number\n Phonelib.parse(phone_number).local_number\n end",
"def phone_input(method, options)\n basic_input_helper(:phone_field, :phone, method, options)\n end",
"def phone_number\n return homework_number if rand(0..1).zero?\n\n mobile_number\n end",
"def primary_phone=(n)\n pull unless @details\n pn = Quickbooks::Model::TelephoneNumber.new\n pn.free_form_number = n\n @details.primary_phone = pn\n #update our locally stored number too\n update_phone_number\n end",
"def set_phone_num\n @phone_num = PhoneNum.find(params[:id])\n end",
"def add_phone_number(type, number)\n phone_number = PhoneNumber.new\n phone_number.type = type\n phone_number.number = number\n #once we have that we need to append it to the internal @phone_numbers array with:\n phone_numbers.push(phone_number)\n end",
"def short_phone_number\n FFaker.numerify('###-##-##')\n end",
"def call\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new account_sid, auth_token\n\n @client.account.messages.create(\n :from => '+18152642023',\n :to => @number,\n :body => 'hahahayolo'\n )\n end",
"def number_params\n params.require(:number).permit(:phonenumber, :country)\n end",
"def sms(phone_number)\n mp \"[BP Deprecated] use app.launch(sms: #{phone_number}) over app.sms\"\n launch(sms: phone_number)\n end",
"def assign_phone_number\n if !params[:customer].blank? && !params[:call_id].blank?\n call = Radius::Call.find_by_radacctid(params[:call_id].to_i)\n customer = Customer.find_by_name_and_address(params[:customer])\n if !call\n flash[:error] = 'Call not found'\n elsif !customer\n flash[:error] = 'Customer not found'\n else\n customer.phones.add call.caller\n end\n end\n redirect_to :action => :index\n end",
"def format_phone_number(phone_number_str)\n return phone_number_str\nend",
"def set_twilio_params\n\t @incoming_phone = params[:From]\n\t @message = params[:Body]\n\t anonymous_phone_number = params[:To]\n\n\t @interview = Interview.where(phone_number: anonymous_phone_number).first\n\t end",
"def phone_link_to(number, options={})\n defaults = {:service => :skype}\n options = defaults.merge(options).symbolize_keys\n\n # link_to(\"test\", \"callto://#{number.to_s}\")\n content_tag(:a, number, :href => \"callto:#{number}\" )\n end",
"def phone_info(phone_number)\n if Telephony.config.pinpoint.sms_configs.empty?\n return PinpointHelper.handle_config_failure(:sms)\n end\n\n response = nil\n error = nil\n\n Telephony.config.pinpoint.sms_configs.each do |sms_config|\n error = nil\n CLIENT_POOL[sms_config].with do |client|\n response = client.phone_number_validate(\n number_validate_request: { phone_number: phone_number },\n )\n rescue Seahorse::Client::NetworkingError,\n Aws::Pinpoint::Errors::ServiceError => error\n PinpointHelper.notify_pinpoint_failover(\n error: error,\n region: sms_config.region,\n channel: :sms,\n extra: {},\n )\n end\n break if response\n end\n\n type = case response&.number_validate_response&.phone_type\n when 'MOBILE'\n :mobile\n when 'LANDLINE'\n :landline\n when 'VOIP'\n :voip\n else\n :unknown\n end\n\n error ||= unknown_failure_error if !response\n\n PhoneNumberInfo.new(\n type: type,\n carrier: response&.number_validate_response&.carrier,\n error: error,\n )\n end",
"def create\n @phone_number = @kontact_information.phone_numbers.build(params[:phone_number])\n respond_to do |format|\n if @phone_number.save\n flash[:notice] = 'Phone number was successfully created.'\n format.html { redirect_to(@phone_number) }\n format.mobile {redirect_to profile_kontact_kontact_information_plural_fields_path(@profile, @kontact)}\n format.xml { render :xml => @phone_number, :status => :created, :location => @phone_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @phone_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def phone=(v)\n @phone = alma_string v\n end",
"def initialize(name = \"\",phone=\"\")\n @name = name\n @phone_number = phone\n end"
] |
[
"0.727347",
"0.7182441",
"0.7126095",
"0.710153",
"0.7060691",
"0.6984639",
"0.6861804",
"0.68602294",
"0.68159324",
"0.68159324",
"0.6781796",
"0.6754689",
"0.6709373",
"0.6684381",
"0.66806006",
"0.6673164",
"0.6603824",
"0.6558685",
"0.6544645",
"0.64883184",
"0.6467116",
"0.64515036",
"0.6430502",
"0.6428998",
"0.6422879",
"0.64035666",
"0.63953537",
"0.6376468",
"0.6375417",
"0.6350249",
"0.6337875",
"0.633755",
"0.6333552",
"0.6278321",
"0.6265431",
"0.6259968",
"0.62567735",
"0.6254506",
"0.62509125",
"0.62415147",
"0.6228477",
"0.62059987",
"0.617756",
"0.6173962",
"0.6162673",
"0.61147076",
"0.6112258",
"0.61068517",
"0.60994744",
"0.6089307",
"0.6087084",
"0.6069574",
"0.6060801",
"0.6060257",
"0.60598105",
"0.60598105",
"0.60413677",
"0.60313153",
"0.6030218",
"0.60204774",
"0.6014069",
"0.60108703",
"0.6005457",
"0.6004943",
"0.5998321",
"0.59961474",
"0.5990934",
"0.59864694",
"0.59847057",
"0.59752136",
"0.5968828",
"0.59619045",
"0.59592795",
"0.5957894",
"0.5942977",
"0.5941872",
"0.5930412",
"0.5929547",
"0.5903624",
"0.5903624",
"0.5903333",
"0.5903333",
"0.5903333",
"0.5901324",
"0.59000087",
"0.58960193",
"0.5895964",
"0.58927697",
"0.5882764",
"0.5856613",
"0.58562636",
"0.5851208",
"0.5848297",
"0.584504",
"0.58446264",
"0.58418614",
"0.584147",
"0.5838458",
"0.5837097",
"0.58351165"
] |
0.81615365
|
0
|
Return 1st 3 words of content and ellipsis
|
def preview
self.content.split(' ')[0...5].join(' ') + '...'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def excerpt\n return content if content.length <= 120\n content[0..116] + '...'\n end",
"def first_n_words( n , text )\n words = text.split[0...n]\n words.join(' ') + if words.size == n then '...' else '' end\n end",
"def first_20(post_text = '') \n \tshort_text = post_text.split(\" \").first(20).join(\" \")\n \tshort_text + \"...\"\n end",
"def snippet(text, wordcount, omission)\n return '' if text.blank?\n text.split[0..(wordcount-1)].join(\" \") + (text.split.size > wordcount ? \" \" + omission : \"\")\n end",
"def snippet(sentence, desired_word_count = 3)\n sentence.sub(/\\A(?<first_x_words>(\\w+ ){#{desired_word_count}})(?<the_rest>.*)/, '\\k<first_x_words>...')\nend",
"def summarize_content (char_num)\n if self.content.length <= char_num\n return self.content\n else return self.content[0..(char_num-1)] + \"...\"\n end\n end",
"def first_x_words(str,n=20,finish='…')\n str.split(' ')[0,n].inject{|sum,word| sum + ' ' + word} + finish\nend",
"def the_excerpt(content=nil, length=100)\n if node = content || @content || Content.get(params[:id])\n \n # First, we convert the text to html and strip it\n # (remember it's stored as markdown)\n text = Maruku.new(\"#{node.body}\").to_html.gsub(/<\\/?[^>]*>/, \"\")\n \n # Next, we truncate it\n text = text.split(\" \")[0..length].join(\" \")\n \n # Add ellipse if anything was actually shortened\n text += \"...\" unless node.body.split(\" \").length < length\n \n return text\n \n else\n \"<strong>Error:</strong> No content could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end",
"def notebooktext_short\n truncate_text_words(self.notebooktext, 100)\n end",
"def smart_truncate(opts = {})\n opts = {:words => 12}.merge(opts)\n if opts[:sentences]\n return self.split(/\\.(\\s|$)+/).reject{ |s| s.strip.empty? }[0, opts[:sentences]].map{|s| s.strip}.join('. ') + '...'\n end\n a = self.split(/\\s/) # or /[ ]+/ to only split on spaces\n n = opts[:words]\n a[0...n].join(' ') + (a.size > n ? '...' : '')\n end",
"def lede(word_count = 25)\n doc = self.hpricot_body\n #wipe images\n doc.search(\"img\").remove\n paras = doc.search(\"//p\")\n text = \"\" \n while paras.size > 0 && text.split(\" \").size < word_count\n text += paras.shift.to_html\n end\n if (arr = text.split(\" \")).size > word_count\n return arr[0..word_count].join(\" \") + \" ...\"\n else \n return arr.join(\" \")\n end\n end",
"def abbrev(text, length=50)\n return text if text.size < length # do nothing if not needed\n ea_side = length / 2\n return text[0..ea_side-1] + \"...\" + text[-(ea_side-3).. -1]\nend",
"def preview(text, length=400)\n text.split(/\\s/).inject(\"\") do |out, chunk|\n if (out.size + 1 + chunk.size) <= length\n out + \" \" + chunk\n else\n return out + \" ...\"\n end\n end\n end",
"def content_summary(max)\n if self.content.length >= max\n self.content.slice(0..max) + \"...\"\n else\n self.content\n end\n end",
"def text_summary\n summary = self.text\n summary = summary[(summary.index(\" \") + 1)...summary.length] if self.text[0...1] == \"@\"\n summary = (summary.length > 30 ? \"#{summary[0..30]}...\" : summary[0..30])\n summary\n end",
"def short_text(text, max_length)\n short = text\n if text.present? && text.length > max_length\n short_array = text.slice(0, max_length).split(' ')\n short_array.pop\n short = short_array.join(' ') + ' ...'\n end\n short\n end",
"def fakewrap(str, width, max)\n parts = str.split(/\\s+/)\n result = []\n\n # Work until were out of words\n until parts.length == 0 do\n part = ''\n\n # Work as long as we're under the character limit\n while part.length < width do\n part = [part, parts.shift].join(' ')\n end\n result << part.strip\n end\n\n # If we're over the max lines, ellipsis the last line\n if result.length > max\n result = result[0..max - 1]\n result << '...'\n end\n return result\nend",
"def summary\n content = self.content\n sentences = content.split(\".\")\n \"#{sentences[0..1].join(\".\")}...\"\n end",
"def truncate_paragraph(long_str, num_characters, truncated_indicator=\"...\")\n if long_str.length <= num_characters\n return long_str\n else \n return long_str.split(//).first(num_characters).join + \" \" + (truncated_indicator) \n end\n \n\nend",
"def shrink_text(text, num_words=5)\n text = text.split[0..(num_words-1)].join(\" \") + (text.split.size > num_words ? \"...\" : \"\")\n return text\n end",
"def shortened_title\n if title.size < 120\n return title\n else\n return \"#{title.slice(0,120)}...\"\n end\n end",
"def content_based_description\n first_long_paragraph = parsed_search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end",
"def getTitle(doc)\n\tfirstLine = doc.strip[/^[^\\n]+(?=\\n|$)/]\n\tfirstLine.length <= TITLE_LENGTH ? firstLine : firstLine[0,TITLE_LENGTH-3]+\"...\"\nend",
"def truncate\n title.chomp.slice(0...(width - 4))\n end",
"def truncate_words(options = {})\n stripped = ActionController::Base.helpers.strip_tags(self)\n\n max_length = options[:max_chars] || 100\n omission = options[:omission] || \"...\"\n center = options[:center]\n highlight = [options[:highlight]].flatten.compact\n highlight_class = options[:highlight_class] || \"highlight\"\n\n if max_length < stripped.length\n if center\n r_limit = stripped.index(center) + center.length + ((max_length - center.length) / 2) - 1 - omission.length\n l_limit = stripped.index(center) - ((max_length - center.length) / 2) + omission.length\n\n if l_limit < 0\n r_limit -= l_limit\n r_limit += omission.length\n l_limit = 0\n end\n if r_limit > stripped.length\n l_limit -= r_limit - stripped.length\n l_limit -= omission.length\n r_limit = stripped.length\n end\n result = stripped[l_limit..r_limit]\n if l_limit >0 && stripped[l_limit-1,1] != \" \"\n result = result[result.index(\" \")+1..-1]\n end\n if r_limit < stripped.length && stripped[r_limit + 1,1] != \" \"\n result = result[0..(result.rindex(\" \")-1)]\n end\n\n result = omission + result + omission\n else\n limit = max_length - 1 - omission.length\n result = stripped[0..limit]\n if stripped[limit + 1,1] != \" \"\n if result.rindex(\" \")\n result = result[0..(result.rindex(\" \")-1)]\n else\n result = \"\"\n end\n end\n result += omission\n end\n else\n result = stripped\n end\n\n highlight.each do |h|\n result = result.gsub(h, \"<span class=\\\"#{highlight_class}\\\">#{h}</span>\")\n end\n result\n\n\n end",
"def excerpt(words_count=50)\n \n HTMLAnalysis.new(body).plain_text.split(%r{\\s+}).take(words_count).join(' ').strip\n\n end",
"def short(str)\n limit = 140\n str = str.gsub(/(\\n|\\r)/, \"\")\n return str if str.size <= limit\n str.strip[0...(limit-3)]\n .concat(\"...\")\n end",
"def truncate( text, num_words = 6, truncate_string = \"...\" )\n if text.nil? then return end\n arr = text.split( ' ' )\n arr.length > num_words ? arr[ 0...num_words ].join( ' ' ) + truncate_string : text\nend",
"def title_slice(title,tsize)\n unless title==nil\n if title.size > tsize || title.size == tsize\n title= title.slice(0,tsize-3)+\"...\"\n return title.titlecase\n else\n return title.titlecase\n end\n end \n end",
"def excerpt_separator; end",
"def truncate( text, num_words = 6, truncate_string = \" [...]\" )\n if text.nil? then return end\n arr = text.split( ' ' )\n arr.length > num_words ? arr[ 0...num_words ].join( ' ' ) + truncate_string : text\nend",
"def lorem\n \"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\"\n end",
"def title(title,tsize)\n unless title==nil\n if title.size > tsize || title.size == tsize\n title= title.slice(0,tsize-3)+\"...\"\n return title\n else\n return title\n end\n end \n end",
"def list_title(n=40)\n st = title[0..n].to_s\n st += \"...\" unless title.length <= n\n st\n end",
"def truncate_paragraph(long_str, num_characters, truncated_indicator=\"...\")\n\n if long_str.length > num_characters\n return long_str[0...num_characters] + \" \" + truncated_indicator\n else \n return long_str\n end\n\nend",
"def shortened_tweet_truncator(tweet) \n if word_substitutor(tweet).length > 140 \n word_substitutor(tweet)[0...137] + \"...\"\n else \n tweet\n end \nend",
"def text_summary\n summary = attribute_get(:text)\n summary = summary[(summary.index(\" \") + 1)...summary.length] if summary[0...1] == \"@\"\n summary = (summary.length > 30 ? \"#{summary[0..30]}...\" : summary[0..30])\n summary\n end",
"def to_s\n (@text.size > @length_to_display ? @text[0, @length_to_display - 4] + \"...\" : @text).gsub(\"\\n\",\" \")\n end",
"def generate_excerpt?; end",
"def extract_excerpt(text, divider = \"\\r\\n\\r\\n\")\n text.lines(divider).to_a.each(&:strip!).reject(&:blank?).take(3).join(divider)\n end",
"def list_title(n=40)\n st = subject[0..n].to_s\n st += \"...\" unless subject.length <= n\n st\n end",
"def abbreviate( text, wordcount )\n if text.nil? \n return \"\"\n end\n comps = text.gsub(/(\\s)+/, \" \").split(\" \");\n res = \"\";\n limit = wordcount;\n limit = comps.size if limit > comps.size;\n limit = 0 if limit < 2 \n\n for i in 0..(limit-2)\n res = res + comps[i] + \" \" if ! comps[i].nil?;\n end\n res += comps[limit-1] if ! comps[limit-1].nil?;\n\n res += \"...\" if comps.size > wordcount;\n\n return res;\n end",
"def snippet\n snippet = text.split(\"\\r\\n\\r\\n\")[0]\n snippet = snippet[0, 500] + ' **[. . .]**' if snippet.length > 550\n snippet\n end",
"def shorten(text, length)\n if text.length <= length - 1\n text\n else\n text[0..length - 1] + \"...\"\n end\n end",
"def shortened_tweet_truncator(tweet)\n if word_substituter(tweet).length > 140\n word_substituter(tweet)[0..136] + '...'\n else\n tweet\n end\nend",
"def title\n description.truncate(30, :separator =>' ')\n end",
"def snippet(text, max)\n result = ''\n count = 0\n # TODO figure out support for pre that contains code blocks..\n return [result, count] if is_blank?(text)\n text.split.each do |word|\n return [result.strip!, count] if count >= max\n result << \"#{word} \"\n count += 1\n end\n [result.strip!, count]\n end",
"def shorten_post_contents(contents)\n return contents if contents.length < 1500\n splits = contents.split(\"\\n\")\n splits.pop while splits.join('').length > 1500\n splits.pop if splits[-1][0..1] == '<h'\n splits.join(\"\\n\")\n end",
"def content_summary(**args)\n length = args[:length] ? args[:length] : 50\n # If we can find first paragraph\n reg = Regexp.new(/(^<p>[^<]*<\\/p>)/)\n if !self.content.match(reg).nil?\n return self.content.match(reg).captures[0].gsub(/<[a-z]{1,}[^>]*>|<\\/[a-z]>/,'').truncate(length)\n end\n # Else, strip HTML and truncate\n return self.content.gsub(/<[a-z]{1,}[^>]*>|<\\/[a-z]>/, '').truncate(length)\n end",
"def shortened_tweet_truncator(tweet)\n shortened_tweet = selective_tweet_shortener(tweet)\n if tweet.length < 140 \n tweet\n elsif\n shortened_tweet.length > 140 \n shortened_tweet[0...140-3] + \"...\" \n else\n shortened_tweet\nend\nend",
"def summary\n\t\tsummary = \"\"\n\t\tget = @text.split(/ /)\n\t\tget.each_index do |word|\n\t\t\tsummary << get[word] << \" \" if word < 10\n\t\tend\n\t\tsummary.strip\n\tend",
"def teaser(text, options = {})\n options.reverse_merge!(:length => 150, :omission => '...')\n format = options.delete(:format) if options[:format]\n truncate(strip_tags(to_html(text.to_s, format)).strip, options)\n end",
"def generate_teaser(text, length=180)\n return '' if text.blank?\n teaser = ''\n\n stripped_body = ActionController::Base.helpers.strip_tags(text)\n .gsub(\" \",\" \").gsub(/\\r/,'').strip\n\n stripped_body.match(/^.+/) do |match|\n first_paragraph = match[0]\n\n if first_paragraph.length <= length\n teaser = first_paragraph\n else\n shortened_paragraph = first_paragraph.match(/\\A.{#{length}}[^\\.]*\\.?/)\n\n teaser = if shortened_paragraph\n \"#{shortened_paragraph[0]}\"\n else\n first_paragraph\n end\n end\n end\n\n teaser\n end",
"def truncate_without_splitting_words(text, length = 50, ellipsis = true)\n truncated_result = ''\n remaining_length = length\n stop = false\n truncated = false\n # lines\n text.split(\"\\n\").each do |l|\n # words\n l.split(' ').each do |w|\n # If we're going to go over the length, and we've not already\n if (remaining_length - w.length) <= 0 && !stop\n truncated = true\n stop = true\n # Decide if adding or leaving out the last word puts us closer to the desired length\n if (remaining_length - w.length).abs < remaining_length.abs\n truncated_result += (w + ' ')\n end\n elsif !stop\n truncated_result += (w + ' ')\n remaining_length -= (w.length + 1)\n end\n end\n truncated_result += \"\\n\"\n end\n # Need some kind of whitespace before elipses or auto-link breaks\n html = truncated_result.strip + (truncated && ellipsis ? \"\\n...\" : '')\n html.html_safe\n end",
"def truncated_content\n\t\tid.to_s+\" - \"+content.truncate(50,{omission: '...'})\n end",
"def shorten_description(description,text_length)\n description.length>text_length ? description.slice(0,text_length)+\"...\" : description\n end",
"def preview_text(maxlength = 30)\n return \"\" if description.blank?\n my_contents = description[\"contents\"]\n return \"\" if my_contents.blank?\n content_flagged_as_preview = my_contents.select { |a| a[\"take_me_for_preview\"] }.first\n if content_flagged_as_preview.blank?\n content_to_take_as_preview = my_contents.first\n else\n content_to_take_as_preview = content_flagged_as_preview\n end\n preview_content = self.contents.select { |content| content.name == content_to_take_as_preview[\"name\"] }.first\n return \"\" if preview_content.blank? || preview_content.essence.blank?\n text = preview_content.essence.preview_text(maxlength)\n text.size > maxlength ? \"#{text[0..maxlength]}...\" : text\n end",
"def getPostDescription article\n\t\treturn article.gsub(/<[^>]*>/,'').gsub(/ /,' ').slice(0,60)+'...'\n\tend",
"def summary(content)\n content[0, content.index('<!-- more -->') || content.length]\nend",
"def sentence_wrap_once!(length)\n md = /^(.{0,#{length-1}}[^\\?\\.!])(?:([\\?\\.!]+) +|$)(.*)$/.match(self)\n if md\n first,punct,remainder = md.captures\n first << punct if punct\n replace(remainder)\n else\n first = word_wrap_once!(length-3) + '...'\n end\n first\n end",
"def shorten(text, chars=20)\n text.length > chars ? \"#{text[0..chars-3]}...\" : text\n end",
"def truncate_paragraph(long_str, num_characters, truncated_indicator=\"...\")\nend",
"def scrollspy_item(text)\n text.length > LIMIT ? text[0..LIMIT].split(\" \")[0..-2].join(' ') << '...' : text\n end",
"def truncated_content\n\t\t\tid.to_s+\" - \"+content.truncate(50,{omission: '...'})\n\t end",
"def condenseString(text)\n condensed = strip_tags( markdown text )\n if(condensed.length > 300)\n condensed = condensed[0...299] + \"...\"\n end\n sanitize condensed\n end",
"def shortened_tweet_truncator(tweet)\n\n if tweet.length <= 140\n tweet\n else\n word_substituter(tweet)[0..136] + \"...\"\n end\nend",
"def tweetable_title\n title.size > 119 ? title[0,116] + \"...\" : title\n end",
"def short_description\n\t\tself.description[0..200] + '...'\n\tend",
"def display_truncated_text(text, options)\n truncate_options = {:length => options.delete(:length), :whitespace => options.delete(:whitespace)}\n any_hidden = false\n\n options = {\n :block_tag => \"p\",\n :more => \"\\xE2\\x80\\xA6\", # Ellipsis character in UTF-8\n :truncated_text => {:class => 'truncated'}\n }.merge(options)\n\n if options[:truncated_text].kind_of?(Hash) && options[:truncated_text][:class]\n truncated_attributes = \" class=\\\"#{options[:truncated_text][:class]}\\\"\"\n end\n\n truncate_text(text, truncate_options) do |visible, hidden|\n any_hidden ||= hidden.present?\n {\n :visible => !visible.empty?,\n :html => [\n html_escape(visible),\n (!visible.empty? || hidden.blank?) ? nil : html_escape(hidden),\n ( visible.empty? || hidden.blank?) ? nil : (\n truncated_attributes ? \"<span#{truncated_attributes}>#{html_escape(hidden)}</span>\" : nil\n )\n ].compact\n }\n\n end.tap do |blocks|\n if any_hidden && options[:more]\n last_visible_html = blocks.select{|block| block[:visible] }.last[:html]\n if truncated_attributes\n last_visible_html.insert(1, \"<a href=\\\"#\\\" class=\\\"expand-truncated\\\">#{html_escape(options[:more])}</a>\")\n else\n last_visible_html.insert(1, html_escape(options[:more]))\n end\n end\n\n end.map do |block|\n if block[:visible]\n if options[:block_tag]\n \"<#{options[:block_tag]}>#{block[:html].join}</#{options[:block_tag]}>\"\n else\n block[:html].join\n end\n elsif options[:block_tag] && truncated_attributes\n \"<#{options[:block_tag]}#{truncated_attributes}>#{block[:html].join}</#{options[:block_tag]}>\"\n end\n end.compact.join\n end",
"def wrap(body)\n separator = \" \"\n words = body.split(separator)\n sentences = []\n sentence = []\n words.each do |word|\n sentence.push(word)\n if (sentence).join(separator).length > 75\n sentence.pop\n sentences.push(sentence.join(separator))\n sentence = [word]\n end\n end\n if sentence.length > 0\n sentences.push(sentence.join(separator))\n end\n sentences.join(\"\\n\")\nend",
"def shortened_tweet_truncator(tweet)\n short = word_substituter(tweet)\n if short.length > 140\n short[0..139]\n else\n short\n end\nend",
"def cap_text(text, limit)\n if text.length > limit then\n return text[0..limit-2] + \"…\"\n end\n\n return \"%-#{limit}s\" % text\nend",
"def full_info number \n\t\tshort_text = description.split(\"<br>\")[0][0..59]\n\t\tshort_text = short_text + \"...\" if short_text.length == 60\n\t\t\"#{number}. #{short_text}\"\n\tend",
"def preview_body(max_length=400)\n max_length -= 3 # Account for three dots\n body[0..max_length].gsub(/\\s\\w+\\s*$/,'...')\n end",
"def teaser_text\n\t\t# assumption: html_content always starts with '<section>'\n\t\t# therefore I will find the content of the next '<section>'\n\t\t# by starting our search at position 8\n\t\tintro_starting_index = self.html_content.index('<section>', 8)\n\t\t# but of course we don't want to include '<section>' in our\n\t\t# teaser text, so lets add 9 to this (length of '<section>')\n\t\tintro_starting_index += 9\n\t\t# ... and the index of the closing tag is\n\t\tintro_ending_index = self.html_content.index('</section>', intro_starting_index)\n\t\t# so here's our teaser, which will be '...' via css in cases\n\t\t# where it's longer than the space available\n\t\tteaser = self.html_content[intro_starting_index...intro_ending_index]\n\t\tteaser = teaser[0..240] if teaser.length > 240\n\t\t\"#{teaser}...\"\n\tend",
"def teaser_text\n\t\t# assumption: html_content always starts with '<section>'\n\t\t# therefore I will find the content of the next '<section>'\n\t\t# by starting our search at position 8\n\t\tintro_starting_index = self.html_content.index('<section>', 8)\n\t\t# but of course we don't want to include '<section>' in our\n\t\t# teaser text, so lets add 9 to this (length of '<section>')\n\t\tintro_starting_index += 9\n\t\t# ... and the index of the closing tag is\n\t\tintro_ending_index = self.html_content.index('</section>', intro_starting_index)\n\t\t# so here's our teaser, which will be '...' via css in cases\n\t\t# where it's longer than the space available\n\t\tteaser = self.html_content[intro_starting_index...intro_ending_index]\n\t\tteaser = teaser[0..240] if teaser.length > 240\n\t\t\"#{teaser}...\"\n\tend",
"def shortened_tweet_truncator(tweet)\n if word_substituter(tweet).length <= 140\n word_substituter(tweet)\n else\n word_substituter(tweet)[0..136] << \"...\" \n end\nend",
"def shortened_tweet_truncator(tweet_string)\n if tweet_string.length > 140\n tweet_string[0..136] + \"...\"\n else\n tweet_string\n end\nend",
"def short_text_display content, path\n text = ((content.length > 90) ? HTML_Truncator.truncate(content, 3) : content )\n ((content.length > text.length) ? (text + \"<a href='#{path}' class='btn-link'> (more) </a>\") : text).html_safe\n end",
"def trim_post content\n line = ''\n counter = 1\n words = content.split(/ /)\n \n # we break before 272 leaving space for cw and break in case it's needed\n while not words.empty? and not too_long?(line)\n line += \" #{words.shift}\"\n end\n \n return line.strip, words.join(' ')\n end",
"def string_sentence(str, num)\n if str.length > num\n if num <= 3\n return str[0..num - 1] << \"...\"\n end\n return str[0..num - 4] << \"...\"\n end\nend",
"def list_title(n=40)\n st = name[0..n].to_s\n st += \"...\" unless name.length <= n\n st\n end",
"def word_break(word)\n if word.length > 10\n content_tag :abbr, truncate(word, :length => 10), :title => word\n else\n word\n end\n end",
"def fold_paragraph(paragraph, max_width)\n # Gradually build our output\n str, *rest = paragraph\n width = str.length\n\n rest.each do |word|\n if width + word.length + 1 <= max_width\n str << ' ' << word\n width += word.length + 1\n else\n str << \"\\n\" << word\n width = word.length\n end\n end\n\n str\nend",
"def render_truncated_description(args)\n truncated_output = String.new\n content_tag :div, class: 'truncate-description' do\n description = args[:value].first\n button = \"<span class='view-more' href>Read More <div class='down-arrow'>»</div></span></br>\"\n truncated_output << \"<div class='description'>#{description}</div>#{button}</br>\"\n # return truncated_output.html_safe\n return description\n end\n end",
"def shortened_tweet_truncator(tweet)\n shortened_tweet = selective_tweet_shortener(tweet)\n tweet_w_ellipses = \"\"\n char_array = []\n\n if shortened_tweet.length > 140\n shortened_tweet = shortened_tweet[0..136] + \"...\"\n else\n return shortened_tweet\n end\nend",
"def excerpt(text, phrase, options = T.unsafe(nil)); end",
"def truncated_text_with_hover text, args = {:truncate => 40}\n \"<div title='#{text.length > args[:truncate] ? text : nil}'>#{text.truncate(args[:truncate])}</div>\".html_safe\n end",
"def shortened_tweet_truncator(tweet)\n if tweet.length < 140\n tweet\n else\n word_substituter(tweet)[0...140]\n end\nend",
"def display_snippet(content)\n content = display_full(content)\n\n # If our entire post fits in the snippet, just parse the HTML and return it.\n return content if content.length <= MINIMUM_CHARS_FOR_PREVIEW\n \n\n first_part = content[0...MINIMUM_CHARS_FOR_PREVIEW]\n remainder = content[MINIMUM_CHARS_FOR_PREVIEW..-1]\n (first_part + remainder.split(\"</p>\").first + \"</p>\")\n\n end",
"def excerpt(input)\n if input.index(/<!--\\s*more\\s*-->/i)\n input.split(/<!--\\s*more\\s*-->/i)[0]\n else\n input\n end\n end",
"def excerpt(input)\n if input.index(/<!--\\s*more\\s*-->/i)\n input.split(/<!--\\s*more\\s*-->/i)[0]\n else\n input\n end\n end",
"def wrap(num_lines)\n cleaned = gsub(/\\s+/, ' ').strip\n\n chars_per_line = cleaned.size / num_lines.to_f\n\n lines = []\n cleaned.split.each do |word|\n if lines.empty?\n lines << word\n else\n if (lines[-1].size + 1 + word.size) <= chars_per_line ||\n lines.size >= num_lines\n lines[-1] << ' ' unless lines[-1].empty?\n lines[-1] << word\n else\n lines << word\n end\n end\n end\n\n Caption.new(lines.join(\"\\n\"))\n end",
"def truncated_content_tag(element, text, opts = {})\n return '' if text.blank?\n\n length = opts.delete(:length) || 25\n opts.reverse_merge!(:title => text, :alt => :text)\n content_tag element, truncate(text, :length => length), opts\n end",
"def truncate_from_end(text)\n return text if text.blank? || text.size <= 20\n \n \"...#{text[-20, 20]}\"\n end",
"def truncate_from_end(text)\n return text if text.blank? || text.size <= 20\n \n \"...#{text[-20, 20]}\"\n end",
"def top_3_words(text)\n text.gsub(\"\\n\", \" \")\n .split(\" \")\n .map(&:downcase)\n .map(&sanitize)\n .reject(&empty)\n .reject(&no_letters)\n .reduce({}, &top_word)\n .sort_by(&word_count)\n .reverse\n .take(3)\n .map(&:first)\nend",
"def to_teaser(length=20)\n # Remove HTML\n cleaned = gsub(/<\\/?[^>]*>/, \"\").split(\" \")\n\n # If the given string is over the given length at the `...' punctuation otherwise leave as is\n if (cleaned.size > length)\n # Join it, chomp off trailing `.'s and `,'s and at the ending\n cleaned[0..(length-1)].join(\" \").chomp(\".\").chomp(\",\") + \" …\"\n else\n cleaned.join(\" \")\n end\n \n end",
"def get_content_string(content)\n\t\tif (content.length > 200) then\n\t\t\treturn content[0, 200] + \"...\"\n\t\telse\n\t\t\treturn content\n\t\tend\n\tend",
"def secondary_description\n first_long_paragraph = parsed_document.search('//p[string-length() >= 120]').first\n first_long_paragraph ? first_long_paragraph.text : ''\n end"
] |
[
"0.7057888",
"0.7000038",
"0.6959024",
"0.6905326",
"0.6837792",
"0.68131495",
"0.6607022",
"0.6546468",
"0.65408176",
"0.6535372",
"0.65225637",
"0.65146345",
"0.6496327",
"0.64756733",
"0.6463349",
"0.6419969",
"0.6384793",
"0.6380042",
"0.6349158",
"0.6307467",
"0.6292589",
"0.6254117",
"0.62490666",
"0.62442505",
"0.6225937",
"0.62177235",
"0.6217339",
"0.61846524",
"0.61794007",
"0.6173647",
"0.6168674",
"0.61495787",
"0.6139278",
"0.61343116",
"0.6132995",
"0.61315954",
"0.6130789",
"0.612791",
"0.61194694",
"0.6111709",
"0.61107177",
"0.6105293",
"0.608531",
"0.60820895",
"0.60675925",
"0.60597515",
"0.60412335",
"0.60263187",
"0.6022658",
"0.60219485",
"0.6018482",
"0.59965026",
"0.5996085",
"0.5993233",
"0.59786767",
"0.5978018",
"0.5976844",
"0.59695935",
"0.59623057",
"0.5961061",
"0.59554297",
"0.5944911",
"0.5944738",
"0.5923184",
"0.59225345",
"0.59162575",
"0.59156156",
"0.5899536",
"0.589643",
"0.5885849",
"0.587752",
"0.5875325",
"0.58710754",
"0.58703834",
"0.5862624",
"0.5862624",
"0.58574885",
"0.58555144",
"0.58553064",
"0.58466685",
"0.58283645",
"0.58264273",
"0.582511",
"0.5807767",
"0.5807431",
"0.58070064",
"0.58023906",
"0.5778335",
"0.57734066",
"0.576865",
"0.5758655",
"0.5758655",
"0.5752945",
"0.57452875",
"0.57403094",
"0.57403094",
"0.5735964",
"0.57341176",
"0.57294285",
"0.57277703"
] |
0.7083525
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_acuerdo_acceso_interconexion
@acuerdo_acceso_interconexion = AcuerdoAccesoInterconexion.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 set_actions\n actions :all\n end",
"def define_action_helpers?; 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_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def 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 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 action\n end",
"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 after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def around_hooks; 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 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 setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def call\n setup_context\n super\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 shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622",
"0.5309231",
"0.5296901",
"0.529641",
"0.5296097",
"0.5258364",
"0.5242683",
"0.5236372",
"0.5236372",
"0.5236372",
"0.5236372",
"0.5236372",
"0.52346426",
"0.52320486",
"0.5225926",
"0.52210605",
"0.52171826",
"0.52138335",
"0.5207914",
"0.52069265",
"0.5176269",
"0.5174653",
"0.51730466",
"0.51650184",
"0.5161409",
"0.5156175",
"0.5154185",
"0.5151096",
"0.5151089",
"0.51452935",
"0.5138662",
"0.51339483",
"0.5113475",
"0.51132",
"0.51132",
"0.5108031",
"0.51075375",
"0.5090693",
"0.50892115",
"0.5081523",
"0.5081454",
"0.5064919",
"0.50545585",
"0.50531805",
"0.50501585",
"0.50501585",
"0.50329936",
"0.5024674",
"0.50203156",
"0.50156844",
"0.50149846",
"0.50011337",
"0.4999346",
"0.49984375",
"0.4988749",
"0.4988749",
"0.49842322",
"0.49800175",
"0.4979922",
"0.49791628",
"0.49666047",
"0.49655434",
"0.49559638",
"0.49557537",
"0.49554902",
"0.4953974",
"0.49519545",
"0.49449277",
"0.49440357",
"0.49329734",
"0.49315402",
"0.49261367",
"0.4925912",
"0.4925598",
"0.4924306",
"0.49202663",
"0.49167567",
"0.49164373",
"0.4915191",
"0.49145022",
"0.49140996"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def acuerdo_acceso_interconexion_params
unless params[:acuerdo_acceso_interconexion].empty?
params.require(:acuerdo_acceso_interconexion).permit(:titulo_acuerdo, :fecha_validez_acuerdo, :anexos, :adendas, :nota, asiento_attributes: [:id, :acto_id, :acto_type, :_destroy, :num_asiento, :num_asiento_original, :acto_inscribible, :tipo_asiento, :tipo_inscripcion, :numero_resolucion, :nombre_resolucion,:titulo_resolucion, :fecha_resolucion, :fecha_solicitud, :nombre_operador, :identificacion_operador, :cedula_representante_legal, :nombre_representante_legal, :usuario, :enlace_documento, :num_expediente_sutel, :operadorregulado_id, :vigencia2 ], servicios_interconexion_attributes: [:servicio, :precio_interconexion, :sci_servicios_id, :id], operadores_acuerdo_acceso_interconexions_attributes: [:operador_regulados_id, :nombre_operador, :identificacion_operador, :nombre_representante_legal, :cedula_representante_legal, servicios_operadores_acuerdo_acceso_interconexions_attributes: [:precio_interconexion, :sci_servicios_id]])
end
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
|
print documentation, use like this; ri 'Arraypop' Array.ri Array.ri :pop arr.ri :pop
|
def ri(method = nil)
unless method && method =~ /^[A-Z]/ # if class isn't specified
klass = self.kind_of?(Class) ? name : self.class.name
method = [klass, method].compact.join('#')
end
system 'ri', method.to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def \n \n using_pop(array)\n \n\n array.pop()\n \nend",
"def using_pop(array)\n array.pop()\nend",
"def using_pop(arr)\n arr.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def pop\r\n @arr.shift\r\n end",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n array.pop\nend",
"def using_pop(array)\n element = array.pop\n element\nend",
"def using_pop (array)\n return array.pop\nend",
"def \n \n pop_with_args(array)\n # {...}(pop_x_times)\n\n\n array.pop(2)\n \n \n #-X-\n # array.pop()\n # array.pop()\n \nend",
"def using_pop(array)\n array = array.pop(1)\n array.pop\n\n\nend",
"def pop_with_args(array)\n array.pop(2)\n end",
"def pop\r\n # What does array.pop do? It takes the last \r\n # item of a list. We want this method to return\r\n # the last item. So maybe we can do something like:\r\n # return @data.last\r\n end",
"def pop; end",
"def pop; end",
"def pop; end",
"def pop; end",
"def pop; end",
"def pop_from_array(arr)\n arr.size.times do\n puts arr.pop\n end\nend",
"def pop_with_args(array,numb = 2)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2);\nend",
"def pop\n end",
"def pop_with_args(array)\narray = array.pop(2)\narray.pop(2)\nend",
"def pop() end",
"def pop\n @a.pop\n end",
"def pop_from_array(arr)\n l=arr.length\n l.each do\n num=arr.pop\n puts \"#{num} is removed!\"\n end\nend",
"def pop\r\n # IMPLEMENT ME\r\n end",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(array)\n array.pop(2)\nend",
"def pop_with_args(arr)\n arr.pop(2)\nend",
"def pop()\n v, _ = @array.pop\n v\n end",
"def pop()\n \n end",
"def pop()\n \n end",
"def pop()\n \n end",
"def pop_with_args (array)\n return array.pop(2)\nend",
"def pop_with_args(array)\n array = array.pop(2)\n array.pop(2)\n \nend",
"def pop\n # IMPLEMENT ME\n end",
"def stack_as_array\n puts \"Stack as array: \"\n arr = [1,3,4,5,6,7]\n print arr\n puts\n\n puts \"Pop top element (7):\"\n puts arr.pop\n print arr\n puts\n\n puts \"Push element (8):\"\n arr.push(8)\n print arr\n puts\n puts\nend",
"def test_mutate_array_pop\n numbers = [1, 2, 3, 4]\n output = capture_io do\n numbers.each do |number|\n p number\n numbers.pop(1)\n end\n end\n assert_equal [\"1\\n2\\n\", \"\"], output\n assert_equal [1, 2], numbers\n=begin\nthis follows the same pattern as the last example but since\nelements are take from the back end of the array, the first\ntwo p statement do print the first two elements of the array.\nafter 2 pop operations the array index exceeds the index of\nthe last element in the array.\n=end\n end",
"def mutate(arr)\n arr.pop\n end",
"def popd\n\t\t\tpush [:pop]\n\t\t\tdip\n\t\tend",
"def pop \r\n @data.pop\r\n end",
"def pop\n @ivar.pop \n end",
"def brpop(*args); end",
"def brpop(*args); end",
"def remove_item(elective_array)\n elective_array.pop\n puts elective_array\nend",
"def pop\n @mut.synchronize{@array.sort!.pop}\n end",
"def op_pop(n = nil)\n pop(n)\n end",
"def pop\n\n outlen_op(:tclistpop)\n end",
"def pop\n \tnode = @array[-1]\n \t@array.delete_at(-1) \n \t@array[-1].next_node = nil unless @array.count == 1 \n\tputs \"J'ai supprimé le node : #{node.value}\"\n end",
"def test_pushing_and_popping_arrays\n array = [1,2]\n array.push(:last)\n\n assert_equal [1, 2, :last], array\n\n popped_value = array.pop\n assert_equal :last, popped_value\n assert_equal [1, 2], array\n end",
"def brpop(*args)\n _bpop(:brpop, args)\n end",
"def brpop(*args)\n _bpop(:brpop, args)\n end",
"def pop()\n @data.pop\n end",
"def pop()\n (@arr1.size-1).times { @arr2.push(@arr1.shift) }\n result = @arr1.shift\n @arr1, @arr2 = @arr2, @arr1\n result\n end",
"def -(arr)\n raise 'Not Implemented'\n end",
"def pop\n raise NotImplementedError\n end",
"def pop\n delete_at(0)\n end",
"def pop\n peek\n\n @out.pop\n end",
"def pop\n raise 'No such element' if @elements.length == 0\n @elements.slice!(-1)\n end",
"def mutate(array)\n array.pop \nend",
"def pop(pops)\n view.update_many(\"$pop\" => collect_operations(pops))\n end",
"def pop_stack\n raise ArgumentError if @array_list.empty?\n\n @array_list.pop\n end",
"def delete\n @array_roses.pop\nend",
"def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end",
"def pop # utility\n @stack.pop\n end",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def pop\n @instructions << Instruction.new(:pop)\n self\n end",
"def pop\n\t\tremove(@length - 1)\n\tend",
"def pop\n @obj.pop\n end",
"def pop\n raise StackUnderflow if empty?\n @index -= 1\n @info[@index]\n end",
"def pop\n @tape.pop()\n end",
"def pop\n @data.delete_at @data.length - 1 if @data.length > 0\n end",
"def eliminar_ult_elem_arr(arreglo)\n arreglo.pop\n arreglo\nend",
"def blpop(*args)\n _bpop(:blpop, args)\n end",
"def %\n pop\n end",
"def blpop(*args)\n _bpop(:blpop, args)\n end"
] |
[
"0.7563825",
"0.73930633",
"0.7309735",
"0.73064196",
"0.7291879",
"0.72710735",
"0.72372276",
"0.72372276",
"0.72372276",
"0.72372276",
"0.72372276",
"0.72372276",
"0.72372276",
"0.72372276",
"0.72372276",
"0.7197551",
"0.7041456",
"0.6908693",
"0.68627924",
"0.68513554",
"0.6815353",
"0.68002784",
"0.68002784",
"0.68002784",
"0.68002784",
"0.68002784",
"0.67967117",
"0.6611105",
"0.6588636",
"0.6587472",
"0.65834445",
"0.6530693",
"0.6520768",
"0.65128875",
"0.6505472",
"0.64727443",
"0.64727443",
"0.64625376",
"0.64625376",
"0.64625376",
"0.64625376",
"0.64625376",
"0.64625376",
"0.64625376",
"0.6449121",
"0.6447872",
"0.6438174",
"0.6438174",
"0.6438174",
"0.6428621",
"0.63731015",
"0.634162",
"0.6313502",
"0.62167525",
"0.62039155",
"0.61879474",
"0.6179419",
"0.61451834",
"0.613712",
"0.613712",
"0.6121475",
"0.60867774",
"0.60632455",
"0.6048916",
"0.6048012",
"0.60362744",
"0.6025663",
"0.6007125",
"0.6000772",
"0.5998107",
"0.59902775",
"0.5987248",
"0.5946741",
"0.5934947",
"0.59287226",
"0.5921333",
"0.5858565",
"0.58541214",
"0.5852603",
"0.5833686",
"0.58237314",
"0.5797594",
"0.5797594",
"0.5797594",
"0.5797594",
"0.5797594",
"0.5797594",
"0.5797594",
"0.5797594",
"0.5797594",
"0.5797594",
"0.5795643",
"0.57898855",
"0.57694864",
"0.57646435",
"0.5747846",
"0.5742299",
"0.5736247",
"0.57229346",
"0.5710639",
"0.5690728"
] |
0.0
|
-1
|
general Postfix server options: c master.cf chroot is y, so this process should chroot to queue_directory. d not daemon mode D debug mode i set max_idle= l master.cf maxproc is 1 m set max_use= n name master.cf service name o param=value param=value s number of server sockets S stdin stream mode t type master.cf service type (inet, unix, pass) u master.cf unpriv is y, so this process should setuid to mail_owner. v verbose mode V message to stderr z master.cf maxproc is 0 This library support only 's', 'i', 'm' option.
|
def parse_args
@args.extend OptionParser::Arguable
opts = @args.getopts('cdDi:lm:n:o:s:St:uvVz')
@nsocks = opts['s'] ? opts['s'].to_i : 1
@max_idle = opts['i'] ? opts['i'].to_i : DEFAULT_MAX_IDLE
@max_use = opts['m'] ? opts['m'].to_i : DEFAULT_MAX_USE
$VERBOSE = true if opts['v']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setup_options\n @options = {\n :min_threads => 0,\n :max_threads => 16,\n :quiet => false,\n :debug => false,\n :binds => [],\n :workers => 0,\n :daemon => false,\n :before_worker_shutdown => [],\n :before_worker_boot => [],\n :before_worker_fork => [],\n :after_worker_boot => []\n }\n\n @parser = OptionParser.new do |o|\n o.on \"-b\", \"--bind URI\", \"URI to bind to (tcp://, unix://, ssl://)\" do |arg|\n @options[:binds] << arg\n end\n\n o.on \"-C\", \"--config PATH\", \"Load PATH as a config file\" do |arg|\n @options[:config_file] = arg\n end\n\n o.on \"--control URL\", \"The bind url to use for the control server\",\n \"Use 'auto' to use temp unix server\" do |arg|\n if arg\n @options[:control_url] = arg\n elsif jruby?\n unsupported \"No default url available on JRuby\"\n end\n end\n\n o.on \"--control-token TOKEN\",\n \"The token to use as authentication for the control server\" do |arg|\n @options[:control_auth_token] = arg\n end\n\n o.on \"-d\", \"--daemon\", \"Daemonize the server into the background\" do\n @options[:daemon] = true\n @options[:quiet] = true\n end\n\n o.on \"--debug\", \"Log lowlevel debugging information\" do\n @options[:debug] = true\n end\n\n o.on \"--dir DIR\", \"Change to DIR before starting\" do |d|\n @options[:directory] = d.to_s\n @options[:worker_directory] = d.to_s\n end\n\n o.on \"-e\", \"--environment ENVIRONMENT\",\n \"The environment to run the Rack app on (default development)\" do |arg|\n @options[:environment] = arg\n end\n\n o.on \"-I\", \"--include PATH\", \"Specify $LOAD_PATH directories\" do |arg|\n $LOAD_PATH.unshift(*arg.split(':'))\n end\n\n o.on \"-p\", \"--port PORT\", \"Define the TCP port to bind to\",\n \"Use -b for more advanced options\" do |arg|\n @options[:binds] << \"tcp://#{Configuration::DefaultTCPHost}:#{arg}\"\n end\n\n o.on \"--pidfile PATH\", \"Use PATH as a pidfile\" do |arg|\n @options[:pidfile] = arg\n end\n\n o.on \"--preload\", \"Preload the app. Cluster mode only\" do\n @options[:preload_app] = true\n end\n\n o.on \"--prune-bundler\", \"Prune out the bundler env if possible\" do\n @options[:prune_bundler] = true\n end\n\n o.on \"-q\", \"--quiet\", \"Quiet down the output\" do\n @options[:quiet] = true\n end\n\n o.on \"-R\", \"--restart-cmd CMD\",\n \"The puma command to run during a hot restart\",\n \"Default: inferred\" do |cmd|\n @options[:restart_cmd] = cmd\n end\n\n o.on \"-S\", \"--state PATH\", \"Where to store the state details\" do |arg|\n @options[:state] = arg\n end\n\n o.on '-t', '--threads INT', \"min:max threads to use (default 0:16)\" do |arg|\n min, max = arg.split(\":\")\n if max\n @options[:min_threads] = min\n @options[:max_threads] = max\n else\n @options[:min_threads] = 0\n @options[:max_threads] = arg\n end\n end\n\n o.on \"--tcp-mode\", \"Run the app in raw TCP mode instead of HTTP mode\" do\n @options[:mode] = :tcp\n end\n\n o.on \"-V\", \"--version\", \"Print the version information\" do\n puts \"puma version #{Puma::Const::VERSION}\"\n exit 1\n end\n\n o.on \"-w\", \"--workers COUNT\",\n \"Activate cluster mode: How many worker processes to create\" do |arg|\n @options[:workers] = arg.to_i\n end\n\n o.on \"--tag NAME\", \"Additional text to display in process listing\" do |arg|\n @options[:tag] = arg\n end\n\n o.banner = \"puma <options> <rackup file>\"\n\n o.on_tail \"-h\", \"--help\", \"Show help\" do\n log o\n exit 1\n end\n end\n end",
"def default_master_server_arguments(port, date)\n {\n :sid => '1',\n :thnum => '16',\n :format => 'tch',\n :bnum => '503316469',\n :apow => '11',\n :fpow => '18',\n :ncnum => '6000000',\n :xmsiz => '1073741824',\n :opts => 'lb',\n :slave => false,\n :date => date.strftime('%Y%m'),\n :port => port\n }\n end",
"def options_setting\n if OPTS[:s] then @@server = OPTS[:s] else @@server = SERVER end\n if OPTS[:p] then @@port = OPTS[:p].to_i else @@port = PORT.to_i end\n if OPTS[:n] then @@nick = OPTS[:n] else @@nick = NICK end\n\n # channel character (no # or head #)\n if OPTS[:c] then\n channel = OPTS[:c]\n if channel.start_with?(\"#\") == false then\n @@channel = \"#\" + channel\n else\n @@channel = channel\n end\n else\n @@channel = \"\"\n end\n if OPTS[:t] then @@topic = OPTS[:t] else @@topic = \"\" end\n end",
"def default_config_options\n ini_data = {\n supervisord: config,\n supervisorctl: {},\n 'rpcinterface:supervisor' => {'supervisor.rpcinterface_factory' => 'supervisor.rpcinterface:make_main_rpcinterface'},\n 'include' => {files: ::File.join(confd_path, '*.conf') },\n }\n # Are we using unix or inet?\n if ctl_is_inet?\n # Either numeric or IP/port, means inet.\n ini_data[:inet_http_server] = {port: ctl_listen}\n ini_data[:inet_http_server][:password] = ctl_password if ctl_password\n ini_data[:inet_http_server][:username] = ctl_username if ctl_username\n ini_data[:supervisorctl][:serverurl] = \"http://#{@ctl_bind_host}:#{@ctl_bind_port}\"\n else\n # Otherwise, Unix sockets.\n ini_data[:unix_http_server] = {file: ctl_listen}\n ini_data[:unix_http_server][:password] = ctl_password if ctl_password\n ini_data[:unix_http_server][:username] = ctl_username if ctl_username\n # Maybe deal with chmod somehow? Defaults are safe I think.\n if owner\n chown = owner.dup\n if group\n chown << ':'\n chown << group\n end\n ini_data[:unix_http_server][:chown] = chown\n end\n ini_data[:supervisorctl][:serverurl] = \"unix://#{ctl_listen}\"\n end\n ini_data[:supervisorctl][:password] = ctl_password if ctl_password\n ini_data[:supervisorctl][:username] = ctl_username if ctl_username\n {ini: ini_data}\n end",
"def configure_server(options = T.unsafe(nil)); end",
"def get_options\n ARGV.options { |opt|\n opt.banner = \"Usage: ruby #{__FILE__} [options] ipv6addr port\"\n\n opt.on(\"--help\", \"What you see right now\"){ puts opt; exit 0}\n\n opt.on(\"--doc=DIRECTORY\", String, \"Output rdoc (Ruby HTML documentation) into directory\"){|dir|\n system(\"rdoc -o #{dir} #{__FILE__}\")\n }\n\n opt.on(\"--verbose\", \"-v\", \"print space separated timestamps to STDOUT\"){|@verbose|}\n\n opt.on(\"--interval=FLOAT\", \"-i\", Float, \"approximate interval to send packets at will sleep for this many seconds before sending. Not very accurate when doing less than 0.01. Will divide interval by 1000 when < 0.01 (inteval of 0.001 effective to reduce send interval to less than 0.01 but suddenly jumps up to 0.00005 and 100% cpu time) Probably need proper scheduling besides sleep to get better accuracy\"){|@interval|\n puts \"using interval of #{@interval}\" if not @verbose\n }\n\n opt.on(\"--data=STRING\", \"-d\", String, \"payload to send (by default sends timestamp\",\n \"like this #{Time.now().to_f})\"){|@payload|\n @use_payload = true\n puts \"using payload of #{@payload}\" if not @verbose\n }\n\n opt.on(\"-r\", \"Receive mode \"){|@receive|}\n\n opt.on_tail(\"default port is #{@port}\")\n opt.parse!\n } or exit(1);\n\n if @quit\n pp self\n (print ARGV.options; exit)\n end\n\n raise \"Missing host from the commandline.\" if ARGV.size < 1\n\n @host = ARGV.shift\n\n @port = ARGV.shift if not ARGV.empty?\n\n end",
"def options(key)\n key = key.to_s.downcase\n disabled = 0\n enabled = key == 'sasl' ? 2 : 1\n node['postfix']['options'][key] ? enabled : disabled\nend",
"def process_options\n options = OpenStruct.new\n options.log = Logger::INFO\n options.daemonize = false\n begin\n OptionParser.new do |opts|\n opts.on(\"--debug\", \"Log all messages\") { |v| options.log = Logger::DEBUG }\n opts.on(\"--info\", \"Log all messages\") { |v| options.log = Logger::INFO }\n opts.on(\"--warn\", \"Log all messages\") { |v| options.log = Logger::WARN }\n opts.on(\"--error\", \"Log all messages\") { |v| options.log = Logger::ERROR }\n opts.on(\"--fatal\", \"Log all messages\") { |v| options.log = Logger::FATAL }\n opts.on(\"--daemonize\", \"Run as system daemon\") { |v| options.daemonize = true }\n end.parse!\n rescue OptionParser::InvalidOption => e\n LOG.warn(\"%06d\"%Process::pid) {\"#{e.inspect}\"}\n end\n options\n end",
"def server_flags; end",
"def parse_options\n options = Trollop::options do\n version VERSION\n banner <<-EOS\nPostwhite is a policy server for Postfix MTA which filters incoming emails\nbased on per recipient whitelists managed by an email frontend.\n\nDocumentation:\n http://www.bitcetera.com/products/postwhite\n\nUsage:\n postwhite [options] {#{Postwhite::COMMANDS.join('|')}}\n\nOptions:\n EOS\n opt :'audit', \"Write audit information to log\", :default => false\n opt :'config-dir', \"Directory containing the configuration files\", :default => '/etc/postfix/postwhite'\n opt :'debug', \"Write debug information to log\", :default => false\n opt :'detach', \"Detach the daemon\", :default => false\n opt :'prefix', \"Use this prefix for all paths\", :default => '/'\n opt :'quiet', \"Don't output anything\", :default => false\n opt :'user', \"Run the server as this user\", :default => 'postwhite'\n stop_on Postwhite::COMMANDS\n end\n options[:command] = ARGV[0]\n options\n end",
"def qmqp_server(i=0)\n return @options[:qmqp_server] if @options[:qmqp_server]\n dir = @options[:dir] || '/var/qmail'\n filename = \"#{dir}/control/qmqpservers\"\n return '127.0.0.1' unless File.exists?(filename)\n File.readlines(filename)[i].chomp\n end",
"def default_old_master_server_arguments(port, date)\n default_master_server_arguments(port, date).merge(:xmsiz => '268435456')\n end",
"def daemonopts()\n {\n :ontop => false,\n :backtrace => false,\n :dir_mode => :normal,\n :app_name => 'graphiteme',\n :dir => '/var/run/graphiteme/',\n :log_output => true,\n :log_dir => '/var/log/graphiteme/',\n }\nend",
"def get_opts()\n clopts = {}\n parser = OptionParser.new\n\n # :ack\n parser.on(\"-a\", \"--ack=ackmode\", String, \n \"Ack Mode (Default: auto)\") {|am| \n clopts[:ack] = am}\n\n # :userid\n parser.on(\"-u\", \"--user=LOGINID\", String, \n \"Server user id (Default: login)\") {|lid| \n clopts[:userid] = lid}\n\n # :password\n parser.on(\"-p\", \"--password=PASSWORD\", String, \n \"Server password (Default: passcode)\") {|pw| \n clopts[:password] = pw}\n\n # :host\n parser.on(\"-s\", \"--server=SERVERNAME\", String, \n \"Hostname of server (Default: localhost)\") {|host| \n clopts[:host] = host}\n\n # :port\n parser.on(\"-P\", \"--port=PORT\", Integer,\n \"Port number of server (Default: 51613)\") {|port| \n clopts[:port] = port}\n\n # Handle help if required\n parser.on(\"-h\", \"--help\", \"Show this message\") do\n puts parser\n exit\n end\n # Run the parse\n parser.parse(ARGV)\n # Return found options\n clopts \n end",
"def parse_global_options!(argv, env)\n semver = Ncio::VERSION\n host = Socket.gethostname\n cert_default = self.cert_default\n key_default = self.key_default\n Ncio::Trollop.options(argv) do\n stop_on_unknown\n version \"ncio #{semver} (c) 2016 Jeff McCune\"\n banner BANNER\n uri_dfl = env['NCIO_URI'] || \"https://#{host}:4433/classifier-api/v1\"\n opt :uri, 'Node Classifier service uri '\\\n '{NCIO_URI}', default: uri_dfl\n opt :cert, CERT_MSG, default: env['NCIO_CERT'] || cert_default\n opt :key, KEY_MSG, default: env['NCIO_KEY'] || key_default\n opt :cacert, CACERT_MSG, default: env['NCIO_CACERT'] || CACERT_DEFAULT\n log_msg = 'Log file to write to or keywords '\\\n 'STDOUT, STDERR {NCIO_LOGTO}'\n opt :logto, log_msg, default: env['NCIO_LOGTO'] || 'STDERR'\n opt :syslog, 'Log to syslog', default: true, conflicts: :logto\n opt :verbose, 'Set log level to INFO'\n opt :debug, 'Set log level to DEBUG'\n opt :retry_connections, 'Retry API connections, '\\\n 'e.g. waiting for the service to come online. '\\\n '{NCIO_RETRY_CONNECTIONS}',\n default: (env['NCIO_RETRY_CONNECTIONS'] == 'true') || false\n opt :connect_timeout, 'Retry <i> seconds if --retry-connections=true '\\\n '{NCIO_CONNECT_TIMEOUT}',\n default: env['NCIO_CONNECT_TIMEOUT'] || CONNECT_TIMEOUT_DEFAULT\n end\n end",
"def default_options\n {\n :description => '', # Name\n :type => 0, # 0 - Email, 1 - External script, 2 - SMS, 3 - Jabber, 100 - EzTexting\n :smtp_server => '',\n :smtp_helo => '',\n :smtp_email => '', # Email address of Zabbix server\n :exec_path => '', # Name of external script\n :gsm_modem => '', # Serial device name of GSM modem\n :username => '', # Jabber user name used by Zabbix server\n :passwd => '' # Jabber password used by Zabbix server\n }\n end",
"def options_build\n @prod_options = \"--port #{@prod_port} --log #{@prod_log} --pid #{@prod_pid} -e production -d\"\n @dev_options = \"--port #{@dev_port} --log #{@dev_log} --pid #{@dev_pid} -e development -d\"\nend",
"def tune_osx_nfs(options)\n nfs_file = \"/etc/nfs.conf\"\n nfs_params = ['nfs.server.nfsd_threads = 64\",\"nfs.server.reqcache_size = 1024\",\"nfs.server.tcp = 1\",\"nfs.server.udp = 0\",\"nfs.server.fsevents = 0']\n nfs_params.each do |nfs_tune|\n nfs_tune = \"nfs.client.nfsiod_thread_max = 64\"\n message = \"Information:\\tChecking NFS tuning\"\n command = \"cat #{nfs_file} |grep '#{nfs_tune}'\"\n output = execute_command(options,message,command)\n if not output.match(/#{nfs_tune}/)\n backup_file(options,nfs_file)\n message = \"Information:\\tTuning NFS\"\n command = \"echo '#{nfs_tune}' >> #{nfs_file}\"\n execute_command(options,message,command)\n end\n end\n return\nend",
"def setup_options\n parser = OptionParser.new do |o|\n o.banner = 'Usage: bundle exec qpush-server [options]'\n\n o.on('-c', '--config PATH', 'Load PATH for config file') do |arg|\n load(arg)\n Server.log.info(\"* Server config: #{arg}\")\n end\n\n o.on('-h', '--help', 'Prints this help') { puts o && exit }\n end\n parser.parse!(@argv)\n end",
"def options_parser\n @options ||= {\n :env => :development,\n :port => 9095\n #:config => File.join( Wonkavision::Sample::CONFIG_DIR, \"worker.rb\" )\n }\n\n @options_parser ||= OptionParser.new do |opts|\n opts.banner = \"Usage: rpm_analytics_worker [options]\"\n\n opts.separator \"\"\n opts.separator \"Server options:\"\n \n opts.on('-e', '--environment NAME', \"Set the execution environment (prod, dev or test) (default: #{@options[:env]})\") { |val| @options[:env] = val }\n opts.on('-l', '--log FILE', \"Log to file (default: off)\") { |file| @options[:log_dir] = file }\n opts.on('-s', '--stdout', \"Log to stdout (default: #{@options[:log_stdout]})\") { |v| @options[:log_stdout] = v }\n opts.on('-v', '--verbose', \"Enable verbose logging (default: #{@options[:verbose]})\") { |v| @options[:verbose] = v }\n opts.on('-c', '--console', 'Start a wonkavision console. Other requested services (worker or api) will not run until the console exits.') { |c| @options[:run_console] = c }\n opts.on('-f', '--api', \"Run the API web front end (default: #{!!@options[:run_api]}\") { |v| @options[:run_api] = v }\n opts.on('-w', '--worker', \"Run an analytics worker (default: #{!!@options[:run_worker]}\") { |v| @options[:run_worker] = v }\n opts.on('-a', '--address HOST', \"Bind to HOST address (default: #{@options[:address]})\") { |addr| @options[:address] = addr }\n opts.on('-p', '--port PORT', \"Use PORT (default: #{@options[:port]})\") { |port| @options[:port] = port.to_i }\n opts.on('-h', '--help', 'Display help message') { show_options(opts) }\n end\n\n end",
"def parse\n\n # display the banner\n @banner.display_banner\n\n # if argv is empty\n if @argv.empty?\n ARGV << '-h'\n end\n\n options = OpenStruct.new\n opt_parser = OptionParser.new do|opts|\n\n opts.banner = 'usage: server_manager.rb -opt [ACTION]'\n\n opts.on('-d', '--deploy ¤', [:install], 'manage the deployment :', '¤ install', \"\\n\") do |action|\n return \"deploy_#{action}\" # return point\n end\n\n opts.on('-s', '--server ¤', [:start, :stop, :restart, :status], 'manage the server :', '¤ start', '¤ stop', '¤ restart', '¤ status', \"\\n\") do |action|\n return \"server_#{action}\" # return point\n end\n\n opts.on('-u','--update ¤',[:server, :system_packages, :system_core], 'manage the updates :', '¤ server', '¤ system_packages', '¤ system_core',\"\\n\") do |action|\n return \"update_#{action}\" # return point\n end\n\n opts.on('-a','--archive ¤', [:display, :remove, :remove_all, :import, :export], 'manage the archives :', '¤ display', '¤ remove', '¤ remove_all', '¤ import', '¤ export',\"\\n\") do |action|\n return \"archive_#{action}\" # return point\n end\n\n opts.on('-b','--blacklist ¤', [:display, :add, :remove], 'manage the blacklist :', '¤ display', '¤ add', '¤ remove', \"\\n\") do |action|\n return \"blacklist_#{action}\" # return point\n end\n\n opts.on('-l','--log ¤', [:client, :server, :clear_client, :clear_server], 'manage the logs :', '¤ client', '¤ server', '¤ clear_client', '¤ clear_server', \"\\n\") do |action|\n return \"log_#{action}\" # return point\n end\n\n opts.on('-h', '--help', 'display help') do\n puts opts\n exit\n end\n end\n\n begin\n opt_parser.parse!(@argv)\n\n rescue OptionParser::ParseError => e\n puts \"#{e}\".error\n exit\n end\n\n end",
"def initialize(\n ports: DEFAULT_SMTPD_PORT,\n hosts: DEFAULT_SMTPD_HOST,\n max_processings: DEFAULT_SMTPD_MAX_PROCESSINGS,\n max_connections: nil,\n crlf_mode: nil,\n do_dns_reverse_lookup: nil,\n io_cmd_timeout: nil,\n io_buffer_chunk_size: nil,\n io_buffer_max_size: nil,\n pipelining_extension: nil,\n internationalization_extensions: nil,\n auth_mode: nil,\n tls_mode: nil,\n tls_cert_path: nil,\n tls_key_path: nil,\n tls_ciphers: nil,\n tls_methods: nil,\n tls_cert_cn: nil,\n tls_cert_san: nil,\n logger: nil,\n logger_severity: nil\n )\n # create an exposed logger to forward loggings to the on_logging_event\n @logger = MidiSmtpServer::ForwardingLogger.new(method(:on_logging_event))\n\n # external logging\n if logger.nil?\n @logger_protected = Logger.new($stdout)\n @logger_protected.datetime_format = '%Y-%m-%d %H:%M:%S'\n @logger_protected.formatter = proc { |severity, datetime, _progname, msg| \"#{datetime}: [#{severity}] #{msg.chomp}\\n\" }\n @logger_protected.level = logger_severity.nil? ? Logger::DEBUG : logger_severity\n else\n @logger_protected = logger\n @logger_protected.level = logger_severity unless logger_severity.nil?\n logger.warn('Deprecated: \"logger\" was set on new! Please use \"on_logging_event\" instead.')\n end\n\n # list of TCPServers\n @tcp_servers = []\n # list of running threads\n @tcp_server_threads = []\n\n # lists for connections and thread management\n @connections = []\n @processings = []\n @connections_mutex = Mutex.new\n @connections_cv = ConditionVariable.new\n\n # settings\n\n # build array of ports\n # split string into array to instantiate multiple servers\n @ports = ports.to_s.delete(' ').split(',')\n # check for at least one port specification\n raise 'Missing port(s) to bind service(s) to!' if @ports.empty?\n # check that not also a '' empty item for port is added to the list\n raise 'Do not use empty value \"\" for port(s). Please use specific port(s)!' if @ports.include?('')\n\n # build array of hosts\n # split string into array to instantiate multiple servers\n @hosts = hosts.to_s.delete(' ').split(',')\n #\n # Check source of TCPServer.c at https://github.com/ruby/ruby/blob/trunk/ext/socket/tcpserver.c#L25-L31\n # * Internally, TCPServer.new calls getaddrinfo() function to obtain ip_addresses.\n # * If getaddrinfo() returns multiple ip_addresses,\n # * TCPServer.new TRIES to create a server socket for EACH address and RETURNS FIRST one that is SUCCESSFUL.\n #\n # So for that it was a small portion of luck which address had been used then.\n # We won't support that magic anymore. If wish to bind on all local ip_addresses\n # and interfaces, use new \"*\" wildcard, otherwise specify ip_addresses and / or hostnames\n #\n # raise exception when found empty or inner empty hosts specification like \"\" or \"a.b.c.d,,e.f.g.h\", guess miss-coding\n raise 'No hosts defined! Please use specific hostnames and / or ip_addresses or \"*\" for wildcard!' if @hosts.empty?\n raise 'Detected an empty identifier in given hosts! Please use specific hostnames and / or ip_addresses or \"*\" for wildcard!' if @hosts.include?('')\n\n # build array of addresses for ip_addresses and ports to use\n @addresses = []\n @hosts.each_with_index do |host, index|\n # resolv ip_addresses for host if not wildcard / all hosts\n # if host is \"*\" wildcard (all) interfaces are used\n # otherwise it will be bind to the found host ip_addresses\n if host == '*'\n ip_addresses_for_host = []\n Socket.ip_address_list.each do |a|\n # test for all local valid ipv4 and ipv6 ip_addresses\n # check question on stackoverflow for details\n # https://stackoverflow.com/questions/59770803/identify-all-relevant-ip-addresses-from-ruby-socket-ip-address-list\n ip_addresses_for_host << a.ip_address if \\\n (a.ipv4? &&\n (a.ipv4_loopback? || a.ipv4_private? ||\n !(a.ipv4_loopback? || a.ipv4_private? || a.ipv4_multicast?)\n )\n ) ||\n (a.ipv6? &&\n (a.ipv6_loopback? || a.ipv6_unique_local? ||\n !(a.ipv6_loopback? || a.ipv6_unique_local? || a.ipv6_linklocal? || a.ipv6_multicast? || a.ipv6_sitelocal? ||\n a.ipv6_mc_global? || a.ipv6_mc_linklocal? || a.ipv6_mc_nodelocal? || a.ipv6_mc_orglocal? || a.ipv6_mc_sitelocal? ||\n a.ipv6_v4compat? || a.ipv6_v4mapped? || a.ipv6_unspecified?)\n )\n )\n end\n else\n ip_addresses_for_host = Resolv.new.getaddresses(host).uniq\n end\n # get ports for that host entry\n # if ports at index are not specified, use last item\n # of ports array. if multiple ports specified by\n # item like 2525:3535:4545, then all ports will be instantiated\n ports_for_host = (index < @ports.length ? @ports[index] : @ports.last).to_s.split(':')\n # append combination of ip_address and ports to the list of serving addresses\n ip_addresses_for_host.each do |ip_address|\n ports_for_host.each do |port|\n @addresses << \"#{ip_address}:#{port}\"\n end\n end\n end\n\n # read max_processings\n @max_processings = max_processings\n raise 'Number of simultaneous processings (max_processings) must be a positive integer!' unless @max_processings.is_a?(Integer) && @max_processings.positive?\n # check max_connections\n @max_connections = max_connections\n raise 'Number of concurrent connections is lower than number of simultaneous processings!' if @max_connections && @max_connections < @max_processings\n\n # check for crlf mode\n @crlf_mode = crlf_mode.nil? ? DEFAULT_CRLF_MODE : crlf_mode\n raise \"Unknown CRLF mode #{@crlf_mode} was given!\" unless CRLF_MODES.include?(@crlf_mode)\n\n # always prevent auto resolving hostnames to prevent a delay on socket connect\n BasicSocket.do_not_reverse_lookup = true\n # do reverse lookups manually if enabled by io.addr and io.peeraddr\n @do_dns_reverse_lookup = do_dns_reverse_lookup.nil? ? true : do_dns_reverse_lookup\n\n # io and buffer settings\n @io_cmd_timeout = io_cmd_timeout.nil? ? DEFAULT_IO_CMD_TIMEOUT : io_cmd_timeout\n @io_buffer_chunk_size = io_buffer_chunk_size.nil? ? DEFAULT_IO_BUFFER_CHUNK_SIZE : io_buffer_chunk_size\n @io_buffer_max_size = io_buffer_max_size.nil? ? DEFAULT_IO_BUFFER_MAX_SIZE : io_buffer_max_size\n\n # smtp extensions\n @pipelining_extension = pipelining_extension.nil? ? DEFAULT_PIPELINING_EXTENSION_ENABLED : pipelining_extension\n @internationalization_extensions = internationalization_extensions.nil? ? DEFAULT_INTERNATIONALIZATION_EXTENSIONS_ENABLED : internationalization_extensions\n\n # check for authentification\n @auth_mode = auth_mode.nil? ? DEFAULT_AUTH_MODE : auth_mode\n raise \"Unknown authentification mode #{@auth_mode} was given!\" unless AUTH_MODES.include?(@auth_mode)\n\n # check for encryption\n @encrypt_mode = tls_mode.nil? ? DEFAULT_ENCRYPT_MODE : tls_mode\n raise \"Unknown encryption mode #{@encrypt_mode} was given!\" unless ENCRYPT_MODES.include?(@encrypt_mode)\n # SSL transport layer for STARTTLS\n if @encrypt_mode == :TLS_FORBIDDEN\n @tls = nil\n else\n # try to load openssl gem now\n begin\n require 'openssl'\n rescue LoadError\n end\n # check for openssl gem when enabling TLS / SSL\n raise 'The openssl library gem is not installed!' unless defined?(OpenSSL)\n # check for given CN and SAN\n if tls_cert_cn.nil?\n # build generic set of \"valid\" self signed certificate CN and SAN\n # using all given hosts and detected ip_addresses but not \"*\" wildcard\n tls_cert_san = ([] + @hosts + @addresses.map { |address| address.rpartition(':').first }).uniq\n tls_cert_san.delete('*')\n # build generic CN based on first SAN\n if tls_cert_san.first.match?(/^(127\\.0?0?0\\.0?0?0\\.0?0?1|::1|localhost)$/i)\n # used generic localhost.local\n tls_cert_cn = 'localhost.local'\n else\n # use first element from detected hosts and ip_addresses\n # drop that element from SAN\n tls_cert_cn = tls_cert_san.first\n tls_cert_san.slice!(0)\n end\n else\n tls_cert_cn = tls_cert_cn.to_s.strip\n tls_cert_san = tls_cert_san.to_s.delete(' ').split(',')\n end\n # create ssl transport service\n @tls = TlsTransport.new(tls_cert_path, tls_key_path, tls_ciphers, tls_methods, tls_cert_cn, tls_cert_san, @logger)\n end\n end",
"def option_parser #:nodoc:\n @option_parser ||= OptionParser.new do |opts|\n opts.banner = \"Usage: #{File.basename($0)} [options] action ...\"\n\n opts.on(\"-d\", \"--debug\",\n \"Prompts before each remote command execution.\"\n ) { |value| options[:debug] = true }\n\n opts.on(\"-e\", \"--explain TASK\",\n \"Displays help (if available) for the task.\"\n ) { |value| options[:explain] = value }\n\n opts.on(\"-F\", \"--default-config\",\n \"Always use default config, even with -f.\"\n ) { options[:default_config] = true }\n\n opts.on(\"-f\", \"--file FILE\",\n \"A recipe file to load. May be given more than once.\"\n ) { |value| options[:recipes] << value }\n\n opts.on(\"-H\", \"--long-help\", \"Explain these options and environment variables.\") do\n long_help\n exit\n end\n\n opts.on(\"-h\", \"--help\", \"Display this help message.\") do\n puts opts\n exit\n end\n\n opts.on(\"-n\", \"--dry-run\",\n \"Prints out commands without running them.\"\n ) { |value| options[:dry_run] = true }\n\n opts.on(\"-p\", \"--password\",\n \"Immediately prompt for the password.\"\n ) { options[:password] = nil }\n\n opts.on(\"-q\", \"--quiet\",\n \"Make the output as quiet as possible.\"\n ) { options[:verbose] = 0 }\n\n opts.on(\"-S\", \"--set-before NAME=VALUE\",\n \"Set a variable before the recipes are loaded.\"\n ) do |pair|\n name, value = pair.split(/=/, 2)\n options[:pre_vars][name.to_sym] = value\n end\n\n opts.on(\"-s\", \"--set NAME=VALUE\",\n \"Set a variable after the recipes are loaded.\"\n ) do |pair|\n name, value = pair.split(/=/, 2)\n options[:vars][name.to_sym] = value\n end\n\n opts.on(\"-T\", \"--tasks [PATTERN]\",\n \"List all tasks (matching optional PATTERN) in the loaded recipe files.\"\n ) do |value|\n options[:tasks] = if value\n value\n else\n true\n end\n options[:verbose] ||= 0\n end\n\n opts.on(\"-t\", \"--tool\",\n \"Abbreviates the output of -T for tool integration.\"\n ) { options[:tool] = true }\n\n opts.on(\"-V\", \"--version\",\n \"Display the Capistrano version, and exit.\"\n ) do\n require 'capistrano/version'\n puts \"Capistrano v#{Capistrano::Version::STRING}\"\n exit\n end\n\n opts.on(\"-v\", \"--verbose\",\n \"Be more verbose. May be given more than once.\"\n ) do\n options[:verbose] ||= 0\n options[:verbose] += 1\n end\n\n opts.on(\"-X\", \"--skip-system-config\",\n \"Don't load the system config file (capistrano.conf)\"\n ) { options.delete(:sysconf) }\n\n opts.on(\"-x\", \"--skip-user-config\",\n \"Don't load the user config file (.caprc)\"\n ) { options.delete(:dotfile) }\n end\n end",
"def parse_options\n @options = {\n :environment => 'production',\n :config_path => ENV['CLOUD_CROWD_CONFIG'] || '.',\n :daemonize => false\n }\n @option_parser = OptionParser.new do |opts|\n opts.on('-c', '--config PATH', 'path to configuration directory') do |conf_path|\n @options[:config_path] = conf_path\n end\n opts.on('-p', '--port PORT', 'port number for server (central or node)') do |port_num|\n @options[:port] = port_num\n end\n opts.on('-e', '--environment ENV', 'server environment (defaults to production)') do |env|\n @options[:environment] = env\n end\n opts.on('-d', '--daemonize', 'run as a background daemon') do |daemonize|\n @options[:daemonize] = daemonize\n end\n opts.on('--days NUM_DAYS', 'grace period before cleanup (7 by default)') do |days|\n @options[:days] = days.to_i if days.match(/\\A\\d+\\Z/)\n end\n opts.on_tail('-v', '--version', 'show version') do\n require \"#{CC_ROOT}/lib/cloud-crowd\"\n puts \"CloudCrowd version #{VERSION}\"\n exit\n end\n end\n @option_parser.banner = BANNER\n @option_parser.parse!(ARGV)\n end",
"def default_options\n {\n name: '', # Name\n description: '', # Description\n type: 0, # 0 - Email, 1 - External script, 2 - SMS, 3 - Jabber, 100 - EzTexting\n smtp_server: '',\n smtp_helo: '',\n smtp_email: '', # Email address of Zabbix server\n exec_path: '', # Name of external script\n gsm_modem: '', # Serial device name of GSM modem\n username: '', # Jabber user name used by Zabbix server\n passwd: '' # Jabber password used by Zabbix server\n }\n end",
"def default_options\n {\n thread_count: DEFAULT_THREAD_COUNT,\n ssh: Hash.new\n }\n end",
"def default_options\n {\n thread_count: DEFAULT_THREAD_COUNT,\n ssh: Hash.new\n }\n end",
"def default_slave_server_arguments(master_host, master_port, slave_port, date)\n {\n :sid => '2',\n :thnum => '24',\n :mhost => master_host,\n :mport => master_port,\n :format => 'tch',\n :bnum => '503316469',\n :apow => '11',\n :fpow => '18',\n :ncnum => '3000000',\n :xmsiz => '536870912',\n :opts => 'lb',\n :slave => true,\n :date => date.strftime('%Y%m'),\n :port => slave_port\n }\n end",
"def default_options\n HashWithIndifferentAccess.new({\n :sunspot_index_queue_name => \"sunspot_index_queue\",\n :user => \"guest\",\n :pass => \"guest\",\n :host => \"localhost\",\n :port => \"5672\",\n :vhost => \"/\",\n :max_attempts_count => 5,\n :retry_interval => 300,\n :index_delay => 0\n })\n end",
"def default_options\n {\n :name => nil,\n :key_ => nil,\n :hostid => nil,\n :delay => 60,\n :history => 60,\n :status => 0,\n :type => 7,\n :snmp_community => '',\n :snmp_oid => '',\n :value_type => 3,\n :data_type => 0,\n :trapper_hosts => 'localhost',\n :snmp_port => 161,\n :units => '',\n :multiplier => 0,\n :delta => 0,\n :snmpv3_securityname => '',\n :snmpv3_securitylevel => 0,\n :snmpv3_authpassphrase => '',\n :snmpv3_privpassphrase => '',\n :formula => 0,\n :trends => 365,\n :logtimefmt => '',\n :valuemapid => 0,\n :delay_flex => '',\n :authtype => 0,\n :username => '',\n :password => '',\n :publickey => '',\n :privatekey => '',\n :params => '',\n :ipmi_sensor => '',\n }\n end",
"def configure_cc_server(options)\n search_string = \"live\"\n configure_linux_server(options,search_string)\n return\nend",
"def daemon=(options = {})\n if options.respond_to?(:keys)\n daemon.bind = options[:bind] if options[:bind]\n daemon.port = options[:port] if options[:port]\n daemon.log_file = options[:log_file] if options[:log_file]\n daemon.timer = options[:timer] if options[:timer]\n end\n end",
"def reqopt(type, queue = nil)\n raise unless @opts.include?(type)\n case type\n when :user\n return { :password => @password, :tags => \"administrator\" }\n when :vhost\n return {}\n when :perm\n return { :configure => \".*\", :write => \".*\", :read => \".*\" }\n when :exchange, :dlexchange\n return {\"type\":\"direct\",\"auto_delete\":false,\"durable\":true,\"internal\":false,\"arguments\":{}}\n when :dlqueue\n return {\"auto_delete\":false,\"durable\":true,\"arguments\":{\"x-queue-type\":\"quorum\"},\"node\":@node}\n when :queue\n return {\"auto_delete\":false,\n \"durable\":true,\n \"arguments\":{\"x-dead-letter-exchange\": @dlexname,\n \"x-dead-letter-routing-key\": dlqname(queue),\n \"x-queue-type\": \"quorum\"},\n \"node\":@node}\n when :dlbinding\n return {\n :routing_key => dlqname(queue),\n :arguments => {}\n }\n when :binding\n return {\n :routing_key => queue,\n :arguments => {}\n }\n end\n end",
"def config_fgservice(servicename, lowport, highport, comment, category, type, proto)\n\n config = String.new\n\n#####################################\n# TCP and Destination Entry\n####################################\n if type == :dst && proto == :tcp\n\n fgservice = <<-EOS\n edit #{servicename}\n set tcp-portgrange #{lowport} #{highport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n####################################\n# UDP and Destination Entry\n####################################\n if type == :dst && proto == :udp\n\n fgservice = <<-EOS\n edit #{servicename}\n set udp-portgrange #{lowport} #{highport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n###################################\n# TCP and Source Entry\n####################################\n if type == :src && proto == :tcp\n\n fgservice = <<-EOS\n edit #{servicename}\n set tcp-portgrange 1 65535 #{lowport} #{highport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n###################################\n# UDP and Source Entry\n####################################\n if type == :src && proto == :udp\n\n fgservice = <<-EOS\n edit #{servicename}\n set udp-portgrange 1 65535 #{lowport} #{highport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n###################################\n# ICMP Service Entry\n####################################\n if type == :icmp && proto == :icmp\n\n fgservice = <<-EOS\n edit #{servicename}\n set protocol ICMP\n set icmptype #{lowport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n return config\nend",
"def configure_gmond\n run_commands <<-COMMANDS\n sudo gmond --default_config > ~/gmond.conf\n sudo mv ~/gmond.conf /etc/ganglia/gmond.conf\n sudo perl -pi -e 's/name = \"unspecified\"/name = \"bfd\"/g' /etc/ganglia/gmond.conf\n sudo perl -pi -e 's/owner = \"unspecified\"/name = \"bfd\"/g' /etc/ganglia/gmond.conf\n sudo perl -pi -e 's/send_metadata_interval = 0/send_metadata_interval = 5/g' /etc/ganglia/gmond.conf\n export MASTER_HOST=#{MASTER_NODE}\n COMMANDS\n \n if !SLAVE\n command = <<-COMMAND\n sudo sed -i -e \"s|\\\\( *mcast_join *=.*\\\\)|#\\\\1|\" \\\n -e \"s|\\\\( *bind *=.*\\\\)|#\\\\1|\" \\\n -e \"s|\\\\( *location *=.*\\\\)| location = \\\"master-node\\\"|\" \\\n -e \"s|\\\\(udp_send_channel {\\\\)|\\\\1\\\\n host=#{MASTER_NODE}|\" \\\n /etc/ganglia/gmond.conf\n COMMAND\n run_command(command)\n else\n command = <<-COMMAND\n sudo sed -i -e \"s|\\\\( *mcast_join *=.*\\\\)|#\\\\1|\" \\\n -e \"s|\\\\( *bind *=.*\\\\)|#\\\\1|\" \\\n -e \"s|\\\\(udp_send_channel {\\\\)|\\\\1\\\\n host=#{MASTER_NODE}|\" \\\n /etc/ganglia/gmond.conf\n COMMAND\n run_command(command)\n end\n run_command(\"sudo gmond\")\nend",
"def initialize(options = {})\n @options = {\n :daemonize => DEFAULT_DAEMONIZE,\n :host => DEFAULT_HOST,\n :path => DEFAULT_PATH,\n :pid_file => DEFAULT_PID_FILE,\n :port => DEFAULT_PORT,\n :threads_number => DEFAULT_THREADS_NUMBER,\n :timeout => DEFAULT_TIMEOUT\n }.merge(options)\n \n @stats = {}\n end",
"def configure_ai_pkg_repo(options,read_only)\n service_base_name = get_ai_service_base_name(options)\n if options['host-os-name'].to_s.match(/SunOS/)\n smf_name = \"pkg/server:#{service_base_name}\"\n message = \"Information:\\tChecking if service \"+smf_name+\" exists\"\n if options['service'].to_s.match(/alt/)\n command = \"svcs -a |grep '#{smf_name}\"\n else\n command = \"svcs -a |grep '#{smf_name} |grep -v alt\"\n end\n output = execute_command(options,message,command)\n if not output.match(/#{smf_name}/)\n message = \"\"\n commands = []\n commands.push(\"svccfg -s pkg/server add #{options['service']}\")\n commands.push(\"svccfg -s #{smf_name} addpg pkg application\")\n commands.push(\"svccfg -s #{smf_name} setprop pkg/port=#{options['publisherport']}\")\n commands.push(\"svccfg -s #{smf_name} setprop pkg/inst_root=#{options['repodir']}\")\n commands.push(\"svccfg -s #{smf_name} addpg general framework\")\n commands.push(\"svccfg -s #{smf_name} addpropvalue general/complete astring: #{options['service']}\")\n commands.push(\"svccfg -s #{smf_name} setprop pkg/readonly=#{read_only}\")\n commands.push(\"svccfg -s #{smf_name} setprop pkg/proxy_base = astring: http://#{options['publisherhost']}/#{options['service']}\")\n commands.push(\"svccfg -s #{smf_name} addpropvalue general/enabled boolean: true\")\n commands.each do |temp_command|\n execute_command(options,message,temp_command)\n end\n refresh_smf_service(options,smf_name)\n add_apache_proxy(options,service_base_name)\n end\n end\n return\nend",
"def restartOptionsServerConfiguration\n # SAME ON config/initializers/mailer.rb !!!\n begin\n # mail_delivery_method can be :smtp, :smtp_tls, :sendmail, :test\n delivery_method = Option.getValue(MAIL_DELIVERY_METHOD).nil? ? nil : Option.getValue(MAIL_DELIVERY_METHOD).strip\n if delivery_method == ':sendmail'\n ActionMailer::Base.delivery_method = :sendmail\n elsif delivery_method == ':test'\n ActionMailer::Base.delivery_method = :test\n else\n ActionMailer::Base.delivery_method = :smtp\n end\n ActionMailer::Base.smtp_settings = {\n :address => Option.getValue(SMTP_ADDRESS).nil? ? nil : Option.getValue(SMTP_ADDRESS).strip,\n :port => Option.getValue(SMTP_PORT).nil? ? nil : Option.getValue(SMTP_PORT).strip,\n :domain => Option.getValue(SMTP_DOMAIN).nil? ? nil : Option.getValue(SMTP_DOMAIN).strip,\n :user_name => Option.getValue(SMTP_USER_NAME).nil? ? nil : Option.getValue(SMTP_USER_NAME).strip,\n :password => Option.getValue(SMTP_PASSWORD).nil? ? nil : Option.getValue(SMTP_PASSWORD).strip\n }\n if delivery_method == ':smtp_tls' and RUBY_VERSION > \"1.8.6\"\n ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true\n end\n smtp_authentication = Option.getValue(SMTP_AUTHENTICATION).nil? ? nil : Option.getValue(SMTP_AUTHENTICATION).strip\n if smtp_authentication == ':login' then \n ActionMailer::Base.smtp_settings[:authentication] = :login\n elsif smtp_authentication == ':cram_md5'\n ActionMailer::Base.smtp_settings[:authentication] = :cram_md5\n else\n ActionMailer::Base.smtp_settings[:authentication] = :plain\n end\n rescue => e\n RAILS_DEFAULT_LOGGER.error e\n RAILS_DEFAULT_LOGGER.error \"... database not created yet?\"\n end\nend",
"def declare_configuration_options\n ws.config.declare \"daemon_polling_period\", \"string\",\n default: \"60\",\n doc: \"Enter the github polling period\"\n\n ws.config.declare \"daemon_buildbot_host\", \"string\",\n default: \"localhost\",\n doc: \"Enter builbot host/ip\"\n\n ws.config.declare \"daemon_buildbot_port\", \"string\",\n default: \"8010\",\n doc: \"Enter buildbot http port\"\n\n ws.config.declare \"daemon_project\", \"string\",\n default: File.basename(ws.root_dir),\n doc: \"Enter the project name\"\n\n ws.config.declare \"daemon_max_age\", \"string\",\n default: \"120\",\n doc: \"Enter events and pull requests max age\"\n end",
"def tunable_settings\n [\n 'puppet_enterprise::master::puppetserver::jruby_max_active_instances',\n 'puppet_enterprise::master::puppetserver::reserved_code_cache',\n 'puppet_enterprise::profile::amq::broker::heap_mb',\n 'puppet_enterprise::profile::console::java_args',\n 'puppet_enterprise::profile::database::shared_buffers',\n 'puppet_enterprise::profile::master::java_args',\n 'puppet_enterprise::profile::orchestrator::java_args',\n 'puppet_enterprise::profile::puppetdb::java_args',\n 'puppet_enterprise::puppetdb::command_processing_threads',\n ]\n end",
"def queue_opts\n {\n :max_bytes => 50_000,\n :service => config.kafka_response_topic,\n }\n end",
"def exec_postfix() return @postfix end",
"def configHost\n unless File.open('nagios.cfg').read() =~ /hosts.cfg/ && File.open('nagios.cfg').read() =~ /services.cfg/\n\tcfg = File.read('nagios.cfg')\n\tcfg = cfg.gsub(/templates.cfg/, \"templates.cfg\\ncfg_file=/usr/local/nagios/etc/hosts.cfg\\ncfg_file=/usr/local/nagios/etc/services.cfg\")\n\tFile.open('nagios.cfg', 'w') { |file| file.puts cfg }\n end\n File.open('hosts.cfg', 'a+') { |file|\n\tfile.puts \"define host{\\nname\\t\\t\\tlinux-box\\nuse\\t\\t\\tgeneric-host\\ncheck_period\\t\\t24x7\\ncheck_interval\\t\\t5\\nretry_interval\\t\\t1\\nmax_check_attempts\\t10\\ncheck_command\\t\\tcheck-host-alive\\nnotification_period\\t24x7\\nnotification_interval\\t30\\nnotification_options\\td,r\\ncontact_groups\\t\\tadmins\\nregister\\t\\t\\t0\\n}\\n\" unless File.open('hosts.cfg').read() =~ /name\\t\\t\\tlinux-box/\n\t@names.length.times do |x|\n\t file.puts \"define host{\\nuse\\t\\t\\tlinux-box\\nhost_name\\t\\t#{@names[x]}\\nalias\\t\\t\\t#{@names[x]}\\naddress\\t\\t\\t#{@ips[x]}\\n}\\n\\n\"\n\tend\n }\n File.open('services.cfg', 'a') { |file| \n @names.length.times do |x|\n file.puts \"define service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tCPU Load\\n\\tcheck_command\\t\\tcheck_nrpe!check_load\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tTotal Processes\\n\\tcheck_command\\t\\tcheck_nrpe!check_total_procs\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tCurrent Users\\n\\tcheck_command\\t\\tcheck_nrpe!check_users\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tSSH\\n\\tcheck_command\\t\\tcheck_ssh\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tPING\\n\\tcheck_command\\t\\tcheck_ping!100.0,20%!500.0,60%\\n}\\n\\n\" \n end\n }\n end",
"def initialize(options={})\n @multi_message_max_count = 0\n \n self.host = options[:host] || DEFAULT_HOST\n self.port = options[:port] || DEFAULT_PORT\n end",
"def pool_options(options); end",
"def parse_service_data_from_options\n data = {}\n data[:strategy] = deploy_strategy if deploy_strategy\n data[:ports] = parse_ports(ports_list) unless ports_list.empty?\n data[:links] = parse_links(link_list) unless link_list.empty?\n data[:memory] = parse_memory(memory) if memory\n data[:memory_swap] = parse_memory(memory_swap) if memory_swap\n data[:shm_size] = parse_memory(shm_size) if shm_size\n data[:cpus] = cpus if cpus\n data[:cpu_shares] = cpu_shares if cpu_shares\n data[:affinity] = affinity_list unless affinity_list.empty?\n data[:env] = env_list unless env_list.empty?\n data[:secrets] = parse_secrets(secret_list) unless secret_list.empty?\n data[:container_count] = instances if instances\n data[:cmd] = Shellwords.split(cmd) if cmd\n data[:user] = user if user\n data[:image] = parse_image(image) if image\n data[:privileged] = privileged?\n data[:cap_add] = cap_add_list if cap_add_list\n data[:cap_drop] = cap_drop_list if cap_drop_list\n data[:net] = net if net\n data[:log_driver] = log_driver if log_driver\n data[:log_opts] = parse_log_opts(log_opt_list) if log_opt_list\n deploy_opts = parse_deploy_opts\n data[:deploy_opts] = deploy_opts unless deploy_opts.empty?\n health_check = parse_health_check\n data[:health_check] = health_check unless health_check.empty?\n data[:pid] = pid if pid\n data[:stop_signal] = stop_signal if stop_signal\n data[:stop_grace_period] = stop_timeout if stop_timeout\n data\n end",
"def parseOptions(args)\n require 'optparse'\n\n cfgFile = nil\n @interactive = false\n @logConfigFile = ENV['RES_MGR_LOG'] || \"/etc/omf-resmgr-#{OMF_MM_VERSION}/omf-resmgr_log.xml\"\n\n opts = OptionParser.new\n opts.banner = \"Usage: omf-resmgr [options]\"\n @config = {:communicator => {}, :manager => {}}\n @config[:communicator] = {:xmpp => {}}\n\n opts.on(\"--pubsub-gateway HOST\",\n \"Hostname of the local PubSub server to connect to\") {|name|\n @config[:communicator][:xmpp][:pubsub_gateway] = name\n }\n opts.on(\"--pubsub-user NAME\",\n \"Username for connecting to the local PubSub server (if not set, RM \"+\n \"will register its own new user)\") {|name|\n @config[:communicator][:xmpp][:pubsub_user] = name\n }\n opts.on(\"--pubsub-pwd PWD\",\n \"Password for connecting to the local PubSub server (if not set, RM \"+\n \"will register its own new user)\") {|name|\n @config[:communicator][:xmpp][:pubsub_pwd] = name\n }\n \n # Instance Options\n opts.on('--name NAME',\n \"Checkin name of the manager (unique HRN for this resource)\") {|name|\n @config[:manager][:name] = name\n }\n\n # Signing/Verification Options\n opts.on(\"-p\", \"--private_key FILE\", \"Set your RSA/DSA SSH private key file location\") { |file| \n @config[:communicator][:private_key] = file \n }\n opts.on(\"-P\", \"--public_key_dir DIRECTORY\", \"Set the directory holding the public keys of your OMF peers\") { |dir| \n @config[:communicator][:public_key_dir] = dir \n } \n opts.on(\"-a\", \"--auth YES|NO\", \"Enable or disable signature checks and message signing (default is no)\") { |auth|\n @config[:communicator][:authenticate_messages] = (auth.downcase == \"yes\") \n }\n\n # General Options\n opts.on(\"-i\", \"--interactive\",\n \"Run the manager in interactive mode\") {\n @interactive = true\n }\n opts.on(\"--log FILE\",\n \"File containing logging configuration information\") {|file|\n @logConfigFile = file\n }\n opts.on(\"-n\", \"--just-print\",\n \"Print the commands that would be executed, but do not execute them\") {\n ResourceManager.JUST_PRINT = true\n }\n opts.on_tail(\"-h\", \"--help\", \"Show this message\") { puts opts; exit }\n opts.on_tail(\"-v\", \"--version\", \"Show the version\") {\n puts VERSION_STRING\n exit\n }\n\n rest = opts.parse(args)\n\n # Make sure log exists ...\n @logConfigFile = File.exists?(@logConfigFile) ? @logConfigFile : nil\n MObject.initLog('resourceManager', nil, {:configFile => @logConfigFile})\n\n # Read config file\n if cfgFile.nil?\n name = \"omf-resmgr.yaml\"\n path = [\"../etc/omf-resmgr/#{name}\", \"/etc/omf-resmgr-#{OMF_MM_VERSION}/#{name}\"]\n cfgFile = path.detect {|f|\n File.readable?(f)\n }\n else\n if (!File.readable?(cfgFile))\n raise \"Can't find configuration file '#{cfgFile}'\"\n end\n end\n if (cfgFile.nil?)\n raise \"Can't find a configuration file\"\n else\n require 'yaml'\n h = YAML::load_file(cfgFile)\n if ((p = h[:rmanager]) == nil)\n raise \"Missing ':rmanager' root in '#{cfgFile}'\"\n end\n @config = p.merge_deep!(@config)\n end\n\n # At this point, we should now have a name \n if @config[:manager][:name] == nil \n raise \"Manager's Name is not defined in config file or as arguments!\"\n else\n # substitute hostname or mac address, if required\n @config[:manager][:name].gsub!(/%hostname%/, `/bin/hostname`.chomp)\n @config[:manager][:name].gsub!(/%macaddr%/, `ifconfig control | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}'`)\n @managerName = @config[:manager][:name] \n end\n \n kl = nil\n if @config[:communicator][:authenticate_messages]\n MObject.info(\"Message authentication is enabled\")\n if @config[:communicator][:private_key] == nil\n error \"No private key file specified on command line or config file! Exiting now!\\n\"\n\t exit\n end\n if @config[:communicator][:public_key_dir] == nil\n error \"No public key directory specified on command line or config file! Exiting now!\\n\"\n\t exit\n end\n kl = KeyLocator.new(@config[:communicator][:private_key], @config[:communicator][:public_key_dir])\n else\n MObject.info(\"Message authentication is disabled\")\n end\n\n ## TODO: initialize message envelope here with kl and authenticate_messages\n \n end",
"def modify_job_options(service)\n # Example how to programmatically modify job options:\n job_options = service.job_options\n #job_options[:limit] = 'someHost'\n #job_options[:extra_vars]['flavor'] = 'm1.small'\n @hosts,@modify = Getting_Hosts()\n \n #@the_list = $evm.root['dialog_mylist']\n job_options[:extra_vars]['mylist'] = @hosts\n job_options[:extra_vars]['list'] = @modify\n # Important: set stack_options\n #@reqopts = @handle.root['dialog*']\n #@handle.log(\"info\", \"the inputs are: #{@reqopts} \")\n #vm_name = $evm.root['dialog_param_vm_name']\n #@handle.log(\"info\", \"the vm name is: #{vm_name} \")\n #job_options[:extra_vars]['name_host'] = vm_name\n #@handle.log(\"info\", \"Starting Ansible Tower Pre-Provisioning\")\n service.job_options = job_options\n @options = service.job_options[:extra_vars]\n @handle.log(\"info\", \"the options are: #{@options} \")\n end",
"def command_string\n if (datastore['JOBNAME'] == \"DUMMY\") && !datastore['FTPUSER'].nil?\n datastore['JOBNAME'] = (datastore['FTPUSER'] + \"1\").strip.upcase\n end\n lhost = Rex::Socket.resolv_nbo(datastore['LHOST'])\n lhost = lhost.unpack(\"H*\")[0]\n lport = datastore['LPORT']\n lport = lport.to_s.to_i.to_s(16).rjust(4, '0')\n\n jcl_jobcard +\n \"//**************************************/\\n\" \\\n \"//* SPAWN BIND SHELL FOR MSF MODULE */\\n\" \\\n \"//**************************************/\\n\" \\\n \"//*\\n\" \\\n \"//STEP1 EXEC PROC=ASMACLG,PARM.L=(CALL)\\n\" \\\n \"//L.SYSLIB DD DSN=SYS1.CSSLIB,DISP=SHR\\n\" \\\n \"//C.SYSIN DD *,DLM=ZZ\\n\" \\\n \" TITLE 'Spawns Bind Shell'\\n\" \\\n \"SPAWNBND CSECT\\n\" \\\n \"SPAWNBND AMODE 31\\n\" \\\n \"SPAWNBND RMODE ANY\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* @SETUP registers and save areas *\\n\" \\\n \"***********************************************************************\\n\" \\\n \" USING *,15\\n\" \\\n \"@SETUP0 B @SETUP1\\n\" \\\n \" DROP 15\\n\" \\\n \" DS 0H # half word boundary\\n\" \\\n \"@SETUP1 STM 14,12,12(13) # save our registers\\n\" \\\n \" LR 2,13 # callers sa\\n\" \\\n \" LR 8,15 # pgm base in R8\\n\" \\\n \" USING @SETUP0,8 # R8 for base addressability\\n\" \\\n \"*************************************\\n\" \\\n \"* set up data area / addressability *\\n\" \\\n \"*************************************\\n\" \\\n \" L 0,@DYNSIZE # len of variable area\\n\" \\\n \" GETMAIN RU,LV=(0) # get data stg, len R0\\n\" \\\n \" LR 13,1 # data address\\n\" \\\n \" USING @DATA,13 # addressability for data area\\n\" \\\n \" ST 2,@BACK # store callers sa address\\n\" \\\n \" ST 13,8(,2) # store our data addr\\n\" \\\n \" DS 0H # halfword boundaries\\n\" \\\n \"\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* BPX1SOC set up socket - inline *\\n\" \\\n \"***********************************************************************\\n\" \\\n \" CALL BPX1SOC, X\\n\" \\\n \" (DOM,TYPE,PROTO,DIM,SRVFD, X\\n\" \\\n \" RTN_VAL,RTN_COD,RSN_COD),VL,MF=(E,PLIST)\\n\" \\\n \"*******************************\\n\" \\\n \"* chk return code, 0 or exit *\\n\" \\\n \"*******************************\\n\" \\\n \" LHI 15,2\\n\" \\\n \" L 6,RTN_VAL\\n\" \\\n \" CIB 6,0,7,EXITP # R6 not 0? Time to exit\\n\" \\\n \"\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* BPX1BND (bind) bind to local socket - inline *\\n\" \\\n \"***********************************************************************\\n\" \\\n \" XC SOCKADDR(16),SOCKADDR # zero sock addr struct\\n\" \\\n \" MVI SOCK_FAMILY,AF_INET # family inet\\n\" \\\n \" MVI SOCK_LEN,SOCK#LEN # len of socket\\n\" \\\n \" MVC SOCK_SIN_PORT,CONNSOCK # port to bind to\\n\" \\\n \" MVC SOCK_SIN_ADDR,CONNADDR # address to bind to\\n\" \\\n \" CALL BPX1BND, X\\n\" \\\n \" (SRVFD,SOCKLEN,SOCKADDR, X\\n\" \\\n \" RTN_VAL,RTN_COD,RSN_COD),VL,MF=(E,PLIST)\\n\" \\\n \"*******************************\\n\" \\\n \"* chk return code, 0 or exit *\\n\" \\\n \"*******************************\\n\" \\\n \" LHI 15,3\\n\" \\\n \" L 6,RTN_VAL\\n\" \\\n \" CIB 6,0,7,EXITP # R6 not 0? Time to exit\\n\" \\\n \"\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* BPX1LSN (listen) listen on local socket - inline *\\n\" \\\n \"***********************************************************************\\n\" \\\n \" CALL BPX1LSN, X\\n\" \\\n \" (SRVFD,BACKLOG, X\\n\" \\\n \" RTN_VAL,RTN_COD,RSN_COD),VL,MF=(E,PLIST)\\n\" \\\n \"*******************************\\n\" \\\n \"* chk return code, 0 or exit *\\n\" \\\n \"*******************************\\n\" \\\n \" LHI 15,4\\n\" \\\n \" L 6,RTN_VAL\\n\" \\\n \" CIB 6,0,7,EXITP # R6 not 0? Time to exit\\n\" \\\n \"\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* BPX1ACP (accept) accept socket connection - inline *\\n\" \\\n \"***********************************************************************\\n\" \\\n \" XC SOCKADDR(16),SOCKADDR # zero sock addr struct\\n\" \\\n \" MVI SOCK_FAMILY,AF_INET # family inet\\n\" \\\n \" MVI SOCK_LEN,SOCK#LEN # len of socket\\n\" \\\n \" CALL BPX1ACP, X\\n\" \\\n \" (SRVFD,CLILEN,CLISKT, X\\n\" \\\n \" CLIFD,RTN_COD,RSN_COD),VL,MF=(E,PLIST)\\n\" \\\n \"*******************************\\n\" \\\n \"* chk return code, 0 or exit *\\n\" \\\n \"*******************************\\n\" \\\n \" LHI 15,5\\n\" \\\n \" L 6,RTN_VAL\\n\" \\\n \" CIB 6,0,7,EXITP # R6 not 0? Time to exit\\n\" \\\n \"\\n\" \\\n \"*************************************************\\n\" \\\n \"* order of things to prep child pid *\\n\" \\\n \"* 0) Dupe all 3 file desc of CLIFD *\\n\" \\\n \"* 1) Dupe parent read fd to std input *\\n\" \\\n \"*************************************************\\n\" \\\n \"*******************\\n\" \\\n \"***** STDIN *****\\n\" \\\n \"*******************\\n\" \\\n \" CALL BPX1FCT, X\\n\" \\\n \" (CLIFD, X\\n\" \\\n \" =A(F_DUPFD2), X\\n\" \\\n \" =A(F_STDI), X\\n\" \\\n \" RTN_VAL,RTN_COD,RSN_COD),VL,MF=(E,PLIST)\\n\" \\\n \"****************************************************\\n\" \\\n \"* chk return code here anything but -1 is ok *\\n\" \\\n \"****************************************************\\n\" \\\n \" LHI 15,6 # exit code for this func\\n\" \\\n \" L 7,RTN_VAL # set r7 to rtn val\\n\" \\\n \" CIB 7,-1,8,EXITP # r6 = -1 exit\\n\" \\\n \"\\n\" \\\n \"*******************\\n\" \\\n \"***** STDOUT *****\\n\" \\\n \"*******************\\n\" \\\n \" CALL BPX1FCT, X\\n\" \\\n \" (CLIFD, X\\n\" \\\n \" =A(F_DUPFD2), X\\n\" \\\n \" =A(F_STDO), X\\n\" \\\n \" RTN_VAL,RTN_COD,RSN_COD),VL,MF=(E,PLIST)\\n\" \\\n \"****************************************************\\n\" \\\n \"* chk return code here anything but -1 is ok *\\n\" \\\n \"****************************************************\\n\" \\\n \" LHI 15,7 # exit code for this func\\n\" \\\n \" L 7,RTN_VAL # set r7 to rtn val\\n\" \\\n \" CIB 7,-1,8,EXITP # r6 = -1 exit\\n\" \\\n \"\\n\" \\\n \"*******************\\n\" \\\n \"***** STDERR *****\\n\" \\\n \"*******************\\n\" \\\n \" CALL BPX1FCT, X\\n\" \\\n \" (CLIFD, X\\n\" \\\n \" =A(F_DUPFD2), X\\n\" \\\n \" =A(F_STDE), X\\n\" \\\n \" RTN_VAL,RTN_COD,RSN_COD),VL,MF=(E,PLIST)\\n\" \\\n \"****************************************************\\n\" \\\n \"* chk return code here anything but -1 is ok *\\n\" \\\n \"****************************************************\\n\" \\\n \" LHI 15,8 # exit code for this func\\n\" \\\n \" L 7,RTN_VAL # set r7 to rtn val\\n\" \\\n \" CIB 7,-1,8,EXITP # r7 = -1 exit\\n\" \\\n \"\\n\" \\\n \"***********************************************************************\\n\" \\\n \"* BP1SPN (SPAWN) execute shell '/bin/sh' *\\n\" \\\n \"***********************************************************************\\n\" \\\n \" XC INHE(INHE#LENGTH),INHE # clear inhe structure\\n\" \\\n \" XI INHEFLAGS0,INHESETPGROUP\\n\" \\\n \" SPACE ,\\n\" \\\n \" MVC INHEEYE,=C'INHE'\\n\" \\\n \" LH 0,TLEN\\n\" \\\n \" STH 0,INHELENGTH\\n\" \\\n \" LH 0,TVER\\n\" \\\n \" STH 0,INHEVERSION\\n\" \\\n \" CALL BPX1SPN, X\\n\" \\\n \" (EXCMDL,EXCMD,EXARGC,EXARGLL,EXARGL,EXENVC,EXENVLL, X\\n\" \\\n \" EXENVL,FDCNT,FDLST,=A(INHE#LENGTH),INHE,RTN_VAL, X\\n\" \\\n \" RTN_COD,RSN_COD),VL,MF=(E,PLIST)\\n\" \\\n \" LHI 15,9 # exit code for this func\\n\" \\\n \" L 7,RTN_VAL # set r7 to rtn val\\n\" \\\n \" L 6,RTN_COD\\n\" \\\n \" L 5,RSN_COD\\n\" \\\n \" CIB 7,-1,8,EXITP # r7 = -1 exit\\n\" \\\n \"\\n\" \\\n \"****************************************************\\n\" \\\n \"* cleanup & exit preload R15 with exit code *\\n\" \\\n \"****************************************************\\n\" \\\n \" XR 15,15 # 4 FOR rc\\n\" \\\n \"EXITP L 0,@DYNSIZE\\n\" \\\n \" LR 1,13\\n\" \\\n \" L 13,@BACK\\n\" \\\n \" DROP 13\\n\" \\\n \" FREEMAIN RU,LV=(0),A=(1) #free storage\\n\" \\\n \" XR 15,15\\n\" \\\n \" L 14,12(,13) # load R14\\n\" \\\n \" LM 0,12,20(13) # load 0-12\\n\" \\\n \" BSM 0,14 # branch to caller\\n\" \\\n \"\\n\" \\\n \"****************************************************\\n\" \\\n \"* Constants and Variables *\\n\" \\\n \"****************************************************\\n\" \\\n \" DS 0F # constants full word boundary\\n\" \\\n \"F_STDI EQU 0\\n\" \\\n \"F_STDO EQU 1\\n\" \\\n \"F_STDE EQU 2\\n\" \\\n \"*************************\\n\" \\\n \"* Socket conn variables * # functions used by pgm\\n\" \\\n \"*************************\\n\" \\\n \"CONNSOCK DC XL2'#{lport}' # LPORT\\n\" \\\n \"CONNADDR DC XL4'#{lhost}' # LHOST\\n\" \\\n \"BACKLOG DC F'1' # 1 byte backlog\\n\" \\\n \"DOM DC A(AF_INET) # AF_INET = 2\\n\" \\\n \"TYPE DC A(SOCK#_STREAM) # stream = 1\\n\" \\\n \"PROTO DC A(IPPROTO_IP) # ip = 0\\n\" \\\n \"DIM DC A(SOCK#DIM_SOCKET) # dim_sock = 1\\n\" \\\n \"SOCKLEN DC A(SOCK#LEN+SOCK_SIN#LEN)\\n\" \\\n \"CLILEN DC F'0' # client sock len - don't care\\n\" \\\n \"CLISKT DC X'00' # client socket struck - don't care\\n\" \\\n \"************************\\n\" \\\n \"* BPX1SPN vars *********\\n\" \\\n \"************************\\n\" \\\n \"EXCMD DC CL7'/bin/sh' # command to exec\\n\" \\\n \"EXCMDL DC A(L'EXCMD) # len of cmd to exec\\n\" \\\n \"EXARGC DC F'1' # num of arguments\\n\" \\\n \"EXARG1 DC CL2'sh' # arg 1 to exec\\n\" \\\n \"EXARG1L DC A(L'EXARG1) # len of arg1\\n\" \\\n \"EXARGL DC A(EXARG1) # addr of argument list\\n\" \\\n \"EXARGLL DC A(EXARG1L) # addr of arg len list\\n\" \\\n \"EXENVC DC F'0' # env var count\\n\" \\\n \"EXENVL DC F'0' # env var arg list addr\\n\" \\\n \"EXENVLL DC F'0' # env var arg len addr\\n\" \\\n \"FDCNT DC F'0' # field count s/b 0\\n\" \\\n \"FDLST DC F'0' # field list addr s/b 0\\n\" \\\n \"TVER DC AL2(INHE#VER)\\n\" \\\n \"TLEN DC AL2(INHE#LENGTH)\\n\" \\\n \" SPACE ,\\n\" \\\n \"@DYNSIZE DC A(@ENDYN-@DATA)\\n\" \\\n \"***************************\\n\" \\\n \"***** end of constants ****\\n\" \\\n \"***************************\\n\" \\\n \"@DATA DSECT ,\\n\" \\\n \" DS 0D\\n\" \\\n \"PLIST DS 16A\\n\" \\\n \"RTN_VAL DS F # return value\\n\" \\\n \"RTN_COD DS F # return code\\n\" \\\n \"RSN_COD DS F # reason code\\n\" \\\n \"CLIFD DS F # client fd\\n\" \\\n \"SRVFD DS F # server fd\\n\" \\\n \"@BACK DS A\\n\" \\\n \"*\\n\" \\\n \" BPXYSOCK LIST=NO,DSECT=NO\\n\" \\\n \" BPXYFCTL LIST=NO,DSECT=NO\\n\" \\\n \" BPXYINHE LIST=NO,DSECT=NO\\n\" \\\n \"@ENDYN EQU *\\n\" \\\n \"@DATA#LEN EQU *-@DATA\\n\" \\\n \" BPXYCONS LIST=YES\\n\" \\\n \" END SPAWNBND\\n\" \\\n \"ZZ\\n\" \\\n \"//*\\n\"\n end",
"def optional_port; end",
"def spawn_server(options = {}, **args)\n unless port_available?(options[\"port\"])\n raise \"Port #{options[\"port\"]} is already in use. Change it to an available port in \"\\\n \"config/config.yml.\"\n end\n prefix = get_fuseki_command_prefix args\n command = \"#{prefix}fuseki-server --memTDB --update --port #{options[\"port\"]} \"\\\n \"--jetty-config=#{File.join(Rails.root, \"config\", \"jetty-fuseki.xml\")} \"\\\n \"/#{options[\"dataset\"]} > /dev/null\"\n spawn command\n end",
"def default_submission_port; end",
"def initialize(opts = {})\n @opts = { :host => DEFAULT_HOST,\n :port => DEFAULT_PORT,\n :path => DEFAULT_PATH,\n :timeout => DEFAULT_TIMEOUT }.merge(opts)\n\n @logger = case @opts[:logger]\n when IO, String; Logger.new(opts[:logger])\n when Logger; opts[:logger]\n else; Logger.new(STDERR)\n end\n\n @logger.level = @opts[:log_level] || Logger::ERROR\n\n @timeout = @opts[:timeout]\n\np @opts[:port]\np @opts[:host]\n @socket = TCPServer.new(@opts[:host], @opts[:port])\n @socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1)\n @socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)\n\n @queue_collection = QueueCollection.new(@opts[:path])\n\n @workers = ThreadGroup.new\n\n @stats = Hash.new(0)\n end",
"def update_config_options\n options = Util::OptsParser.options(ARGV)\n Util::Configuration.tag_time_to_live_in_seconds = options[:ttl]\n Util::Configuration.case_sensitive_matching = options[:case]\n Util::Configuration.hashtag_storage_class = options[:storage]\n Util::Configuration.log_capture_device = options[:log_device]\n Util::Configuration.automatic_restart = options[:automatic_restart]\n current_config = Util::Configuration.to_a\n current_config << \"Port: #{options[:port]}\"\n logger.info(current_config.join(', '))\n options\n end",
"def modify_file\n\n file_name = \"#{ node[\"php_fpm\"][\"pools_path\"] }/#{ @current_resource.pool_name }.conf\"\n\n #Start Base Configuration\n find_replace(file_name, \"user = \", @current_resource.pool_user, @new_resource.pool_user)\n find_replace(file_name, \"group = \", @current_resource.pool_group, @new_resource.pool_group)\n\n #Replace IP Address and Port\n if @current_resource.listen_address != @new_resource.listen_address || @current_resource.listen_port != @new_resource.listen_port && (!@current_resource.use_sockets)\n find_replace(file_name, \"listen = \", \"#{ @current_resource.listen_address }:#{ @current_resource.listen_port }\", \"#{ @new_resource.listen_address }:#{ @new_resource.listen_port }\")\n else\n find_replace(file_name, \"listen = \",\"#{ @current_resource.listen_socket }\", \"#{ @new_resource.listen_socket }\")\n end\n\n @new_resource.listen_allowed_clients != nil ? find_replace(file_name, \"listen.allowed_clients = \",@current_resource.listen_allowed_clients, @new_resource.listen_allowed_clients) : nil\n @new_resource.listen_owner != nil ? find_replace(file_name, \"listen.owner = \",@current_resource.listen_owner, @new_resource.listen_owner) : nil\n @new_resource.listen_group != nil ? find_replace(file_name, \"listen.group = \",@current_resource.listen_group, @new_resource.listen_group) : nil\n @new_resource.listen_mode != nil ? find_replace(file_name, \"listen.mode = \",@current_resource.listen_mode, @new_resource.listen_mode) : nil\n @new_resource.listen_backlog != nil ? find_replace(file_name, \"listen.backlog = \",@current_resource.listen_backlog, @new_resource.listen_backlog) : nil\n\n #Start PM configuration\n @new_resource.pm != nil ? find_replace(file_name, \"pm = \",@current_resource.pm,@new_resource.pm) : nil\n @new_resource.pm_max_children != nil ? find_replace(file_name, \"pm.max_children = \",@current_resource.pm_max_children, @new_resource.pm_max_children) : nil\n @new_resource.pm_start_servers != nil ? find_replace(file_name, \"pm.start_servers = \",@current_resource.pm_start_servers, @new_resource.pm_start_servers) : nil\n @new_resource.pm_min_spare_servers != nil ? find_replace(file_name, \"pm.min_spare_servers = \",@current_resource.pm_min_spare_servers, @new_resource.pm_min_spare_servers) : nil\n @new_resource.pm_max_spare_servers != nil ? find_replace(file_name, \"pm.max_spare_servers = \",@current_resource.pm_max_spare_servers, @new_resource.pm_max_spare_servers) : nil\n @new_resource.pm_process_idle_timeout != nil ? find_replace(file_name, \"pm.process_idle_timeout = \",@current_resource.pm_process_idle_timeout, @new_resource.pm_process_idle_timeout) : nil\n @new_resource.pm_max_requests != nil ? find_replace(file_name, \"pm.max_requests = \",@current_resource.pm_max_requests, @new_resource.pm_max_requests) : nil\n @new_resource.pm_status_path != nil ? find_replace(file_name, \"pm.status_path = \",@current_resource.pm_status_path, @new_resource.pm_status_path) : nil\n\n #Start Ping\n @new_resource.ping_path != nil ? find_replace(file_name, \"ping.path = \",@current_resource.ping_path, @new_resource.ping_path) : nil\n @new_resource.ping_response != nil ? find_replace(file_name, \"ping.response = \",@current_resource.ping_response, @new_resource.ping_response) : nil\n\n #Start Logging\n @new_resource.access_format != nil ? find_replace(file_name, \"access.format = \",@current_resource.access_format, @new_resource.access_format.gsub(\"\\\\\",\"\")) : nil\n @new_resource.request_slowlog_timeout != nil ? find_replace(file_name, \"request_slowlog_timeout = \",@current_resource.request_slowlog_timeout, @new_resource.request_slowlog_timeout) : nil\n @new_resource.request_terminate_timeout != nil ? find_replace(file_name, \"request_terminate_timeout = \",@current_resource.request_terminate_timeout, @new_resource.request_terminate_timeout) : nil\n @new_resource.access_log != nil ? find_replace(file_name, \"access.log = \",@current_resource.access_log, @new_resource.access_log) : nil\n @new_resource.slow_log != nil ? find_replace(file_name, \"slowlog = \",@current_resource.slow_log, @new_resource.slow_log) : nil\n\n #Start Misc\n @new_resource.chdir != nil ? find_replace(file_name, \"chdir = \",@current_resource.chdir, @new_resource.chdir) : nil\n @new_resource.chroot != nil ? find_replace(file_name, \"chroot = \",@current_resource.chroot, @new_resource.chroot) : nil\n @new_resource.catch_workers_output != nil ? find_replace(file_name, \"catch_workers_output = \",@current_resource.catch_workers_output, @new_resource.catch_workers_output) : nil\n @new_resource.security_limit_extensions != nil ? find_replace(file_name, \"security.limit_extensions = \",@current_resource.security_limit_extensions, @new_resource.security_limit_extensions) : nil\n @new_resource.rlimit_files != nil ? find_replace(file_name, \"rlimit_files = \",@current_resource.rlimit_files, @new_resource.rlimit_files) : nil\n @new_resource.rlimit_core != nil ? find_replace(file_name, \"rlimit_core = \",@current_resource.rlimit_core, @new_resource.rlimit_core) : nil\n\n #Start PHP INI Values\n if !@current_resource.php_ini_values.nil?\n @current_resource.php_ini_values.each do | k, v |\n find_replace(file_name, \"php_value[#{ k }] = \", v, @new_resource.php_ini_values[\"#{ k }\"])\n end\n end\n\n #Start PHP INI Flags\n if !@current_resource.php_ini_flags.nil?\n @current_resource.php_ini_flags.each do | k, v |\n find_replace(file_name, \"php_flag[#{ k }] = \", v, @new_resource.php_ini_flags[\"#{ k }\"])\n end\n end\n\n #Start PHP INI Admin Values\n if !@current_resource.php_ini_admin_values.nil?\n @current_resource.php_ini_admin_values.each do | k, v |\n find_replace(file_name, \"php_admin_value[#{ k }] = \", v, @new_resource.php_ini_admin_values[\"#{ k }\"])\n end\n end\n\n #Start PHP INI Admin Flags\n if !@current_resource.php_ini_admin_flags.nil?\n @current_resource.php_ini_admin_flags.each do | k, v |\n find_replace(file_name, \"php_admin_flag[#{ k }] = \", v, @new_resource.php_ini_admin_flags[\"#{ k }\"])\n end\n end\n\n #Start ENV Variables\n if !@current_resource.env_variables.nil?\n @current_resource.env_variables.each do | k, v |\n find_replace(file_name, \"env[#{ k }] = \",v,@new_resource.env_variables[\"#{ k }\"])\n end\n end\n\nend",
"def parse_options()\n\n options = {}\n\n ARGV.each_index do |index|\n case $*[index]\n when '-m' then options[:auto_connect] = false\n when '-v' then options[:verbose] = true\n when '-q' then options[:verbose] = false\n when '-t' then options[:log_truncate] = true\n when '-r' then options[:log_response] = false\n else\n ::Twiga.say_warn \"unknown option: #{arg}\"\n end # case\n\n $*.delete_at(index) # remove from command line\n\n end # do each cmd line arg\n \n return Kinokero::Cloudprint::DEFAULT_OPTIONS.merge(options)\n\n end",
"def opts\n @opts ||= OptionParser.new do |opts|\n opts.program_name = File.basename($PROGRAM_NAME)\n opts.banner = \"Usage: #{opts.program_name}\"\n\n opts.separator ''\n opts.separator 'Actions:'\n\n names = @actions.map(&:name)\n padding = names.map(&:size).max\n @actions.each do |action|\n opts.separator \" #{action.name.ljust(padding)} #{action.description}\\n\"\n end\n\n opts.separator ''\n opts.separator 'Tasks:'\n\n @processor_class.tasks.each do |task_name|\n opts.separator \" #{task_name}\"\n end\n\n opts.separator ''\n opts.separator 'Specific options:'\n opts.on('-a', '--action ACTION', names, 'Select an action to run (you may give this switch multiple times)', \" (#{names.join(', ')})\") do |v|\n options.actions << v\n end\n opts.on('-t', '--task TASK', @processor_class.tasks, 'Select a scraping task to run (you may give this switch multiple times)', \" (#{@processor_class.tasks.join(', ')})\") do |v|\n options.tasks << v\n end\n opts.on('-o', '--output_dir PATH', 'The directory or Redis address (e.g. redis://localhost:6379/0) in which to dump JSON documents') do |v|\n options.output_dir = v\n end\n opts.on('--pipelined', 'Dump JSON documents all at once') do |v|\n options.pipelined = v\n end\n opts.on('-c', '--cache_dir PATH', 'The directory or Memcached address (e.g. memcached://localhost:11211) in which to cache HTTP requests') do |v|\n options.cache_dir = v\n end\n opts.on('--no-cache', 'Disable HTTP request caching') do |v|\n options.cache_dir = nil\n end\n opts.on('-e', '--expires_in SECONDS', \"The cache's expiration time in seconds\") do |v|\n options.expires_in = v\n end\n opts.on('--value_max_bytes BYTES', \"The maximum Memcached item size\") do |v|\n options.value_max_bytes = v\n end\n opts.on('--memcached_username USERNAME', \"The Memcached username\") do |v|\n options.memcached_username = v\n end\n opts.on('--memcached_password USERNAME', \"The Memcached password\") do |v|\n options.memcached_password = v\n end\n opts.on('-d', '--database_url', 'The database URL (e.g. mongodb://USER:PASSWORD@localhost:27017/pupa or postgres://USER:PASSWORD@localhost:5432/pupa') do |v|\n options.database_url = v\n end\n opts.on('--[no-]validate', 'Validate JSON documents') do |v|\n options.validate = v\n end\n opts.on('-v', '--verbose', 'Show all messages') do\n options.level = 'DEBUG'\n end\n opts.on('-q', '--quiet', 'Show only warning and error messages') do\n options.level = 'WARN'\n end\n opts.on('-s', '--silent', 'Show no messages') do\n options.level = 'UNKNOWN'\n end\n opts.on('-n', '--dry-run', 'Show the plan without running any actions') do\n options.dry_run = true\n end\n\n opts.separator ''\n opts.separator 'Common options:'\n opts.on_tail('-h', '--help', 'Show this message') do\n puts opts\n exit\n end\n opts.on_tail('-v', '--version', 'Show version') do\n puts Pupa::VERSION\n exit\n end\n end\n end",
"def start_server(options = {})\n\n # Backward compatibility\n if options.is_a? String\n url = options\n port = nil\n logfile = nil\n else\n url = options[:url]\n port = options[:port]\n logfile = options[:logfile]\n end\n\n url = ENV['TALKSHOW_REMOTE_URL'] if ENV['TALKSHOW_REMOTE_URL']\n port = ENV['TALKSHOW_PORT'] if ENV['TALKSHOW_PORT']\n logfile = ENV['TALKSHOW_LOG'] if ENV['TALKSHOW_LOG']\n\n Talkshow::Server.set_port port if port\n Talkshow::Server.set_logfile logfile if logfile\n \n if !url\n @type = :thread\n @question_queue = ::Queue.new\n @answer_queue = ::Queue.new\n @thread = Thread.new do\n Talkshow::Server.question_queue(@question_queue)\n Talkshow::Server.answer_queue(@answer_queue)\n Talkshow::Server.run!\n end\n else\n @type = :remote\n @question_queue = Talkshow::Queue.new(url)\n @answer_queue = Talkshow::Queue.new(url)\n end\n \n end",
"def sidekiq_options(opts = T.unsafe(nil)); end",
"def default_options\n { dir_mode: :normal, dir: File.expand_path('daemon', project.path),\n multiple: false, log_output: true }\n end",
"def main(command_line_options=ARGV)\n parser = Slop::Parser.new cli_flags\n arguments = parse_arguments(command_line_options, parser)\n\n if arguments.key?(:ce) || arguments.key?(:ci) || arguments.key?(:h)\n if arguments.key?(:ci)\n\n end\n if arguments.key?(:ce)\n\n end\n if arguments.key?(:h)\n puts cli_flags\n end\n exit\n end\n\n elsif set?(arguments, :port)\n puts portquiz arguments[:port]\n elsif set?(arguments, :down)\n puts is_it_up arguments[:down]\n end",
"def initialize(info = {})\n super\n\n register_evasion_options(\n [\n OptBool.new('ONCRPC::tcp_request_fragmentation', [false, 'Enable fragmentation of TCP ONC/RPC requests', false]),\n ], Msf::Exploit::Remote::SunRPC\n )\n\n\n register_advanced_options(\n [\n OptInt.new('TIMEOUT', [true, 'Number of seconds to wait for responses to RPC calls', 10])\n # XXX: Use portmapper to do call - Direct portmap to make the request to the program portmap_req\n ], Msf::Exploit::Remote::SunRPC)\n\n register_options(\n [\n # XXX: XPORT\n Opt::RHOST,\n Opt::RPORT(111),\n ], Msf::Exploit::Remote::SunRPC\n )\n end",
"def host_notification_options=(arg)\n @host_notification_options = check_state_options(\n arg, %w(d u r f s n), 'host_notification_options')\n end",
"def set_prerun_config_defaults\n @@config.daemon_name = File.basename(__FILE__) unless @@config.daemon_name\n @@config.pid_file = \"#{@@config.daemon_name}.pid\" unless @@config.pid_file\n @@config.force_kill_wait = nil unless @@config.force_kill_wait\n @@config.group = nil unless @@config.group\n @@config.user = nil unless @@config.user\n end",
"def initialize(options) # :yield: mesg\n @options = options\n @options[\"Host\"] = \"localhost\" unless @options.has_key?(\"Host\")\n @options[\"Port\"] = 23 unless @options.has_key?(\"Port\")\n @options[\"Prompt\"] = /[$%#>] \\z/n unless @options.has_key?(\"Prompt\")\n @options[\"Timeout\"] = 10 unless @options.has_key?(\"Timeout\")\n @options[\"Waittime\"] = 0 unless @options.has_key?(\"Waittime\")\n unless @options.has_key?(\"Binmode\")\n @options[\"Binmode\"] = false\n else\n unless (true == @options[\"Binmode\"] or false == @options[\"Binmode\"])\n raise ArgumentError, \"Binmode option must be true or false\"\n end\n end\n\n unless @options.has_key?(\"Telnetmode\")\n @options[\"Telnetmode\"] = true\n else\n unless (true == @options[\"Telnetmode\"] or false == @options[\"Telnetmode\"])\n raise ArgumentError, \"Telnetmode option must be true or false\"\n end\n end\n\n @telnet_option = { \"SGA\" => false, \"BINARY\" => false }\n\n if @options.has_key?(\"Output_log\")\n @log = File.open(@options[\"Output_log\"], 'a+')\n @log.sync = true\n @log.binmode\n end\n\n if @options.has_key?(\"Dump_log\")\n @dumplog = File.open(@options[\"Dump_log\"], 'a+')\n @dumplog.sync = true\n @dumplog.binmode\n def @dumplog.log_dump(dir, x) # :nodoc:\n len = x.length\n addr = 0\n offset = 0\n while 0 < len\n if len < 16\n line = x[offset, len]\n else\n line = x[offset, 16]\n end\n hexvals = line.unpack('H*')[0]\n hexvals += ' ' * (32 - hexvals.length)\n hexvals = format(\"%s %s %s %s \" * 4, *hexvals.unpack('a2' * 16))\n line = line.gsub(/[\\000-\\037\\177-\\377]/n, '.')\n printf \"%s 0x%5.5x: %s%s\\n\", dir, addr, hexvals, line\n addr += 16\n offset += 16\n len -= 16\n end\n print \"\\n\"\n end\n end\n\n if @options.has_key?(\"Proxy\")\n if @options[\"Proxy\"].kind_of?(Net::Telnet)\n @sock = @options[\"Proxy\"].sock\n elsif @options[\"Proxy\"].kind_of?(IO)\n @sock = @options[\"Proxy\"]\n else\n raise \"Error: Proxy must be an instance of Net::Telnet or IO.\"\n end\n else\n message = \"Trying \" + @options[\"Host\"] + \"...\\n\"\n yield(message) if block_given?\n @log.write(message) if @options.has_key?(\"Output_log\")\n @dumplog.log_dump('#', message) if @options.has_key?(\"Dump_log\")\n\n begin\n if @options[\"Timeout\"] == false\n @sock = TCPSocket.open(@options[\"Host\"], @options[\"Port\"])\n else\n Timeout.timeout(@options[\"Timeout\"], Net::OpenTimeout) do\n @sock = TCPSocket.open(@options[\"Host\"], @options[\"Port\"])\n end\n end\n rescue Net::OpenTimeout\n raise Net::OpenTimeout, \"timed out while opening a connection to the host\"\n rescue\n @log.write($ERROR_INFO.to_s + \"\\n\") if @options.has_key?(\"Output_log\")\n @dumplog.log_dump('#', $ERROR_INFO.to_s + \"\\n\") if @options.has_key?(\"Dump_log\")\n raise\n end\n @sock.sync = true\n @sock.binmode\n\n message = \"Connected to \" + @options[\"Host\"] + \".\\n\"\n yield(message) if block_given?\n @log.write(message) if @options.has_key?(\"Output_log\")\n @dumplog.log_dump('#', message) if @options.has_key?(\"Dump_log\")\n end\n\n end",
"def run_option_parser\n @run_option_parser ||= begin\n require 'optparse'\n OptionParser.new do |op|\n op.on('-x') { set :lock, true }\n op.on('-e env') { |val| set :environment, val.to_sym }\n op.on('-s server') { |val| set :server, val }\n op.on('-p port') { |val| set :port, val.to_i }\n end \n end\n end",
"def setsockopt(*) end",
"def initialize(*args)\r\n arg=args[0]\r\n @packet_timeout = Resolver::DefaultPacketTimeout\r\n @port = Resolver::DefaultPort\r\n @udp_size = Resolver::DefaultUDPSize\r\n @use_tcp = false\r\n @tsig = nil\r\n @ignore_truncation = false\r\n @src_addr = '0.0.0.0'\r\n @src_port = 0\r\n @recurse = true\r\n @persistent_udp = false\r\n @persistent_tcp = false\r\n @dnssec = false\r\n \r\n if (arg==nil)\r\n # Get default config\r\n config = Config.new\r\n @server = config.nameserver[0]\r\n elsif (arg.kind_of?String)\r\n @server=arg\r\n elsif (arg.kind_of?Hash)\r\n arg.keys.each do |attr|\r\n begin\r\n send(attr.to_s+\"=\", arg[attr])\r\n rescue Exception\r\n TheLog.error(\"Argument #{attr} not valid\\n\")\r\n end\r\n # end\r\n end\r\n end\r\n #Check server is IP\r\n @server=Config.resolve_server(@server)\r\n \r\n end",
"def initialize\n @debug = false\n @verbose = false\n @quit = false\n @interval = 0.01\n @payload = nil\n @port = 8080\n @use_payload = false\n @receive = false\n\n get_options\n\n rescue => err\n STDERR.puts err\n STDERR.puts \"\\n\"\n STDERR.puts usage\n exit 1\n end",
"def program_options\n [\n # The values of the array are,\n # [long_option, short_option and parameter, description, code to execute] \n ['--to', '-t TO', \"Send email to recipent\",\n lambda { |value| options.to = value }\n ],\n ['--message', '-m MESSAGE', \"Include the message.\",\n lambda { |value| options.message = value }\n ],\n ['--subject', '-s SUBJECT', \"Include the subject.\",\n lambda { |value| options.subject = value }\n ],\n ['--verbose', '-v', \"Log to standard output.\",\n lambda { |value| options.verbose = true }\n ],\n ['--version', '-V', \"Display the program version.\",\n lambda { |value|\n puts \"#{program_name}, version #{PROGRAM_VERSION}\"\n exit\n }\n ]\n ]\nend",
"def update_server(opts = {})\n key_format = opts[:key_format] || 7\n cmd = \"tacacs-server host #{opts[:hostname]}\"\n cmd << ' single-connection' if opts[:multiplex]\n cmd << \" port #{opts[:port]}\" if opts[:port]\n cmd << \" timeout #{opts[:timeout]}\" if opts[:timeout]\n cmd << \" key #{key_format} #{opts[:key]}\" if opts[:key]\n configure cmd\n end",
"def servers\n tuples = config.scan(SERVER_REGEXP)\n tuples.map do |(host, mplex, vrf, port, tout, keyfm, key)|\n hsh = {}\n hsh[:hostname] = host\n hsh[:vrf] = vrf\n hsh[:port] = port.to_i\n hsh[:timeout] = tout.to_i\n hsh[:key_format] = keyfm.to_i\n hsh[:key] = key\n hsh[:multiplex] = mplex ? true : false\n hsh\n end\n end",
"def parse_options(options)\n OptionParser.new do |opts|\n opts.banner = 'Usage: cider-ci_flay FILE/DIR ...'\n\n opts.on('-d', '--print-details') do\n options.print_details = true\n end\n\n opts.on('-m', '--mass MASS', Integer,\n \"See flay documentation, default #{options.mass}.\") do |n|\n options.mass = n\n end\n end.parse!\n\n options\nend",
"def initialize(config_file, proc_id, proc_count)\n @config_basename = File.basename(config_file)\n @config = Dsl.load(config_file)\n @proc_id = proc_id\n @thpool = ThreadPool.new(THREAD_POOL_SIZE)\n @deferred_jobs = 0\n @completed_defers = 0\n @loop_counter = 0\n @jobq = ::Queue.new\n @proc_count = proc_count\n @ip_addrs = nil\n @complete = false\n @@con_pool = @con_pool = nil\n @@server = self\n @options = config.options.reverse_merge :verbose => false\n raise ArgumentError, \"config file does not have a required global csettings options\" unless options.has_key?(:csettings)\n #create readers for each of the above options\n self.extend self.options.to_mod\n\n @@logger = @logger = initialize_logger()\n\n Thread.current[:name] = 'main'\n\n Message.bind_config(config)\n Message.attach_logger(logger)\n# Timeseries.attach_logger(logger)\n Thread.abort_on_exception = false\n end",
"def supervisor(options)\n\n end",
"def postgresql_server(options = {})\n version = postgresql_version\n\n recipe :postgresql_client\n recipe :postgresql_scripts\n\n package \"postgresql-#{version}\",\n :ensure => :installed,\n :require => exec('update sources')\n package \"postgresql-contrib-#{version}\",\n :ensure => :installed,\n :require => exec('update sources')\n service 'postgresql',\n :ensure => :running,\n :hasstatus => true,\n :require => package(\"postgresql-#{version}\")\n\n notifies = if postgresql_restart_on_change\n [service('postgresql')]\n else\n []\n end\n # ensure the postgresql key is present on the configuration hash\n file \"/etc/postgresql/#{version}/main/pg_hba.conf\",\n :ensure => :present,\n :content => template(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'pg_hba.conf.erb'), binding),\n :require => package(\"postgresql-#{version}\"),\n :mode => '600',\n :owner => 'postgres',\n :group => 'postgres',\n :notify => notifies\n file \"/etc/postgresql/#{version}/main/postgresql.conf\",\n :ensure => :present,\n :content => template(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'postgresql.conf.erb'), binding),\n :require => package(\"postgresql-#{version}\"),\n :mode => '600',\n :owner => 'postgres',\n :group => 'postgres',\n :notify => notifies\n end",
"def initialize(options = {})\n @daemonize = options[:daemonize].nil? ? true : options[:daemonize]\n @pid_file = options[:pid_file].nil? ? nil : File.absolute_path(options[:pid_file])\n end",
"def help\n rez = \":mysql processlist - will show process list\\n\"\n rez << \":mysql status - will show mysql status\\n\"\n rez << \":mysql kill ID1[ ID2 ID3 ...] - will kill threads\\n\"\n end",
"def initialize(server, user, password, options = {})\n @server = server\n @user = user\n @password = password\n @connection = nil\n @ignore = options[:ignore]\n @recursion_level = 0\n @verbose = options[:verbose] || false\n @passive = options[:passive] || false\n @port = options[:port] || false\n\n end",
"def initialize(options={})\n @server_list = ServerList.new\n @groups = Hash.new { |h,k| h[k] = ServerList.new }\n @gateway = nil\n @open_groups = []\n @connect_threads = []\n @on_error = :fail\n @default_user = ENV['USER'] || ENV['USERNAME'] || \"unknown\"\n\n @open_connections = 0\n @pending_sessions = []\n @session_mutex = Mutex.new\n\n options.each { |opt, value| send(\"#{opt}=\", value) }\n end",
"def parse_opts (opts)\r\n\tbegin\r\n\t\toptions = OpenStruct.new\t\r\n\t\toptions.conf = false\r\n\t\toptions.app = nil # application name\r\n\t\toptions.priority = nil # app priority (70-90)\r\n\t\toptions.cli = nil # app command interpreter (e.g. ruby)\r\n\t\toptions.get = nil \r\n\t\toptions.put = nil\r\n\t\toptions.list = nil\r\n\t\toptions.status = nil\r\n\t\toptions.reg = nil\r\n\t\toptions.ureg = nil\r\n\t\toptions.del = nil\r\n\r\n\r\n\t\traise \"No valid options specified\" if opts == nil || opts.size < 1 \r\n\r\n\t\toptions.app = File.basename(pwd = Dir.pwd)\r\n\t\traise ArgumentError, \"Invalid current working directory (running from '/' root?)\" if options.app =~ /\\A\\//\r\nputs \"parsing opts 2\" \r\n\t\ti = 1\r\n\t\tcase opts[0]\r\n\t\t\twhen \"conf\", \"config\", \"configure\"\r\n\t\t\t\toptions.conf = true\r\n\r\n\t\t\twhen \"put\" # put [<file1>[ <file2>...]] - put file(s) to the reader (no files=all files)\r\n\t\t\t\toptions.put = f = []\r\n\t\t\t\tif opts.size == 1 # no args => all files\r\n\t\t\t\t\tf = file_list(Dir.pwd, :recursive=>false, :exclude=>[APP_CONF])\r\n\t\t\t\telse # specific files\r\n\t\t\t\t\topts[i,opts.size-1].each do |file|\r\n#\t\t\t\t\t\traise ArgumentError, \"File '#{file}' must be in the current folder\" if file =~ /[\\/\\\\]/\r\n\t\t\t\t\t\tfile = File.expand_path(file)\r\n\t\t\t\t\t\tnext if file == APP_CONF # skip configuration file\r\n\t\t\t\t\t\traise ArgumentError, \"'#{file}' was not found\" unless File.exist?(file) \r\n\t\t\t\t\t\traise ArgumentError, \"'#{file}' is not a file\" if File.directory?(file)\r\n\t\t\t\t\t\traise ArgumentError, \"'#{file}' is not in the current folder\" if file =~ /^#{pwd}[\\/\\\\]..*[\\/\\\\]/\r\n\t\t\t\t\t\tf << file\r\n\t\t\t\t\tend\r\n\t\t\t\tend\r\n\t\t\t\traise ArgumentError, \"No files to send\" if f.empty?\r\n\t\t\t\toptions.put = f\r\n\r\n\t\t\twhen \"get\" # [<file1>[ <file2>...]] - retrieve file(s) from the reader (no files=all files)\r\n\t\t\t\toptions.get = f = []\r\n\t\t\t\topts[i,opts.size-1].each do |file|\r\n\t\t\t\t\traise ArgumentError, \"File '#{file}' must be in the application's folder\" if file =~ /[\\/\\\\]/\r\n\t\t\t\t\traise ArgumentError, \"Invalid file name '#{file}'\" if /^-/ =~ file\r\n\t\t\t\t\tf << file.strip\r\n\t\t\t\tend\r\n\t\t\t\toptions.get = f\r\n\r\n\t\t\twhen \"del\", \"delete\" # <APP> - remove APP from the reader\r\n\t\t\t\traise ArgumentError, \"Invalid application name value\" if /^-/ =~ opts[i] # || /^./ =~ opts[i]\r\n\t\t\t\toptions.del = (opts.size==1) ? options.app : opts[i]\r\n\r\n\t\t\twhen \"l\", \"list\" # list applications installed on the reader\r\n\t\t\t\traise \"Invalid number of options\" unless opts.size <= 2\r\n\t\t\t\toptions.list = (opts.size==1) ? options.app : opts[i]\r\n\t\t\twhen \"s\", \"status\" # [APPNAME]\", \"display status of applications installed on the reader\"\r\n\t\t\t\traise \"Invalid number of options\" unless opts.size <= 2\r\n\t\t\t\toptions.status = (opts.size==1) ? options.app : opts[i] \r\n\r\n\t\t\twhen \"rg\", \"reg\", \"register\" # \"register application on the reader\"\r\n\t\t\t\toptions.reg = true\r\n\t\t\t# check for optional arguments\r\n\t\t\t\twhile i < opts.size do \r\n\t\t\t\t\tcase opts[i]\r\n\t\t\t\t\twhen \"-p\", \"--priority\" # application startup PRIORITY (70-90), default 80\r\n\t\t\t\t\t\traise ArgumentError, \"Priority value is missing\" unless (i+=1) < opts.size\r\n\t\t\t\t\t\topt = opts[i].to_i\r\n\t\t\t\t\t\traise ArgumentError, \"Priority value range must be 70-90\" if opt<70 || opt>90\r\n\t\t\t\t\t\toptions.priority = opt\r\n\t\t\t\t\twhen \"-c\", \"--cli\" # application command language interpreter (e.g. 'ruby')\r\n\t\t\t\t\t\traise ArgumentError, \"Command language interpreter value is missing\" unless (i+=1) < opts.size\r\n\t\t\t\t\t\topt = opts[i]\r\n\t\t\t\t\t\traise ArgumentError, \"Invalid command language interpreter value\" if /^-/ =~ opt\r\n\t\t\t\t\t\toptions.cli = opt\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\traise \"Invalid option #{opts[i]}\"\r\n\t\t\t\t\tend \r\n\t\t\t\t\ti += 1\r\n\t\t\t\tend\r\n\r\n\t\t\twhen \"ur\", \"ureg\", \"unreg\", \"unregister\" # \"unregister application on the reader\"\r\n\t\t\t\toptions.ureg = true\r\n\r\n\t\t\twhen \"help\", \"h\"\r\n\t\t\t\tusage\r\n\t\t\t\texit\r\n\r\n\t\t\twhen \"v\", \"ver\", \"version\"\r\n\t\t\t\tputs \"#{__FILE__} #{APP_NAME} ver.#{APP_VER}\"\r\n\t\t\t\texit\r\n\r\n\t\t\telse\r\n\t\t\t\traise \"Invalid command line option #{opts[0]}\"\r\n\t\tend\r\n\r\n\trescue ArgumentError\r\n#\t\tputs $!\r\n\t\traise\r\n\trescue\r\n\t\tusage\r\n\t\tputs\r\n#\t\tputs $!\r\n\t\traise\r\n\tend\r\n\r\nputs \"done parsing options\"\r\n\treturn options\r\nend",
"def options\n result = options_pre_mizuno\n result[:reuse_address] = true\n result\n end",
"def server_port; end",
"def cli_options\n { returns: [0],\n user: node[:jboss][:user],\n cwd: node[:jboss][:home]\n }\n end",
"def process_args args={}\n @type = args[:type] ? args[:type].to_sym : :all\n @server_type = args[:server_type] ? args[:server_type] : 'master'\n @server_id = args[:server_id] || @master[:server_id]\n @start_id = args[:start_id]\n\n if @server_type == 'master'\n @cur_server = @master\n else\n @cur_server = args\n end\n end",
"def parse_args( args )\n\toptions = OpenStruct.new\n\toptions.database = Etc.getpwuid( Process.uid ).name\n\toptions.host = '127.0.0.1'\n\toptions.port = 5432\n\toptions.user = Etc.getpwuid( Process.uid ).name\n\toptions.sslmode = 'prefer'\n\toptions.interval = 5\n\n\topts = OptionParser.new do |opts|\n\t\topts.banner = \"Usage: #{$0} [options]\"\n\n\t\topts.separator ''\n\t\topts.separator 'Connection options:'\n\n\t\topts.on( '-d', '--database DBNAME',\n\t\t\t\t\"specify the database to connect to (default: \\\"#{options.database}\\\")\" ) do |db|\n\t\t\toptions.database = db\n\t\tend\n\n\t\topts.on( '-h', '--host HOSTNAME', 'database server host' ) do |host|\n\t\t\toptions.host = host\n\t\tend\n\n\t\topts.on( '-p', '--port PORT', Integer,\n\t\t\t\t\"database server port (default: \\\"#{options.port}\\\")\" ) do |port|\n\t\t\toptions.port = port\n\t\tend\n\n\t\topts.on( '-U', '--user NAME',\n\t\t\t\t\"database user name (default: \\\"#{options.user}\\\")\" ) do |user|\n\t\t\toptions.user = user\n\t\tend\n\n\t\topts.on( '-W', 'force password prompt' ) do |pw|\n\t\t\tprint 'Password: '\n\t\t\tbegin\n\t\t\t\tsystem 'stty -echo'\n\t\t\t\toptions.pass = gets.chomp\n\t\t\tensure\n\t\t\t\tsystem 'stty echo'\n\t\t\t\tputs\n\t\t\tend\n\t\tend\n\n\t\topts.separator ''\n\t\topts.separator 'Other options:'\n\n\t\topts.on_tail( '--help', 'show this help, then exit' ) do\n\t\t\t$stderr.puts opts\n\t\t\texit\n\t\tend\n\n\t\topts.on_tail( '--version', 'output version information, then exit' ) do\n\t\t\tputs SCRIPT_VERSION\n\t\t\texit\n\t\tend\n\tend\n\n\topts.parse!( args )\n\treturn options\nend",
"def base_options\n [valid?(new_resource._?(:secure_storage, '-sSF')),\n valid?(new_resource._?(:master_passwd, '-mPF')),\n new_resource._?(:accept_license, '-acceptLicense'),\n ((new_resource.output == :silent) ? '-s' :\n (new_resource.output == :verbose) ? '-sP' :\n (new_resource.output == :debug) ? '-sVP' : '-sP')]\n end",
"def configureStartup\n `chkconfig --add nagios`\n `chkconfig --level 35 nagios on`\n `chkconfig --add httpd`\n `chkconfig --level 35 httpd on`\n `iptables -I INPUT 1 -s #{@ips[0]}/#{@mask} -p tcp -m tcp --dport 80 -j ACCEPT`\n `iptables -I INPUT 1 -s #{@ips[0]}/#{@mask} -p udp -m udp --dport 80 -j ACCEPT`\n `service iptables save`\n `service iptables restart`\n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def process_options\n \n end",
"def initialize(*args)\n @args = []\n @debug = false\n @env = false\n @fde = true\n @help = false\n @pretend = false\n @profile = false\n @report = false\n @graph = false\n @projects = false\n @stealth = false\n @disable_service = false\n @enable_service = false\n @restart_service = false\n @disable_services = false\n @enable_services = false\n @restart_services = false\n @list_services = false\n @color = true\n\n @options = OptionParser.new do |o|\n o.banner = \"Usage: #{File.basename $0} [options] [projects...]\\n\\n\"\n\n o.on \"--debug\", \"Be really verbose.\" do\n @debug = true\n end\n\n o.on \"--pretend\", \"--noop\", \"Don't make changes.\" do\n @pretend = true\n end\n\n o.on \"--report\", \"Enable puppet reports.\" do\n @report = true\n end\n\n o.on \"--graph\", \"Enable generation of dependency graphs.\" do\n @graph = true\n end\n\n o.on \"--env\", \"Show useful environment variables.\" do\n @env = true\n end\n\n o.on \"--help\", \"-h\", \"-?\", \"Show help.\" do\n @help = true\n end\n\n o.on \"--disable-service SERVICE\", \"Disable a Boxen service.\" do |service|\n @disable_service = service\n end\n\n o.on \"--enable-service SERVICE\", \"Enable a Boxen service.\" do |service|\n @enable_service = service\n end\n\n o.on \"--restart-service SERVICE\", \"Restart a Boxen service.\" do |service|\n @restart_service = service\n end\n\n o.on \"--disable-services\", \"Disable all Boxen services.\" do\n @disable_services = true\n end\n\n o.on \"--enable-services\", \"Enable all Boxen services.\" do\n @enable_services = true\n end\n\n o.on \"--restart-services\", \"Restart all Boxen services.\" do\n @restart_services = true\n end\n\n o.on \"--list-services\", \"List Boxen services.\" do\n @list_services = true\n end\n\n o.on \"--homedir DIR\", \"Boxen's home directory.\" do |homedir|\n @homedir = homedir\n end\n\n o.on \"--logfile DIR\", \"Boxen's log file.\" do |logfile|\n @logfile = logfile\n end\n\n o.on \"--login LOGIN\", \"Your GitHub login.\" do |login|\n @login = login\n end\n\n o.on \"--no-fde\", \"Don't require full disk encryption.\" do\n @fde = false\n end\n\n # --no-pull is used before options are parsed, but consumed here.\n\n o.on \"--no-pull\", \"Don't try to update code before applying.\"\n\n o.on \"--no-issue\", \"--stealth\", \"Don't open an issue on failure.\" do\n @stealth = true\n end\n\n o.on \"--token TOKEN\", \"Your GitHub OAuth token.\" do |token|\n @token = token\n end\n\n o.on \"--profile\", \"Profile the Puppet run.\" do\n @profile = true\n end\n\n o.on \"--future-parser\", \"Enable the Puppet future parser\" do\n @future_parser = true\n end\n\n o.on \"--projects\", \"Show available projects.\" do\n @projects = true\n end\n\n o.on \"--srcdir DIR\", \"The directory where repos live.\" do |srcdir|\n @srcdir = srcdir\n end\n\n o.on \"--user USER\", \"Your local user.\" do |user|\n @user = user\n end\n\n o.on \"--no-color\", \"Disable colors.\" do\n @color = false\n end\n end\n\n parse args.flatten.compact\n end",
"def start_daemon(config, &block) # :yields: socket_server\n c = DEFAULT.dup\n c.update(config)\n\n File.umask(c[:daemon_umask])\n\n if (c[:status_file]) then\n status_file = StatusFile.new(c[:status_file])\n status_file.open\n status_file.lock or abort(\"#{c[:daemon_name]} daemon is already running.\")\n end\n\n if (c[:daemonize]) then\n logger = Syslog::Logger.new(c[:daemon_name])\n def logger.close\n Syslog::Logger.syslog = nil\n Syslog.close\n nil\n end\n else\n logger = Logger.new(STDOUT)\n logger.progname = c[:daemon_name]\n def logger.close # not close STDOUT\n end\n end\n\n if (c[:daemon_debug]) then\n logger.level = Logger::DEBUG\n else\n logger.level = Logger::INFO\n end\n\n if (c[:listen_address].respond_to? :call) then\n sockaddr_get = c[:listen_address]\n else\n sockaddr_get = proc{ c[:listen_address] }\n end\n\n euid = Daemon.get_uid(c[:server_privileged_user])\n egid = Daemon.get_gid(c[:server_privileged_group])\n\n root_process = RootProcess.new(logger, sockaddr_get, c[:server_polling_interval_seconds], c[:server_restart_overlap_seconds], euid, egid, &block)\n [ [ :signal_stop_graceful, proc{ root_process.signal_stop_graceful } ],\n [ :signal_stop_forced, proc{ root_process.signal_stop_forced } ],\n [ :signal_stat_get_and_reset, proc{ root_process.signal_stat_get(reset: true) } ],\n [ :signal_stat_get_no_reset, proc{ root_process.signal_stat_get(reset: false) } ],\n [ :signal_stat_stop, proc{ root_process.signal_stat_stop } ],\n [ :signal_restart_graceful, proc{ root_process.signal_restart_graceful } ],\n [ :signal_restart_forced, proc{ root_process.signal_restart_forced } ]\n ].each{|sig_key, sig_hook|\n if (signal = c[sig_key]) then\n Signal.trap(signal, &sig_hook)\n end\n }\n Signal.trap(:CHLD) { root_process.signal_server_down }\n\n if (c[:daemonize]) then\n Process.daemon(c[:daemon_nochdir])\n end\n\n # update after process ID changes in daemonization.\n if (c[:status_file]) then\n status_file.write({ 'pid' => $$ }.to_yaml)\n end\n\n status = root_process.start\n exit(status)\n end",
"def options() end",
"def check_server_options(event)\n if event.content =~ /(^!dm prefix)/i\n if @launch_option == 'lite'\n event.respond(content: 'This option is not supported with Dice Maiden Lite.')\n return true\n end\n handle_prefix(event)\n elsif event.content =~ /(^!dm request)/i\n if @launch_option == 'lite'\n event.respond(content: 'This option is not supported with Dice Maiden Lite.')\n return true\n end\n set_show_request(event)\n end\nend",
"def initialize(pstack, server)\n super(pstack)\n @server = server\n @wopts = {}\n getopts(@server.service_negotiation)\n @mode = :normal # Parse mode :normal, :cmd, :cr\n @state = {}\n @sc = nil\n @sneg_opts = [ TTYPE, ZMP ] # supported options which imply an initial\n # sub negotiation of options\n @ttype = []\n @init_tries = 0 # Number of tries at negotitating sub options\n @synch = false\n log.debug \"telnet filter initialized - #{@init_tries}\"\n end",
"def main\n STDERR.reopen File.join(File.dirname(__FILE__), \"../../log/master.err\"+($is_debug ? \".dug\" :\"\"))\n #server=TCPServer::new('10.0.0.60',port)\n @server=TCPServer::new(@port)\n $logger.debug \"Running on Port #{@port}\"\n begin\n if defined?(Fcntl::FD_CLOEXEC)\n @server.fcntl(Fcntl::FD_CLOEXEC, 1)\n end\n @server.listen(5)\n #@sock=@server.accept_nonblock\n rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR\n IO.select([@server])\n retry\n end\n\n get_local_analyzers.each { |analyzer|\n # If on start if analyzer is in downstream mode and ingress then restart the processl\n if (analyzer.cmd_port.nil?) && ((analyzer.status == Analyzers::INGRESS) || (analyzer.status == Analyzers::DOWNSTREAM))\n port=get_port(analyzer.id)\n $logger.error \"We don't have a port number for #{analyzer.id}, assigning it #{port}\"\n elsif (!analyzer.cmd_port.nil?) && ((analyzer.status == Analyzers::INGRESS) || (analyzer.status == Analyzers::DOWNSTREAM))\n @ports_analyzer[analyzer.cmd_port - @start_port + 1]=analyzer.id\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n begin\n `touch /tmp/keepalive_#{analyzer.id}.out`\n rescue Exception => e\n $logger.debug \"raised a error,when touch KeepAlive file.\"\n $logger.debug e.class\n $logger.debug e.message\n end\n #analyzer.update_attributes({:status=>Analyzer::DISCONNECTED})\n }\n\n an_count=get_local_analyzers.size\n try_count=Array.new(an_count, 0)\n retrys= case an_count/5\n when 0 then\n 5\n when 1 then\n 3\n else\n 2\n end\n while (1)\n get_local_analyzers.each { |analyzer|\n if (!analyzer.cmd_port.nil?)\n @ports_analyzer[analyzer.cmd_port - @start_port + 1]=analyzer.id\n try_count[analyzer.id]=0 if try_count[analyzer.id].nil?\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n if $is_debug && (not $loggers.has_key? analyzer.id)\n $loggers[analyzer.id] = Logger.new(File.join(File.dirname(__FILE__), \"../../log/master_#{analyzer.id}.dug\"))\n $loggers[analyzer.id].formatter = MasterPrettyErrors.new\n $loggers[analyzer.id].level=Logger::DEBUG\n end\n }\n time=Time.now()\n selected_socket_list=IO.select([@server], nil, nil, 5)\n if (selected_socket_list.nil?)\n $logger.debug \"Nothing to send Do a heartbeat\"\n #logger.debugs @ports_analyzer.inspect()\n @ports_analyzer.each_index { |port_index|\n analyzer_id=@ports_analyzer[port_index]\n port=nil\n if !analyzer_id.nil?\n port=get_port(analyzer_id)\n end\n\n unless port.nil?\n # keepalive check\n begin\n active_time=File.ctime(\"/tmp/keepalive_#{analyzer_id}.out\")\n if Time.now-active_time > 1200\n $logger.debug \"KeepAlive overdue for #{analyzer_id}\"\n raise\n end\n rescue Errno::ENOENT => e\n $logger.debug \"KeepAlive doesn't exist!\"\n `touch /tmp/keepalive_#{analyzer_id}.out`\n rescue Exception => e\n $logger.debug \"Monitor process dead, let's kill it!\"\n anl=Analyzers.find(analyzer_id)\n if (!anl.nil?) && (!anl.pid.nil?) && (anl.pid != 0)\n begin\n $loggers[anl.id].debug \"Kill analyzer process #{anl.pid}\" if $is_debug\n `kill -9 #{anl.pid}`\n try_count[analyzer_id]=0\n rescue\n end\n else\n System_logs.log(\"Unable to start monitoring process for Analyzer: #{anl.name}\", nil, System_logs::MESSAGE, analyzer_id)\n $loggers[anl.id].debug \"Unable to start monitoring process for Analyzer: #{anl.name}\" if $is_debug\n anl.update_attributes({:pid => nil})\n end\n $logger.debug \"Restarting monitor for #{analyzer_id}\"\n $loggers[anl.id].debug \"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\" if $is_debug\n System_logs.log(\"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\", nil, System_logs::MESSAGE, analyzer_id)\n `touch /tmp/keepalive_#{analyzer_id}.out`\n start_monitor(analyzer_id, port)\n try_count[analyzer_id] = 0\n next\n end\n\n try_count[analyzer_id] +=1\n request=Net::HTTP.new('localhost', port)\n $logger.debug \"Do a heartbeat on #{port}\"\n #tries=0\n flag=true\n begin\n #sleep 5\n #tries +=1\n $logger.debug \"TRY # #{try_count[analyzer_id]}\"\n $loggers[analyzer_id].debug \"Confirm analyzer cmd_port try_count # #{try_count[analyzer_id]}\" if $is_debug\n request.read_timeout=10\n response=request.get(\"/\")\n rescue Timeout::Error #Instrument not responding. Lets kill the process.\n $logger.debug \"Timeout::Error\"\n flag=false\n anl=Analyzers.find(analyzer_id)\n if (try_count[analyzer_id] > retrys)\n if (!anl.nil?) && (!anl.pid.nil?) && (anl.pid != 0)\n begin\n #`kill -9 #{anl.pid}`\n $logger.debug \"Kill analyzer process #{anl.pid}\"\n $loggers[anl.id].debug \"Kill analyzer process #{anl.pid}\" if $is_debug\n Process.kill(\"TERM\", anl.pid)\n try_count[analyzer_id]=0\n rescue\n end\n else\n System_logs.log(\"Unable to start monitoring process for Analyzer: #{anl.name}\", nil, System_logs::MESSAGE, analyzer_id)\n $loggers[anl.id].debug \"Unable to start monitoring process for Analyzers: #{anl.name}\" if $is_debug\n anl.update_attributes({:pid => nil})\n end\n end\n rescue Exception => e\n $logger.debug \"#{e.message}\"\n #sleep 5\n #$logger.debug \"Try again\"\n flag=false\n #if (try_count[analyzer_id] > 5)\n if (try_count[analyzer_id] > retrys)\n anl=Analyzers.find(analyzer_id)\n #ret = `ps -ef | grep #{anl.pid}`\n #unless ret.include?(\"monitor\")\n begin\n if Sticky_ID != -1 && Region.find(Analyzers.find(analyzer_id).region_id).server_id != Sticky_ID\n $logger.debug \"This analyzer is not on this server.\"\n $loggers[anl.id].debug \"This analyzer is not on this server.\" if $is_debug\n next\n end\n\n Process::getpgid anl.pid\n try_count[analyzer_id]=0\n rescue => e\n puts e.message\n try_count[analyzer_id]=0\n $logger.debug \"Restarting monitor for #{analyzer_id}\"\n System_logs.log(\"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\", nil, System_logs::MESSAGE, analyzer_id)\n $loggers[anl.id].debug \"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\" if $is_debug\n `touch /tmp/keepalive_#{analyzer_id}.out`\n start_monitor(analyzer_id, port)\n end\n end\n end\n if flag==true\n try_count[analyzer_id]=0\n end\n $logger.debug \"response.inspect: #{response.inspect()}\"\n end\n diff=Time.now-time\n if diff < 5\n sleep (5-diff)\n end\n }\n else\n selected_socket=selected_socket_list[0].first()\n @sock=selected_socket.accept\n process()\n end\n end\n end",
"def server\n @_server ||= case options.fetch(:type, :tcp)\n when :tcp\n TCPServer.new options.fetch(:host, \"127.0.0.1\"),\n options.fetch(:port, 2010)\n when :unix\n UNIXServer.new options.fetch(:path)\n when :pipe\n FakeServer.new options.fetch(:pipe)\n end\n end",
"def parse_options\r\n options = {\r\n 'port' => nil,\r\n 'secure' => false\r\n }\r\n OptionParser.new do |opts|\r\n opts.banner = 'Usage: --port port'\r\n opts.on('--port PORT', 'server port') do |v|\r\n options['port'] = v\r\n end\r\n opts.on('--use_tls USE_TLS', ['false', 'true'],\r\n 'require a secure connection?') do |v|\r\n options['secure'] = v == 'true'\r\n end\r\n end.parse!\r\n\r\n if options['port'].nil?\r\n fail(OptionParser::MissingArgument, 'please specify --port')\r\n end\r\n options\r\nend",
"def initialize(server, newnick, opts)\n raise ArgumentError, \"Please specify at least one channel\" unless opts[:channel] or opts[:channels]\n \n @nick = newnick\n @server = server\n @port = opts[:port]\n @port ||= 6667\n @local_ip = opts[:local_ip]\n @options = opts\n @listeners = Set.new\n @listeners << self\n @logger = @options[:logger]\n @nick_generator = Proc.new do |oldnick|\n if options[:ghost_without_password] then\n message \"GHOST #{oldnick}\", 'NickServ'\n nil\n elsif options[:dont_ghost] or options[:password].nil? then\n \"#{oldnick}_\"\n else\n message \"GHOST #{oldnick} #{options[:password]}\", 'NickServ'\n nil\n end\n end\n @server_type = Daemon[opts[:server_type]]\n @server_type ||= Daemon.default\n @throttle_rate = opts[:throttle_rate]\n @throttle_rate ||= 1\n @throttle_threshold = opts[:throttle_threshold]\n @throttle_threshold ||= 5\n \n @when_long = (opts[:when_long] || :send).to_sym\n @max_message_length = opts[:max_message_length].to_i\n @max_message_length = 500 if @max_message_length < 1\n \n @nick_regex = (opts[:nick_regex] ? opts[:nick_regex].to_re : NICK_REGEX)\n \n @channels = Set.new\n @channels.merge opts[:channels] if opts[:channels]\n @channels << opts[:channel] if opts[:channel]\n @channels.map! do |chan|\n if chan.kind_of? Hash then\n { normalized_channel_name(chan.keys.only) => chan.values.only }\n else\n normalized_channel_name chan\n end\n end\n # Make a hash of channels to their passwords\n @channel_passwords = @channels.select { |ch| ch.kind_of? Hash }.mash { |pair| pair }\n # Strip the passwords from @channels, making it an array of channel names only\n @channels.map! { |chan| chan.kind_of?(Hash) ? chan.keys.only : chan }\n @channel_members = Hash.new\n @updating_channel_members = Hash.new # stores the NAMES list as its being built\n \n if @throttle = opts[:throttle] then\n @messages_queue = Queue.new\n @messages_thread = Thread.new do\n throttled = false\n loop do\n args = @messages_queue.pop\n throttled = true if not throttled and @messages_queue.length >= @throttle_threshold\n throttled = false if throttled and @messages_queue.empty?\n sleep @throttle_rate if throttled\n privmsg *args\n end\n end\n end\n \n @chan_mutex = Mutex.new\n @join_mutex = Mutex.new\n @socket_mutex = Mutex.new\n end"
] |
[
"0.60628885",
"0.59429365",
"0.58650863",
"0.58417577",
"0.5769326",
"0.5734786",
"0.5601387",
"0.55294394",
"0.5472042",
"0.5432906",
"0.54265237",
"0.5419419",
"0.53925216",
"0.5384949",
"0.53476393",
"0.5342322",
"0.5341511",
"0.53003466",
"0.5296648",
"0.5295062",
"0.5282721",
"0.52822363",
"0.5272228",
"0.52607185",
"0.52198565",
"0.52159476",
"0.52159476",
"0.52097243",
"0.52070737",
"0.5201728",
"0.5194146",
"0.5193276",
"0.51775974",
"0.51765877",
"0.5161249",
"0.5155993",
"0.5154281",
"0.51474494",
"0.5121321",
"0.51055723",
"0.5092964",
"0.50551176",
"0.5053357",
"0.5041341",
"0.50032276",
"0.5002876",
"0.4972896",
"0.49678823",
"0.4960271",
"0.49526364",
"0.49426183",
"0.49425608",
"0.4933766",
"0.4933754",
"0.49165815",
"0.49124238",
"0.48922548",
"0.48885962",
"0.48877314",
"0.48872426",
"0.48870853",
"0.48780057",
"0.4868392",
"0.48670363",
"0.48568776",
"0.4854128",
"0.4844043",
"0.48436266",
"0.48432332",
"0.48350042",
"0.48298344",
"0.48272696",
"0.48220584",
"0.48189726",
"0.48175195",
"0.48097682",
"0.4809164",
"0.48017275",
"0.4794466",
"0.4794431",
"0.47847232",
"0.4781973",
"0.47736123",
"0.47665453",
"0.47614643",
"0.4758264",
"0.47538787",
"0.47477898",
"0.47422785",
"0.47422785",
"0.47422785",
"0.47402748",
"0.47358233",
"0.4733521",
"0.4733484",
"0.47308806",
"0.47276384",
"0.4722081",
"0.47201476",
"0.47182783"
] |
0.499497
|
46
|
This blocks anyone posting a link from paypal in chat
|
def no_paypal_content
errors.add_to_base("Please, no thirdparty websites.") if content =~ /paypal/i
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allow_mails_from_merchant\n end",
"def reject(deal)\n @deal, @merchant = deal, deal.merchant\n @deal_url = merchant_promo_url(@merchant, @deal)\n \n mail :to => deal.merchant.email\n end",
"def garantir_link\n if link.present?\n link_params = link\n _link = link_params.split('/').reject { |l| l.blank? || l == 'http:' }\n _link[0].sub!(/s.|[^.]*.|\\s./, '') if _link[0].split('.').length == 3\n if ['herokuapp.com', 'codepen.io'].include? _link[0]\n link_params.gsub!('/' + _link[2] + '/', '/debug/')\n link_params.remove!('?' + _link[-1].split('?')[-1])\n elsif !_link[0]['.com'].try(:presence?)\n # sem link\n link_params.sub!('/', '') if _link[0] == '/'\n else\n errors.add(:link, 'Não é permitido.')\n return false\n end\n self.link = link_params\n end\n end",
"def noreferrer?; end",
"def block_from_invitation?\n false\n end",
"def reject_social_links(attributes)\n attributes[\"url\"].blank? && !self.social_links.where(site: attributes[\"site\"]).exists?\n end",
"def when_i_submit_bad_url\n given_i_am_signed_in\n # shouldn't get to the stage of finding\n submit_url 'http://thisisspam.com/fake-viagra.html'\nend",
"def share_non_member(notebook, sharer, emails, message, url)\n @notebook = notebook\n @url = url.chomp('/')\n @sharer = sharer\n @message = message\n @email_needs_to_be_simplified = need_to_simplify_email?(@notebook, @message)\n mail(\n bcc: emails,\n subject: \"NBGallery notebook shared with you\"\n )\n end",
"def request_declined me \n @amount = me.amount\n @me = me\n @currency = me.account.currency\n subjects = \"Money request declined by recipient!\"\n mail to: me.sender.email, subject: subjects\n end",
"def rejected(bid)\n @bid = bid\n mail :to => bid.bidder.email\n body :bid => bid\n end",
"def email_deny(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/deny\", params)\n end",
"def mailhide(email)\n \n pubkey = \"01YEt2vML25j_mJdXHCZp5sA==\"\n privkey = \"DC8DD53D1762851B633183724D4BCD3D\"\n encrypted_email = Base64.encode64(encrypt(privkey, pad_string(email, 16))).tr('+/','-_')\n \n return \"http://mailhide.recaptcha.net/d?k=\"+pubkey+\"&c=\"+encrypted_email\n end",
"def check_only_links\n end",
"def bots_not_allowed\n render_403('page') if visitor_is_bot?\n end",
"def tweet_rejected_by_advertiser(tweet)\n @tweet = tweet\n\n set_attachments\n\n mail(to: tweet.influencer.user.email, subject: \"Notificaciones @ Social Target - Una propuesta de tweet que has modificado, ha sido rechazada por el anunciante\")\n end",
"def share_confirm(sharer_id, receiver_id, share_amount)\n @receiver = User.find(receiver_id)\n @user = User.find(sharer_id)\n @share_amount = share_amount\n mail :to => recipient(@user.email), :subject => \"#{@receiver.display_name} has accepted your shared tips\"\n end",
"def old_notify_user (listing, sender, receiver)\n send_as :notification\n from sender.facebook_session.user \n recipients receiver.facebook_session.user\n #fbml \"<a href='#{FB_APP_HOME_URL}/listings/#{listing.id}'><b>#{listing.title}</b></a> has been approved.\"\n fbml \"Your listing: <a href='#{listings_path(listing.id)}}'><b>#{listing.title}</b></a> has been approved.\"\n end",
"def block_processed\n if @registration && @registration.voted_digitally?\n redirect_to thanks_url\n end\n end",
"def apply_privacy(msg)\n if !msg[:privacy] || msg[:privacy].to_s == \"none\"\n return msg\n else\n if msg.privacys.include?(\"user\")\n if msg.class == Request \n if msg.method == \"REFER\"\n msg.referred_by ='sip:anonymous@anonymous.invalid'\n end\n msg.from.uri = \"sip:anonymous@anonymous.invalid\"\n msg.from.display_name ='\"Anonymous\"' \n elsif msg[:warning]\n warn_code,warn_agent,warn_text = msg.warning.to_s.split(' ',3)\n msg.warning = warn_code + \" \" + warn_text\n end \n end \n msg.privacy = nil\n return msg\n end \n end",
"def disapprove(user)\n set_attachments\n\n @user = user\n\n mail(to: user.email, subject: \"Cuenta Desactivada @ Social Target - Its time to go social\")\n end",
"def cancel_double_paypal_payments\n return unless order\n\n if service_provider == paypal_ipn\n unaccept_self_if_existing_paypal\n elsif /PayPal/.match?(service_provider)\n unaccept_previous_ipn\n end\n end",
"def denial(user, company, affiliation)\n @subject = \"Unable to authorize #{user.name} to trade at Foodmoves.com\"\n @body = {:user => user,\n :company => company,\n :affiliation => affiliation}\n @recipients = user.email\n @bcc = @@bcc\n @from = 'Foodmoves Support <support@foodmoves.com>'\n @sent_on = Time.now\n end",
"def send_verify_email_link\n service_response = UserManagement::SendDoubleOptInLink.new(params).perform\n render_api_response(service_response)\n end",
"def reject_unadded_users\n if !ensure_bebo_application_is_installed\n new_params = {\"apikey\" => @connection.auth_data[\"api_key\"], \"next\" => url_for(params)}\n signature = @connection.signature(new_params)\n render :text =>\n \"<sn:redirect url='http://bebo.com/c/apps/add?ApiKey=#{@connection.auth_data[\"api_key\"]}&next=#{new_params[:next]}&sig=#{signature}'/>\" and return\n end\n end",
"def is_spam? \n # You'll need to get your own Akismet API key from www.akismet.com\n \n #return false;\n \n @akismet = Akismet.new('key', 'webpage') \n \n return nil unless @akismet.verifyAPIKey\n \n return self.spam!(:exempt => true) if @akismet.commentCheck(\n self.author_ip, # remote IP\n self.user_agent, # user agent\n self.referrer, # http referer\n self.page.url, # permalink\n 'comment', # comment type\n self.author, # author name\n self.author_email, # author email\n self.author_url, # author url\n self.content, # comment text\n {}) # other\n end",
"def ipn\n # Create a notify object we must\n notify = Paypal::Notification.new(request.raw_post)\n\n #we must make sure this transaction id is not already completed\n\n if notify.acknowledge\n begin\n # if notify.complete?\n end\n else\n # another reason to be suspicious\n end\n\n render :nothing => true\n end",
"def reply_neg\n puts 'AWW BOO'\n # byebug\n friend_deny=Follow.find_by(follower_id: follow_params[:user2], followee_id: decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n if friend_deny.destroy\n render json: {friend_deny: 'success'}\n else\n render json: {friend_deny: 'failure'}\n end\n end",
"def allow_paypal_payments?\n paypal_credentials.present? || paypal_email.present?\n end",
"def charge_paypal_account(amount)\n true\n end",
"def charge_paypal_account(amount)\n true\n end",
"def require_one_click_payment?(source, shopper)\n false\n end",
"def sender_can_bill?\n !posts.detect { |post| post.can_bill? user }.nil?\n end",
"def skip_reconfirmation!; end",
"def handle_unverified_request\n redirect_to root_url, :notice => \"We detect unmatching token form your form, please do not hack us\"\n \n end",
"def account_blocked(user, project = nil)\n setup_email(user)\n @subject += head_encode((project ? project.login : 'Your account'.t) + \" has been banned from the Kroogi Network\".t)\n @body[:user] = user\n @body[:project] = project\n end",
"def accepted(bid)\n @bid = bid\n \n mail :to => bid.bidder.email\n body :bid => bid\n end",
"def deal_liked(target, like)\n @target = target\n @user = like.user\n @deal = like.deal\n @like = like\n mail :to => target.email, \n :tag => \"like\",\n :subject => \"#{@user.best_name} loved your Qwiqq post!\"\n end",
"def set_receipt_url\r\n if @PARAM_HASH['RECEIPT_FORM_ID']== 'remote_url'\r\n return @PARAM_HASH['REMOTE_URL']\r\n else\r\n return 'https://secure.bluepay.com/interfaces/shpf?SHPF_FORM_ID=' + @PARAM_HASH['RECEIPT_FORM_ID'] + \r\n '&SHPF_ACCOUNT_ID=' + ACCOUNT_ID + \r\n '&SHPF_TPS_DEF=' + url_encode(@receipt_tps_def) + \r\n '&SHPF_TPS=' + url_encode(@receipt_tamper_proof_seal) + \r\n '&RETURN_URL=' + url_encode(@PARAM_HASH['RETURN_URL']) + \r\n '&DBA=' + url_encode(@PARAM_HASH['DBA']) + \r\n '&AMEX_IMAGE=' + url_encode(@PARAM_HASH['AMEX_IMAGE']) + \r\n '&DISCOVER_IMAGE=' + url_encode(@PARAM_HASH['DISCOVER_IMAGE'])\r\n end\r\n end",
"def rejection(recipient, listing_title, listing_id)\n subject \"Your listing \\'#{listing_title}\\' has been reject. Please edit and resubmitted.\"\n recipients recipient\n from 'Project Bordeaux No-Reply <no-reply@appfactory.us>'\n sent_on Time.now\n body :url => FB_APP_HOME_URL, :listing_title => listing_title, :listing_id => listing_id\n end",
"def received (payment)\n @payment = payment\n\n mail to: payment.user.email, subject: \"Подтверждение пополнения баланса на kupibazar.com\"\n end",
"def tweet_accepted_by_advertiser(tweet)\n @tweet = tweet\n\n set_attachments\n\n mail(to: tweet.influencer.user.email, subject: \"Notificaciones @ Social Target - Uno de tus tweets revisados, fue aceptado por una empresa y esta listo para ser públicado\")\n end",
"def loan_request_notification(owner, requester, user_lacquer)\n @owner = owner\n @requester = requester\n @user_lacquer = user_lacquer\n @user_url = \"http://www.lacquerloveandlend.com/users/#{@owner.id}\"\n\n mail(to: @owner.email, subject: \"#{@requester.name} wants to borrow #{@user_lacquer.lacquer.name}\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end",
"def recipient_can_bill?\n !posts.detect { |post| post.can_bill? recipient }.nil?\n end",
"def disable_link\n @disable_link = true\n end",
"def reject?(sender)\r\n false\r\n end",
"def tradeya_postponed(n)\n @tradeya = n.trade.item\n @offer = n.trade.offer\n headers['X-SMTPAPI'] = '{\"category\": \"TradeYa postponed offerer copy\"}'\n mail(:to => @offer.user.email, :subject => 'TradeYa has been Postponed', :from => 'TradeYa <jared@tradeya.com>', :content_type => \"text/html\")\n end",
"def sent_only_to_me\n return @sent_only_to_me\n end",
"def send_link\n @purchase = Purchase.find_by_id params[:id]\n if !@purchase\n redirect_to '/admin/purchases'\n return\n end\n @message = params[:message].blank? ? I18n.t('admin.purchases.links.empty_message') : params[:message]\n UserMailer.purchase_resume(params[:emails].split(','), @purchase, @message).deliver\n redirect_to '/admin/purchases'\n end",
"def no_spamming\n created_urls = submitter.submitted_urls\n num_of_recent_urls = created_urls\n .where('created_at > ?', 1.minute.ago)\n .count\n\n raise \"Cannot create more than 5 shortened links in a minute!\" if num_of_recent_urls >= 5 \n end",
"def can_void?(payment)\n !payment.void?\n end",
"def can_void?(payment)\n !payment.void?\n end",
"def low_credit_warning_to_advertiser(user)\n @user = user\n @advertiser = user.advertiser\n\n set_attachments\n\n mail(to: user.email, subject: \"Su crédito ha disminuido a $#{sprintf('%.02f', @user.balance)} - Its time to go social\")\n end",
"def dont_send\n current_div.button(:id=>\"send_message_cancel\").click\n wait_for_ajax\n end",
"def set_receipt_url\r\n if @PARAM_HASH['RECEIPT_FORM_ID']== 'remote_url'\r\n return @PARAM_HASH['REMOTE_URL']\r\n else\r\n return 'https://secure.bluepay.com/interfaces/shpf?SHPF_FORM_ID=' + @PARAM_HASH['RECEIPT_FORM_ID'] + \r\n '&SHPF_ACCOUNT_ID=' + @ACCOUNT_ID + \r\n '&SHPF_TPS_DEF=' + url_encode(@receipt_tps_def) + \r\n '&SHPF_TPS_HASH_TYPE=' + url_encode(@PARAM_HASH['RECEIPT_TPS_HASH_TYPE']) +\r\n '&SHPF_TPS=' + url_encode(@receipt_tamper_proof_seal) + \r\n '&RETURN_URL=' + url_encode(@PARAM_HASH['RETURN_URL']) + \r\n '&DBA=' + url_encode(@PARAM_HASH['DBA']) + \r\n '&AMEX_IMAGE=' + url_encode(@PARAM_HASH['AMEX_IMAGE']) + \r\n '&DISCOVER_IMAGE=' + url_encode(@PARAM_HASH['DISCOVER_IMAGE'])\r\n end\r\n end",
"def denied\n ContactMailer.denied\n end",
"def deny_publish client, &block\n control_request(\"deny_publish\", client, &block)\n end",
"def ban!\n MTurkUtils.ban_user self\n end",
"def validate!\n uri = URI.parse('https://www.paypal.com/cgi-bin/webscr?cmd=_notify-validate')\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.open_timeout = 60\n http.read_timeout = 60\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = true\n response = http.post(uri.request_uri, self.data,\n 'Content-Length' => \"#{self.data.size}\",\n 'User-Agent' => \"Ruby on Rails\"\n ).body\n\n unless [\"VERIFIED\", \"INVALID\"].include?(response)\n Rails.logger.error \"Faulty paypal result: #{response}\"\n return false\n end\n unless response == \"VERIFIED\"\n Rails.logger.error \"Invalid IPN: #{response}\" \n Rails.logger.error \"Data: #{self.data}\"\n return false\n end\n\n return true\n end",
"def require_share_recipient\n @attributes[:require_share_recipient]\n end",
"def allow_anon\n end",
"def secure_mail_to(email)\n mail_to email, nil, :encode => 'javascript'\n end",
"def secure_mail_to(email)\n mail_to email, nil, :encode => 'javascript'\n end",
"def secure_mail_to(email)\n mail_to email, nil, :encode => 'javascript'\n end",
"def secure_mail_to(email)\n mail_to email, nil, :encode => 'javascript'\n end",
"def secure_mail_to(email)\n mail_to email, nil, :encode => 'javascript'\n end",
"def secure_mail_to(email)\n mail_to email, nil, :encode => 'javascript'\n end",
"def share_deal(target_email, share)\n @deal = share.deal\n @user = share.user\n @share = share\n mail :to => target_email, \n :tag => \"share\",\n :subject => \"#{@user.best_name} shared a post with you on Qwiqq!\"\n end",
"def blocked?\n !actor.likes?(activity_object)\n end",
"def ask_for_recipient\n\n end",
"def check_safetynet_window\n # Skip check if email is already stopped\n return false if mail.perform_deliveries == false\n\n channel = self.class.safetynet_channel\n options = self.class.safetynet_options\n method = action_name\n limit = options[channel][:limit]\n timeframe = options[channel][:timeframe]\n\n # Update the mail.to array with those who are whitelisted and permitted\n mail.to = mail.to.keep_if do |email|\n next true if is_whitelisted?(email)\n permit_delivery?(email, channel, method, limit, timeframe)\n end\n\n permit_delivery = mail.to.any?\n\n if channel == :email\n mail.perform_deliveries = permit_delivery\n end\n permit_delivery\n end",
"def loan_request_accepted_notification(transaction)\n @owner = transaction.owner\n @requester = transaction.requester\n @user_lacquer = transaction.user_lacquer\n\n mail(to: @requester.email, subject: \"#{@owner.name} has agreed to loan you #{@user_lacquer.lacquer.name}!\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end",
"def seller_dispute_order_cancelled(seller)\n @seller=seller\n @url = 'http://badaboum-prod.herokuapp.com/users/sign_in'\n mail(to: @seller.email, subject: \"Litige traité - vente annulée\")\n end",
"def remote_pledge(pay_to)\n \tvenmo_info = self.user.venmo_account\n \trequest = 'https://api.venmo.com/v1/payments'\n \tresponse = HTTParty.post(request, query: {\n access_token: venmo_info.access_token,\n user_id: pay_to,\n amount: self.amount.to_s,\n note: 'Payment from my app'\n })\n\n \tJSON.parse(response.body)\n end",
"def reject?(sender)\n false\n end",
"def reject?(sender)\n false\n end",
"def reject_link(hash)\n p hash\n hash.each do |key|\n unless key=='user_id'\n return hash[key].blank?\n end\n end \n # reject if not real link ids (either)\n end",
"def contact_pub_copy(n)\n @offer = n.item\n @user = n.user\n @msg = n.msg\n @trade = n.trade\n headers['X-SMTPAPI'] = '{\"category\": \"Publisher contacts offerer copy\"}'\n mail(:to => n.user.email, :subject => \"You sent a message!\", :from => 'TradeYa <AdminRobot@TradeYa.com>', :content_type => \"text/html\")\n end",
"def ipn_valid?(message)\n require \"net/https\"\n uri = URI(paypal_endpoint)\n data = \"cmd=_notify-validate&\" + message.map { |k, v| \"#{k}=#{CGI.escape(v)}\" }.join(\"&\")\n con = Net::HTTP.new(uri.host, uri.port)\n con.use_ssl = true\n r = con.post(uri.path, data)\n r.body.include?(\"VERIFIED\")\n end",
"def reject_user\n # set the enabled flag to false for the user\n # clear activation code (prevents user from showing up as pending user)\n # send out rejection notification\n end",
"def handle_unverified_request\n true\n end",
"def handle_unverified_request\n true\n end",
"def reject_email(email)\n @greeting = \"Hi\"\n\n mail to: email, subject: \"Your ASES Application Decision\"\n end",
"def mine(amount, payer, payee, miner, timestamp, signature, prev_hash)\r\n blob = amount.to_s + payer.to_s + payee.to_s + miner.to_s + timestamp.to_s + signature.to_s + prev_hash.to_s\r\n nonce = find_nonce(blob)\r\n Faraday.post(\"#{URL}:#{payer}/block_mined\", amount: amount, payer: payer, payee: payee, miner: miner, timestamp: timestamp, signature: signature, prev_hash: prev_hash, nonce: nonce)\r\nend",
"def skip_confirmation_notification!; end",
"def check_negative_captcha\n if not params[:email_auth].blank?\n flash[:warning] = \"You appear to be a SPAM bot, and cannot submit to the requested page.\"\n redirect_to site_index_path\n end\n end",
"def share_mail(signature, target_email)\n @signature = signature\n @petition = @signature.petition\n\n @person_function = ''\n if @signature.person_function.present?\n @person_function = t('mail.mailafriend.note') + \" \\\"#{@signature.person_function}\\\"\"\n end\n\n mail(\n to: target_email,\n subject: t('mail.mailafriend.subject', title: @petition.name)\n )\n end",
"def can_void?(payment)\n !payment.void? && payment.pending? && !payment.response_code.blank?\n end",
"def can_void?(payment)\n !payment.void? && payment.pending? && !payment.response_code.blank?\n end",
"def unanswered_with_my_tags\n request('unanswered/my-tags').auth_required!\n end",
"def spam?(env)\n\t\t\tparams = { blog: 'http://sivers.org/',\n\t\t\t\tuser_ip: env['REMOTE_ADDR'],\n\t\t\t\tuser_agent: env['HTTP_USER_AGENT'],\n\t\t\t\treferrer: env['HTTP_REFERER'],\n\t\t\t\tcomment_type: 'comment',\n\t\t\t\tcomment_author: env['rack.request.form_hash']['name'],\n\t\t\t\tcomment_author_email: env['rack.request.form_hash']['email'],\n\t\t\t\tcomment_content: env['rack.request.form_hash']['comment'] }\n\t\t\tparams.each {|k,v| params[k] = URI.encode_www_form_component(v)}\n\t\t\tkey = Sivers.config['akismet']\n\t\t\turi = URI(\"http://#{key}.rest.akismet.com/1.1/comment-check\")\n\t\t\t'true' == Net::HTTP.post_form(uri, params).body\n\t\tend",
"def deny\n @request.remove_from_whitelist\n File.delete(\"#{$config[:'spool-dir']}/#{@request[:sender]}\") rescue true\n end",
"def deny(reason)\n user = self.adult_sponsor\n if self.destroy && reason.is_a?(Hash)\n user.group = nil\n user.save\n GroupMailer.send_denied_notice(user, self, reason['email_text']).deliver\n true\n else\n false\n end\n end",
"def should_mail_submission_message? # -> email rejection message\n self.authorized == false && (self.message_sent == false && !self.message.blank?)\n end",
"def payment_method\n # If redirected here with token, means user selected cancel option at PayPal.\n if params.key? :token\n flash[:notice] = 'PayPal payment cancelled'\n end\n\n @payment = @application.unpaid_payment\n end",
"def not_sent_to_me\n return @not_sent_to_me\n end",
"def on_outbound\n nil\n end",
"def edit_privacy_confirmation(user)\n @user = user\n\n mail(\n # from: 'codetest1980@gmail.com',\n from: 'lifeabroadjapan@gmail.com',\n to: @user.email,\n subject: 'Privacy setting was changed (Med+)'\n )\n end",
"def spam?(content, honeypot)\n honeypot.present? || link_tags?(content) || too_many_urls?(content)\n end",
"def instauser_reject_email(user_id)\n @user = Instauser.find_by(id: user_id)\n mail(to: @user.email, subject: 'Thanks for joining Capish!')\n end",
"def prevent_call_sign_screen\n root_url == request.original_url && !user_signed_in?\n end"
] |
[
"0.6167413",
"0.58691263",
"0.5775323",
"0.5612665",
"0.55139744",
"0.54867",
"0.54698706",
"0.54659456",
"0.5429437",
"0.5427524",
"0.53761524",
"0.5370299",
"0.53551006",
"0.53113556",
"0.5285021",
"0.5284297",
"0.5276118",
"0.52563554",
"0.5246471",
"0.5239043",
"0.5232328",
"0.5227361",
"0.5207809",
"0.5200359",
"0.51951957",
"0.51876783",
"0.5185214",
"0.51844645",
"0.5176047",
"0.5176047",
"0.51627",
"0.51611197",
"0.5151065",
"0.51416147",
"0.5122882",
"0.5119914",
"0.5119879",
"0.5117851",
"0.5109222",
"0.51070267",
"0.5105447",
"0.5100447",
"0.5099422",
"0.5091775",
"0.50910836",
"0.5089138",
"0.50872386",
"0.50871384",
"0.50856507",
"0.508163",
"0.508163",
"0.50736946",
"0.50721014",
"0.5071979",
"0.506812",
"0.506326",
"0.506258",
"0.50577855",
"0.50500447",
"0.5041885",
"0.50406605",
"0.50406605",
"0.50406605",
"0.50406605",
"0.50406605",
"0.50406605",
"0.5040098",
"0.5039566",
"0.503714",
"0.503687",
"0.5036339",
"0.50285715",
"0.5020644",
"0.499931",
"0.499931",
"0.49958867",
"0.4993025",
"0.49926844",
"0.49858952",
"0.4976825",
"0.4976825",
"0.49705872",
"0.49701965",
"0.4962039",
"0.49596545",
"0.49525252",
"0.49470544",
"0.49470544",
"0.49434817",
"0.49325138",
"0.4930675",
"0.49303594",
"0.49298438",
"0.49295956",
"0.49292338",
"0.49290884",
"0.49281114",
"0.49239677",
"0.49228936",
"0.4921127"
] |
0.6136085
|
1
|
yields self to block
|
def test_yields_self_to_block
inner = nil
outer = Crd::Flex::Command.new 'mxmlc' do |c|
inner = c
end
assert_same( outer, inner )
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def block; end",
"def self \n if block_given?\n yield self\n else\n self\n end",
"def yield\n @eff.yield.perform\n end",
"def execute\n yield self if block_given?\n end",
"def run\n yield\n end",
"def yield; end",
"def call(&block)\n block.call(self) if block_given?\n self\n end",
"def call_block\n @_block.call(self) if @_block\n end",
"def run_this_for_me\n\tyield\nend",
"def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end",
"def run_block\n yield\nend",
"def run\n block.call\n end",
"def each\n yield self\n end",
"def block?; end",
"def each(&block)\n end",
"def block\n true\n end",
"def yields *args\n @yields = args\n self\n end",
"def yield\n\t\t\tFiber.scheduler.yield\n\t\tend",
"def yield\n wait\n case result\n when Exception\n raise result\n else\n result\n end\n end",
"def yields\n parsed {\n @yields\n }\n end",
"def blocks() end",
"def run(&block)\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def block_node; end",
"def block_node; end",
"def each(&block)\n raise NotImplementedError\n end",
"def execute\n ret = yield self\n close\n ret\n end",
"def return_block\n yield\nend",
"def run(&block); end",
"def visit(&block)\n # block.call self\n yield self\n end",
"def each(&_block)\n iterator = BlockIterator.new(self)\n\n until iterator.current_hash == Block::GENESIS_PREV_HASH\n block = iterator.next\n yield(block)\n end\n end",
"def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end",
"def call\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block\n self\n end",
"def run_block_proc\n yield\nend",
"def each &block\n end",
"def with_block(&block)\n yield self if block_given? && @value\n end",
"def result\n @result = yield\n end",
"def return(&block); end",
"def exec &block\n connect!\n yield self\n ensure\n disconnect!\n end",
"def yield\n\t\t\t@selector.yield\n\t\tend",
"def yield\n\t\t\t@selector.yield\n\t\tend",
"def rblock\n if block_given?\n # yield execute the block\n yield\n else\n puts \"No block\"\n end\n end",
"def blocks; end",
"def blocks; end",
"def blocks; end",
"def start\n yield\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def with\n yield self\n end",
"def each(&block)\n return enum_for(:each) unless block_given?\n visit { |node| yield node }\n self\n end",
"def initialize(&block)\n yield self\n end",
"def request(&block)\n self.with(&block)\n end",
"def each(&block)\n @items.each(&block)\n self\n end",
"def i_take_a_block\n yield\nend",
"def block_call\n expect :iter\n self[1]\n end",
"def callBlock\n yield\n yield\nend",
"def each(&block)\n raise NotImplementedError\n end",
"def my_method\n yield(self)\nend",
"def call_block\n\tputs \"Start of method\"\n\tyield\n\tyield\n\tputs \"End of method\"\nend",
"def generate_next\n @block.call(@so_far)\n end",
"def call\n if @block\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self)\n end\n self\n end",
"def configure\n yield self if block_given?\n end",
"def visit(&block)\n block.call self\n end",
"def with_block(&block)\n end",
"def _each(&block)\n _next.each(&block) if _next\n end",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method_3\n yield\nend",
"def block_method1\n yield\nend",
"def yield(value)\n @queue.yield(value)\n self\n end",
"def with_metadata &block\n yield @metadata if block_given?\n self\n end",
"def each(&block)\n\n end",
"def each(&block)\n\t\t\t self.get.each &block\n\t\t\tend",
"def record_block\n @block = true\n end",
"def each # And define each on top of next\n loop { yield self.next }\n end"
] |
[
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.76818454",
"0.7513531",
"0.74186593",
"0.7385445",
"0.7269016",
"0.7201663",
"0.719286",
"0.71538794",
"0.7124814",
"0.70338684",
"0.6962987",
"0.6941435",
"0.69134945",
"0.6913254",
"0.68758553",
"0.685613",
"0.6809828",
"0.6792645",
"0.6792478",
"0.67690444",
"0.6764442",
"0.67348385",
"0.67340606",
"0.67340606",
"0.67340606",
"0.67340606",
"0.67299646",
"0.67299646",
"0.666989",
"0.6639268",
"0.66273886",
"0.6614462",
"0.6609947",
"0.6606536",
"0.6599508",
"0.65910214",
"0.6588262",
"0.65833485",
"0.65696305",
"0.6563703",
"0.6562396",
"0.65599185",
"0.6553693",
"0.6553693",
"0.6543882",
"0.6538014",
"0.6538014",
"0.6538014",
"0.6536764",
"0.65048057",
"0.65048057",
"0.65048057",
"0.65048057",
"0.6501807",
"0.6496606",
"0.6488329",
"0.64811146",
"0.6478604",
"0.6470251",
"0.64595383",
"0.64554566",
"0.64504445",
"0.6441769",
"0.6438946",
"0.64336056",
"0.6432676",
"0.6427904",
"0.6426899",
"0.642632",
"0.64190006",
"0.63915026",
"0.63915026",
"0.63915026",
"0.63915026",
"0.63915026",
"0.6387777",
"0.63812125",
"0.63800126",
"0.6379955",
"0.63786393",
"0.63566715",
"0.6355537"
] |
0.0
|
-1
|
provides access to command name passed in constructor
|
def test_provides_access_to_command_name_passed_in_constructor
Crd::Flex::Command.new 'mxmlc' do |c|
assert_equal( 'mxmlc', c.command )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def command_name; end",
"def command_name=(_arg0); end",
"def initialize(name)\n super \"Unknown command: #{name}\"\n @command = name\n end",
"def initialize(name, command)\r\n super(name)\r\n @command = command\r\n end",
"def command_name\n self.class.command_name\n end",
"def command_name\n return @command_name\n end",
"def command name\n @commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n return @commands[name]\n end",
"def command_name\n return self.class.to_s.split(\"::\").last.downcase.gsub(/command/,\"\")\n end",
"def command_name\n @command_name ||= if command = name.to_s.split(\"::\").last\n command.chomp!(\"Command\")\n command.underscore\n end\n end",
"def command_name\n klass_name = self.class.name.split('::').last\n command = klass_name.gsub(/([^\\^])([A-Z])/, '\\1_\\2').downcase\n command\n end",
"def command_name(cmd)\n cmd\n end",
"def initialize command\n @command = command\n end",
"def command_name(name = T.unsafe(nil)); end",
"def command(cmd_name)\n cmd = Command.new(cmd_name, self)\n yield cmd\n @commands[cmd_name] = cmd\n end",
"def command_factory\n end",
"def command\n attributes.fetch(:command)\n end",
"def command\n attributes.fetch(:command)\n end",
"def initialize_command(message)\n message = Message.new(params)\n @command = begin\n \"#{message.command.capitalize}Command\".constantize.new(message)\n rescue\n HelpCommand.new(message)\n end\n end",
"def command_for(name, *args)\n command_str_for(*(COMMANDS[name] + args))\n end",
"def command(name)\n commands.find { |command| command.name == name.to_s }\n end",
"def command\n\n h.fields['__command__']\n end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def command\n @command ||= Class.new.send(:include, Command)\n end",
"def command\n @attributes['command']\n end",
"def command(key)\n keys = configuration.instance.keys\n cmd = eval \"#{keys}.#{key}\"\n cmd.capitalize! << \"Command\"\n case cmd\n when /QuitCommand/\n QuitCommand.new(@terminal)\n else\n NoOpCommand.new\n end\n end",
"def command(name)\n load_commands.select { |lc| lc.type == name.to_sym }\n end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def initialize(command)\n @command = command\n end",
"def initialize(error, name, command)\n @error = error\n @name = name.downcase\n @command = command\n end",
"def command_builder; end",
"def command\n raise NotImplementedError, \"`command' is not implemented by #{self.class.name}\"\n end",
"def to_command(symbol)\n command_class_name = symbol.to_s.path_to_name.tr(' ', '')\n Kernel.const_get(\"#{command_class_name}Command\")\n end",
"def command(type)\n end",
"def commander name, options = {}\n define_method :commander do\n instance_variable_get(\"@commander\") || begin\n clazz = \"Commanders::#{name.to_s.camelize}\".constantize \n instance_variable_set \"@commander\", clazz.new(self, options)\n end\n end\n end",
"def createCommandClass( name, m_name )\n Object.const_set( name, Class.new( Command ) ).instance_eval do\n define_method( :initialize ) do |*args|\n inst_vars = []\n args.each do |k|\n inst_vars.push( k )\n end\n instance_variable_set( \"@_vars\", inst_vars )\n end\n end\n begin\n Command::Target_map[ name ] = m_name\n rescue Exception\n STDERR.puts( \"Error setting value in Command::Target_map: #{$!}\" )\n end\nend",
"def command\n raise NotImplementedError\n end",
"def create_command(command_name)\n config.create_command_name = command_name ? \"::#{command_name}\" : nil\n end",
"def _retrieve_class_and_command(name, sent_command = nil) #:nodoc:\n if name.nil?\n [self.class, nil]\n elsif self.class.all_commands[name.to_s]\n [self.class, name.to_s]\n else\n klass, command = self.class.prepare_for_invocation(nil, name)\n [klass, command || sent_command]\n end\n end",
"def __subcommand__() @__subcommand__&.__ident__ end",
"def command\n @property[:command]\n end",
"def retrieve_command_name(args) #:nodoc:\n meth = args.first.to_s unless args.empty?\n args.shift if meth && (map[meth] || meth !~ /^\\-/)\n end",
"def create_command(text)\n self.class.concrete_command.new(self, text)\n end",
"def command(cmd)\n \"do_#{cmd}\".intern\n end",
"def command(name, help, &b)\r\n\t\t\t@commands[name] = Command.new(name, help, &b)\r\n\t\tend",
"def command\n case first\n when '\\?' then Command::HelpCommand\n when '\\config' then Command::PrintConfigCommand\n else\n puts \"Unknown command: #{buffer}\"\n end\n end",
"def command\n return @command.underscore if @command.is_a?(String)\n @command\n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def command?(name)\n __getobj__.present?(name)\n end",
"def command\n @command ||= command_for(:query)\n end",
"def has_command!(name, referer = self.class)\n name.split(':').inject(referer){|cur,look|\n cur.const_get(command2module(look))\n }\n rescue NameError => ex\n raise NoSuchCommand, \"No such command #{name}\", ex.backtrace\n end",
"def command_namespace\n self.class.const_get(:Commands)\n end",
"def method_missing(cmd, *args)\n command(cmd.to_s, *args)\n end",
"def create_command(meth)\n if meth == \"perform\"\n alias_method command_name, meth\n else\n # Prevent exception about command without usage.\n # Some commands define their documentation differently.\n @usage ||= meth\n @desc ||= \"\"\n\n super\n end\n end",
"def command(name, case_sensitive = false, &block)\n commands[name.to_s] = { :case_sensitive => case_sensitive, :block => block }\n end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def default_command(name)\n abstract!\n end",
"def getCommand()\n raise \"Missing implementation of 'getCommand'\"\n end",
"def newcommand(options, &block)\n raise \"No name given in command\" unless options.include?(:name)\n\n command = options[:name]\n\n SLAF::Commands.module_eval {\n define_method(\"#{command}_command\", &block)\n }\n\n SLAF::command_options || SLAF.command_options = {}\n\n if options.include?(:allow_arguments)\n SLAF::command_options[command] = options[:allow_arguments]\n else\n SLAF::command_options[command] = false\n end\nend",
"def formulate_command\n @command\n end",
"def build_command(cmd)\n cmd\n end",
"def command(command_text)\n @command_text = command_text\n end",
"def method_missing(command_name, *args)\n command command_name, *args\n end",
"def command\n @command ||= command_for(:query)\n end",
"def ident\n \"<Command name=#{name}>\"\n end",
"def get_command(name)\n @commands.select {|c| c.invokers.include? name}.compact[0]\n end",
"def command(name,aliases,desc,long_desc,arg_name,arg_options)\n abstract!\n end",
"def get_instruction\n Rips::Instructions.const_get(\"#{@cmd[:name].capitalize}\").new\n end",
"def self_command #:nodoc:\n Foreman::Thor::DynamicCommand.new(namespace, class_options)\n end",
"def cmd; end",
"def cmd(*args) self.class.cmd(*args) end",
"def /(command_name)\n command_name = command_name.to_s unless command_name.nil?\n cls = Class.new { include GitFlow::Mixin }\n (class << cls; self; end).module_eval do\n attr_accessor :help, :documentation, :command\n define_method(:/) do |subcommand|\n raise \"Subcommand cannot be nil\" unless subcommand\n GitFlow/([command_name, subcommand].compact.join(' '))\n end\n define_method(:inherited) do |subclass|\n subclass.command = command_name\n GitFlow.commands[command_name] = subclass\n end\n end\n cls\n end",
"def method_missing(name, *args, &block)\n command = registry[name]\n\n if args.size > 1\n command.new(*args, &block)\n else\n command.call(*args, &block)\n end\n end",
"def test_automatically_provides_command_name_to_superclass\n assert_equal( 'compc', @cmd.command )\n end",
"def create_command command_text\r\n DatabaseCommand.new self, command_text\r\n end",
"def namespace(name = nil)\n if name\n super\n else\n @namespace ||= super.chomp(\"_command\").sub(/:command:/, \":\")\n end\n end",
"def command_object\n @command_object ||= GitPusshuTen::Command.new(cli, configuration, hooks, environment)\n end",
"def method_missing name, *args, &block\n Baldrick::Command.instance.respond_to?(name) ? Baldrick::Command.instance.send(name, *args, &block) : super(name, args) \n end",
"def [](cmd_val)\n k = Argument.to_key(cmd_val)\n @commands[k]\n end",
"def initialize command, parameters = nil\n @command = command\n @parameters = parameters\n end",
"def set_command\n @command = Command.find(params[:id])\n end",
"def set_command\n @command = Command.find(params[:id])\n end",
"def set_command\n @command = Command.find(params[:id])\n end",
"def set_command\n @command = Command.find(params[:id])\n end",
"def set_command\n @command = Command.find(params[:id])\n end",
"def command_params\n params[:command]\n end",
"def command; datastore['COMMAND']; end",
"def command_name\n @command_name ||= SimpleCov.command_name\n end"
] |
[
"0.799135",
"0.7973865",
"0.780604",
"0.7767644",
"0.7766731",
"0.7740175",
"0.7721307",
"0.765618",
"0.765618",
"0.765618",
"0.7375512",
"0.73577493",
"0.7343512",
"0.7323733",
"0.73176956",
"0.7291462",
"0.72361875",
"0.7211687",
"0.71776646",
"0.7099506",
"0.7099506",
"0.708783",
"0.7082477",
"0.7079294",
"0.70342225",
"0.7012736",
"0.6990999",
"0.69735044",
"0.6959622",
"0.69298494",
"0.69083",
"0.69083",
"0.69083",
"0.69083",
"0.69083",
"0.69083",
"0.68864256",
"0.6811307",
"0.68075985",
"0.6801683",
"0.67852455",
"0.67824703",
"0.67821854",
"0.67728573",
"0.67717785",
"0.67675996",
"0.67238116",
"0.67067266",
"0.670542",
"0.6704966",
"0.67000604",
"0.6697757",
"0.66868526",
"0.6656699",
"0.66520923",
"0.6650369",
"0.6650369",
"0.6650369",
"0.66275895",
"0.6624452",
"0.66202843",
"0.6617092",
"0.6610899",
"0.66078967",
"0.66011417",
"0.6593689",
"0.6593689",
"0.6593689",
"0.6582351",
"0.6582023",
"0.6575356",
"0.65571445",
"0.65569127",
"0.65494925",
"0.654485",
"0.6523994",
"0.6522759",
"0.6503272",
"0.65025777",
"0.64925814",
"0.64914876",
"0.6488948",
"0.6476135",
"0.6472414",
"0.64585567",
"0.6453185",
"0.64282787",
"0.6417418",
"0.641681",
"0.6415799",
"0.6407602",
"0.6401809",
"0.6396102",
"0.6396102",
"0.6396102",
"0.63952434",
"0.63952434",
"0.6388422",
"0.6373728",
"0.63729614"
] |
0.71030843
|
19
|
assembles only command name in to cmd method
|
def test_assembles_only_command_name_in_to_cmd_method
Crd::Flex::Command.new 'mxmlc' do |c|
assert_equal( 'mxmlc', c.to_cmd )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def command_name(cmd)\n cmd\n end",
"def command_name; end",
"def command_name=(_arg0); end",
"def command(cmd)\n \"do_#{cmd}\".intern\n end",
"def command_name\n @command_name ||= if command = name.to_s.split(\"::\").last\n command.chomp!(\"Command\")\n command.underscore\n end\n end",
"def command_name\n return @command_name\n end",
"def command_name(name = T.unsafe(nil)); end",
"def command_name\n return self.class.to_s.split(\"::\").last.downcase.gsub(/command/,\"\")\n end",
"def build_command(cmd)\n cmd\n end",
"def command_name\n klass_name = self.class.name.split('::').last\n command = klass_name.gsub(/([^\\^])([A-Z])/, '\\1_\\2').downcase\n command\n end",
"def command\n return @command.underscore if @command.is_a?(String)\n @command\n end",
"def retrieve_command_name(args) #:nodoc:\n meth = args.first.to_s unless args.empty?\n args.shift if meth && (map[meth] || meth !~ /^\\-/)\n end",
"def command_name\n self.class.command_name\n end",
"def command(cmd)\n if VNMNetwork::COMMANDS.keys.include?(cmd.to_sym)\n cmd_str = \"#{VNMNetwork::COMMANDS[cmd.to_sym]}\"\n else\n cmd_str = \"#{cmd}\"\n end\n\n return cmd_str\n end",
"def command_for(name, *args)\n command_str_for(*(COMMANDS[name] + args))\n end",
"def cmd; end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def command_name(command)\n command.slice(0, command.index(/\\s/)).split('/')[-1]\n end",
"def extract_command; end",
"def __subcommand__() @__subcommand__&.__ident__ end",
"def ident\n \"<Command name=#{name}>\"\n end",
"def command_name(command)\n i = command =~ /\\s/\n command = command.slice(0, i) if i\n command.split('/')[-1]\n end",
"def normalize_command_name(meth) #:nodoc:\n return default_command.to_s.tr(\"-\", \"_\") unless meth\n\n possibilities = find_command_possibilities(meth)\n raise AmbiguousTaskError, \"Ambiguous command #{meth} matches [#{possibilities.join(', ')}]\" if possibilities.size > 1\n\n if possibilities.empty?\n meth ||= default_command\n elsif map[meth]\n meth = map[meth]\n else\n meth = possibilities.first\n end\n\n meth.to_s.tr(\"-\", \"_\") # treat foo-bar as foo_bar\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def command(name)\n commands[name]\n end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def cmd_cmds\n puts self.methods.grep(/^cmd_/).map {|m| m[4..-1]} * \" \"\n end",
"def formulate_command\n @command\n end",
"def to_s\n name\n .split(\"::\")\n .map { |n| n.gsub(/Command$/, \"\").downcase if /Command$/.match?(n) }\n .compact\n .join(\" \")\n end",
"def command_pp\n to_s.gsub(/^_/, \"\").downcase\n end",
"def command name\n @commands[name]\n end",
"def cmd\n (@cmd ? @cmd : @ctx.cmd).join ' '\n end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def module2command(mod)\n case mod\n when Module\n module2command(RubyTools::class_unqualified_name(mod))\n when String\n mod.gsub(/[A-Z]/){|x| \"-#{x.downcase}\"}[1..-1]\n when Symbol\n module2command(mod.to_s).to_sym\n else\n raise ArgumentError, \"Invalid module argument #{mod.class}\"\n end\n end",
"def command\n if args.skip?\n ''\n else\n commands.join('; ')\n end\n end",
"def commander _args\n \"commander _args;\" \n end",
"def command_string\n\t\treturn datastore['CMD'] || ''\n\tend",
"def hook_func_name(command)\n command.tr('-', '_') << '_cli_hook'\n end",
"def commands_command(stem, sender, reply_to, msg)\n commands = self.class.instance_methods.select { |m| m =~ /^\\w+_command$/ }\n commands.map! { |m| m.to_s.match(/^(\\w+)_command$/)[1] }\n commands.reject! { |m| UNADVERTISED_COMMANDS.include? m }\n return if commands.empty?\n commands.map! { |c| \"#{options[:command_prefix]}#{c}\" }\n \"Commands for #{leaf_name}: #{commands.sort.join(', ')}\"\n end",
"def command_builder; end",
"def command(name)\n return @commands[name]\n end",
"def command_name(command)\n parts = []\n command = command.split(\" \")\n command.shift while command[0].to_s.include?(\"=\")\n parts << command.shift.split(\"/\")[-1]\n if parts[0] == \"sudo\"\n until command.empty?\n part = command.shift\n if part.include?(\"/\")\n parts << part.split(\"/\")[-1]\n break\n else\n parts << part\n end\n end\n end\n parts.join(\" \")\n end",
"def command_names\n commands.map &:name\n end",
"def cmd_suffix(cmd)\n if cmd =~ VALID_NAME\n cmd\n else\n mod = cmd.gsub(/\\W+/,'_')\n mod.gsub!(/^_+/, '')\n mod.gsub!(/_+$/, '')\n mod\n end\n end",
"def command\n return \"#{@command} #{options}\"\n end",
"def subcommands(cmd); end",
"def subcommands(cmd); end",
"def create_command(meth)\n if meth == \"perform\"\n alias_method command_name, meth\n else\n # Prevent exception about command without usage.\n # Some commands define their documentation differently.\n @usage ||= meth\n @desc ||= \"\"\n\n super\n end\n end",
"def command(type)\n end",
"def cmd(*args) self.class.cmd(*args) end",
"def dispatch_method_names(command, type = 'bot')\n [type + '_' + command.join('_').downcase,\n type + '_' + command.first.downcase]\n end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def command\n\n h.fields['__command__']\n end",
"def quick_command\n @raw[0] || \"\"\n end",
"def command\n attributes.fetch(:command)\n end",
"def command\n attributes.fetch(:command)\n end",
"def command\n return @raw_command\n end",
"def get_cmd(klass,task)\n cmd = case klass.to_s\n when \"Brocade::SAN::ZoneConfiguration\"\n \"cfg#{task}\"\n when \"Brocade::SAN::Zone\"\n \"zone#{task}\"\n when \"Brocade::SAN::Alias\"\n \"ali#{task}\"\n end \n end",
"def currentCommand _args\n \"currentCommand _args;\" \n end",
"def _CommandNameForSpecialLineCommand\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_NewpageCommand)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_ExplicitParagraphCommand)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_CommandNameForSpecialLineCommand unless _tmp\n return _tmp\n end",
"def command\n case first\n when '\\?' then Command::HelpCommand\n when '\\config' then Command::PrintConfigCommand\n else\n puts \"Unknown command: #{buffer}\"\n end\n end",
"def assignedCommander _args\n \"assignedCommander _args;\" \n end",
"def command(name)\n load_commands.select { |lc| lc.type == name.to_sym }\n end",
"def commandType\n result = \"\"\n if (@currentCommand.slice(0) == \"@\")\n result = \"A_COMMAND\"\n else\n result = \"C_COMMAND\"\n end\n return result\n end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def command(name)\n commands.find { |command| command.name == name.to_s }\n end",
"def default_command(name)\n abstract!\n end",
"def to_command(symbol)\n command_class_name = symbol.to_s.path_to_name.tr(' ', '')\n Kernel.const_get(\"#{command_class_name}Command\")\n end",
"def _retrieve_class_and_command(name, sent_command = nil) #:nodoc:\n if name.nil?\n [self.class, nil]\n elsif self.class.all_commands[name.to_s]\n [self.class, name.to_s]\n else\n klass, command = self.class.prepare_for_invocation(nil, name)\n [klass, command || sent_command]\n end\n end",
"def commands\n args.commands.map do |cmd|\n if cmd.respond_to?(:join)\n cmd.map { |c| c.index(' ') ? \"'#{c}'\" : c }.join(' ')\n else\n cmd.to_s\n end\n end\n end",
"def action_for_command(cmd)\n cmd.downcase!\n cmd.match(CONFLICT_CMD_REGEX) ? \"on_#{cmd}\" : cmd\n end",
"def cmd(command)\n\t\tbegin\n\t\t\t`#{command}`\n\t\trescue Exception => e\n\t\t\te.to_s\n\t\tend\n\tend",
"def raw_command\n @raw_command ||= @raw.split[0] || \"\"\n end",
"def command(name,aliases,desc,long_desc,arg_name,arg_options)\n abstract!\n end",
"def doCmd(cmd)\n puts cmd;\n puts `#{cmd}`;\nend",
"def getCommand(state)\n\treturn 'e ' << state.to_s\nend",
"def command_raw(args)\n\n end",
"def command_factory\n end",
"def call(*command); end",
"def to_s\n return command\n end",
"def full_command\n command_array.join(' ')\n end",
"def command(cmd_name)\n cmd = Command.new(cmd_name, self)\n yield cmd\n @commands[cmd_name] = cmd\n end",
"def method_missing(cmd, *args)\n command(cmd.to_s, *args)\n end",
"def command\n @attributes['command']\n end",
"def parse_command(cmd)\n cmd_name, *cmd_args = cmd.split\n method_name = COMMAND_MAP[cmd_name] || ''.freeze\n send(method_name, cmd, *cmd_args)\n rescue ArgumentError, NoMethodError\n output MSG_INVALID_COMMAND\n end",
"def command(binary, action, service, param = nil, sub_param = nil)\n [\n prepare_parameter(binary),\n action, # simple keyword does not need transformation\n prepare_parameter(service),\n prepare_parameter(param),\n prepare_parameter(sub_param, false) # last param does no need quoting\n ].reject(&:empty?).join ' '\n end",
"def name_commands(name, action, seqno, opts = {})\n cmd = if opts[:default] == true\n \"default route-map #{name}\"\n elsif opts[:enable] == false\n \"no route-map #{name}\"\n else\n \"route-map #{name}\"\n end\n cmd << \" #{action}\"\n cmd << \" #{seqno}\"\n [cmd]\n end",
"def command_name(index)\n @list[index]\n end"
] |
[
"0.81547135",
"0.8104025",
"0.7954934",
"0.7653976",
"0.76478624",
"0.76413333",
"0.7641055",
"0.7602003",
"0.7551413",
"0.7513772",
"0.7442354",
"0.73648196",
"0.72745186",
"0.7255864",
"0.7251457",
"0.72260815",
"0.7100213",
"0.7100213",
"0.7100213",
"0.7057975",
"0.7028563",
"0.7010621",
"0.7006337",
"0.6989082",
"0.6977419",
"0.6974701",
"0.6974701",
"0.6974701",
"0.6973404",
"0.6933836",
"0.6924662",
"0.6922859",
"0.6908151",
"0.6907579",
"0.68606794",
"0.6788607",
"0.6788607",
"0.6788607",
"0.6788607",
"0.6788607",
"0.6788607",
"0.67816436",
"0.6755863",
"0.67327064",
"0.6726062",
"0.67185247",
"0.6713003",
"0.6712952",
"0.6710591",
"0.6702333",
"0.6662531",
"0.6659616",
"0.6649726",
"0.6642569",
"0.6642569",
"0.6640437",
"0.6604173",
"0.6584704",
"0.65803605",
"0.6557059",
"0.6557059",
"0.6557059",
"0.65495163",
"0.65398717",
"0.6535819",
"0.6535819",
"0.65327054",
"0.6525427",
"0.6524222",
"0.6520138",
"0.6504292",
"0.6462877",
"0.64586323",
"0.645823",
"0.64571786",
"0.64571786",
"0.64571786",
"0.64555717",
"0.6441311",
"0.6435095",
"0.6432474",
"0.6420623",
"0.6414132",
"0.6407462",
"0.63976395",
"0.63964",
"0.6396357",
"0.6395544",
"0.639343",
"0.6388677",
"0.63818717",
"0.6374821",
"0.6365638",
"0.6335554",
"0.63334686",
"0.6326042",
"0.6325345",
"0.63232553",
"0.6320225",
"0.63178337"
] |
0.6643471
|
53
|
has can tell whether or not an argument has been set
|
def test_has_can_tell_whether_or_not_an_argument_has_been_set
Crd::Flex::Command.new 'mxmlc' do |s|
assert_equal( false, s.has?( :output ) )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def has_argument?(key)\n self.arguments.set?(key)\n end",
"def hasArg?(arg); argSet.member?(arg) end",
"def has_missing_required_arg?\n !missing_required_arguments.empty?\n end",
"def has_arg name\n raise \"has_arg #{name}.#{name.class}\" unless name.is_a? Symbol\n self.arg_names.index_of name\n end",
"def args_defined?\n @args_def && @args_def.args.size > 0\n end",
"def expects_argument?\n config[:argument] && config[:argument] != :optional\n end",
"def has?(param)\n \tparam and param.length > 0\n end",
"def provides_arguments?\n false\n end",
"def argument?; end",
"def any_args?\n @any_args\n end",
"def any_args?\n @any_args\n end",
"def no_args_provided?\n @no_args_provided ||= no_args_provided\n end",
"def arguments_given?\n !@arguments.empty?\n end",
"def arguments_valid?\n true if @arguments.size >= 1 \n end",
"def provides_arguments?\n true\n end",
"def provides_arguments?\n true\n end",
"def has_param?(name)\n\n end",
"def arguments_valid?\n true # no required arguments\n end",
"def expects_argument?\n true\n end",
"def arguments?\n arguments.any?\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end",
"def argument_assigned?(arg=nil)\n if arg.class == Hash && !block_given?\n return @j_del.java_method(:isArgumentAssigned, [Java::IoVertxCoreCli::Argument.java_class]).call(Java::IoVertxCoreCli::Argument.new(::Vertx::Util::Utils.to_json_object(arg)))\n end\n raise ArgumentError, \"Invalid arguments when calling argument_assigned?(arg)\"\n end",
"def arguments_valid?\n # TO DO - implement some real logic here\n true if @arguments.length == 1 \n end",
"def arguments?\n arguments.any?\n end",
"def arguments_valid?\n # Should be no remaining arguments\n true if @arguments.length == 0\n end",
"def arguments_valid?\n # TODO - implement your real logic here\n true # if @arguments.length == 1\n end",
"def accepts_optional_argument?\n config[:optional_argument] || config[:argument] == :optional\n end",
"def arguments_valid?\n true \n end",
"def includes_arguments?\n !default_data.empty? || !flags.empty? ||\n !required_args.empty? || !optional_args.empty? ||\n !remaining_arg.nil? || flags_before_args_enforced?\n end",
"def arguments_valid?\n # right now, there is no set of invalid arguments.\n # (can I really just say true here? I don't have to return something?)\n true unless (@options.set_status == true and @options.status == nil)\n end",
"def arguments_valid?\n\t\t # TO DO - implement your real logic here\n\t\t true if @arguments.length == 1\n\t\tend",
"def arguments_valid?\n true if @arguments.size > 1\n end",
"def arguments_valid?\n true \n # to do\n end",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def has_option?(arg)\n !!find_option(arg)\n end",
"def in_kwarg; end",
"def arguments_valid?\n true\n end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def missing_option=(_arg0); end",
"def ensure_param(arg)\n params[arg.to_sym].present?\n end",
"def has_arg?(flag)\n\t\tfp = @flag_pairs.get_value(flag)\n\t\treturn fp != nil && (@args_a.include?(flag) || @args_a.include?(fp))\n\tend",
"def has_param?(key)\n @params.internal_parameters.has_key?(key)\n end",
"def has_param?(key)\n params[key] || dyn_params[key]\n end",
"def method_missing(name, *args)\n super unless args.empty? && !block_given?\n @set.include?(name)\n end",
"def parameter?(var_name)\n @@user_supplied_parameters.has_key?(var_name)\n end",
"def has_param(name) \n return (@params.has_key? name)\n end",
"def arguments_valid?\n true\n end",
"def has_arg name\n raise \"has_arg #{name}.#{name.class}\" unless name.is_a? Symbol\n max = self.arguments.get_length\n counter = 1\n while( counter <= max )\n if( self.arguments.get(counter).name == name)\n return counter\n end\n counter = counter + 1\n end\n return nil\n end",
"def has_param?(name)\n @input.has_key?(name)\n end",
"def check_params; true; end",
"def uses_par?(parameter); @params.values.include?(parameter); end",
"def can_have_quick_param?\n @definition[:allow_quick_param]\n end",
"def multiparam?\n !!@multiparam\n end",
"def method_missing(*_args)\n true\n end",
"def arguments_valid?\n ret = false\n ret = true unless (@options.action == nil)\n end",
"def field_provided?(key)\n @params.has_key?(key)\n end",
"def has_key?(*args)\n @params.has_key?(*args)\n end",
"def has_key?(*args)\n @params.has_key?(*args)\n end",
"def in_kwarg=(_arg0); end",
"def set?\n self == :set\n end",
"def arguments_valid?\n num = 0\n num += 1 if @options.stats\n num += 1 if @options.attach\n num += 1 if @options.detach\n return false if num > 1\n return true\n end",
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def has?(arg)\n !!find(arg)\n end",
"def method_defined?(arg0)\n end",
"def undefinable_arguments\r\n @undefinable_arguments ||= arguments.all_not_definable\r\n end",
"def checkParamInArguments(id)\n in_arguments = false\n @arguments.each { |arg|\n if arg[:id] == id\n in_arguments = true\n break\n end\n }\n if in_arguments\n abort(\"\\nERROR: Argument '#{id}' already defined in the arguments of '#{@scope_location}'\\n\")\n end\n end",
"def param_exists?(param_name)\n params[param_name] and not params[param_name].empty? ? true : false\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if (1..2).include? @arguments.length \n end",
"def check_arguments(params, *args)\n contains = true\n args.each do |arg|\n contains = false unless params.key? arg.to_sym\n end\n contains\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 2\n end",
"def prepared_arg?(k)\n true\n end",
"def setting_provided?(key)\n !settings[key].nil?\n end",
"def prepared_arg?(k)\n true\n end",
"def wrong_num_parameters?\n (ARGV.size != 1)\n end",
"def instance_variable_defined?(p0) end",
"def arguments_valid?\n true if @commands.length > 0\n end",
"def required\n !!parameter[:required]\n end",
"def valid?(setup)\n setup.args.length >= required_args && (max_args == -1 || setup.args.length <= max_args)\n end",
"def arguments_valid?\n true if ['install','list','uninstall'].include?(@arguments[0])\n end",
"def prepared_arg?(k)\n true\n end",
"def propertydefined?(name)\n name = name.intern unless name.is_a? Symbol\n @parameters.include?(name)\n end",
"def specified?(name)\n !!@__specified__[name]\n end",
"def attr_with_writable_flag?\n method_name == :attr && args.any? && args.last.type == :true\n end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def provided?(name)\n\t\t\t\tname = name.to_sym\n\t\t\t\t(@options[name] || {})[:value] != nil\n\t\t\tend",
"def public_method_defined?(arg0)\n end",
"def no_parameters?\n @parameters.nil? or @parameters.empty?\n end",
"def api_has_param?(key)\n @api[:optional].has_key?(key)\n end",
"def complete_args?\n @complete_args\n end",
"def option_set?(instance_key)\n var = instance_variable_get(\"@#{instance_key}\")\n !!(defined?(var) && var)\n end",
"def param_present?(obj)\n @config_params.value?(obj)\n end",
"def check_definition_state(is_arg: false, is_method: false)\n if @definition_finished\n raise ToolDefinitionError,\n \"Defintion of tool #{display_name.inspect} is already finished\"\n end\n if is_arg && argument_parsing_disabled?\n raise ToolDefinitionError,\n \"Tool #{display_name.inspect} has disabled argument parsing\"\n end\n if (is_arg || is_method) && delegate_target\n raise ToolDefinitionError,\n \"Tool #{display_name.inspect} is already delegating to another tool\"\n end\n self\n end",
"def has_options?\n properties.include?(\"has_options\")\n end",
"def args?\n\t\treturn !@form.empty?\n\tend",
"def has_required?; end"
] |
[
"0.77382064",
"0.77382064",
"0.75720257",
"0.7095822",
"0.6820216",
"0.6815802",
"0.6775533",
"0.670544",
"0.6649012",
"0.6568362",
"0.6560428",
"0.6560428",
"0.65445143",
"0.6537804",
"0.64999115",
"0.64767843",
"0.64767843",
"0.64741063",
"0.6472226",
"0.6444105",
"0.64405686",
"0.6403695",
"0.6377402",
"0.6348696",
"0.63457155",
"0.6344642",
"0.6334374",
"0.6331558",
"0.6330781",
"0.63217723",
"0.6304676",
"0.62889093",
"0.6281216",
"0.6255682",
"0.6249333",
"0.6234926",
"0.62301016",
"0.6228695",
"0.6204807",
"0.6204807",
"0.6204807",
"0.6204807",
"0.6204807",
"0.6204807",
"0.6178501",
"0.617589",
"0.6153905",
"0.6149929",
"0.61479115",
"0.6125728",
"0.6113862",
"0.60927373",
"0.6077086",
"0.60555357",
"0.60482585",
"0.60457754",
"0.6039455",
"0.6019289",
"0.60131794",
"0.60080177",
"0.6000293",
"0.5989451",
"0.5989451",
"0.5979584",
"0.59716135",
"0.596132",
"0.59557766",
"0.5949979",
"0.594732",
"0.5940454",
"0.5929151",
"0.59164023",
"0.5914505",
"0.5912118",
"0.5906446",
"0.5904821",
"0.58972466",
"0.5896797",
"0.58941776",
"0.5882919",
"0.587669",
"0.58746207",
"0.5871735",
"0.586719",
"0.58566153",
"0.58491665",
"0.5846764",
"0.58358115",
"0.5822222",
"0.581113",
"0.5807508",
"0.58007693",
"0.57986283",
"0.5790648",
"0.5780628",
"0.576137",
"0.5753736",
"0.5750632",
"0.57497305",
"0.57375395"
] |
0.62424856
|
35
|
assignment creates a string argument
|
def test_assignment_creates_a_string_argument
Crd::Flex::Command.new 'mxmlc' do |s|
s.output = 'Main.swf'
assert_equal( true, s.has?( :output ) )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def string=(_arg0); end",
"def string=(arg0)\n end",
"def assign_name(string = \"Bob\")\n return string\nend",
"def string= string\n #This is a stub, used for indexing\n end",
"def assign_name(name='Bob')\n name \nend",
"def assign_name(name='Bob')\n name\nend",
"def SAC02=(arg)",
"def PO101=(arg)",
"def assign_name(name = 'Bob')\n\tname\nend",
"def PO113=(arg)",
"def assign_name(name = 'Bob')\r\n name \r\n end",
"def PO114=(arg)",
"def SAC12=(arg)",
"def assign_name(arg='Bob')\n return arg # don't need return\nend",
"def PO107=(arg)",
"def SAC03=(arg)",
"def SAC07=(arg)",
"def SAC06=(arg)",
"def string=(p0) end",
"def PO105=(arg)",
"def PRF02=(arg)",
"def SAC05=(arg)",
"def a *args\n args[1] = args[1].to_s if args[1].is_a?(Symbol)\n do_conn :assign, *args\n end",
"def SAC01=(arg)",
"def PO106=(arg)",
"def PO109=(arg)",
"def PO102=(arg)",
"def transformed_argname=(_); end",
"def PO115=(arg)",
"def PO112=(arg)",
"def new_object_string(goal)\n ivar_assignment_string(goal, \".new(params[:#{goal.s}])\", \".new(params[:#{goal.s}])\")\n end",
"def PO104=(arg)",
"def to_ruby_arg\n \"#{to_s_name}#{@default ? ' = ' + @default : ''}\"\n end",
"def PO111=(arg)",
"def SAC04=(arg)",
"def str(str); end",
"def str(str); end",
"def assign_name(name = 'bob')\n assigned_name = name\nend",
"def CTT02=(arg)",
"def SE02=(arg)",
"def input_string=(str)\n @input_string = str\n end",
"def SE01=(arg)",
"def PRF01=(arg)",
"def PO103=(arg)",
"def PO110=(arg)",
"def assign_name(name = 'Bob')\n new_name = name\nend",
"def AMT02=(arg)",
"def set_str(x)\n @str = x\n end",
"def CTT07=(arg)",
"def assign_name(name = \"Bob\")\n name\nend",
"def assign_name(name = \"Bob\")\n name\nend",
"def string(str); end",
"def PO108=(arg)",
"def argue(argument)\n return \"#{argument}\"\nend",
"def assign_name(name = 'Bob')\n name\nend",
"def assign_name(name = 'Bob')\n name\nend",
"def PRF04=(arg)",
"def CTT06=(arg)",
"def CTT01=(arg)",
"def PRF03=(arg)",
"def CTT04=(arg)",
"def CTT03=(arg)",
"def str(str)\n Atoms::Str.new(str)\n end",
"def string(*) end",
"def CTT05=(arg)",
"def explicit=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def name=(_arg0); end",
"def initialize(value, string = nil)\n @value = value\n # discuss 'expression tree' as the \"orthodox\" solution instead of strings\n @string = string || value.to_s\n end",
"def TDS01=(arg)",
"def []=(string, value); end",
"def []=(string, value); end",
"def assign_name(tacos_from = 'Taco Bell', is_it_good = 'yes')\n tacos_from\n is_it_good\nend",
"def initialize(string = \"hello\")\n\t\t@string = string\n\tend",
"def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\" #re-assignment and creates a new string object. (doesn't have scope to change the string that was passed)\n an_array_param << \"rutabaga\" # uses the object that was passed in and appends 'rutabaga'\nend",
"def SAC15=(arg)",
"def method_missing(id, *args)\n name = id.id2name\n case args.length\n when 1\n\tset_string(name, args.join)\n when 0\n\tset_string(name)\n end\n end",
"def transformed_argname; end",
"def AMT01=(arg)",
"def raw=(_arg0); end",
"def raw=(_arg0); end",
"def name = (name)",
"def MTX02=(arg)",
"def String(p0) end",
"def new_string(name)\n constructor = Attribute.java_class.declared_constructor(\n java.lang.String,\n java.util.List\n )\n\n constructor.new_instance(name.to_s, nil).to_java(Attribute)\n end"
] |
[
"0.78299844",
"0.759605",
"0.7013762",
"0.69193244",
"0.69103163",
"0.6846448",
"0.67807674",
"0.6771822",
"0.6756093",
"0.6751129",
"0.6737686",
"0.67169243",
"0.66909933",
"0.6684321",
"0.66791296",
"0.6667396",
"0.66613805",
"0.6642231",
"0.6623453",
"0.65958595",
"0.6594305",
"0.65919256",
"0.65850824",
"0.65670437",
"0.6566761",
"0.656663",
"0.6560973",
"0.65553695",
"0.6546482",
"0.654365",
"0.65306103",
"0.652253",
"0.6520839",
"0.6497746",
"0.64752126",
"0.64732003",
"0.64732003",
"0.6471635",
"0.64650166",
"0.6462479",
"0.6420698",
"0.6405212",
"0.64034706",
"0.6398315",
"0.6382468",
"0.6380008",
"0.63704306",
"0.63657385",
"0.6359878",
"0.63591313",
"0.63591313",
"0.6356499",
"0.6354142",
"0.63487834",
"0.63385284",
"0.63385284",
"0.6319541",
"0.62824214",
"0.6279821",
"0.6277149",
"0.62746775",
"0.6269988",
"0.6261339",
"0.6242053",
"0.6235928",
"0.620411",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.6187912",
"0.617747",
"0.616863",
"0.6153753",
"0.6153753",
"0.6145274",
"0.61442345",
"0.61391515",
"0.61317116",
"0.61259687",
"0.6102284",
"0.60911345",
"0.6062796",
"0.6062796",
"0.60509807",
"0.6047836",
"0.6040358",
"0.60194266"
] |
0.6180683
|
83
|
can retrieve argument set through assignment
|
def test_can_retrieve_argument_set_through_assignment
Crd::Flex::Command.new 'mxmlc' do |s|
s.output = 'Main.swf'
assert_equal( 'Main.swf', s.output )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set=(_arg0); end",
"def arguments=(_arg0); end",
"def mset(*_arg0); end",
"def mset(*args); end",
"def set!(*args)\n end",
"def set_arguments (args)\n end",
"def assign args={}\n args.keys.each{ |name| instance_variable_set(\"@#{name}\", args[name]) }\n end",
"def set(*args)\n # not supported\n end",
"def set(*args)\n # not supported\n end",
"def entry_set=(_arg0); end",
"def func_set(args)\n p1 = _eval(car(args))\n p2 = _eval(car(cdr(args)))\n\n if p1 == @o_man.nil\n if @lint\n Error.warn(\"warning: setting the value of a nil object\")\n end\n else\n @o_man.set_object(p1, p2)\n end\n return p2\n end",
"def PO114=(arg)",
"def args(assignment, *rest)\n @values = []\n if last = rest.pop\n @values << last\n end\n @assignments = [assignment] + rest\n end",
"def SAC07=(arg)",
"def SE02=(arg)",
"def parameters=(_arg0); end",
"def probers=(_arg0); end",
"def set_args\n <<-CODE\n t1 = stack_pop();\n c->args = N2I(t1);\n CODE\n end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def SAC02=(arg)",
"def PO113=(arg)",
"def set_arguments(*args)\n @arguments = Arguments.new\n add_arguments(*args)\n end",
"def parameters=(_); end",
"def SE01=(arg)",
"def PO106=(arg)",
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def initialize(keyword); super(keyword); @argSet = Set.new end",
"def params=(_arg0); end",
"def params=(_arg0); end",
"def args() return @args end",
"def PRF02=(arg)",
"def PO107=(arg)",
"def SAC03=(arg)",
"def PO101=(arg)",
"def set_args(argvals, arglist)\n @arglist = arglist\n @argvals = argvals\n i = 0\n if argvals == \"\"\n @argvals = Array.new\n arglist.each do |arg|\n @argvals << nil\n end\n end\n arglist.each do |arg|\n\n if @argvals[i].nil?\n @argvals[i] = \"\"\n end\n #Tricky magic part where we are defining var names on the fly. Escaped quotes turn everything to strings.\n #Handle this later by allowing numbers to be numbers but keeping strings.\n\n instance_eval \"def #{arg}; return argvals[#{i}]; end\"\n i += 1\n end\n end",
"def argument_references(argument); end",
"def SAC06=(arg)",
"def args()\n #This is a stub, used for indexing\n end",
"def instance_variable_set(p0, p1) end",
"def explicit=(_arg0); end",
"def params=(_); end",
"def PO105=(arg)",
"def SAC12=(arg)",
"def PO109=(arg)",
"def set(*args)\n run \"set #{OptArg.parse(*args)}\"\n nil\n end",
"def store=(_arg0); end",
"def strict_variables=(_arg0); end",
"def PO102=(arg)",
"def arguments=(value)\n @arguments = value\n end",
"def x=(_arg0); end",
"def x=(_arg0); end",
"def x=(_arg0); end",
"def AMT02=(arg)",
"def PO104=(arg)",
"def isolated=(_arg0); end",
"def isolated=(_arg0); end",
"def SAC05=(arg)",
"def set; end",
"def set; end",
"def PO111=(arg)",
"def PO115=(arg)",
"def assign_arguments(arguments)\n initial_arguments = @arguments\n initial_set_arguments = initial_arguments.assigned_arguments\n current_arguments = initial_set_arguments.dup\n\n # First assign normal values\n arguments.each do |key, value|\n @arguments = TaskArguments.new(self)\n @arguments.merge!(initial_set_arguments)\n assign_argument(key, value)\n current_arguments.merge!(@arguments) do |k, v1, v2|\n if v1 != v2\n raise ArgumentError, \"trying to override #{k}=#{v1} to #{v2}\"\n end\n v1\n end\n end\n initial_arguments.merge!(current_arguments)\n\n ensure\n @arguments = initial_arguments\n end",
"def SAC01=(arg)",
"def func_setq(args)\n p = args\n p2 = nil\n\n loop do\n p1 = car(p)\n p2 = _eval(car(cdr(p)))\n @o_man.set_object(p1, p2)\n p = cdr(cdr(p))\n break unless (p != @o_man.nil)\n end\n\n return p2\n end",
"def arglist= exp\n expect :call, :attrasgn, :safe_call, :safe_attrasgn\n @my_hash_value = nil\n start_index = 3\n\n if exp.is_a? Sexp and exp.node_type == :arglist\n exp = exp[1..-1]\n end\n\n exp.each_with_index do |e, i|\n self[start_index + i] = e\n end\n end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def callSetArgs(object,*args)\n arity = object&.arity || object.method(:call).arity\n if arity > 0\n object.call(*args[0..arity-1])\n elsif arity == 0\n object.call()\n else\n object.call(*args)\n end\n end",
"def PO103=(arg)",
"def args\n @args \n end",
"def args(*) end",
"def pass=(_arg0); end",
"def set _obj, _args\n \"_obj set _args;\" \n end",
"def PRF01=(arg)",
"def __set()\n caller.each do |c|\n source = c[/^([^:]+):/,1]\n set = @@__sets[source]\n return set if set\n end\n\n :original\n end",
"def permitted=(_arg0); end",
"def extra=(_arg0); end",
"def CTT07=(arg)",
"def y=(_arg0); end",
"def assign args={}\n args.each do |_name, value|\n public_send(\"#{_name.underscore}=\", value)\n end\n end",
"def method_missing(symbol, *args, &block)\r\n key = symbol.to_s\r\n return set(key[0, key.length - 1].to_sym, args.first) if (key[-1].eql? '=')\r\n get(symbol)\r\n end",
"def get_params\n @set_params\n end",
"def PRF03=(arg)",
"def SAC04=(arg)",
"def assign_argument(key, value)\n key = key.to_sym\n if TaskArguments.delayed_argument?(value)\n @arguments[key] = value\n else\n if self.respond_to?(\"#{key}=\")\n self.send(\"#{key}=\", value)\n end\n if @arguments.writable?(key, value)\n # The accessor did not write the argument. That's alright\n @arguments[key] = value\n end\n end\n end",
"def first_arg= exp\n expect :call, :attrasgn, :safe_call, :safe_attrasgn\n @my_hash_value = nil\n self[3] = exp\n end",
"def assignment_without_argument_usage(argument); end",
"def set_argument\n @argument = Argument.find(params[:id])\n end",
"def argument_types=(*value)\n end"
] |
[
"0.7623902",
"0.6948813",
"0.67751545",
"0.6765537",
"0.667659",
"0.6569326",
"0.65015066",
"0.64867926",
"0.64867926",
"0.64597017",
"0.6448581",
"0.64435154",
"0.6398204",
"0.63960326",
"0.6370653",
"0.6364791",
"0.63464034",
"0.6337062",
"0.6300145",
"0.6300145",
"0.6300145",
"0.6300145",
"0.6300145",
"0.62627375",
"0.62622976",
"0.6242728",
"0.6238897",
"0.6232365",
"0.6206692",
"0.6192539",
"0.6192539",
"0.6192539",
"0.6189388",
"0.6185131",
"0.6185131",
"0.61830044",
"0.6181661",
"0.61702013",
"0.6166674",
"0.61362934",
"0.61327964",
"0.6122242",
"0.6117788",
"0.611331",
"0.60896206",
"0.6085037",
"0.60823137",
"0.6077385",
"0.6075447",
"0.606721",
"0.6062244",
"0.6037557",
"0.60347545",
"0.6032942",
"0.6031902",
"0.6031645",
"0.6031645",
"0.6031645",
"0.6025817",
"0.60239124",
"0.60091144",
"0.60091144",
"0.59928155",
"0.59897465",
"0.59897465",
"0.5984315",
"0.5968082",
"0.59638536",
"0.59561694",
"0.5954294",
"0.59507054",
"0.5946445",
"0.5946445",
"0.5946445",
"0.5946445",
"0.5946445",
"0.5946445",
"0.5946445",
"0.5946445",
"0.5945747",
"0.5944773",
"0.5941154",
"0.59301335",
"0.59142274",
"0.59116364",
"0.5895339",
"0.58772105",
"0.5875669",
"0.586895",
"0.5861705",
"0.5855914",
"0.5855067",
"0.5837845",
"0.5828333",
"0.5827846",
"0.5820518",
"0.5817899",
"0.5802945",
"0.57935727",
"0.5783495",
"0.5781941"
] |
0.0
|
-1
|
argument can be overwritten through assignment
|
def test_argument_can_be_overwritten_through_assignment
Crd::Flex::Command.new 'mxmlc' do |s|
s.output = 'Main.swf'
assert_equal( 'Main.swf', s.output )
s.output = 'App.swf'
assert_equal( 'App.swf', s.output )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def old_value=(_arg0); end",
"def PO114=(arg)",
"def explicit=(_arg0); end",
"def set=(_arg0); end",
"def extra=(_arg0); end",
"def safe_by_default=(_arg0); end",
"def PO106=(arg)",
"def PO107=(arg)",
"def PO101=(arg)",
"def PO113=(arg)",
"def SE02=(arg)",
"def PO109=(arg)",
"def cop=(_); end",
"def cop=(_); end",
"def SAC07=(arg)",
"def PO115=(arg)",
"def PO105=(arg)",
"def PO111=(arg)",
"def SAC06=(arg)",
"def PO102=(arg)",
"def SAC02=(arg)",
"def PRF02=(arg)",
"def SE01=(arg)",
"def PO104=(arg)",
"def autofinish=(_arg0); end",
"def CTT07=(arg)",
"def SAC05=(arg)",
"def PO103=(arg)",
"def base=(_arg0); end",
"def isolated=(_arg0); end",
"def isolated=(_arg0); end",
"def operator=(_arg0); end",
"def probers=(_arg0); end",
"def overrides=(_arg0); end",
"def SAC03=(arg)",
"def PO108=(arg)",
"def object=(_arg0); end",
"def object=(_arg0); end",
"def object=(_arg0); end",
"def object=(_arg0); end",
"def safe=(_arg0); end",
"def before=(_arg0); end",
"def CTT02=(arg)",
"def SAC12=(arg)",
"def CTT06=(arg)",
"def pass=(_arg0); end",
"def PRF01=(arg)",
"def permitted=(_arg0); end",
"def x=(_arg0); end",
"def x=(_arg0); end",
"def x=(_arg0); end",
"def attribute=(_arg0); end",
"def attribute=(_arg0); end",
"def ITD07=(arg)",
"def current_value=(_arg0); end",
"def store=(_arg0); end",
"def assignment_without_argument_usage(argument); end",
"def PRF04=(arg)",
"def SAC04=(arg)",
"def origin=(_arg0); end",
"def MTX02=(arg)",
"def jeweler=(_arg0); end",
"def jeweler=(_arg0); end",
"def jeweler=(_arg0); end",
"def checked=(_arg0); end",
"def SAC01=(arg)",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def PRF03=(arg)",
"def set!(*args)\n end",
"def PO110=(arg)",
"def CTT04=(arg)",
"def AMT02=(arg)",
"def PO112=(arg)",
"def public=(_arg0); end",
"def CTT05=(arg)",
"def CTT03=(arg)",
"def assign_name(name = 'bob')\n assigned_name = name\nend",
"def []=(*args); end",
"def assign_name(arg='Bob')\n return arg # don't need return\nend",
"def y=(_arg0); end",
"def CTT01=(arg)",
"def default=(_arg0); end",
"def method=(_arg0); end",
"def method=(_arg0); end",
"def method=(_arg0); end",
"def params=(_); end",
"def just_assignment(number)\r\n foo = number + 3\r\nend",
"def dynamic=(_arg0); end",
"def raw=(_arg0); end",
"def raw=(_arg0); end",
"def instance_variable_set(p0, p1) end",
"def ITD03=(arg)",
"def value=(_); end",
"def just_assignment(number)\n foo = number + 3 \nend"
] |
[
"0.78870517",
"0.7604563",
"0.7567148",
"0.7550401",
"0.753814",
"0.74575424",
"0.74496603",
"0.7446322",
"0.7388597",
"0.7372473",
"0.73535234",
"0.7309903",
"0.7277173",
"0.7277173",
"0.7276303",
"0.72646135",
"0.7263914",
"0.72597873",
"0.723266",
"0.72235733",
"0.72213906",
"0.72212875",
"0.7216867",
"0.717112",
"0.71482396",
"0.7046016",
"0.7043191",
"0.70387477",
"0.7034884",
"0.70342386",
"0.70342386",
"0.7020306",
"0.7019288",
"0.7010356",
"0.7008393",
"0.69876426",
"0.6987385",
"0.6987385",
"0.6987385",
"0.6987385",
"0.6976021",
"0.6972524",
"0.6963056",
"0.6953158",
"0.69348395",
"0.6916401",
"0.6912428",
"0.6912223",
"0.69109786",
"0.69109786",
"0.69109786",
"0.6899338",
"0.6899338",
"0.6896999",
"0.68961334",
"0.6893478",
"0.6861072",
"0.68347585",
"0.68297976",
"0.6821255",
"0.68070036",
"0.6796144",
"0.6796144",
"0.6796144",
"0.6792524",
"0.67896664",
"0.67811745",
"0.67811745",
"0.67811745",
"0.67811745",
"0.67811745",
"0.67811745",
"0.67811745",
"0.67811745",
"0.6773071",
"0.6772179",
"0.6767375",
"0.67627144",
"0.6743829",
"0.67393094",
"0.67344505",
"0.67222947",
"0.6689846",
"0.66703445",
"0.66689485",
"0.66600317",
"0.6654544",
"0.6648221",
"0.6648151",
"0.66428715",
"0.66428715",
"0.66428715",
"0.66391957",
"0.6622098",
"0.661453",
"0.6595129",
"0.6595129",
"0.6592534",
"0.6583453",
"0.6582656",
"0.65757436"
] |
0.0
|
-1
|
retrieving new argument before assignment gives empty array
|
def test_retrieving_new_argument_before_assignment_gives_empty_array
Crd::Flex::Command.new 'mxmlc' do |s|
assert_equal( [ ], s.library_path )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def old_value=(_arg0); end",
"def probers=(_arg0); end",
"def extra=(_arg0); end",
"def arguments=(_arg0); end",
"def PO114=(arg)",
"def []=(*args); end",
"def y=(_arg0); end",
"def PRF02=(arg)",
"def x=(_arg0); end",
"def x=(_arg0); end",
"def x=(_arg0); end",
"def set=(_arg0); end",
"def isolated=(_arg0); end",
"def isolated=(_arg0); end",
"def PO113=(arg)",
"def store=(_arg0); end",
"def PO106=(arg)",
"def PO111=(arg)",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def args=(_arg0); end",
"def SE02=(arg)",
"def tricky_method(my_string_param, an_array_param)\n puts \"my_string_param inside the method #{my_string_param.object_id}\"\n my_string_param += \"rutabaga\"\n puts \"my_string_param inside the method after re-assignment #{my_string_param.object_id}\"\n puts\n puts \"an_array_param inside the method before mutation #{an_array_param.object_id}\"\n an_array_param << \"rutabaga\"\n puts \"an_array_param inside the method after mutation #{an_array_param.object_id}\"\nend",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def value=(_arg0); end",
"def PO109=(arg)",
"def args(assignment, *rest)\n @values = []\n if last = rest.pop\n @values << last\n end\n @assignments = [assignment] + rest\n end",
"def PO101=(arg)",
"def params=(_arg0); end",
"def params=(_arg0); end",
"def PO105=(arg)",
"def PRF01=(arg)",
"def mutliplied(array)\nend",
"def SE01=(arg)",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # string is mutated\n an_array_param = ['pumpkins', 'rutabaga'] # array is reassigned, hence not mutated\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # modifies existing variable\n an_array_param = ['pumpkins', 'rutabaga'] # new variable -> no effect on my_array\nend",
"def SAC07=(arg)",
"def PO107=(arg)",
"def PO102=(arg)",
"def offences_by=(_arg0); end",
"def PO104=(arg)",
"def PO115=(arg)",
"def PRF04=(arg)",
"def AMT02=(arg)",
"def []=(p0, *rest) end",
"def []=(p0, *rest) end",
"def take_array(a)\n a = [\"a\", 1, 3, \"we0w98\"] \n puts a\n dont_mutate\n #mutate_caller\n end",
"def origin=(_arg0); end",
"def SAC02=(arg)",
"def pass=(_arg0); end",
"def normalized=(_arg0); end",
"def element=(_arg0); end",
"def parameters=(_arg0); end",
"def PRF03=(arg)",
"def get_arr_x(x, y) \n x # this coordinate doesn't change\nend",
"def mutate(arr)\n arr.pop # (no bang! here) mutates\nend",
"def strict_variables=(_arg0); end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def ext=(_arg0); end",
"def data=(_arg0); end",
"def data=(_arg0); end",
"def data=(_arg0); end",
"def data=(_arg0); end",
"def mutate(array)\n array.pop \nend",
"def initial=(_arg0); end",
"def getArray _args\n \"getArray _args;\" \n end",
"def SAC06=(arg)",
"def params=(_); end",
"def current_value=(_arg0); end",
"def before=(_arg0); end",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def mutate(array)\n array.pop\nend",
"def MTX02=(arg)",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def no_mutate(array)\n array.last\nend",
"def value_written=(_arg0); end",
"def SAC05=(arg)",
"def assignment(arr)\n yield(arr)\nend",
"def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga'\n # Appends the given object to str/original object\n an_array_param = ['pumpkins', 'rutabaga']\n # Assigns a new object to local variable an_array_param (but not my_array)\nend",
"def non_mutate(array)\n array.last\nend",
"def array_method(input, value_input, which_index)\n\tinput[which_index] = value_input\t\n\tputs input\n\treturn input\nend"
] |
[
"0.6616945",
"0.6561144",
"0.6530753",
"0.64734846",
"0.6375704",
"0.6318633",
"0.62615925",
"0.62433445",
"0.6227827",
"0.6227827",
"0.6227827",
"0.6221699",
"0.6206022",
"0.6206022",
"0.62057215",
"0.6202669",
"0.61804014",
"0.6177529",
"0.6177462",
"0.6177462",
"0.6177462",
"0.6177462",
"0.6177462",
"0.6165121",
"0.6138006",
"0.6119481",
"0.6119481",
"0.6119481",
"0.6119481",
"0.6119481",
"0.6119481",
"0.6119481",
"0.6119481",
"0.61094564",
"0.610637",
"0.60792494",
"0.6068676",
"0.6068676",
"0.60681736",
"0.60573286",
"0.6046636",
"0.60346156",
"0.6032754",
"0.60188395",
"0.6018256",
"0.6016548",
"0.5988322",
"0.5987467",
"0.5984863",
"0.5977173",
"0.5969478",
"0.596847",
"0.5963374",
"0.5963374",
"0.5944674",
"0.5939158",
"0.5933862",
"0.5922264",
"0.5918371",
"0.59149826",
"0.5911076",
"0.59086794",
"0.5907776",
"0.58775806",
"0.58737874",
"0.586095",
"0.586095",
"0.586095",
"0.5850126",
"0.5850126",
"0.5850126",
"0.5850126",
"0.5847609",
"0.5836273",
"0.58310777",
"0.5828468",
"0.5826007",
"0.58256996",
"0.58151335",
"0.58116823",
"0.58116823",
"0.58116823",
"0.58116823",
"0.58116823",
"0.58116823",
"0.58116823",
"0.58116823",
"0.58116823",
"0.58116823",
"0.58081454",
"0.580653",
"0.580653",
"0.580653",
"0.580653",
"0.580653",
"0.57965314",
"0.5789791",
"0.5788007",
"0.5784711",
"0.5784163",
"0.57799983"
] |
0.0
|
-1
|
can easily build arrays when accessing by default
|
def test_can_easily_build_arrays_when_accessing_by_default
Crd::Flex::Command.new 'mxmlc' do |s|
s.library_path << 'lib/bin'
s.library_path << 'lib/swc'
assert_equal( [ 'lib/bin', 'lib/swc' ], s.library_path )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def Array(p0) end",
"def __array__; self; end",
"def build_array(param1, param2, param3)\n\t[param1, param2, param3]\nend",
"def array\n raise \"Not implemented\"\n end",
"def make_array\n [@name, @author, @deviation_url, @views, @favs, @comments]\n end",
"def build_array(it1, it2, it3)\n\tnew_array = [it1, it2, it3]\n\tp new_array\nend",
"def array\n\t\t#create an array of\n\t\tarray = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n\tend",
"def create_an_array\n [\"a\", \"b\", \"c\", \"d\"]\nend",
"def build_array(a, b, c)\n\tx = []\n\treturn x.push(a, b, c)\nend",
"def array\n @@array\n end",
"def create_array(one, two, three)\n\treturn [one, two, three]\nend",
"def build_array\n arr = []\n yield(arr)\n arr \n end",
"def array()\n\t\t@array\n\tend",
"def array\n @array\n end",
"def getArray _args\n \"getArray _args;\" \n end",
"def array_array(rn, cn, iv = 1)\n Array.new(rn) { Array.new(cn, iv) }\nend",
"def build_array(x, y, z)\n array = []\n array.push(x, y, z)\nend",
"def converted_arrays; end",
"def create_an_array\n [\"oranges\",\"apples\",\"kiwis\",\"mangos\"]\nend",
"def instantiate_new_array\n<<<<<<< HEAD\n Array.new\nend",
"def beer(arr, x, y)\n build = Array.new \n arr << x << y \nend",
"def create_array(base_type, element_count, size = 0)\n if base_type.respond_to?(:name)\n base_type = base_type.name\n end\n return build(\"#{base_type}[#{element_count}]\", size)\n end",
"def make_array(item1, item2, item3)\n\tarray = [item1, item2, item3]\n\n\tarray\nend",
"def array(op, len, work) # DK:P297\n\t\t\t\twarn \"array is not implemented\"\n\t\t\tend",
"def make_array\n <<-CODE\n next_int;\n t1 = array_new(state, _int);\n j = _int - 1;\n for(; j >= 0; j--) {\n t2 = stack_pop();\n array_set(state, t1, j, t2);\n }\n\n cpu_perform_hook(state, c, BASIC_CLASS(array),\n global->sym_from_literal, t1);\n stack_push(t1);\n CODE\n end",
"def [](idx)\n Ruby.primitive :array_aref\n end",
"def name_array(name1, name2)\n real_name_array = [name1, name2]\n real_name_array\nend",
"def [](length)\n self::Array.new(length)\n end",
"def array_nl()\n #This is a stub, used for indexing\n end",
"def beer(arr, x, y)\n\tbuild = Array.new\n\tarr << x << y \nend",
"def build_sample\n sample = Array.new(8) {Array.new(8)}\n sample[0][0] = King.new(0, 0, 0)\n sample[7][7] = King.new(7, 7, 1)\n sample[0][4] = Rook.new(0, 4, 1)\n sample[4][0] = Rook.new(4, 0, 1)\n sample[4][4] = Bishop.new(4, 4, 1)\n sample\nend",
"def multidimArray\n # fill multidimensional\n puts \"----------- Multi-dimensional arrays -------------- \"\n empty_table = Array.new(3) { Array.new(3) }\n Array({:a => \"a\", :b => \"b\"}) #=> [[:a, \"a\"], [:b, \"b\"]]\n number_array = [ [1,2,3], [4,5,6] ]\n puts number_array.to_s\nend",
"def another; return []; end",
"def[] *description\n\t\t\tNArray.new(description)\n\t\tend",
"def create_array_new(size)\n Array.new(size) { Array.new(size) { '0' } }\nend",
"def calls_array\n a = return_array\n a[1]\n end",
"def get_array(key, values, level)\n content = ''\n content << \"#{key.to_s}[]=\"\n if values[0].is_a?(::Numeric)\n content << '{'\n values.each { |v|\n content << \"#{get_numeric(v)},\"\n }\n content.chomp!(',')\n content << \"};\\r\\n\"\n else\n content << \"\\r\\n\"\n level.times { content << \"\\t\"}\n content << \"{\\r\\n\"\n values.each { |v|\n (level + 1).times {content << \"\\t\"}\n content << \"\\\"#{v.to_s}\\\",\\r\\n\"\n }\n content.chomp!(\",\\r\\n\")\n content << \"\\r\\n\"\n level.times { content << \"\\t\"}\n content << \"};\\r\\n\"\n end\n content\n end",
"def at(idx)\n Ruby.primitive :array_aref\n end",
"def make_array(n)\n if n.class != Array\n x = []\n x << n\n array = x\n return array\n else\n return n\n end\n end",
"def [](index)\n Array.new([index])\n end",
"def array_with_two_elements\n @my_two_array = Array.new(2)\nend",
"def _get_array(sp, key)\n return self[key] if sp.length == 0\n\n if key.is_a?(Range)\n res = []\n self[key].each do |k|\n next unless k.structured?\n res << k.rh_get(sp) if k.rh_exist?(sp)\n end\n res\n else\n self[key].rh_get(sp) if self[key].structured?\n end\n end",
"def to_a; Array(force) end",
"def get_array(path=\"\")\n Element.get_array(@element, path)\n end",
"def to_a; [Array]; end",
"def to_ary() end",
"def visit_array(h); end",
"def array_with_two_elements\n ary = Array.new\n Array.new(2)\nend",
"def yale_nd_row_as_array i\n yale_nd_row(i, :array)\n end",
"def poorly_written_ruby(*arrays)\n \n # create an empty combined array\n combined_array = []\n \n # for each array in the arrays object, add it to the combined array\n arrays.each do |array|\n combined_array += array\n end\n\n return combined_array\nend",
"def array(arg)\n if arg\n arg = arg.chomp.rstrip.lstrip\n name = arg.scan(/\\s*(\\w*)\\[\\d*\\]?/).first.first\n \n # following 10 lines seem to be unnecessary\n # and are left over from early array work\n # but they are still here for a bit\n # determine if there is an array assignement, and how many\n # then eliminate the assignment and update the array size\n # if /\\w*\\[\\d*\\]\\s*\\=\\s*\\{(.*)\\}/ =~ arg\n # assignment = arg.scan(/\\w*\\[\\d*\\]\\s*\\=\\s*\\{(.*)\\}/).first.first\n # array_size = assignment.split(\",\").length\n # if /\\[(\\s*)\\]/ =~ arg\n # arg.gsub!(/(\\[\\d*\\])/, \"[#{array_size}]\")\n # end\n # end\n # arg = arg.scan(/^((\\s*|\\w*)*\\s*\\w*\\[\\d*\\])?/).first.first\n\n # help rad_processor do a better job with array types\n types = [\"int\", \"long\", \"char*\", \"unsigned int\", \"unsigned long\", \"byte\", \"bool\", \"float\" ]\n types.each_with_index do |type, i|\n @type = types[i] if /#{type}/ =~ arg\n end\n raise ArgumentError, \"type not currently supported.. got: #{arg}. Currently supporting #{types.join(\", \")}\" unless @type\n\n arg = \"#{arg};\" unless arg[-1,1] == \";\"\n $array_types[name] = @type\n @type = nil\n $external_var_identifiers << name unless $external_var_identifiers.include?(name)\n # add array_name declaration\n $external_array_vars << arg unless $external_array_vars.include?(arg)\n end\n end",
"def initialize arr = []\n super arr\n end",
"def array_init(size, value)\n arr = Array.new(size) { value }\nend",
"def array(sym, options)\n size = options.fetch(:size, 0)\n default = options.fetch(:default) { ->(_, _) { Array.new(size) } }\n type = Array[options.fetch(:type)]\n field sym, options.merge(type: type, default: default)\n end",
"def double_array(array)\n # your code here\nend",
"def test_array_literals\n array = Array.new\n assert_equal [], array\n\n array[0] = 1\n assert_equal [1], array\n\n array[1] = 2\n assert_equal [1, 2], array\n\n array << 333\n assert_equal [1, 2, 333], array\n end",
"def initialize(val, nombre)\n @value = Array.new(nombre, val)\nend",
"def initialize\n @more_array = Array.new\n end",
"def get_items\r\n @arr.to_a\r\n end",
"def array_start\n []\n end",
"def index_as\n Array(@index_as)\n end",
"def lcts(array)\nend",
"def get_array(path='.')\n Element.get_array(@element, path)\n end",
"def _array(obj)\n obj.map { |v| _renc(v) }\n end",
"def to_a\n @array ||= [name, depth]\n end",
"def add_to_array(var1, *others)\n\tcurrent_arr = [var1, *others]\n\tcurrent_arr = current_arr.flatten\n\tp current_arr\nend",
"def arrays\n @vectors\n end",
"def mutliplied(array)\nend",
"def index_as\n Array(@index_as)\n end",
"def array(before: Pass.instance, each: Pass.instance, after: Pass.instance)\n ArrayV.new before: before, each: each, after: after\n end",
"def explore_array(method, *arguments)\n ['a', 'b', 'c'].send(method, *arguments)\nend",
"def k_array!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 60 )\n\n\n\n type = K_ARRAY\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 493:3: 'array'\n match( \"array\" )\n\n\n\n @state.type = type\n @state.channel = channel\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 60 )\n\n\n end",
"def array\n \t(1..size).map{ |i| \"#{fill}\" }\n end",
"def make_array(startArrayValue, endArrayValue)\n\tresultArray = []\n\tfor i in startArrayValue..endArrayValue\n\t\tresultArray.push(i)\n\tend\n\treturn resultArray\nend",
"def array(input_array)\n output = input_array + [100] # Creates a new array by adding '[]' to the string \"100\",\n # then combines \"input_array\" and \"[\"100\"]\" arrays by '+'\n return output\nend",
"def airports_normal\n return Array.new\n end",
"def to_ary; []; end",
"def array_with_two_elements\n [1,2]\nend",
"def get_array_final(name,value)\n\thash_final = Hash[name.zip(value.map)]\n\treturn hash_final\nend",
"def double_array(array)\n array + array\nend",
"def create_arr\n k = []\n n = self.first\n until n.nil? do\n if n.value.is_a? Linkedlist\n k.append(n.value.create_arr)\n else\n k.append(n.value)\n end\n n = n.next\n end\n return k\n end",
"def initialize; @ary = []; end",
"def arrays_of_arrays(names, specialties)\n result = []\n\n # initialize iterator\n i = 0\n\n #loops through names\n specialties.each do |specialty|\n\n # shovel sub_array into result\n result.push([names[i]] + [specialty])\n\n # increment iterator\n i += 1\n end\n return result\n\nend",
"def initialize array\n @array = array\n end",
"def to_a; [w, x, y, z] end",
"def company_array(arr)\n companies_array = []\n arr.each {|comp| companies_array << comp }\n companies_array \nend",
"def build_array(node)\r\n return [] if node.nil?\r\n results = []\r\n results.concat build_array(node.left)\r\n results << node.payload\r\n results.concat build_array(node.right)\r\n results\r\nend",
"def array(*args)\n args_ = (args.size == 1) && (args[0].is_a? ::Array) ? args[0] : args\n args_.each_with_object(newObject('Array')) do |val, obj|\n obj.add val\n end\n end",
"def [](*) end",
"def to_index_array a=[]\n\t\t@primitives.each do |p|\n\t\t\ta += p[:verts]\n\t\tend\n\t\ta\n\tend",
"def mda(width, height) \n return Array.new(width){ Array.new(height) }\nend",
"def arrayaccess\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 27 )\n __IDENTIFIER19__ = nil\n\n begin\n # at line 871:4: IDENTIFIER '[' expression ']'\n __IDENTIFIER19__ = match( IDENTIFIER, TOKENS_FOLLOWING_IDENTIFIER_IN_arrayaccess_1431 )\n match( T__32, TOKENS_FOLLOWING_T__32_IN_arrayaccess_1436 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_arrayaccess_1441 )\n expression\n @state.following.pop\n # --> action\n\n \t var = nil\n \t if(not @current_method.nil?)\n \t\t if(not @current_method.local_variables[__IDENTIFIER19__.text].nil?)\n \t\t var = @current_method.local_variables[__IDENTIFIER19__.text]\n \t\t elsif( not @current_class.instance_variables[__IDENTIFIER19__.text].nil?)\n \t\t var = @current_class.instance_variables[__IDENTIFIER19__.text]\n \t\t else\n \t\t raise \"Variable #{__IDENTIFIER19__.text} not declared neither in #{@current_class.name} or its method #{@current_method.name}\"\n \t\t end\n \t\t\telse\n \t\t \tif( not @current_class.instance_variables[__IDENTIFIER19__.text].nil?)\n \t\t \t var = @current_class.instance_variables[__IDENTIFIER19__.text]\n \t\t else\n \t\t raise \"Variable #{__IDENTIFIER19__.text} not declared as instance of #{@current_class.name}\"\n \t\t end\n \t\t\tend\n \t\t\taux = @stack_operands.pop\n \t\t\ttype = @stack_types.pop\n \t\t\tif(type != 'int')\n \t\t\t raise \"You can only access an address of an array with an integer expression \"\n \t\t\tend\n \t generate('ver', aux, nil, var.dim)\n \t base = var.address\n \t temp = get_avail\n \t generate('jmp', base, aux, temp)\n \t free_avail(aux)\n \t @stack_operands.push(\"(#{temp})\")\n \t\t @stack_types.push(var.type)\n \t \n # <-- action\n match( T__33, TOKENS_FOLLOWING_T__33_IN_arrayaccess_1451 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 27 )\n\n end\n \n return \n end",
"def get_items\n\t\t@arr\n\tend",
"def Array(type)\n Strict(::Array).of(type)\n end",
"def test_array_accessor\n @valid_source[N::MEETEST::array_test] << \"foo\"\n assert_equal(@valid_source[N::MEETEST::array_test], @valid_source.meetest::array_test)\n assert_equal(\"foo\", @valid_source[N::MEETEST::array_test][0])\n end",
"def [] i\n @array[i]\n end",
"def [](*args)\n self.to_a[*args]\n end",
"def [](*args)\n self.to_a[*args]\n end",
"def to_a\n @arr\n end",
"def add(x, y, z)\n#\tx + y + z\n\tbuild = Array.new\n\tbuild << x << y << z\nend",
"def table_array\r\n @table_array\r\n end"
] |
[
"0.70760995",
"0.70729804",
"0.6957557",
"0.6777844",
"0.6753968",
"0.67352843",
"0.66489214",
"0.661263",
"0.660413",
"0.6595286",
"0.657325",
"0.65664274",
"0.65545654",
"0.6505749",
"0.6501083",
"0.6496304",
"0.6495435",
"0.6477869",
"0.64571416",
"0.6437",
"0.6430427",
"0.6362715",
"0.6357234",
"0.63169736",
"0.62888974",
"0.6267136",
"0.6254837",
"0.6253259",
"0.62509936",
"0.62078416",
"0.6198126",
"0.6123948",
"0.6123629",
"0.61206853",
"0.61117",
"0.6088595",
"0.6079956",
"0.60786015",
"0.60750884",
"0.6028114",
"0.6018607",
"0.6017982",
"0.6014449",
"0.5988586",
"0.5975597",
"0.5967374",
"0.59492975",
"0.59316474",
"0.5930199",
"0.59187984",
"0.5916227",
"0.5905907",
"0.58995086",
"0.5896328",
"0.587793",
"0.584634",
"0.5824025",
"0.5812774",
"0.58120346",
"0.58089375",
"0.5793241",
"0.57879853",
"0.57828027",
"0.57801414",
"0.57794744",
"0.57740045",
"0.5767898",
"0.5759962",
"0.5759494",
"0.57526386",
"0.5752303",
"0.5748739",
"0.5747288",
"0.57429624",
"0.57317317",
"0.5731047",
"0.5718351",
"0.5708929",
"0.57060194",
"0.56942123",
"0.56913406",
"0.56828445",
"0.5662058",
"0.5660491",
"0.56565154",
"0.56558996",
"0.5653947",
"0.56388533",
"0.5634255",
"0.5625192",
"0.5616553",
"0.56111085",
"0.560655",
"0.5605441",
"0.5594067",
"0.5591497",
"0.5590315",
"0.5590315",
"0.558852",
"0.5587285",
"0.5582295"
] |
0.0
|
-1
|
assembles one string argument into cmd
|
def test_assembles_one_string_argument_into_cmd
Crd::Flex::Command.new 'mxmlc' do |s|
s.output = 'Main.swf'
cmd = s.to_cmd.split( /\s+/ )
assert_equal( 'mxmlc', cmd.shift )
assert( cmd.include?( '-output=Main.swf' ), 'Could not find argument in to_cmd' )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_command(cmd)\n cmd\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def command_str_for(*args)\n args.collect{|arg|\n case arg\n when Array\n arg.join(' ')\n when Hash\n arg.collect{|k,v| \"-#{k} #{v}\"}.join(' ')\n else\n arg.to_s\n end\n }.join(' ')\n end",
"def command_shell_string__from call, *args\n \"#{call} #{args.join \" \"}\"\n end",
"def commander _args\n \"commander _args;\" \n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def to_s\n cmd = ''\n @arr.each do |arg|\n if arg == @arr.first\n cmd << arg\n elsif arg.is_a?(Array)\n param, value = arg.first.to_s, arg.last.to_s\n\n if param =~ /^\\-{1,2}(.*)/\n param = $1\n end\n\n if param.length == 1\n cmd << ' ' << \"-#{param} #{Escape.shell_single_word(value)}\"\n else\n cmd << ' ' << \"--#{param}=#{Escape.shell_single_word(value)}\"\n end\n elsif arg.is_a?(Symbol)\n arg = arg.to_s\n if arg.length == 1\n cmd << ' ' << \"-#{arg}\"\n else\n cmd << ' ' << \"--#{arg}\"\n end\n elsif arg.is_a?(String) && arg.strip =~ /^\\-/\n cmd << ' ' << arg\n else\n cmd << ' ' << Escape.shell_single_word(arg.to_s)\n end\n end\n cmd\n end",
"def command(binary, action, service, param = nil, sub_param = nil)\n [\n prepare_parameter(binary),\n action, # simple keyword does not need transformation\n prepare_parameter(service),\n prepare_parameter(param),\n prepare_parameter(sub_param, false) # last param does no need quoting\n ].reject(&:empty?).join ' '\n end",
"def cmd(*args)\n\n cmd_args = []\n\n for arg in args\n\n case arg\n\n when Array\n cmd_literals = arg.shift.split(/\\s+/)\n\n for cmd_literal in cmd_literals\n if cmd_literal == \"?\"\n raise \"Not enough substitution arguments\" unless cmd_args.any?\n cmd_args << arg.shift\n else\n cmd_args << cmd_literal\n end\n end\n\n raise \"More parameters than ?'s in cmd string\" if arg.any?\n\n when String\n cmd_args << arg\n\n else\n cmd_args << arg.to_s\n\n end\n\n end\n\n p [:cmd_args, cmd_args] if $DEBUG\n\n system(*cmd_args)\nend",
"def command_name=(_arg0); end",
"def doCmd(cmd)\n puts cmd;\n puts `#{cmd}`;\nend",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def cmd(cmd, *args)\n system(\"#{cmd} #{args.join(' ')}\")\nend",
"def parse_command_string( arg )\n return arg if arg.kind_of? Array # assume no work needed\n # Otherwise, assume arg is a ς and split it using #each_char\n arg.to_s.each_char.with_object [] do |char, memo|\n # Handle prefix characters:\n ( PREFIX_CHARACTERS.include?(memo[-1]) ? memo[-1] : memo ) << char\n end\n end",
"def cmd(options={})\n arguments\n end",
"def test_assembles_two_string_arguments_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.output = 'Main.swf'\n s.static_link_runtime_shared_libraries = true\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-output=Main.swf' ), 'Could not find argument in to_cmd' )\n assert( cmd.include?( '-static-link-runtime-shared-libraries=true' ), 'Could not find argument in to_cmd' )\n end\n end",
"def run_cmd(input); end",
"def cmd(*args) self.class.cmd(*args) end",
"def cmd(*args)\n command = Shellwords.join(args)\n out = `#{command}`.strip\n fail!(puts \"command failed: #{command}\", $?.exitstatus) unless $?.success?\n out\nend",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def command_for(name, *args)\n command_str_for(*(COMMANDS[name] + args))\n end",
"def quoted_shell_param s\n \"\\\"#{s}\\\"\"\n end",
"def command\n return \"#{@command} #{options}\"\n end",
"def command(str)\n ar=str.split(/ /)\n case ar[0]\n when \"++addr\"\n if ar.size<2\n return @addr.to_s\n else \n @addr=ar[1].to_i\n end\n\n end\n return nil\n end",
"def command(cmd)\n \"do_#{cmd}\".intern\n end",
"def cmdline\n if @cmdline.nil?\n cmdline = \"#{@cmd}\"\n @args.each do |arg|\n cmdline << (arg.to_s.index(\" \") ? \" \\\"#{arg}\\\"\" : \" #{arg}\")\n end if @args\n @cmdline = cmdline\n end\n @cmdline\n end",
"def command_raw(args)\n\n end",
"def from_cmd(cmd)\n so = shell_out(cmd)\n so.stdout.split($/)[0]\n end",
"def create_commands args\n command = String.new\n args.each do |arg|\n command << arg << \" \" \n end\n command\n end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def parse_string_argument(key)\n if @opts[key].nil? and s=@argv.shift\n @opts[key] = s.dup \n end\n end",
"def command\n device = \"\"\n if @device != -1\n device = \"--device #{@device.to_s}\"\n end\n blocks = \"\"\n if @include_blocks\n blocks = \"--show_blocks\"\n end\n \"%s --size %d --duration %d --randsleep %s %s\" % [@executable, @input_size,\n @duration, blocks, device]\n end",
"def exec_cmd(cmd, str)\n return cmd.execute(@pl, str.split(\" \"))\nend",
"def cmd(command)\n\t\tbegin\n\t\t\t`#{command}`\n\t\trescue Exception => e\n\t\t\te.to_s\n\t\tend\n\tend",
"def issue_command(str)\n puts str\nend",
"def cmd\n c = ['git commit']\n c << '-a' if all?\n c << %(-m \"#{options.message}\") if message?\n c << %(-m \"#{message}\") unless story_ids.empty?\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(' ')\n end",
"def command_string\n\n cmd = \"perl -MIO -e '$p=fork();exit,if$p;\" +\n \"$c=new IO::Socket::INET6(LocalPort,#{datastore['LPORT']},Reuse,1,Listen)->accept;\" +\n \"$~->fdopen($c,w);STDIN->fdopen($c,r);system$_ while<>'\"\n\n return cmd\n end",
"def command\n if args.skip?\n ''\n else\n commands.join('; ')\n end\n end",
"def cmd(string)\n @commands << string\n end",
"def command\n args = options[:args].join(' ')\n\n return \"python -E #{kernel} #{args} #{conversion}\"\n end",
"def quick_command\n @raw[0] || \"\"\n end",
"def run(cmd)\n TV.new [\"--test\", cmd.split].flatten\nend",
"def run_command(*args)\n %x(#{args.join(\" \")})\n rescue IOError, SystemCallError\n nil\n end",
"def expand_command(command)\n if match = /^\"(.+?)\"(?:\\s+(.*))?/.match(command)\n exe, arguments = match.captures\n exe = which(exe) and [ \"\\\"#{exe}\\\"\", arguments ].compact.join(\" \")\n elsif match = /^'(.+?)'(?:\\s+(.*))?/.match(command) and not Facter::Util::Config.is_windows?\n exe, arguments = match.captures\n exe = which(exe) and [ \"'#{exe}'\", arguments ].compact.join(\" \")\n else\n exe, arguments = command.split(/ /,2)\n if exe = which(exe)\n # the binary was not quoted which means it contains no spaces. But the\n # full path to the binary may do so.\n exe = \"\\\"#{exe}\\\"\" if exe =~ /\\s/ and Facter::Util::Config.is_windows?\n exe = \"'#{exe}'\" if exe =~ /\\s/ and not Facter::Util::Config.is_windows?\n [ exe, arguments ].compact.join(\" \")\n end\n end\n end",
"def get_cmd(extra_params = '')\n\n cmd = 'dustmasker '+@extra_params + '-outfmt '+ @format + ' 2>/dev/null'\n return cmd\n\n end",
"def call(*command); end",
"def make_command(action, args = [])\n command = @commands[action.to_sym]\n command += \" '\" + args.join(' ') + \"'\" unless args.empty?\n\n command\n end",
"def runprog(prog, arg)\n %x( #{prog} #{arg} )\nend",
"def normalize_args(string, options_hash); end",
"def argument_string(args)\n args.inject([]) do |opts, opt|\n opts << (opt =~ /^-/ ? opt : opt.inspect)\n end.join(' ') \n end",
"def cli_path=(_arg0); end",
"def cmd str; MimaCommand.new(str).bits; end",
"def cmd(str)\n\t\t@pipe.puts str\n\tend",
"def binocular _args\n \"binocular _args;\" \n end",
"def command\n\n cmd = \"\"\n\n xval = @options['xrange']\n cmd << \" #{xval}\" if( xval )\n \n yval = @options['yrange']\n cmd << \" #{yval}\" if( yval and xval )\n\n cmd << \" #{@basecommand}\"\n\n cmd << \" using #{@options['using']}\" if( @options['using'] )\n\n tstr = @options[\"title\"]\n cmd += if( !tstr ) then ''\n\t elsif( tstr == 'notitle' ) then 'notitle'\n\t else \" title '#{tstr}'\"\n\t end\n\n cmd << \" with #{@options['with']}\" if( @options[\"with\"] )\n\n cmd\n end",
"def mk_cmd(env, cmd, options)\n [env, cmd.shellsplit, options].flatten\n end",
"def command\n ([executable] + options_composition + @redirections).join(\" \")\n end",
"def sh_string(cmd, default = nil)\n val = sh(cmd).strip rescue nil\n val.nil? || val.empty? ? default : val\n end",
"def argument_string(args)\n args.inject([]) do |opts, opt|\n opts << (opt =~ /^-/ ? opt : opt.inspect)\n end.join(' ')\n end",
"def cmd(str)\n return `cd #{APP_DIR}; #{str}`\nend",
"def ex(cmd)\n puts cmd\n puts `#{cmd}`\nend",
"def sh_string(cmd, default)\n val = sh(cmd).strip rescue nil\n (val.nil? || val.empty?) ? default : val\n end",
"def cli_prefix=(_arg0); end",
"def parse(line)\n cmd, arg_string = line.downcase.split(' ')\n [cmd, *arg_string.to_s.split(',')]\n end",
"def command(cmd)\n if VNMNetwork::COMMANDS.keys.include?(cmd.to_sym)\n cmd_str = \"#{VNMNetwork::COMMANDS[cmd.to_sym]}\"\n else\n cmd_str = \"#{cmd}\"\n end\n\n return cmd_str\n end",
"def command_name(cmd)\n cmd\n end",
"def test_assembles_one_array_argument_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.source_path << 'src'\n s.source_path << 'lib/src'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-source-path+=src,lib/src' ), 'Could not find argument in to_cmd' )\n end\n end",
"def effectiveCommander _args\n \"effectiveCommander _args;\" \n end",
"def run_cmd(cmd)\n\tend",
"def command_string(cmd, params)\n clean_params = Hash[params]\n clean_params[:Bugzilla_password] = \"********\"\n \"xmlrpc_client.call(#{cmd}, #{clean_params})\"\n end",
"def parse_input(input_string)\n cmd = \"\"\n args = []\n \n split_input = input_string.split(\",\")\n \n if split_input.length > 1\n cmd = split_input[0].slice(15, split_input[0].length - 1)\n i = 1;\n while i < split_input.length\n arg = \"\"\n input_chars = split_input[i].chars\n input_chars.each do |char|\n if char != \" \" && char != \")\"\n arg += char\n end\n end\n args << arg\n i += 1\n end\n else\n cmd = split_input[0].slice(15, split_input[0].length - 2)\n end\n puts cmd\n puts args\nend",
"def test_to_cmd_is_formatted_appropriately\n cmd = @cmd.to_cmd\n assert_match( /^asdoc\\s/, cmd )\n assert( cmd.include?( '-output=build/docs' ), 'Could not find output argument in to_cmd' )\n assert( cmd.include?( '-source-path+=test/fixtures/target,libs/src' ), 'Could not find source-path argument in to_cmd' )\n assert( cmd.include?( '-library-path+=libs/bin' ), 'Could not find library-path argument in to_cmd' )\n assert( cmd.include?( '-doc-sources=test/fixtures/target' ), 'Could not find doc-sources argument in to_cmd' )\n assert( cmd.include?( '-main-title=\"Testing API Documentation\"' ), 'Could not find main-title argument in to_cmd' )\n assert( cmd.include?( '-window-title=\"Testing API Documentation\"' ), 'Could not find window-title argument in to_cmd' )\n end",
"def shell(cmd)\n `#{cmd}`\n end",
"def shell(cmd)\n `#{cmd}`\n end",
"def run2(*args)\n args.map!(&:to_s)\n command = args.join(' ')\n if include_meta_character?(command)\n run(command)\n else\n run(*args)\n end\n end",
"def command_string\n\t\treturn datastore['CMD'] || ''\n\tend",
"def command(name,aliases,desc,long_desc,arg_name,arg_options)\n @io.puts \"#{@nest}=== Command: <tt>#{([name] + aliases).join('|')} #{@arg_name_formatter.format(arg_name,arg_options,[])}</tt>\"\n @io.puts String(desc).strip\n @io.puts \n @io.puts String(long_desc).strip\n @nest = \"#{@nest}=\"\n end",
"def to_s\n require \"shellwords\"\n\n escaped_args = @args.map do |arg|\n escaped = Shellwords.escape(arg)\n next escaped if escaped == arg\n next escaped if arg.include?(\"'\")\n \"'#{arg}'\"\n end\n escaped_args.join(\" \")\n end",
"def build_remote_cmd(task, cmd_str, input, given_opts, ssh_opts)\n Remote::Cmd.new(cmd_str, ssh_opts)\n end",
"def test_assembles_two_array_arguments_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.source_path << 'src'\n s.source_path << 'lib/src'\n s.library_path << 'lib/bin'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-source-path+=src,lib/src' ), 'Could not find argument in to_cmd' )\n assert( cmd.include?( '-library-path+=lib/bin' ), 'Could not find argument in to_cmd' )\n end\n end",
"def command(type, name, data = nil)\n command = \"#{type} /#{name}\"\n command += \" #{data}\" if data\n \n STDOUT.puts(command)\n end",
"def cmd\n (@cmd ? @cmd : @ctx.cmd).join ' '\n end",
"def build_local_cmd(task, cmd_str, input, given_opts)\n Local::Cmd.new(cmd_str, given_opts)\n end",
"def text_from_args\n\t\t\treturn ARGV.join(' ').gsub(\"\\t\",'')\n\t\tend",
"def get_command_from_args(args)\n raise 'A command is required' if args.empty?\n {\n :filename => 'todo_list_data.txt',\n :command => args[0],\n :modifier => args[1]\n }\n end",
"def quote_arg(arg)\n '\"' + arg.to_s.gsub(ARG_QUOTER) { |m| \"\\\\#{m}\" } + '\"'\n end",
"def system(cmd, *rest) end",
"def cmd(cmd)\n puts cmd\n system cmd\n end",
"def get_cmdline_str(args)\n # Build commandline string, with quotes around arguments with special\n # characters in them (i.e., characters interpreted by shell)\n args_str = \"\"\n quote = '\"'\n args.each do |arg|\n if not arg.kind_of?(String)\n raise RuntimeError, \"Argument not string: '#{arg}' (#{arg.class})\"\n end\n\n if arg.nil?\n next\n end\n # Quote whitespace and '\\'\n if not /[\\s\\\\]/.match(arg).nil?\n arg = \"#{quote}#{arg}#{quote}\"\n end\n args_str += \"#{arg} \"\n end\n args_str.strip!()\n\n return args_str\n end",
"def cmd(cmd)\n puts cmd\n system cmd\nend",
"def command(string)\n @request_id = rand(1000)\n @string1 = string\n @string2 = TRAILER\n @command_type = COMMAND_EXEC\n\n @packet_size = build_packet.length\n\n return self\n end",
"def absolute_command(cmd, path: nil)\n was_array = cmd.is_a?(Array)\n cmd = if was_array\n cmd.dup\n else\n Shellwords.split(cmd)\n end\n # Don't try to touch anything if the first value looks like a flag or a path.\n if cmd.first && !cmd.first.start_with?('-') && !cmd.first.include?(::File::SEPARATOR)\n # If which returns false, just leave it I guess.\n cmd[0] = which(cmd.first, path: path) || cmd.first\n end\n cmd = Shellwords.join(cmd) unless was_array\n cmd\n end",
"def precmd(line)\n line\n end"
] |
[
"0.7068323",
"0.69636685",
"0.69636685",
"0.69366765",
"0.6899672",
"0.68419486",
"0.6755255",
"0.6755255",
"0.6755255",
"0.6679324",
"0.6585226",
"0.6529333",
"0.6517605",
"0.64571357",
"0.6444411",
"0.6444411",
"0.6444411",
"0.642966",
"0.64284426",
"0.6351566",
"0.63457745",
"0.631738",
"0.6298997",
"0.6286874",
"0.62543416",
"0.6194601",
"0.6179615",
"0.61696494",
"0.6157549",
"0.6150045",
"0.6142871",
"0.6139081",
"0.6125598",
"0.61139727",
"0.6105444",
"0.6105444",
"0.6105444",
"0.60831404",
"0.6081492",
"0.60587627",
"0.6049642",
"0.6041617",
"0.60284144",
"0.6027898",
"0.6025125",
"0.60234374",
"0.6009146",
"0.5999565",
"0.59994966",
"0.5995953",
"0.5979339",
"0.5973101",
"0.59586984",
"0.59130996",
"0.588835",
"0.5884293",
"0.5875155",
"0.58586395",
"0.5857883",
"0.5855103",
"0.58508474",
"0.58335465",
"0.5816126",
"0.581374",
"0.58077157",
"0.5801974",
"0.5799179",
"0.5798717",
"0.5796807",
"0.5794922",
"0.57936674",
"0.5791511",
"0.5777858",
"0.57727814",
"0.5765433",
"0.57531226",
"0.5742224",
"0.57348686",
"0.57316697",
"0.5708753",
"0.5708753",
"0.5706087",
"0.5703332",
"0.57020295",
"0.57001364",
"0.5699327",
"0.569631",
"0.569539",
"0.5693523",
"0.56905276",
"0.569011",
"0.56708616",
"0.5670344",
"0.56471425",
"0.5644833",
"0.56440794",
"0.56359226",
"0.56319785",
"0.5631827",
"0.5625864"
] |
0.72035694
|
0
|
converts argument names with underscores to hyphens
|
def test_converts_argument_names_with_underscores_to_hyphens
Crd::Flex::Command.new 'mxmlc' do |s|
s.static_link_runtime_shared_libraries = true
cmd = s.to_cmd.split( /\s+/ )
assert_equal( 'mxmlc', cmd.shift )
assert( cmd.include?( '-static-link-runtime-shared-libraries=true' ), 'Could not find argument in to_cmd' )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def argument_name_without_leading_underscore\n name = if argument_name_string[FIRST_CHARACTER] == UNDERSCORE\n argument_name_string.reverse.chop.reverse\n else\n argument_name_string\n end\n name.to_sym\n end",
"def dasherize(underscored_word)\n underscored_word.gsub(/_/, '-')\n end",
"def dasherize(underscored_word)\n underscored_word.gsub(/_/, '-')\n end",
"def dasherize(underscored_word)\n underscored_word.gsub(/_/, '-')\n end",
"def dasherize(underscored_word)\n underscored_word.to_s.dup.tr('_', '-')\n end",
"def dasherize(word)\n word.gsub(/_/,'-')\nend",
"def transformed_argname=(_); end",
"def _normalize(name)\n # maybe do something more, maybe not.. ruby does allow for\n # some weird stuff to be used as a variable name. the user\n # should use some common sense. and, other things might\n # also be an syntax error, like starting with a number.\n # this normalization is more of a comvenience than anything\n # else\n name.tr('-', '_')\n end",
"def transformed_argname; end",
"def normalize(name)\n name.to_s.gsub('-', '_')\n end",
"def name_with_underscores\n name.gsub(\" \", \"_\")\n end",
"def underscore!\n gsub!('::', '_')\n gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n downcase!\n end",
"def normalize_switch raw_switch_arg\n (@shorts[raw_switch_arg] || raw_switch_arg).tr(\"_\", \"-\")\n end",
"def dasherize(s, opts)\n if opts[:dasherize]\n s.tr('_', '-')\n else\n s\n end\n end",
"def underscore_name(name)\n name.to_s.sub(/.*::/, \"\").\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore\n gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z\\d])(A-Z)/, '\\1_\\2').\n tr('-', '_').downcase\n end",
"def shellify_opt(value)\n value.to_s.gsub('_', '-')\n end",
"def dasherize!\n self.replace(self.scan(/[A-Z][a-z]*/).join(\"-\").downcase)\n end",
"def transform\n params.transform_keys! { |key| key.tr('-', '_') }\n end",
"def underscore(a_word)\n u_word = a_word.dup\n u_word.gsub!(/::/, '/')\n u_word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n u_word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n u_word.tr!(\"-\", \"_\")\n u_word.downcase!\n u_word\nend",
"def underscore\n gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').tr('-', '_').downcase\n end",
"def to_dash(s)\n s.gsub(/\\.|\\_/, '--')\n end",
"def dasherize(word)\n classify(word).to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"_\", \"-\").downcase\n end",
"def underscore(camel_cased_word)\n\tcamel_cased_word.to_s.gsub(/::/, '/').\n\t gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t tr(\"-\", \"_\").\n\t downcase + \"s\"\nend",
"def underscore(camel_cased_word)\n camel_cased_word.to_s.\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def undasherize(str)\n str.sub(/^-{1,2}/, '')\n end",
"def underscore(camel_cased_word)\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end",
"def normalize(key)\n key.tr(\"-\", \"_\")\n end",
"def underscore\n self.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore(camel_cased_word)\n return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/\n word = camel_cased_word.to_s.gsub(/::/, '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word.to_sym\n end",
"def dasherize(underscored_word)\n Geode::FastInflector.dasherize(underscored_word)\n end",
"def underscore(str) # :doc:\n str.to_s. # allow symbols and strings\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2'). # underscore-delimit caps\n gsub(/([a-z\\d])\\s?([A-Z])/, '\\1_\\2'). # underscore-delimit words\n tr(\"-\", \"_\"). # dashes to underscores\n downcase. # everything lowercase\n to_sym # convert to symbol\n end",
"def dash_case(preserve_prefixed_underscores: true)\n LuckyCase.dash_case self, preserve_prefixed_underscores: preserve_prefixed_underscores\n end",
"def cfn_safe(string)\n string.gsub(/[\\W_]/, '-')\n end",
"def underscore(camel_cased_word)\n word = camel_cased_word.to_s.dup\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end",
"def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore(word)\n word.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore\n\t self.to_s.gsub(/::/, '/').\n\t gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t tr(\"-\", \"_\").\n\t downcase\n\tend",
"def underscore\n\t self.to_s.gsub(/::/, '/').\n\t gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n\t gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n\t tr(\"-\", \"_\").\n\t downcase\n\tend",
"def dasherize(class_name)\n return class_name if class_name !~ /[A-Z:_]/\n c = class_name.to_s.gsub('::', '')\n\n (c[0] + c[1..-1].gsub(/[A-Z]/){ |c| \"-#{c}\" }).\n downcase.\n gsub('_', '-')\n end",
"def underscore\n self.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore(name)\r\n s = name[0].downcase\r\n name[1,name.length].each_char do |ch|\r\n s += (ch.match(/[^A-Z]/) ? ch : \"_\"+ch.downcase)\r\n end\r\n return s\r\n end",
"def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end",
"def name_format\n self.name.gsub!(/[^0-9a-z\\-_ ]/i, '_') unless self.name.nil?\n self.name.gsub!(/\\s+/, '-') unless self.name.nil?\n self.name = self.name.downcase unless self.name.nil?\n end",
"def optionify\n output = self.apachify\n output = \"-#{output[3..-1]}\" if self.to_s[0..3] == 'not_'\n output\n end",
"def optionify\n output = self.apachify\n output = \"-#{output[3..-1]}\" if self.to_s[0..3] == 'not_'\n output\n end",
"def space_replace_hyphen(call_number)\n return unless call_number\n general_normalization(call_number) do |cn|\n # dashes should be followed by spaces e.g. cd-10994\n # ls, cass, dat, cd, vcass, dvd\n cn = cn.sub(\"-\", \" \") if format_prefix?(cn)\n cn\n end\n end",
"def underscore(camel_cased_word)\n return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)\n\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word\n end",
"def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").downcase\n end",
"def ns_hyphenate\n to_s.ns_underscore.hyphenate\n end",
"def underscore(camel_cased_word)\n word = camel_cased_word.to_s.dup\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.tr!(\"[\", \"_\")\n word.tr!(\"]\", \"\")\n word.downcase!\n word\n end",
"def format_name(name)\n name.split(' ').join('_')\n end",
"def format_name(name)\n name.split(' ').join('_')\n end",
"def underscore(camel_cased_word)\n return camel_cased_word unless /[A-Z-]|::/.match?(camel_cased_word)\n\n word = camel_cased_word.to_s.gsub('::', '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/, '\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/, '\\1_\\2')\n word.tr!('-', '_')\n word.downcase!\n word\n end",
"def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/')\n .gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/,'\\1_\\2')\n .tr(\"-\", \"_\")\n .downcase\n end",
"def toLower _args\n \"toLower _args;\" \n end",
"def underscore(camel_cased_word)\n camel_cased_word.to_s.gsub(/(.)([A-Z])/, '\\1_\\2').downcase\n end",
"def underscore\n word = self.dup\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end",
"def to_dashcase\n s = self.dup\n s.gsub!(/\\'/,'') # remove ' from rob's, so we don't get rob-s-blog\n s.gsub!(/\\W+/, ' ') # all non-word chars to spaces\n s.gsub!('_',' ') # we don't like underscores\n s.strip! # ooh la la\n s.downcase! #\n s.gsub!(/\\ +/, '-') # spaces to dashes, preferred separator char everywhere\n s\n end",
"def norm(s)\n s.gsub(/ /, '-').underscore\nend",
"def to_param\n\t\tname.tr(' ', '_') \n\tend",
"def sanitize_attr(attr)\n return attr.gsub(/[^a-zA-Z\\:\\_]/, '-')\n end",
"def underscore(camel_cased_word)\n word = camel_cased_word.to_s.dup\n word.gsub!(/::/, '/')\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end",
"def unhyphenate(string)\n string.to_s.gsub(/(pre|post)xfer/, '\\1-xfer')\nend",
"def sanitize_name(name)\n name.gsub!(' ', '_')\n name.downcase!\n name.gsub!('-', '_')\n name.gsub!('\\'', '_')\n name\n end",
"def underscore_string(str)\n str.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def unmiga_name\n gsub(/_(str|sp|subsp|pv)__/,\"_\\\\1._\").tr('_', ' ')\n end",
"def underscore(str)\n str.gsub(/.*::/,'').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore(s)\n s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def to_underscore(string)\n string.to_s.gsub(/([A-Z][A-Z0-9]?)/) { '_' + $1.downcase }.gsub(/^_|\\s_/, ' ').gsub(/^\\s/, '')\nend",
"def dashify\n strip.gsub(/[ \\/_~]/, '-').squeeze('-')\n end",
"def normalize_name(name)\n return name.to_s if !name.is_a?(String) && !name.is_a?(MatchData)\n name = name.captures.compact.join('-') if name.is_a?(MatchData)\n name.split('-').map { |s| s[/\\A[0-9]\\Z/].nil? ? s : \"0#{s}\" }.join('-').upcase\nrescue\n name.to_s\nend",
"def safe_name\n name.to_s.gsub(/[^a-zA-Z0-9 _\\-:\\.]/, '').gsub(/:/, ' - ').gsub(/ +/, ' ')\n end",
"def underscore(string)\n string.gsub('::', '_')\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n end",
"def underscore(term)\n term\n .to_s\n .gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .downcase\n .to_sym\n end",
"def underscore(camel_cased_word)\n word = camel_cased_word.to_s.dup\n word.gsub!('::', '/')\n word.gsub!(/(?:([A-Za-z\\d])|^)((?=a)b)(?=\\b|[^a-z])/) { \"#{$1}#{$1 && '_'}#{$2.downcase}\" }\n word.gsub!(/([A-Z\\d]+)([A-Z][a-z])/,'\\1_\\2')\n word.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n word.tr!(\"-\", \"_\")\n word.downcase!\n word\n end",
"def CamelCasetoUnderscore(str)\n str.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def to_param\n name.downcase.gsub(' ', '-')\n end",
"def _sanitize_name(name)\n name.to_s.tr_s('^a-zA-Z0-9', '_')\n end",
"def underscore(class_name)\n class_name.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def underscore_vars\r\n self.gsub(/\\b[a-z][a-z]*(?:[A-Z][a-z]*)(?:[A-Z][a-z]*)*\\b/) {|word|\r\n word.underscore\r\n }\r\n end",
"def toUpper _args\n \"toUpper _args;\" \n end",
"def underscore(str)\n str = str.to_s\n str = str[0].downcase + str[1...str.length].gsub(/([A-Z]+)/) { |m| \"_#{m.downcase}\" }\n str.to_sym\n end",
"def _prepareName ( name )\n name.to_s.gsub /[\\W]/, ''\n end",
"def normalize_key(k)\n k.to_s.gsub('-', '_').gsub(INVALID_PATTERN, '').to_sym\n end",
"def under_score(camel_cased_word)\n camel_cased_word.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def clean(name)\n name.gsub(/[^a-zA-Z0-9-]/, '-')\n end",
"def dasherize(str)\n (str.length > 1 ? \"--\" : \"-\") + str\n end",
"def to_underscore(string)\n string.gsub(/(.)([A-Z])/,'\\1_\\2').downcase\nend",
"def underscore(string)\n string.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end",
"def transform_params\n params.transform_keys! { |key| key.tr(\"-\", \"_\") }\n end",
"def spell_out (foo)\n foo.downcase.split(\"\").join(\"-\")\n end",
"def humanize\n self.gsub(/_/, \" \").capitalize\n end",
"def name_to_param(name)\n # convert good words (wrapped in pipes) to dashes\n name.gsub!(/(_?)\\|(\\w+)\\|(_?)/) { \"#{Regexp.last_match[1]}#{Regexp.last_match[2].dasherize}#{Regexp.last_match[3]}\" }\n\n # split words on underscores, wrap in brackets, and convert good words back to underscores\n name = name.split('_').map.with_index do |word, index|\n word = word.gsub(/(?<!new)index/, '').underscore\n if index == 0\n word\n else\n \"[#{word}]\"\n end\n end\n\n # join wrapped words\n name.join\n end",
"def space_after_hyphen(call_number)\n return unless call_number\n general_normalization(call_number) do |cn|\n # dashes should be followed by spaces e.g. cd-10994\n # ls, cass, dat, cd, vcass, dvd\n cn = cn.sub(\"-\", \"- \") if format_prefix?(cn)\n cn\n end\n end",
"def option(option)\n \"--\" << option.to_s.gsub('_', '-')\n end",
"def argument_string(args)\n args.inject([]) do |opts, opt|\n opts << (opt =~ /^-/ ? opt : opt.inspect)\n end.join(' ')\n end",
"def underscorize\n self.gsub(\" \",\"_\")\n end"
] |
[
"0.7434346",
"0.72641337",
"0.71720374",
"0.71720374",
"0.71594393",
"0.7124182",
"0.7042182",
"0.69382614",
"0.690875",
"0.6860738",
"0.685133",
"0.67673415",
"0.6739195",
"0.67330974",
"0.66992426",
"0.6673833",
"0.66623104",
"0.66041684",
"0.66023517",
"0.65758485",
"0.65684193",
"0.65502125",
"0.652498",
"0.64988035",
"0.64963543",
"0.6473817",
"0.6457461",
"0.64567876",
"0.6445926",
"0.6445481",
"0.6441432",
"0.64354324",
"0.64144826",
"0.64028186",
"0.6402169",
"0.64001894",
"0.6377806",
"0.63649386",
"0.63649386",
"0.63596606",
"0.6355464",
"0.63552606",
"0.63493496",
"0.63484037",
"0.6347104",
"0.6345414",
"0.6345121",
"0.6345121",
"0.63433814",
"0.6340039",
"0.6337877",
"0.6327201",
"0.63033164",
"0.62816143",
"0.62816143",
"0.6262626",
"0.6244575",
"0.6231408",
"0.6226246",
"0.6225869",
"0.6217149",
"0.62040216",
"0.6189684",
"0.61862296",
"0.61814034",
"0.61578345",
"0.6156013",
"0.61487895",
"0.61474717",
"0.61472964",
"0.61431736",
"0.61346084",
"0.61261487",
"0.6125976",
"0.61218905",
"0.61196166",
"0.6119161",
"0.6114835",
"0.6086608",
"0.6079144",
"0.6074661",
"0.6073923",
"0.6064265",
"0.60628396",
"0.6038848",
"0.6038648",
"0.6036812",
"0.60338813",
"0.6033594",
"0.6027732",
"0.6022338",
"0.60183465",
"0.60180646",
"0.6016128",
"0.6013199",
"0.59999824",
"0.5989848",
"0.59789526",
"0.5978316",
"0.59769154"
] |
0.6508206
|
23
|
assembles two string arguments into cmd
|
def test_assembles_two_string_arguments_into_cmd
Crd::Flex::Command.new 'mxmlc' do |s|
s.output = 'Main.swf'
s.static_link_runtime_shared_libraries = true
cmd = s.to_cmd.split( /\s+/ )
assert_equal( 'mxmlc', cmd.shift )
assert( cmd.include?( '-output=Main.swf' ), 'Could not find argument in to_cmd' )
assert( cmd.include?( '-static-link-runtime-shared-libraries=true' ), 'Could not find argument in to_cmd' )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run2(*args)\n args.map!(&:to_s)\n command = args.join(' ')\n if include_meta_character?(command)\n run(command)\n else\n run(*args)\n end\n end",
"def command_str_for(*args)\n args.collect{|arg|\n case arg\n when Array\n arg.join(' ')\n when Hash\n arg.collect{|k,v| \"-#{k} #{v}\"}.join(' ')\n else\n arg.to_s\n end\n }.join(' ')\n end",
"def cmd(cmd, *args)\n system(\"#{cmd} #{args.join(' ')}\")\nend",
"def command_shell_string__from call, *args\n \"#{call} #{args.join \" \"}\"\n end",
"def test_assembles_two_array_arguments_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.source_path << 'src'\n s.source_path << 'lib/src'\n s.library_path << 'lib/bin'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-source-path+=src,lib/src' ), 'Could not find argument in to_cmd' )\n assert( cmd.include?( '-library-path+=lib/bin' ), 'Could not find argument in to_cmd' )\n end\n end",
"def commander _args\n \"commander _args;\" \n end",
"def create_commands args\n command = String.new\n args.each do |arg|\n command << arg << \" \" \n end\n command\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def test_assembles_one_string_argument_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.output = 'Main.swf'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-output=Main.swf' ), 'Could not find argument in to_cmd' )\n end\n end",
"def cmd(*args)\n\n cmd_args = []\n\n for arg in args\n\n case arg\n\n when Array\n cmd_literals = arg.shift.split(/\\s+/)\n\n for cmd_literal in cmd_literals\n if cmd_literal == \"?\"\n raise \"Not enough substitution arguments\" unless cmd_args.any?\n cmd_args << arg.shift\n else\n cmd_args << cmd_literal\n end\n end\n\n raise \"More parameters than ?'s in cmd string\" if arg.any?\n\n when String\n cmd_args << arg\n\n else\n cmd_args << arg.to_s\n\n end\n\n end\n\n p [:cmd_args, cmd_args] if $DEBUG\n\n system(*cmd_args)\nend",
"def cmd(options={})\n arguments\n end",
"def cmd(*args)\n command = Shellwords.join(args)\n out = `#{command}`.strip\n fail!(puts \"command failed: #{command}\", $?.exitstatus) unless $?.success?\n out\nend",
"def test(cmd, file1, file2=\"foo\") end",
"def binocular _args\n \"binocular _args;\" \n end",
"def split_arguments!(arguments)\n \n if arguments.any? { |arg| arg.strip == 'of' }\n command = arguments.delete('of')\n elsif arguments.any? { |arg| arg.strip == 'convert' }\n command = arguments.delete('convert')\n end\n \n command\nend",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def myshelljoin argv\n argv.map{|x| x.index(' ') ? \"\\\"#{x}\\\"\" : x }.join(' ')\n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def shell_commands(cmd, *args); end",
"def cmd_concat_operator\n\t\t\" & \"\n\tend",
"def cmd(*args) self.class.cmd(*args) end",
"def shell_commands(cmd, args); end",
"def command(binary, action, service, param = nil, sub_param = nil)\n [\n prepare_parameter(binary),\n action, # simple keyword does not need transformation\n prepare_parameter(service),\n prepare_parameter(param),\n prepare_parameter(sub_param, false) # last param does no need quoting\n ].reject(&:empty?).join ' '\n end",
"def to_s\n cmd = ''\n @arr.each do |arg|\n if arg == @arr.first\n cmd << arg\n elsif arg.is_a?(Array)\n param, value = arg.first.to_s, arg.last.to_s\n\n if param =~ /^\\-{1,2}(.*)/\n param = $1\n end\n\n if param.length == 1\n cmd << ' ' << \"-#{param} #{Escape.shell_single_word(value)}\"\n else\n cmd << ' ' << \"--#{param}=#{Escape.shell_single_word(value)}\"\n end\n elsif arg.is_a?(Symbol)\n arg = arg.to_s\n if arg.length == 1\n cmd << ' ' << \"-#{arg}\"\n else\n cmd << ' ' << \"--#{arg}\"\n end\n elsif arg.is_a?(String) && arg.strip =~ /^\\-/\n cmd << ' ' << arg\n else\n cmd << ' ' << Escape.shell_single_word(arg.to_s)\n end\n end\n cmd\n end",
"def mate *args\n flattened_args = args.map {|arg| \"\\\"#{arg.to_s}\\\"\"}.join ' '\n `mate #{flattened_args}`\n nil\nend",
"def test_multi_stringflag_as_strings\n opts = @p.parse %w(--xyz dog --xyz cat)\n assert_equal true, opts[:xyz_given]\n assert_equal [\"dog\",\"cat\"], opts[:xyz]\n assert_equal [], opts[:abc] # note, multi-args default to empty array\n assert_nil opts[:ghi_given]\n assert_equal [\"gg\",\"hh\"], opts[:ghi]\n end",
"def run_command(*args)\n %x(#{args.join(\" \")})\n rescue IOError, SystemCallError\n nil\n end",
"def build_command(cmd)\n cmd\n end",
"def cmdline\n if @cmdline.nil?\n cmdline = \"#{@cmd}\"\n @args.each do |arg|\n cmdline << (arg.to_s.index(\" \") ? \" \\\"#{arg}\\\"\" : \" #{arg}\")\n end if @args\n @cmdline = cmdline\n end\n @cmdline\n end",
"def normalize_args(string, options_hash); end",
"def test_to_cmd_is_formatted_appropriately\n cmd = @cmd.to_cmd\n assert_match( /^asdoc\\s/, cmd )\n assert( cmd.include?( '-output=build/docs' ), 'Could not find output argument in to_cmd' )\n assert( cmd.include?( '-source-path+=test/fixtures/target,libs/src' ), 'Could not find source-path argument in to_cmd' )\n assert( cmd.include?( '-library-path+=libs/bin' ), 'Could not find library-path argument in to_cmd' )\n assert( cmd.include?( '-doc-sources=test/fixtures/target' ), 'Could not find doc-sources argument in to_cmd' )\n assert( cmd.include?( '-main-title=\"Testing API Documentation\"' ), 'Could not find main-title argument in to_cmd' )\n assert( cmd.include?( '-window-title=\"Testing API Documentation\"' ), 'Could not find window-title argument in to_cmd' )\n end",
"def union(arg1, *arg2)\n first = arg1\n rest = []\n arg2.each do |char|\n char.each do |subchar|\n rest << subchar\n end\n end\n return first + rest\n \nend",
"def command_raw(args)\n\n end",
"def commands\n args.commands.map do |cmd|\n if cmd.respond_to?(:join)\n cmd.map { |c| c.index(' ') ? \"'#{c}'\" : c }.join(' ')\n else\n cmd.to_s\n end\n end\n end",
"def expand_command(command)\n if match = /^\"(.+?)\"(?:\\s+(.*))?/.match(command)\n exe, arguments = match.captures\n exe = which(exe) and [ \"\\\"#{exe}\\\"\", arguments ].compact.join(\" \")\n elsif match = /^'(.+?)'(?:\\s+(.*))?/.match(command) and not Facter::Util::Config.is_windows?\n exe, arguments = match.captures\n exe = which(exe) and [ \"'#{exe}'\", arguments ].compact.join(\" \")\n else\n exe, arguments = command.split(/ /,2)\n if exe = which(exe)\n # the binary was not quoted which means it contains no spaces. But the\n # full path to the binary may do so.\n exe = \"\\\"#{exe}\\\"\" if exe =~ /\\s/ and Facter::Util::Config.is_windows?\n exe = \"'#{exe}'\" if exe =~ /\\s/ and not Facter::Util::Config.is_windows?\n [ exe, arguments ].compact.join(\" \")\n end\n end\n end",
"def to_cmd_ary(opts={arguments:[],separator:\"=\"})\n # [program, sub_program, normalize_params(opts[:separator]), opts[:arguments]].flatten.compact\n [program, sub_program, normalize_params(opts[:separator]), opts[:arguments].map{|a| a.split}].flatten.compact\n end",
"def test_arg_check_2string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy']))\n end",
"def run(cmd)\n TV.new [\"--test\", cmd.split].flatten\nend",
"def puts_two(*arg)\n\targ1, arg2 = argumentsputs \"arg1: #{arg1}, arg2: #{arg2}\"\n\tputs \"arg1: #{arg1}, arg2:#{arge2}\"\nend",
"def command\n args = options[:args].join(' ')\n\n return \"python -E #{kernel} #{args} #{conversion}\"\n end",
"def get_command_from_args(args)\n raise 'A command is required' if args.empty?\n {\n :filename => 'todo_list_data.txt',\n :command => args[0],\n :modifier => args[1]\n }\n end",
"def combine_args(provides, version, arch)\n provides = provides.to_s.strip\n version = if !version.nil? && !version.empty?\n version.to_s.strip\n end\n arch = if !arch.nil? && !arch.empty?\n arch.to_s.strip\n end\n if version =~ /^[><=]/\n if arch\n return { \"provides\" => \"#{provides}.#{arch} #{version}\" }\n else\n return { \"provides\" => \"#{provides} #{version}\" }\n end\n end\n maybe_arch = provides.rpartition(\".\").last\n if is_arch?(maybe_arch)\n arch = maybe_arch\n provides.delete_suffix!(\".#{arch}\")\n end\n provides = \"#{provides}-#{version}\" if version\n provides = \"#{provides}.#{arch}\" if arch\n # yum (on rhel7) can't handle an epoch in provides, but\n # deconstructing the args can't handle dealing with globs\n if provides =~ /-\\d+:/ && provides !~ /[\\*\\?]/\n deconstruct_args(provides)\n else\n { \"provides\" => provides }\n end\n end",
"def test_merge\n \tassert_equal(UI.parseCommand('merge', MergeCmd1*\" \"),UI.main(MergeCmd1))\n \tassert_equal(UI.parseCommand('merge', MergeCmdInv*\" \"),UI.main(MergeCmdInv))\n end",
"def effectiveCommander _args\n \"effectiveCommander _args;\" \n end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def run(command, *args)\n sh \"#{command} #{args.join(' ')}\"\nend",
"def system(cmd, *rest) end",
"def command\n\n cmd = \"\"\n\n xval = @options['xrange']\n cmd << \" #{xval}\" if( xval )\n \n yval = @options['yrange']\n cmd << \" #{yval}\" if( yval and xval )\n\n cmd << \" #{@basecommand}\"\n\n cmd << \" using #{@options['using']}\" if( @options['using'] )\n\n tstr = @options[\"title\"]\n cmd += if( !tstr ) then ''\n\t elsif( tstr == 'notitle' ) then 'notitle'\n\t else \" title '#{tstr}'\"\n\t end\n\n cmd << \" with #{@options['with']}\" if( @options[\"with\"] )\n\n cmd\n end",
"def test_assembles_one_array_argument_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.source_path << 'src'\n s.source_path << 'lib/src'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-source-path+=src,lib/src' ), 'Could not find argument in to_cmd' )\n end\n end",
"def command_arguments(options={})\n args = []\n args.concat(['--type', options[:type].to_s]) if options[:type]\n args.concat(['--line-break', options[:line_break].to_s]) if options[:line_break]\n args.concat(['--charset', options[:charset].to_s]) if options[:charset]\n\n if options[:type].to_s == 'js'\n args << '--nomunge' unless options[:munge]\n args << '--preserve-semi' if options[:preserve_semicolons]\n args << '--disable-optimizations' unless options[:optimize]\n end\n\n args\n end",
"def cmd\n c = ['git commit']\n c << '-a' if all?\n c << %(-m \"#{options.message}\") if message?\n c << %(-m \"#{message}\") unless story_ids.empty?\n c << argument_string(unknown_options) unless unknown_options.empty?\n c.join(' ')\n end",
"def mk_cmd(env, cmd, options)\n [env, cmd.shellsplit, options].flatten\n end",
"def prep_args(*args)\n args = args.flatten.compact\n args = args.first.to_s.split(/\\s+/) if args.size == 1\n cmd = sudo? ? :sudo : args.shift\n \n # Symbols to switches. :l -> -l, :help -> --help\n args.collect! do |a|\n if a.is_a?(Symbol)\n a = (a.to_s.size == 1) ? \"-#{a}\" : a.to_s\n end\n a\n end\n [cmd, args]\n end",
"def cmdline(command, options = {})\n command = [command].flatten\n cmdline = [where]\n cmdline += @options.merge(options).map { |k, v| !v ? nil : \"#{option(k)} #{v == true ? '' : v.to_s}\".rstrip }.compact\n cmdline << option(command.shift)\n cmdline += command\n cmdline.flatten.join(' ').strip\n end",
"def doCmd(cmd)\n puts cmd;\n puts `#{cmd}`;\nend",
"def argument_string(args)\n args.to_a.map { |v| v.join '=' }.join('&')\n end",
"def exec(args)\n cmd = if args.kind_of?(Array)\n Shellwords.join(args)\n else\n args\n end\n\n exec_command(cmd)\n end",
"def call(*command); end",
"def command\n if args.skip?\n ''\n else\n commands.join('; ')\n end\n end",
"def command\n ([executable] + options_composition + @redirections).join(\" \")\n end",
"def command_name=(_arg0); end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def command_start=(_arg0); end",
"def parts_to_commands(parts, opts)\n parts.map do |p|\n cmd = ''\n cmd << @cmd_start\n if opts[:enc_format] == 'hex_double_quoted'\n cmd << %Q{\"#{p}\"}\n elsif opts[:enc_format] == 'hex_single_quoted'\n cmd << %Q{'#{p}'}\n else\n cmd << p\n end\n cmd << @cmd_end\n cmd\n end\n end",
"def command_parse(argv)\n end",
"def argument_string(args)\n args.inject([]) do |opts, opt|\n opts << (opt =~ /^-/ ? opt : opt.inspect)\n end.join(' ') \n end",
"def cmd(extra_args)\n `#{@ledger} -f #{@filename} #{extra_args}`\n end",
"def initialize_cmd_args(args, new_name_args)\n args = args.dup\n args.shift(2 + @name_args.length) \n cmd_args = new_name_args + args\n end",
"def systemChat _args\n \"systemChat _args;\" \n end",
"def SpawnArguments(*args)\n # the env vars hash is either the first argument, or empty\n env = if args.first.is_a?(Hash)\n args.shift\n else\n {}\n end\n\n # the options hash is either the last argument, or empty\n options = if args.last.is_a?(Hash)\n args.pop\n else\n {}\n end\n\n raise(ArgumentError, \"You must provide a command to run.\") if args.empty?\n\n command = args.shift\n\n raise(\n ArgumentError,\n \"Unable to recognize first command component. Expected String or Array, got #{args.first.class}.\"\n ) unless command.is_a?(String) || command.is_a?(Array)\n\n raise(\n ArgumentError,\n \"Each command component after the first must be strings.\"\n ) unless args.all? { |arg| arg.is_a?(String) }\n\n if args.empty?\n if command.is_a?(String) # single commandline string\n [env, command, options]\n elsif command.is_a?(Array)\n [env, [command], options] # [command, argv0] pair with no other command arguments\n end\n else\n # this covers\n # a command with multiple string arguments\n # and\n # a [command, argv0] pair with multiple string arguments\n [env, [command, *args], options]\n end\nend",
"def generate_args\n stdin = []\n cmd = ['tpm_takeownership']\n owner_pass = resource[:owner_pass]\n srk_pass = resource[:srk_pass]\n\n if owner_pass != 'well-known'\n stdin << [ /owner password/i, owner_pass ]\n stdin << [ /Confirm password/i, owner_pass ]\n else\n cmd << '-y'\n end\n\n if srk_pass != 'well-known'\n stdin << [ /SRK password/i, srk_pass ]\n stdin << [ /Confirm password/i, srk_pass ]\n else\n cmd << '-z'\n end\n return stdin, cmd.join(' ')\n end",
"def two_strings(man, woman)\n p \"When \" + man + \" Met \" + woman\nend",
"def args(argv)\n Docopt.docopt(docopt, version: @version, argv:argv)\n end",
"def cmd(*cmd_args)\n\t\tsetup_opts = {}\n\t\tbegin\n\t\t\t@arguments.parser(*cmd_args) do |opt,idx,val|\n\t\t\t\tif opt == '-h'\n\t\t\t\t\t@arguments.usage\n\t\t\t\t\tKernel.exit(1)\n\t\t\t\tend\n\t\t\t\t@packet.each_header do |type|\n\t\t\t\t\ttype << \"_case\"\n\t\t\t\t\tsetup_opts.merge!(Parser::Case.new.send(type.to_sym,opt,val))\n\t\t\t\tend\n\t\t\tend\n\t\trescue\n\t\t\t@arguments.usage\n\t\t\tKernel.exit(1)\n\t\tend\n\t\tself.setup(setup_opts)\n\tend",
"def make_command(action, args = [])\n command = @commands[action.to_sym]\n command += \" '\" + args.join(' ') + \"'\" unless args.empty?\n\n command\n end",
"def commandGetOut _args\n \"commandGetOut _args;\" \n end",
"def command_for(name, *args)\n command_str_for(*(COMMANDS[name] + args))\n end",
"def get_cmdline_str(args)\n # Build commandline string, with quotes around arguments with special\n # characters in them (i.e., characters interpreted by shell)\n args_str = \"\"\n quote = '\"'\n args.each do |arg|\n if not arg.kind_of?(String)\n raise RuntimeError, \"Argument not string: '#{arg}' (#{arg.class})\"\n end\n\n if arg.nil?\n next\n end\n # Quote whitespace and '\\'\n if not /[\\s\\\\]/.match(arg).nil?\n arg = \"#{quote}#{arg}#{quote}\"\n end\n args_str += \"#{arg} \"\n end\n args_str.strip!()\n\n return args_str\n end",
"def command(name,aliases,desc,long_desc,arg_name,arg_options)\n @io.puts \"#{@nest}=== Command: <tt>#{([name] + aliases).join('|')} #{@arg_name_formatter.format(arg_name,arg_options,[])}</tt>\"\n @io.puts String(desc).strip\n @io.puts \n @io.puts String(long_desc).strip\n @nest = \"#{@nest}=\"\n end",
"def exec(cmd, *rest) end",
"def argument_string(args)\n args.inject([]) do |opts, opt|\n opts << (opt =~ /^-/ ? opt : opt.inspect)\n end.join(' ')\n end",
"def text_from_args\n\t\t\treturn ARGV.join(' ').gsub(\"\\t\",'')\n\t\tend",
"def to_s\n require \"shellwords\"\n\n escaped_args = @args.map do |arg|\n escaped = Shellwords.escape(arg)\n next escaped if escaped == arg\n next escaped if arg.include?(\"'\")\n \"'#{arg}'\"\n end\n escaped_args.join(\" \")\n end",
"def test_options_parser\n input_short = '-oC:\\test -v -c pass'.split(\" \")\n input_long = '--output-path=C:\\test --verbose --copy-only pass'.split(\" \")\n\n [input_short, input_long].each do |input|\n options = parse_args(input)\n\n assert_equal('C:\\test', options[:output_folder])\n assert_true(options[:verbose])\n assert_true(options[:copy_only])\n assert_equal(['pass'], input)\n end\n end",
"def print_two(*args)\n\t# First indented line is one that unpacks the arguments the \n\t# same as with your scripts.\n\targ1, arg2 = args\n\t# To demonstrate how it works we print these arguments out, \n\t# just like we would in a script.\n\tputs \"arg1: #{arg1}, arg2: #{arg2}\"\nend",
"def parse(line)\n cmd, arg_string = line.downcase.split(' ')\n [cmd, *arg_string.to_s.split(',')]\n end",
"def one_away(str1, str2)\n\nend",
"def preprocess_arguments_for_commands(args)\n # All arguments should be passed through to the atlantis command.\n if args.first == \"atlantis\"\n return args.slice!(1..-1)\n end\n if args.first == \"ssh\"\n arg_index = 1\n arg_index += 1 if Component.names.include?(args[1]) # Skip <component>, if it exists\n while arg_index < args.length\n break if args[arg_index][0] != \"-\"\n arg_index += 1 if args[arg_index] == \"-i\"\n arg_index += 1\n end\n return [] unless arg_index < args.length\n puts \"slicing #{arg_index.inspect}\"\n return args.slice!(arg_index..-1)\n end\n []\nend",
"def join(delimiter); @args.join(delimiter) end",
"def initialize(*args)\n args.flatten!\n @first, @last = args.shift, args.pop\n @middle = args.join(' ') if args.any?\n super(to_s)\n end",
"def process_argv!\n super\n if raw_script_name =~ /(\\w+)-([\\w\\-]+)/\n self.command = $2\n else\n self.command = rest.shift\n end\n end",
"def process_commandline_args\n\n params = { :sidelength => 1, :mult => 10, :stroke_width => 1,\n :cols => 3, :rows => 3,\n :nested => 1, :nested_spacing => 0.2,\n :suppress_grid => false,\n :moveto_color => '#0000ff', :lineto_color => '#ff0000',\n :xshift => 0, :yshift => 0, :gcode => false, :do_tform => false\n }\n\n ARGV.each { |a|\n if v = a.match(/^--side-length=([0-9.]+)$/) then params[:sidelength] = v[1].to_f\n elsif v = a.match(/^--cols=([0-9]+)$/) then params[:cols] = v[1].to_i\n elsif v = a.match(/^--rows=([0-9]+)$/) then params[:rows] = v[1].to_i\n elsif v = a.match(/^--nested=([0-9]+)$/) then params[:nested] = v[1].to_i\n elsif v = a.match(/^--nested-spacing=(0?\\.[0-9]+)$/) then params[:nested_spacing] = v[1].to_f\n elsif v = a.match(/^--suppress-grid(=([01]))?$/) then params[:suppress_grid] = (v[1].nil? || v[2] == \"1\")\n elsif v = a.match(/^--mult=([.0-9e]+)$/) then params[:mult] = v[1].to_f\n elsif v = a.match(/^--stroke-width=([.0-9]+)$/) then params[:stroke_width] = v[1].to_f\n elsif v = a.match(/^--moveto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:moveto_color] = v[1]\n elsif v = a.match(/^--lineto-color=(none|#(\\h{3}|\\h{6}))$/)\n then params[:lineto_color] = v[1]\n elsif v = a.match(/^--xshift=([-.0-9]+)$/) then params[:xshift] = v[1].to_f\n elsif v = a.match(/^--yshift=([-.0-9]+)$/) then params[:yshift] = v[1].to_f\n elsif v = a.match(/^--gcode$/) then params[:gcode] = true\n elsif v = a.match(/^--apply-maths$/) then params[:do_tform] = true\n else abort \"\\nArborting!!! -- Error: unknown argument #{a}\\n\\n\"\n end\n }\n\n params\nend",
"def parse(args)\n rest = args.clone\n rest.delete_at(0)\n return args[0], rest\n end",
"def ASLtoATL _args\n \"ASLtoATL _args;\" \n end"
] |
[
"0.6640243",
"0.6495583",
"0.63996524",
"0.6379334",
"0.63629115",
"0.63383967",
"0.622787",
"0.6225234",
"0.6225234",
"0.6205089",
"0.6166615",
"0.61398673",
"0.61373705",
"0.6002811",
"0.5957732",
"0.5872808",
"0.5845634",
"0.58316904",
"0.5812553",
"0.5812553",
"0.5812553",
"0.5801443",
"0.5799153",
"0.57969475",
"0.5789267",
"0.5777131",
"0.5756525",
"0.57369924",
"0.5722001",
"0.5691414",
"0.5652312",
"0.56514716",
"0.5645258",
"0.563379",
"0.55880296",
"0.552981",
"0.55253696",
"0.5523798",
"0.55169255",
"0.55031586",
"0.5494409",
"0.54937166",
"0.5486753",
"0.5484198",
"0.54838574",
"0.5478004",
"0.54664713",
"0.54626167",
"0.54626167",
"0.54626167",
"0.5460668",
"0.5452508",
"0.54467946",
"0.544464",
"0.54129404",
"0.5412557",
"0.5408953",
"0.53998286",
"0.53930855",
"0.53851503",
"0.53821087",
"0.5375325",
"0.5373862",
"0.5372219",
"0.5367994",
"0.53673995",
"0.5358739",
"0.5358739",
"0.5358739",
"0.5349077",
"0.5348727",
"0.5344352",
"0.5343454",
"0.53424305",
"0.5339806",
"0.53354996",
"0.5328848",
"0.5324387",
"0.53122026",
"0.53088415",
"0.53008825",
"0.5290419",
"0.5288232",
"0.52873635",
"0.5286672",
"0.52827424",
"0.52818364",
"0.52775437",
"0.5276621",
"0.5275184",
"0.5273595",
"0.526797",
"0.52629364",
"0.52627474",
"0.5238714",
"0.5235612",
"0.52252483",
"0.5222944",
"0.52161676",
"0.5215826"
] |
0.67715317
|
0
|
assembles one array argument into cmd
|
def test_assembles_one_array_argument_into_cmd
Crd::Flex::Command.new 'mxmlc' do |s|
s.source_path << 'src'
s.source_path << 'lib/src'
cmd = s.to_cmd.split( /\s+/ )
assert_equal( 'mxmlc', cmd.shift )
assert( cmd.include?( '-source-path+=src,lib/src' ), 'Could not find argument in to_cmd' )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n cmd = ''\n @arr.each do |arg|\n if arg == @arr.first\n cmd << arg\n elsif arg.is_a?(Array)\n param, value = arg.first.to_s, arg.last.to_s\n\n if param =~ /^\\-{1,2}(.*)/\n param = $1\n end\n\n if param.length == 1\n cmd << ' ' << \"-#{param} #{Escape.shell_single_word(value)}\"\n else\n cmd << ' ' << \"--#{param}=#{Escape.shell_single_word(value)}\"\n end\n elsif arg.is_a?(Symbol)\n arg = arg.to_s\n if arg.length == 1\n cmd << ' ' << \"-#{arg}\"\n else\n cmd << ' ' << \"--#{arg}\"\n end\n elsif arg.is_a?(String) && arg.strip =~ /^\\-/\n cmd << ' ' << arg\n else\n cmd << ' ' << Escape.shell_single_word(arg.to_s)\n end\n end\n cmd\n end",
"def to_cmd_ary(opts={arguments:[],separator:\"=\"})\n # [program, sub_program, normalize_params(opts[:separator]), opts[:arguments]].flatten.compact\n [program, sub_program, normalize_params(opts[:separator]), opts[:arguments].map{|a| a.split}].flatten.compact\n end",
"def test_assembles_two_array_arguments_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.source_path << 'src'\n s.source_path << 'lib/src'\n s.library_path << 'lib/bin'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-source-path+=src,lib/src' ), 'Could not find argument in to_cmd' )\n assert( cmd.include?( '-library-path+=lib/bin' ), 'Could not find argument in to_cmd' )\n end\n end",
"def args_to_string(array)\n\tarray.map {|x| x.class == Array && x.size > 1 ? x[0].size > 1 ? '--' + x.join(' ') : '-' + x.join(' ') : x }.join(' ')\nend",
"def cmd(*args)\n\n cmd_args = []\n\n for arg in args\n\n case arg\n\n when Array\n cmd_literals = arg.shift.split(/\\s+/)\n\n for cmd_literal in cmd_literals\n if cmd_literal == \"?\"\n raise \"Not enough substitution arguments\" unless cmd_args.any?\n cmd_args << arg.shift\n else\n cmd_args << cmd_literal\n end\n end\n\n raise \"More parameters than ?'s in cmd string\" if arg.any?\n\n when String\n cmd_args << arg\n\n else\n cmd_args << arg.to_s\n\n end\n\n end\n\n p [:cmd_args, cmd_args] if $DEBUG\n\n system(*cmd_args)\nend",
"def full_command\n command_array.join(' ')\n end",
"def command_line_arguments(array)\n array.size.times do\n if array.include?('-nc')\n colour_changer(:white)\n array.delete('-nc')\n elsif array.any? { |x| ['-d1', '-d2', '-d3', '-d4'].include? x }\n key = (array[0])[1, 2].to_sym\n @difficulty = DIFFICULTY[key]\n @promptarr = prompt_select(key)\n @intro = false\n end\n end\n end",
"def cmd(options={})\n arguments\n end",
"def command_str_for(*args)\n args.collect{|arg|\n case arg\n when Array\n arg.join(' ')\n when Hash\n arg.collect{|k,v| \"-#{k} #{v}\"}.join(' ')\n else\n arg.to_s\n end\n }.join(' ')\n end",
"def create_commands args\n command = String.new\n args.each do |arg|\n command << arg << \" \" \n end\n command\n end",
"def mk_cmd(env, cmd, options)\n [env, cmd.shellsplit, options].flatten\n end",
"def commander _args\n \"commander _args;\" \n end",
"def getArray _args\n \"getArray _args;\" \n end",
"def cmd_with_targets(cmd_array, target, extras)\n final_arr = cmd_array\n final_arr.concat(['-target', target]) unless target.nil?\n # rubocop:disable Style/SafeNavigation\n extras.each { |e| final_arr.concat(['-target', e]) } unless extras.nil?\n # rubocop:enable Style/SafeNavigation\n final_arr.join(' ')\n end",
"def command_shell_string__from call, *args\n \"#{call} #{args.join \" \"}\"\n end",
"def binocular _args\n \"binocular _args;\" \n end",
"def rake_array_arg(arg, delim = \" \")\n return arg.split(delim) if arg.is_a? String\n return arg\nend",
"def run(cmd)\n TV.new [\"--test\", cmd.split].flatten\nend",
"def make_command_line_unix(ary)\n ary.collect { |str| escape_shell_unix(str) }.join(\" \")\n end",
"def cmd_to_run\n\tarr = ARGV.dup\n\tarr = default_cmd if arr.empty?\n\tarr\nend",
"def call(*command); end",
"def call(*args)\n if args.first.is_a?(Array) && args.size == 1\n command = args.first\n else\n command = args\n end\n\n @commands << command\n nil\n end",
"def array_to_bash array\n quoted_array = array.map {|item| \"'\" + item + \"'\"}\n \"(\" + quoted_array.join(\" \") + \")\"\n end",
"def cmd(cmd, *args)\n system(\"#{cmd} #{args.join(' ')}\")\nend",
"def command_raw(args)\n\n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def parse(command)\n case command.class.name.downcase.to_sym #Array => :array\n when :array\n command.compact.join(' && ')\n when :string\n command.chomp\n else\n raise Trooper::MalformedCommandError, \"Command Not a String or Array: #{command.inspect}\"\n end\n end",
"def to_exec(args = self)\n Array(@executable) + args\n end",
"def arrayize_arguments(args)\n # Go through trailing arguments and suck them in if they don't seem\n # to have an owner.\n array = []\n until args.empty? || args.first.match(/^-/)\n array << args.shift\n end\n array\n end",
"def commands\n args.commands.map do |cmd|\n if cmd.respond_to?(:join)\n cmd.map { |c| c.index(' ') ? \"'#{c}'\" : c }.join(' ')\n else\n cmd.to_s\n end\n end\n end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def command(binary, action, service, param = nil, sub_param = nil)\n [\n prepare_parameter(binary),\n action, # simple keyword does not need transformation\n prepare_parameter(service),\n prepare_parameter(param),\n prepare_parameter(sub_param, false) # last param does no need quoting\n ].reject(&:empty?).join ' '\n end",
"def to_s\n @argv.join(' ')\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def build_command(cmd)\n cmd\n end",
"def cmd(*args) self.class.cmd(*args) end",
"def argSetTextual; @argSet.map { |a| a.to_s }.sort.join(':') end",
"def preprocess_arguments_for_commands(args)\n # All arguments should be passed through to the atlantis command.\n if args.first == \"atlantis\"\n return args.slice!(1..-1)\n end\n if args.first == \"ssh\"\n arg_index = 1\n arg_index += 1 if Component.names.include?(args[1]) # Skip <component>, if it exists\n while arg_index < args.length\n break if args[arg_index][0] != \"-\"\n arg_index += 1 if args[arg_index] == \"-i\"\n arg_index += 1\n end\n return [] unless arg_index < args.length\n puts \"slicing #{arg_index.inspect}\"\n return args.slice!(arg_index..-1)\n end\n []\nend",
"def test_assembles_one_string_argument_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.output = 'Main.swf'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-output=Main.swf' ), 'Could not find argument in to_cmd' )\n end\n end",
"def shell_commands(cmd, *args); end",
"def resolve_command_args(command_args)\n return command_args.first if command_args.is_a?(Array) && command_args.first.is_a?(Array)\n\n command_args\n end",
"def syntax\n t = @cmd_args\n t = [[t]] if !t.is_a? Array\n\n args = [] \n count = 0\n t.each do |expected_array|\n count += 1\n if count == 1\n str = \"Syntax: #{@cmd_name}\"\n else\n str = \" #{@cmd_name}\"\n end\n expected_array.each do |expected|\n # each expected arg.\n str += case expected\n when :arg_none then \"\"\n when :arg_dir! then \" <direction>\"\n when :arg_str! then \" <string literal>\"\n when :arg_word!then \" <word>\"\n when :arg_int! then \" <#>\"\n when :arg_obj_inv! then \" <item>\"\n when :arg_obj_room! then \" <item>\"\n when :arg_obj_inv_or_room! then \" <item>\"\n when :arg_class! then \" <Class>\"\n when :arg_player_in_game! then \" <player in game>\"\n when :arg_player_offline! then \" <any player>\"\n when :arg_actor_room! then \" <npc/player>\"\n when String then \" \" + expected \n else \"\"\n \n end\n end \n args << str\n end\n return args\n end",
"def lnbAddArray _args\n \"lnbAddArray _args;\" \n end",
"def make_command_line_windows(ary)\n ary.collect { |str| escape_shell_windows(str) }.join(\" \")\n end",
"def split_args(ary)\n\tfiles = []\n\topts = []\n\tc = false\n\tary.each do |i|\n\t\tnext if i == '-'\n\t\tif i == '--' then\n\t\t\tc = true\n\t\t\tnext\n\t\tend\n\t\tfiles << i if c or not (i =~ /^-/)\n\t\topts << i if (not c) and (i =~ /^-/)\n\tend\n\t[files, opts]\nend",
"def run_command(*args)\n %x(#{args.join(\" \")})\n rescue IOError, SystemCallError\n nil\n end",
"def command_arguments(options={})\n args = []\n args.concat(['--type', options[:type].to_s]) if options[:type]\n args.concat(['--line-break', options[:line_break].to_s]) if options[:line_break]\n args.concat(['--charset', options[:charset].to_s]) if options[:charset]\n\n if options[:type].to_s == 'js'\n args << '--nomunge' unless options[:munge]\n args << '--preserve-semi' if options[:preserve_semicolons]\n args << '--disable-optimizations' unless options[:optimize]\n end\n\n args\n end",
"def shell_commands(cmd, args); end",
"def camCommand _obj, _args\n \"_obj camCommand _args;\" \n end",
"def resolve_command_args(command_args)\n return command_args.first if command_args.is_a?(Array) && command_args.first.is_a?(Array)\n\n command_args\n end",
"def to_argv\n flags = []\n each do |f,v|\n m = f.to_s.size == 1 ? '-' : '--'\n case v\n when Array\n v.each{ |e| flags << \"#{m}#{f}='#{e}'\" }\n when true\n flags << \"#{m}#{f}\"\n when false, nil\n # nothing\n else\n flags << \"#{m}#{f}='#{v}'\"\n end\n end\n flags\n end",
"def test_does_not_print_argument_for_empty_array\n Crd::Flex::Command.new 'echo' do |s|\n s.library_path = [ ]\n assert_equal( [ ], s.library_path )\n assert_no_match( /-library-path/, s.to_cmd )\n end\n end",
"def mediatec ( cmd )\n # On execute la commande indiquee et on retourne un Array des lignes\n # obtenues.\n %x{bundle exec bin/mediatec #{cmd}}.split(\"\\n\")\nend",
"def initialize(*argv)\n\t\tif argv.length == 1 && argv[0].class == String\n\t\t\t@array = argv[0].unpack('C*')\n\t\telse\n\t\t\t@array = Array.new(*argv)\n\t\tend\n\tend",
"def single_select title, array\n str = %x[ echo \"#{array.join(\"\\n\")}\" | fzf --reverse --prompt=\"#{title} >\" -1 -0 ]\n return str\nend",
"def to_shellwords\n argv = []\n argv << %[--autopath] if autopath?\n argv << %[--verbose] if verbose?\n argv << %[--format=\"#{format}\"] if format\n argv << %[--chdir=\"#{chdir}\"] if chdir\n argv << %[--tags=\"#{tags.join(';')}\"] unless tags.empty?\n argv << %[--match=\"#{match.join(';')}\"] unless match.empty?\n argv << %[--units=\"#{units.join(';')}\"] unless units.empty?\n argv << %[--loadpath=\"#{loadpath.join(';')}\"] unless loadpath.empty?\n argv << %[--requires=\"#{requires.join(';')}\"] unless requires.empty?\n argv << files.join(' ') unless files.empty?\n argv\n end",
"def command *args, &block\n @commands ||= []\n @args ||= []\n @commands << block\n @args << args\n end",
"def argv; argline.split(/ +/) unless argline.nil?; end",
"def effectiveCommander _args\n \"effectiveCommander _args;\" \n end",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def shell_command(command)\n command.map {|word| shell_single_word(word) }.join(' ')\n end",
"def array2command(dirname, name, data, duration=1)\n\tFile.open(dirname + \"/\" + name + \"_lb.h\", 'w') do |file| \n\t\tsum = 0\n\t\tdata_cum = data.collect do |v, d|\n\t\t\tsum += d \n\t\t\t[v, sum]\n\t\tend\n\t\t\t\n\t\t# GENERATE ARDUINO CPP HEADER FILE\n\t\t\t# last = data.pop\n\t\t\theader(name, file);\n\n\t\t\tfile.write \"\\tLogger *#{name.underscore};\\n\"\n\t\t\tfile.write \"\\tvoid getLog(){\\n\"\n\t\t\tfile.write \"\\t\\t #{name.underscore} = new Logger(#{\"%3.0f\" % data_cum.length}, 0, 255);\\n\"\n\n\t\t\tdata_cum.each do |v, d|\n\t\t\t\tfile.write \"\\t\\t#{name.underscore}->log(#{\"%3.0f\" % v}, #{\"%3.0f\" % d});\\n\"\n\t\t\tend\n\t\t\tfile.write \"\\t}\\n\"\n\t\t\tfooter(name, file);\n\t\t# END HEADER FILE\n\tend\nend",
"def commandGetOut _args\n \"commandGetOut _args;\" \n end",
"def command(*values)\n if values.empty?\n @properties.fetch(:command) { [] }\n else\n @properties[:command] = []\n values.each { |val| @properties[:command] << val }\n end\n end",
"def command\n args = options[:args].join(' ')\n\n return \"python -E #{kernel} #{args} #{conversion}\"\n end",
"def test_assembles_two_string_arguments_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.output = 'Main.swf'\n s.static_link_runtime_shared_libraries = true\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-output=Main.swf' ), 'Could not find argument in to_cmd' )\n assert( cmd.include?( '-static-link-runtime-shared-libraries=true' ), 'Could not find argument in to_cmd' )\n end\n end",
"def add_args_to_command(cmd, data, has_args, has_info, version)\n if has_info then\n cmd.buffers||= []\n cmd.pid||= false\n cmd.ininterfaces||= []\n cmd.outinterfaces||= []\n cmd.inhandles||= []\n cmd.outhandles||= []\n cmd.inargs||= []\n cmd.outargs||= []\n end\n data.each do |arg|\n type = arg[0]\n info = arg[1]\n if info then\n case info.before\n when \"Buffer\"\n index = SwIPC::parse_int(info.inside[0])\n tx_type = SwIPC::parse_int(info.inside[1])\n size = SwIPC::parse_int(info.inside[2])\n data_type = nil\n \n if type then\n case type.before\n when \"Out\"\n data_type = type.inside[0].to_s\n when \"InArray\"\n data_type = type.inside[0].to_s + \"[]\"\n when \"OutArray\"\n data_type = type.inside[0].to_s + \"[]\"\n when \"InBuffer\"\n data_type = \"bytes\"\n when \"OutBuffer\"\n data_type = \"bytes\"\n else\n data_type = type.to_s\n end\n data_type = cmd.context.get_or_infer_type(data_type)\n data_type.assert_size_on(version, size == 0 ? nil : size)\n end\n cmd.buffers[index] = SwIPC::Buffer.new(data_type, tx_type, size)\n when \"InRaw\" # <size, alignment, position>\n size = SwIPC::parse_int(info.inside[0])\n alignment = SwIPC::parse_int(info.inside[1])\n position = SwIPC::parse_int(info.inside[2])\n data_type = nil\n if type then\n data_type = cmd.context.get_or_infer_type(type.to_s)\n data_type.assert_size_on(version, size)\n data_type.assert_alignment_on(version, alignment)\n end\n cmd.inargs.push(SwIPC::Command::Arg.new(size, alignment, position, data_type))\n cmd.inargs.sort_by! do |a| a.position end\n when \"OutRaw\"\n size = SwIPC::parse_int(info.inside[0])\n alignment = SwIPC::parse_int(info.inside[1])\n position = SwIPC::parse_int(info.inside[2])\n if type then\n if type.before != \"Out\" then\n raise \"invalid OutRaw type\"\n end\n data_type = cmd.context.get_or_infer_type(type.inside[0].to_s)\n data_type.assert_size_on(version, size)\n data_type.assert_alignment_on(version, alignment)\n end\n cmd.outargs.push(SwIPC::Command::Arg.new(size, alignment, position, data_type))\n cmd.outargs.sort_by! do |a| a.position end\n when \"InObject\"\n if_type = nil\n if type then\n if type.before != \"SharedPointer\" then\n raise \"invalid InObject type\"\n end\n if_type = type.inside[0].to_s\n end\n cmd.ininterfaces[SwIPC::parse_int(info.inside[0])]||= if_type\n when \"OutObject\"\n of_type = nil\n if type then\n if type.before != \"Out\" then\n raise \"invalid OutObject type: \" + type.to_s\n end\n if type.inside[0].before != \"SharedPointer\" then\n raise \"invalid OutObject type: \" + type.to_s\n end\n of_type = type.inside[0].inside[0].to_s\n end\n cmd.outinterfaces[SwIPC::parse_int(info.inside[0])]||= of_type\n when \"InHandle\"\n # type is uninteresting\n cmd.inhandles[SwIPC::parse_int(info.inside[0])] = SwIPC::parse_int(info.inside[1])\n when \"OutHandle\"\n # type is uninteresting\n cmd.outhandles[SwIPC::parse_int(info.inside[0])] = SwIPC::parse_int(info.inside[1])\n else\n raise \"invalid info type: \" + info.before\n end\n else\n # TODO: infer?\n end\n end\nend",
"def command\n cmd = [exiftool_command]\n cmd << options_args\n cmd << values_args\n cmd << escaped_filenames\n cmd.flatten.join(' ')\n end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def script__from batch\n batch.map { |call, *args|\n command_shell_string__from call, *args\n }.join(\" ;\\n\")\n end",
"def cmdline(command, options = {})\n command = [command].flatten\n cmdline = [where]\n cmdline += @options.merge(options).map { |k, v| !v ? nil : \"#{option(k)} #{v == true ? '' : v.to_s}\".rstrip }.compact\n cmdline << option(command.shift)\n cmdline += command\n cmdline.flatten.join(' ').strip\n end",
"def compileArr(arr)\n\tfor a in arr\n\t\tif isExecutable(a)\n\t\t\t$stderr.puts red(\"Error: \")+\"Couldn't link the source code.\"\n\t\t\texit 1\n\t\tend\n\tend\n\n\tarr.map! { |a|\n\t\tescapePath(a)\n\t}\n\n\treturn compile(arr.join(\" \"))\nend",
"def get_args( from: '', required: false, default_value: [], comment: '' )\n cmd_options = @options['command_line_options'][from]\n # Auto documentation of this option\n @doc.push \"Option to pass arguments from: #{from},\\tdefault_value :#{default_value},\\tcomment :#{comment}\"\n if cmd_options.class == Array\n cmd_options = cmd_options.join ' '\n cmd_options = \"\\\"#{cmd_options}\\\"\" # return with quotes\n else\n @errors.push \" Arguments option #{from} should be an Array. #{cmd_options.class} found\"\n end\n end",
"def AssembleComplexStringsAndShapes(arg0, arg1 = nil)\n ret = _invoke(1610744278, [arg0, arg1], [VT_BYREF | VT_ARRAY | VT_BYREF | VT_DISPATCH, VT_R8])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def parse(line)\n cmd, arg_string = line.downcase.split(' ')\n [cmd, *arg_string.to_s.split(',')]\n end",
"def gather_command\n @command = []\n @lines.each do |x|\n if x[0,1].is_i?\n @command.push(x.split(/ /).s_to_i)\n else\n @command.push(x.split(//))\n end\n end\n end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def cmdarg_stack; end",
"def absolute_command(cmd, path: nil)\n was_array = cmd.is_a?(Array)\n cmd = if was_array\n cmd.dup\n else\n Shellwords.split(cmd)\n end\n # Don't try to touch anything if the first value looks like a flag or a path.\n if cmd.first && !cmd.first.start_with?('-') && !cmd.first.include?(::File::SEPARATOR)\n # If which returns false, just leave it I guess.\n cmd[0] = which(cmd.first, path: path) || cmd.first\n end\n cmd = Shellwords.join(cmd) unless was_array\n cmd\n end",
"def cascad(lcmd) sync_spawn(\"oled-exp\",@opt,\"cascad\",*(lcmd.map {|a|i a.to_s}) ) end",
"def make_command(action, args = [])\n command = @commands[action.to_sym]\n command += \" '\" + args.join(' ') + \"'\" unless args.empty?\n\n command\n end",
"def commandTarget _obj, _args\n \"_obj commandTarget _args;\" \n end",
"def generate_create_cli_arguments(options)\n options.map do |key, value|\n # If value is false, option is not set\n next if value.to_s == \"false\"\n # If value is true, consider feature flag with no value\n opt = value.to_s == \"true\" ? [] : [value]\n opt.unshift(\"--#{key.to_s.tr(\"_\", \"-\")}\")\n end.flatten.compact\n end",
"def command_name=(_arg0); end",
"def run(command, *args)\n sh \"#{command} #{args.join(' ')}\"\nend",
"def parts_to_commands(parts, opts)\n parts.map do |p|\n cmd = ''\n cmd << @cmd_start\n if opts[:enc_format] == 'hex_double_quoted'\n cmd << %Q{\"#{p}\"}\n elsif opts[:enc_format] == 'hex_single_quoted'\n cmd << %Q{'#{p}'}\n else\n cmd << p\n end\n cmd << @cmd_end\n cmd\n end\n end",
"def run_ar_extract_bdmroutine_arguments_from_console_arguments(\n ar_console_arguments)\n i_len=nil\n if KIBUVITS_b_DEBUG\n bn=binding()\n kibuvits_typecheck bn, Array,ar_console_arguments\n i_len=ar_console_arguments.size\n if i_len<1\n kibuvits_throw(\"i_len==\"+i_len.to_s+\" < 1 , but the \"+\n \"ar_console_arguments[0] has to contain the bdmroutine name.\")\n end # if\n else\n i_len=ar_console_arguments.size\n end # if\n ar_parameters=nil\n if 1<i_len\n ar_parameters=ar_console_arguments[1..(-1)]\n else\n ar_parameters=Array.new\n end # if\n return ar_parameters\n end",
"def parsed\n [raw_command] + args\n end",
"def assignedCommander _args\n \"assignedCommander _args;\" \n end",
"def myshelljoin argv\n argv.map{|x| x.index(' ') ? \"\\\"#{x}\\\"\" : x }.join(' ')\n end",
"def exec(args)\n cmd = if args.kind_of?(Array)\n Shellwords.join(args)\n else\n args\n end\n\n exec_command(cmd)\n end"
] |
[
"0.7245188",
"0.71567416",
"0.70673466",
"0.6924166",
"0.66781735",
"0.66477025",
"0.6617469",
"0.6565068",
"0.65550244",
"0.6526354",
"0.6498005",
"0.646884",
"0.6440869",
"0.6423733",
"0.63962555",
"0.63503236",
"0.6326912",
"0.63247424",
"0.62887",
"0.6288465",
"0.6280191",
"0.6264499",
"0.6220086",
"0.6168695",
"0.6155227",
"0.6114246",
"0.6114246",
"0.6114246",
"0.6092016",
"0.6086255",
"0.6082319",
"0.6050122",
"0.6041534",
"0.6041534",
"0.6041534",
"0.59851015",
"0.59546834",
"0.59508497",
"0.59508497",
"0.5949017",
"0.5931752",
"0.59307224",
"0.59054935",
"0.5905377",
"0.5895724",
"0.58944196",
"0.5880601",
"0.5878257",
"0.58626705",
"0.5859776",
"0.583606",
"0.5822496",
"0.5813677",
"0.5810648",
"0.5807831",
"0.5787286",
"0.5783854",
"0.57657325",
"0.57644445",
"0.5761578",
"0.5756069",
"0.57521826",
"0.57483345",
"0.5748326",
"0.574491",
"0.57230335",
"0.5713775",
"0.57112116",
"0.5710834",
"0.56968033",
"0.568749",
"0.5685311",
"0.5682298",
"0.56820405",
"0.56820405",
"0.56820405",
"0.56820405",
"0.56659806",
"0.5644744",
"0.56249005",
"0.56220907",
"0.56174684",
"0.5615879",
"0.5606648",
"0.55996215",
"0.55996215",
"0.55996215",
"0.55902225",
"0.55812365",
"0.5580749",
"0.5578803",
"0.55779654",
"0.5577364",
"0.55666846",
"0.5566584",
"0.5553624",
"0.5552376",
"0.5542874",
"0.55411",
"0.55394524"
] |
0.72121495
|
1
|
assembles two array arguments into cmd
|
def test_assembles_two_array_arguments_into_cmd
Crd::Flex::Command.new 'mxmlc' do |s|
s.source_path << 'src'
s.source_path << 'lib/src'
s.library_path << 'lib/bin'
cmd = s.to_cmd.split( /\s+/ )
assert_equal( 'mxmlc', cmd.shift )
assert( cmd.include?( '-source-path+=src,lib/src' ), 'Could not find argument in to_cmd' )
assert( cmd.include?( '-library-path+=lib/bin' ), 'Could not find argument in to_cmd' )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_cmd_ary(opts={arguments:[],separator:\"=\"})\n # [program, sub_program, normalize_params(opts[:separator]), opts[:arguments]].flatten.compact\n [program, sub_program, normalize_params(opts[:separator]), opts[:arguments].map{|a| a.split}].flatten.compact\n end",
"def create_commands args\n command = String.new\n args.each do |arg|\n command << arg << \" \" \n end\n command\n end",
"def test_assembles_one_array_argument_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.source_path << 'src'\n s.source_path << 'lib/src'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-source-path+=src,lib/src' ), 'Could not find argument in to_cmd' )\n end\n end",
"def cmd_with_targets(cmd_array, target, extras)\n final_arr = cmd_array\n final_arr.concat(['-target', target]) unless target.nil?\n # rubocop:disable Style/SafeNavigation\n extras.each { |e| final_arr.concat(['-target', e]) } unless extras.nil?\n # rubocop:enable Style/SafeNavigation\n final_arr.join(' ')\n end",
"def command_line_arguments(array)\n array.size.times do\n if array.include?('-nc')\n colour_changer(:white)\n array.delete('-nc')\n elsif array.any? { |x| ['-d1', '-d2', '-d3', '-d4'].include? x }\n key = (array[0])[1, 2].to_sym\n @difficulty = DIFFICULTY[key]\n @promptarr = prompt_select(key)\n @intro = false\n end\n end\n end",
"def cmd(options={})\n arguments\n end",
"def run2(*args)\n args.map!(&:to_s)\n command = args.join(' ')\n if include_meta_character?(command)\n run(command)\n else\n run(*args)\n end\n end",
"def commander _args\n \"commander _args;\" \n end",
"def binocular _args\n \"binocular _args;\" \n end",
"def command_str_for(*args)\n args.collect{|arg|\n case arg\n when Array\n arg.join(' ')\n when Hash\n arg.collect{|k,v| \"-#{k} #{v}\"}.join(' ')\n else\n arg.to_s\n end\n }.join(' ')\n end",
"def test_assembles_two_string_arguments_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.output = 'Main.swf'\n s.static_link_runtime_shared_libraries = true\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-output=Main.swf' ), 'Could not find argument in to_cmd' )\n assert( cmd.include?( '-static-link-runtime-shared-libraries=true' ), 'Could not find argument in to_cmd' )\n end\n end",
"def args_to_string(array)\n\tarray.map {|x| x.class == Array && x.size > 1 ? x[0].size > 1 ? '--' + x.join(' ') : '-' + x.join(' ') : x }.join(' ')\nend",
"def cmd(cmd, *args)\n system(\"#{cmd} #{args.join(' ')}\")\nend",
"def to_s\n cmd = ''\n @arr.each do |arg|\n if arg == @arr.first\n cmd << arg\n elsif arg.is_a?(Array)\n param, value = arg.first.to_s, arg.last.to_s\n\n if param =~ /^\\-{1,2}(.*)/\n param = $1\n end\n\n if param.length == 1\n cmd << ' ' << \"-#{param} #{Escape.shell_single_word(value)}\"\n else\n cmd << ' ' << \"--#{param}=#{Escape.shell_single_word(value)}\"\n end\n elsif arg.is_a?(Symbol)\n arg = arg.to_s\n if arg.length == 1\n cmd << ' ' << \"-#{arg}\"\n else\n cmd << ' ' << \"--#{arg}\"\n end\n elsif arg.is_a?(String) && arg.strip =~ /^\\-/\n cmd << ' ' << arg\n else\n cmd << ' ' << Escape.shell_single_word(arg.to_s)\n end\n end\n cmd\n end",
"def cmd(*args)\n\n cmd_args = []\n\n for arg in args\n\n case arg\n\n when Array\n cmd_literals = arg.shift.split(/\\s+/)\n\n for cmd_literal in cmd_literals\n if cmd_literal == \"?\"\n raise \"Not enough substitution arguments\" unless cmd_args.any?\n cmd_args << arg.shift\n else\n cmd_args << cmd_literal\n end\n end\n\n raise \"More parameters than ?'s in cmd string\" if arg.any?\n\n when String\n cmd_args << arg\n\n else\n cmd_args << arg.to_s\n\n end\n\n end\n\n p [:cmd_args, cmd_args] if $DEBUG\n\n system(*cmd_args)\nend",
"def command_shell_string__from call, *args\n \"#{call} #{args.join \" \"}\"\n end",
"def mk_cmd(env, cmd, options)\n [env, cmd.shellsplit, options].flatten\n end",
"def shell_commands(cmd, *args); end",
"def shell_commands(cmd, args); end",
"def commands\n args.commands.map do |cmd|\n if cmd.respond_to?(:join)\n cmd.map { |c| c.index(' ') ? \"'#{c}'\" : c }.join(' ')\n else\n cmd.to_s\n end\n end\n end",
"def run(cmd)\n TV.new [\"--test\", cmd.split].flatten\nend",
"def command_arguments(options={})\n args = []\n args.concat(['--type', options[:type].to_s]) if options[:type]\n args.concat(['--line-break', options[:line_break].to_s]) if options[:line_break]\n args.concat(['--charset', options[:charset].to_s]) if options[:charset]\n\n if options[:type].to_s == 'js'\n args << '--nomunge' unless options[:munge]\n args << '--preserve-semi' if options[:preserve_semicolons]\n args << '--disable-optimizations' unless options[:optimize]\n end\n\n args\n end",
"def make_command_line_unix(ary)\n ary.collect { |str| escape_shell_unix(str) }.join(\" \")\n end",
"def call(*command); end",
"def SpawnArguments(*args)\n # the env vars hash is either the first argument, or empty\n env = if args.first.is_a?(Hash)\n args.shift\n else\n {}\n end\n\n # the options hash is either the last argument, or empty\n options = if args.last.is_a?(Hash)\n args.pop\n else\n {}\n end\n\n raise(ArgumentError, \"You must provide a command to run.\") if args.empty?\n\n command = args.shift\n\n raise(\n ArgumentError,\n \"Unable to recognize first command component. Expected String or Array, got #{args.first.class}.\"\n ) unless command.is_a?(String) || command.is_a?(Array)\n\n raise(\n ArgumentError,\n \"Each command component after the first must be strings.\"\n ) unless args.all? { |arg| arg.is_a?(String) }\n\n if args.empty?\n if command.is_a?(String) # single commandline string\n [env, command, options]\n elsif command.is_a?(Array)\n [env, [command], options] # [command, argv0] pair with no other command arguments\n end\n else\n # this covers\n # a command with multiple string arguments\n # and\n # a [command, argv0] pair with multiple string arguments\n [env, [command, *args], options]\n end\nend",
"def split_args(ary)\n\tfiles = []\n\topts = []\n\tc = false\n\tary.each do |i|\n\t\tnext if i == '-'\n\t\tif i == '--' then\n\t\t\tc = true\n\t\t\tnext\n\t\tend\n\t\tfiles << i if c or not (i =~ /^-/)\n\t\topts << i if (not c) and (i =~ /^-/)\n\tend\n\t[files, opts]\nend",
"def full_command\n command_array.join(' ')\n end",
"def myshelljoin argv\n argv.map{|x| x.index(' ') ? \"\\\"#{x}\\\"\" : x }.join(' ')\n end",
"def cmd(*args) self.class.cmd(*args) end",
"def cmd_to_run\n\tarr = ARGV.dup\n\tarr = default_cmd if arr.empty?\n\tarr\nend",
"def exec(args)\n cmd = if args.kind_of?(Array)\n Shellwords.join(args)\n else\n args\n end\n\n exec_command(cmd)\n end",
"def run_command(*args)\n %x(#{args.join(\" \")})\n rescue IOError, SystemCallError\n nil\n end",
"def preprocess_arguments_for_commands(args)\n # All arguments should be passed through to the atlantis command.\n if args.first == \"atlantis\"\n return args.slice!(1..-1)\n end\n if args.first == \"ssh\"\n arg_index = 1\n arg_index += 1 if Component.names.include?(args[1]) # Skip <component>, if it exists\n while arg_index < args.length\n break if args[arg_index][0] != \"-\"\n arg_index += 1 if args[arg_index] == \"-i\"\n arg_index += 1\n end\n return [] unless arg_index < args.length\n puts \"slicing #{arg_index.inspect}\"\n return args.slice!(arg_index..-1)\n end\n []\nend",
"def cmd(*args)\n command = Shellwords.join(args)\n out = `#{command}`.strip\n fail!(puts \"command failed: #{command}\", $?.exitstatus) unless $?.success?\n out\nend",
"def generate_create_cli_arguments(options)\n options.map do |key, value|\n # If value is false, option is not set\n next if value.to_s == \"false\"\n # If value is true, consider feature flag with no value\n opt = value.to_s == \"true\" ? [] : [value]\n opt.unshift(\"--#{key.to_s.tr(\"_\", \"-\")}\")\n end.flatten.compact\n end",
"def call(*args)\n if args.first.is_a?(Array) && args.size == 1\n command = args.first\n else\n command = args\n end\n\n @commands << command\n nil\n end",
"def mate *args\n flattened_args = args.map {|arg| \"\\\"#{arg.to_s}\\\"\"}.join ' '\n `mate #{flattened_args}`\n nil\nend",
"def run(command, *args)\n sh \"#{command} #{args.join(' ')}\"\nend",
"def command_raw(args)\n\n end",
"def cmdline(command, options = {})\n command = [command].flatten\n cmdline = [where]\n cmdline += @options.merge(options).map { |k, v| !v ? nil : \"#{option(k)} #{v == true ? '' : v.to_s}\".rstrip }.compact\n cmdline << option(command.shift)\n cmdline += command\n cmdline.flatten.join(' ').strip\n end",
"def exiftool_args\n fail MultiExiftool::Error, 'No filenames.' if filenames.empty?\n cmd = []\n cmd << Writer.mandatory_args\n cmd << options_args\n cmd << values_args\n cmd << filenames\n cmd.flatten\n end",
"def initialize_cmd_args(args, new_name_args)\n args = args.dup\n args.shift(2 + @name_args.length) \n cmd_args = new_name_args + args\n end",
"def union(arg1, *arg2)\n first = arg1\n rest = []\n arg2.each do |char|\n char.each do |subchar|\n rest << subchar\n end\n end\n return first + rest\n \nend",
"def invoke_independent_command!(args)\n \n ##\n # Flatten Arguments to be able to test if the array is empty\n # and not an empty array in an empty array\n args.flatten!\n \n ##\n # Parses the CLI\n cli = GitPusshuTen::CLI.new(args)\n \n ##\n # Parses the Configuration\n if File.exist?(configuration_file)\n configuration = GitPusshuTen::Configuration.new(cli.environment).parse!(configuration_file)\n else\n configuration = nil\n end\n \n ##\n # Initializes the help command by default if there aren't any arguments\n if args.empty?\n GitPusshuTen::Command.new(cli, configuration, nil, nil)\n exit\n end\n \n ##\n # Append more arguments to the array below to allow more commands\n # to invoke without initializing an environment\n if %w[help version initialize].include? args.flatten.first\n \"GitPusshuTen::Commands::#{args.flatten.first.classify}\".constantize.new(\n cli, configuration, nil, nil\n ).perform!\n exit\n end\n end",
"def shell_command(files, options={})\n loadpath = options[:loadpath]\n requires = options[:requires]\n\n cmd = []\n cmd << \"ruby\" # \"bundle exec ruby\"\n cmd << loadpath.map{ |i| %{-I\"#{i}\"} }.join(' ') unless loadpath.empty?\n cmd << requires.map{ |r| %{-r\"#{r}\"} }.join(' ') unless requires.empty?\n #cmd << \"-r minitest/unit\"\n cmd.concat(files)\n cmd << \"| tapout\"\n cmd << \"-t #{trace}\" if @trace\n cmd << \"--no-ansi\" unless @ansi\n cmd << @format\n cmd = cmd.join(' ')\n\n return cmd\n\n #puts cmd if $DEBUG\n #system cmd\n end",
"def split_arguments!(arguments)\n \n if arguments.any? { |arg| arg.strip == 'of' }\n command = arguments.delete('of')\n elsif arguments.any? { |arg| arg.strip == 'convert' }\n command = arguments.delete('convert')\n end\n \n command\nend",
"def to_exec(args = self)\n Array(@executable) + args\n end",
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def args(args = [])\n args << \"--out=#{::File.basename(r.path)}\"\n args << \"--dir=#{::File.dirname(r.path)}\"\n args << \"--checksum=sha-256=#{r.checksum}\" if r.checksum\n args << \"--header='#{r.header}'\" if r.header\n args << \"--check-certificate=#{r.check_cert}\"\n args << \"--file-allocation=falloc\"\n args << \"--max-connection-per-server=#{r.connections}\"\n args << r.source\n end",
"def syntax\n t = @cmd_args\n t = [[t]] if !t.is_a? Array\n\n args = [] \n count = 0\n t.each do |expected_array|\n count += 1\n if count == 1\n str = \"Syntax: #{@cmd_name}\"\n else\n str = \" #{@cmd_name}\"\n end\n expected_array.each do |expected|\n # each expected arg.\n str += case expected\n when :arg_none then \"\"\n when :arg_dir! then \" <direction>\"\n when :arg_str! then \" <string literal>\"\n when :arg_word!then \" <word>\"\n when :arg_int! then \" <#>\"\n when :arg_obj_inv! then \" <item>\"\n when :arg_obj_room! then \" <item>\"\n when :arg_obj_inv_or_room! then \" <item>\"\n when :arg_class! then \" <Class>\"\n when :arg_player_in_game! then \" <player in game>\"\n when :arg_player_offline! then \" <any player>\"\n when :arg_actor_room! then \" <npc/player>\"\n when String then \" \" + expected \n else \"\"\n \n end\n end \n args << str\n end\n return args\n end",
"def effectiveCommander _args\n \"effectiveCommander _args;\" \n end",
"def split_command(args)\n main_args = nil\n sub_command = nil\n sub_args = []\n\n args.each_index do |i|\n if args[i].start_with?(\"-\")\n args.delete(args[i])\n end\n end\n\n args.each_index do |i|\n if !args[i].start_with?(\"-\")\n main_args = args[0,i]\n sub_command = args[i]\n sub_args = args[i+1, args.length - i + 1]\n break\n end\n end\n\n main_args = args.dup if main_args.nil?\n return [main_args, sub_command, sub_args]\nend",
"def arrayize_arguments(args)\n # Go through trailing arguments and suck them in if they don't seem\n # to have an owner.\n array = []\n until args.empty? || args.first.match(/^-/)\n array << args.shift\n end\n array\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def add_cmd_args(str)\n @cmd_args << \" #{str} \"\n end",
"def command *args, &block\n @commands ||= []\n @args ||= []\n @commands << block\n @args << args\n end",
"def prep_args(*args)\n args = args.flatten.compact\n args = args.first.to_s.split(/\\s+/) if args.size == 1\n cmd = sudo? ? :sudo : args.shift\n \n # Symbols to switches. :l -> -l, :help -> --help\n args.collect! do |a|\n if a.is_a?(Symbol)\n a = (a.to_s.size == 1) ? \"-#{a}\" : a.to_s\n end\n a\n end\n [cmd, args]\n end",
"def to_shellwords\n argv = []\n argv << %[--autopath] if autopath?\n argv << %[--verbose] if verbose?\n argv << %[--format=\"#{format}\"] if format\n argv << %[--chdir=\"#{chdir}\"] if chdir\n argv << %[--tags=\"#{tags.join(';')}\"] unless tags.empty?\n argv << %[--match=\"#{match.join(';')}\"] unless match.empty?\n argv << %[--units=\"#{units.join(';')}\"] unless units.empty?\n argv << %[--loadpath=\"#{loadpath.join(';')}\"] unless loadpath.empty?\n argv << %[--requires=\"#{requires.join(';')}\"] unless requires.empty?\n argv << files.join(' ') unless files.empty?\n argv\n end",
"def make_command_line_windows(ary)\n ary.collect { |str| escape_shell_windows(str) }.join(\" \")\n end",
"def cmd_concat_operator\n\t\t\" & \"\n\tend",
"def commandGetOut _args\n \"commandGetOut _args;\" \n end",
"def exiftool_args\n fail MultiExiftool::Error, 'No filenames.' if filenames.empty?\n cmd = []\n cmd << Reader.mandatory_args\n cmd << options_args\n cmd << tags_args\n cmd << filenames\n cmd.flatten\n end",
"def command\n cmd = [exiftool_command]\n cmd << options_args\n cmd << values_args\n cmd << escaped_filenames\n cmd.flatten.join(' ')\n end",
"def command(*values)\n if values.empty?\n @properties.fetch(:command) { [] }\n else\n @properties[:command] = []\n values.each { |val| @properties[:command] << val }\n end\n end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def opcode(op,args) \"#{op} #{args.join ','}\" end",
"def command\n args = options[:args].join(' ')\n\n return \"python -E #{kernel} #{args} #{conversion}\"\n end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def cmdarg=(_arg0); end",
"def test(cmd, file1, file2=\"foo\") end",
"def cmd(command, *arguments) Command.send(command.to_sym, *arguments) end",
"def test_assembles_one_string_argument_into_cmd\n Crd::Flex::Command.new 'mxmlc' do |s|\n s.output = 'Main.swf'\n cmd = s.to_cmd.split( /\\s+/ )\n assert_equal( 'mxmlc', cmd.shift )\n assert( cmd.include?( '-output=Main.swf' ), 'Could not find argument in to_cmd' )\n end\n end",
"def to_args\n args = [\n \"--name \\\"#{name}\\\"\",\n \"--version \\\"#{version}\\\"\",\n \"--user \\\"#{user}\\\"\",\n \"--group \\\"#{group}\\\"\",\n \"--iteration \\\"#{iteration}\\\"\",\n \"--homepage \\\"#{homepage}\\\"\",\n \"--home \\\"#{home}\\\"\",\n \"--architecture \\\"#{architecture}\\\"\",\n \"--description \\\"#{description}\\\"\",\n \"--maintainer \\\"#{maintainer}\\\"\",\n \"--vendor \\\"#{vendor}\\\"\"\n ]\n args.push \"--dependencies #{dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless dependencies.nil? || dependencies.empty?\n args.push \"--build-dependencies #{build_dependencies.map{|d| \"\\\"#{d}\\\"\"}.join}\" unless build_dependencies.nil? || build_dependencies.empty?\n args.push \"--compile-cache-dir \\\"#{compile_cache_dir}\\\"\" unless compile_cache_dir.nil? || compile_cache_dir.empty?\n args.push \"--before-precompile \\\"#{before_precompile}\\\"\" unless before_precompile.nil? || before_precompile.empty?\n args.push \"--after-precompile \\\"#{after_precompile}\\\"\" unless after_precompile.nil? || after_precompile.empty?\n args.push \"--before-install \\\"#{before_install}\\\"\" unless before_install.nil? || before_install.empty?\n args.push \"--after-install \\\"#{after_install}\\\"\" unless after_install.nil? || after_install.empty?\n args.push \"--before-remove \\\"#{before_remove}\\\"\" unless before_remove.nil? || before_remove.empty?\n args.push \"--after-remove \\\"#{after_remove}\\\"\" unless after_remove.nil? || after_remove.empty?\n\n args.push \"--license \\\"#{license}\\\"\" unless license.nil? || license.empty?\n args.push \"--buildpack \\\"#{buildpack}\\\"\" unless buildpack.nil? || buildpack.empty?\n args.push \"--buildpack_list \\\"#{buildpack_list}\\\"\" unless buildpack_list.nil? || buildpack_list.empty?\n args.push \"--force-os \\\"#{force_os}\\\"\" unless force_os.nil? || force_os.empty?\n args.push \"--runner \\\"#{runner}\\\"\" unless runner.nil? || runner.empty?\n args.push \"--logrotate-frequency \\\"#{logrotate_frequency}\\\"\" unless logrotate_frequency.nil? || logrotate_frequency.empty?\n args.push \"--logrotate-backlog \\\"#{logrotate_backlog}\\\"\" unless logrotate_backlog.nil?\n args.push \"--env #{env.variables.map{|v| \"\\\"#{v}\\\"\"}.join(\" \")}\" if env.present?\n args.push \"--auto\" if auto\n args.push \"--verbose\" if verbose\n args.push \"--store-cache\" if store_cache\n args.push \"--debug\" if debug\n args.push \"--verify\" if verify\n args.push \"--no-clean\" if !clean\n args.push \"--no-edge\" if !edge\n args.push \"--tmpdir\" if !tmpdir\n args\n end",
"def run_ar_extract_bdmroutine_arguments_from_console_arguments(\n ar_console_arguments)\n i_len=nil\n if KIBUVITS_b_DEBUG\n bn=binding()\n kibuvits_typecheck bn, Array,ar_console_arguments\n i_len=ar_console_arguments.size\n if i_len<1\n kibuvits_throw(\"i_len==\"+i_len.to_s+\" < 1 , but the \"+\n \"ar_console_arguments[0] has to contain the bdmroutine name.\")\n end # if\n else\n i_len=ar_console_arguments.size\n end # if\n ar_parameters=nil\n if 1<i_len\n ar_parameters=ar_console_arguments[1..(-1)]\n else\n ar_parameters=Array.new\n end # if\n return ar_parameters\n end",
"def commandTarget _obj, _args\n \"_obj commandTarget _args;\" \n end",
"def invoke(argv)\n system(\n argv.join(' ')\n )\n end",
"def argv; argline.split(/ +/) unless argline.nil?; end",
"def normalize_args(args)\n return args if args.nil?\n args.pop if args.size > 0 && args.last == '--'\n args\n end",
"def command(binary, action, service, param = nil, sub_param = nil)\n [\n prepare_parameter(binary),\n action, # simple keyword does not need transformation\n prepare_parameter(service),\n prepare_parameter(param),\n prepare_parameter(sub_param, false) # last param does no need quoting\n ].reject(&:empty?).join ' '\n end",
"def make_command_line(ary)\n case RUBY_PLATFORM\n when /mswin32|bccwin32/\n make_command_line_windows(ary)\n else\n make_command_line_unix(ary)\n end\n end",
"def script__from batch\n batch.map { |call, *args|\n command_shell_string__from call, *args\n }.join(\" ;\\n\")\n end",
"def process_args\n args = @args.dup\n @options[:operands] = nil\n unless args.length >= 2\n puts @opts\n exit 1\n end\n @options[:operands] = args.shift(2)\n @options[:output_filename] = args.shift unless args.empty?\n @options[:output] ||= @options[:output_filename] || $stdout\n\n run\n end",
"def command_parse(argv)\n end",
"def args(argv)\n Docopt.docopt(docopt, version: @version, argv:argv)\n end",
"def parts_to_commands(parts, opts)\n parts.map do |p|\n cmd = ''\n cmd << @cmd_start\n if opts[:enc_format] == 'hex_double_quoted'\n cmd << %Q{\"#{p}\"}\n elsif opts[:enc_format] == 'hex_single_quoted'\n cmd << %Q{'#{p}'}\n else\n cmd << p\n end\n cmd << @cmd_end\n cmd\n end\n end",
"def argSetTextual; @argSet.map { |a| a.to_s }.sort.join(':') end",
"def resolve_command_args(command_args)\n return command_args.first if command_args.is_a?(Array) && command_args.first.is_a?(Array)\n\n command_args\n end",
"def command\n log.debug self.pretty_inspect\n\n throw 'Invalid linker' unless @ld.is_a?(Linker)\n throw 'One or more source files are required' unless @sources.length > 0\n# cflags = default_flags\n# cflags.concat @flags\n# end\n# throw cflags\n\n# topdir = h[:topdir] || ''\n# ld = @ld\n# ldadd = h[:ldadd]\n# ld.flags = h[:ldflags]\n# ld.output = Platform.pathspec(h[:output])\n# ld.rpath = h[:rpath] if h[:rpath].length > 0\n\n# inputs = h[:sources]\n# inputs = [ inputs ] if inputs.is_a? String\n# inputs = inputs.map { |x| Platform.pathspec(topdir + x) }\n# throw 'One or more sources are required' unless inputs.count\n\n#TODO:if @combine\n# return [ @path, cflags, '-combine', ldflags, inputs, ldadd ].flatten.join(' ')\n#\n \n cmd = [ @path, '-DHAVE_CONFIG_H', '-I.', @platform_cflags, flags, '-c', @sources ].flatten.join(' ')\n\n cmd += Platform.dev_null if @quiet\n\n log.debug \"Compiler command: #{cmd}\"\n\n cmd\n end",
"def to_s\n @argv.join(' ')\n end",
"def split_main_and_subcommand(argv, command_list)\n # Initialize return variables\n main_args = nil\n sub_command = nil\n sub_args = []\n\n commands = []\n command_list.keys.each {|k| commands << k.to_s}\n\n # We split the arguments into two: One set containing any flags before a word, and then the rest. The rest are what\n # get actually sent on to the command\n argv.each_index do |i|\n if commands.index(argv[i])\n main_args = argv[0, i]\n sub_command = argv[i]\n sub_args = argv[i+1..-1]\n break\n elsif argv[i].end_with?('.rb')\n main_args = argv[0, i]\n sub_command = 'execute_ruby_script'\n sub_args = argv[i..-1]\n break\n end\n end\n\n # Handle the case that argv was empty or didn't contain any command\n main_args = argv.dup if main_args.nil?\n\n [main_args, sub_command, sub_args]\nend",
"def to_argv\n flags = []\n each do |f,v|\n m = f.to_s.size == 1 ? '-' : '--'\n case v\n when Array\n v.each{ |e| flags << \"#{m}#{f}='#{e}'\" }\n when true\n flags << \"#{m}#{f}\"\n when false, nil\n # nothing\n else\n flags << \"#{m}#{f}='#{v}'\"\n end\n end\n flags\n end",
"def generate_multi_cmd(multi_def,multi_samples)\n\t\t\t\tmulti_cmd = []\t\n\t\t\t\tmulti_samples.each do |sample_name|\n\t\t\t\t\tif sample_name.include? \",\"\n\t\t\t\t\t\tmulti_cmd << split_and_sub(\",\",multi_def,sample_name)\n\t\t\t\t\telsif sample_name.include? \";\"\n\t\t\t\t\t\tmulti_cmd << split_and_sub(\";\",multi_def,sample_name)\n\t\t\t\t\telse\n\t\t\t\t\t\tmulti_cmd << sub_placeholders(multi_def,self.samples_obj[sample_name])\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\treturn multi_cmd.join(\"\\s\")\n\t\t\tend",
"def test_to_cmd_is_formatted_appropriately\n cmd = @cmd.to_cmd\n assert_match( /^asdoc\\s/, cmd )\n assert( cmd.include?( '-output=build/docs' ), 'Could not find output argument in to_cmd' )\n assert( cmd.include?( '-source-path+=test/fixtures/target,libs/src' ), 'Could not find source-path argument in to_cmd' )\n assert( cmd.include?( '-library-path+=libs/bin' ), 'Could not find library-path argument in to_cmd' )\n assert( cmd.include?( '-doc-sources=test/fixtures/target' ), 'Could not find doc-sources argument in to_cmd' )\n assert( cmd.include?( '-main-title=\"Testing API Documentation\"' ), 'Could not find main-title argument in to_cmd' )\n assert( cmd.include?( '-window-title=\"Testing API Documentation\"' ), 'Could not find window-title argument in to_cmd' )\n end",
"def echo_at_least_two( first_arg, *middle_args, last_arg)\r\n pp \"The first argument is #{first_arg}\"\r\n middle_args.each { |arg| pp \"A middle argument is #{arg}\" }\r\n pp \"The last argument is #{last_arg}\"\r\nend",
"def quoted_shell_params args\n args.map(&method(:quoted_shell_param))\n end"
] |
[
"0.6598915",
"0.6512753",
"0.6512354",
"0.64623946",
"0.64417624",
"0.63631356",
"0.63423735",
"0.6336858",
"0.63310724",
"0.6313476",
"0.6311418",
"0.6306207",
"0.6300613",
"0.6294837",
"0.6264264",
"0.6176318",
"0.60607445",
"0.60588604",
"0.6000599",
"0.589969",
"0.5860555",
"0.5850429",
"0.5830474",
"0.581915",
"0.58179367",
"0.58081853",
"0.580245",
"0.5781216",
"0.57774943",
"0.57596827",
"0.575929",
"0.57444066",
"0.5730238",
"0.57287914",
"0.5682819",
"0.5679378",
"0.56696975",
"0.566285",
"0.56586224",
"0.56562763",
"0.5652445",
"0.5648101",
"0.5639321",
"0.56350017",
"0.56295305",
"0.56254315",
"0.56245327",
"0.56197536",
"0.56197536",
"0.56197536",
"0.55994976",
"0.55967253",
"0.559662",
"0.5585915",
"0.5575084",
"0.557258",
"0.557258",
"0.5554062",
"0.5546939",
"0.5534445",
"0.5530125",
"0.55284524",
"0.5524079",
"0.5517438",
"0.5515661",
"0.5510615",
"0.55086726",
"0.55086726",
"0.55086726",
"0.55086726",
"0.5493932",
"0.54917413",
"0.54917413",
"0.54917413",
"0.54833376",
"0.54832065",
"0.54817176",
"0.54793954",
"0.54789835",
"0.54788756",
"0.5474919",
"0.5463608",
"0.5457823",
"0.54448414",
"0.5443559",
"0.5443358",
"0.54420924",
"0.5441268",
"0.5440678",
"0.5440016",
"0.54317135",
"0.5414462",
"0.5409064",
"0.5398688",
"0.53865063",
"0.53685564",
"0.53633666",
"0.53563374",
"0.53533345",
"0.5336848"
] |
0.7290355
|
0
|
run runs the command and returns the output
|
def test_run_runs_the_command_and_returns_the_output
Crd::Flex::Command.new 'echo' do |s|
s.output = 'Main.swf'
assert_equal( '-output=Main.swf', s.run! )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run_and_output(cmd)\n run(cmd).output\n end",
"def run\n system(command)\n $?\n end",
"def run\n system(command)\n $?\n end",
"def run_command(*command)\n\t\t\t#stdout, stderr, status\n\t\t\treturn Open3.capture3(*command)\n\t\tend",
"def run\n begin\n IO.popen(@cmd_line).read\n rescue\n @logger.error(\"Failed to execute command on #{@host}\")\n \"\"\n end\n end",
"def run\n # TODO: include a parse step here and remove duplicate parsing code from\n # individual commands\n execute\n end",
"def run_cmd(input); end",
"def run(*command)\n IO.popen(command) { |io| io.read.strip }\n end",
"def run_and_return(cmd)\n output = []\n run cmd do |ch, st, data|\n output << data\n end\n return output.to_s\n end",
"def run_and_return(cmd)\n output = []\n run cmd do |ch, st, data|\n output << data\n end\n return output.to_s\n end",
"def run_and_return(cmd)\n output = []\n run cmd do |ch, st, data|\n output << data\n end\n return output.to_s\n end",
"def run\n out = \"\"\n\n begin\n PTY.spawn(command) do |stdout, stdin, pid|\n begin\n stdout.each do |line|\n out << line.strip+\"\\n\"\n print line if @tee\n end\n rescue Errno::EIO\n #Errno:EIO error probably just means that the process has finished giving output\n end\n Process.wait(pid)\n end\n rescue PTY::ChildExited\n # The child process has exited.\n end\n\n if $?.exitstatus == 0\n return Parser.parse(out) if @parse\n return out\n else\n raise \"httperf exited with status #{$?.exitstatus}\\n\\nhttperf output:\\n--------------\\n#{out}\"\n end\n end",
"def run\n raise \"`#{ real_command }' failed\" unless Kernel.system( real_command )\n end",
"def run(cmd)\n puts(cmd)\n system(cmd)\nend",
"def run(cmd)\n runner.run(cmd, shell, nil)\n end",
"def run\n\t\traise RuntimeError, \"Command line not parsed; call parse!().\" unless @command\n\t\t$log.debug(\"#{self.class}.#{__method__}() - Performing #{@command}...\")\n\t\treturn self.send(@command)\n\tend",
"def run_cmd(input)\n return self.process(input,false)\n end",
"def run command, *args\n formatted = Report.format_command_line command, *args\n write \">>> #{formatted}\\n\"\n Report.run_capturing_output(command, *args) do |data|\n write data\n end\n end",
"def run command\n # unless command\n # command = \" \\\"#{@args.join(\"\\\" \\\"\")}\\\"\" if args.any?\n # @switches.each{ |opt| command += \" --#{opt.to_s}\" }\n # @options.each { |opt, val| command += \" --#{opt.to_s} \\\"#{val}\\\"\" }\n # end\n return if command.nil? || command.strip.empty?\n command += \" 2>&1\"\n command += \" >/dev/null\" unless @capture || @output\n\n output = `#{self.path} #{command}`.strip\n puts output.gsub(/^/, \" -- \") if @output\n\n self.reset_for_next_command\n output\n end",
"def run_command(*args)\n %x(#{args.join(\" \")})\n rescue IOError, SystemCallError\n nil\n end",
"def run(cmd)\n puts cmd\n system cmd\nend",
"def run(command)\n display command.join(\" \")\n\n IO.popen(command + [err: %i[child out]]) do |io|\n __display(io.read(128), partial: true, verbose: true) until io.eof?\n end\n\n fail StandardError, \"Error running '#{command.join(\" \")}'\" unless $?.success?\n end",
"def run()\n stdout_file = Tempfile::new(\"rbatch_tmpout\",RBatch::tmp_dir)\n stderr_file = Tempfile::new(\"rbatch_tmperr\",RBatch::tmp_dir)\n pid = spawn(@cmd_str,:out => [stdout_file,\"w\"],:err => [stderr_file,\"w\"])\n if @opt[:timeout] != 0\n timeout(@opt[:timeout]) do\n begin\n status = Process.waitpid2(pid)[1] >> 8\n rescue Timeout::Error => e\n raise(CmdException,\"Command timeout (over \" + @opt[:timeout] + \" sec)\" )\n end\n end\n else\n status = Process.waitpid2(pid)[1] >> 8\n end\n result = RBatch::CmdResult.new(stdout_file,stderr_file,status,@cmd_str)\n if @opt[:raise] && status != 0\n raise(CmdException,\"Command exit status is not 0. result: \" + result.to_s)\n end\n return result\n end",
"def run\n _cmd = built_in_command( options[:args] )\n _cmd ||= options[:command] ? CommandRunner.new(options[:command]) : 0\n if _cmd.class == CommandRunner\n _cmd.run do |item|\n puts \"%s:\\n %s\\n\\n\" % [ item.class, item.desc ] if item.is_a?(UseCase) && ENV['ENVIRONMENT'] != 'test'\n end\n else\n _cmd\n end\n end",
"def run(command, options = {:desc => '', :get_output_string => false})\n puts options[:desc]\n puts \"Executing: #{command}\"\n\n if options[:get_output_string]\n result = `#{command}`\n else\n command << \" > /dev/null\" if command # Not show output details to stdout\n result = system(command)\n end\n\n report(result)\n end",
"def run(cmd)\n ENV['LANG'] = 'C'\n log \"Run: #{cmd}\"\n if dry_run\n return ['', 0]\n end\n stdout = `#{cmd} 2>&1`\n return_code = $?.exitstatus\n puts stdout\n puts \"Return: #{return_code}\"\n [stdout, return_code]\n end",
"def run(command, verbose = false, message = nil)\n if verbose then\n puts \"#{message}\"\n puts command\n result = `#{command}`\n puts result\n return result\n else\n `#{command}`\n end\nend",
"def run(command, verbose = false, message = nil)\n if verbose then\n puts \"#{message}\"\n puts command\n result = `#{command}`\n puts result\n return result\n else\n `#{command}`\n end\nend",
"def run\n log.info(\"Running...\")\n result = run_internal()\n log.info(\"Success! #{result.message}\")\n return result\n end",
"def run_cmd(input)\n return @session.process(input,false)\n end",
"def run_cmd(cmd)\n process = session.sys.process.execute(cmd, nil, {'Hidden' => true, 'Channelized' => true})\n res = \"\"\n while (d = process.channel.read)\n break if d == \"\"\n res << d\n end\n process.channel.close\n process.close\n return res\n end",
"def execute\n parse_command\n run_command(command)\n end",
"def run\n Application.logger.info \"Executing #{self.class.to_s} (UseCase)\"\n _r = execute\n Application.logger.info \"Returned from #{self.class.to_s} => #{_r.inspect}\"\n _r\n end",
"def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, err\n end\n end",
"def run(*args)\n cli.run(*args)\n end",
"def run(*command)\n\t\t\t\tif !@interrupted\n\t\t\t\t\tbegin\n\t\t\t\t\t\treturn Run.run(*command)\n\t\t\t\t\trescue Interrupt #interruption\n\t\t\t\t\t\t@interrupted=true\n\t\t\t\t\t\treturn \"\", false\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\treturn \"\", false\n\t\t\t\tend\n\t\t\tend",
"def run_cmd(cmd)\n\tend",
"def run(cmd)\n Open3.popen3(*cmd) do |i, o, e, t|\n i.close\n t.value\n end\n end",
"def run *args\n puts args.first.join ' '\n status, stdout, stderr = systemu *args\n puts stdout, stderr unless status.success?\nend",
"def run(command)\n result = connection.exec!(command)\n puts \"[BEGIN #{@host}: #{command}]\"\n puts \" #{result}\"\n puts \"[END #{@host}: #{command}]\"\n end",
"def run_for_output(cmd)\n LOG.debug \"RUNNING (for output): #{cmd}\"\n out, _status = Open3.capture2e(cmd)\n out.strip\n end",
"def run(command, *arguments)\n expanded_command = build_cli_call(command, arguments)\n status, out, err = run_command(expanded_command)\n Result.new(expanded_command, status, out, err)\n end",
"def run_cmd(cmd)\n Chef::Log.info \"executing: #{cmd}\"\n result = Mixlib::ShellOut.new(cmd).run_command.stdout.strip\n return result\nend",
"def run_cmd(cmd, *args)\n output, = Open3.capture2e(cmd, *args)\n\n output\n end",
"def run(command)\n log_and_exit \"Tried to run: #{command}\" if $testing\n %x(#{command})\n end",
"def run(cmd)\n result = `#{cmd}`\n raise Castanaut::Exceptions::ExternalActionError if $?.exitstatus > 0\n result\n end",
"def run(cmd)\n p4.run cmd\n end",
"def run(command)\n if !command.kind_of?(Array)\n cmd = [command]\n else\n cmd = command\n end\n\n cmd.each { |line|\n puts line\n IO.popen(line) { |io|\n io.each_char do |c|\n print c\n end\n }\n }\n\nend",
"def run(command, *args)\n send(command, *args)\n end",
"def exec(command)\n #logger.debug { \"Github: Executing command: '#{command}'\" }\n #p \"Github: Executing command: '#{command}'\"\n \n # Get a path to a temp file\n #logfile = Tempfile.new('github__exec')\n #logfile.close\n \n #success = system(\"#{command} > #{logfile.path} 2>&1\")\n #output_from_command = File.readlines(logfile.path)\n #output_from_command = %x[command]\n shell = Shell.new(command)\n shell.run\n success = (shell.exitstatus == 0)\n output_from_command = shell.output\n if success\n #logger.debug { \"Github: Command output: #{output_from_command.inspect}\"}\n #p \"Github: Command output: #{output_from_command.inspect}\"\n return output_from_command\n else\n #logger.error { \"Github: Command '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"}\n p \"Github: Command failed '#{command}' didn't exit properly. Full output: #{output_from_command.inspect}\"\n end\n \n #ensure\n #logfile.unlink\n end",
"def run(command,use_shell=true,working_dir=\"C:\\\\\",forward_to_standard_out=true)\n\tif command.strip.empty?\n\t\traise \"No command provided to run()\"\n\tend\n\n\t# Necessary if command take advantage of any shell features such as\n\t# IO piping\n\tif use_shell\n\t\tcommand = \"cmd /S /C \\\"#{command}\\\"\"\n\tend\n\n\toutput = []\n\tp = nil\n\n\tbegin\n\t\tputs \"Executing: #{command}\"\n\t\tp = Runtime.getRuntime.exec(command,[].to_java(:string),java.io.File.new(working_dir))\n\n\t\t# Read error stream\n\t\tstd_err_reader = BufferedReader.new(InputStreamReader.new(p.getErrorStream))\n\t\twhile ((line = std_err_reader.readLine()).nil? == false)\n\t\t\tputs line if forward_to_standard_out\n\t\tend\n\n\t\tp.waitFor\n\t\tputs \"Execution completed\"\n\t\treader = BufferedReader.new(InputStreamReader.new(p.getInputStream))\n\t\twhile ((line = reader.readLine()).nil? == false)\n\t\t\tputs line if forward_to_standard_out\n\t\t\toutput << \"#{line}\"\n\t\tend\n\trescue Exception => e\n\t\tputs e.message\n\t\tputs e.backtrace.inspect\n\tensure\n\t\tp.destroy if !p.nil?\n\tend\n\treturn output.join(\"\\n\")\nend",
"def run(cmd)\n output = `#{cmd.gsub(/\\s+/, \" \")} 2>&1`\n\n unless $?.exitstatus == 0\n #Kickvideo::Notifier.deliver_processing_error(@attachment.instance, @attachment, cmd, output)\n raise Kickvideo::ProcessingError, \"Error while running #{cmd} - #{output}\"\n end\n\n output\n end",
"def scm_run(command)\n run(command) do |ch,stream,text|\n ch[:state] ||= { :channel => ch }\n output = source.handle_data(ch[:state], stream, text)\n ch.send_data(output) if output\n end\n end",
"def run!(input)\n stdout, stderr, process = run(input)\n\n if process.success?\n puts stdout\n\n STDERR.puts(stderr) unless stderr.empty?\n else\n abort stderr\n end\n end",
"def run(command,use_shell=true,working_dir)\n\t# Necessary if command take advantage of any shell features such as\n\t# IO pipining\n\tif use_shell\n\t\tcommand = \"cmd /S /C \\\"#{command}\\\"\"\n\tend\n\n\tbegin\n\t\tputs \"Executing: #{command}\"\n\t\tp = Runtime.getRuntime.exec(command,[].to_java(:string),java.io.File.new(working_dir))\n\t\t\n\t\t# RegRipper sends output to the error stream. This must be read in order to prevent the process from locking\n\t\tstd_err_reader = BufferedReader.new(InputStreamReader.new(p.getErrorStream))\n\t\twhile ((line = std_err_reader.readLine()).nil? == false)\n\t\t\t#puts line\n\t\tend\n\t\t\n\t\tp.waitFor\n\t\tputs \"Execution completed:\"\n\t\treader = BufferedReader.new(InputStreamReader.new(p.getInputStream))\n\t\twhile ((line = reader.readLine()).nil? == false)\n\t\t\tputs line\n\t\tend\n\trescue Exception => e\n\t\tputs e.message\n\t\tputs e.backtrace.inspect\n\tensure\n\t\tp.destroy\n\tend\nend",
"def exec\n binding.pry\n # command.run(*service.exec(args.command))\n end",
"def run\n # Make sure the desired working directory exists.\n FileUtils.makedirs(@dir) if not File.directory?(@dir)\n # Actually run the command.\n if @log then\n @pid = spawn(@cmd, :chdir => @dir, [:out, :err] => [@log, 'a'])\n else\n @pid = spawn(@cmd, :chdir => @dir, [:out, :err] => '/dev/null')\n end\n\n # In the forked process, wait for the command to be done.\n Process.waitall\n\n # Report that this command finished.\n begin\n require 'prowler'\n Prowler.verify_certificate = false\n Prowler.application = 'cuted'\n Prowler.notify(@cmd, \"Finished in #{@dir}\", @prowl_key) if @prowl_key\n rescue LoadError\n end\n\n # Return the CuteCommand.\n self\n end",
"def run(cmd, capture_stderr=true)\n notice \"Running: \" + cmd.color(:white)\n cmd += \" 2>&1\" if capture_stderr\n\n out = \"\"\n IO.popen(cmd) do |f|\n while l = f.gets\n out += l\n msg \" \" + l\n end\n end\n\n raise CmdFailedError.new(\"Command '#{cmd}' had exit status #{$?.to_i}\") if $? != 0\n out\n end",
"def run_cmd(cmd,token=true)\n opts = {'Hidden' => true, 'Channelized' => true, 'UseThreadToken' => token}\n process = session.sys.process.execute(cmd, nil, opts)\n res = \"\"\n while (d = process.channel.read)\n break if d == \"\"\n res << d\n end\n process.channel.close\n process.close\n return res\n end",
"def run(cmd)\n puts \"\\033[1;37m#{cmd}\\033[0m\"\n result = `#{cmd}`\n abort unless $?.success?\n puts result unless result.empty?\n result\nend",
"def run_cmd(cmd)\n ret = \"\"\n start = Time.now.to_i\n log_and_stream \"<div class='command'><h4>Running #{cmd}</h4><p class='output'>\"\n time = Benchmark.measure do\n Open3.popen3(cmd) do |inn, out, err|\n output = \"\"\n until out.eof?\n # raise \"Timeout\" if output.empty? && Time.now.to_i - start > 300\n chr = out.read(1)\n output << chr\n ret << chr\n if chr == \"\\n\" || chr == \"\\r\"\n log_and_stream output + \"<br>\"\n output = \"\"\n end\n end\n log_and_stream(output) unless output.empty?\n log_and_stream(\"<span class='stderr'>STDERR: #{err.read}</span><br>\") unless err.eof?\n end\n end\n log_and_stream \"</p>\"\n log_and_stream \"<h5>Time: #{time}</h5></div>\"\n return ret\n end",
"def run_command(command ,*args)\n args.collect! do |arg|\n # args can contain characters like '>' so we must escape them, but don't quote switches\n if arg !~ /^[\\-]/\n \"\\\"#{arg}\\\"\"\n else\n arg.to_s\n end\n end\n command = \"#{command} #{args.join(\" \")}\"\n output = `#{command} 2>&1`\n\n if $?.exitstatus != 0\n raise FlashToolError, \"SWF command (#{command.inspect}) failed: #{{:status_code => $?, :output => output}.inspect}\"\n else\n output\n end\n end",
"def run(cmd)\r\n args = cmd.split\r\n Pdm::Runner.new.run args\r\nend",
"def run\n testable = Parser.new(@argv).parse\n Executor.new(testable).execute\n end",
"def run(cmd)\n print \"-> #{cmd}...\"\n system cmd\n print \"ok\\n\"\nend",
"def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end",
"def run(cmd)\n log cmd\n system(cmd) or fail \"Command Failed: [#{cmd}]\"\n end",
"def run(cmd, *args)\n dispatch(cmd, *args)\n end",
"def run_simple(*command, **opts, &b)\n\t\t\t# here the block is called in case of error\n\t\t\topts[:error_mode]=b if b\n\t\t\t_status, out, _error = run(*command, **opts)\n\t\t\treturn out\n\t\tend",
"def run(command)\n puts command\n `#{command}`.tap &method(:puts)\nend",
"def run\n result = execute\n result.split(\"\\n\").each do |r|\n parsed = r.split\n ods_value = parsed[-1]\n line_key = parsed[0..-2].join('_')\n if ods_value !~ /^[-+]?[0-9]*\\.?[0-9]+$/\n $logger.warn \"Command #{ods_key} returned non numeric value - \\\n \\\"#{ods_value}\\\", when running \\\"#{command_line}\\\"\"\n return\n end\n ods_key = line_key.empty? ? self.ods_key : [self.ods_key, line_key].join('.')\n ods_string = format_ods_string(ods_key, ods_value)\n send_to_ods(ods_string)\n end\n rescue Exception => ex\n $logger.error \"Could not run #{self.ods_key}\"\n $logger.error ex\n ex.backtrace.each do |b|\n $logger.error \"\\t#{b}\"\n end\n end",
"def run\n raise Error, \"Unknown command `#{command_name}`\"\n end",
"def execute\n setup\n begin\n data = main\n rescue ArgumentError => e\n warn e.message\n exit 1\n end\n puts format_data(data)\n end",
"def run(command, log_action = true)\r\n log 'executing', \"#{command} from #{Dir.pwd}\" if log_action\r\n `#{command}`\r\n end",
"def run\n return if $test\n #Run number\n n = 0\n\n IO.popen(RSlave, \"w+\") { |p|\n if @collect\n collectVariants(p)\n elsif @agg\n @topdir = Dir.pwd\n aggregateRuns(p, @topdir)\n else\n raise ArgumentError, \"No vector file specified\", caller[0] if not @agg and ARGV.size < 1\n\n vecFile = ARGV.shift\n singleRun(p, vecFile, n)\n end\n\n p.puts %{q(\"no\")}\n\n }\n\n rescue Errno::EPIPE => err\n $defout.old_puts err\n $defout.old_puts err.backtrace\n $defout.old_puts \"last R command: #{$lastCommand.shift}\"\n end",
"def run(command)\n wait_until_done if running?\n setup_environment\n begin\n @command = command.dup\n @status = nil\n words = Shellwords.shellwords(command)\n @pid, @stdin, stdout, stderr = Open4.popen4(*words)\n @standard_output = Stream.new(self, 'standard output', stdout)\n @standard_error = Stream.new(self, 'standard error' , stderr)\n self\n ensure\n teardown_environment\n end\n end",
"def run(cmd)\n #logger.trace \"executing locally: #{cmd.inspect}\" if logger\n run_locally cmd\n # puts `#{cmd}`\nend",
"def run\n \n if parsed_options?\n \n process_command\n end\n \n end",
"def _run_command(command)\n require \"posix-spawn\"\n\n pid, stdin, stdout, stderr = POSIX::Spawn.popen4(command)\n Process.waitpid(pid)\n\n # $?.exitstatus contains exit status do something with it if non zero raise error maybe\n end",
"def execute(filename, command, error)\n # Execute Command\n @result[:_task] = filename\n @result[:_timestamp]= Time.now.to_i\n # @result[:_date]\n unless @params[\"_target\"][\"remote\"].nil?\n begin \n stdout, stderr, status = Open3.capture3(*command)\n rescue Exception => e\n default_error = { \n msg: e.message,\n kind: \"test::#{filename}\",\n details: { class: e.class.to_s,\n backtrace: e.backtrace }, \n }\n @result[:_error] = default_error.merge(error)\n\n end\n @result[:_stdout] = stdout\n @result[:_sterr] = stderr\n @result[:_status] = status\n @result\n else\n @result[:_timestamp]= Time.now\n @result[:_command_start_time] = Time.now\n begin \n $results = command.call()\n @result[:_command_end_time] = Time.now\n rescue Exception => e\n @result[:_command_end_time] = Time.now\n default_error = { \n msg: e.message,\n kind: \"test::#{filename}\",\n details: { class: e.class.to_s,\n backtrace: e.backtrace }, \n }\n @result[:_error] = default_error.merge(error)\n #puts @result\n end\n # makes sure the results are at the top level of the return object\n unless $results.nil?\n $results.each do |key, value|\n @result[key] = value\n end\n end\n end\n @result\n end",
"def run!\n old_sync = $stdout.sync\n $stdout.sync = true\n begin\n open(\"| #{@command}\", \"r\") do |file|\n until file.eof? do\n test_line = file.getc \n break unless test_line\n putc(test_line)\n @line.push(test_line)\n push_in_the_results(test_line)\n end\n end\n ensure\n $stdout.sync = old_sync\n end\n @results = @results.join\n self\n end",
"def run command, args = {}\n # check if in verbose mode\n verbose = args[:verbose] || @verbose\n output = `echo | #{command} 2>&1`\n success = $?.success?\n\n if verbose\n say \"RUNNING: #{command}\", :type => (success ? :success : :fail)\n say output\n end\n\n args[:boolean] ? success : output\n end",
"def run(options={})\n formatter = get_formatter(options)\n @output, success = run_command(cmd(options), formatter)\n\n return false unless success\n return check_for_output(formatter)\n end",
"def run(*params)\n opts = params.extract_options!\n command = Array.wrap(params).join(' ')\n info command unless opts[:quiet]\n\n begin\n cmdrunner = Mixlib::ShellOut.new(command, timeout: opts[:timeout] || Conveyor::Foreman.instance.config[:command_timeout] || 600)\n cmdrunner.run_command()\n\n info cmdrunner.stdout.chomp unless cmdrunner.stdout.chomp.length == 0\n\n \t\t\t\tif cmdrunner.error!\n \terror \"Error running: `#{command}`\", cmdrunner.stderr.chomp\n \t@status.fail!\n \t\t\t\telse\n \t\t\t\t\tif cmdrunner.stderr.chomp.length > 0\n \t\t\t\t\t\twarning \"Error output recieved, but no error code recieved\"\n \t\t\t\t\t\twarning cmdrunner.stderr.chomp\n \t\t\t\t\tend\n \t\t\t\tend\n\n return !cmdrunner.error!\n rescue Mixlib::ShellOut::CommandTimeout => e\n error e.class, e.message, \"Command: #{command}\"\n # raise e unless opts[:ignore_error]\n rescue => e\n error e.class, e.message, e.backtrace.join(\"\\n\")\n # raise e unless opts[:ignore_error]\n end\n end",
"def cmd_run argv\n setup argv\n uuid = @hash['uuid']\n if @hash['boolean'].nil?\n rename = \"\"\n else\n rename = @hash['boolean']\n end\n response = @api.run(uuid, rename)\n msg response\n return response\n end",
"def run_command_script(command)\n Open3.popen2e(\"ruby #{command}\") do |stdin, stdout_err|\n while line = stdout_err.gets\n puts line\n end\n end\n end",
"def run_program(cmd, input = \"\")\n stdout, = Open3.capture2e(shell_out_env, *cmd, stdin_data: input)\n\n stdout\n end",
"def run_command(command, ignore_failure = false)\n return Simp::Cli::ExecUtils::run_command(command, ignore_failure, logger)\n end",
"def run\n stime = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n sys(command, path: config[:bin], stdout: stdout, stderr: stderr)\n \n etime = Process.clock_gettime(Process::CLOCK_MONOTONIC)\n\n ttime = etime-stime\n puts \"Query #{qfile} took #{ttime} seconds.\"\n\n done!\n rescue CommandFailed => e\n done! e.exitstatus\n end",
"def run!\n cmd = self.to_s\n puts (\"=\"*100).blue if Songster.debug\n puts \"`#{cmd}`\".green if Songster.debug\n output = `#{self.to_s}`\n puts output.red if Songster.debug\n return output\n end",
"def run\n if @options['file']\n execute_script @options['file']\n elsif @options['command']\n execute @options['command']\n else\n interactive_shell\n puts \n end\n end",
"def runCommand(bamFile, chipDesignPath)\n FileUtils.mkdir(@outputDir)\n cmd = \"java -Xmx8G -cp \" + @captureCodeDir + \"/picard-1.07.jar:\" + @captureCodeDir +\n \"/sam-1.07.jar:\" + @captureCodeDir + \" CaptureStatsBAM5\"\n cmd = cmd + \" -o \" + @outputDir + \"/\" + @resultPrefix.to_s + \" -t \" +\n chipDesignPath.to_s + \" -i \" + bamFile + \" -d -w\"\n\n puts \"Running the following command for capture stats : \"\n puts cmd\n `#{cmd}`\n exitStatus = $?\n puts \"Exit status of Capture Stats Command : \" + exitStatus.to_s\n\n parseResults()\n uploadToLIMS()\n emailResults()\n puts \"Completed Everything\"\n end",
"def run\n\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n\n end",
"def run(input)\n stdout, stderr, process = capture(input)\n\n raise stderr unless process.success?\n\n return stdout.strip\n end",
"def runCmd\n puts \" Deployed and running #{@request.data['command']} #{@request.data['arguments']}\".light_green\n print ' STDOUT'.light_cyan + ' and' + ' STDERR'.light_magenta + \":\\n\"\n\n # offset (place saving) variables\n @stdoutOffset = 0\n @stderrOffset = 0\n begin\n # get most recent task state\n # need to wait for \"task_running\" before we can ask for STDOUT/STDERR\n @taskState = JSON.parse(RestClient.get \"#{@uri}/api/history/task/#{@thisTask['taskId']['id']}\")\n @taskState[\"taskUpdates\"].each do |update|\n @taskState = update['taskState']\n end\n if @taskState == \"TASK_FAILED\"\n return 1 # failure\n end\n if @taskState == \"TASK_RUNNING\"\n sleep 1\n # print stdout\n @stdout = JSON.parse(RestClient.get \"#{@uri}/api/sandbox/#{@thisTask['taskId']['id']}/read\", {params: {path: \"stdout\", length: 30000, offset: @stdoutOffset}})['data']\n outLength = @stdout.bytes.to_a.size\n if @stdout.length > 0\n print @stdout.light_cyan\n @stdoutOffset += outLength\n end\n # print stderr\n @stderr = JSON.parse(RestClient.get \"#{@uri}/api/sandbox/#{@thisTask['taskId']['id']}/read\", {params: {path: \"stderr\", length: 30000, offset: @stderrOffset}})['data']\n errLength = @stderr.bytes.to_a.size\n if @stderr.length > 0\n print @stderr.light_magenta\n @stderrOffset += errLength\n end\n end\n end until @taskState == \"TASK_FINISHED\"\n\n return 0 # success\n end",
"def run_command(cmd)\n IO.popen(cmd) do |f|\n while ! f.eof\n puts f.gets\n end\n end\n $?\n end",
"def command_run(str_opts)\n command :run do |c|\n c.syntax = 'budik run [options]'\n c.summary = @str_run.summary\n c.description = @str_run.description\n command_run_options(c, str_opts)\n c.action { |_args, opts| Command.new(:run, opts) }\n end\n end",
"def run(cmd)\n puts \"=== running: #{cmd} \".ljust(terminal_columns, '=').cyan\n pid, _, stdout, stderr = Open4::popen4 cmd\n _, status = Process::waitpid2 pid\n puts \"===\".ljust(terminal_columns, '=').cyan\n {:status => status, :stdout => stdout.read.strip, :stderr => stderr.read.strip}\n end",
"def run\n if parsed_options? && arguments_valid? \n process_arguments \n process_command\n else\n output_usage\n end\n end",
"def call(*command); end",
"def run_cmd(command, arguments = [], &block)\n reset if command_count_exceeded?\n ensure_open_shell!\n\n @command_count += 1\n result = nil\n service.run_command(shell, command, arguments) do |command_id|\n result = service.get_command_output(shell, command_id, &block)\n end\n result\n end"
] |
[
"0.726669",
"0.72159886",
"0.72159886",
"0.6970422",
"0.6970309",
"0.69441235",
"0.69344425",
"0.69065624",
"0.6840741",
"0.6840741",
"0.6839807",
"0.683495",
"0.6832714",
"0.68320477",
"0.681404",
"0.68090266",
"0.6796596",
"0.6790829",
"0.67811906",
"0.6745228",
"0.6728954",
"0.671053",
"0.66890424",
"0.66584015",
"0.66320723",
"0.6592196",
"0.65868866",
"0.65868866",
"0.6581539",
"0.658061",
"0.6579522",
"0.6573282",
"0.6570741",
"0.65652496",
"0.65489143",
"0.65429217",
"0.65423197",
"0.6542306",
"0.6529191",
"0.65127957",
"0.6504558",
"0.649392",
"0.64789444",
"0.64679956",
"0.64429885",
"0.641747",
"0.6408519",
"0.64061755",
"0.6405068",
"0.64002615",
"0.63796234",
"0.635994",
"0.63560146",
"0.63501346",
"0.6338935",
"0.633456",
"0.63264275",
"0.63217413",
"0.631509",
"0.63070375",
"0.6300681",
"0.6299957",
"0.62984097",
"0.629478",
"0.62911546",
"0.62896985",
"0.62896985",
"0.62769604",
"0.6262042",
"0.62589073",
"0.6255558",
"0.6250193",
"0.6241335",
"0.62398094",
"0.62354743",
"0.6228751",
"0.62283844",
"0.62220275",
"0.6220901",
"0.6213604",
"0.6209252",
"0.6208823",
"0.62033594",
"0.61991787",
"0.61938924",
"0.6193531",
"0.6187418",
"0.61703414",
"0.6168108",
"0.61649406",
"0.6161689",
"0.6155361",
"0.6149356",
"0.61492753",
"0.61474854",
"0.6136067",
"0.61313546",
"0.6117449",
"0.6116682",
"0.6114972",
"0.6112728"
] |
0.0
|
-1
|
found returns true for commands found in path
|
def test_found_returns_true_for_commands_found_in_path
Crd::Flex::Command.new 'mxmlc' do |s|
assert_equal( true, s.found? )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cmds_in_path? commands = provides, custom_cmd_dir = nil\n present, missing = [*commands].partition {|cmd_name| cmd_dir(cmd_name) }\n ours, other = if custom_cmd_dir\n present.partition {|cmd_name| cmd_dir(cmd_name) == custom_cmd_dir }\n else\n present.partition {|cmd_name| pkg_manager.cmd_in_path? cmd_name }\n end\n\n if !ours.empty? and !other.empty?\n log_error \"The commands for #{name} run from more than one place.\"\n log \"#{cmd_location_str_for ours}, but #{cmd_location_str_for other}.\"\n :fail\n else\n returning missing.empty? do |result|\n if result\n log cmd_location_str_for(ours.empty? ? other : ours)\n else\n log \"#{missing.map {|i| \"'#{i}'\" }.to_list} #{missing.length == 1 ? 'is' : 'are'} missing.\"\n end\n end\n end\n end",
"def command_found; end",
"def command_in_path?(command)\n found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|\n File.exist?(File.join(p, command))\n end\n found.include?(true)\n end",
"def command_in_path?(command)\n found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|\n File.exist?(File.join(p, command))\n end\n found.include?(true)\n end",
"def test_found_returns_false_for_commands_not_found_in_path\n Crd::Flex::Command.new 'madeupcommandname' do |s|\n assert_equal( false, s.found? )\n end\n end",
"def command_available?(command)\n find = Releasy.win_platform? ? \"where\" : \"which\"\n # Call this Kernel version of `` so it can be mocked in testing.\n result = Kernel.`(\"#{find} #{command}\")\n return false unless $? == 0\n result\n end",
"def has_executable(path)\n # Be smart: If the path includes a forward slash, we're checking\n # an absolute path. Otherwise, we're checking a global executable\n if path.include?('/')\n @commands << \"test -x #{path}\"\n else\n @commands << \"[ -n \\\"`echo \\\\`which #{path}\\\\``\\\" ]\"\n end\n end",
"def command_exists?\n File.exists? self.command_file\n end",
"def command_exist?(command)\r\n basename = File.basename(command)\r\n path = +\"\"\r\n print \"Checking #{basename}: \"\r\n begin\r\n if open(\"| which #{command} 2>/dev/null\") { |f| path = f.gets.strip }\r\n puts \"detected [#{path}]\"\r\n path.strip\r\n elsif open(\"| which #{basename} 2>/dev/null\") { |f| path = f.gets.strip }\r\n puts \"detected [#{path}]\"\r\n path.strip\r\n else\r\n puts \"#{basename} not found\"\r\n false\r\n end\r\n rescue StandardError\r\n puts \"#{basename} not found\"\r\n false\r\n end\r\n end",
"def has_executable(path)\n # Be smart: If the path includes a forward slash, we're checking\n # an absolute path. Otherwise, we're checking a global executable\n if path.include?('/')\n @commands << \"test -x #{path}\"\n else\n @commands << \"[ -n \\\"`echo \\\\`which #{path}\\\\``\\\" ]\"\n end\n end",
"def command?(command)\n ENV['PATH'].split(':').any? do |directory|\n File.exists?(File.join(directory, command))\n end\nend",
"def search_command(command, macroname, force, abort)\n path = @macros[macroname]\n\n if (!path) or path == '' or force\n if path = File .which(command)\n\t@macros[macroname] = path\n end\n end\n\n if path and File .executable?(path)\n print \"#{command} is .. #{path}\\n\"\n else\n search_abort(command, macroname) if abort\n return nil\n end\n end",
"def command?(path)\n p = Pathname.new(path)\n p.relative? && p.basename == p\n end",
"def command_exists?\n COMMANDS.include? @command\n end",
"def exec_in_path(command)\n ENV['PATH'].split(':').collect {|d| Dir.entries d if Dir.exists? d}.flatten.include?(command)\n end",
"def valid_command_path?(path)\n File.exist?(path) && File.executable?(path)\n end",
"def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\n end",
"def command_exists(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end",
"def has_executable_in_path(command_name)\n return nil != find_executable_in_path(command_name)\n end",
"def include?(command)\n @commands.include?(command)\n end",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\nend",
"def exec_exixts?(name)\n `which #{name}`.start_with?('/')\n end",
"def match?(command)\n @entries.each do |entry|\n if (entry.match(command))\n return(entry.inspect)\n end\n end\n return(nil)\n end",
"def command_exist?(command)\n exts = env.fetch(\"PATHEXT\", \"\").split(::File::PATH_SEPARATOR)\n env.fetch(\"PATH\", \"\").split(::File::PATH_SEPARATOR).any? do |dir|\n file = ::File.join(dir, command)\n ::File.exist?(file) || exts.any? { |ext| ::File.exist?(\"#{file}#{ext}\") }\n end\n end",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\n end",
"def shell_command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any?{|d| File.exists? File.join(d, command) }\n end",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? do |root|\n path = File.join(root, command)\n File.executable?(path) && File.file?(path)\n end\n end",
"def command?(name)\n `which #{name}`\n $?.success?\nend",
"def command?(name)\n `which #{name}`\n $?.success?\nend",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\n end",
"def matches?(cmd)\n files_match? && file_content_match?\n end",
"def checkCommand(command)\n if $commands.include? command\n return :cmd\n elsif command.partition(' ').first == 'PLACE'\n return :placecmd\n else\n return false\n end\n end",
"def which(cmd)\n\tpaths = ENV[\"PATH\"].split(\":\")\n\tpaths.push(\"/usr/local/bin\", \"/usr/bin\", \"/bin\").uniq!\n\tpaths.each do |dir|\n\t\tfile = dir + \"/\" + cmd\n\t\tif File.file?(file) and File.executable?(file)\n\t\t\treturn true end\n\tend\n\treturn\nend",
"def has_command?(sub_command)\n commands.keys.include?(sub_command)\n end",
"def match?(cmd)\n (cmd =~ /#{inst}\\s/) != nil\n end",
"def which(cmd); end",
"def which(cmd); end",
"def which(cmd); end",
"def is_installed(path)\n File.foreach(path) do |line|\n if line.include?(@prepend_string)\n @logger.info(\"Found completion already installed in #{path}\")\n return true\n end\n end\n return false\n end",
"def find(command, commands=Boson.commands)\n command && commands.find {|e| [e.name, e.alias].include?(command) }\n end",
"def known_command?(command)\n zone = zone_from_command(command)\n @commands[zone].include? command\n rescue StandardError\n nil\n end",
"def command?(name)\n !which(name).nil?\nend",
"def command?(command)\n system(\"which #{command} > /dev/null 2>&1\")\n end",
"def command?(command)\n system(\"which #{command} > /dev/null 2>&1\")\n end",
"def contains? path\n @contents.any? do |line|\n File.fnmatch? line, path\n end\n end",
"def has_commands\n @commands.length > 0\n end",
"def which(bin, *path)\n path = path + ['/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin']\n path += ENV['PATH'].split(File::PATH_SEPARATOR)\n path.flatten.uniq.each do |dir|\n dest = File.join(dir, bin)\n return dest if FileTest.file? dest and FileTest.executable? dest\n end\n return false\n rescue StandardError => e\n logger.warn e\n return false\n end",
"def is_managed?(path)\n # Short circuit if the directory is not present\n return false unless File.directory?(path)\n\n git = Facter::Core::Execution.which('git')\n svn = Facter::Core::Execution.which('svn')\n\n Dir.chdir(path) do\n if git\n %x{#{git} ls-files . --error-unmatch &> /dev/null}\n\n return true if $?.success?\n end\n\n if svn\n %x{#{svn} info &> /dev/null}\n\n return true if $?.success?\n end\n end\n\n return false\nend",
"def plugins_respond_to?(cmd_name)\n\t\t\treturn respond_to?(\"command_#{cmd_name}\".to_sym)\n\t\tend",
"def executable?(path)\n raise \"`executable?' method does not support Windows systems\" if session.platform == 'windows'\n\n cmd_exec(\"test -x '#{path}' && echo true\").to_s.include? 'true'\n end",
"def has_successful_execution(cmd)\n @commands << cmd\n end",
"def okdir(command)\n end",
"def whichfile(cmd)\n\n Chef::Log.debug(\"Executing which #{cmd}\")\n\n shell = Mixlib::ShellOut.new(\"which \" + cmd, :env => { 'PATH' => '/usr/bin:/usr/local/bin:/bin' })\n shell.run_command\n\n unless shell.exitstatus == 0\n return false\n else\n return true\n end\nend",
"def include_command?(command)\n commands = mode_configuration\n commands.include?(command)\n end",
"def check_path_for(command)\n unless FileTest.executable?(command) || system_path.split(\":\").any?{ |path| FileTest.executable?(File.join(path, command))}\n raise ExecutableNotFoundError, command\n end\n command\n end",
"def command?(cmd)\n !!system(cmd, out: ::File::NULL, err: ::File::NULL)\n end",
"def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end",
"def valid_command?(cmd)\n cmd.scan(/^(PLACE|MOVE|LEFT|RIGHT|REPORT|EXIT)(.*)/i).any?\n end",
"def file_exists(path)\n # Use `ls` command to check file exists\n # If file exists, `ls [path]` will echo the varible `path`\n # Or `ls` command will report an error message\n # But we can not ensure that the implementation of ls command are the same on different destribution\n # So just check the success flag not error message\n # eg:\n # $ ls /etc/passwd\n # /etc/passwd\n # $ ls /etc/nosuchfile\n # ls: cannot access '/etc/nosuchfile': No such file or directory\n result = shell_command_token(\"ls #{path}\").to_s.strip\n if result.eql?(path)\n return true\n end\n return false\n end",
"def installed?(tool)\n # first: check with updatedb\n if session.locate_updatedb? == true\n out = ''\n if (session.methods.include? :cache) && session.cache.exists?(\"ls_path\")\n out = session.cache.read(\"ls_path\")\n else\n out = ''\n env_paths = get_all_path\n for path in env_paths\n out << session.updatedb_search(path).join(\"\\n\").to_s\n end\n end\n session.cache.add(\"ls_path\", out) if session.methods.include? :cache\n\n out.each_line do |line|\n line.chomp!\n return line if line =~ /\\/#{tool}$/\n end\n end\n\n # second: if cache run ls for every path once and cache it\n if session.methods.include? :cache\n out = ''\n if session.cache.exists?(\"ls_path\")\n out = session.cache.read(\"ls_path\")\n else\n env_paths = get_all_path\n # ls:\n # -m fill width with a comma separated list of entries\n cmd = \"/bin/ls -m\"\n for path in env_paths\n # adding timeout because it may need some time if many\n # tools are installed\n # out << cmd_exec(\"#{cmd} #{path}/*\", 20, 60 * 2)\n tmp = session.shell_command_token(\"#{cmd} #{path}/*\", 20, 60 * 2)\n tmp.split(',').each do |tmp_tool|\n tmp_tool.chomp!\n tmp_tool.strip!\n out << tmp_tool + \"\\n\"\n end\n end\n # out.gsub!(\"\\t\", \"\\n\")\n session.cache.add(\"ls_path\", out)\n end\n out.each_line do |line|\n line.chomp!\n return line if line =~ /\\/#{tool}$/\n end\n\n return false\n end\n\n # third: fallback: using traditional which\n out = cmd_exec(\"which #{tool}\")\n if out[0, 1] == '/'\n return out\n else\n return nil\n end\n end",
"def in_path? provided_list = provides\n apps, command_names = [*provided_list].partition {|i| i.to_s[/\\.app\\/?$/] }\n commands = command_names.versions\n apps_in_path?(apps) and cmds_in_path?(commands) and matching_versions?(commands)\n end",
"def load_commands?\n @module\n end",
"def check_exists?(path)\n # This can also be accomplished with ::File.exists? however, this demonstrates how a more complex shellout\n # command can be used to determine state\n #cmd = shell_out(\"ls #{path}\", { :returns => [0,1,2] })\n #cmd.stderr.empty? && (cmd.stdout !~ /^$/)\n ::File.exist?(path)\nend",
"def command?(name)\n !which(name).nil?\n end",
"def isExecutable(cmd)\n\treturn File.executable? cmd\nend",
"def main_commands_enabled\n $game_party.exists\n end",
"def main_commands_enabled\n $game_party.exists\n end",
"def main_commands_enabled\n $game_party.exists\n end",
"def config_repo_installed?\n cmd_test %{-d \"#{config_path}\"}\nend",
"def installed?(command)\n MakeMakefile.find_executable(command)\n end",
"def find_in_path(utility)\n path = (ENV['PATH'] || \"\").split(File::PATH_SEPARATOR)\n suffixes = self.class.on_windows? ? self.class.windows_executable_extensions : [\"\"]\n\n path.each do |dir|\n suffixes.each do |sfx|\n file = File.join(dir, utility + sfx)\n return true if File.executable?(file)\n end\n end\n\n false\n end",
"def load_commands\n subcommand_files.each { |subcommand| Kernel.load subcommand }\n true\n end",
"def load_commands\n subcommand_files.each { |subcommand| Kernel.load subcommand }\n true\n end",
"def load_commands\n subcommand_files.each { |subcommand| Kernel.load subcommand }\n true\n end",
"def stow_path_bin_exists?\n ::File.exist?(\"#{stow_path}/../bin/stow\")\n end",
"def find_command_enabled?\n $find_command_enabled ||= scanned_client_server!.features.find_command_enabled?\nend",
"def find_command_enabled?\n $find_command_enabled ||= scanned_client_server!.features.find_command_enabled?\nend",
"def execute(input: $stdin, output: $stdout)\n values = [\n ['less', exec_exist?('less')],\n ['git', exec_exist?('git')],\n ['ruby', exec_exist?('ruby')],\n ['/usr/bin/ruby', exec_exist?('/usr/bin/ruby')],\n ['go', exec_exist?('go')],\n ['fred', exec_exist?('fred')]\n ]\n\n pretty_table('Paths Exist?', %w[key exists], values)\n\n :gui\n end",
"def which(cmd, extra_path: %w{/bin /usr/bin /sbin /usr/sbin}, path: nil)\n # If it was already absolute, just return that.\n return cmd if cmd =~ /^(\\/|([a-z]:)?\\\\)/i\n # Allow passing something other than the real env var.\n path ||= ENV['PATH']\n # Based on Chef::Mixin::Which#which\n # Copyright 2010-2015, Chef Softare, Inc.\n paths = path.split(File::PATH_SEPARATOR) + extra_path\n paths.each do |candidate_path|\n filename = ::File.join(candidate_path, cmd)\n return filename if ::File.executable?(filename)\n end\n false\n end",
"def in_path?(name)\n (`which #{name}`).to_s.strip.size > 0\n end",
"def has_shortcuts?(cmd)\n command_shortcuts(cmd)\n end",
"def validate_command_path\n command = self.command\n # TODO/REFACTOR: We're finding the command using everything until the first space. Kind of lame...\n command_executable = command.match(/(^[^\\s]+)/).try(:[], 1) # Get the name of the actual command\n unless command_executable.present?\n errors.add(:command, \"must contain a valid, executable system command.\")\n return false\n end\n\n cmd_abs_path = `which #{command_executable}`.chomp # Check for existance in executable path, get full path\n unless $?.to_i == 0\n errors.add(:command, \"must contain a valid, executable system command.\")\n return false\n end\n\n if cmd_abs_path == command_executable\n return true\n else\n # TODO/REFACTOR: We're finding the command using everything until the first space. Kind of lame...\n self.command = command.sub(/(^[^\\s]+)/, cmd_abs_path); # Replace command with full-path command\n return true\n end\n end",
"def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end",
"def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end",
"def exec_exist?(*args)\n require \"tty-which\"\n TTY::Which.exist?(*args)\n end",
"def relative_command?(path)\n p = Pathname.new(path)\n p.relative? && p.basename != p\n end",
"def command?(command)\n MakeMakefile::Logging.instance_variable_set :@logfile, File::NULL\n MakeMakefile::Logging.quiet = true\n MakeMakefile.find_executable command.to_s\n end",
"def file_exists?(path)\n parse_boolean(transport.execute(\"Test-Path #{escape(path)}\", :read_only => true).stdout)\n end",
"def installed?\n ::File.exist?(PATH)\n end",
"def has_command!(name, referer = self.class)\n name.split(':').inject(referer){|cur,look|\n cur.const_get(command2module(look))\n }\n rescue NameError => ex\n raise NoSuchCommand, \"No such command #{name}\", ex.backtrace\n end",
"def file_exists?(path)\n result = transport.execute(\"ls -d #{path}\")\n result.exitstatus == 0 && result.stdout != ''\n end",
"def exist?(path)\n found = true\n run_via \"head -1 #{path} >/dev/null 2>&1 || echo $?\" do |channel, stream, data|\n if data =~ /^(\\d+)/\n if $1.to_i > 0\n logger.trace \"Not found\"\n found = false \n end\n end\n end\n found\n end",
"def which!(cmd)\n found = which(cmd)\n throw \"I could not find #{cmd}\" if found.nil?\n found\nend",
"def unknown_command(method, line)\n\n\t\t[method, method+\".exe\"].each do |cmd|\n\t\t\tif (command_passthru == true and Rex::FileUtils.find_full_path(cmd))\n\n\t\t\t\tprint_status(\"exec: #{line}\")\n\t\t\t\tprint_line('')\n\n\t\t\t\tself.busy = true\n\t\t\t\tbegin\n\t\t\t\t\tio = ::IO.popen(line, \"r\")\n\t\t\t\t\tio.each_line do |data|\n\t\t\t\t\t\tprint(data)\n\t\t\t\t\tend\n\t\t\t\t\tio.close\n\t\t\t\trescue ::Errno::EACCES, ::Errno::ENOENT\n\t\t\t\t\tprint_error(\"Permission denied exec: #{line}\")\n\t\t\t\tend\n\t\t\t\tself.busy = false\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\n\t\tsuper\n\tend",
"def command?(name)\n !which(name).nil?\n end",
"def command? command\n Commands.method_defined? command\n end",
"def command? command\n Commands.method_defined? command\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 which command\n require 'open3'\n Open3.popen3(\"which #{command}\") do |stdin, stdout, stderr, wait_thr|\n if wait_thr.value.to_i == 0\n availability = true\n else\n availability = false\n end\n return availability\n end\n end",
"def search(f_name) \r\n yield ENV['PATH'].split(';').map {|p| File.join p, f_name}.find {|p| File.file? p and File.executable? p}\r\nend"
] |
[
"0.734286",
"0.72677845",
"0.7204347",
"0.7204347",
"0.71495306",
"0.68601066",
"0.68000686",
"0.67995626",
"0.67675847",
"0.6755701",
"0.66697246",
"0.6572039",
"0.6554533",
"0.6524722",
"0.6480451",
"0.645957",
"0.6427544",
"0.6405467",
"0.64004755",
"0.63667154",
"0.6351046",
"0.6288546",
"0.62805915",
"0.62771386",
"0.62557536",
"0.6243811",
"0.6235904",
"0.6235093",
"0.6235093",
"0.6227919",
"0.62232816",
"0.61984825",
"0.61886764",
"0.61719596",
"0.6139898",
"0.6135587",
"0.6135587",
"0.6135587",
"0.61076665",
"0.60932326",
"0.6092073",
"0.6067342",
"0.6063491",
"0.6063491",
"0.6042063",
"0.60370946",
"0.60274804",
"0.6010449",
"0.60038316",
"0.600205",
"0.5993329",
"0.59878546",
"0.5986634",
"0.5973765",
"0.596875",
"0.5963393",
"0.59425145",
"0.59290946",
"0.5916527",
"0.59114903",
"0.590922",
"0.59084564",
"0.5905902",
"0.589583",
"0.5888543",
"0.5879606",
"0.5879606",
"0.5879606",
"0.58764064",
"0.58720297",
"0.5864221",
"0.58582664",
"0.58582664",
"0.58582664",
"0.58440334",
"0.5836736",
"0.5836736",
"0.582957",
"0.5827441",
"0.582557",
"0.5818409",
"0.5814492",
"0.57876056",
"0.57876056",
"0.5786476",
"0.57754946",
"0.57713896",
"0.5750341",
"0.57498163",
"0.57474065",
"0.5717668",
"0.5711483",
"0.57099223",
"0.5699729",
"0.56977",
"0.569582",
"0.569582",
"0.56945395",
"0.5689935",
"0.568992"
] |
0.75232357
|
0
|
found returns false for commands not found in path
|
def test_found_returns_false_for_commands_not_found_in_path
Crd::Flex::Command.new 'madeupcommandname' do |s|
assert_equal( false, s.found? )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cmds_in_path? commands = provides, custom_cmd_dir = nil\n present, missing = [*commands].partition {|cmd_name| cmd_dir(cmd_name) }\n ours, other = if custom_cmd_dir\n present.partition {|cmd_name| cmd_dir(cmd_name) == custom_cmd_dir }\n else\n present.partition {|cmd_name| pkg_manager.cmd_in_path? cmd_name }\n end\n\n if !ours.empty? and !other.empty?\n log_error \"The commands for #{name} run from more than one place.\"\n log \"#{cmd_location_str_for ours}, but #{cmd_location_str_for other}.\"\n :fail\n else\n returning missing.empty? do |result|\n if result\n log cmd_location_str_for(ours.empty? ? other : ours)\n else\n log \"#{missing.map {|i| \"'#{i}'\" }.to_list} #{missing.length == 1 ? 'is' : 'are'} missing.\"\n end\n end\n end\n end",
"def command_found; end",
"def command_exists?\n File.exists? self.command_file\n end",
"def test_found_returns_true_for_commands_found_in_path\n Crd::Flex::Command.new 'mxmlc' do |s|\n assert_equal( true, s.found? )\n end\n end",
"def command_available?(command)\n find = Releasy.win_platform? ? \"where\" : \"which\"\n # Call this Kernel version of `` so it can be mocked in testing.\n result = Kernel.`(\"#{find} #{command}\")\n return false unless $? == 0\n result\n end",
"def command_in_path?(command)\n found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|\n File.exist?(File.join(p, command))\n end\n found.include?(true)\n end",
"def command_in_path?(command)\n found = ENV['PATH'].split(File::PATH_SEPARATOR).map do |p|\n File.exist?(File.join(p, command))\n end\n found.include?(true)\n end",
"def command_exist?(command)\r\n basename = File.basename(command)\r\n path = +\"\"\r\n print \"Checking #{basename}: \"\r\n begin\r\n if open(\"| which #{command} 2>/dev/null\") { |f| path = f.gets.strip }\r\n puts \"detected [#{path}]\"\r\n path.strip\r\n elsif open(\"| which #{basename} 2>/dev/null\") { |f| path = f.gets.strip }\r\n puts \"detected [#{path}]\"\r\n path.strip\r\n else\r\n puts \"#{basename} not found\"\r\n false\r\n end\r\n rescue StandardError\r\n puts \"#{basename} not found\"\r\n false\r\n end\r\n end",
"def has_executable(path)\n # Be smart: If the path includes a forward slash, we're checking\n # an absolute path. Otherwise, we're checking a global executable\n if path.include?('/')\n @commands << \"test -x #{path}\"\n else\n @commands << \"[ -n \\\"`echo \\\\`which #{path}\\\\``\\\" ]\"\n end\n end",
"def command?(command)\n ENV['PATH'].split(':').any? do |directory|\n File.exists?(File.join(directory, command))\n end\nend",
"def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\n end",
"def has_executable_in_path(command_name)\n return nil != find_executable_in_path(command_name)\n end",
"def valid_command_path?(path)\n File.exist?(path) && File.executable?(path)\n end",
"def has_executable(path)\n # Be smart: If the path includes a forward slash, we're checking\n # an absolute path. Otherwise, we're checking a global executable\n if path.include?('/')\n @commands << \"test -x #{path}\"\n else\n @commands << \"[ -n \\\"`echo \\\\`which #{path}\\\\``\\\" ]\"\n end\n end",
"def command_exists?\n COMMANDS.include? @command\n end",
"def command_exists(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n }\n end\n return nil\n end",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\nend",
"def search_command(command, macroname, force, abort)\n path = @macros[macroname]\n\n if (!path) or path == '' or force\n if path = File .which(command)\n\t@macros[macroname] = path\n end\n end\n\n if path and File .executable?(path)\n print \"#{command} is .. #{path}\\n\"\n else\n search_abort(command, macroname) if abort\n return nil\n end\n end",
"def command?(name)\n !which(name).nil?\nend",
"def command_exist?(command)\n exts = env.fetch(\"PATHEXT\", \"\").split(::File::PATH_SEPARATOR)\n env.fetch(\"PATH\", \"\").split(::File::PATH_SEPARATOR).any? do |dir|\n file = ::File.join(dir, command)\n ::File.exist?(file) || exts.any? { |ext| ::File.exist?(\"#{file}#{ext}\") }\n end\n end",
"def shell_command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any?{|d| File.exists? File.join(d, command) }\n end",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\n end",
"def exec_exixts?(name)\n `which #{name}`.start_with?('/')\n end",
"def command?(path)\n p = Pathname.new(path)\n p.relative? && p.basename == p\n end",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? {|d| File.exists? File.join(d, command) }\n end",
"def command_exists?(command)\n ENV['PATH'].split(File::PATH_SEPARATOR).any? do |root|\n path = File.join(root, command)\n File.executable?(path) && File.file?(path)\n end\n end",
"def command?(name)\n `which #{name}`\n $?.success?\nend",
"def command?(name)\n `which #{name}`\n $?.success?\nend",
"def command?(command)\n system(\"which #{command} > /dev/null 2>&1\")\n end",
"def command?(command)\n system(\"which #{command} > /dev/null 2>&1\")\n end",
"def checkCommand(command)\n if $commands.include? command\n return :cmd\n elsif command.partition(' ').first == 'PLACE'\n return :placecmd\n else\n return false\n end\n end",
"def command?(name)\n !which(name).nil?\n end",
"def check_path_for(command)\n unless FileTest.executable?(command) || system_path.split(\":\").any?{ |path| FileTest.executable?(File.join(path, command))}\n raise ExecutableNotFoundError, command\n end\n command\n end",
"def command?(cmd)\n !!system(cmd, out: ::File::NULL, err: ::File::NULL)\n end",
"def known_command?(command)\n zone = zone_from_command(command)\n @commands[zone].include? command\n rescue StandardError\n nil\n end",
"def command?(name)\n !which(name).nil?\n end",
"def include?(command)\n @commands.include?(command)\n end",
"def has_command?(sub_command)\n commands.keys.include?(sub_command)\n end",
"def check_command_existence(cmd_name)\n\tret = `type #{cmd_name} 1>/dev/null 2>/dev/null`\n\treturn $?.exitstatus == 0 ? true : false\nend",
"def which!(cmd)\n found = which(cmd)\n throw \"I could not find #{cmd}\" if found.nil?\n found\nend",
"def validate_command_path\n command = self.command\n # TODO/REFACTOR: We're finding the command using everything until the first space. Kind of lame...\n command_executable = command.match(/(^[^\\s]+)/).try(:[], 1) # Get the name of the actual command\n unless command_executable.present?\n errors.add(:command, \"must contain a valid, executable system command.\")\n return false\n end\n\n cmd_abs_path = `which #{command_executable}`.chomp # Check for existance in executable path, get full path\n unless $?.to_i == 0\n errors.add(:command, \"must contain a valid, executable system command.\")\n return false\n end\n\n if cmd_abs_path == command_executable\n return true\n else\n # TODO/REFACTOR: We're finding the command using everything until the first space. Kind of lame...\n self.command = command.sub(/(^[^\\s]+)/, cmd_abs_path); # Replace command with full-path command\n return true\n end\n end",
"def which(cmd); end",
"def which(cmd); end",
"def which(cmd); end",
"def has_command!(name, referer = self.class)\n name.split(':').inject(referer){|cur,look|\n cur.const_get(command2module(look))\n }\n rescue NameError => ex\n raise NoSuchCommand, \"No such command #{name}\", ex.backtrace\n end",
"def match?(cmd)\n (cmd =~ /#{inst}\\s/) != nil\n end",
"def valid_command?(cmd)\n cmd.scan(/^(PLACE|MOVE|LEFT|RIGHT|REPORT|EXIT)(.*)/i).any?\n end",
"def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end",
"def exec_in_path(command)\n ENV['PATH'].split(':').collect {|d| Dir.entries d if Dir.exists? d}.flatten.include?(command)\n end",
"def whichfile(cmd)\n\n Chef::Log.debug(\"Executing which #{cmd}\")\n\n shell = Mixlib::ShellOut.new(\"which \" + cmd, :env => { 'PATH' => '/usr/bin:/usr/local/bin:/bin' })\n shell.run_command\n\n unless shell.exitstatus == 0\n return false\n else\n return true\n end\nend",
"def which(cmd)\n\tpaths = ENV[\"PATH\"].split(\":\")\n\tpaths.push(\"/usr/local/bin\", \"/usr/bin\", \"/bin\").uniq!\n\tpaths.each do |dir|\n\t\tfile = dir + \"/\" + cmd\n\t\tif File.file?(file) and File.executable?(file)\n\t\t\treturn true end\n\tend\n\treturn\nend",
"def isExecutable(cmd)\n\treturn File.executable? cmd\nend",
"def plugins_respond_to?(cmd_name)\n\t\t\treturn respond_to?(\"command_#{cmd_name}\".to_sym)\n\t\tend",
"def check_exists?(path)\n # This can also be accomplished with ::File.exists? however, this demonstrates how a more complex shellout\n # command can be used to determine state\n #cmd = shell_out(\"ls #{path}\", { :returns => [0,1,2] })\n #cmd.stderr.empty? && (cmd.stdout !~ /^$/)\n ::File.exist?(path)\nend",
"def has_commands\n @commands.length > 0\n end",
"def command?(command)\n MakeMakefile::Logging.instance_variable_set :@logfile, File::NULL\n MakeMakefile::Logging.quiet = true\n MakeMakefile.find_executable command.to_s\n end",
"def config_repo_installed?\n cmd_test %{-d \"#{config_path}\"}\nend",
"def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end",
"def exec_exist?(*args)\n require 'tty-which'\n TTY::Which.exist?(*args)\n end",
"def exec_exist?(*args)\n require \"tty-which\"\n TTY::Which.exist?(*args)\n end",
"def have_command?(command)\n # May be shell-dependent, OS-dependent\n # Kernel#system does not raise Errno::ENOENT when running under the Bundler\n !`which #{command}`.empty?\n end",
"def executable?(path)\n raise \"`executable?' method does not support Windows systems\" if session.platform == 'windows'\n\n cmd_exec(\"test -x '#{path}' && echo true\").to_s.include? 'true'\n end",
"def check(exec, name, url, install=nil)\n return unless `which #{exec}`.empty?\n \n puts \"#{name} not found. (#{url})\"\n puts \"\\nInstall via:\\n#{install}\" if install\n\n exit(1)\nend",
"def okdir(command)\n end",
"def has_shortcuts?(cmd)\n command_shortcuts(cmd)\n end",
"def find(command, commands=Boson.commands)\n command && commands.find {|e| [e.name, e.alias].include?(command) }\n end",
"def installed?(command)\n MakeMakefile.find_executable(command)\n end",
"def stow_path_bin_exists?\n ::File.exist?(\"#{stow_path}/../bin/stow\")\n end",
"def check_for_executable; end",
"def file_exists(path)\n # Use `ls` command to check file exists\n # If file exists, `ls [path]` will echo the varible `path`\n # Or `ls` command will report an error message\n # But we can not ensure that the implementation of ls command are the same on different destribution\n # So just check the success flag not error message\n # eg:\n # $ ls /etc/passwd\n # /etc/passwd\n # $ ls /etc/nosuchfile\n # ls: cannot access '/etc/nosuchfile': No such file or directory\n result = shell_command_token(\"ls #{path}\").to_s.strip\n if result.eql?(path)\n return true\n end\n return false\n end",
"def relative_command?(path)\n p = Pathname.new(path)\n p.relative? && p.basename != p\n end",
"def match?(command)\n @entries.each do |entry|\n if (entry.match(command))\n return(entry.inspect)\n end\n end\n return(nil)\n end",
"def command?(name)\n __getobj__.present?(name)\n end",
"def load_commands?\n @module\n end",
"def command? command\n Commands.method_defined? command\n end",
"def command? command\n Commands.method_defined? command\n end",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def check(exec, name, url)\n return unless `which #{exec}`.empty?\n puts \"#{name} not found.\\nInstall it from #{url}\"\n exit\nend",
"def is_command_valid?(command)\n\t\tAVAILABLE_COMMANDS.include?(command)\n\tend",
"def in_path?(name)\n (`which #{name}`).to_s.strip.size > 0\n end",
"def valid_command?(command)\n\t\tVALID_COMMANDS.include?(command)\n\tend",
"def is_managed?(path)\n # Short circuit if the directory is not present\n return false unless File.directory?(path)\n\n git = Facter::Core::Execution.which('git')\n svn = Facter::Core::Execution.which('svn')\n\n Dir.chdir(path) do\n if git\n %x{#{git} ls-files . --error-unmatch &> /dev/null}\n\n return true if $?.success?\n end\n\n if svn\n %x{#{svn} info &> /dev/null}\n\n return true if $?.success?\n end\n end\n\n return false\nend",
"def requireCMD(cmdName, extraHelp = nil)\n\n if(cmdName.start_with? \"./\" or File.exists? cmdName)\n # Skip relative paths\n return\n end\n\n if which(cmdName) != nil\n # Command found\n return\n end\n\n # Windows specific checks\n if OS.windows?\n # There are a bunch of inbuilt stuff that aren't files so ignore them here\n case cmdName\n when \"call\"\n return\n when \"start\"\n return\n when \"mklink\"\n return\n end\n end\n\n # Print current search path\n puts \"\"\n info \"The following paths were searched for \" +\n pathExtsAsArray.map{|i| \"'#{cmdName}#{i}'\"}.join(' or ') + \" but it wasn't found:\"\n\n pathAsArray.each{|p|\n puts p\n }\n \n onError \"Required program / tool '#{cmdName}' is not installed or missing from path.\\n\" +\n \"Please install it and make sure it is in path, then try again. \" +\n \"(path is printed above for reference)\" + (\n if extraHelp then \" \" + extraHelp else \"\" end) \n \nend",
"def unknown_command(method, line)\n\n\t\t[method, method+\".exe\"].each do |cmd|\n\t\t\tif (command_passthru == true and Rex::FileUtils.find_full_path(cmd))\n\n\t\t\t\tprint_status(\"exec: #{line}\")\n\t\t\t\tprint_line('')\n\n\t\t\t\tself.busy = true\n\t\t\t\tbegin\n\t\t\t\t\tio = ::IO.popen(line, \"r\")\n\t\t\t\t\tio.each_line do |data|\n\t\t\t\t\t\tprint(data)\n\t\t\t\t\tend\n\t\t\t\t\tio.close\n\t\t\t\trescue ::Errno::EACCES, ::Errno::ENOENT\n\t\t\t\t\tprint_error(\"Permission denied exec: #{line}\")\n\t\t\t\tend\n\t\t\t\tself.busy = false\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\n\t\tsuper\n\tend",
"def include_command?(command)\n commands = mode_configuration\n commands.include?(command)\n end",
"def main_commands_enabled\n $game_party.exists\n end",
"def main_commands_enabled\n $game_party.exists\n end",
"def main_commands_enabled\n $game_party.exists\n end",
"def which(bin, *path)\n path = path + ['/usr/bin', '/usr/sbin', '/usr/local/bin', '/usr/local/sbin']\n path += ENV['PATH'].split(File::PATH_SEPARATOR)\n path.flatten.uniq.each do |dir|\n dest = File.join(dir, bin)\n return dest if FileTest.file? dest and FileTest.executable? dest\n end\n return false\n rescue StandardError => e\n logger.warn e\n return false\n end",
"def matches?(cmd)\n files_match? && file_content_match?\n end",
"def which(cmd, extra_path: %w{/bin /usr/bin /sbin /usr/sbin}, path: nil)\n # If it was already absolute, just return that.\n return cmd if cmd =~ /^(\\/|([a-z]:)?\\\\)/i\n # Allow passing something other than the real env var.\n path ||= ENV['PATH']\n # Based on Chef::Mixin::Which#which\n # Copyright 2010-2015, Chef Softare, Inc.\n paths = path.split(File::PATH_SEPARATOR) + extra_path\n paths.each do |candidate_path|\n filename = ::File.join(candidate_path, cmd)\n return filename if ::File.executable?(filename)\n end\n false\n end",
"def installed?(tool)\n # first: check with updatedb\n if session.locate_updatedb? == true\n out = ''\n if (session.methods.include? :cache) && session.cache.exists?(\"ls_path\")\n out = session.cache.read(\"ls_path\")\n else\n out = ''\n env_paths = get_all_path\n for path in env_paths\n out << session.updatedb_search(path).join(\"\\n\").to_s\n end\n end\n session.cache.add(\"ls_path\", out) if session.methods.include? :cache\n\n out.each_line do |line|\n line.chomp!\n return line if line =~ /\\/#{tool}$/\n end\n end\n\n # second: if cache run ls for every path once and cache it\n if session.methods.include? :cache\n out = ''\n if session.cache.exists?(\"ls_path\")\n out = session.cache.read(\"ls_path\")\n else\n env_paths = get_all_path\n # ls:\n # -m fill width with a comma separated list of entries\n cmd = \"/bin/ls -m\"\n for path in env_paths\n # adding timeout because it may need some time if many\n # tools are installed\n # out << cmd_exec(\"#{cmd} #{path}/*\", 20, 60 * 2)\n tmp = session.shell_command_token(\"#{cmd} #{path}/*\", 20, 60 * 2)\n tmp.split(',').each do |tmp_tool|\n tmp_tool.chomp!\n tmp_tool.strip!\n out << tmp_tool + \"\\n\"\n end\n end\n # out.gsub!(\"\\t\", \"\\n\")\n session.cache.add(\"ls_path\", out)\n end\n out.each_line do |line|\n line.chomp!\n return line if line =~ /\\/#{tool}$/\n end\n\n return false\n end\n\n # third: fallback: using traditional which\n out = cmd_exec(\"which #{tool}\")\n if out[0, 1] == '/'\n return out\n else\n return nil\n end\n end",
"def installed?\n ::File.exist?(PATH)\n end",
"def which(cmd)\n\t system(\"which #{ cmd} > /dev/null 2>&1\")\n\tend",
"def requireCMD(cmd_name, extraHelp = nil)\n if cmd_name.start_with?('./') || File.exist?(cmd_name)\n # Skip relative paths\n return\n end\n\n unless which(cmd_name).nil?\n # Command found\n return\n end\n\n # Windows specific checks\n if OS.windows?\n # There are a bunch of inbuilt stuff that aren't files so ignore them here\n case cmd_name\n when 'call'\n return\n when 'start'\n return\n when 'mklink'\n return\n end\n end\n\n # Print current search path\n puts ''\n info 'The following paths were searched for ' +\n pathExtsAsArray.map { |i| \"'#{cmd_name}#{i}'\" }.join(' or ') + \" but it wasn't found:\"\n\n pathAsArray.each do |p|\n puts p\n end\n\n onError \"Required program / tool '#{cmd_name}' is not installed or missing from path.\\n\" \\\n 'Please install it and make sure it is in path, then try again. ' \\\n '(path is printed above for reference)' + (\n extraHelp ? ' ' + extraHelp : '')\nend",
"def which command\n require 'open3'\n Open3.popen3(\"which #{command}\") do |stdin, stdout, stderr, wait_thr|\n if wait_thr.value.to_i == 0\n availability = true\n else\n availability = false\n end\n return availability\n end\n end",
"def environmentOK?()\n\tcommandsMissing = []\n\tNEEDED_COMMANDS.each{ |command|\n\t\tif !which(command)\n\t\t\tcommandsMissing.push(command)\n\t\tend\n\t}\n\tif commandsMissing.size > 0\n\tputs \"You are missing following programs:\\n\"\n\tcommandsMissing.each { |command|\n\t\tputs \"\\t#{command}\\n\"\n\t}\n\treturn false\n\tend\n\treturn true\nend"
] |
[
"0.75767535",
"0.7559685",
"0.7533789",
"0.7528143",
"0.7427609",
"0.7412547",
"0.7412547",
"0.73862094",
"0.71920097",
"0.7176774",
"0.7171674",
"0.71709985",
"0.715777",
"0.7150228",
"0.71192884",
"0.7086153",
"0.7013274",
"0.69986874",
"0.6954254",
"0.6953138",
"0.6944452",
"0.69290453",
"0.6907073",
"0.6896657",
"0.68886524",
"0.68854237",
"0.6879997",
"0.6879997",
"0.6861981",
"0.6861981",
"0.68176025",
"0.68084526",
"0.6776803",
"0.668117",
"0.66653824",
"0.66521937",
"0.6632803",
"0.66158015",
"0.6593976",
"0.6579413",
"0.6574348",
"0.6537522",
"0.6537522",
"0.6537522",
"0.6524352",
"0.6522126",
"0.65196145",
"0.6516441",
"0.6506695",
"0.6492267",
"0.6471207",
"0.6464109",
"0.6455965",
"0.6428873",
"0.64175004",
"0.6412706",
"0.63765997",
"0.63666916",
"0.63666916",
"0.6360815",
"0.6353553",
"0.6349206",
"0.6341699",
"0.63386995",
"0.6338195",
"0.6335372",
"0.6333417",
"0.6329797",
"0.63289756",
"0.63273734",
"0.6314335",
"0.63123053",
"0.6306809",
"0.6293121",
"0.6288675",
"0.6288675",
"0.6284164",
"0.6284164",
"0.6284164",
"0.6284164",
"0.6284164",
"0.62815654",
"0.6281291",
"0.6274765",
"0.6270627",
"0.6268744",
"0.62597764",
"0.6232863",
"0.6228218",
"0.6228218",
"0.6228218",
"0.62103736",
"0.62041515",
"0.61981446",
"0.61791795",
"0.616295",
"0.6161298",
"0.61475444",
"0.61387104",
"0.6123098"
] |
0.7704929
|
0
|
can pass hash to constructor and have arguments be created before passing to block
|
def test_can_pass_hash_to_constructor_and_have_arguments_be_created_before_passing_to_block
opts = { :output => 'Main.swf', :library_path => [ 'libs/bin', 'libs/swc' ] }
Crd::Flex::Command.new 'mxmlc', opts do |s|
assert_equal( 'Main.swf', s.output )
assert_equal( [ 'libs/bin', 'libs/swc' ], s.library_path )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize args = {}\n hash_make args, Block::ARG_SPECS\n @initial_params = collect_params\n end",
"def initialize args\n hash_make args, BlockState::ARG_SPECS\n end",
"def create_hash(&block); end",
"def create_hash(&block); end",
"def initialize\n @block_args = []\n end",
"def call\n from_hash if hash_definition.any?\n\n instance_exec(&@block) unless @block.nil?\n end",
"def initialize(&block)\n @block = block\n end",
"def initialize(&block)\n @block = block\n end",
"def initialize(&block)\n instance_eval(&block) if block_given?\n end",
"def initialize(params ={}, &block)\n super\n instance_eval &block\n end",
"def initialize(&block)\n @block = block\n end",
"def initialize(&block)\n instance_eval(&block) if block_given?\n end",
"def new_hash(*args, &block)\n if block\n r = hash_class.new\n r.default = block\n r\n elsif args.size == 1\n value = args.first\n if value.is_a?(Hash) or value.is_a?(hash_class)\n r = hash_class.new\n r.putAll(value)\n r\n else\n r = hash_class.new\n r.default = value\n r\n end\n else\n r = hash_class.new\n args.each_slice(2) {|key,val| r.put(key,val)}\n r\n end\n end",
"def initialize hashed_args\n hash_make hashed_args, Signal::ARG_SPECS\n end",
"def initialize(field, &block)\n @hash = { field: field }\n @block = block\n end",
"def initialize(*args)\n @hash = HashWithIndifferentAccess.new(*args)\n end",
"def initialize hash\n @hash = hash\n end",
"def hash(*args, **_arg1, &block); end",
"def initialize(attributes = {}, &block)\n super\n self.value = attributes.delete(:value) \n self.bucket = attributes.delete(:bucket)\n yield self if block_given?\n end",
"def initialize(key, value = nil, &block)\n @key = key\n @value = value\n\n if block_given?\n @block = block\n else\n @block = nil\n end\n end",
"def initialize(&block)\n instance_exec(&block) if block_given?\n end",
"def construct( &block )\n self.instance_eval(&block)\n @options\n end",
"def initialize(*args)\n super\n # hash = {}\n end",
"def initialize(*args)\n raise \"No block was given.\" unless block_given?\n \n super(*args) do\n begin\n yield(*args)\n rescue SystemExit, Interrupt\n raise\n rescue Exception => e\n print \"#{Knj::Errors.error_str(e)}\\n\\n\"\n end\n end\n \n @data = {}\n end",
"def initialize(source_hash = T.unsafe(nil), default = T.unsafe(nil), &blk); end",
"def initialize(&block)\n @required_options = []\n instance_exec &block\n end",
"def initialize(options={},&block)\n @mode = options.fetch(:mode,:encrypt).to_sym\n @block_size = options.fetch(:block_size,DEFAULT_BLOCK_SIZE).to_i\n @key_size = options.fetch(:key_size,DEFAULT_KEY_SIZE).to_i\n @iv = options.fetch(:iv,DEFAULT_IV).to_s\n @hash = options.fetch(:hash,DEFAULT_HASH).to_s.downcase\n @key = if options[:key]\n options[:key].to_s\n elsif (password = options[:password])\n begin\n Digest.const_get(@hash.upcase).hexdigest(password)\n rescue RuntimeError => e\n raise(InvalidHash,\"invalid hash name #{@hash.dump}\")\n end\n end\n\n yield self if block_given?\n end",
"def create_block_object(&block)\n block\nend",
"def block=(_arg0); end",
"def block=(_arg0); end",
"def initialize(&block)\r\n yield(self) if block_given? \r\n end",
"def initialize(hash = nil)\n @arguments = 0\n return if hash.nil?\n @name = hash['name']\n @arguments = hash['arguments']\n end",
"def initialize (&block)\n instance_exec(&block)\n end",
"def initialize(args={}, &block)\n @args = args\n @targets = []\n if block\n self.instance_eval(&block)\n end\n end",
"def initialize(state, &block)\n if nil == state\n raise \"Passed nil to initialize. Generally disallowed.\"\n end\n @state = state\n @fields = {}\n # @context = context\n # @vars = Hashie::Mash.new(vars)\n\n instance_eval &block\n end",
"def initialize(*data_args)\n initialize_data(*data_args)\n yield self if block_given?\n end",
"def initialize(optHash)\n @optHash=optHash\n setParameters()\nend",
"def initialize(hash={})\n # assign the attributes here (???)\n hash.each do |k, v| # name = id, name, etc.\n self.send(\"#{k}=\", v)\n # self.k = v # there's no '.k' method\n #binding.pry\n end\n end",
"def initialize hash={}\n @hash = Hash.new\n\n hash.each do |key, value|\n key = key.to_sym unless key.is_a? Symbol\n @hash[key] = value\n end\n\n @hash.each do |name, node|\n @hash[name] = self.class.send(:__blobjectify__, node)\n end\n\n yield self if block_given?\n end",
"def initialize(*)\n super\n yield self if block_given?\n end",
"def initialize(block_arg = nil, &block)\n @block = block || block_arg\n @run = false\n @ivars = {}\n if !@block\n raise ArgumentError, \"needs a block.\"\n end\n end",
"def initialize(options = {}, &block)\n\t\t \n\t\t\tyield self unless block == nil\n\t\tend",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize(symbol, options, &block)\n @symbol, @options, @block = symbol,options,block\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize(hash={}, &block)\n @spectrum_queries = []\n merge!(hash, &block)\n block.call(block_arg) if block\n end",
"def initialize(&block)\n yield self\n end",
"def initialize\n yield( self ) if block_given? # allow setup with code block\n end",
"def initialize(*args)\n extend RsgeUtil\n\n yield self if block_given?\n\n if (args[0] != nil)\n conf = args[0]\n else\n conf = Hash.new\n end\n\n raise ArgumentError, \"Argument is not a hash! #{conf.class} #{conf}\" if conf.class != Hash\n\n # We're a valid job unless we run into some condition\n self.valid = true\n\n if conf.has_key?(:jobid)\n parse_job_by_id conf\n end\n end",
"def initialize(data=nil, &block)\n @table = ::Hash.new(&block)\n update!(data || {})\n end",
"def initialize(owner_class, *args, &block); end",
"def initialize\n @h = new_hash\n end",
"def initialize(hash={})\n @hash = hash\n end",
"def initialize(*args)\n args.each do |arg|\n if arg.kind_of? Hash\n arg.each do |k,v|\n self.send(\"#{k}=\", v)\n end\n end\n end\n end",
"def initialize symbol, *args, &block\n @symbol = symbol.to_sym\n @args = args\n @block = block\n end",
"def initialize args={}\n assign(args)\n end",
"def initialize(a_hash)\n from_h(a_hash)\n end",
"def initialize(argument_types, block)\n @argument_types = argument_types\n @number_of_arguments = argument_types.size\n @block = block\n end",
"def initialize(_options = {}, &block)\n yield self unless block.nil?\n end",
"def initialize(object, **context)\n @object = wrap_hash_into_struct(object)\n @context = context\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def initialize\n yield self if block_given?\n end",
"def make_block args\n raise ArgumentError, \"args does not have :sample_rate key\" unless args.has_key?(:sample_rate)\n \n klass = find_class(@class_sym)\n block = klass.new :sample_rate => args[:sample_rate]\n block.restore_state self\n \n return block\n end",
"def initialize(*h)\n if h.length == 1 && h.first.kind_of?(Hash)\n h.first.each do |k,v| \n if !respond_to? \"#{k}\"\n self.class_eval(\"def #{k};@#{k};end\")\n self.class_eval(\"def #{k}=(val);@#{k}=val;end\")\n end\n send(\"#{k}=\",v) \n end\n end\n end",
"def initialize(&block)\n configure(&block) if block_given?\n end",
"def initialize(hash)\n super(hash)\n end",
"def initialize hashed_args\n new_args = DEFAULT_ARGS.merge(hashed_args)\n \n @type = new_args[:type]\n if @type.is_a?(Enumerable)\n @type.each do |type|\n raise ArgumentError, \"#{type} is not a Class\" unless type.is_a?(Class)\n end\n else\n raise ArgumentError, \"#{@type} is not a Class\" unless @type.is_a?(Class)\n end\n \n @validator = new_args[:validator]\n @reqd = new_args[:reqd]\n \n unless @reqd\n msg = \"if hashed arg is not required, a default value or value generator (proc) must be defined via :default key\"\n raise ArgumentError, msg unless new_args.has_key?(:default)\n @default = new_args[:default]\n end\n end",
"def initialize(options={}, &block)\n super(options)\n\n block.call(self) # Allow for population of data with a block during initialization.\n end",
"def initialize(name)\n @block = ->(*args) { new(*args).public_send(name) }\n end",
"def initialize(name)\n @block = ->(*args) { new(*args).public_send(name) }\n end",
"def initialize(options = {})\n options.each do |key, value|\n send(:\"#{key}=\", value)\n end\n yield self if block_given?\n end",
"def _klass_new(*args, &block)\n inst = super()\n inst._set_self(_self)\n inst._struct_class = _struct_class\n if args.first.is_a?(::Hash)\n inst._load(args.first)\n end\n if block\n inst.build!(&block)\n end\n inst\n end",
"def test_basic_builder\n block_ = proc do\n set_value(:a, 1)\n set_value_by_block(:b){ 2 }\n end\n hash_ = Hash.new\n Blockenspiel.invoke(block_) do\n add_method(:set_value) do |key_, value_|\n hash_[key_] = value_\n end\n add_method(:set_value_by_block, :receive_block => true) do |key_, bl_|\n hash_[key_] = bl_.call\n end\n end\n assert_equal(1, hash_[:a])\n assert_equal(2, hash_[:b])\n end",
"def configure(hash = nil, &_block)\n if block_given?\n carrier = Surrealist::Carrier.new\n yield(carrier)\n @default_args = carrier.parameters\n else\n @default_args = hash.nil? ? Surrealist::HashUtils::EMPTY_HASH : hash\n end\n end",
"def create_block(arg_type , frame_type)\n @callable.create_block(arg_type ,frame_type)\n end",
"def initialize(attrs = nil)\n @new_record = true\n @attributes ||= {}\n process_attributes(attrs) do\n yield(self) if block_given?\n end\n # run_callbacks(:initialize) unless _initialize_callbacks.empty?\n # raise ::TinyDyno::Errors::MissingHashKey.new(self.name) unless @hash_key.is_a?(Hash)\n end",
"def initializer(name, opts = T.unsafe(nil), &block); end",
"def initializer(name, opts = T.unsafe(nil), &block); end",
"def initialize(&block)\n yield self\n end",
"def initialize(*args); end",
"def initialize(enum = nil, &block) # :yields: o\n @hash ||= Hash.new\n\n enum.nil? and return\n\n if block\n enum.each { |o| add(block[o]) }\n else\n merge(enum)\n end\n end",
"def initialize(name=nil, &block)\n @value = name ? { name: name } : {}\n super\n end",
"def initialize *args\n if args.size == 1 && args.first.is_a?(Hash)\n super()\n args.first.each do |k,v|\n send \"#{k}=\", v\n end\n else\n super\n end\n end",
"def initialize *args\n if respond_to? :before_init\n warn 'before_init is deprecated. please define process_init_args class method'\n else\n hash = self.class.process_init_args(*args)\n end\n\n unless hash && hash.kind_of?(Hash)\n raise ArgumentError, \"#{hash.inspect} was wrong as arguments. please specify kind of Hash instance\"\n end\n\n # allow String or Symbol for key\n tmp_hash = {}\n hash.each do |key,val|\n tmp_hash[key.to_s] = val\n end\n hash = tmp_hash\n\n hash.each do |key, val|\n if attribute_of[key]\n attribute_of[key].set val\n end\n end\n\n attribute_of.each do |key, val|\n next if val.class.lazy?\n raise AttrRequiredError, \"param: :#{key} is required to #{hash.inspect}\" if !val.class.optional? && !val.get\n end\n\n after_init\n end",
"def initialize(attributes = nil)\n super\n yield self if block_given?\n end",
"def hash=(_arg0); end",
"def initialize(type, &block)\n @state = OpenStruct.new(type: type)\n\n self.instance_eval(&block) if block_given?\n end",
"def block(_hash)\n raise Sibit::NotSupportedError, 'block() doesn\\'t work here'\n end",
"def initialize(options = {}, &blk)\n init(options, &blk)\n end",
"def initialize(options = {}, &blk)\n init(options, &blk)\n end",
"def initialize(*args, &block)\n self.__init_core(block, *args)\n end",
"def initialize opts={}, &block\n @name = opts[:name]\n @activation = opts[:activation]\n @icon = opts[:icon]\n @sound = opts[:sound]\n @block = block\n invariant\n end",
"def initialize(*args)\n extend RSchedUtil\n\n yield self if block_given?\n\n if (args[0] != nil)\n conf = args[0]\n else\n conf = Hash.new\n end\n\n raise ArgumentError, \"Argument is not a hash! #{conf.class} #{conf}\" if conf.class != Hash\n\n # We're a valid job unless we run into some condition\n self.valid = true\n\n if conf.has_key?(:jobid)\n parse_job_by_id conf\n end\n end",
"def setup(hash_args); end"
] |
[
"0.77099276",
"0.75982904",
"0.75966257",
"0.75966257",
"0.6932157",
"0.6859926",
"0.68573457",
"0.68573457",
"0.6842839",
"0.67864305",
"0.6779723",
"0.67660934",
"0.67637604",
"0.6755913",
"0.67214763",
"0.6702719",
"0.6694621",
"0.66620964",
"0.6642057",
"0.66334885",
"0.6590679",
"0.6590223",
"0.6579895",
"0.657681",
"0.65596163",
"0.6552064",
"0.65510756",
"0.6545329",
"0.65444267",
"0.65444267",
"0.6533311",
"0.6514048",
"0.650349",
"0.649816",
"0.6494602",
"0.6479865",
"0.6452543",
"0.6439045",
"0.64314616",
"0.643145",
"0.64312476",
"0.6426686",
"0.6422895",
"0.6422895",
"0.6417565",
"0.6411393",
"0.6411393",
"0.6411393",
"0.6411393",
"0.6402348",
"0.639687",
"0.6393745",
"0.6392908",
"0.63888836",
"0.6384194",
"0.6366892",
"0.6362808",
"0.63609856",
"0.63563484",
"0.6350448",
"0.634966",
"0.6320667",
"0.6314107",
"0.63080406",
"0.6296876",
"0.6296876",
"0.6296876",
"0.6296876",
"0.62765634",
"0.6257501",
"0.62529814",
"0.62500846",
"0.6249629",
"0.6241387",
"0.6236512",
"0.6236512",
"0.6235923",
"0.6234808",
"0.6231913",
"0.62003994",
"0.6196605",
"0.6188849",
"0.61821723",
"0.61821723",
"0.6178056",
"0.6169944",
"0.61682653",
"0.61645746",
"0.6154058",
"0.6145594",
"0.6134164",
"0.6120154",
"0.6117556",
"0.6112609",
"0.60863787",
"0.60863787",
"0.6079812",
"0.6076069",
"0.6052649",
"0.60474896"
] |
0.6223613
|
79
|
does not print argument for empty array
|
def test_does_not_print_argument_for_empty_array
Crd::Flex::Command.new 'echo' do |s|
s.library_path = [ ]
assert_equal( [ ], s.library_path )
assert_no_match( /-library-path/, s.to_cmd )
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_array(array)\n raise NotImplementedError\nend",
"def print_array(array)\n p array\nend",
"def print_elements(input_array)\n # TODO\nend",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def test1(array)\n\tputs \"Test1: Should take an array as argument -> \"\n\tarray.class == Array ? true : false\nend",
"def print_array(array)\n puts \"NOT IMPLEMENTED\"\nend",
"def printarr\n\t\t@arr.each_with_index do |element, index|\n\t\t\tprint element.empty? ? \".\t\" : \"#{element}\t\"\n\t\t\tputs \"\" if (index == 2)||(index == 5)\n\t\tend\n\t\tputs \"\"\n\tend",
"def print_array my_array\n\t\tp my_array\n\tend",
"def isArray _args\n \"isArray _args;\" \n end",
"def array_print_10\nend",
"def empty()\n @arr1.empty?\n end",
"def print_array(array)\n index = 0\n while array[index] != nil\n print array[index], \" \"\n index += 1\n end\nend",
"def test_print_words_empty\n li = []\n assert_equal [], @grapher.print_words(li)\n end",
"def empty?\r\n @arr.empty?\r\n end",
"def test_empty_array_not_equal_1\r\n\t\tassert_equal(false,Array == 1)\r\n\tend",
"def not_empty!(*args)\n if args.any?{|arg| arg.nil? or arg.to_s.empty?}\n coercion_error!\n end\n args\n end",
"def test_empty_0\n # Changes: had to rewrite arrays as @cls\n # assert_equal true, [].empty?\n # assert_equal false, [1].empty?\n # assert_equal false, [1, 1, 4, 2, 5, 4, 5, 1, 2].empty?\n assert_equal true, @cls[].empty?\n assert_equal false, @cls[1].empty?\n assert_equal false, @cls[1, 1, 4, 2, 5, 4, 5, 1, 2].empty?\n end",
"def test_empty_0\n # Changes: had to rewrite arrays as @cls\n # assert_equal true, [].empty?\n # assert_equal false, [1].empty?\n # assert_equal false, [1, 1, 4, 2, 5, 4, 5, 1, 2].empty?\n assert_equal true, @cls[].empty?\n assert_equal false, @cls[1].empty?\n assert_equal false, @cls[1, 1, 4, 2, 5, 4, 5, 1, 2].empty?\n end",
"def getArray _args\n \"getArray _args;\" \n end",
"def look_and_say(array)\n\nend",
"def arrayify_and_stringify_elements(arg)\n return false if arg == false\n \n case\n when arg.blank? then []\n when arg.is_a?(Array) then arg\n else arg.to_s.strip.split(/\\s/)\n end.map(&:to_s)\n end",
"def show_blanks\n\t\t@result_array = \"_\"*@word_array.length\n\t\tputs @result_array\n\tend",
"def show_blanks\n\t\t@result_array = \"_\"*@word_array.length\n\t\tputs @result_array\n\tend",
"def test3(array)\n\tputs \"Test3: Should return an array of arrays -> \"\n\tabg_maker(array).any? {|x| x.class != Array} ? false : true\nend",
"def array_method(input)\n\treturn \"thanks for the sweet array!\"\nend",
"def test\n puts [].empty?\n puts \"\".empty?\n puts [].present?\n puts 1.present?\n puts nil.blank?\nend",
"def test2(array)\n\tputs \"Test2: Should return an array -> \"\n\tabg_maker(array).class == Array ? true : false\nend",
"def void_array(*args)\n return nil.to_a\n end",
"def empty?\n @ary.empty?\n end",
"def check_array!(key, arr)\n if arr\n if arr.any?{|val| val.nil?}\n handle_error(key, :invalid_type, \"invalid value in array parameter #{param_name(key)}\")\n end\n else\n handle_error(key, :missing, \"missing parameter for #{param_name(key)}\")\n end\n end",
"def array?\n false\n end",
"def printArray(arr, type)\n puts \"#{type}: \" +arr.join(\", \")\nend",
"def array?\n false\n end",
"def print_array(array)\n count = 0\n until array[count] == nil\n print array[count]\n count += 1\n end\nend",
"def sentence_maker(s_array)\n\n if s_array.empty? == true\n\n puts \"Array is empty add some values\"\n\n else\n\n p s_array.join(' ').capitalize + '.'\n\n end\nend",
"def printListEnumerated(arr)\r\n i = 0\r\n while i < arr.length\r\n puts ' ' + i.to_s + ' ' + arr[i].to_s\r\n i += 1\r\n end\r\n if(arr.length == 0)\r\n puts ' List is empty.'\r\n end\r\n\r\n end",
"def printArray(arr) \n\tarr.each do |e|\n\t\tputs e\n\tend\nend",
"def empty?() \n\t\t\ta = to_ary\n\t\t\ta[0] == 0 && a[1] == 0 \n\t\tend",
"def array_nl()\n #This is a stub, used for indexing\n end",
"def test_computes_sum_of_empty_array\n\t\tassert_equal(0, sum([]))\n\tend",
"def print_array(array)\n\n array.length.times do |array_element|\n print \"#{array_element} \"\n end\n # raise NotImplementedError\nend",
"def print_arr_1(arr)\n arr.each do |idx|\n puts el\n end\nend",
"def returns_array?\n false\n end",
"def returns_array?\n false\n end",
"def print_array(array)\n count = 0\n\n until array[count] == nil\n puts array[count]\n count += 1\n end\n\nend",
"def test_format_print_one_real\n simulator = Sim.new(nil, nil, nil)\n assert_equal simulator.ruby_format_print([1, 0]), \"\\tFound 1 ruby in Enumerable Canyon.\\n\"\n end",
"def recursive_print(array)\n\nend",
"def expecting; [] end",
"def print_val(arr)\n arr[1]\n end",
"def test_NilClass_InstanceMethod_to_a\n\t\tassert_equal([], nil.to_a)\n\tend",
"def print_array(array)\n puts '[' + array.join(',') + ']'\nend",
"def printAll()\n if @vector.length > 0\n @vector.each_with_index do |elemento, index|\n puts \"Elemento[#{index}]=#{elemento}\"\n end \n else\n puts \"El arreglo está vacio\"\n end\n end",
"def nonemptyArray?(thing)\n thing.kind_of?(Array) &&\n !thing.empty?\nend",
"def isFlatEmpty _obj, _args\n \"_obj isFlatEmpty _args;\" \n end",
"def test_zero_prospectors\n\t\tassert check_args([1, 0])\n\tend",
"def returns_array?\n false\n end",
"def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.each { |item| puts item.data }\n\t\tend\n\tend",
"def simple_array_validator(val, name, size = T.unsafe(nil)); end",
"def simple_array_validator(val, name, size = T.unsafe(nil)); end",
"def printarray(array)\n print'{'\n array.each_index do |i|\n print \"#{array[i]}\"\n if i < array.length - 1\n print ', '\n end\n end\n print\"}\\n\\n\"\n end",
"def test_convert_word_empty\n arr = ''\n assert_equal [], @grapher.convert_word(arr)\n end",
"def is_empty()\n \n end",
"def function(argument1, argument2, *splat)\n puts argument1\n puts argument2\n #Is there a better way to detect an empty splat argument?\n if splat == []\n puts \"empty splat!\"\n else\n #Iterate over a variable number of arguments.\n splat.each { |splat_n| puts splat_n }\n end\nend",
"def test_sum_empty_array\n expected_sum = 0\n assert_equal expected_sum, Stats.sum(Array.new)\n end",
"def test_args_check_nil\n\t\targs_checker = ArgsChecker::new\n\t\tarr = nil\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend",
"def Array(p0) end",
"def any_args?\n @any_args\n end",
"def any_args?\n @any_args\n end",
"def print_array(array)\n length(array).times do |index|\n puts array[index]\n end\n # raise NotImplementedError\nend",
"def imprimer(array)\n array.each do |element|\n print(\"#{element} \")\n end\n puts\nend",
"def printArray\n i = 0\n while (i < (@commandArray.length + 1))\n puts @commandArray.at(i)\n i += 1\n end\n end",
"def print_array(array)\n (length(array)).times do |i|\n print array[i]\n end\n # raise NotImplementedError\nend",
"def refute_empty(obj, msg = T.unsafe(nil)); end",
"def print_array(arr) # define method with one parameter\n\ti = 0 # set starting index value\n\twhile i < arr.length\n\t\tputs arr[i] # Returns the value in the array at index value iteration\n\n\t\ti += 1\n\tend\nend",
"def func4(*args)\n if args.length==0\n puts \"no arguments\\n\"\n elsif args.length==1\n puts (\"one arguemnet = \"+args[0]+\"\\n\")\n elsif args.length>1\n puts (\"more than arguments\")\n puts args\n end\nend",
"def doubler(array)\n \nend",
"def doubler(array)\n \nend",
"def test_parser_handles_empty_email_array\n empty_string = ''\n\n email_array_assert empty_string, empty_string\n end",
"def test_no_arg\n\tassert_output(nil, abort) {GoldRush.argchecker()}\n end",
"def puts_array(array)\n array.each {|item| puts item}\n end",
"def test_all_match_no_elements\n stream = FromArray.new([])\n assert(\n stream.all_match { |val| val % 2 == 1 },\n 'Expected true because the stream is empty!'\n )\n end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def empty?; end",
"def print_array(array)\n for i in 0..array.size - 1 do\n print \"#{array[i]} \"\n end\nend",
"def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.full_scan { |item| puts item.data }\n\t\tend\n\tend",
"def print\n\t\tif self.length == 0\n\t\t\tputs \"empty\"\n\t\telse\n\t\t\tself.full_scan { |item| puts item.data }\n\t\tend\n\tend",
"def array_looper(array)\n\tarray.each do |a|\n\t\tputs a\n\tend\nend",
"def printArray(anArray)\n\tprint \"\\nHere are the elements in your array: \"\n\tanArray.each {| item | print \"#{ item } \"}\nend",
"def not _args\n \"not _args;\" \n end",
"def do_something_with(arr)\n\tputs \"do something\"\n\tputs arr.length\n\tputs\nend"
] |
[
"0.6761435",
"0.66365284",
"0.64765215",
"0.64585656",
"0.64585656",
"0.6400779",
"0.6395051",
"0.6389489",
"0.6338984",
"0.6210894",
"0.6171471",
"0.61523604",
"0.61470485",
"0.61461955",
"0.61439544",
"0.6120291",
"0.61198926",
"0.61198926",
"0.6103999",
"0.6047667",
"0.60435915",
"0.60337573",
"0.60337573",
"0.6031378",
"0.60219634",
"0.60034055",
"0.5948007",
"0.59346235",
"0.59327644",
"0.5928397",
"0.59161705",
"0.590118",
"0.5900509",
"0.5896197",
"0.5861251",
"0.5846822",
"0.582645",
"0.5811725",
"0.58079684",
"0.5785933",
"0.57829",
"0.57707953",
"0.5767166",
"0.5767166",
"0.57586074",
"0.57362926",
"0.5735751",
"0.5733126",
"0.5729479",
"0.57056576",
"0.5704458",
"0.56994426",
"0.56971115",
"0.5694551",
"0.56888115",
"0.568528",
"0.56816643",
"0.56805134",
"0.56805134",
"0.5676231",
"0.567368",
"0.5672437",
"0.5672119",
"0.56707454",
"0.5649586",
"0.5644451",
"0.56361985",
"0.56361985",
"0.563032",
"0.56229633",
"0.56190443",
"0.5608038",
"0.56025237",
"0.5595928",
"0.5594739",
"0.5586168",
"0.5586168",
"0.5583515",
"0.5578485",
"0.55775917",
"0.5574092",
"0.55736446",
"0.55736446",
"0.55736446",
"0.55736446",
"0.55736446",
"0.55736446",
"0.55736446",
"0.55736446",
"0.55736446",
"0.55736446",
"0.55736446",
"0.55736446",
"0.5571618",
"0.55650246",
"0.55650246",
"0.55632496",
"0.5556346",
"0.5556313",
"0.55513155"
] |
0.5859915
|
35
|
GET /transfers GET /transfers.json
|
def index
@transfers = Transfer.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def transfers\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/list').transfers\n end",
"def index\n @transfers = Transfer.all\n render json: @transfers\n end",
"def index\n @transfers = Transfer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transfers }\n end\n end",
"def get_transfers(opts = {})\n data, _status_code, _headers = get_transfers_with_http_info(opts)\n data\n end",
"def get_transfers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferApi.get_transfers ...'\n end\n # resource path\n local_var_path = '/transfers'\n\n # query parameters\n query_params = {}\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n query_params[:'transferId'] = opts[:'transfer_id'] if !opts[:'transfer_id'].nil?\n query_params[:'transferTag'] = opts[:'transfer_tag'] if !opts[:'transfer_tag'].nil?\n query_params[:'transferStatus'] = opts[:'transfer_status'] if !opts[:'transfer_status'].nil?\n query_params[:'walletId'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'beneficiaryWalletId'] = opts[:'beneficiary_wallet_id'] if !opts[:'beneficiary_wallet_id'].nil?\n query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'beneficiaryUserId'] = opts[:'beneficiary_user_id'] if !opts[:'beneficiary_user_id'].nil?\n query_params[:'transferDate'] = opts[:'transfer_date'] if !opts[:'transfer_date'].nil?\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'transferTypeId'] = opts[:'transfer_type_id'] if !opts[:'transfer_type_id'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageCount'] = opts[:'page_count'] if !opts[:'page_count'].nil?\n query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'createdDateFrom'] = opts[:'created_date_from'] if !opts[:'created_date_from'].nil?\n query_params[:'createdDateTo'] = opts[:'created_date_to'] if !opts[:'created_date_to'].nil?\n query_params[:'updatedDateFrom'] = opts[:'updated_date_from'] if !opts[:'updated_date_from'].nil?\n query_params[:'updatedDateTo'] = opts[:'updated_date_to'] if !opts[:'updated_date_to'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferApi#get_transfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @transfers = @bank_account.transfers.all\n end",
"def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end",
"def index\n @transfers = Transfer.where user: @user\n end",
"def show\n render json: @transfer\n end",
"def transfer(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/%i' % [id])\n end",
"def transfers\n self.ListTransfers.first.map { |t| map_transfer(t) }\n end",
"def get_transfer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.get_transfer_all_using_get ...'\n end\n # resource path\n local_var_path = '/transfer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageExternalAccountTransfer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#get_transfer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_transfers_in\n run_command :get_transfers_in, :domain, {\n :key => 'attributes'\n }\n end",
"def index\n @page = params[\"page\"]\n @transfers = Transfer.order(\"created_at desc\").all.paginate(:page => @page)\n end",
"def transfers\r\n @transfers ||= TransfersController.new(configuration: @configuration)\r\n end",
"def transfers\n @transfers = TransferHelper.transfers_for_user(user:current_user)\n\n render :partial => 'home/transfers'\n end",
"def transfers_count\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/count').count\n end",
"def trades\n Client.current.get(\"#{resource_url}/trades\")\n end",
"def index\n @shop_stripe_transfers = Shop::StripeTransfer.all\n end",
"def index\n @transfers = []\n if current_user.admin?\n @transfers = Transfer.all\n else\n @transfers = Transfer.where(from: current_accounts.collect{|x| x.acct_number}) + Transfer.where(to: current_accounts.collect{|x| x.acct_number}) \n end\n end",
"def get_transfers_away\n run_command :get_transfers_away, :domain, {\n :key => 'attributes'\n }\n end",
"def get_transfer_all_using_get(opts = {})\n data, _status_code, _headers = get_transfer_all_using_get_with_http_info(opts)\n data\n end",
"def show\r\n @transfers = Transfer.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end",
"def transfers\n Transfer.where('sender_id = ? OR receiver_id = ?', id, id)\n end",
"def get_token_transfer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokenTransferApi.get_token_transfer_all_using_get ...'\n end\n # resource path\n local_var_path = '/token_transfer'\n\n # query parameters\n query_params = {}\n query_params[:'wallet_id'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].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']\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 => 'PageTokenTransferResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TokenTransferApi#get_token_transfer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def payment_transfers\n authorize :report\n\n @transfers = company.transfers(start_param, end_param)\n # @transfers = company.transfers(300.days.ago.to_s, Date.current.to_s)\n\n respond_to do |format|\n format.json\n format.pdf { render '/companies/report' }\n end\n end",
"def index\n render json: serializer_class.new(paginate(ecf_transfers), params: { cpd_lead_provider: current_user }).serializable_hash.to_json\n end",
"def find_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def index\n @transfers = Transfer.all.limit(5)\n \n end",
"def index\n @breadcrumbs = [['Transfers']]\n @transfers = @transfers.includes(:from_warehouse, :to_warehouse, :batch)\n transfers = TransferDecorator.decorate_collection(@transfers.order('id DESC'))\n @transfers = Kaminari.paginate_array(transfers).page(params[:page])\n end",
"def query_status(params, path_url = 'transfers', class_type = 'Transfer')\n super\n end",
"def set_transfer\n @transfer = current_user.transfers.find(params[:id])\n end",
"def trades(options)\n request :public, :get, :trades, options\n end",
"def index\n @cartridge_transfers = CartridgeTransfer.all\n end",
"def transfer_funds\n @organizer = Organizer.find(params[:id])\n @amount = raw_price(params[:amount])\n @current = raw_price(params[:current])\n\n if params[:amount].nil?\n @status = \"danger\"\n @message_status = \"Você não especificou um valor\"\n return\n end\n\n @bank_account_active_id = @organizer.marketplace.bank_account_active.own_id\n if @bank_account_active_id.nil?\n @status = \"danger\"\n @message_status = \"Você não tem nenhuma conta bancária ativa no momento\"\n else\n if @amount <= @current\n bank_transfer_data = {\n \"amount\" => @amount,\n \"transferInstrument\" => {\n \"method\" => \"BANK_ACCOUNT\",\n \"bankAccount\" => {\n \"id\" => @bank_account_active_id,\n }\n }\n }\n response_transfer = RestClient.post(\"#{Rails.application.secrets[:moip_domain]}/transfers\", bank_transfer_data.to_json, :content_type => :json, :accept => :json, :authorization => \"OAuth #{@organizer.marketplace.token}\"){|response, request, result, &block|\n case response.code\n when 401\n @status = \"danger\"\n @message_status = \"Você não está autorizado a realizar esta transação\"\n @response_transfer_json = JSON.load response\n when 400\n @status = \"danger\"\n @message_status = \"Não foi possíel realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 200\n @status = \"danger\"\n @message_status = \"Não foi possível realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 201\n @status = \"success\"\n @message_status = \"Solicitação de transferência realizada com sucesso\"\n @response_transfer_json = JSON.load response\n MarketplaceMailer.transfer(@organizer, friendly_price(@response_transfer_json[\"amount\"]), l(@response_transfer_json[\"updatedAt\"].to_datetime, format: '%d de %B de %Y as %Hh%M')).deliver_now\n else\n @activation_message = \"Não conseguimos resposta do MOIP para a transferência soliticata, verifique os dados novamente.\"\n @activation_status = \"danger\"\n @response_transfer_json = JSON.load response\n end\n }\n else\n @status = \"danger\"\n @message_status = \"Você não tem fundos suficientes para realizar esta transferência\"\n end\n end\n\n end",
"def get_transfer_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferApi.get_transfer ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TransferApi.get_transfer\"\n end\n # resource path\n local_var_path = '/transfers/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferApi#get_transfer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @stock_transfer = StockTransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_transfer }\n end\n end",
"def create\n @transfer = current_user.transfers.build(transfer_params)\n\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to my_transfers_url, notice: 'Transfer was successfully created.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def retrieve_inventory_transfer(transfer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/inventory/transfers/{transfer_id}',\n 'default')\n .template_param(new_parameter(transfer_id, key: 'transfer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def find_organization_transfers_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferRequestsApi.find_organization_transfers ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TransferRequestsApi.find_organization_transfers\"\n end\n # resource path\n local_var_path = '/organizations/{id}/transfers'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'exclude'] = @api_client.build_collection_param(opts[:'exclude'], :csv) if !opts[:'exclude'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TransferRequestList'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"TransferRequestsApi.find_organization_transfers\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferRequestsApi#find_organization_transfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @transfer = Transfer.new(transfer_params)\n\n if @transfer.save\n render json: @transfer, status: :created, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end",
"def get_transfer(id, opts = {})\n data, _status_code, _headers = get_transfer_with_http_info(id, opts)\n data\n end",
"def get_coins\n get(\"/getcoins\")\n end",
"def index\n @account_transfers = AccountTransfer.all\n @appoint_responsible = AppointResponsible.new\n end",
"def create\n @transfer = Transfer.new(transfer_params)\n respond_to do |format|\n if !params[:transfer][:items].nil?\n total = 0\n params[:transfer][:items].each do |f| \n item = Item.where([\"id = #{f}\"]).first\n total += item.amount\n end\n account = Account.where([\"id = #{@transfer.account_id}\"]).first\n new_total = account.amount - total\n if new_total > 0 \n if @transfer.save\n account.update(amount: new_total)\n params[:transfer][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(transfer_id: @transfer.id)\n end\n \n format.html { redirect_to accounts_path, notice: \"Transfer was successfully created.\" }\n format.json { render :show, status: :created, location: @transfer }\n end\n else\n format.html { redirect_to budgets_url, notice: \"The account hasn't got enough money\"}\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end",
"def create\n @transfer = @bank_account.transfers.new(transfer_params)\n\n begin\n transfer_result = @transfer.initiate_transfer(params[:amount])\n @transfer.status = transfer_result[:status]\n @transfer.stripe_token = transfer_result[:id]\n rescue => e\n @transfer_error = e.message\n end\n\n respond_to do |format|\n if !@transfer_error && @transfer.save\n format.html {\n redirect_to user_bank_account_transfer_path(\n @user, @bank_account, @transfer\n ),\n notice: 'Transfer was successfully created.'\n }\n format.json { render action: 'show', status: :created, location: @transfer }\n else\n format.html { render action: 'new' }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n account = Account.find(params[:account_id].to_i)\n @transactions = account.transactions\n\n transactions_json = TransactionSerializer.new(@transactions).serialized_json\n render json: transactions_json\n end",
"def set_transfer\n @transfer = current_user.transactions.find(params[:id])\n end",
"def transfer_unit\n if !params[:ic_number].nil?\n user = User.find_by_ic_number(params[:ic_number])\n departments = user.units.active.collect(&:name)\n render :json=>[departments] if departments\n end\n end",
"def index\n @student_hour_transfers = StudentHourTransfer.all\n end",
"def get_token_transfer_all_using_get(opts = {})\n data, _status_code, _headers = get_token_transfer_all_using_get_with_http_info(opts)\n data\n end",
"def update\n if @transfer.update(transfer_params)\n render :show, status: :ok, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end",
"def transfer_funds(destination, params)\n # Validation\n params = validate_input(params, @exception_array += %w[currency value])\n # The Request Body Parameters\n if destination.blank?\n # Blind Transfer\n transfer_body = {\n amount: {\n currency: params['currency'],\n value: params['value']\n }\n }\n else\n # Targeted Transfer\n transfer_body = {\n amount: {\n currency: params['currency'],\n value: params['value']\n },\n destination: destination\n }\n end\n transfer_hash = K2Transfer.make_hash('transfers', 'POST', @access_token, 'Transfer', transfer_body)\n @threads << Thread.new do\n sleep 0.25\n @location_url = K2Connect.to_connect(transfer_hash)\n end\n @threads.each(&:join)\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end",
"def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end",
"def show\n @logtransfer = Logtransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logtransfer }\n end\n end",
"def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'\n end\n if @api_client.config.client_side_validation && opts[:'transactions_type'] && !['automated', 'manual'].include?(opts[:'transactions_type'])\n fail ArgumentError, 'invalid value for \"transactions_type\", must be one of automated, manual'\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?\n query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?\n query_params[:'transactions_type'] = opts[:'transactions_type'] if !opts[:'transactions_type'].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 = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'TransactionListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_accounts()\n http_get(accounts_url)\n end",
"def index\n @transferencias = Transferencia.all\n end",
"def destroy\n @transfer = Transfer.find(params[:id])\n @transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end",
"def index\n @transactions = Transaction.all\n render json: @transactions\n end",
"def index\r\n @stock_transfers = StockTransfer.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @stock_transfers }\r\n end\r\n end",
"def get_transactions(service)\n\t\treturn @transport.get_path(\"transactions\",service)\n\tend",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to my_transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def credit\n handle_response(get(\"/credit.json\"))\n end",
"def index\n @trades = Trade.all\n render json: @trades\n end",
"def index\n if @account\n @transactions = @account.transactions\n else\n @transactions = Transaction.all\n end\n render json: @transactions\n end",
"def index\n user_coin_transactions = get_user_coin_transactions\n if user_coin_transactions\n json_response(user_coin_transactions)\n else \n json_response({:status => false, :message => 'no transaction'})\n end\n end",
"def index *_\n @trades = owned_trades_view\n\n render json: @trades\n end",
"def status(options = {})\n options[:currency] = 'btc'\n\n params = { currency: options[:currency] }\n params[:id] = options[:id] if options[:id]\n params[:email] = options[:email] if options[:email]\n\n response = @client.protected_run :get, 'user/coins/status',\n params: params\n JSON.parse(response.body).map do |transfer_status|\n TransferStatus.new transfer_status\n end\n end",
"def create\n @transfer = new_transfer\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to transfers_path, notice: \"#{t(:transfer_transaction)} #{t(:was_successfully_created)}\" }\n # format.json { render action: 'show', status: :created, location: @transfer }\n else\n init\n format.html { render action: 'new' }\n # format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def clean_transfers(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/clean').status == \"OK\"\n end",
"def get_token_transfer_using_get_with_http_info(token_transfer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokenTransferApi.get_token_transfer_using_get ...'\n end\n # verify the required parameter 'token_transfer_id' is set\n if @api_client.config.client_side_validation && token_transfer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'token_transfer_id' when calling TokenTransferApi.get_token_transfer_using_get\"\n end\n # resource path\n local_var_path = '/token_transfer/{token_transfer_id}'.sub('{' + 'token_transfer_id' + '}', token_transfer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TokenTransferResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TokenTransferApi#get_token_transfer_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @transfer = @branch.transfers.find(params[:id])\n @transfered_product = @transfer.transfered_products.build\n @product = Product.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transfer }\n end\n end",
"def index\r\n @transferencias = Transferencia.all\r\n end",
"def withdrawals\n Transfer.where(\n from: id,\n transfer_type: 'withdrawal'\n )\n end",
"def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end",
"def credit\n handle_response(self.class.get(\"/credit.json\"))\n end",
"def transactions\n JSON.parse(response.body).fetch('transactions')\n end",
"def create\n @transfer = @branch.transfers.create(params[:transfer])\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to branch_transfer_path(@branch,@transfer), notice: 'Transfer was successfully created.' }\n format.json { render json: @transfer, status: :created, location: @transfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transfer client\n if @options[:verbose]\n error = \"Rock Trading does not have a 'transfer' API.\\n\"\n error << \"You must transfer bitcoin manually.\"\n\t @options[:logger].info error\n\tend\n end",
"def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}/transactions?type=#{type}\", headers)\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end"
] |
[
"0.8085029",
"0.76260304",
"0.73241717",
"0.72007954",
"0.7198779",
"0.7133896",
"0.7062837",
"0.7012793",
"0.67484874",
"0.6748145",
"0.6654107",
"0.6601119",
"0.656075",
"0.6546354",
"0.6531464",
"0.649038",
"0.6358053",
"0.63124937",
"0.62614787",
"0.6250275",
"0.62478787",
"0.62245274",
"0.6109003",
"0.6099499",
"0.60991025",
"0.6097748",
"0.60656124",
"0.60434324",
"0.60427254",
"0.60317993",
"0.60239774",
"0.59730095",
"0.5925461",
"0.587076",
"0.5838161",
"0.5834123",
"0.5827383",
"0.5796881",
"0.5760911",
"0.5738363",
"0.57345307",
"0.5727611",
"0.57160234",
"0.56820047",
"0.5623487",
"0.56131244",
"0.5609269",
"0.5587619",
"0.55718887",
"0.5563703",
"0.5559464",
"0.5556181",
"0.5554064",
"0.5554015",
"0.55505526",
"0.5511685",
"0.5511013",
"0.5505678",
"0.5500903",
"0.55005306",
"0.54957604",
"0.5491955",
"0.54881966",
"0.5438368",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54375887",
"0.54211265",
"0.5415449",
"0.54139596",
"0.5404737",
"0.5402322",
"0.5400017",
"0.5398741",
"0.53986704",
"0.5397301",
"0.5391681",
"0.5390579",
"0.5389518",
"0.53879404",
"0.53853154",
"0.5363573",
"0.5362834",
"0.5357569",
"0.5355804",
"0.5351854",
"0.53403765",
"0.5338573"
] |
0.71721023
|
8
|
GET /transfers/1 GET /transfers/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @transfers = Transfer.all\n render json: @transfers\n end",
"def transfers\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/list').transfers\n end",
"def index\n @transfers = Transfer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transfers }\n end\n end",
"def index\n @transfers = Transfer.all\n end",
"def index\n @transfers = Transfer.all\n end",
"def index\n @transfers = Transfer.all\n end",
"def index\n @transfers = Transfer.all\n end",
"def get_transfers_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferApi.get_transfers ...'\n end\n # resource path\n local_var_path = '/transfers'\n\n # query parameters\n query_params = {}\n query_params[:'accessSignature'] = opts[:'access_signature'] if !opts[:'access_signature'].nil?\n query_params[:'accessTag'] = opts[:'access_tag'] if !opts[:'access_tag'].nil?\n query_params[:'accessUserId'] = opts[:'access_user_id'] if !opts[:'access_user_id'].nil?\n query_params[:'accessUserIp'] = opts[:'access_user_ip'] if !opts[:'access_user_ip'].nil?\n query_params[:'transferId'] = opts[:'transfer_id'] if !opts[:'transfer_id'].nil?\n query_params[:'transferTag'] = opts[:'transfer_tag'] if !opts[:'transfer_tag'].nil?\n query_params[:'transferStatus'] = opts[:'transfer_status'] if !opts[:'transfer_status'].nil?\n query_params[:'walletId'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'beneficiaryWalletId'] = opts[:'beneficiary_wallet_id'] if !opts[:'beneficiary_wallet_id'].nil?\n query_params[:'userId'] = opts[:'user_id'] if !opts[:'user_id'].nil?\n query_params[:'beneficiaryUserId'] = opts[:'beneficiary_user_id'] if !opts[:'beneficiary_user_id'].nil?\n query_params[:'transferDate'] = opts[:'transfer_date'] if !opts[:'transfer_date'].nil?\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'transferTypeId'] = opts[:'transfer_type_id'] if !opts[:'transfer_type_id'].nil?\n query_params[:'pageNumber'] = opts[:'page_number'] if !opts[:'page_number'].nil?\n query_params[:'pageCount'] = opts[:'page_count'] if !opts[:'page_count'].nil?\n query_params[:'sortBy'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'sortOrder'] = opts[:'sort_order'] if !opts[:'sort_order'].nil?\n query_params[:'createdDateFrom'] = opts[:'created_date_from'] if !opts[:'created_date_from'].nil?\n query_params[:'createdDateTo'] = opts[:'created_date_to'] if !opts[:'created_date_to'].nil?\n query_params[:'updatedDateFrom'] = opts[:'updated_date_from'] if !opts[:'updated_date_from'].nil?\n query_params[:'updatedDateTo'] = opts[:'updated_date_to'] if !opts[:'updated_date_to'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferApi#get_transfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @transfers = Transfer.resources(params[:resource].capitalize)\n end",
"def transfer(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/%i' % [id])\n end",
"def index\n @transfers = @bank_account.transfers.all\n end",
"def index\n @transfers = Transfer.where user: @user\n end",
"def show\n render json: @transfer\n end",
"def get_transfers(opts = {})\n data, _status_code, _headers = get_transfers_with_http_info(opts)\n data\n end",
"def find_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def index\n @page = params[\"page\"]\n @transfers = Transfer.order(\"created_at desc\").all.paginate(:page => @page)\n end",
"def get_transfer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.get_transfer_all_using_get ...'\n end\n # resource path\n local_var_path = '/transfer'\n\n # query parameters\n query_params = {}\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageExternalAccountTransfer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#get_transfer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def query_status(params, path_url = 'transfers', class_type = 'Transfer')\n super\n end",
"def transfers\n self.ListTransfers.first.map { |t| map_transfer(t) }\n end",
"def show\r\n @transfers = Transfer.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end",
"def get_transfers_in\n run_command :get_transfers_in, :domain, {\n :key => 'attributes'\n }\n end",
"def set_transfer\n @transfer = current_user.transfers.find(params[:id])\n end",
"def retrieve_inventory_transfer(transfer_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/inventory/transfers/{transfer_id}',\n 'default')\n .template_param(new_parameter(transfer_id, key: 'transfer_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def transfers\r\n @transfers ||= TransfersController.new(configuration: @configuration)\r\n end",
"def transfers\n @transfers = TransferHelper.transfers_for_user(user:current_user)\n\n render :partial => 'home/transfers'\n end",
"def index\n @transfers = Transfer.all.limit(5)\n \n end",
"def show\n @stock_transfer = StockTransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock_transfer }\n end\n end",
"def get_transfer_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferApi.get_transfer ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TransferApi.get_transfer\"\n end\n # resource path\n local_var_path = '/transfers/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferApi#get_transfer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def transfers\n Transfer.where('sender_id = ? OR receiver_id = ?', id, id)\n end",
"def index\n @shop_stripe_transfers = Shop::StripeTransfer.all\n end",
"def transfers_count\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/count').count\n end",
"def get_transfers_away\n run_command :get_transfers_away, :domain, {\n :key => 'attributes'\n }\n end",
"def get_transfer_by_path(path)\n obj = @service.object(path)\n .tap(&:introspect)\n Transfer.new(obj.Get(Transfer::INTERFACE, 'Id').first, self)\n end",
"def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def get_token_transfer_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokenTransferApi.get_token_transfer_all_using_get ...'\n end\n # resource path\n local_var_path = '/token_transfer'\n\n # query parameters\n query_params = {}\n query_params[:'wallet_id'] = opts[:'wallet_id'] if !opts[:'wallet_id'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'order_by'] = opts[:'order_by'] if !opts[:'order_by'].nil?\n query_params[:'ascending'] = opts[:'ascending'] if !opts[:'ascending'].nil?\n query_params[:'get_latest'] = opts[:'get_latest'] if !opts[:'get_latest'].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']\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 => 'PageTokenTransferResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TokenTransferApi#get_token_transfer_all_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def trades\n Client.current.get(\"#{resource_url}/trades\")\n end",
"def index\n @transfers = []\n if current_user.admin?\n @transfers = Transfer.all\n else\n @transfers = Transfer.where(from: current_accounts.collect{|x| x.acct_number}) + Transfer.where(to: current_accounts.collect{|x| x.acct_number}) \n end\n end",
"def destroy\n @transfer = Transfer.find(params[:id])\n @transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end",
"def show\n @logtransfer = Logtransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logtransfer }\n end\n end",
"def create\n @transfer = Transfer.new(transfer_params)\n\n if @transfer.save\n render json: @transfer, status: :created, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end",
"def payment_transfers\n authorize :report\n\n @transfers = company.transfers(start_param, end_param)\n # @transfers = company.transfers(300.days.ago.to_s, Date.current.to_s)\n\n respond_to do |format|\n format.json\n format.pdf { render '/companies/report' }\n end\n end",
"def set_transfer\n @transfer = Transfer.find(params[:id])\n end",
"def create\n @transfer = current_user.transfers.build(transfer_params)\n\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to my_transfers_url, notice: 'Transfer was successfully created.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @transfer = @bank_account.transfers.new(transfer_params)\n\n begin\n transfer_result = @transfer.initiate_transfer(params[:amount])\n @transfer.status = transfer_result[:status]\n @transfer.stripe_token = transfer_result[:id]\n rescue => e\n @transfer_error = e.message\n end\n\n respond_to do |format|\n if !@transfer_error && @transfer.save\n format.html {\n redirect_to user_bank_account_transfer_path(\n @user, @bank_account, @transfer\n ),\n notice: 'Transfer was successfully created.'\n }\n format.json { render action: 'show', status: :created, location: @transfer }\n else\n format.html { render action: 'new' }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_transfer(id, opts = {})\n data, _status_code, _headers = get_transfer_with_http_info(id, opts)\n data\n end",
"def index\n @cartridge_transfers = CartridgeTransfer.all\n end",
"def set_transfer\n @transfer = current_user.transactions.find(params[:id])\n end",
"def get_transfer_all_using_get(opts = {})\n data, _status_code, _headers = get_transfer_all_using_get_with_http_info(opts)\n data\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end",
"def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end",
"def index\n render json: serializer_class.new(paginate(ecf_transfers), params: { cpd_lead_provider: current_user }).serializable_hash.to_json\n end",
"def transfer_funds\n @organizer = Organizer.find(params[:id])\n @amount = raw_price(params[:amount])\n @current = raw_price(params[:current])\n\n if params[:amount].nil?\n @status = \"danger\"\n @message_status = \"Você não especificou um valor\"\n return\n end\n\n @bank_account_active_id = @organizer.marketplace.bank_account_active.own_id\n if @bank_account_active_id.nil?\n @status = \"danger\"\n @message_status = \"Você não tem nenhuma conta bancária ativa no momento\"\n else\n if @amount <= @current\n bank_transfer_data = {\n \"amount\" => @amount,\n \"transferInstrument\" => {\n \"method\" => \"BANK_ACCOUNT\",\n \"bankAccount\" => {\n \"id\" => @bank_account_active_id,\n }\n }\n }\n response_transfer = RestClient.post(\"#{Rails.application.secrets[:moip_domain]}/transfers\", bank_transfer_data.to_json, :content_type => :json, :accept => :json, :authorization => \"OAuth #{@organizer.marketplace.token}\"){|response, request, result, &block|\n case response.code\n when 401\n @status = \"danger\"\n @message_status = \"Você não está autorizado a realizar esta transação\"\n @response_transfer_json = JSON.load response\n when 400\n @status = \"danger\"\n @message_status = \"Não foi possíel realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 200\n @status = \"danger\"\n @message_status = \"Não foi possível realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 201\n @status = \"success\"\n @message_status = \"Solicitação de transferência realizada com sucesso\"\n @response_transfer_json = JSON.load response\n MarketplaceMailer.transfer(@organizer, friendly_price(@response_transfer_json[\"amount\"]), l(@response_transfer_json[\"updatedAt\"].to_datetime, format: '%d de %B de %Y as %Hh%M')).deliver_now\n else\n @activation_message = \"Não conseguimos resposta do MOIP para a transferência soliticata, verifique os dados novamente.\"\n @activation_status = \"danger\"\n @response_transfer_json = JSON.load response\n end\n }\n else\n @status = \"danger\"\n @message_status = \"Você não tem fundos suficientes para realizar esta transferência\"\n end\n end\n\n end",
"def update\n if @transfer.update(transfer_params)\n render :show, status: :ok, location: @transfer\n else\n render json: @transfer.errors, status: :unprocessable_entity\n end\n end",
"def create\n @transfer = Transfer.new(transfer_params)\n respond_to do |format|\n if !params[:transfer][:items].nil?\n total = 0\n params[:transfer][:items].each do |f| \n item = Item.where([\"id = #{f}\"]).first\n total += item.amount\n end\n account = Account.where([\"id = #{@transfer.account_id}\"]).first\n new_total = account.amount - total\n if new_total > 0 \n if @transfer.save\n account.update(amount: new_total)\n params[:transfer][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(transfer_id: @transfer.id)\n end\n \n format.html { redirect_to accounts_path, notice: \"Transfer was successfully created.\" }\n format.json { render :show, status: :created, location: @transfer }\n end\n else\n format.html { redirect_to budgets_url, notice: \"The account hasn't got enough money\"}\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def index\n @breadcrumbs = [['Transfers']]\n @transfers = @transfers.includes(:from_warehouse, :to_warehouse, :batch)\n transfers = TransferDecorator.decorate_collection(@transfers.order('id DESC'))\n @transfers = Kaminari.paginate_array(transfers).page(params[:page])\n end",
"def find_organization_transfers_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferRequestsApi.find_organization_transfers ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TransferRequestsApi.find_organization_transfers\"\n end\n # resource path\n local_var_path = '/organizations/{id}/transfers'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'exclude'] = @api_client.build_collection_param(opts[:'exclude'], :csv) if !opts[:'exclude'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TransferRequestList'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"TransferRequestsApi.find_organization_transfers\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferRequestsApi#find_organization_transfers\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @transfer = new_transfer\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to transfers_path, notice: \"#{t(:transfer_transaction)} #{t(:was_successfully_created)}\" }\n # format.json { render action: 'show', status: :created, location: @transfer }\n else\n init\n format.html { render action: 'new' }\n # format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @transfer = @branch.transfers.find(params[:id])\n @transfered_product = @transfer.transfered_products.build\n @product = Product.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transfer }\n end\n end",
"def index\n @account_transfers = AccountTransfer.all\n @appoint_responsible = AppointResponsible.new\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to my_transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @transfer = @branch.transfers.create(params[:transfer])\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to branch_transfer_path(@branch,@transfer), notice: 'Transfer was successfully created.' }\n format.json { render json: @transfer, status: :created, location: @transfer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def trades(options)\n request :public, :get, :trades, options\n end",
"def get_transfer_using_get_with_http_info(external_account_transfer_id, transfer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.get_transfer_using_get ...'\n end\n # verify the required parameter 'external_account_transfer_id' is set\n if @api_client.config.client_side_validation && external_account_transfer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'external_account_transfer_id' when calling FundingApi.get_transfer_using_get\"\n end\n # verify the required parameter 'transfer_id' is set\n if @api_client.config.client_side_validation && transfer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'transfer_id' when calling FundingApi.get_transfer_using_get\"\n end\n # resource path\n local_var_path = '/transfer/{transfer_id}'.sub('{' + 'external_account_transfer_id' + '}', external_account_transfer_id.to_s).sub('{' + 'transfer_id' + '}', transfer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(: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 => 'ExternalAccountTransfer')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#get_transfer_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_token_transfer_using_get_with_http_info(token_transfer_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokenTransferApi.get_token_transfer_using_get ...'\n end\n # verify the required parameter 'token_transfer_id' is set\n if @api_client.config.client_side_validation && token_transfer_id.nil?\n fail ArgumentError, \"Missing the required parameter 'token_transfer_id' when calling TokenTransferApi.get_token_transfer_using_get\"\n end\n # resource path\n local_var_path = '/token_transfer/{token_transfer_id}'.sub('{' + 'token_transfer_id' + '}', token_transfer_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TokenTransferResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TokenTransferApi#get_token_transfer_using_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @torrent = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").find(Integer(params[:id]))\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @torrent }\n end\n end",
"def clean_transfers(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/clean').status == \"OK\"\n end",
"def get_coins\n get(\"/getcoins\")\n end",
"def transfer(id)\n Transfer.new(id, self)\n end",
"def transfer_unit\n if !params[:ic_number].nil?\n user = User.find_by_ic_number(params[:ic_number])\n departments = user.units.active.collect(&:name)\n render :json=>[departments] if departments\n end\n end",
"def find_transfer_request_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferRequestsApi.find_transfer_request_by_id ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TransferRequestsApi.find_transfer_request_by_id\"\n end\n # resource path\n local_var_path = '/transfers/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'include'] = @api_client.build_collection_param(opts[:'include'], :csv) if !opts[:'include'].nil?\n query_params[:'exclude'] = @api_client.build_collection_param(opts[:'exclude'], :csv) if !opts[:'exclude'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TransferRequest'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"TransferRequestsApi.find_transfer_request_by_id\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferRequestsApi#find_transfer_request_by_id\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n ActiveRecord::Base.transaction do\n @transfer = Transfer.new(transfer_params)\n @transfer = Transfer.new(transfer_params)\n @transferaccount = @transfer.transferaccounts.build\n @transferaccount.account_id = current_account.id\n \n respond_to do |format|\n if @transfer.save\n format.html { redirect_to @transfer }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def transfer\n @purchase = Purchase.find_by(invoice_id: params[:invoice_id])\n @bank_account = BankAccount.first\n end",
"def create\n @transfer = Transfer.new(transfer_params)\n @transfer.sender_account = current_user.account\n\n respond_to do |format|\n if @transfer.save\n format.html { redirect_to @transfer.sender_account, notice: 'Transfer was successfully created.' }\n format.json { render :show, status: :created, location: @transfer }\n else\n format.html { render :new }\n format.json { render json: @transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\r\n @stock_transfers = StockTransfer.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.xml { render :xml => @stock_transfers }\r\n end\r\n end",
"def transfer client\n if @options[:verbose]\n error = \"Rock Trading does not have a 'transfer' API.\\n\"\n error << \"You must transfer bitcoin manually.\"\n\t @options[:logger].info error\n\tend\n end",
"def find_transfer_request\n @transfer_request = OwnershipTransferRequest.find_by!(\n token: params[:token],\n accepted: nil\n )\n end",
"def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end",
"def new\n @stock_transfer = StockTransfer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stock_transfer }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: \"Transfer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def index *_\n @trades = owned_trades_view\n\n render json: @trades\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def status(options = {})\n options[:currency] = 'btc'\n\n params = { currency: options[:currency] }\n params[:id] = options[:id] if options[:id]\n params[:email] = options[:email] if options[:email]\n\n response = @client.protected_run :get, 'user/coins/status',\n params: params\n JSON.parse(response.body).map do |transfer_status|\n TransferStatus.new transfer_status\n end\n end",
"def index\n account = Account.find(params[:account_id].to_i)\n @transactions = account.transactions\n\n transactions_json = TransactionSerializer.new(@transactions).serialized_json\n render json: transactions_json\n end",
"def trips\n flight = Flight.where(\"id = ?\", params[:id]).take\n if flight.nil?\n render :json => {errors: \"404\"}, :status => 404\n else\n respond_with( flight.trips )\n end\n end",
"def index\n @transferencias = Transferencia.all\n end",
"def show\n @chain = Chain.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chain }\n end\n end",
"def show\n @breadcrumb = 'read'\n @inventory_transfer = InventoryTransfer.find(params[:id])\n @items = @inventory_transfer.inventory_transfer_items.paginate(:page => params[:page], :per_page => per_page).order('id')\n # Approvers\n @is_approver = company_approver(@inventory_transfer, @inventory_transfer.store.company, current_user.id) ||\n office_approver(@inventory_transfer, @inventory_transfer.store.office, current_user.id) ||\n (current_user.has_role? :Approver)\n # If current user is not approver up to here, maybe it's a multioffice store...\n if !@is_approver\n @is_approver = multioffice_store_approver(@inventory_transfer, current_user.id)\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_transfer }\n end\n end"
] |
[
"0.741434",
"0.74059945",
"0.72151774",
"0.7011247",
"0.7011247",
"0.7011247",
"0.7011247",
"0.6941883",
"0.6936286",
"0.68959785",
"0.6847237",
"0.67529625",
"0.67234665",
"0.64557207",
"0.645324",
"0.6319211",
"0.6294915",
"0.6253235",
"0.62481064",
"0.62369657",
"0.62287086",
"0.6225091",
"0.61940217",
"0.61080056",
"0.6070289",
"0.60530317",
"0.6049648",
"0.6031012",
"0.6028932",
"0.5958839",
"0.5953352",
"0.59436065",
"0.5892504",
"0.5863769",
"0.5856886",
"0.5856886",
"0.5856886",
"0.5856886",
"0.5856886",
"0.5856886",
"0.5856886",
"0.5856886",
"0.5856886",
"0.5856886",
"0.5856886",
"0.5856886",
"0.58327705",
"0.58211577",
"0.58192885",
"0.5816242",
"0.5815604",
"0.581334",
"0.5800243",
"0.5796303",
"0.5780874",
"0.5776348",
"0.57666916",
"0.5733934",
"0.57292175",
"0.57290584",
"0.5725151",
"0.5723314",
"0.57113194",
"0.5697743",
"0.56907064",
"0.5689274",
"0.56755114",
"0.5635852",
"0.56245303",
"0.55917394",
"0.55796385",
"0.5565987",
"0.55305946",
"0.5488219",
"0.5463877",
"0.54515463",
"0.5436006",
"0.5417852",
"0.54155076",
"0.5411567",
"0.54048413",
"0.54046243",
"0.5400294",
"0.5399875",
"0.5396933",
"0.538508",
"0.53743696",
"0.5369286",
"0.5360097",
"0.53465796",
"0.5335663",
"0.5333708",
"0.53290164",
"0.53290164",
"0.53290164",
"0.5323433",
"0.5320441",
"0.5317185",
"0.5315682",
"0.5304891",
"0.5302407"
] |
0.0
|
-1
|
DELETE /transfers/1 DELETE /transfers/1.json
|
def destroy
@transfer.destroy
respond_to do |format|
format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @transfer = Transfer.find(params[:id])\n @transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: \"Transfer was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to my_transfers_url, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n respond_to do |format|\n format.html { redirect_to transfers_url, notice: 'transfer was successfully deleted.' }\n # format.json { head :no_content }\n end\n end",
"def destroy\n latest_transfer = Transfer.latest_transfer(@transfer.transferable_id, @transfer.transferable_type)\n @transfer.destroy\n @transfer.transferable.update(branch_id: @transfer.from_location_id) if latest_transfer == @transfer\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repeating_transfer.destroy\n respond_to do |format|\n format.html { redirect_to repeating_transfers_url, notice: 'Repeating transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @account_transfer.destroy\n respond_to do |format|\n format.html { redirect_to account_transfers_url, notice: 'Account transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transfer.destroy\n end",
"def destroy\n @stock_transfer = StockTransfer.find(params[:id])\n @stock_transfer.destroy\n\n respond_to do |format|\n format.html { redirect_to stock_transfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @logtransfer = Logtransfer.find(params[:id])\n @logtransfer.destroy\n\n respond_to do |format|\n format.html { redirect_to logtransfers_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @transit.destroy\n respond_to do |format|\n format.html { redirect_to transits_url, notice: 'Transit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @cartridge_transfer.destroy\n respond_to do |format|\n format.html { redirect_to cartridge_transfers_url, notice: 'Cartridge transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @inventory_transfer = InventoryTransfer.find(params[:id])\n\n respond_to do |format|\n if @inventory_transfer.destroy\n format.html { redirect_to inventory_transfers_url,\n notice: (crud_notice('destroyed', @inventory_transfer) + \"#{undo_link(@inventory_transfer)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to inventory_transfers_url, alert: \"#{@inventory_transfer.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @inventory_transfer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def clean_transfers(id)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/transfers/clean').status == \"OK\"\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @transferencia.destroy\n respond_to do |format|\n format.html { redirect_to transferencias_url, notice: 'Transferencia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relay.destroy\n respond_to do |format|\n format.html { redirect_to relays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @traffic = Traffic.find(params[:id])\n @traffic.destroy\n\n respond_to do |format|\n format.html { redirect_to traffics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_hour_transfer.destroy\n respond_to do |format|\n format.html { redirect_to student_hour_transfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_transaction = ClientTransaction.find(params[:id])\n @client_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to client_transactions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end",
"def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaccion = Transaccion.find(params[:id])\n @transaccion.destroy\n\n respond_to do |format|\n format.html { redirect_to transacciones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transit_chamber_io = TransitChamberIo.find(params[:id])\n @transit_chamber_io.destroy\n\n respond_to do |format|\n format.html { redirect_to transit_chamber_ios_url }\n format.json { head :no_content }\n end\n end",
"def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @traffic.destroy\n respond_to do |format|\n format.html { redirect_to traffics_url, notice: 'Traffic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Transaction.find(params[:id]).try(:destroy)\n\n head :no_content\n end",
"def destroy\n @step.destroy\n respond_to do |format|\n format.html { redirect_to @trip }\n format.json { head :no_content }\n end\n end",
"def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end",
"def destroy\n @chain = Chain.find(params[:id])\n @chain.destroy\n\n respond_to do |format|\n format.html { redirect_to chains_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chain = Chain.find(params[:id])\n @chain.destroy\n\n respond_to do |format|\n format.html { redirect_to chains_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @stock_transfer = StockTransfer.find(params[:id])\r\n @stock_transfer.destroy\r\n \r\n flash[:notice] = \"Stock Transfer successfully destroyed\"\r\n\r\n respond_to do |format|\r\n format.html { redirect_back_or_default(stock_transfers_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @transfer_product = TransferProduct.find(params[:id])\n @transfer_product.destroy\n\n respond_to do |format|\n format.html { redirect_to transfer_products_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @fast.destroy\n respond_to do |format|\n format.html { redirect_to fasts_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @relay_destination.destroy\n respond_to do |format|\n format.html { redirect_to @relay, notice: 'Relay destination was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tx.destroy\n respond_to do |format|\n format.html { redirect_to txes_url, notice: 'Tx 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 @di_transaction = DiTransaction.find(params[:id])\n @di_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to di_transactions_url }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def destroy\n @stats_money_transaction = Stats::MoneyTransaction.find(params[:id])\n @stats_money_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_money_transactions_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @transference.destroy\n respond_to do |format|\n format.html { redirect_to transferences_url, notice: 'Transference was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @complete_transaction.destroy\n respond_to do |format|\n format.html { redirect_to @complete, notice: 'Transaksi berjaya dipadamkan' }\n format.json { head :no_content }\n end\n end",
"def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end",
"def destroy\n @direcciont.destroy\n respond_to do |format|\n format.html { redirect_to direccionts_url, notice: 'Direcciont was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end",
"def destroy\n @traffic = Traffic.find(params[:id])\n @traffic.destroy\n\n respond_to do |format|\n format.html { redirect_to(traffics_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def destroy\n @settlement = Settlement.find(params[:id])\n @settlement.destroy\n\n respond_to do |format|\n format.html { redirect_to settlements_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @task_copy.destroy\n respond_to do |format|\n format.html { redirect_to task_copies_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def destroy\n @translantion = Translantion.find(params[:id])\n @translantion.destroy\n\n respond_to do |format|\n format.html { redirect_to translantions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tx = Tx.find(params[:id])\n @tx.destroy\n\n respond_to do |format|\n format.html { redirect_to(txes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_pricing_transit.destroy\n respond_to do |format|\n format.html { redirect_to admin_pricing_transits_path, notice: mk_notice(@admin_pricing_transit, :id, 'Transit', :destroy) }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n request(:delete, path)\n end",
"def delete_transfer_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransferApi.delete_transfer ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling TransferApi.delete_transfer\"\n end\n # resource path\n local_var_path = '/transfers/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20023')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransferApi#delete_transfer\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip.destroy\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @torrent = Torrents.new(:url => \"http://newt.local:9091/transmission/rpc\").find(Integer(params[:id]))\n @torrent.destroy\n\n respond_to do |format|\n format.html { redirect_to torrents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trip = Trip.find(params[:id])\n @trip.destroy\n\n respond_to do |format|\n format.html { redirect_to trips_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @upload = Upload.find(params[:id])\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @upload = Upload.find(params[:id])\n @upload.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to txns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tribe.destroy\n respond_to do |format|\n format.html { redirect_to tribes_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end"
] |
[
"0.7729923",
"0.76982164",
"0.742149",
"0.742149",
"0.742149",
"0.74167866",
"0.74125475",
"0.7403977",
"0.7242137",
"0.7179308",
"0.7122767",
"0.7081196",
"0.7007919",
"0.6901883",
"0.67975754",
"0.67509127",
"0.6718018",
"0.67002594",
"0.6688077",
"0.6675711",
"0.6661923",
"0.66495657",
"0.66193044",
"0.6614093",
"0.6588594",
"0.658627",
"0.653341",
"0.6500473",
"0.6496774",
"0.64866096",
"0.64866096",
"0.64866096",
"0.64866096",
"0.64866096",
"0.64866096",
"0.64866096",
"0.64866096",
"0.6475827",
"0.6466782",
"0.64517206",
"0.64517206",
"0.64517206",
"0.64517206",
"0.64517206",
"0.64517206",
"0.64517206",
"0.64491796",
"0.64435166",
"0.64434266",
"0.6434929",
"0.6421151",
"0.6416008",
"0.64093465",
"0.6406956",
"0.64055526",
"0.63899994",
"0.63899994",
"0.6389425",
"0.63808864",
"0.6373643",
"0.6369217",
"0.6366974",
"0.6363147",
"0.63571674",
"0.6353846",
"0.6353846",
"0.6353846",
"0.6353846",
"0.6348918",
"0.6348549",
"0.6347613",
"0.6347613",
"0.63444924",
"0.63396776",
"0.63333786",
"0.63267547",
"0.63259333",
"0.63255167",
"0.6322707",
"0.6318246",
"0.63127834",
"0.6311133",
"0.63109535",
"0.6309992",
"0.6308847",
"0.63069737",
"0.6305315",
"0.63048977",
"0.62979054",
"0.62979054",
"0.62979054",
"0.62969357",
"0.629639",
"0.629639",
"0.629639",
"0.6290471",
"0.6290471",
"0.6288409",
"0.62882894",
"0.6283506"
] |
0.7457703
|
2
|
Use callbacks to share common setup or constraints between actions.
|
def set_transfer
@transfer = Transfer.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def transfer_params
params.require(:tranfers_trancase).permit(:type, :date)
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 filtering_params\n params.permit(:email)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def url_whitelist; end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def 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 permit_request_params\n params.permit(:address)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",
"0.62877893",
"0.62814754",
"0.62416226",
"0.6237962",
"0.62168854",
"0.62127215",
"0.62084496",
"0.61927646",
"0.6176822",
"0.6174079",
"0.6171225",
"0.6161419",
"0.61507314",
"0.6150071",
"0.6145409",
"0.61204594",
"0.61135256",
"0.6105225",
"0.6103249",
"0.6088041",
"0.6079626",
"0.6070542",
"0.6060409",
"0.60198915",
"0.6016795",
"0.6010659",
"0.60103244",
"0.6005393",
"0.6005393",
"0.6000696",
"0.60000104",
"0.59931517",
"0.59916013",
"0.5991397",
"0.5990416",
"0.5979021",
"0.5965926",
"0.59582806",
"0.59579134",
"0.5957629",
"0.5956672",
"0.59518754",
"0.59510773",
"0.5942638",
"0.5937516",
"0.59361875",
"0.59361875",
"0.59336793",
"0.5928626",
"0.5925229",
"0.59243226",
"0.59174913",
"0.5907821",
"0.5907719",
"0.5906177",
"0.59056896",
"0.5897028",
"0.5896294",
"0.5895856",
"0.5893494",
"0.58926904",
"0.589066",
"0.58854234",
"0.58809334",
"0.5878489",
"0.58727074",
"0.5868653",
"0.5866631",
"0.58666086",
"0.5866305",
"0.586484",
"0.58631617",
"0.5861481",
"0.5861059",
"0.5859114",
"0.5858489",
"0.585326",
"0.58530635",
"0.5848788",
"0.58479697"
] |
0.0
|
-1
|
GET /latstraps1s GET /latstraps1s.json
|
def index
@latstraps1s = Latstraps1.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_latstraps1\n @latstraps1 = Latstraps1.find(params[:id])\n end",
"def create\n @latstraps1 = Latstraps1.new(latstraps1_params)\n\n respond_to do |format|\n if @latstraps1.save\n format.html { redirect_to @latstraps1, notice: 'Latstraps1 was successfully created.' }\n format.json { render :show, status: :created, location: @latstraps1 }\n else\n format.html { render :new }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @latstrapshome4s = Latstrapshome4.all\n end",
"def update\n respond_to do |format|\n if @latstraps1.update(latstraps1_params)\n format.html { redirect_to \"/latstraps1s\"}\n format.json { render :show, status: :ok, location: @latstraps1 }\n else\n format.html { render :edit }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end",
"def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def indexs\n\n\n #application/mixare-json \n\n \tslat = params[:slat]\n \tslon = params[:slon]\n \telat = params[:elat]\n \telon = params[:elon]\n\n \t# /hgt/_design/hgt/_view/tags?startkey=[-27,27]\\&endkey=[-25,28]\n #uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags?startkey=[#{slat},#{slon}]&endkey=[#{elat},#{elon}]\"\n uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags\"\n\n request = RestClient.get uri\n\n request = Yajl::Parser.parse(request)\n\n puts request.inspect\n\n response = {}\n response[:results] = []\n\n request[\"rows\"].each do |row|\n\n title = row[\"value\"][\"kind\"] == \"recommendation\" ? \"Go There - \" : \"Don't Go There - \"\n title = \"#{title}#{row['value']['description']}\"\n\n response[:results] << {\n id: row[\"id\"],\n lat: row[\"value\"][\"lat\"].to_s,\n lng: row[\"value\"][\"lon\"].to_s,\n elevation: \"0.0\",\n title: title,\n distance: \"1\",\n has_detail_page: \"0\",\n webpage: \"\"\n }\n end\n response[:status] = \"OK\"\n response[:num_results] = response[:results].length\n render json: response, :content_type => 'application/mixare-json'\n end",
"def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def latstraps1_params\n params.require(:latstraps1).permit(:exercise, :reps, :sets)\n end",
"def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end",
"def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end",
"def set_latstrapshome4\n @latstrapshome4 = Latstrapshome4.find(params[:id])\n end",
"def index\r\n markers = Marker.all\r\n render json: markers\r\n end",
"def index\n @l1s = L1.all\n end",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def index\n @prefix_groups = PrefixGroup.order(:group_name).includes(:prefixes).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prefix_groups }\n end\n end",
"def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end",
"def show\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smallmap }\n end\n end",
"def skjar1\n Apis.client.get('/tv/skjar1')\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def index\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { @url_shorts = UrlShort.all }\n end\n end",
"def index\n @kouteimasters = Kouteimaster.all\n end",
"def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end",
"def index\n @api_v1_initiatives = Api::V1::Initiative.all\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def index\n locations = Location.all\n render json: locations\n end",
"def set_v1_map\n @v1_map = V1::Map.find_by(slug: params[:slug])\n end",
"def index\n @mountains = Mountain.all\n end",
"def index\n @poblamiento_import_locations = PoblamientoImportLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poblamiento_import_locations }\n end\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end",
"def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"def index\n @shouldersbiceps1s = Shouldersbiceps1.all\n end",
"def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end",
"def index\n @sticker = Sticker.find(params[:sticker_id])\n @zones = @sticker.zones\n @user = User.find(params[:user_id])\n declare_sticker\n\n respond_to do |format|\n format.html { gmaps_all_zones_marker }\n format.json { render json: @zones }\n end\n end",
"def from_name\n @locations = Location.where(\"name like ?\", \"%#{params[:id]}%\") \n\n lat = params[:lat]\n lon = params[:lon]\n\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end",
"def show\n respond_to do |format|\n format.html { @api_v1_location }\n format.json { render json: {results: @api_v1_location, message: 'Locations have loaded successfully.'} }\n end\n end",
"def show\n @sasmap = Sasmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def splash()\n\t\t@request.add('/')\n\t\t@request.add('/var/widgets.json?callback=define')\n\t\t@request.add('/system/me?_charset_=utf-8')\n\t\t@request.add('/tags/directory.tagged.json?_charset_=utf-8&_=1342651726188')\n\t\t@request.add('/var/search/activity/all.json?items=12&_charset_=utf-8&_=1342651726197')\n\t\t@request.add('/var/search/public/random-content.json?page=0&items=10&tag=&type=c&_charset_=utf-8&_=1342651726201')\n\t\t@request.add('/var/templates/worlds.2.json?_charset_=utf-8')\n end",
"def index\n @geopoints = Geopoint.all\n @jsons = @geopoints.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @geopoints }\n end\n end",
"def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end",
"def index\n @positives = Positive.all\n @positives_json= Positive.all.map(&:lonlat).as_json\n\n\n\n\n\n end",
"def index\n @shorteners = Shortener.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorteners }\n end\n end",
"def destroy\n @latstraps1.destroy\n respond_to do |format|\n format.html { redirect_to latstraps1s_url, notice: 'Latstraps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end",
"def index\n locations = @project.locations.all\n render json: { locations: locations }\n end",
"def index\n #@world_maps = WorldMap.all\n\n respond_to do |format|\n format.html # index.erb.erb\n format.json { render json: @world_maps }\n end\n end",
"def index\n @stations = Station.all\n\n render json: @stations\n end",
"def index\n file = File.read \"db/extract.json\"\n data = JSON.parse(file)\n @places = PLACES\n end",
"def create\n @latstrapshome4 = Latstrapshome4.new(latstrapshome4_params)\n\n respond_to do |format|\n if @latstrapshome4.save\n format.html { redirect_to @latstrapshome4, notice: 'Latstrapshome4 was successfully created.' }\n format.json { render :show, status: :created, location: @latstrapshome4 }\n else\n format.html { render :new }\n format.json { render json: @latstrapshome4.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n skickers = Skicker.order(power: :asc)\n render json: { status: 'SUCCESS', message: 'Loaded skickers', value: skickers }\n end",
"def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def index\n @maps = Map.order(name: :asc)\n @title = 'Maps'\n @page_class = 'maps'\n end",
"def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end",
"def index\n @monuments = Monument.geocoded #returns monuments with coordinates\n\n @markers = @monuments.map do |flat|\n {\n lat: flat.latitude,\n lng: flat.longitude\n }\n end\n end",
"def index\n @map_versions = MapVersion.order(:position)\n\n @formattedMaps = @map_versions.map do |map|\n {\n 'version' => {'value' => map.version, 'searchable' => true, 'sortable' => true},\n 'position' => {'value' => map.position, 'searchable' => true, 'sortable' => true},\n 'description' => {'value' => map.description, 'searchable' => true, 'sortable' => true},\n 'edit' => {'value' => edit_admin_map_version_path(map)},\n 'delete' => {'value' => admin_map_version_path(map), 'method' => 'delete'}\n }\n end\n\n gon.map_versions = @formattedMaps;\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @map_versions }\n end\n end",
"def index\n @bicepstriceps1s = Bicepstriceps1.all\n end",
"def index\n if @campaign\n @maps = @campaign.maps\n render json: @maps\n else\n render json: @maps.errors, status: :unprocessable_entity\n end\n end",
"def snpi\n if latlonra[:latitude]\n #Creates new location to be matched\n @location = Location.new({:latitude => latlonra[:latitude], :longitude => latlonra[:longitude], :name => '', :description => ''})\n #Runs Get SNPI from models/location.rb\n @locations = Location.get_snpi(@location,Location.all, latlonra[:radius])\n #Uses orinila parameter for @Locations_json\n @locations_json = @locations.to_json\n end\n end",
"def country_api\n # endpoint = \"https://corona.lmao.ninja/countries\"\n endpoint = 'https://corona.lmao.ninja/v2/countries'\n response = HTTParty.get(endpoint)\n data = JSON.parse response.body\n res = data\n result =[]\n endpoint_all = \"https://corona.lmao.ninja/all\"\n response1 = HTTParty.get(endpoint_all)\n data1 = JSON.parse response1.body\n res1 = data1\n result<<{\n country: \"world\",\n cases: res1[\"cases\"],\n todayCases: res1[\"todayCases\"],\n deaths: res1[\"deaths\"],\n todayDeaths: res1[\"todayDeaths\"],\n recovered: res1[\"recovered\"],\n active: res1[\"active\"],\n critical: res1[\"critical\"],\n casesPerOneMillion: res1[\"casesPerOneMillion\"],\n deathsPerOneMillion: res1[\"deathsPerOneMillion\"],\n tests: res1[\"tests\"],\n testsPerOneMillion: res1[\"testsPerOneMillion\"],\n affectedCountries: res1[\"affectedCountries\"]\n }\n\n res.each do |country|\n result<<{\n country: country[\"country\"],\n lat: country[\"countryInfo\"][\"lat\"],\n long: country[\"countryInfo\"][\"long\"],\n flag: country[\"countryInfo\"][\"flag\"],\n cases: country[\"cases\"],\n todayCases: country[\"todayCases\"],\n deaths: country[\"deaths\"],\n todayDeaths: country[\"todayDeaths\"],\n recovered: country[\"recovered\"],\n active: country[\"active\"],\n critical: country[\"critical\"],\n casesPerOneMillion: country[\"casesPerOneMillion\"],\n deathsPerOneMillion: country[\"deathsPerOneMillion\"],\n tests: country[\"tests\"],\n testsPerOneMillion: country[\"testsPerOneMillion\"]\n }\n end\n render json: result\n end",
"def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end",
"def getMsa\r\n census_geo, url = CensusApi.getGeoInfo(params[:lat], params[:lon])\r\n @Output = MsaMapping.getMsaByGeo(census_geo[:partialGeoId])\r\n render :json => @Output\r\n end",
"def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end",
"def index\n @platoons = Platoon.all\n end",
"def locations\n get('locations')\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end",
"def index\n @halalfoodhunt_seos = HalalfoodhuntSeo.all\n @search = Supermarket.ransack(params[:q])\n @search.sorts = 'created_at DESC' if @search.sorts.empty?\n @supermarkets = @search.result.where(draft: false)\n @qualifying_type = QualifyingType.all\n @hash = Gmaps4rails.build_markers(@supermarkets) do |supermarket, marker|\n marker.lat supermarket.latitude\n marker.lng supermarket.longitude\n marker.json({operating_address: supermarket.operating_address})\n marker.picture({\n \"url\" => \"http://friends.jumaiyah.com/wp-content/uploads/2016/10/shadows-marker.png\",\n \"width\" => 52,\n \"height\" => 52})\n marker.infowindow render_to_string(:partial => \"/layouts/infobox2\", :locals => { :supermarket => supermarket})\n end\n respond_to do |format|\n format.html\n format.json { render json: @places }\n end\n end",
"def index\n @api_v1_initiative_groups = Api::V1::InitiativeGroup.all\n end",
"def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end",
"def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end",
"def index\n @laws = Law.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def index\n @zones = Zone.all\n\n render json: @zones\n end",
"def index\n @api_v1_stores = Store.all\n json_response(@api_v1_stores)\n end",
"def index\n @api_v1_menus = Menu.all\n render json: @api_v1_menus\n end",
"def show\n @campus_food = CampusFood.find(params[:id])\n\t@loc = params[:loc]\n\t\n\t@locations = Location.all(:conditions =>[ \"loc like ? \", \"%#{params[:loc]}%\"])\n\tif !@locations.empty?\n @lat = @locations[0].lat\n @lng = @locations[0].lng\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @livingsupplies = Livingsupply.all\n end",
"def index\n @supermarkets = Supermarket.all\n respond_to do |format|\n format.json { render json: @supermarkets, status: :ok } \n end \n end",
"def index\n @starter_packs = StarterPack.all\n end",
"def index\n @regiones = Region.all\n\n render json: @regiones\n end",
"def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end",
"def index\n @user_locations = ::Users::UserLocation.where(user_id: auth_user.id).order('is_primary desc')\n @page_title = 'Your Addresses'\n\n respond_to do|format|\n format.html\n format.json { render json: @user_locations }\n end\n end",
"def index\n @gpsds = Gpsd.all\n #respond_to do |format|\n # format.json { render }\n #end\n end",
"def index\n @location_points = LocationPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @location_points }\n end\n end",
"def show\n @loja = Loja.find(params[:id])\n\n\n\n @json = Loja.find(params[:id]).to_gmaps4rails\n @loja_concorrencia = LojaConcorrencium.all\n @outdoors = Outdoor.all\n @local_desportivo = LocalDesportivo.all\n\n @todos = Outdoor.all + Loja.all + Outro.all + LocalDesportivo.all + LojaConcorrencium.all\n\n @json = @todos.to_gmaps4rails\n\n @zone2 = Loja.first.latitude\n @zone1 = Loja.first.longitude\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loja }\n end\n end",
"def index\n if @project\n @lists = @project.lists.order('name ASC')\n @locations = @project.lists.map{|l| l.locations }.flatten\n else\n @lists = Studylist.order('name ASC')\n end\n @hash = Gmaps4rails.build_markers(@locations) do |location, marker|\n marker.lat location.latitude\n marker.lng location.longitude\n marker.infowindow \"#{location.locatable.name}: #{location.locatable.description}. \n <a href='#{url_for([location.locatable.project, location.locatable])}'>...more</a>\"\n marker.json({ title: location.locatable.name })\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @lists }\n end\n end",
"def new\n @smallmap = Smallmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smallmap }\n end\n end",
"def index\n @states = State.all\n \n render json: @states\n end",
"def index\n @p1s = P1.all\n end",
"def index\n @locations = @organization.locations.all\n\n @map = Cartographer::Gmap.new( 'map' )\n @map.zoom = :bound\n @map.icons << Cartographer::Gicon.new\n \n @organization.locations.each do |location|\n @map.markers << \n Cartographer::Gmarker.new(\n :name => 'location_'+Digest::MD5.hexdigest(location.name),\n :marker_type => \"Building\",\n :position => [location.lat, location.lng],\n :info_window_url => \"fixme.org\"\n )\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @polygons = Polygon.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @polygons }\n end\n end",
"def map\n \tif(params[:nombre])\n\t @salas = Sala.search(params[:nombre])\n\t else\n \t@salas = Sala.all\n \tend\n\n respond_to do |format|\n format.html # map.html.erb\n format.json { render json: @salas }\n end\n end",
"def index\n @drop_locations = DropLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drop_locations }\n end\n end",
"def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end",
"def get_static_assests\n types = LocationType.all\n facilities = Facility.all\n type_array = []\n facility_array = []\n types.each do |type|\n type_array << type.name\n end\n facilities.each do |facility|\n facility_array << facility.name\n end\n render json: { location_types: type_array, location_facilities: facility_array }\n end",
"def index\n @lids = Lid.order(\"lower(name) ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lids }\n end\n end",
"def index\n @listings = Listing.all\n render json: @listings\n end"
] |
[
"0.71037024",
"0.6500376",
"0.6446585",
"0.5903811",
"0.5833954",
"0.5670466",
"0.5579053",
"0.55710405",
"0.55571175",
"0.55066556",
"0.5506401",
"0.54144996",
"0.5412773",
"0.5410335",
"0.54012185",
"0.53753346",
"0.5348309",
"0.5330392",
"0.53043866",
"0.53006077",
"0.52976716",
"0.5284351",
"0.5274762",
"0.5270108",
"0.52656144",
"0.52497137",
"0.522498",
"0.52216136",
"0.52074206",
"0.52045196",
"0.51952904",
"0.5193135",
"0.51825774",
"0.5180244",
"0.5157899",
"0.51574624",
"0.5156216",
"0.5155633",
"0.5149291",
"0.51421535",
"0.51324916",
"0.5129781",
"0.5129486",
"0.5119209",
"0.51189154",
"0.5118504",
"0.51081026",
"0.50977707",
"0.50963545",
"0.50949466",
"0.5094813",
"0.5092027",
"0.5080026",
"0.5076636",
"0.5068075",
"0.506683",
"0.50654244",
"0.5063145",
"0.5059463",
"0.50534284",
"0.5046242",
"0.5039643",
"0.5039338",
"0.50285876",
"0.50171316",
"0.50163084",
"0.5015771",
"0.5015576",
"0.5015085",
"0.5014371",
"0.5011913",
"0.50093555",
"0.50069463",
"0.5006608",
"0.500514",
"0.5002011",
"0.5000525",
"0.49966124",
"0.499546",
"0.4988749",
"0.49884266",
"0.49854705",
"0.4982015",
"0.49819937",
"0.49800545",
"0.49773696",
"0.49757636",
"0.4975032",
"0.49692026",
"0.49686682",
"0.49681562",
"0.49642092",
"0.49610698",
"0.4958056",
"0.49501958",
"0.49500754",
"0.4949989",
"0.49498126",
"0.49464676",
"0.49458277"
] |
0.7809883
|
0
|
GET /latstraps1s/1 GET /latstraps1s/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @latstraps1s = Latstraps1.all\n end",
"def set_latstraps1\n @latstraps1 = Latstraps1.find(params[:id])\n end",
"def create\n @latstraps1 = Latstraps1.new(latstraps1_params)\n\n respond_to do |format|\n if @latstraps1.save\n format.html { redirect_to @latstraps1, notice: 'Latstraps1 was successfully created.' }\n format.json { render :show, status: :created, location: @latstraps1 }\n else\n format.html { render :new }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @latstrapshome4s = Latstrapshome4.all\n end",
"def update\n respond_to do |format|\n if @latstraps1.update(latstraps1_params)\n format.html { redirect_to \"/latstraps1s\"}\n format.json { render :show, status: :ok, location: @latstraps1 }\n else\n format.html { render :edit }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smallmap }\n end\n end",
"def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1_locations }\n format.json { render json: {results: @api_v1_locations, message: 'Locations have loaded successfully.'} }\n end\n end",
"def index\r\n @locations = Location.all\r\n @mv = MapsVersion.first\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end",
"def set_latstrapshome4\n @latstrapshome4 = Latstrapshome4.find(params[:id])\n end",
"def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end",
"def show\n @sasmap = Sasmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def show\n @boot = Boot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boot }\n end\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n respond_to do |format|\n format.html { @api_v1_location }\n format.json { render json: {results: @api_v1_location, message: 'Locations have loaded successfully.'} }\n end\n end",
"def index\n @lugars = Lugar.all\n\n render json: @lugars\n end",
"def show\n @plate = Plate.find(params[:id])\n\n render json: @plate\n end",
"def indexs\n\n\n #application/mixare-json \n\n \tslat = params[:slat]\n \tslon = params[:slon]\n \telat = params[:elat]\n \telon = params[:elon]\n\n \t# /hgt/_design/hgt/_view/tags?startkey=[-27,27]\\&endkey=[-25,28]\n #uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags?startkey=[#{slat},#{slon}]&endkey=[#{elat},#{elon}]\"\n uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags\"\n\n request = RestClient.get uri\n\n request = Yajl::Parser.parse(request)\n\n puts request.inspect\n\n response = {}\n response[:results] = []\n\n request[\"rows\"].each do |row|\n\n title = row[\"value\"][\"kind\"] == \"recommendation\" ? \"Go There - \" : \"Don't Go There - \"\n title = \"#{title}#{row['value']['description']}\"\n\n response[:results] << {\n id: row[\"id\"],\n lat: row[\"value\"][\"lat\"].to_s,\n lng: row[\"value\"][\"lon\"].to_s,\n elevation: \"0.0\",\n title: title,\n distance: \"1\",\n has_detail_page: \"0\",\n webpage: \"\"\n }\n end\n response[:status] = \"OK\"\n response[:num_results] = response[:results].length\n render json: response, :content_type => 'application/mixare-json'\n end",
"def show\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_map_road }\n end\n end",
"def new\n @smallmap = Smallmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smallmap }\n end\n end",
"def index\r\n markers = Marker.all\r\n render json: markers\r\n end",
"def index\n @slams = Slam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slams }\n end\n end",
"def show\n @shiftmap = Shiftmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shiftmap }\n end\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def index\n locations = Location.all\n render json: locations\n end",
"def index\n @locations = Location.roots.order(:location_name) \n render :json => @locations #Using Location serializer by default\n end",
"def show\n @campus_food = CampusFood.find(params[:id])\n\t@loc = params[:loc]\n\t\n\t@locations = Location.all(:conditions =>[ \"loc like ? \", \"%#{params[:loc]}%\"])\n\tif !@locations.empty?\n @lat = @locations[0].lat\n @lng = @locations[0].lng\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n locations = @project.locations.all\n render json: { locations: locations }\n end",
"def skjar1\n Apis.client.get('/tv/skjar1')\n end",
"def index\n @service_locations = ServiceLocation.all\n render json: @service_locations\n end",
"def new\n @sasmap = Sasmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def latstraps1_params\n params.require(:latstraps1).permit(:exercise, :reps, :sets)\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end",
"def index\n @poblamiento_import_locations = PoblamientoImportLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @poblamiento_import_locations }\n end\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def index\n #@world_maps = WorldMap.all\n\n respond_to do |format|\n format.html # index.erb.erb\n format.json { render json: @world_maps }\n end\n end",
"def show\n @loja = Loja.find(params[:id])\n\n\n\n @json = Loja.find(params[:id]).to_gmaps4rails\n @loja_concorrencia = LojaConcorrencium.all\n @outdoors = Outdoor.all\n @local_desportivo = LocalDesportivo.all\n\n @todos = Outdoor.all + Loja.all + Outro.all + LocalDesportivo.all + LojaConcorrencium.all\n\n @json = @todos.to_gmaps4rails\n\n @zone2 = Loja.first.latitude\n @zone1 = Loja.first.longitude\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loja }\n end\n end",
"def index\n @stations = Station.all\n\n render json: @stations\n end",
"def from_name\n @locations = Location.where(\"name like ?\", \"%#{params[:id]}%\") \n\n lat = params[:lat]\n lon = params[:lon]\n\n if(lat and lon)\n @locations = Location.nearest_five(lat.to_f, lon.to_f, @locations)\n end\n\n respond_to do |format|\n format.html\n format.json { render :json => @locations }\n end\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def index\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { @url_shorts = UrlShort.all }\n end\n end",
"def show\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_url_map }\n end\n end",
"def locations\n get('locations')\n end",
"def getMsa\r\n census_geo, url = CensusApi.getGeoInfo(params[:lat], params[:lon])\r\n @Output = MsaMapping.getMsaByGeo(census_geo[:partialGeoId])\r\n render :json => @Output\r\n end",
"def map\n respond_to do |format|\n format.html do\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n\n @json_location = constituency_map_path(@constituency.graph_id, format: 'json')\n end\n\n format.json do\n @constituency = Parliament::Utils::Helpers::RequestHelper.filter_response_data(\n Parliament::Utils::Helpers::ParliamentHelper.parliament_request.constituency_map.set_url_params({ constituency_id: params[:constituency_id] }),\n Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')\n ).first\n\n raise ActionController::RoutingError, 'Not Found' unless @constituency.current?\n\n render json: GeosparqlToGeojson.convert_to_geojson(\n geosparql_values: @constituency.area.polygon,\n geosparql_properties: {\n name: @constituency.name,\n start_date: @constituency.start_date,\n end_date: @constituency.end_date\n },\n reverse: false\n ).geojson\n end\n end\n end",
"def map\n respond_to do |format|\n format.html do\n @constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first\n\n @json_location = constituency_map_path(@constituency.graph_id, format: 'json')\n end\n\n format.json do\n @constituency = Parliament::Utils::Helpers::RequestHelper.filter_response_data(\n Parliament::Utils::Helpers::ParliamentHelper.parliament_request.constituency_map.set_url_params({ constituency_id: params[:constituency_id] }),\n Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')\n ).first\n\n raise ActionController::RoutingError, 'Not Found' unless @constituency.current?\n\n render json: GeosparqlToGeojson.convert_to_geojson(\n geosparql_values: @constituency.area.polygon,\n geosparql_properties: {\n name: @constituency.name,\n start_date: @constituency.start_date,\n end_date: @constituency.end_date\n },\n reverse: false\n ).geojson\n end\n end\n end",
"def snpi\n if latlonra[:latitude]\n #Creates new location to be matched\n @location = Location.new({:latitude => latlonra[:latitude], :longitude => latlonra[:longitude], :name => '', :description => ''})\n #Runs Get SNPI from models/location.rb\n @locations = Location.get_snpi(@location,Location.all, latlonra[:radius])\n #Uses orinila parameter for @Locations_json\n @locations_json = @locations.to_json\n end\n end",
"def index\n @mountains = Mountain.all\n end",
"def index\n @sticker = Sticker.find(params[:sticker_id])\n @zones = @sticker.zones\n @user = User.find(params[:user_id])\n declare_sticker\n\n respond_to do |format|\n format.html { gmaps_all_zones_marker }\n format.json { render json: @zones }\n end\n end",
"def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end",
"def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end",
"def show\n @sklad = Sklad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sklad }\n end\n end",
"def index\r\n @locations = Location.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @locations }\r\n end\r\n end",
"def show\n @lift = Lift.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lift }\n end\n end",
"def create\n @latstrapshome4 = Latstrapshome4.new(latstrapshome4_params)\n\n respond_to do |format|\n if @latstrapshome4.save\n format.html { redirect_to @latstrapshome4, notice: 'Latstrapshome4 was successfully created.' }\n format.json { render :show, status: :created, location: @latstrapshome4 }\n else\n format.html { render :new }\n format.json { render json: @latstrapshome4.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @geopoints = Geopoint.all\n @jsons = @geopoints.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @geopoints }\n end\n end",
"def index\n if @campaign\n @maps = @campaign.maps\n render json: @maps\n else\n render json: @maps.errors, status: :unprocessable_entity\n end\n end",
"def show\n @pinglun = Pinglun.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pinglun }\n end\n end",
"def show\n @slab = Slab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @slab }\n end\n end",
"def index\n @drop_locations = DropLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drop_locations }\n end\n end",
"def index\n @coasters = Coaster.all\n\n render json: @coasters\n end",
"def index\n @positives = Positive.all\n @positives_json= Positive.all.map(&:lonlat).as_json\n\n\n\n\n\n end",
"def show\n @tinymap = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap }\n end\n end",
"def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end",
"def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end",
"def index\n file = File.read \"db/extract.json\"\n data = JSON.parse(file)\n @places = PLACES\n end",
"def show\n @asset_host = DayzGps::Application.config.action_controller.asset_host ||\n \"http://localhost:#{request.port.inspect}\"\n respond_to do |format|\n format.html\n format.json { render json: @group_map.map_markers }\n end\n end",
"def index\n @litters = Litter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @litters }\n end\n end",
"def index\n @concept_maps = ConceptMap.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json:@concept_maps }\n end\n end",
"def index\n @locations = Location.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @locations }\n end\n end",
"def index\n @stations = Station.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stations }\n end\n end",
"def show\n @tinymap2 = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap2 }\n end\n end",
"def index\n @gpsds = Gpsd.all\n #respond_to do |format|\n # format.json { render }\n #end\n end",
"def index\n @pinns = Pinn.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pinns }\n end\n end",
"def show\n render json: @gpsd\n end",
"def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end",
"def index\n @zones = Zone.all\n\n render json: @zones\n end",
"def splash()\n\t\t@request.add('/')\n\t\t@request.add('/var/widgets.json?callback=define')\n\t\t@request.add('/system/me?_charset_=utf-8')\n\t\t@request.add('/tags/directory.tagged.json?_charset_=utf-8&_=1342651726188')\n\t\t@request.add('/var/search/activity/all.json?items=12&_charset_=utf-8&_=1342651726197')\n\t\t@request.add('/var/search/public/random-content.json?page=0&items=10&tag=&type=c&_charset_=utf-8&_=1342651726201')\n\t\t@request.add('/var/templates/worlds.2.json?_charset_=utf-8')\n end",
"def index\n @kouteimasters = Kouteimaster.all\n end",
"def load_station_data\n data = Net::HTTP.get(URI.parse(stations_url))\n JSON.parse(data)[\"result\"]\n end",
"def set_v1_map\n @v1_map = V1::Map.find_by(slug: params[:slug])\n end",
"def show\n @bootcamp = Bootcamp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bootcamp }\n end\n end",
"def index\n @prefix_groups = PrefixGroup.order(:group_name).includes(:prefixes).page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prefix_groups }\n end\n end",
"def index\n @api_v1_initiatives = Api::V1::Initiative.all\n end",
"def show\n @chef_mapping = ChefMapping.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chef_mapping }\n end\n end",
"def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end",
"def show\n @listing = Listing.find(params[:id])\n @user=User.all\n @tip= @listing.tips\n @vv=@listing.pens \n @json=@vv.all.to_gmaps4rails;\n end",
"def show\n @location = Location.find(params[:id])\n render json: @locationProut\n end",
"def show\n @admin_geonode = Admin::Geonode.find(params[:id])\n @json = @admin_geonode.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_geonode }\n end\n end",
"def index\n @locations = Location.order(\"id desc\").page(params[:page]).per(50)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end",
"def update\n respond_to do |format|\n if @latstrapshome4.update(latstrapshome4_params)\n format.html { redirect_to \"/latstrapshome4s\"}\n format.json { render :show, status: :ok, location: @latstrapshome4 }\n else\n format.html { render :edit }\n format.json { render json: @latstrapshome4.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html { render layout: false }\n format.json\n format.geojson\n end\n end",
"def destroy\n @latstraps1.destroy\n respond_to do |format|\n format.html { redirect_to latstraps1s_url, notice: 'Latstraps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locations }\n end\n end",
"def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end",
"def index\n if @project\n @lists = @project.lists.order('name ASC')\n @locations = @project.lists.map{|l| l.locations }.flatten\n else\n @lists = Studylist.order('name ASC')\n end\n @hash = Gmaps4rails.build_markers(@locations) do |location, marker|\n marker.lat location.latitude\n marker.lng location.longitude\n marker.infowindow \"#{location.locatable.name}: #{location.locatable.description}. \n <a href='#{url_for([location.locatable.project, location.locatable])}'>...more</a>\"\n marker.json({ title: location.locatable.name })\n end\n\n respond_to do |format|\n format.html { render layout: 'fluid' }# index.html.erb\n format.json { render json: @lists }\n end\n end",
"def index\n @location_points = LocationPoint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @location_points }\n end\n end"
] |
[
"0.745412",
"0.71234393",
"0.64603186",
"0.6256377",
"0.6194292",
"0.5827636",
"0.5821374",
"0.5758407",
"0.5692765",
"0.5672097",
"0.5651511",
"0.5640348",
"0.55883646",
"0.5578611",
"0.55353594",
"0.55040306",
"0.54781944",
"0.54655915",
"0.54646647",
"0.54426885",
"0.54358226",
"0.5434993",
"0.5430054",
"0.54245937",
"0.5422303",
"0.53990626",
"0.53729385",
"0.5359405",
"0.5348172",
"0.53476423",
"0.5344921",
"0.5342301",
"0.53353703",
"0.5314527",
"0.5313653",
"0.53129303",
"0.53089726",
"0.5304718",
"0.5296982",
"0.5292864",
"0.5288923",
"0.5287536",
"0.5277153",
"0.5276896",
"0.5261229",
"0.5257433",
"0.5256702",
"0.52541786",
"0.5248103",
"0.52413017",
"0.52350533",
"0.5227438",
"0.5226985",
"0.52238935",
"0.5214923",
"0.52095485",
"0.52087516",
"0.52086043",
"0.520084",
"0.5195472",
"0.51953685",
"0.5195351",
"0.51941425",
"0.51908535",
"0.51890194",
"0.51867354",
"0.5185958",
"0.5183806",
"0.5182196",
"0.5181889",
"0.5181421",
"0.51728487",
"0.5172328",
"0.51723003",
"0.5170738",
"0.5169284",
"0.5166359",
"0.51636493",
"0.51596266",
"0.5155479",
"0.5151083",
"0.5149837",
"0.5149415",
"0.5147841",
"0.5138329",
"0.51373875",
"0.51363796",
"0.51351506",
"0.5134816",
"0.51327634",
"0.5127724",
"0.5121756",
"0.5121658",
"0.5118702",
"0.511652",
"0.5113145",
"0.5112551",
"0.5111988",
"0.5106492",
"0.5103572",
"0.5101944"
] |
0.0
|
-1
|
POST /latstraps1s POST /latstraps1s.json
|
def create
@latstraps1 = Latstraps1.new(latstraps1_params)
respond_to do |format|
if @latstraps1.save
format.html { redirect_to @latstraps1, notice: 'Latstraps1 was successfully created.' }
format.json { render :show, status: :created, location: @latstraps1 }
else
format.html { render :new }
format.json { render json: @latstraps1.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_latstraps1\n @latstraps1 = Latstraps1.find(params[:id])\n end",
"def latstraps1_params\n params.require(:latstraps1).permit(:exercise, :reps, :sets)\n end",
"def index\n @latstraps1s = Latstraps1.all\n end",
"def create\n @latstrapshome4 = Latstrapshome4.new(latstrapshome4_params)\n\n respond_to do |format|\n if @latstrapshome4.save\n format.html { redirect_to @latstrapshome4, notice: 'Latstrapshome4 was successfully created.' }\n format.json { render :show, status: :created, location: @latstrapshome4 }\n else\n format.html { render :new }\n format.json { render json: @latstrapshome4.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @latstraps1.update(latstraps1_params)\n format.html { redirect_to \"/latstraps1s\"}\n format.json { render :show, status: :ok, location: @latstraps1 }\n else\n format.html { render :edit }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @smallmap = Smallmap.new(params[:smallmap])\n\n respond_to do |format|\n if @smallmap.save\n format.html { redirect_to @smallmap, notice: 'Smallmap was successfully created.' }\n format.json { render json: @smallmap, status: :created, location: @smallmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @smallmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def latstrapshome4_params\n params.require(:latstrapshome4).permit(:exercise, :reps, :sets)\n end",
"def destroy\n @latstraps1.destroy\n respond_to do |format|\n format.html { redirect_to latstraps1s_url, notice: 'Latstraps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def index\n @latstrapshome4s = Latstrapshome4.all\n end",
"def create\n @sasmap = Sasmap.new(params[:sasmap])\n\n respond_to do |format|\n if @sasmap.save\n format.html { redirect_to @sasmap, notice: 'Sasmap was successfully created.' }\n format.json { render json: @sasmap, status: :created, location: @sasmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sasmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shouldersbiceps1 = Shouldersbiceps1.new(shouldersbiceps1_params)\n\n respond_to do |format|\n if @shouldersbiceps1.save\n format.html { redirect_to @shouldersbiceps1, notice: 'Shouldersbiceps1 was successfully created.' }\n format.json { render :show, status: :created, location: @shouldersbiceps1 }\n else\n format.html { render :new }\n format.json { render json: @shouldersbiceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @landmaster = Landmaster.new(landmaster_params)\n \n respond_to do |format|\n if @landmaster.save\n format.html { redirect_to landmasters_path, notice: 'Landmaster was successfully created.' }\n format.json { render :show, status: :created, location: @landmaster }\n else\n format.html { render :new }\n format.json { render json: @landmaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @label_set = LabelSet.new(label_set_params)\n\n respond_to do |format|\n if @label_set.save\n format.html { redirect_to @label_set, notice: 'Label set was successfully created.' }\n format.json { render :show, status: :created, location: @label_set }\n else\n format.html { render :new }\n format.json { render json: @label_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @location = Location.find(params[:location_id])\n @shelf = @location.shelves.new\n respond_to do |format|\n if @shelf.save\n format.html { redirect_to @location, notice: 'Shelf added.' }\n format.js { render js: \"thot.increase_counter('#shc_#{@location.id}');\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_latstrapshome4\n @latstrapshome4 = Latstrapshome4.find(params[:id])\n end",
"def create\n @plate = Plate.new(params[:plate])\n\n if @plate.save\n render json: @plate, status: :created, location: @plate\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def create\n @stone = Stone.new(stone_params)\n\n \n if @stone.save\n respond_with @stone\n else\n render json: @stone.errors, status: :unprocessable_entity \n end\n \n \n end",
"def create\n @spawner = Spawner.new(spawner_params)\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.save\n format.html { redirect_to @spawner, notice: 'Spawner was successfully created.' }\n format.json { render json: @spawner, status: :created, location: @spawner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mountain = Mountain.new(mountain_params)\n\n respond_to do |format|\n if @mountain.save\n format.html { redirect_to @mountain, notice: 'Mountain was successfully created.' }\n format.json { render :show, status: :created, location: @mountain }\n else\n format.html { render :new }\n format.json { render json: @mountain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end",
"def new\n @smallmap = Smallmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @smallmap }\n end\n end",
"def create\n Mountain.create mountain_params\n redirect_to (mountains_path)\n end",
"def create\n @mini_map_road = MiniMapRoad.new(params[:mini_map_road])\n\n respond_to do |format|\n if @mini_map_road.save\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully created.' }\n format.json { render json: @mini_map_road, status: :created, location: @mini_map_road }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sklad = Sklad.new(params[:sklad])\n\n respond_to do |format|\n if @sklad.save\n format.html { redirect_to @sklad, notice: 'Sklad was successfully created.' }\n format.json { render json: @sklad, status: :created, location: @sklad }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sklad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bicepstriceps1 = Bicepstriceps1.new(bicepstriceps1_params)\n\n respond_to do |format|\n if @bicepstriceps1.save\n format.html { redirect_to @bicepstriceps1, notice: 'Bicepstriceps1 was successfully created.' }\n format.json { render :show, status: :created, location: @bicepstriceps1 }\n else\n format.html { render :new }\n format.json { render json: @bicepstriceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stilage = Stilage.new(stilage_params)\n respond_to do |format|\n if @stilage.save\n format.html { redirect_to @stilage, notice: 'Stilage was successfully created.' }\n format.json { render :show, status: :created, location: @stilage }\n else\n format.html { render :new }\n format.json { render json: @stilage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spltrain = Spltrain.new(spltrain_params)\n\n respond_to do |format|\n if @spltrain.save\n format.html { redirect_to @spltrain, notice: 'Spltrain was successfully created.' }\n format.json { render :show, status: :created, location: @spltrain }\n else\n format.html { render :new }\n format.json { render json: @spltrain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @sasmap = Sasmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sasmap }\n end\n end",
"def create\n @kota_stone = KotaStone.new(kota_stone_params)\n\n respond_to do |format|\n if @kota_stone.save\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully created.' }\n format.json { render action: 'show', status: :created, location: @kota_stone }\n else\n format.html { render action: 'new' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @testboot = Testboot.new(testboot_params)\n\n respond_to do |format|\n if @testboot.save\n format.html { redirect_to @testboot, notice: 'Testboot was successfully created.' }\n format.json { render :show, status: :created, location: @testboot }\n else\n format.html { render :new }\n format.json { render json: @testboot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sekilas_info = SekilasInfo.new(sekilas_info_params)\n\n respond_to do |format|\n if @sekilas_info.save\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sekilas_info }\n else\n format.html { render action: 'new' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_snack\n response = RestClient.post SNACKS_URL, {name: @suggestion.name, location: @suggestion.location}.to_json, content_type: :json\n logger.debug \"web service response code => #{response.code}\"\n if response.code != 200\n flash[:notice] = \"Error: #{response.code} while communicating with services, please try again later.\"\n end\n parsed = JSON.parse(response) \n end",
"def create\n @flat_stage = Flat::Stage.new(flat_stage_params)\n\n respond_to do |format|\n if @flat_stage.save\n format.html { redirect_to @flat_stage, notice: 'Stage was successfully created.' }\n format.json { render :show, status: :created, location: @flat_stage }\n else\n format.html { render :new }\n format.json { render json: @flat_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n s = Spooge.new()\n create_status = s.save\n n = generate_random_name\n s.name = n\n s.email = \"#{n}@gmail.com\"\n s.touch_date = DateTime.now\n s.status = STATUS[rand(STATUS.length)]\n\n resp = {:create_status => create_status, :record => s}\n render :json => resp\n end",
"def create\n @labelling = Labelling.new(params[:labelling])\n\n respond_to do |format|\n if @labelling.save\n format.html { redirect_to @labelling, notice: 'Labelling was successfully created.' }\n format.json { render json: @labelling, status: :created, location: @labelling }\n else\n format.html { render action: \"new\" }\n format.json { render json: @labelling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @knowledge_point = KnowledgePoint.new(params[:knowledge_point])\n params[:structure_ids].each do |structure_id|\n @structure = Structure.find_by_id(structure_id)\n @knowledge_point.structures << @structure\n end\n respond_to do |format|\n if @knowledge_point.save\n format.html { redirect_to @knowledge_point, :notice => 'Knowledge point was successfully created.' }\n format.json { render :json => @knowledge_point, :status => :created, :location => @knowledge_point }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @knowledge_point.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @stone = Stone.new(params[:stone])\n\n respond_to do |format|\n if @stone.save\n format.html { redirect_to @stone, notice: 'Stone was successfully created.' }\n format.json { render json: @stone, status: :created, location: @stone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @latstrapshome4.update(latstrapshome4_params)\n format.html { redirect_to \"/latstrapshome4s\"}\n format.json { render :show, status: :ok, location: @latstrapshome4 }\n else\n format.html { render :edit }\n format.json { render json: @latstrapshome4.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stackup = Stackup.new(stackup_params)\n\n respond_to do |format|\n if @stackup.save\n format.html { redirect_to @stackup, notice: 'Stackup was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stackup }\n else\n format.html { render action: 'new' }\n format.json { render json: @stackup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @start_male_pole_jump = StartMalePoleJump.new(start_male_pole_jump_params)\n\n respond_to do |format|\n if @start_male_pole_jump.save\n format.html { redirect_to action:index, notice: 'Start male pole jump was successfully created.' }\n format.json { render :show, status: :created, location: @start_male_pole_jump }\n else\n format.html { render :new }\n format.json { render json: @start_male_pole_jump.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @strain = Strain.new(params[:strain])\n\n respond_to do |format|\n if @strain.save\n format.html { redirect_to @strain, :notice => 'Strain was successfully created.' }\n format.json { render :json => @strain, :status => :created, :location => @strain }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @strain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def indexs\n\n\n #application/mixare-json \n\n \tslat = params[:slat]\n \tslon = params[:slon]\n \telat = params[:elat]\n \telon = params[:elon]\n\n \t# /hgt/_design/hgt/_view/tags?startkey=[-27,27]\\&endkey=[-25,28]\n #uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags?startkey=[#{slat},#{slon}]&endkey=[#{elat},#{elon}]\"\n uri = \"#{DATABASE}/hgt/_design/hgt/_view/tags\"\n\n request = RestClient.get uri\n\n request = Yajl::Parser.parse(request)\n\n puts request.inspect\n\n response = {}\n response[:results] = []\n\n request[\"rows\"].each do |row|\n\n title = row[\"value\"][\"kind\"] == \"recommendation\" ? \"Go There - \" : \"Don't Go There - \"\n title = \"#{title}#{row['value']['description']}\"\n\n response[:results] << {\n id: row[\"id\"],\n lat: row[\"value\"][\"lat\"].to_s,\n lng: row[\"value\"][\"lon\"].to_s,\n elevation: \"0.0\",\n title: title,\n distance: \"1\",\n has_detail_page: \"0\",\n webpage: \"\"\n }\n end\n response[:status] = \"OK\"\n response[:num_results] = response[:results].length\n render json: response, :content_type => 'application/mixare-json'\n end",
"def ejemplares\n\t\tsnib = Geoportal::Snib.new\n\t\tsnib.params = params\n\t\tsnib.ejemplares\n\t\t\n\t\trender json: snib.resp\n\tend",
"def create\n @sudoku = Sudoku.new(sudoku_params)\n @sudoku.gaps = Sudoku.generate_gaps\n respond_to do |format|\n if @sudoku.save\n format.html { redirect_to @sudoku }\n format.json { render :show, status: :created, location: @sudoku }\n else\n format.html { render :new }\n format.json { render json: @sudoku.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slab = Slab.new(params[:slab])\n\n respond_to do |format|\n if @slab.save\n format.html { redirect_to @slab, :notice => 'Slab was successfully created.' }\n format.json { render :json => @slab, :status => :created, :location => @slab }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @newspapper = Newspapper.new(params[:newspapper])\n\n respond_to do |format|\n if @newspapper.save\n flash[:notice] = 'Newspapper was successfully created.'\n format.html { redirect_to(@newspapper) }\n format.xml { render :xml => @newspapper, :status => :created, :location => @newspapper }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @newspapper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @noami = Noami.new(params[:noami])\n @selected_label = params[:sl]\n @as = params[:ass]\n @us = @as\n\n respond_to do |format|\n if @noami.save\n format.html {}\n format.js\n format.xml { render :xml => @noami, :status => :created, :location => @noami }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @noami.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @saddness = Saddness.new(saddness_params)\n\n respond_to do |format|\n if @saddness.save\n format.html { redirect_to @saddness, notice: 'Saddness was successfully created.' }\n format.json { render :show, status: :created, location: @saddness }\n else\n format.html { render :new }\n format.json { render json: @saddness.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lokasis = Rute.select(\"id_jalan\").uniq\n @jalan = Jalan.new(jalan_params)\n\n respond_to do |format|\n if @jalan.save\n format.html { redirect_to @jalan, notice: \"Jalan was successfully created.\" }\n format.json { render :show, status: :created, location: @jalan }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @jalan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @p1 = P1.new(p1_params)\n\n respond_to do |format|\n if @p1.save\n format.html { redirect_to @p1, notice: 'P1 was successfully created.' }\n format.json { render :show, status: :created, location: @p1 }\n else\n format.html { render :new }\n format.json { render json: @p1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @starter_pack = StarterPack.new(starter_pack_params)\n\n respond_to do |format|\n if @starter_pack.save\n format.html { redirect_to settings_url, notice: 'Starter pack was successfully created.' }\n format.json { render :show, status: :created, location: @starter_pack }\n else\n format.html { render :new }\n format.json { render json: @starter_pack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slap = Slap.new(slap_params)\n\n respond_to do |format|\n if @slap.save\n format.html { redirect_to @slap, notice: 'Slap was successfully created.' }\n format.json { render :show, status: :created, location: @slap }\n else\n format.html { render :new }\n format.json { render json: @slap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n has = params[\"area\"].to_json\n data_has = JSON.parse(has)\n @zone = Zone.new();\n @zone.nombre_zona = params[\"nombre_zona\"]\n @zone.color = params[\"color\"]\n\n respond_to do |format|\n if @zone.save\n \n data_has.each do |geo|\n @coordenada = CoordinateZone.new()\n geo.each do |data|\n @coordenada.zone_id = @zone.id\n @coordenada.latitud = data[\"lat\"].to_f\n @coordenada.longitud = data[\"lng\"].to_f \n end\n @coordenada.save\n end\n\n format.html { redirect_to @zone, notice: 'Zone was successfully created.' }\n format.js \n # format.js { render js: \"window.location.href=#{ directories_path }\" }\n format.json { render :show, status: :created, location: @zone }\n \n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def create\n @shiftmap = Shiftmap.new(params[:shiftmap])\n\n respond_to do |format|\n if @shiftmap.save\n format.html { redirect_to @shiftmap, notice: 'Shiftmap was successfully created.' }\n format.json { render json: @shiftmap, status: :created, location: @shiftmap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shiftmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_parks_from_api\n url = \"https://developer.nps.gov/api/v1/parks?limit=500&api_key=GhGhpL8DrRdsEAwfu0Mn4gXuhgkdnhVnrEnNfmRx\"\n resp = RestClient.get(url)\n json_hash = JSON.parse(resp)\n park_codes = []\n\n json_hash.each do |data_key, value|\n if data_key[\"data\"]\n value.each do |hash_keys|\n Park.create(park_name: hash_keys[\"fullName\"], park_code: hash_keys[\"parkCode\"])\n \n end\n end\n end\n\nend",
"def create\n @key_indicate_map_indicator_key = KeyIndicateMap::IndicatorKey.new\n @key_indicate_map_indicator_key.save\n\n respond_to do |format|\n format.js\n format.json { head :no_content }\n end\n end",
"def create\n @startup = current_user.startups.build(startup_params)\n\n respond_to do |format|\n if @startup.save\n format.html { redirect_to startups_url, notice: 'listing was successfully created.' }\n format.json { render :index, status: :created, location: @startup }\n else\n format.html { render :new }\n format.json { render json: @startup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pinjam = Pinjam.new(pinjam_params)\n\n respond_to do |format|\n if @pinjam.save\n format.html { redirect_to @pinjam, notice: 'Pinjam was successfully created.' }\n format.json { render :show, status: :created, location: @pinjam }\n else\n format.html { render :new }\n format.json { render json: @pinjam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @liftset = Liftset.new(liftset_params)\n\n respond_to do |format|\n if @liftset.save\n format.html { redirect_to @liftset, notice: 'Liftset was successfully created.' }\n format.json { render action: 'show', status: :created, location: @liftset }\n else\n format.html { render action: 'new' }\n format.json { render json: @liftset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coin_set = CoinSet.new(params[:coin_set])\n\n respond_to do |format|\n if @coin_set.save\n format.html { redirect_to root_path, notice: 'Coin set was successfully created.' }\n format.json { render json: @coin_set, status: :created, location: @coin_set }\n else\n format.html { render action: \"new\" }\n format.json { render json: @coin_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tdc2sasmapping = Tdc2sasmapping.new(params[:tdc2sasmapping])\n\n respond_to do |format|\n if @tdc2sasmapping.save\n format.html { redirect_to @tdc2sasmapping, notice: 'Tdc2sasmapping was successfully created.' }\n format.json { render json: @tdc2sasmapping, status: :created, location: @tdc2sasmapping }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tdc2sasmapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tree = Tree.new(params[:tree])\n @tree.synclatlon\n respond_to do |format|\n if @tree.save\n format.html { redirect_to @tree, notice: 'Tree was successfully created.' }\n format.json { render json: @tree, status: :created, location: @tree }\n else\n format.html { render 'new' }\n format.json { render json: @tree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tinymap = Tinymap.new(params[:tinymap])\n\n respond_to do |format|\n if @tinymap.save\n format.html { redirect_to @tinymap, notice: 'Tinymap was successfully created.' }\n format.json { render json: @tinymap, status: :created, location: @tinymap }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tinymap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @collection = Collection.new(collection_params)\n build_kiosks(params)\n respond_to do |format|\n if @collection.save\n format.html { redirect_to @collection, notice: 'Collection was successfully created.' }\n format.json { render :show, status: :created, location: @collection }\n else\n format.html { render :new }\n format.json { render json: @collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @natulang = Natulang.new(params[:natulang])\n\n respond_to do |format|\n if @natulang.save\n format.html { redirect_to @natulang, notice: 'Natulang was successfully created.' }\n format.json { render json: @natulang, status: :created, location: @natulang }\n else\n format.html { render action: \"new\" }\n format.json { render json: @natulang.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @student1 = Student1.new(params[:student1])\r\n\r\n respond_to do |format|\r\n if @student1.save\r\n format.html { redirect_to @student1, notice: 'Student1 was successfully created.' }\r\n format.json { render json: @student1, status: :created, location: @student1 }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @student1.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @scrapping_datum = ScrappingDatum.new(scrapping_datum_params)\n\n respond_to do |format|\n if @scrapping_datum.save\n format.html { redirect_to @scrapping_datum, notice: 'Scrapping datum was successfully created.' }\n format.json { render :show, status: :created, location: @scrapping_datum }\n else\n format.html { render :new }\n format.json { render json: @scrapping_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wide_puppet = WidePuppet.new(wide_puppet_params)\n\n respond_to do |format|\n if @wide_puppet.save\n format.html { redirect_to action: \"index\", notice: 'Wide puppet was successfully created.' }\n format.json { render :show, status: :created, location: @wide_puppet }\n else\n format.html { render :new }\n format.json { render json: @wide_puppet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n #clone yarn params (in private) to attrs var\n form_data = params().clone\n attrs2 = yarn_params().clone\n #set user_id in attr = current user\n attrs2[:user_id] = current_user.id\n @yarn = Yarn.new(attrs2)\n \n @array_stop_point = ((form_data[:skein_lengths].length * 2) - 1)\n @skein_lengths = []\n @skein_lengths << form_data[:skein_lengths].values\n @skein_lengths = @skein_lengths.flatten\n respond_to do |format|\n if @yarn.save\n yarn_id = @yarn[:id]\n skein_attrs = {:yarn_id => yarn_id, :length => 0}\n @skein_lengths.each do |x|\n @skein = Skein.new(skein_attrs)\n @skein[:length] = x\n @skein.save\n puts \"SKEIN saved, length: #{x}\"\n end\n \n \n # @new_skein_lengths.each do |x|\n # @skein = Skein.new(skein_attrs)\n # @skein[:length] = x\n # puts \"SKEIN saved, length: #{x}\"\n # # i = i + 1\n # @skein.save\n # end\n \n \n\n # @skein1 = Skein.new(skein_attrs)\n # @skein1[:length] = @skein_1_length\n # puts \"SKEIN 1 PRE SAVE: #{@skein1}\"\n # @skein1.save\n # @skein2 = Skein.new(skein_attrs)\n # @skein2[:length] = @skein_2_length\n # puts \"SKEIN 2 PRE SAVE: #{@skein2}\"\n # @skein2.save\n # @skein3 = Skein.new(skein_attrs)\n # @skein3[:length] = @skein_3_length\n # puts \"SKEIN 3 PRE SAVE: #{@skein3}\"\n # @skein3.save\n # @skein4 = Skein.new(skein_attrs)\n # @skein4[:length] = @skein_4_length\n # puts \"SKEIN 4 PRE SAVE: #{@skein4}\"\n # @skein4.save\n # @skein5 = Skein.new(skein_attrs)\n # @skein5[:length] = @skein_5_length\n # puts \"SKEIN 5 PRE SAVE: #{@skein5}\"\n # @skein5.save\n\n format.html { redirect_to yarns_path, :notice => 'Yarns and Skeins sucessfully created' }\n format.json { render :show, status: :created, location: @yarn }\n else\n format.html { render :new }\n format.json { render json: @yarn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lat_lon = LatLon.new(lat_lon_params)\n\n respond_to do |format|\n if @lat_lon.save\n format.html { redirect_to @lat_lon, notice: 'Lat lon was successfully created.' }\n format.json { render :show, status: :created, location: @lat_lon }\n else\n format.html { render :new }\n format.json { render json: @lat_lon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @spawner = Spawner.new\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spawner }\n end\n end",
"def create\n @initial_marker = InitialMarker.new(marker_params)\n\n respond_to do |format|\n format.html { redirect_to new_marker_url(:lat => @initial_marker.lat,\n :lon => @initial_marker.lon), notice: 'Marker was successfully created.' }\n format.json { render :show, status: :created, location: @initial_marker }\n end\n end",
"def v1_map_params\n params.require(:v1_map).permit(:title, :slug, :description)\n end",
"def create\n @plasmid_probe = PlasmidProbe.new(plasmid_probe_params)\n\n respond_to do |format|\n if @plasmid_probe.save\n format.html { redirect_to @plasmid_probe, notice: 'Plasmid probe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @plasmid_probe }\n else\n format.html { render action: 'new' }\n format.json { render json: @plasmid_probe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mouse_rack = MouseRack.new(mouse_rack_params)\n\n respond_to do |format|\n if @mouse_rack.save\n format.html { redirect_to @mouse_rack, notice: 'Mouse rack was successfully created.' }\n format.json { render :show, status: :created, location: @mouse_rack }\n else\n format.html { render :new }\n format.json { render json: @mouse_rack.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @land_use_mapping = LandUseMapping.new(params[:land_use_mapping])\n @title = \"land use mapping\"\n\n respond_to do |format|\n if @land_use_mapping.save\n format.html { redirect_to(@land_use_mapping, :notice => 'LandUseMapping was successfully created.') }\n format.xml { render :xml => @land_use_mapping, :status => :created, :location => @land_use_mapping }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @land_use_mapping.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n s_id = Allotment.where(user_id: current_user.id).pluck(:school_id).first\n standard_id = Standard.where(name: params[:class_mapping][:standard]).pluck(:id).first\n section_id = Section.where(name: params[:class_mapping][:section]).pluck(:id).first\n @classes = ClassMapping.new({:section_id => section_id, :standard_id => standard_id, :school_id => s_id})\n @saved_class = { id:@classes.id, standard: params[:class_mapping][:standard], section: params[:class_mapping][:section], school: s_id}\n if @classes.save\n render :json => @saved_class\n end\n end",
"def barton_flats_params\n name = \"Barton Flats, California, USA\"\n {\n :display_name => name,\n :location => {\n :display_name => name,\n :north => 34.1865,\n :west => -116.924,\n :east => -116.88,\n :south => 34.1571,\n :high => 2000.0,\n :low => 1600.0,\n :notes => \"This is now Barton Flats\",\n },\n }\n end",
"def create\n params[:traceroute].each do |tr|\n Traceroute.create(:server => tr[:server], :local_ip => tr[:local_ip], :stdout => tr[:stdout], :stderr => tr[:stderr], :exit_status => tr[:exit_status], :timestamp => tr[:timestamp])\n end\n\n\n\n #puts \"hello #{params}\"\n #@hello = params\n #@hello.map { |k,v| puts \"#{k} is #{v}\" }\n #traceroute_params.each do |v|\n # traceroute = Traceroute.create(v)\n #end\n\n respond_to do |format|\n format.all { render :nothing => true, :status => 200 }\n end\n #@traceroute = Traceroute.new(params)\n\n #respond_to do |format|\n # if @traceroute.save\n # format.html { redirect_to @traceroute, notice: 'Traceroute was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @traceroute }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @traceroute.errors, status: :unprocessable_entity }\n # end\n #end\n end",
"def create\n @plains_walker = PlainsWalker.new(plains_walker_params)\n\n respond_to do |format|\n if @plains_walker.save\n format.html { redirect_to @plains_walker, notice: 'Plains walker was successfully created.' }\n format.json { render :show, status: :created, location: @plains_walker }\n else\n format.html { render :new }\n format.json { render json: @plains_walker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @baton = Baton.new(params[:baton])\n\n respond_to do |format|\n if @baton.save\n format.html { redirect_to @baton, notice: 'Baton was successfully created.' }\n format.json { render json: @baton, status: :created, location: @baton }\n else\n format.html { render action: \"new\" }\n format.json { render json: @baton.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_v1_map\n @v1_map = V1::Map.find_by(slug: params[:slug])\n end",
"def create\n @trail = Trail.new(params[:trail])\n respond_to do |format|\n if @trail.save\n\t@trail.lat_map = elevation(@trail.longitude_start, @trail.latitude_start, @trail.longitude_end, @trail.latitude_end)\n\t@trail.gmap = staticmap_uri(@trail.longitude_start + \",\" + @trail.latitude_start + \"|\"+ @trail.longitude_end + \",\" + @trail.latitude_end)\n\t@trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render json: @trail, status: :created, location: @trail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @woodensofaset = Woodensofaset.new(woodensofaset_params)\n\n respond_to do |format|\n if @woodensofaset.save\n format.html { redirect_to @woodensofaset, notice: 'Woodensofaset was successfully created.' }\n format.json { render :show, status: :created, location: @woodensofaset }\n else\n format.html { render :new }\n format.json { render json: @woodensofaset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @plate = Plate.new(plate_params)\n\n respond_to do |format|\n if @plate.save\n format.html { redirect_to @plate, notice: 'Plate was successfully created.' }\n format.json { render :show, status: :created, location: @plate }\n else\n format.html { render :new }\n format.json { render json: @plate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @klasa = Klasa.new(klasa_params)\n\n respond_to do |format|\n if @klasa.save\n format.html { redirect_to @klasa, notice: 'Klasa was successfully created.' }\n format.json { render :show, status: :created, location: @klasa }\n else\n format.html { render :new }\n format.json { render json: @klasa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end",
"def create\n request = Request.new({title: params[:title], reqtype: params[:reqtype], description: params[:description],\n lat: params[:lat], lng: params[:lng], address: params[:address], status: params[:status], user_id: @current_user.id})\n if request.save\n render json: {\n status: 'success',\n message: 'Request added successfully',\n data: request\n },\n status: :created\n else \n render json: {\n status: 'error',\n message: 'Request not saved',\n data: request.errors\n },\n status: :unprocessable_entity\n end\n end",
"def create\n @sluzby = Sluzby.new(params[:sluzby])\n\n respond_to do |format|\n if @sluzby.save\n format.html { redirect_to @sluzby, notice: 'Sluzby was successfully created.' }\n format.json { render json: @sluzby, status: :created, location: @sluzby }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sluzby.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gpsd = Gpsd.new(gpsd_params)\n\n if @gpsd.save\n render json: @gpsd, status: :created, location: @gpsd\n else\n render json: @gpsd.errors, status: :unprocessable_entity\n end\n end",
"def create\n @map = Map.new(params[:map])\n @map.name = \"Map Created #{Time.now.strftime('at %I:%M%p')}\" if @map.name.blank?\n @map.description = \"No Description Provided\" if @map.description.blank?\n if points = params['markers']\n points.each do |marker_identifier, point|\n @map.points.build(:lat => point['lat'].to_f,:lng => point['lng'].to_f,:description =>point['description'], :marker_identifier => marker_identifier)\n end\n end\n respond_to do |format|\n if @map.save\n format.html { redirect_to(@map, :notice => 'Map was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n end",
"def create\n @ministries = Ministries.new(params[:ministries])\n\n respond_to do |format|\n if @ministries.save\n flash[:notice] = 'Ministries was successfully created.'\n format.html { redirect_to(@ministries) }\n format.xml { render :xml => @ministries, :status => :created, :location => @ministries }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ministries.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sulabh_address = SulabhAddress.new(sulabh_address_params)\n\n respond_to do |format|\n if @sulabh_address.save\n format.html { redirect_to @sulabh_address, notice: 'Sulabh address was successfully created.' }\n\t\tformat.js\n format.json { render :show, status: :created, location: @sulabh_address }\n else\n format.html { render :new }\n format.json { render json: @sulabh_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bits_1 = Bits1.new(bits_1_params)\n\n respond_to do |format|\n if @bits_1.save\n format.html { redirect_to @bits_1, notice: 'Bits 1 was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bits_1 }\n else\n format.html { render action: 'new' }\n format.json { render json: @bits_1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @one_offspring = OneOffspring.new(one_offspring_params)\n\n respond_to do |format|\n if @one_offspring.save\n format.html { redirect_to @one_offspring, notice: 'One offspring was successfully created.' }\n format.json { render :show, status: :created, location: @one_offspring }\n else\n format.html { render :new }\n format.json { render json: @one_offspring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map_student = MapStudent.new(map_student_params)\n\n respond_to do |format|\n if @map_student.save\n format.html { redirect_to @map_student, notice: 'Map student was successfully created.' }\n format.json { render :show, status: :created, location: @map_student }\n else\n format.html { render :new }\n format.json { render json: @map_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slam = Slam.new(params[:slam])\n\n respond_to do |format|\n if @slam.save\n @slam.update_attributes(master_id: current_user.id)\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n \n format.html { redirect_to edit_round_path(@round1), notice: 'Get to it!' }\n format.json { render json: @slam, status: :created, location: @slam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slam.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.66604346",
"0.66254866",
"0.66133755",
"0.6069491",
"0.6048444",
"0.5418844",
"0.5394696",
"0.5307771",
"0.5144165",
"0.5112531",
"0.50980717",
"0.50695324",
"0.5038042",
"0.4962604",
"0.49588573",
"0.49386764",
"0.49221656",
"0.4905619",
"0.48861098",
"0.48747998",
"0.48525006",
"0.48482594",
"0.48445022",
"0.48351943",
"0.4819669",
"0.4819338",
"0.48163438",
"0.4814554",
"0.48018768",
"0.48005077",
"0.47981167",
"0.4785512",
"0.47834074",
"0.47798923",
"0.4766365",
"0.47631916",
"0.4762868",
"0.47554448",
"0.47472474",
"0.47278315",
"0.47254485",
"0.47253212",
"0.47219637",
"0.47215056",
"0.47097424",
"0.4706997",
"0.46943632",
"0.46913606",
"0.46904707",
"0.46842882",
"0.46838695",
"0.46770644",
"0.46697578",
"0.46695364",
"0.46689782",
"0.46643293",
"0.46639904",
"0.46544513",
"0.4651123",
"0.46482757",
"0.46455118",
"0.46447712",
"0.46391132",
"0.46331617",
"0.4630335",
"0.46303228",
"0.46286902",
"0.46133685",
"0.4612439",
"0.46062842",
"0.46031052",
"0.46010357",
"0.45974934",
"0.45925215",
"0.4583566",
"0.4580045",
"0.45712078",
"0.45698297",
"0.45627546",
"0.45610902",
"0.4560758",
"0.45584267",
"0.45507276",
"0.4549215",
"0.4546192",
"0.4545509",
"0.45422548",
"0.4539914",
"0.4539091",
"0.45356524",
"0.45345268",
"0.45311812",
"0.45306",
"0.45271203",
"0.45269123",
"0.4525937",
"0.45241922",
"0.45232067",
"0.45145595",
"0.45120952"
] |
0.75690776
|
0
|
PATCH/PUT /latstraps1s/1 PATCH/PUT /latstraps1s/1.json
|
def update
respond_to do |format|
if @latstraps1.update(latstraps1_params)
format.html { redirect_to "/latstraps1s"}
format.json { render :show, status: :ok, location: @latstraps1 }
else
format.html { render :edit }
format.json { render json: @latstraps1.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @latstrapshome4.update(latstrapshome4_params)\n format.html { redirect_to \"/latstrapshome4s\"}\n format.json { render :show, status: :ok, location: @latstrapshome4 }\n else\n format.html { render :edit }\n format.json { render json: @latstrapshome4.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_latstraps1\n @latstraps1 = Latstraps1.find(params[:id])\n end",
"def patch!\n request! :patch\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n if @smallmap.update_attributes(params[:smallmap])\n format.html { redirect_to @smallmap, notice: 'Smallmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smallmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boot = Boot.find(params[:id])\n\n respond_to do |format|\n if @boot.update_attributes(params[:boot])\n flash[:success] = \"Updated successfully \"\n format.html { redirect_to boots_path, notice: 'Boot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def create\n @latstraps1 = Latstraps1.new(latstraps1_params)\n\n respond_to do |format|\n if @latstraps1.save\n format.html { redirect_to @latstraps1, notice: 'Latstraps1 was successfully created.' }\n format.json { render :show, status: :created, location: @latstraps1 }\n else\n format.html { render :new }\n format.json { render json: @latstraps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slam = Slam.find(params[:id])\n \n respond_to do |format|\n if @slam.update_attributes(params[:slam])\n format.html { redirect_to @slam, notice: 'Fixed up!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shouldersbiceps1.update(shouldersbiceps1_params)\n format.html { redirect_to \"/shouldersbiceps1s\"}\n format.json { render :show, status: :ok, location: @shouldersbiceps1 }\n else\n format.html { render :edit }\n format.json { render json: @shouldersbiceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_api_v1_initiative_update\n @api_v1_initiative_update = Api::V1::InitiativeUpdate.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cello_master.update(cello_master_params)\n format.html { redirect_to @cello_master, notice: 'Cello master was successfully updated.' }\n format.json { render :show, status: :ok, location: @cello_master }\n else\n format.html { render :edit }\n format.json { render json: @cello_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @slap.update(slap_params)\n format.html { redirect_to @slap, notice: 'Slap was successfully updated.' }\n format.json { render :show, status: :ok, location: @slap }\n else\n format.html { render :edit }\n format.json { render json: @slap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spliff.update(spliff_params)\n format.html { redirect_to '/spliffs', notice: 'Spliff was successfully updated.' }\n format.json { redirect_to '/spliffs', status: :ok, location: '/spliffs' }\n else\n format.html { render :edit }\n format.json { render json: @spliff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spawner = Spawner.find(params[:id])\n @fieldtrips = Fieldtrip.all\n\n respond_to do |format|\n if @spawner.update_attributes(spawner_params)\n format.html { redirect_to @spawner, notice: 'Spawner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spawner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update!(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 @slab = Slab.find(params[:id])\n\n respond_to do |format|\n if @slab.update_attributes(params[:slab])\n format.html { redirect_to @slab, :notice => 'Slab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @slab.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sklad = Sklad.find(params[:id])\n\n respond_to do |format|\n if @sklad.update_attributes(params[:sklad])\n format.html { redirect_to @sklad, notice: 'Sklad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sklad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def latstraps1_params\n params.require(:latstraps1).permit(:exercise, :reps, :sets)\n end",
"def update\n respond_to do |format|\n if @mountain.update(mountain_params)\n format.html { redirect_to @mountain, notice: 'Mountain was successfully updated.' }\n format.json { render :show, status: :ok, location: @mountain }\n else\n format.html { render :edit }\n format.json { render json: @mountain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n respond_to do |format|\n if @liftset.update(liftset_params)\n format.html { redirect_to @liftset, notice: 'Liftset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @liftset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stone = Stone.find(params[:id])\n\n respond_to do |format|\n if @stone.update_attributes(params[:stone])\n format.html { redirect_to @stone, notice: 'Stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stone.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @platoon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sekilas_info.update(sekilas_info_params)\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def update\n respond_to do |format|\n if @bicepstriceps1.update(bicepstriceps1_params)\n format.html { redirect_to \"/bicepstriceps1s\"}\n format.json { render :show, status: :ok, location: @bicepstriceps1 }\n else\n format.html { render :edit }\n format.json { render json: @bicepstriceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @labelling = Labelling.find(params[:id])\n\n respond_to do |format|\n if @labelling.update_attributes(params[:labelling])\n format.html { redirect_to @labelling, notice: 'Labelling was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @labelling.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lamp.update(lamp_params)\n format.html { redirect_to @lamp, notice: 'Lamp was successfully updated.' }\n format.json { render :show, status: :ok, location: @lamp }\n else\n format.html { render :edit }\n format.json { render json: @lamp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plate = Plate.find(params[:id])\n saved = @plate.update_attributes(get_first_indexed_params(:plate))\n respond_to do |format|\n if saved\n success_message = 'Plate was successfully updated.'\n format.html do\n flash[:notice] = success_message\n redirect_to plate_url(@plate)\n end\n flash.now[:notice] = success_message\n format.js\n else\n format.html { render :action => 'edit' }\n format.js { render :action => 'edit' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @flat_stage.update(flat_stage_params)\n format.html { redirect_to @flat_stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @flat_stage }\n else\n format.html { render :edit }\n format.json { render json: @flat_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n if @server1.update_attributes(params[:server1])\n format.html { redirect_to @server1, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @glass = Glass.find(params[:id])\n\n respond_to do |format|\n if @glass.update_attributes(params[:glass])\n format.html { redirect_to @glass, notice: 'Glass was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @glass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sasmap = Sasmap.find(params[:id])\n\n respond_to do |format|\n if @sasmap.update_attributes(params[:sasmap])\n format.html { redirect_to @sasmap, notice: 'Sasmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sasmap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sa_request.update(sa_request_params)\n format.html { redirect_to @sa_request, notice: 'Sa request was successfully updated.' }\n format.json { render :show, status: :ok, location: @sa_request }\n else\n format.html { render :edit }\n format.json { render json: @sa_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slitter = Slitter.find(params[:id])\n\n respond_to do |format|\n if @slitter.update_attributes(params[:slitter])\n format.html { redirect_to @slitter, notice: 'Slitter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slitter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mini_map_road = MiniMapRoad.find(params[:id])\n\n respond_to do |format|\n if @mini_map_road.update_attributes(params[:mini_map_road])\n format.html { redirect_to @mini_map_road, notice: 'Mini map road was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mini_map_road.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def update\n @species = Species.find(params[:id])\n @species.update_attributes(params[:species])\n \n respond_with(@species, :location => admin_species_path(@species))\n end",
"def update\n respond_to do |format|\n if @sun_glass.update(sun_glass_params)\n format.html { redirect_to @sun_glass, notice: 'Sun glass was successfully updated.' }\n format.json { render :show, status: :ok, location: @sun_glass }\n else\n format.html { render :edit }\n format.json { render json: @sun_glass.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @supermarket = Supermarket.find(params[:id]) \n respond_to do |format|\n if @supermarket.update(supermarket_params)\n format.json { render json: @supermarket, status: :ok }\n end\n end\n end",
"def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @plato = Plato.find(params[:id])\n\n if @plato.update(plato_params)\n head :no_content\n else\n render json: @plato.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @startup.update(startup_params)\n format.html { redirect_to startups_url, notice: 'listing was successfully updated.' }\n format.json { render :index, status: :ok, location: @startup }\n else\n format.html { render :edit }\n format.json { render json: @startup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @testboot.update(testboot_params)\n format.html { redirect_to @testboot, notice: 'Testboot was successfully updated.' }\n format.json { render :show, status: :ok, location: @testboot }\n else\n format.html { render :edit }\n format.json { render json: @testboot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lb202556 = Lb202556.find(params[:id])\n\n respond_to do |format|\n if @lb202556.update_attributes(params[:lb202556])\n format.html { redirect_to(@lb202556, :notice => 'Lb202556 was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lb202556.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spltrain.update(spltrain_params)\n format.html { redirect_to @spltrain, notice: 'Spltrain was successfully updated.' }\n format.json { render :show, status: :ok, location: @spltrain }\n else\n format.html { render :edit }\n format.json { render json: @spltrain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @request_class_lab.update(request_class_lab_params)\n format.html { redirect_to @request_class_lab }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_class_lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def from_merge_patch_json\n if request.patch?\n from_json\n else\n 415\n end\n end",
"def patch(path, **args); end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def update\n respond_to do |format|\n if @one_offspring.update(one_offspring_params)\n format.html { redirect_to @one_offspring, notice: 'One offspring was successfully updated.' }\n format.json { render :show, status: :ok, location: @one_offspring }\n else\n format.html { render :edit }\n format.json { render json: @one_offspring.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @strain = Strain.find(params[:id])\n\n respond_to do |format|\n if @strain.update_attributes(params[:strain])\n format.html { redirect_to @strain, :notice => 'Strain was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @strain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plate.update(plate_params)\n format.html { redirect_to @plate, notice: 'Plate was successfully updated.' }\n format.json { render :show, status: :ok, location: @plate }\n else\n format.html { render :edit }\n format.json { render json: @plate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sphere = Sphere.find(params[:id])\n\n respond_to do |format|\n if @sphere.update_attributes(params[:sphere])\n format.html { redirect_to @sphere, notice: 'Sphere a été édité avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @model = Model.find(params[:id])\n # @model.name = \"test\"\n @model.scale = 1\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @student1 = Student1.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @student1.update_attributes(params[:student1])\r\n format.html { redirect_to @student1, notice: 'Student1 was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @student1.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lot = Lot.find(params[:id])\n\n respond_to do |format|\n if @lot.update_attributes(params[:lot])\n format.html { redirect_to myadmin_lots_path, :notice => 'Lot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @landmaster.update(landmaster_params)\n format.html { redirect_to @landmaster, notice: 'Landmaster was successfully updated.' }\n format.json { render :show, status: :ok, location: @landmaster }\n else\n format.html { render :edit }\n format.json { render json: @landmaster.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end",
"def update\n respond_to do |format|\n if @camp.update(camp_params)\n format.html { redirect_to @camp, notice: \"#{@camp.name} was revised in the system.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.jdson { render json: @camp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n mountain = Mountain.find params[:id]\n mountain.update mountain_params\n redirect_to (mountains_path)\n end",
"def update\n respond_to do |format|\n if @instrument_patch.update(instrument_patch_params)\n format.html { redirect_to @instrument_patch, notice: 'Instrument patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @instrument_patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bits_1.update(bits_1_params)\n format.html { redirect_to @bits_1, notice: 'Bits 1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bits_1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n if @microposst.update_attributes(params[:microposst])\n format.html { redirect_to @microposst, notice: 'Microposst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bootcamp = Bootcamp.find(params[:id])\n\n respond_to do |format|\n if @bootcamp.update_attributes(params[:bootcamp])\n format.html { redirect_to @bootcamp, notice: 'Bootcamp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bootcamp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sphere.update(sphere_params)\n format.html { redirect_to @sphere, notice: 'Sphere was successfully updated.' }\n format.json { render :show, status: :ok, location: @sphere }\n else\n format.html { render :edit }\n format.json { render json: @sphere.errors, status: :unprocessable_entity }\n end\n end\n end",
"def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update\n respond_to do |format|\n if @maker_master.update(maker_master_params)\n format.html { redirect_to @maker_master, notice: 'Maker master was successfully updated.' }\n format.json { render :show, status: :ok, location: @maker_master }\n else\n format.html { render :edit }\n format.json { render json: @maker_master.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n respond_to do |format|\n if @lat_crime.update(lat_crime_params)\n format.html { redirect_to @lat_crime, notice: 'Lat crime was successfully updated.' }\n format.json { render :show, status: :ok, location: @lat_crime }\n else\n format.html { render :edit }\n format.json { render json: @lat_crime.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @jumbotron.update(jumbotron_params)\n format.html { redirect_to @jumbotron, notice: 'Jumbotron was successfully updated.' }\n format.json { render :show, status: :ok, location: @jumbotron }\n else\n format.html { render :edit }\n format.json { render json: @jumbotron.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @plasmid_probe.update(plasmid_probe_params)\n format.html { redirect_to @plasmid_probe, notice: 'Plasmid probe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plasmid_probe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kela.update(kela_params)\n format.html { redirect_to @kela, notice: 'Kela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @singlepart.update(singlepart_params)\n format.html { redirect_to @singlepart, notice: 'Singlepart was successfully updated.' }\n format.json { render :show, status: :ok, location: @singlepart }\n else\n format.html { render :edit }\n format.json { render json: @singlepart.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @squishee_cup = SquisheeCup.find(params[:id])\n puts params.to_json\n respond_to do |format|\n if @squishee_cup.update_attributes(params[:squishee_cup])\n format.html { redirect_to @squishee_cup, notice: 'Squishee cup was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @squishee_cup.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bundlesticker = Bundlesticker.find(params[:id])\n\n respond_to do |format|\n if @bundlesticker.update_attributes(params[:bundlesticker])\n format.html { redirect_to @bundlesticker, notice: 'Bundlesticker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundlesticker.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @stationeryrequest = Stationeryrequest.find(params[:id])\n #\n @stationeryrequest.hotelsuppliesrequests.each do |hotelsuppliesrequests|\n \n end\n\n respond_to do |format|\n if @stationeryrequest.update_attributes(params[:stationeryrequest])\n format.html { redirect_to @stationeryrequest, notice: 'Stationeryrequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stationeryrequest.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6500646",
"0.6395387",
"0.6019283",
"0.59084517",
"0.58681554",
"0.58584225",
"0.5825715",
"0.5747448",
"0.569428",
"0.56253445",
"0.56252116",
"0.56232136",
"0.56171966",
"0.5595198",
"0.5593387",
"0.55838746",
"0.5581199",
"0.5561473",
"0.5542931",
"0.5542158",
"0.5532701",
"0.5532347",
"0.5516409",
"0.5515709",
"0.5513226",
"0.55117",
"0.55088687",
"0.55070764",
"0.5491315",
"0.5491225",
"0.5485434",
"0.5479792",
"0.54680526",
"0.54639703",
"0.54623425",
"0.545642",
"0.5436669",
"0.543359",
"0.543284",
"0.54272854",
"0.54272854",
"0.5424439",
"0.54202104",
"0.54175556",
"0.5401472",
"0.5399957",
"0.5396938",
"0.5388877",
"0.53881973",
"0.5375966",
"0.53728265",
"0.5372541",
"0.5367204",
"0.5366699",
"0.5359341",
"0.5357659",
"0.5357033",
"0.53564113",
"0.5341735",
"0.53377527",
"0.53320116",
"0.53262615",
"0.5326147",
"0.5325832",
"0.5325155",
"0.5323914",
"0.53220075",
"0.53199166",
"0.53187513",
"0.53184247",
"0.53150326",
"0.53139013",
"0.5312842",
"0.53086084",
"0.5306722",
"0.53055686",
"0.5303975",
"0.5303517",
"0.5301876",
"0.5294809",
"0.52944756",
"0.5291724",
"0.52887774",
"0.5284565",
"0.528382",
"0.52820134",
"0.52793646",
"0.5276877",
"0.52628773",
"0.5262383",
"0.5260366",
"0.52579266",
"0.5256647",
"0.5255406",
"0.5255191",
"0.5250169",
"0.5249317",
"0.52480924",
"0.524376",
"0.52419007"
] |
0.7481019
|
0
|
DELETE /latstraps1s/1 DELETE /latstraps1s/1.json
|
def destroy
@latstraps1.destroy
respond_to do |format|
format.html { redirect_to latstraps1s_url, notice: 'Latstraps1 was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @latstrapshome4.destroy\n respond_to do |format|\n format.html { redirect_to latstrapshome4s_url, notice: 'Latstrapshome4 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @smallmap = Smallmap.find(params[:id])\n @smallmap.destroy\n\n respond_to do |format|\n format.html { redirect_to smallmaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @boot = Boot.find(params[:id])\n @boot.destroy\n\n\n respond_to do |format|\n flash[:success] = \"Deleted successfully \"\n format.html { redirect_to boots_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @sklad = Sklad.find(params[:id])\n @sklad.destroy\n\n respond_to do |format|\n format.html { redirect_to sklads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shouldersbiceps1.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbiceps1s_url, notice: 'Shouldersbiceps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lunch.destroy\n respond_to do |format|\n format.html { redirect_to lunches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end",
"def destroy\n @mountain.destroy\n respond_to do |format|\n format.html { redirect_to mountains_url, notice: 'Mountain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end",
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\r\n @location = Location.find(params[:id])\r\n RemovedLocation.create(server_id: Integer(params[:id]))\r\n directory = Rails.root.join('app','assets','locations');\r\n\r\n path = File.join(directory, @location.image)\r\n File.delete(path)\r\n @location.destroy\r\n mv = MapsVersion.first\r\n mv.version = mv.version+1\r\n mv.save\r\n respond_to do |format|\r\n format.html { redirect_to locations_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat = Flat.find(params[:id])\n @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mini_map_road = MiniMapRoad.find(params[:id])\n @mini_map_road.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_map_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stilage.destroy\n respond_to do |format|\n format.html { redirect_to stilages_url, notice: 'Stilage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slap.destroy\n respond_to do |format|\n format.html { redirect_to slaps_url, notice: 'Slap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hdfs_path = HdfsPath.find(params[:id])\n @hdfs_path.destroy\n\n respond_to do |format|\n format.html { redirect_to hdfs_paths_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @pinglun = Pinglun.find(params[:id])\n @pinglun.destroy\n\n respond_to do |format|\n format.html { redirect_to pingluns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jam_circle.destroy\n respond_to do |format|\n format.html { redirect_to jam_circles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat.destroy\n respond_to do |format|\n format.html { redirect_to flats_url, notice: 'Flat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flat.destroy\n respond_to do |format|\n format.html { redirect_to flats_url, notice: \"Flat was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @platoon.destroy\n respond_to do |format|\n format.html { redirect_to platoons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jamaat = Jamaat.find(params[:id])\n @jamaat.destroy\n\n respond_to do |format|\n format.html { redirect_to jamaats_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @storage_lun = StorageLun.find(params[:id])\n @storage_lun.destroy\n\n respond_to do |format|\n format.html { redirect_to storage_luns_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @baz1.destroy\n respond_to do |format|\n format.html { redirect_to baz1s_url, notice: \"Baz1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_datum.destroy\n respond_to do |format|\n format.html { redirect_to request_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @liftset.destroy\n respond_to do |format|\n format.html { redirect_to liftsets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n streak, success = jsonapi_destroy.to_a\n\n if success\n render json: { meta: {} }\n else\n render_errors_for(streak)\n end\n end",
"def destroy\n @sasmap = Sasmap.find(params[:id])\n @sasmap.destroy\n\n respond_to do |format|\n format.html { redirect_to sasmaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @landmaster.destroy\n respond_to do |format|\n format.html { redirect_to landmasters_url, notice: 'Landmaster was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @samochod.destroy\n respond_to do |format|\n format.html { redirect_to samochods_url, notice: 'Samochod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\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 @bits_1.destroy\n respond_to do |format|\n format.html { redirect_to bits_1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hot_master.destroy\n respond_to do |format|\n format.html { redirect_to hot_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testboot.destroy\n respond_to do |format|\n format.html { redirect_to testboots_url, notice: 'Testboot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end",
"def destroy\n @shelf.destroy\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @patchcord.destroy\n respond_to do |format|\n format.html { redirect_to patchcords_url, notice: 'Patchcord was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stash = Stash.find(params[:id])\n @stash.destroy\n\n respond_to do |format|\n format.html { redirect_to stashes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jumbotron.destroy\n respond_to do |format|\n format.html { redirect_to jumbotrons_url, notice: 'Jumbotron was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @startup = Startup.find(params[:id])\n @startup.destroy\n\n respond_to do |format|\n format.html { redirect_to startups_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @zt020.destroy\n respond_to do |format|\n format.html { redirect_to zt020s_url, notice: 'Zt020 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bootcamp = Bootcamp.find(params[:id])\n @bootcamp.destroy\n\n respond_to do |format|\n format.html { redirect_to bootcamps_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Location.delete(params[\"id\"])\n end",
"def destroy\n @slab = Slab.find(params[:id])\n @slab.destroy\n\n respond_to do |format|\n format.html { redirect_to slabs_url }\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 delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @baz8.destroy\n respond_to do |format|\n format.html { redirect_to baz8s_url, notice: \"Baz8 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slam = Slam.find(params[:id])\n @slam.destroy\n\n respond_to do |format|\n format.html { redirect_to slams_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shouldersbicepshome3.destroy\n respond_to do |format|\n format.html { redirect_to shouldersbicepshome3s_url, notice: 'Shouldersbicepshome3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kela.destroy\n respond_to do |format|\n format.html { redirect_to kelas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @manage_glow.destroy\n respond_to do |format|\n format.html { redirect_to manage_glows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @small_generator = SmallGenerator.find(params[:id])\n @small_generator.destroy\n\n respond_to do |format|\n format.html { redirect_to small_generators_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_initiative_update.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiative_updates_url, notice: 'Initiative update was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kolegij = Kolegij.find(params[:id])\n @kolegij.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pharmaceutical_master.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceutical_masters_url, notice: DELETE_NOTICE }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lk.destroy\n respond_to do |format|\n format.html { redirect_to lks_url, notice: 'Lk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @three60.destroy\n respond_to do |format|\n format.html { redirect_to edit_admin_good_url(@good, anchor: \"three60\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @singleb.destroy\n respond_to do |format|\n format.html { redirect_to singlebs_url, notice: 'Singleb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asteroid.destroy\n respond_to do |format|\n format.html { redirect_to asteroids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @startup.destroy\n respond_to do |format|\n format.html { redirect_to startups_url, notice: 'startup was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sunsystem.destroy\n respond_to do |format|\n format.html { redirect_to sunsystems_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.69022757",
"0.66501516",
"0.6634008",
"0.6574002",
"0.65542793",
"0.65452856",
"0.65343595",
"0.6502773",
"0.64843994",
"0.64838105",
"0.64605963",
"0.6454735",
"0.6451193",
"0.64439267",
"0.6434023",
"0.6434023",
"0.64280146",
"0.6426783",
"0.64247596",
"0.63847095",
"0.6384525",
"0.6358134",
"0.6354701",
"0.63482744",
"0.63439906",
"0.63439906",
"0.63239753",
"0.63235694",
"0.63155276",
"0.6301579",
"0.6298861",
"0.6288963",
"0.62862605",
"0.6284716",
"0.6284506",
"0.6284259",
"0.6282125",
"0.6269215",
"0.6268447",
"0.62672395",
"0.62631243",
"0.6262121",
"0.62558347",
"0.62541544",
"0.62523",
"0.6251431",
"0.62440693",
"0.62404203",
"0.6236734",
"0.6235364",
"0.62329507",
"0.6232933",
"0.6232924",
"0.6232771",
"0.62316805",
"0.6231049",
"0.6229917",
"0.62288237",
"0.6228432",
"0.6226351",
"0.6224894",
"0.6223395",
"0.62146246",
"0.6210115",
"0.6210036",
"0.62036186",
"0.62020177",
"0.6199515",
"0.61976564",
"0.6187753",
"0.6186155",
"0.6185704",
"0.6185704",
"0.6185704",
"0.6185704",
"0.6183947",
"0.6183703",
"0.618359",
"0.6183077",
"0.6179661",
"0.6178249",
"0.61769235",
"0.61758864",
"0.6175327",
"0.6174617",
"0.6174508",
"0.6174179",
"0.61739576",
"0.6171105",
"0.61700886",
"0.6169982",
"0.6169554",
"0.6164066",
"0.61622536",
"0.6160699",
"0.6157837",
"0.61564684",
"0.6154047",
"0.61496705",
"0.6147992"
] |
0.7599374
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_latstraps1
@latstraps1 = Latstraps1.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def latstraps1_params
params.require(:latstraps1).permit(:exercise, :reps, :sets)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
Your code here too!
|
def initialize
@headers = {
"Authorization" => "token #{ENV["AUTH_TOKEN"]}",
"User-Agent" => "HTTParty"
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def custom; end",
"def custom; end",
"def private; end",
"def probers; end",
"def terpene; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def weber; end",
"def r; end",
"def r; end",
"def writethis; end",
"def schubert; end",
"def suivre; end",
"def how_it_works\r\n end",
"def myletter\n \n end",
"def run\n end",
"def processor; end",
"def villian; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def who_we_are\r\n end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def anchored; end",
"def hd\n \n end",
"def run\n \n end",
"def run\n \n end",
"def run() end",
"def formation; end",
"def mitch_hedberg; end",
"def src; end",
"def src; end",
"def src; end",
"def jack_handey; end",
"def frame; end",
"def wrapper; end",
"def post_process; end",
"def style; end",
"def style; end",
"def style; end",
"def running; end",
"def running; end",
"def guct\n end",
"def herald; end",
"def dh; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
"def source() end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def processed_source; end",
"def stderrs; end",
"def run\n end",
"def berlioz; end",
"def code_point; end",
"def refutal()\n end",
"def extra; end",
"def buzzword; end",
"def buzzword; end",
"def operations; end",
"def operations; end",
"def original; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def pos; end",
"def implementation; end",
"def implementation; end",
"def whiny; end",
"def rassoc(p0) end",
"def tiny; end",
"def gounod; end",
"def blg; end"
] |
[
"0.6580489",
"0.6580489",
"0.65659624",
"0.6527405",
"0.63056856",
"0.6290495",
"0.6290495",
"0.6290495",
"0.6290495",
"0.6290495",
"0.6290495",
"0.6290495",
"0.6290495",
"0.6290495",
"0.62183774",
"0.6036351",
"0.6036351",
"0.6029153",
"0.6012837",
"0.6006934",
"0.600459",
"0.5964403",
"0.59640414",
"0.59593976",
"0.5949382",
"0.594938",
"0.594938",
"0.594938",
"0.594938",
"0.594938",
"0.594938",
"0.594938",
"0.594938",
"0.5940007",
"0.59368676",
"0.59368676",
"0.59368676",
"0.59368676",
"0.59368676",
"0.59368676",
"0.59368676",
"0.59366536",
"0.58953685",
"0.58883494",
"0.58883494",
"0.58524257",
"0.5849918",
"0.58352613",
"0.5833361",
"0.5833361",
"0.5833361",
"0.5817977",
"0.5817554",
"0.579508",
"0.57796746",
"0.5774788",
"0.5774788",
"0.5774788",
"0.5769455",
"0.5769455",
"0.5729309",
"0.5727883",
"0.5723663",
"0.57191306",
"0.57191306",
"0.5713284",
"0.57084876",
"0.57084876",
"0.57084876",
"0.57084876",
"0.57084876",
"0.57084876",
"0.57084876",
"0.57084876",
"0.57084876",
"0.57084876",
"0.57084876",
"0.56794304",
"0.5678644",
"0.5675456",
"0.56754535",
"0.56631225",
"0.5658163",
"0.56551456",
"0.56551456",
"0.56531286",
"0.56531286",
"0.56510365",
"0.5648108",
"0.5648108",
"0.5648108",
"0.5648108",
"0.5648108",
"0.5648108",
"0.56478804",
"0.56478804",
"0.5647351",
"0.564262",
"0.56417066",
"0.5632415",
"0.56202626"
] |
0.0
|
-1
|
Returns unique array in which records are sorted by occurrence within array (Descending)
|
def sort_by_occurrence(records)
count = Hash.new(0)
records.each {|element| count[element] += 1}
records = records.uniq.sort {|x,y| count[y] <=> count[x]}
return records
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def consolidate_by_frequency(array)\n array.group_by{|x| x}.values.sort_by{|group| group.count}.reverse.flatten(1).uniq\nend",
"def duplicates_subarray3(arr)\n arr.uniq.map { |elm| [elm] * arr.count(elm)}.sort_by {|subarr| subarr[0].ord }\nend",
"def duplicates_subarray(arr)\n new_arr = []\n arr.each do |elm|\n duplicate = false\n new_arr.each do |sub_arr|\n if sub_arr.include?(elm)\n sub_arr << elm\n duplicate = true\n end\n end\n new_arr << [elm] unless duplicate\n end\n new_arr.sort_by {|sub_arr| sub_arr[0].ord }\nend",
"def array_ranked_descending(array)\n\t\treturn array.sort{|x,y| y <=> x} \n\tend",
"def duplicates_subarray2(arr)\n arr_srt = arr.sort {|a, b| a.ord <=> b.ord}\n new_arr = [[arr_srt[0]]]\n arr_srt.each_with_index do |elm, idx|\n next if idx == 0\n if new_arr[-1].include? elm\n new_arr[-1] << elm\n else\n new_arr << [elm]\n end\n end\n new_arr\nend",
"def equalizeArray(arr)\n hash = {}\n arr.sort.each { |h| hash.store(h, 0) }\n arr.each do |d|\n hash[d] = hash[d] + 1 if hash.key?(d)\n end\n max = 0\n hash.each { |_k, v| v > max ? max = v : max }\n\n arr.length - max\nend",
"def reduce_array(arr)\n seen = Hash.new(0)\n\n arr.each do |nested|\n nested.each do |el|\n seen[el] += el\n end\n end\n\n seen.values.sort\nend",
"def to_sorted_array\n sort.collect(&:last)\n end",
"def sort_counts()\n @count_array = @counts.to_a\n @count_array.sort_by! { |pair| pair[1] }\n @count_array.reverse!\n @count_array\n end",
"def duplicate_sub_arrays2(array)\n array_hash = {}\n \n array.each do |sub_array|\n sorted_array = sub_array.sort\n \n if array_hash[sorted_array]\n array_hash[sorted_array] += 1\n else\n array_hash[sorted_array] = 1\n end\n end\n \n max_array = array_hash.max_by do |key, value|\n value\n end\n \n return max_array[0]\nend",
"def sort_array\n @data.sorted_by.inject([]) do |memo, (key, value)|\n memo << [@data.columns.index(key), value == 'descending' ? 0 : 1]\n end\n end",
"def sort_array_desc(collection)\n i = 0\n result = []\n while i < collection.length\n result = collection.sort { |a, b| b <=> a }\n i += 1\n end\nreturn result.flatten\nend",
"def uniq(arr)\n new_array = []\n arr = arr.sort\n arr.each_with_index do |num, idx|\n new_array << num if num != arr[idx + 1]\n end\n new_array\nend",
"def unique_sort(arr)\n\tp arr.uniq.sort\nend",
"def using_uniq(array)\n\n \nend",
"def convert_to_sorted(arr_of_arr)\n sorted = []\n arr_of_arr.each {|arr| arr.each {|num| sorted.push(num) if !sorted.include?(num)}}\n sorted.sort\nend",
"def remove_dup(given_array, duplicate_count)\r\n counter = 0\r\n new_array = []\r\n hold_info = {}\r\n until counter >= given_array.length \r\n if hold_info[given_array[counter]].nil?\r\n hold_info[given_array[counter]] = 1 \r\n else\r\n hold_info[given_array[counter]] += 1\r\n end\r\n counter += 1\r\n end\r\n duplicates_array = hold_info.select{ |key, value| value == duplicate_count}\r\n new_array = given_array.clone\r\n duplicates_array.each {|key,value| new_array.delete(key)} # delete all the duplicate numbers from the array\r\n p new_array.sort\r\nend",
"def sorted_array_unique_views\n total_unique_views_per_file_path.sort { |a, b| b[1] <=> a[1] }\n end",
"def my_uniq(arr)\n #make hash with each item in teh array as a key, and the value will be its frequency\n new_arr = []\n freqhash = Hash.new(0)\n arr.each do |ele| \n freqhash[ele] += 1\n end\n \n freqhash.each do |k, v| \n new_arr << k\n end\n \n new_arr\nend",
"def search_queries_with_frequencies_sorted_descending\n @searches_grouped_by_frequency.to_a.sort{|a,b| b[1] <=> a[1]}\n end",
"def my_uniq(arr)\n hashed = arr.map {|value| [value, arr.count(value)]}.flatten\n return Hash[*hashed].keys\nend",
"def mode(arr)\n count = Hash.new(0)\n arr.each { |value| count[value] += 1 }\n count = count.sort_by { |key, value| value }\n count.reverse!\n high = count[0][1]\n count.select! { |key, value| value == high } \n result = count.collect(&:first)\n result.sort!\nend",
"def sort arr \n\trec_sort arr, []\nend",
"def mode(array)\n hash = Hash.new(0)\n new_array = []\n\n array.each do |i|\n hash[i] += 1\n end\n\n hash = hash.sort_by { |key, value| value }.reverse.to_h\n\n hash.each do |key, value|\n if value == hash.values[0]\n new_array << key\n end\n end\n p new_array\nend",
"def dominant(arr)\n merge_sort(arr)[-1]\nend",
"def analyze_data(ary)\n frequency = count_frequency(ary)\n sort_hash(frequency)\nend",
"def find_unique_elements(arr)\n\tcounts = Hash.new 0\n\tarr.each do |ele|\n\t\tcounts[ele] += 1\n\tend\n\t\n\tcounts.delete_if {|key, value| value > 1 }\n\tresult = counts.keys #Array returned with keys for non-dupe values\n\treturn result\nend",
"def sort_by_occurrence_h(input)\n output = input.each_with_object(Hash.new(0)){ |tag, counts| counts[tag] += 1 }\n output = Hash[output.sort_by{ |tags, counts| counts}.reverse]\n return output\n end",
"def unique_items(arr) #O(n)\n hash = Hash.new(0)\n results = []\n arr.each do |el|\n hash[el] += 1\n end\n hash.select { |k, v| k if v == 1 }.keys\nend",
"def using_uniq(array)\n array.uniq\n end",
"def mode(array)\n hash = Hash.new(0)\n num_a = []\n final_a = Array.new\n\n array.each do |value|\n hash[value] += 1\n end\n\n num_a = hash.values.sort\n\n hash.each do |k,v|\n if v == num_a[-1]\n final_a << k\n end\n end\n\n return final_a\nend",
"def sorted_triples(array)\n sort_array = []\n array.each_slice(3) do |group|\n sort_array << group.sort\n end\n return sort_array\nend",
"def sort arr\r\n\trec_sort arr, []\r\nend",
"def countInversions(arr)\n metadata = OpenStruct.new(inversions: 0)\n mergesort! arr.dup, arr.dup, 0, arr.size-1, metadata\n return metadata.inversions\nend",
"def unique_in_order(sequence)\n\ta = 0\n\tfinal_arr = []\n\twhile a < sequence.length\n\t\tfinal_arr << sequence[a]\n\t\tduplicate = sequence[a]\n\t\twhile duplicate == sequence[a]\n\t\t\tif sequence[a] == duplicate\n\t\t\t\ta += 1\n\t\t\tend\n\t\tend\n\tend\n\treturn final_arr\nend",
"def sort(arr)\n word_count = {}\n arr.each do |word|\n if word_count[word.length]\n word_count[word.length] << word\n else\n word_count[word.length] = [word]\n end\n end\n word_count.sort.map{|set|set.last.sort}.flatten\nend",
"def improved_poorly_written_ruby(*arrays)\n sorted = []\n arrays.flatten.each do |v|\n size = sorted.size\n if sorted.empty?\n sorted.push(v)\n else\n i = 0\n while i < size\n item = sorted[i]\n if item > v\n sorted.insert(i, v)\n break\n elsif i == size - 1\n sorted.push(v)\n break\n end\n i += 1\n end\n end\n end\n sorted\nend",
"def sorted_triples(array)\n\tnew_array = []\n\tarray.each_slice(3) {|grouped_words| new_array << grouped_words.sort}\n\tnew_array\nend",
"def equalizeArray(arr)\n arr = arr.sort\n count = 0; j = 0\n for i in 0..(arr.length-1)\n if arr[j] != arr[i]\n j += 1\n count+=1\n end\n end\n count\nend",
"def uniq(array)\n counts = Hash.new(0)\n result = []\n array.each do |element|\n counts[element] += 1\n result << element unless counts[element] > 1\n end\n result\nend",
"def counting_sort(array, array_length, highest_value)\n equal = count_keys_equal(array, array_length, highest_value)\n less = count_keys_less(equal, highest_value)\n sorted = rearrange(array, less, array_length, highest_value)\n return sorted\nend",
"def mode (array) \n# creates a hash(tracker) with items as keys and frequencies as values\n tracker = {} \n array.each do |x| \n if tracker.has_key?(x) \n tracker[x] += 1\n else\n tracker[x] = 1\n end \n end \n# finds the highest value (frequency)\n final_values = tracker.values\n highest = 0 \n final_values.each do |x|\n if x > highest\n highest = x\n end \n end\n# adds each key (item) with the highest value to the output array\n output = []\n tracker.each do |key, value|\n if value == highest\n output << key\n end\n end\n return output\nend",
"def using_uniq(array)\n \n array.uniq\n \nend",
"def distinctValues(array)\n\nend",
"def get_sorted_array\n @ary.sort\n end",
"def weighted_uniq(array)\n weighted_hash = array.each_with_object({}) do |v, acc|\n acc[v] ||= 0\n acc[v] += 1\n end\n n = 0\n (weighted_hash.sort_by do |x|\n n += 1\n [-x[1], n]\n end).to_h\n end",
"def my_uniq(arr)\n count = Hash.new(0)\n arr.each {|ele| count[ele]+= 1}\n count.keys\nend",
"def migratoryBirds(arr)\n birds = Hash.new(0)\n arr.each do |bir|\n birds.key?(bir) ? birds[bir] += 1 : birds[bir] = 1\n end\n max = birds.max_by { |_key, value| value }.last\n birds.sort_by { |key, _value| key }\n .select { |_key, value| value == max }\n .first\n .first\nend",
"def uniqify(array)\n encountered = Hash.new { |hash, key| hash[key] = false }\n uniqified_array = []\n array.each do |element|\n uniqified_array.push(element) unless encountered[element]\n encountered[element] = true\n end\n uniqified_array\nend",
"def sort arr\n rec_sort arr, []\nend",
"def my_array_sorting_method(source)\n source.map {|i| i.to_s}.sort.uniq\nend",
"def find_most_frequent_integer(arr)\n new_array=[]\n final_array=[]\n if arr.uniq.length==0\n return nil\n else\n array_to_use=arr.uniq\n array_to_use.each do |x| \n new_array << [arr.count(x), x]\n final_array=new_array.sort\n end\n end\n count_array=[]\n final_array.each do |x|\n count_array << x.reverse\n end\n just_count_array=[]\n count_array.each do |x|\n just_count_array << x.pop\n end\n z=just_count_array[-1]\n res=just_count_array[0..-2].include?(z)\n if res==false\n return final_array[-1][1]\n end\nend",
"def custom_uniq(array)\n final = []\n array.each do |element|\n final << element if !final.include?(element)\n end \n final\nend",
"def my_array_sorting_method(source)\n source.map {|array_Element| array_Element.to_s}.sort.uniq\n end",
"def min_unique(arr)\n arr.sort! #[1,2,2,3,7]\n uniq = []\n dups = []\n (arr.length ).times do |i|\n if arr[i] == arr[i+1]\n dups << arr[i]\n else \n uniq << arr[i]\n end \n end \n\n dups.each do |el|\n while uniq.include?(el)\n el+=1\n end \n uniq << el\n p uniq\n end \n p uniq.reduce(:+)\nend",
"def find_unique_elements(arr)\n arr_unique = []\n arr.each do |elem1|\n var1 = 0\n arr.each do |elem2|\n if elem1 == elem2\n var1 = var1 + 1\n end\n end\n if var1 <= 1\n arr_unique.push(elem1)\n end\n end\nend",
"def using_uniq(array)\n array.uniq\nend",
"def using_uniq(array)\n array.uniq\nend",
"def mode(arr)\n\th = {}\n\tarr.each do |x| \n\t\th [x] = arr.count(x)\n\tend\n\tarr = h.values.sort\n highest_count = arr.last\n h.select {|k,v| v == highest_count}.keys\nend",
"def my_uniq(arr)\n counter = Hash.new(0)\n arr.each do |x|\n counter[x] += 1\n end\n counter.keys\nend",
"def array_to_unique\n a = File.readlines(file_name)\n b = a.sort\n c = b.uniq\n while d = c.shift\n puts d.to_textual unless nil?\n end\n end",
"def migratoryBirds(ar)\n birds = ar.group_by {|v| v}\n most_repeated_birds = birds.sort_by{|key,value| value.length}\n most_repeated_birds.last.first\nend",
"def array_unique(array = [])\n raise 'incorrect array' unless array.is_a? Array\n\n uniq_values = []\n array.each do |el|\n unique_counter = 0\n array.each do |e|\n next if el != e\n\n unique_counter += 1\n end\n uniq_values << el if unique_counter == 1\n end\n uniq_values\nend",
"def test_removes_duplicates\n stream = FromArray.new([2, 2, 3, 4, 1, 1, 2, 5, 4, 3, 6])\n collected = stream.distinct.collect\n assert(collected == collected.uniq)\n assert(collected.length == collected.uniq.length)\n end",
"def sort(unsorted, highest)\n\t# create a hash for each unsorted score\n scores_occurances = {}\n # result array\n sorted_scores = []\n # walk over the unsorted array and add 1 to our hash for each occurance\n unsorted.each do |score| \n \tif(scores_occurances.has_key?(score))\n\t \tscores_occurances[score] += 1\n\t else\n\t \tscores_occurances[score] = 1 \n\t end\n end\n\n (1..highest).each do |int|\n \tif(scores_occurances.has_key?(int))\n scores_occurances[int].times { sorted_scores.push(int) }\n end\n end\n \n sorted_scores\nend",
"def find_unique_elements(arr)\n \n#Algorithmic Process\n#Create an array that includes elements without the repeats\n#Create a hash that pairs each element of the new array with how many times it appears in the original array\n#Any key-value pair that has 1 for a value is unique and gets placed in the desired array\n \nnew_hash = {}\narr.each do |x|\n new_hash[x] = 0 if new_hash[x].nil?\n new_hash[x] = new_hash[x] + 1\nend\n\nnew_hash.delete_if {|key, value| value != 1}\nnew_hash.each_key {|key| puts key}\n\nend",
"def mode(array)\n\thash = array.group_by{|i|i}\n\tnew_array = hash.sort_by {|key,value| \n\t\t-value.size\n\t}\n\ti = new_array[0][1].size\n\tmode_array = []\n\tnew_array.each {|value|\n\t\tif value[1].length == i\n\t\t\tmode_array << value\n\t\tend\n\t}\n\tfinal = mode_array.map{|value| value[1]}\n\tfinal.flatten.uniq.sort\nend",
"def remove_duplicates(array)\nend",
"def dominant(arr)\n\tsorted = Array.merge_sort(arr){|a,b| a.length <=> b.length}\n\tsorted[-1]\nend",
"def mode(array)\n\thash = Hash.new(0)\n \t\tarray.each do |i|\n \t\thash[i] += 1\n \tend\n\tfinal_array = []\n \tn = 0\n \tfrequent_value = hash.values[0]\n \twhile n < hash.length\n\t\tif frequent_value < hash.values[n]\n \t\tfrequent_value = hash.values[n]\n \tend\n \tn += 1\n \tend\n \thash.each do |key, val|\n \tif val == frequent_value\n \t\tfinal_array.push(key)\n \tend\n \tend\n \tp final_array\nend",
"def find_unique_elements (arr)\n n = Hash.new(0)\n return_array = []\n arr.each do |element|\n n[element] += 1\n end\n n.each_pair { |k,v| \n if v == 1\n return_array << k\n end\n }\n \n return return_array\nend",
"def my_array_sorting_method(source)\n\treturn source.uniq.map{|element| element.to_s}.sort\nend",
"def redundancy(array, sensitive=true)\n if sensitive == false\n array = lower(array)\n end\n base = array.to_a.sort! { |x, y| x.to_s <=> y.to_s }.uniq\n occurence = {}\n n, b = 0, 0\n base.each do |x|\n while x == array[n]\n n += 1\n end\n occurence[x] = n - b\n b = n\n end\n puts occurence\nend",
"def dictionary_sort arr\r\n\trec_dict_sort arr, []\r\nend",
"def using_uniq(array)\n array.uniq\nend",
"def using_uniq(array)\n array.uniq\nend",
"def using_uniq(array)\n array.uniq\nend",
"def using_uniq(array)\n array.uniq\nend",
"def using_uniq(array)\n array.uniq\nend",
"def using_uniq(array)\n array.uniq\nend",
"def using_uniq (array)\n return array.uniq!\nend",
"def find_unique_elements(arr)\n collect = Hash.new 0\n \n arr.each do |elt|\n collect[elt] += 1\n end\n\n unique_hash = Hash(collect.select {|k,v| v == 1})\n \n unique_hash.keys\nend",
"def mode (array) \n# creates a hash(tracker) with items as keys and frequencies as values\n tracker = {} \n array.each do |x| \n if tracker.has_key?(x) \n tracker[x] += 1\n else\n tracker[x] = 1\n end \n end \n\n# adds each key (item) with the max value to the output array\n output = []\n tracker.each do |key, value|\n if value == tracker.values.max\n output << key\n end\n end\n\n return output\nend",
"def lecturer_union(arr1,arr2)\n arr1.dup.concat(arr2).uniq.sort\nend",
"def unique_elements(array)\n hash = Hash.new(0)\n array.each { |ele| hash[ele] += 1 }\n\n hash.keys\nend",
"def get_non_duplicated(given_array)\n non_repeated_values=[\"\"]\n non_repeated_index=0\n outer_index=0\n given_array.each do |first_num|\n flag_for_a_duplicate=true\n inner_index=0\n given_array.each do |second_num|\n if (first_num == second_num) && (inner_index \\\n != outer_index)\n flag_for_a_duplicate=false \n end \n inner_index +=1\n end\n if flag_for_a_duplicate\n non_repeated_values[non_repeated_index]=first_num\n non_repeated_index +=1\n end\n outer_index +=1\n end\n non_repeated_values \nend",
"def strand_sort(array)\n temp = array.dup\n result = []\n until temp.empty?\n value = temp.first\n sublist, temp = temp.partition { |val| value = val if value <= val }\n result += sublist.shift(sublist.length) if result.empty?\n result = binary_sort(result, sublist)\n end\n result\nend",
"def mode(array)\n frequency = Hash.new\n array.each do |x|\n array.count(x)\n frequency[x] = array.count(x)\n end\n\n most_frequent = Array.new\n max = frequency.max_by { |x, y| y}\n min = frequency.min_by { |x, y| y}\n if min == max\n frequency.each do |x,y| \n most_frequent = most_frequent.push(x)\n end\n else\n most_frequent[0] = max[0]\n end\n return most_frequent\nend",
"def del_sort(array)\n end",
"def sortByCountDecreasing\r\n @counts.sort_by { |k,v| v }.reverse\r\n end",
"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 sort_scores(unsorted_scores, highest_possible_score)\n\n # array of 0s at indices 0..highest_possible_score\n score_counts = [0] * (highest_possible_score+1)\n\n # populate score_counts\n unsorted_scores.each do |score|\n score_counts[score] += 1\n end\n\n # populate the final sorted array\n sorted_scores = []\n\n # for each item in score_counts\n score_counts.each_with_index do |count, score|\n\n # for the number of times the item occurs\n (0...count).each do |time|\n\n # add it to the sorted array\n sorted_scores.push(score)\n end\n end\n\n return sorted_scores\nend",
"def my_uniq(arr)\n answer = Hash.new\n arr.each_with_index do |el, i|\n answer[el] = 1\n end\n answer.keys\nend",
"def using_uniq(array)\n array.uniq()\nend",
"def uniq(array)\n unique_values = []\n array.each do |el|\n unless unique_values.include?(el)\n unique_values << el\n end\n end\n unique_values\n end",
"def non_duplicated_values(array)\n count = Hash.new(0)\n u_num = []\n array.each {|x| count[x] += 1}\n count.each do |k, v|\n if v == 1\n u_num.push(k)\n end\n end\n\n u_num\nend",
"def mode (array)\n hash = Hash.new (0)\n array.each { |item|\n hash[item] += 1}\n hash\n\n frequency = hash.values.max\n new_array = []\n\n hash.each { |key, value|\n if frequency == value\n new_array.push(key)\n end}\n new_array\nend",
"def my_uniq(arr)\n hsh = Hash.new(0)\n arr.each do |el|\n hsh[el] += 1\n end\n hsh.keys\nend",
"def frequent_elements_with_ties(spectrum, m)\n # Given an array of masses in the spectrum figure out the most 'm' frequent masses\n # including the ties\n\n freq_h = {}\n spectrum.each do |m|\n if freq_h[m]\n freq_h[m] += 1\n else\n freq_h[m] = 1\n end\n end\n\n freq_sorted_h = Hash[freq_h.sort_by{|k,v| v}.reverse]\n\n return_arr = freq_sorted_h.keys.slice(0, m)\n\n # puts freq_sorted_h\n\n (m..(freq_sorted_h.keys.length-1)).each do |i|\n if (freq_sorted_h.values[m-1] == freq_sorted_h.values[i])\n return_arr << freq_sorted_h.keys[i]\n elsif (freq_sorted_h.values[m-1] > freq_sorted_h.values[i])\n break\n end\n end\n # puts return_arr.to_s\n return return_arr\n end",
"def array_to_unique\n a = File.readline(\"./tmp/database_doings/doing_phrases/phrases_to_sort.txt\")\n b = a.sort\n c = b.uniq\n while d = c.shift\n puts d unless nil?\n end\n end"
] |
[
"0.7063057",
"0.6824201",
"0.6536194",
"0.6355298",
"0.6288329",
"0.628811",
"0.62750524",
"0.62489647",
"0.6234922",
"0.6226262",
"0.6209989",
"0.61989325",
"0.6162273",
"0.61431766",
"0.6141335",
"0.6113254",
"0.6107327",
"0.60924834",
"0.6060285",
"0.6058193",
"0.60489273",
"0.60476613",
"0.60360414",
"0.60333997",
"0.6005118",
"0.5967597",
"0.5948864",
"0.5948491",
"0.5944083",
"0.59153825",
"0.59132636",
"0.59123665",
"0.58944553",
"0.5891184",
"0.58907646",
"0.5881016",
"0.58806074",
"0.58643746",
"0.5859581",
"0.585477",
"0.5852391",
"0.5820707",
"0.5805328",
"0.5802521",
"0.5800966",
"0.57902586",
"0.57880497",
"0.57782155",
"0.5776838",
"0.5776749",
"0.5774616",
"0.57681286",
"0.5764751",
"0.57593817",
"0.574013",
"0.5740083",
"0.57378215",
"0.57378215",
"0.5734143",
"0.5726079",
"0.57239336",
"0.5722916",
"0.57215935",
"0.5716658",
"0.57139313",
"0.57110876",
"0.57083327",
"0.57074356",
"0.5706969",
"0.57028174",
"0.5702302",
"0.5701083",
"0.56924677",
"0.5686927",
"0.5685687",
"0.5685687",
"0.5685687",
"0.5685687",
"0.5685687",
"0.5685687",
"0.56847805",
"0.56818646",
"0.56802404",
"0.5678644",
"0.56653136",
"0.5664312",
"0.5661262",
"0.5661217",
"0.56602246",
"0.56569713",
"0.56546676",
"0.56535596",
"0.5648092",
"0.56473714",
"0.564534",
"0.5640202",
"0.5630939",
"0.56281143",
"0.56215894",
"0.56145895"
] |
0.73379296
|
0
|
Returns unique hash in which records are sorted by "record" => "occurrence" (Descending)
|
def sort_by_occurrence_h(input)
output = input.each_with_object(Hash.new(0)){ |tag, counts| counts[tag] += 1 }
output = Hash[output.sort_by{ |tags, counts| counts}.reverse]
return output
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sort_by_occurrence(records)\n count = Hash.new(0)\n records.each {|element| count[element] += 1}\n records = records.uniq.sort {|x,y| count[y] <=> count[x]}\n return records\n end",
"def unique_visit\n parsed_result.each do |result|\n visit_hash[result.first] = result.last.uniq.count\n end\n visit_hash.sort_by{|k,v| v}.reverse.to_h\n end",
"def collate!\n @buckets = @buckets.sort { |a,b| b.time <=> a.time }\n @ordered = {}\n @buckets.map { |o| o.identity }.uniq.each do |identity|\n @ordered[identity] = @buckets.select { |o| o.identity == identity }\n end\n return @buckets\n end",
"def analyze_data(ary)\n frequency = count_frequency(ary)\n sort_hash(frequency)\nend",
"def hash_to_hist(hhash)\n hhash.map{ |k,v| [k, v.size] }.to_h.sort_by{|k,v| v}.reverse.to_h\n end",
"def most_unique\n records = @logs.records.sort_by(&:unique).reverse\n @view.display_most_unique(records)\n end",
"def sort_by_occurrence(list)\n map = {}\n count = [999, list.length].min\n for word in list\n word = word.downcase\n map[word] ||= count\n map[word] += 1000\n count -= 1 if count > 0\n end\n map.to_a.sort_by {|x| -x.last}.map {|x| x.first}\n end",
"def compute_reverse_records(site_uid, site_records)\n reverse_records = {}\n\n site_records.each { |zone, records|\n # Sort records\n site_records[zone] = sort_records(records)\n\n records.each{ |record|\n # Get reverse records\n reverse_file_name, reverse_record = get_reverse_record(record, site_uid)\n if reverse_file_name != nil\n reverse_records[reverse_file_name] ||= []\n reverse_records[reverse_file_name].each {|r|\n if r.label == reverse_record.label\n puts \"Warning: reverse entry with address #{reverse_record.label} already exists in #{reverse_file_name}, #{reverse_record.name} is duplicate\"\n end\n }\n reverse_records[reverse_file_name] << reverse_record\n end\n }\n }\n\n reverse_records\nend",
"def freq_list\n freq_hash = each_with_object(Hash.new(0)) { |v, h| h[v] += 1 }\n freq_hash.sort_by { |k, v| -v }\n end",
"def uniq_by_last(list)\n seen = Hash.new\n uniq_list = list.to_a.reverse.reject do |line|\n dupe = seen.include?(line)\n seen[line] = true\n dupe\n end.reverse\n uniq_list\nend",
"def generate_hash\n @groups.flatten.inject([]) {|hash, stone| hash << stone.to_s}.sort.hash\n end",
"def hash_hash(h)\n require 'digest/md5'\n\n ordered = h.sort.map { |i| i.class==Hash ? i.sort : i }\n return ordered.to_s\n Digest::MD5.hexdigest(Marshal::dump(ordered))\n end",
"def dup_hash(ary)\r\n new_hash = ary.inject(Hash.new(0)) { |h,e| h[e] += 1; h }.select { |_k,v| v > 1 }.inject({}) { |r, e| r[e.first] = e.last; r }\r\n new_hash.each{ |k,v| new_hash[k] = v - 1}\r\n return new_hash\r\nend",
"def sort_and_print(hash, type=\"visits\")\n new_hash = hash.sort_by { |page, visits| -visits}.to_h\n # Print into console to check\n new_hash.each do |page, number_of_visits|\n print page + \" \" + number_of_visits.to_s + \" \" + type + \" \"\n end\n # Return sorted hash\n return new_hash\nend",
"def my_uniq(arr)\n #make hash with each item in teh array as a key, and the value will be its frequency\n new_arr = []\n freqhash = Hash.new(0)\n arr.each do |ele| \n freqhash[ele] += 1\n end\n \n freqhash.each do |k, v| \n new_arr << k\n end\n \n new_arr\nend",
"def unique_entries\n entries = Hash[*@entries.map { |entry| [entry.ip_address, entry] }.flatten].values\n entries.sort_by { |e| [-e.priority.to_i, e.hostname.to_s] }\n end",
"def consolidate_by_frequency(array)\n array.group_by{|x| x}.values.sort_by{|group| group.count}.reverse.flatten(1).uniq\nend",
"def mode(array)\n hash = Hash.new(0)\n new_array = []\n\n array.each do |i|\n hash[i] += 1\n end\n\n hash = hash.sort_by { |key, value| value }.reverse.to_h\n\n hash.each do |key, value|\n if value == hash.values[0]\n new_array << key\n end\n end\n p new_array\nend",
"def most_common_letter(string)\nletters = string.split(\"\")\n# Making a new hash \nfrequencies = Hash.new (0)\n# Add one to the key's value every time the key appears\nletters.each { |letter| frequencies|letter| += 1 }\n# Sorting frequencies by the value of letter \nfrequencies = frequencies.sort_by do |letters, letter| \n letter\nend\n \n puts letters + \" \" + letter \nend",
"def reverse_hash(elements, order)\n length = elements.length\n retn = []\n for i in 0...length\n index = order / FACTORIAL[length - i - 1]\n retn[i] = elements[index]\n elements.delete_at(index)\n order %= FACTORIAL[length - i - 1]\n end\n retn\n end",
"def count(word_list)\n counts =Hash.new(0)\n for word in word_list\n counts[word] +=1\n end\n #counts\n sorted = counts.sort_by{|w, count| count}.reverse\n return sorted\nend",
"def calculate_unique_page_views\n ip_frequency_per_page = calculate_ip_frequency_per_page\n ip_frequency_per_page.transform_values { |value| value.uniq.length }.sort_by { |_key, value| value }.reverse.to_h\n end",
"def unique_entries_by_(key) \n seen = Set.new()\n entries.select { |e|\n k = e.send(key)\n seen.add?(k)\n }.sort{|a, b| a.range.low <=> b.range.low }\n end",
"def getHistogram(sort)\n\n\tif sort == nil\n\t\treturn\n\tend\n\n\thistoGram = {}\n\tvalues = {}\n\ti = 0\n\tj = 1\n\n\twhile j <= sort.length\n\t\tif sort[i] == sort[j]\n\t\t\tj+=1\n\t\telse\n\t\t\tif j - i > 1\n\t\t\t\t#more than 1 character in string\n\t\t\t\tvalues = {sort[i] => (j-i)}\n\t\t\t\thistoGram.merge!(values)\n\t\t\tend\n\t\t\ti = j\n\t\t\tj = i + 1\n\t\tend\n\tend\n\n\thistoGram = histoGram.to_h\n\n\treturn histoGram\n\nend",
"def sort_counts()\n @count_array = @counts.to_a\n @count_array.sort_by! { |pair| pair[1] }\n @count_array.reverse!\n @count_array\n end",
"def most_frequent_occurrence(str)\n lower_str = str.downcase\n letters = {}\n most_frequent = []\n\n for i in 0..lower_str.length - 1\n if letters[lower_str[i]]\n letters[lower_str[i]] += 1\n else\n letters[lower_str[i]] = 1\n end\n end\n\n letters.each do |key, value|\n if most_frequent.length == 0 || letters[key] > most_frequent[1]\n most_frequent = [key, value]\n end\n end\n\n return most_frequent[0]\nend",
"def my_uniq(arr)\n count = Hash.new(0)\n arr.each {|ele| count[ele]+= 1}\n count.keys\nend",
"def generate_hash(input)\n @freq = analyze_raw(input)\n # Reduce returning unnecessarily large hash be stripping away frequencies < min\n @freq.delete_if {|key, value| value < @@MinWordFrequency}\n end",
"def sort_scores_hash(unsorted_scores, highest_possible_score)\n score_counts = {}\n unsorted_scores.each do |score|\n score_counts[score] = 0 unless score_counts[score]\n score_counts[score] += 1\n end\n\n sorted_scores = []\n i = HIGHEST_POSSIBLE_SCORE\n while i >= 0\n unless score_counts[i]\n i = i - 1\n next\n end\n\n score_counts[i].times { sorted_scores << i }\n i = i - 1\n end\n\n sorted_scores\nend",
"def my_uniq(arr)\n hsh = Hash.new(0)\n arr.each do |el|\n hsh[el] += 1\n end\n hsh.keys\nend",
"def greatest_val_key(hash)\n \n\twords_and_values = Hash.new 0 \n\t\n\thash.each do |word|\n\t\twords_and_values[word] = word.length\n\tend\n\n\tnew_hash = words_and_values.sort_by { |key, value| value }.reverse\n\tputs Hash[*new_hash.first]\n\nend",
"def hash_record_low_mem! set, rec, duplicate_type\n key = make_key rec, duplicate_type\n\n set << key\nend",
"def individuals\r\n @log.values.sort{ |a,b| a[:energy] <=> b[:energy] }\r\n end",
"def sort_vals_high_to_low(hash)\n result = hash.sort_by {|key, value| value}.reverse.to_h\n end",
"def highestfrequency\r\n #@counts.group_by { |x| x }.map { |element, matches| [ element, matches ] }.to_h\r\n #@counts.each_with_object({}) { |item, memo| memo[item] ||= 0; memo[item] += 1 }\r\n ##@counts.uniq.map { |x| [x, @counts.count(x)] }.to_h\r\n #freq = @counts.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\r\n @counts.max_by { |k,v| v }\r\n end",
"def my_uniq(arr)\n hashed = arr.map {|value| [value, arr.count(value)]}.flatten\n return Hash[*hashed].keys\nend",
"def my_uniq(arr)\n counter = Hash.new(0)\n arr.each do |x|\n counter[x] += 1\n end\n counter.keys\nend",
"def most_frequent_bigram(str)\n counter = Hash.new(0)\n (0...str.length-1).each { |i| counter[str[i] + str[i+1]] += 1 }\n sorted = counter.sort_by { |k, v| v }\n sorted[-1][0]\nend",
"def items\n @hashes.to_a.sort {|(_, a), (_, b)| a[:stamp] <=> b[:stamp] }\n end",
"def redundancy(array, sensitive=true)\n if sensitive == false\n array = lower(array)\n end\n base = array.to_a.sort! { |x, y| x.to_s <=> y.to_s }.uniq\n occurence = {}\n n, b = 0, 0\n base.each do |x|\n while x == array[n]\n n += 1\n end\n occurence[x] = n - b\n b = n\n end\n puts occurence\nend",
"def hkey(h)\n h.sort_by{|x| x[0].to_s}\n end",
"def serializable_hash \n results.each.inject(empty_bins) do |histogram, result|\n histogram[result] = histogram[result] ? histogram[result] + 1 : 1; histogram\n end\n end",
"def uniqify_arrays_in_hash(hash, sub_key)\n\t\t#iterates over each of the top level values in the hash\n\t\tnew_hash = {}\n\t\thash.map do |key,value|\n\t\t\t#using the sub key, removes all but the last added value\n\t\t\tnew_hash[key] = value.reverse.uniq {|sub_value| sub_value[sub_key]}\n\t\tend\n\t\treturn new_hash\n\tend",
"def uniq(arr)\n result = []\n\n hash_of_uniqs = {}\n arr.each do |el|\n hash_of_uniqs[el] = el\n end\n\n hash_of_uniqs.each do |k, v|\n result << v\n end\n result\nend",
"def hash\n value = 0\n my_rows = @rows\n r_size = my_rows.size\n for i in 0..r_size-1 do\n a_row = my_rows[i]\n a_size = a_row.size\n for j in 0..a_size-1 do\n value ^= a_row[j].hash\n end\n end\n return value\n end",
"def sort_by_decreasing_frequency(img)\n\t\t\t\t hist = img.color_histogram\n\t\t\t\t # sort by decreasing frequency\n\t\t\t\t sorted = hist.keys.sort_by {|p| -hist[p]}\n\t\t\t\t new_img = Magick::Image.new(hist.size, 1)\n\t\t\t\t new_img.store_pixels(0, 0, hist.size, 1, sorted)\n\t\t\t\tend",
"def sort_by_decreasing_frequency(img)\n hist = img.color_histogram\n # sort by decreasing frequency\n sorted = hist.keys.sort_by {|p| -hist[p]}\n new_img = Magick::Image.new(hist.size, 1)\n new_img.store_pixels(0, 0, hist.size, 1, sorted)\n end",
"def compute_element_occurrence(values)\n uniq_elements = Hash.new(0)\n values.map { |x| uniq_elements[x] += 1 }\n uniq_elements\nend",
"def weighted_uniq(array)\n weighted_hash = array.each_with_object({}) do |v, acc|\n acc[v] ||= 0\n acc[v] += 1\n end\n n = 0\n (weighted_hash.sort_by do |x|\n n += 1\n [-x[1], n]\n end).to_h\n end",
"def my_uniq(arr)\n hash = Hash.new(0)\n arr.each {|el| hash[el] = 1} #value doesnt matter this case\n hash.keys\nend",
"def most_frequent_bigram(str)\n binaries = [] \n letters = str.split(\"\") #\"thrill\"\n (0...(letters.length-1)).each_with_index do |letter,idx|\n binaries << (letters[idx] + letters[(idx + 1)])\n end\n hash = Hash.new(0)\n binaries.each do |pairs|\n hash[pairs] += 1 \n end\n sorted = hash.sort_by { |k , v| v }\n return sorted[-1][0]\nend",
"def sortByCountDecreasing\r\n @counts.sort_by { |k,v| v }.reverse\r\n end",
"def uniq_hash(in_hash = {})\n uniq_values = in_hash.values.uniq\n out_hash = {}\n uniq_values.each do |uniq_va|\n in_hash.each do |k,v|\n if v == uniq_va\n if out_hash[uniq_va]\n out_hash[uniq_va] << k\n else\n out_hash[uniq_va] = []\n out_hash[uniq_va] << k\n end\n end\n end\n end\n return out_hash\nend",
"def frequencies(chars)\n freq = Hash.new(0)\n chars.each do |char|\n freq[char] += 1\n end\n freq = freq.sort_by { |char, count| count } # order by highest frequency\n freq.reverse!\n freq = Hash[freq]\n return freq\nend",
"def top_k_frequent_elements(list, k)\n # load a hash table which has elements & their frequency \n element_frequency = {}\n array = []\n return array if list.length == 0\n\n list.each do |val|\n if !(element_frequency[val])\n element_frequency[val] = 1\n else\n element_frequency[val] += 1\n end\n end\n\n values = element_frequency.values.sort!\n inverted_hash = element_frequency.invert\n \n k.times do |i|\n array << inverted_hash[values[i]]\n end\n\n return array \nend",
"def format_two_invoices\n @hash_sorted_by_key = []\n\n #--> Search the list (2) invoices regarding the same documentID that is why the list has been sorted by @documentID\n while @hash_sorted_by_key.length < 2\n\n #Get a document randomly\n index = rand(0..(@b2b_partners_list_invoices.length-1))\n @documentID = @b2b_partners_list_invoices[index][\"PEDC_ID_CLIENTE\"]\n\n #--> Select the hash by chosen document\n @hash_sorted_by_key = @b2b_partners_list_invoices.select { |h| h['PEDC_ID_CLIENTE'] == @documentID }\n\n end\n\nend",
"def find_unique_elements(arr)\n freq = Hash.new #hash to count integers in using key as integer and value as count\n answer = Array.new #array to store the answer to be returned in\n\n \n arr.each {|a| #loop through every element in array \n if freq[a] != nil #check to see if hash value exists\n freq[a] = freq[a] + 1 #add 1 to the hash value\n else \n freq[a] = 1 #create the hash value\n end\n }\n\n\n freq.each {|key, value| #loop through all key and value combinations in hash\n if value == 1 #If the value is 1 it is unique so add it to the answer array to be returned\n answer << key\n end\n } \n return answer\n\nend",
"def read_and_sort_unique_numbers_from_file(filename)\n fh = File.new(filename, 'r')\n\n numbers = Hash.new\n\n while line = fh.gets\n number = line.to_i\n numbers[number] = 1\n end\n fh.close\n\n return numbers.keys.sort\nend",
"def hash_hash(h)\n require 'digest/md5'\n Digest::MD5.hexdigest(Marshal::dump(h.sort))\n end",
"def most_frequent_bigram(str)\n counts = Hash.new(0)\n (0...str.length-1).each do |i|\n bigram = str[i..i + 1]\n counts[bigram] += 1\n end\n\n sorted = counts.sort_by { |h,v| v } # sorts by value \n sorted.last[0]\nend",
"def sort_records(raw_records)\n records = raw_records.clone\n return records if records.size < 2\n (records.size - 2).downto(0) do |i|\n (0 .. i).each do |j|\n records[j], records[j + 1] = records[j + 1], records[j] if records[j].id.to_i < records[j + 1].id.to_i\n end\n end\n records\n end",
"def most_frequent_bigram(str)\n new_array =[]\n new_arr = []\n hash = {}\n hash = Hash.new {|k, v| hash[k] = 0}\n new_str = str.split(\"\")\n (0...new_str.length).each do |i0|\n (i0...new_str.length).each do |iz|\n pair = new_str[i0..iz]\n new_array << pair\n end\n end\n\n new_array.each do |combined|\n if combined.length == 2\n new_arr << combined \n end\n end\n \n new_arr.each do |pairs| \n hash[pairs] += 1\n end\n \n hash.each {|k, v| return k.join(\"\") if v == hash.values.max}\n\n \nend",
"def gen_key(record)\n return Digest::SHA2.hexdigest(record.to_s)\n end",
"def sorted_affinities\n unless @sorted_affinities\n @sorted_affinities = hash_pidurl_affinity.collect { |product_idurl, affinity| affinity }\n @sorted_affinities.sort! { |a1, a2| a2.measure <=> a1.measure }\n current_ranking = 0; previous_measure = nil\n @sorted_affinities.each do |affinity|\n if affinity.measure != previous_measure\n current_ranking += 1\n previous_measure = affinity.measure\n end\n affinity.ranking = current_ranking\n end\n end\n @sorted_affinities\n end",
"def search_queries_with_frequencies_sorted_descending\n @searches_grouped_by_frequency.to_a.sort{|a,b| b[1] <=> a[1]}\n end",
"def sorted_keys; end",
"def savehist(hist, name) \n\thist_sort = {}\n\thist.each {|part, h|\n\t\thist_sort[part] = h.to_a.sort{ |a, b| b[1]<=>a[1]}\n\t\tFile.open(\"#{name}#{part}.txt\", \"w\") {|f| \n\t\t\thist_sort[part].each {|word, occurrence|\n\t\t\t\tf.print \"#{word} #{occurrence}\\n\"\n\t\t\t}\n\t\t}\n\t}\n\treturn hist_sort\nend",
"def dictionary_sort(arr)\n rec_dict_sort arr, []\nend",
"def most_similar(u)\n\t\tuserlist = @userdata.keys\n\t\tuserlist.sort_by{ |id| [similarity(u, id)] }.reverse.drop(1)\n\tend",
"def print_sorted_hash(hsh)\n pp Hash[hsh.sort_by{|k, v| v}.reverse]\n end",
"def sort_hash(hash)\n hash.to_a.sort_by { |a, b| a.to_s }\n end",
"def to_hash\n Hash[sort_tuples(section_tuples)]\n end",
"def hash_record! ht, rec, duplicate_type\n case duplicate_type\n when 1 # whole header match\n unless ht.has_key? rec.header\n ht[rec.header] = rec\n end\n when 2 # header ID match\n unless ht.has_key? rec.id\n ht[rec.id] = rec\n end\n when 3 # whole seq match\n unless ht.has_key? rec.seq\n ht[rec.seq] = rec\n end\n when 4 # whole seq + whole header\n key = \"#{rec.header}#{rec.seq}\"\n unless ht.has_key? key\n ht[key] = rec\n end\n when 5 # whole seq + hedaer ID\n key = \"#{rec.id}#{rec.seq}\"\n unless ht.has_key? key\n ht[key] = rec\n end\n end\nend",
"def unique_elements(arr)\n\n # hash count -> duplicate removed -> return a new array\n new = []\n\n # count = Hash.new(0) # create {} with default value 0\n arr.each do |ele|\n if !new.include?(ele)\n new << ele\n end\n end\n # print count # {\"a\"=>3, \"b\"=>2, \"c\"=>1}\n\n return new \nend",
"def sort_and_print(hash)\n hash.sort_by {|k, v| v}.reverse.each{|item| p item}\nend",
"def largest_hash_key(hash)\n current_highest_id = \"\"\n current_highest = 0\n hash.each do |k,v|\n if v > current_highest\n current_highest = v\n current_highest_id = k\n end\n end\n current_highest_id\n end",
"def euler079\n inputs = []\n File.open_euler('keylog.txt').each_line do |line|\n inputs.push(line.chomp)\n end\n inputs.uniq!.sort!\n\n # create hash of all the numbers that exist\n proceeded_freq = inputs.join.split('').uniq.sort.reduce({}) { |a,n| a[n] = []; a }\n\n # populate the hash, for each key, the value is the numbers that follow it\n inputs.each do |n|\n proceeded_freq[n[0].chr].push(n[1].chr)\n proceeded_freq[n[0].chr].push(n[2].chr)\n proceeded_freq[n[1].chr].push(n[2].chr)\n end\n\n proceeded_freq.map { |k,v| v = v.uniq! }\n proceeded_freq = proceeded_freq.sort_by { |k,v| v.length }.reverse\n\n answer = proceeded_freq.reduce(\"\") { |a, n| a << n[0] }.to_i\nend",
"def most_similar(u)\n userlist = @userdata.keys\n userlist.sort_by{ |id| [similarity(u, id)] }.reverse.drop(1)\n end",
"def hash\n @hash || @hash = (value.hash * -1)\n end",
"def most_frequent_bigram(str)\n\n new_hash = Hash.new(0)\n str.each_char.with_index do |ele, i|\n if i < (str.length - 1)\n new_hash[ele + str[i +1]] += 1\n end\n end\n # p new_hash.values.max\n new_hash.each do |k, v|\n if new_hash.values.max == v\n return k\n end\n end\n\nend",
"def occurences(file) # \n fileString = File.read(file).to_s # the text of the file is stored\n fileString = fileString.chars.sort.join # we sort it\n #puts \"the ordered charactors are\" # \n #puts fileString # \n write_handler = File.new(file+\"_result.out\", \"w\") # create a new file called that _out\n\n # \n result = \"\" # \n values = Hash.new(0) # create new hashtable\n fileString.chars.each do |char| # for each of the chara\\actors\n values[char.to_s] +=1 # add it to the hash\n end # \n values = values.sort_by {|_key, value| value} # sort by lmost common letter\n values = values.reverse # reverse it\n values.each do |val| # for each value\n write_handler.puts val[1].to_s+ \":\"+val[0].to_s # add it to the new file\n end # end\n write_handler.close # close file\n return result # return resullt\nend",
"def hash; map{|el| \"#{el.name} @ #{el.hash}\"}; map(&:hash).reduce(:+) % 2**32; end",
"def calculate_most_viewed_pages\n pages_with_frequency = calculate_page_frequency\n pages_with_frequency.sort_by { |_key, value| value }.reverse.to_h\n end",
"def uniq(array)\n\t\n\tcount = Hash.new 0\n\n array.each do |num|\n count[num] += 1\n end\n \n uniqueness = count.select { |k,v| v == 1 }\n uniqueness.select { |k,v| puts k }\n \nend",
"def ordered_entity_hash\n hash = ActiveSupport::OrderedHash.new\n DC::VALID_KINDS.each {|kind| hash[kind] = [] }\n entities.each do |e|\n hash[e.kind].push :value => e.value, :relevance => e.relevance\n end\n hash.each do |key, list|\n hash[key] = list.sort_by {|e| -e[:relevance] }\n end\n hash\n end",
"def top_k_frequent_elements(list, k)\n return nil if !list\n # intialze an empty hash\n ## iterate throught the list\n #chechk if the key is in the hash,\n # if key is in the hash ++ value\n # otherwise add key and value as 1 since it's first occurance\n # now the key(uniqe) and value(how many time the int_value) happend is in the hash,\n # my_hash.sort_by { |_, value| value }.each { |key, value| puts key } (iterate throught the hash, (hash.each {|key, value|}) )\n # before pushing the key into the initalized array, check to see if the length is less than k\n # if\n hash = Hash.new\n list.each do |int_value|\n if hash.key?(int_value)\n hash[key] = +1\n else\n hash[key] = 1\n end\n end\n kth_frequent_elements = []\n counter = 0 \n pervisou_value = 0\n hash.sort_by { |k, v| -v }.each do |key, value|\n if counter < k\n kth_frequent_elements << key\n if pervisou_value != value\n pervisou_value = value\n counter += 1\n end\n # end\n # if kth_frequent_elements.length < k\n # kth_frequent_elements << key\n else\n break\n end\n end\n return kth_frequent_elements\nend",
"def hash\n Zlib.crc32(to_a.map(&:to_s).sort.to_s)\n end",
"def find_most_frequent_integer(arr)\n collect = Hash.new 0\n \n arr.each do |int|\n collect[int] += 1\n end\n \n if collect.select {|k,v| v == collect.values.max}.count > 1\n nil\n else\n collect.key(collect.values.max)\n end\nend",
"def find_most_frequent_integer(arr)\n #1. Create hash variable with default 0 value.\n hashld = Hash.new 0\n \n #2. Loop through each array element, count them, and insert the final key/value combo into the hashld hash.\n arr.each do |ele|\n \t hashld[ele] += 1\n end\n \n #3. Hold max count in variable.\n maxd = hashld.values.max\n \n #4. Create new hash containing keys with more than 1 count.\n fnlhsh = (hashld.select {|key,value| value == maxd})\n \n #5. Return array if size == 1, else return nil. \n if fnlhsh.size == 1\n final_val = fnlhsh.keys.join.to_i\n else \n final_val = nil\n end\n \n return final_val\nend",
"def dedupe_by_uri(records)\n result = []\n seen = {}\n\n records.reverse.each do |record|\n if !seen[record['uri']]\n result << record\n seen[record['uri']] = true\n end\n end\n\n result.reverse\n end",
"def dedupe_by_uri(records)\n result = []\n seen = {}\n\n records.reverse.each do |record|\n if !seen[record['uri']]\n result << record\n seen[record['uri']] = true\n end\n end\n\n result.reverse\n end",
"def most_similar (u1)\n\t\thash_user_similar = Hash.new\n\t\t@train_data.each_key do |d|\n\t\t\thash_user_similar.store(d, pearson_similarity(u1,d))\n\t\tend\n\t\thash_user_similar.delete(u1)\n\t\treturn sort_decrease_order(hash_user_similar)\n\n\tend",
"def my_uniq(arr)\n hash = {}\n arr.each { |obj| hash[obj] = true }\n hash.keys\nend",
"def find_unique_page_visits(visits)\n unique_visits_hash = Hash.new(0)\n unique_addresses_hash = Array.new\n visits.each do |visit|\n # Each time a unique visit is detected, it adds the address and page to an array, so that it can be checked against for future checks\n if !unique_addresses_hash.include? [visit.page, visit.address]\n unique_addresses_hash.push [visit.page, visit.address]\n unique_visits_hash[visit.page] +=1\n end\n end\n # Returned the hash in case it would be required to be stored rather than just printed\n return unique_visits_hash\nend",
"def repeats(sentence)\n\n words = sentence.split\n hash = {}\n\n words.each do |word|\n hash[word] = count(word)\n end\n\n greatest_value = hash.sort_by{|k, v| v}.last.last\n\n hash.select{|k,v|v=greatest_value}.first.first\n\nend",
"def test_function\n puts \"Please supply input\"\n text = gets.chomp\n words = text.split(\" \")\n\n frequencies = Hash.new(0)\n\n\n words.each do |word|\n frequencies[\"#{word}\"] += 1\n end\n\n\n frequencies = frequencies.sort_by do |k, v|\n frequencies[k] = v\n end\n frequencies.reverse!\n\n frequencies.each do |k,v|\n puts \"#{k} #{v.to_s}\"\n end\nend",
"def sorted_users\n _users_hash = Hash.new( 0)\n category_users.each{|_u| _users_hash[ _u] +=1 }\n _users_hash.sort {|u1,u2| u2[1] <=> u1[1]}.collect{|k,v| k}\n end",
"def get_ographhash(ographobj)\n ographhash = Hash[\n 'display' => ographobj.at_xpath(\"displayprio\").text,\n 'name' => ographobj.at_xpath(\"name\").text,\n 'yaxis' => ographobj.at_xpath(\"verticallabel\").text,\n 'datapoints' => ographobj.xpath('datapoints/overviewgraphdatapoint'),\n ]\n\n return Hash[ographhash.sort]\n end",
"def uniqufy(original_list)\n # Recursive function to bump index unti it is not unique\n def increment(key, acc) if acc.map { |p| p[0] }.include?(key) then increment(bump(key), acc) else key end end \n def bump(pair) [pair[0], pair[1] + 1] end # Increment index in pair of key and index\n\n list = original_list.map { |k, v| [[k, 0], v] } # Index everything with zero first\n pair_list = list.reduce([]) do |acc, pair|\n acc.unshift([increment(pair[0], acc), pair[1]]) # Increment indexes while they're not unique\n end\n\n pair_list.map do |key, val| # Append non-zero indexes as _N postfix\n if key[1] == 0 then [key[0], val] else [\"#{key[0]}_#{key[1]}\", val] end\n end\nend",
"def ph(hash)\n hash.sort { |a, b| a[1]<=>b[1]}.each { |a| puts \"#{a[0]} : #{a[1]}\"}\nend"
] |
[
"0.7349603",
"0.6310041",
"0.60507303",
"0.5988765",
"0.5862194",
"0.57976025",
"0.57502365",
"0.573817",
"0.56708723",
"0.56055963",
"0.55808556",
"0.55299145",
"0.54731566",
"0.5435659",
"0.5425528",
"0.54028034",
"0.5380501",
"0.5372697",
"0.53653216",
"0.53632504",
"0.5357126",
"0.53551954",
"0.5344654",
"0.5326153",
"0.5315264",
"0.530356",
"0.5295534",
"0.5287473",
"0.5254868",
"0.52533746",
"0.525227",
"0.5247611",
"0.52459306",
"0.5214675",
"0.52121204",
"0.52053696",
"0.52024084",
"0.5193283",
"0.51917565",
"0.51853627",
"0.51771134",
"0.517629",
"0.5157769",
"0.51574874",
"0.5148402",
"0.51404047",
"0.5137485",
"0.5136275",
"0.5128392",
"0.5127137",
"0.5119615",
"0.5117498",
"0.5108242",
"0.51076835",
"0.5101958",
"0.50998807",
"0.5096098",
"0.50952303",
"0.5092312",
"0.5089107",
"0.5084408",
"0.5082172",
"0.5078399",
"0.5059367",
"0.5052133",
"0.50461936",
"0.5041999",
"0.50413036",
"0.5039679",
"0.5039377",
"0.5023094",
"0.50097525",
"0.5009555",
"0.5004966",
"0.5004556",
"0.500246",
"0.5000494",
"0.49955612",
"0.49936002",
"0.49912155",
"0.4987248",
"0.49855456",
"0.49828964",
"0.49787727",
"0.497706",
"0.49769503",
"0.49766055",
"0.4970276",
"0.49650207",
"0.49641627",
"0.49641627",
"0.49632502",
"0.49614733",
"0.49533084",
"0.49459076",
"0.4945261",
"0.49439785",
"0.49434084",
"0.4940687",
"0.4940526"
] |
0.6573945
|
1
|
Register this class for the given +id+. Example: class MyPlugin < PluginHost::BaseClass register_for :my_id ... end See PluginHost.register.
|
def register_for id
@plugin_id = id
plugin_host.register self, id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def register_for(id); end",
"def register(plugin, id); end",
"def register(id, &block)\n ref = __get id\n return ref.__getobj__ if ref && ref.weakref_alive?\n item = block.call\n return nil unless item\n __register id, item\n end",
"def register_identifier(klass, identifier)\n Emittance::EventLookup::Registry.register_identifier klass: klass, identifier: identifier\n end",
"def identifier(id)\n Registry.add(id.to_s, self)\n @id = id\n end",
"def register!\n # Register the plugin.\n @manager.register_plugin! self\n end",
"def register(type, cls); end",
"def register(object); end",
"def register(klass)\n Globot.logger.debug \"Registered plugin: #{klass}\"\n @plugins << klass\n end",
"def register(id)\n cached(id) do\n raise \"No fixture named #{id} has been registered\" unless block_given?\n\n ActiveSupport::Notifications.subscribed(method(:subscriber), \"sql.active_record\") do\n yield\n end\n end\n end",
"def register(name, klass)\n @registry[name] = klass\n end",
"def register(name, klass)\n registry[name.to_sym] = klass\n end",
"def register(id, definition)\n if @definitions.has_key? id\n @logger.info 'Definition [%s] is being replaced' % id\n end\n\n @definitions.store id, definition\n end",
"def register(name, klass)\n Registry.instance.register(name, klass)\n end",
"def register\n self.class.definitions[name] = self\n self\n end",
"def register_class(name, clazz)\n register(name, Component::Descriptor.new(clazz))\n end",
"def registered?(id)\n @definitions.has_key? id\n end",
"def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end",
"def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end",
"def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end",
"def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end",
"def register_identifier(klass:, identifier:)\n raise Emittance::InvalidIdentifierError unless valid_identifier? identifier\n raise Emittance::IdentifierCollisionError if identifier_reserved? identifier, klass\n\n identifier_to_klass_mappings[identifier] = klass\n\n klass_to_identifier_mappings[klass] ||= empty_collection\n klass_to_identifier_mappings[klass] << identifier\n\n klass\n end",
"def register(*args)\n registry.register(*args)\n end",
"def reg_abs(id)\n @register[id]\n end",
"def register(subclass)\n p = subclass.new\n yield p\n p.setup\n @known << p\n end",
"def add_class(id, name, super_id, classloader_id, signers_id, \n protection_domain_id, instance_size)\n end",
"def register(endpoint_id, verb, path)\n endpoint = Endpoint.new(\n service_id: id,\n service_uri: uri,\n endpoint_id: endpoint_id,\n verb: verb,\n path: path,\n )\n EndpointRegistry.instance.register(endpoint)\n end",
"def register\n plugin_set.register(self) do |p|\n yield p if block_given?\n end\n end",
"def register\n end",
"def register_with_system(name)\n @unique_id = name.object_id\n end",
"def register(target, obj)\n end",
"def register_id(object, type, remote_id, local_id)\n @keymap[type.to_s][remote_id] = local_id\n c = object.class\n while !['Object', 'ActiveRecord::Base'].include?(c.name)\n @keymap[c.name][remote_id] = local_id\n c = c.superclass\n end\n end",
"def register(type_name, klass = nil, **options, &block)\n registry.register(type_name, klass, **options, &block)\n end",
"def register\n @is_registered = true\n self\n end",
"def register\n end",
"def register\n end",
"def register\n end",
"def register(interface)\n InvalidInterfaceError.check(interface)\n \n interfaces[interface.to_s.demodulize.underscore.to_sym] = interface\n end",
"def register(as_type, klass, constuctor_args = {})\n fail \"Registry key #{as_type} already taken - please use a different one because all subclass keys are shared\" if @@class_registry.key?(as_type.to_sym)\n @@class_registry[as_type.to_sym] = { klass: klass, args: constuctor_args }\nend",
"def register(klass, type)\n registry[type] = klass\n end",
"def register_plugin\n plugin = Class.new(Vagrant.plugin(\"1\"))\n plugin.name(\"Test Plugin #{plugin.inspect}\")\n yield plugin if block_given?\n @_plugins << plugin\n plugin\n end",
"def register_plugin(name, clazz = nil, &block)\n if clazz\n block = lambda{|_| clazz.new(@source)}\n end\n @plugins.store(name, block)\n end",
"def initialize(base_class_name, id)\n @base_class_name = base_class_name\n @id = id\n end",
"def register_plugin(plugin)\n plugin.register\n plugin\n rescue => e\n @logger.error(\"Error registering plugin\", :plugin => plugin.inspect, :error => e.message)\n raise e\n end",
"def register(session_id)\n md5 = Digest::MD5::new\n now = Time::now\n md5.update(now.to_s)\n md5.update(String(now.usec))\n md5.update(String(rand(0)))\n md5.update(String($$))\n md5.update('foobar')\n md5.update(owner_id.to_s)\n md5.update(job_id.to_s)\n md5.update(server.to_s)\n key = md5.hexdigest\n \n Cache.put(\"#{session_id}_#{key}\", self )\n \n reverse_key = [owner_id, job_id, server].join(\"_\")\n Cache.put(\"#{session_id}_#{reverse_key}\", key )\n end",
"def register(klass)\n raise TypeError, \"Can only register classes\" unless klass.is_a? Class\n raise ArgumentError, \"To register, a class must have TYPE defined\" unless klass.const_defined? :TYPE\n registered[klass::TYPE] = klass\n end",
"def register(name, type)\n registry[name] = type\n end",
"def register\n \n end",
"def register(klass)\n storage.add(klass) if klass\n end",
"def register(key, klass)\n container.register(key, klass)\n end",
"def register\r\n \r\n end",
"def register(plugin)\n\t\tname = plugin.to_s\n\n\t\traise Disbatch::InvalidPluginError unless plugin.respond_to?(:execute)\n\n\t\t@plugins[name] = plugin\n\t\tputs \"Registered #{name}\"\n\tend",
"def register(object)\n object_id = SecureRandom.uuid\n @objects[object_id] = object\n object_id\n end",
"def register type, cls\n @@processors[type] = cls\n end",
"def initialize(id, klass, *args)\n @id = id\n @set_key = self.class.key_for id\n @klass = klass.is_a?(String) ? klass.constantize : klass\n @args = args\n end",
"def register_plugin(name, &block)\n plugin = Plugin.new\n plugin.instance_eval(&block)\n @plugins[name] = plugin\n end",
"def initialize(id)\n unless id =~ /^#{self.class.id_prefix}-[-0-9a-f]+$/\n raise \"#{self.class.id_prefix} id : #{id} is not in correct format\"\n end\n @id = id\n end",
"def decorate(klass) #:nodoc:\n registered.each do |plugin|\n name = plugin.name.split(/::/).last.gsub(/([A-Z])/, '_\\1').downcase.\n sub(/^_/, '')\n ivar = \"@#{name}\"\n\n klass.send(:define_method, name) do\n instance = instance_variable_defined?(ivar) &&\n instance_variable_get(ivar)\n\n instance ||= instance_variable_set(ivar, plugin.new(self))\n end\n end\n end",
"def register(template_class, *extensions); end",
"def register\n puts \"register\"\n ApiBase.client.put(\"/device/#{self.id}\", self.to_json)\n end",
"def _register_in_memory(obj, id)\n @lock.synchronize do\n unless obj.is_a?(ObjectBase)\n PEROBS.log.fatal \"You can only register ObjectBase objects\"\n end\n if @in_memory_objects.include?(id)\n PEROBS.log.fatal \"The Store::_in_memory_objects list already \" +\n \"contains an object for ID #{id}\"\n end\n\n @in_memory_objects[id] = obj.object_id\n @stats[:created_objects] += 1\n end\n end",
"def register(path)\n\t\t\t\tpath = path.to_sym\n\t\t\t\tif @@registry[path].nil?\n\t\t\t\t\tcallback = proc { |event| Actor[:zk_service].async.event_callback(path, event) }\n\t\t\t\t\t@@registry[path] = @@zk.register(path.to_s, &callback)\n\t\t\t\tend\n\t\t\t\t@@registry_count[path] = (@@registry_count[path] || 0) + 1\n\t\t\tend",
"def add_id name, value\n context.add_id name, value\n define_singleton_method(name) { value }\n end",
"def register(name, check_class)\n @registry[name] = check_class\n end",
"def register(name, clazz)\n super([name, clazz], Adapter)\n end",
"def identify(id)\n @id = id\n end",
"def id=(id) # :nodoc:\n raise NotImplementedError.new('id can not be changed once the object was created')\n end",
"def register(*plugins)\n @@plugins += plugins\n end",
"def register(instance)\n key = build_key(instance)\n key_registry[key] = instance\n end",
"def register_method(method, &block)\n self.class.register_method(method, &block)\n end",
"def register(...)\n container.register(...)\n end",
"def register\n\n\tend",
"def register_dynamic(object); end",
"def register(name, plugin = false)\n return unless plugin && !loaded?(name)\n @plugins << plugin\n end",
"def set_registered_for\n @registered_for = RegisteredFor.find(params[:id])\n end",
"def new\n @class_register = ClassRegister.new\n end",
"def register_plugin(plugin)\n @plugins ||= Set.new\n @plugins << plugin\n end",
"def registered\n\t\t\tself\n\t\tend",
"def register_type(type, klass, method_name, &block)\n end",
"def register_instance(as_type, instance)\n @@class_registry[as_type.to_sym] = { instance: instance }\nend",
"def add_id(id)\n redis.sadd(key, id)\n end",
"def << plugin\n @plugins[plugin.to_s] = plugin\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(id)\n @id = id\n end",
"def initialize(id)\n @id = id\n end",
"def register(name, extensions, clazz)\n readers << [name, extensions, clazz]\n (class << self; self; end).\n send(:define_method, name) do |*args|\n clazz.new(*args)\n end\n end",
"def define_hook(id, &block)\n\t\t\t\t\th = Hook.new id, &block\n\t\t\t\t\t@hooks[id] = [] unless @hooks[id]\n\t\t\t\t\t@hooks[id] << h\n\t\t\t\tend",
"def initialize(id = nil)\n @id = id || self.class.shorthand_name\n end",
"def register(object)\n\t\t\traise TypeError, 'handle_packet not defined' if !object.respond_to?(:handle_packet)\n\t\t\t@registered << object\n\t\tend",
"def register_broker(broker, identifier)\n registry.register broker, identifier\n end",
"def register\n return self if registered?\n mod_instance = self\n # class Class < SugarCRM::Base\n # module_name = \"Accounts\"\n # end\n klass = Class.new(SugarCRM::Base) do\n self._module = mod_instance\n end \n \n # class Account < SugarCRM::Base\n SugarCRM.const_set self.klass, klass\n self\n end",
"def registerTarget(id, backends: nil)\n if @config['classic'] or !@config.has_key?(\"classic\")\n MU.log \"Registering #{id} to ELB #{@cloud_id}\"\n MU::Cloud::AWS.elb(region: @region, credentials: @credentials).register_instances_with_load_balancer(\n load_balancer_name: @cloud_id,\n instances: [\n {instance_id: id}\n ]\n )\n else\n if backends.nil? or !backends.is_a?(Array) or backends.size == 0\n if @targetgroups.nil?\n cloud_desc\n return if @targetgroups.nil?\n end\n backends = @targetgroups.keys\n end\n backends.each { |tg|\n MU.log \"Registering #{id} to Target Group #{tg}\"\n MU::Cloud::AWS.elb2(region: @region, credentials: @credentials).register_targets(\n target_group_arn: @targetgroups[tg].target_group_arn,\n targets: [\n {id: id}\n ]\n )\n }\n end\n end",
"def register_handler\n @register_handler ||= Justdi::RegisterHandler\n end",
"def on_add(xmlpath, id)\n\n yield(xmlpath, id) if block_given?\n\n end",
"def id=(id)\n super(id)\n end",
"def register(view_hash)\n self.class.register view_hash\n end",
"def register_online_id(id)\n r = execute('setOnlineID', id: id)\n ret = r == 'success'\n log_error(r) unless ret\n return ret\n end",
"def register(name, &plugin_block)\n define_method(name) do |*args, **kwargs, &block|\n t1 = Time.now\n\n data = plugin_block.call(*args, **kwargs, &block)\n\n # If the plugin is just setting the store key\n return nil if data.nil? || !data.key?(:ok)\n\n data[:name] = name\n data[:duration_seconds] = Time.now - t1\n\n Utils.task_and_line(data)\n Utils.node_or_container_label(data)\n data[:task_number] = Store.inc(:count)\n Utils.response(data)\n end\n end",
"def initialize(id)\n self.id = id\n end",
"def register(clazz)\n @listers << clazz.instance\n self\n end"
] |
[
"0.79022527",
"0.7580181",
"0.6201312",
"0.6178429",
"0.60646737",
"0.5949389",
"0.5910501",
"0.5895015",
"0.58876175",
"0.58158946",
"0.579344",
"0.5780836",
"0.57418346",
"0.56677276",
"0.5660178",
"0.5608928",
"0.5604907",
"0.55784726",
"0.55784726",
"0.55784726",
"0.55784726",
"0.55444777",
"0.5536888",
"0.55184823",
"0.55124426",
"0.5495612",
"0.54895246",
"0.548375",
"0.5466056",
"0.54456294",
"0.5399806",
"0.5399582",
"0.53603566",
"0.5352946",
"0.5352301",
"0.5352301",
"0.5352301",
"0.533718",
"0.5329587",
"0.527187",
"0.52711916",
"0.5253996",
"0.5250659",
"0.52449423",
"0.5242791",
"0.52052695",
"0.51877224",
"0.5180577",
"0.517747",
"0.5162873",
"0.51620317",
"0.51616764",
"0.51571417",
"0.5132901",
"0.5107787",
"0.50681955",
"0.50570506",
"0.5054425",
"0.5050359",
"0.5047721",
"0.50432473",
"0.50383174",
"0.5038046",
"0.5031943",
"0.50294876",
"0.5027807",
"0.50195074",
"0.5010157",
"0.49964756",
"0.49916697",
"0.49809563",
"0.4972022",
"0.49713176",
"0.49609867",
"0.4951069",
"0.49391648",
"0.49345604",
"0.4924097",
"0.48998916",
"0.48765844",
"0.4869058",
"0.48543742",
"0.4851232",
"0.4851232",
"0.4851232",
"0.48478025",
"0.4839074",
"0.48340404",
"0.48221153",
"0.4820959",
"0.4819038",
"0.48126376",
"0.48087803",
"0.48084635",
"0.47971705",
"0.47943664",
"0.47931278",
"0.4792743",
"0.47915888",
"0.4785302"
] |
0.8400942
|
0
|
Returns the title of the plugin, or sets it to the optional argument +title+.
|
def title title = nil
if title
@title = title.to_s
else
@title ||= name[/([^:]+)$/, 1]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def title(*arguments, &block)\n @plugin_title = arguments.first if arguments.length > 0\n @plugin_title\n end",
"def title(title = nil)\n @title = title if title\n @title\n end",
"def title(*args)\n @title = args[0] if args.present?\n @title\n end",
"def title(value = nil)\n value ? options[:title] = value : options[:title]\n end",
"def title(title=nil)\n title.nil? ? @title : @title = title\n end",
"def title(value = nil, options = nil)\n end",
"def title\n options.fetch(:title)\n end",
"def title\n return @options[:title]\n end",
"def title(title)\n @title = title\n end",
"def title(t=nil)\n return @title unless t\n @title = t\n end",
"def title=(title)\n title = nil unless title.present?\n settings.title = title\n end",
"def title=(title)\n title = nil if title.blank?\n @settings.title = title\n end",
"def title\n\t\tbase_title = title_extend\n\t\tif @title.nil?\n\t\t\tbase_title\n\t\telse\n\t\t\t\"#{base_title} | #{@title}\"\n\t\tend\n\tend",
"def title(val)\n args_def.title = val\n end",
"def title=(t)\n @options[:title] = t\n end",
"def default_title=(string)\n @title ||= string\n end",
"def page_title(title=nil)\n # DEPRECATED: setting title\n if title\n page_title!(title)\n else\n @_page_title\n end\n end",
"def title(title)\n @title=title\n end",
"def title\n if @title.nil?\n BASE_TITLE\n else\n \"#{BASE_TITLE} | #{@title}\"\n end\n end",
"def set_title(title)\n @title = title\n end",
"def title(title=\"\")\n self.tag('title', title)\n end",
"def title(title)\n filename(title)\n @methods[:title] = title\n end",
"def title=(value)\n\t\t\t@title = value\n\t\tend",
"def title\n base_title = \"Team DIET Tracker\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n _title = self[\"title\"]\n _title ? _title[\"$t\"] : nil\n end",
"def title_is(title = nil)\n title_is_empty if title.nil? || title.empty?\n @title = title\n end",
"def title\n ::I18n.translate(['refinery', 'plugins', name, 'title'].join('.'))\n end",
"def title\n base_title = \"Golo\"\n if@title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title=(new_title = nil)\n @info[:Title] = new_title\n end",
"def title\n base_title = \"Operation Paws for Homes\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def title=(value)\n @title = value\n end",
"def get_title\n base_title = get_name_or_logo\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def title\n base_title = \"Railstwitterclone\"\n if @title.nil?\n base_title\n else\n \"#{base_title} - #{@title}\"\n end\n end",
"def title\n base_title = \"Cliqs\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n return nil\n end",
"def manageable_page_title(title = nil)\n @title = title unless title.nil?\n @title || \"Untitled Page\"\n end",
"def title\n base_title = \"StkUp - Simple, Purposeful Comparisons\"\n @title.nil? ? base_title : \"#{base_title} | #{@title}\"\n end",
"def set_title_locally(title)\n @title = title\n end",
"def title\n super.first || \"\"\n end",
"def title\n super.first || \"\"\n end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def title=(_arg0); end",
"def title\n base_title = \"Digital Library Management Tool\"\n if @title.nil?\n base_title\n else\n \"#{base_title}|#{@title}\"\n end\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title\n connection.write(\"get_title\", false)\n end",
"def title=(value)\n if value\n @title = value if value.is_a? String\n end\n end",
"def html_title\n @html_title || title\n end",
"def title\n base_title = \"Soccer_League Manager\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title?; end",
"def setTitle(title)\r\n\t\t\t\t\t@title = title\r\n\t\t\t\tend",
"def title=(string)\n @title ||= string\n end",
"def title\n self.class.title(nil, params)\n end",
"def title\n return options.title if options.title\n case type\n when :history\n \"RELEASE HISTORY\"\n else\n \"CHANGELOG\"\n end\n end",
"def title\n @doc.title || DEFAULT_TITLE\n end",
"def title\n super.first || ''\n end",
"def title\n super.first || ''\n end",
"def title\n super.first || ''\n end",
"def title\n base_title = \"LoveALLogy\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def get_title\n\t\t@fields_hash[FIELDS_MAP[:title]] || \"\"\n\tend",
"def title_help \n\n\t\t#Define general page title\n\t\tbase_title = \"Rex Ruby on Rails Learning | PagesHelper\"\n\t\tif(@title.nil?)\n\t\t\tbase_title\n\t\telse\n\t\t\tbase_title = \"Rex Ruby on Rails Learning | #{@title} | PagesHelper\"\n\t\tend\n\tend",
"def title\n base_title = 'Statustar'\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n base_title = \"H&H\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def page_meta_title(value = nil, default: true, **opt)\n @page_meta_title = nil if opt.present?\n @page_meta_title = page_value(value, **opt) if value\n @page_meta_title ||= page_value(:label, **opt, default: default)\n end",
"def title\n base_title = \"An Andy Sharkey Production\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n base_title = \"This app is a Toast Machine\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n base_title = app_name \n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def setTitle (title)\n @title = title.to_s\n end",
"def title\n # Sets the browser title bar display\n base_title = \"Grademypitch\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title(title = nil)\n raise TypeError, \"expecting a String or an Array\" unless [String,Array].include?(title.class) || title.nil?\n separator = \" ~ \"\n @page_title = title if title\n if @page_title\n title = @page_title.to_a.flatten\n [@page_title, site_name].flatten.reverse.join(separator)\n else\n site_name\n end\n end",
"def title\n options[:title] || raise(MissingAttribute)\n end",
"def title\n (meta.title if tilt?) || path\n end",
"def title= title\n @title = title\n end",
"def title(title, global=true)\n global ? (before << \"Backend.app.setTitle(#{title.to_json});\") : config[:title] = title\n end",
"def title\n base_title = \"Read-O-Meter: Track your reading\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title\n base_title = \"Let Me Sing Now, llc\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def page_title(value = nil, default: true, **opt)\n @page_title = nil if opt.present?\n @page_title = page_value(value, **opt) if value\n @page_title ||= page_value(:title, **opt, default: default)\n end",
"def title\n base_title = \"S.Hukin ltd - Sheffield, UK. Speciality wholesale foods.\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def page_title!(title)\n @_page_title = title\n end",
"def title\n base_title = \"Bibliocloud\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title(*args, &block)\n element.title(*args, &block)\n end",
"def title\n base_title = \"Reseau Social ESMT\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title(title = T.unsafe(nil)); end",
"def title\n base_title = \"Temple Baptist Church, White House, TN\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title_raw\n conf['title'] || proj.title\n end",
"def page_title title= nil\n\t\tif title\n\t\t\tcontent_for(:page_title) { \"#{title} - 2da.re\" }\n\t\t\treturn title\n\t\telse\n\t\t\tcontent_for?(:page_title) ? content_for(:page_title) : \"Ready 2da.re?\"\n\t\tend\n\tend",
"def title\n @title ||= self.class.non_namespaced_classname\n end",
"def title_or_default(page_title = '') # turn nil into empty\n if page_title.empty?\n title = DEFAULT_TITLE\n else\n title = page_title\n end\n \n return \"#{title} | #{TITLE_SUFFIX}\"\n end",
"def full_title(page_title = '', options = {})\n if options == 'admin'\n base_title = \"GeniusPass (Admin)\"\n else\n base_title = \"GeniusPass\"\n end\n\n if page_title.empty?\n base_title\n else\n \"#{page_title} | #{base_title}\"\n end\n end",
"def title=(value)\n super(value)\n self.set_prefix\n return self.title\n end",
"def title\n @title ||= self.content.split(@@title_separator).first unless self.content.nil?\n end",
"def title\n base_title = \"Bejben\"\n if @title.nil?\n base_title\n else\n \"#{base_title} | #{@title}\"\n end\n end",
"def title=(title)\n if title.nil?\n fail ArgumentError, 'invalid value for \"title\", title cannot be nil.'\n end\n @title = title\n end"
] |
[
"0.827292",
"0.77353597",
"0.74677324",
"0.746107",
"0.7440639",
"0.7274582",
"0.7173406",
"0.71016496",
"0.7076894",
"0.7061905",
"0.7049378",
"0.6987112",
"0.6980184",
"0.69477916",
"0.6937665",
"0.69361824",
"0.69222254",
"0.6899044",
"0.6823574",
"0.6799184",
"0.67820907",
"0.67736316",
"0.67551917",
"0.67453194",
"0.67419535",
"0.6727586",
"0.6717433",
"0.6710387",
"0.6710295",
"0.6700503",
"0.66982216",
"0.66982216",
"0.66982216",
"0.66982216",
"0.66982216",
"0.66982216",
"0.66982216",
"0.6695982",
"0.6687824",
"0.66673154",
"0.6646162",
"0.66436756",
"0.66419256",
"0.66348404",
"0.66293174",
"0.66293174",
"0.6628636",
"0.6628636",
"0.6628636",
"0.66124606",
"0.6606442",
"0.6606442",
"0.6606442",
"0.66037726",
"0.6597378",
"0.6595606",
"0.658501",
"0.6577445",
"0.6572503",
"0.6571568",
"0.65715134",
"0.65707284",
"0.6570423",
"0.6570423",
"0.6570423",
"0.6562137",
"0.6560818",
"0.65586334",
"0.6548882",
"0.654865",
"0.65378237",
"0.6536228",
"0.65304714",
"0.6529526",
"0.65289646",
"0.6525691",
"0.65236366",
"0.65188646",
"0.6517176",
"0.65153",
"0.65149",
"0.65065897",
"0.6506442",
"0.65019894",
"0.6492785",
"0.649219",
"0.64885384",
"0.64841884",
"0.64736056",
"0.6472185",
"0.64577395",
"0.6455956",
"0.6435798",
"0.64332193",
"0.64327353",
"0.64287484",
"0.6426857",
"0.6425518",
"0.6421698",
"0.6418704"
] |
0.74146956
|
5
|
The PluginHost for this Plugin class.
|
def plugin_host host = nil
if host.is_a? PluginHost
const_set :PLUGIN_HOST, host
end
self::PLUGIN_HOST
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def host\n return @host if defined?(@host)\n\n # Attempt to figure out the host class. Note that the order\n # matters here, so please don't touch. Specifically: The symbol\n # check is done after the detect check because the symbol check\n # will return nil, and we don't want to trigger a detect load.\n host_klass = config.global.vagrant.host\n if host_klass.nil? || host_klass == :detect\n hosts = {}\n Vagrant.plugin(\"1\").registered.each do |plugin|\n hosts = hosts.merge(plugin.host.to_hash)\n end\n\n # Get the flattened list of available hosts\n host_klass = Hosts.detect(hosts)\n end\n\n # If no host class is detected, we use the base class.\n host_klass ||= Vagrant.plugin(\"1\", :host)\n\n @host ||= host_klass.new(@ui)\n end",
"def plugin_host(host = T.unsafe(nil)); end",
"def host\n self.host\n end",
"def plugin_manager\n server.plugin_manager\n end",
"def host\n @host\n end",
"def plugin\n JenkinsApi::Client::PluginManager.new(self)\n end",
"def host\n @context.registers[:host]\n end",
"def plugin\n server.plugin(plugin_id)\n end",
"def host\n return @host\n end",
"def host\n return @host\n end",
"def host\r\n return for_context(nil, false) { |c| c.host }\r\n end",
"def plugin_manager; end",
"def initialize\n\t\t\tplugins.init(self)\n\t\tend",
"def host\n active_backend.host\n end",
"def manager\n @plugin.manager\n end",
"def host\n @host\n end",
"def host\n @host\n end",
"def host\n @host ||= Babushka::SystemProfile.for_host\n end",
"def plugins\n @plugins ||= Plugins.new\n end",
"def get_host\n @host\n end",
"def host(h = nil)\n if h\n @host = h\n else\n @host\n end\n end",
"def host\n @host = self.hostuser\n end",
"def register_plugin\n @plugins ||= []\n plugin = Homeland::Plugin.new\n yield plugin\n @plugins << plugin\n @sorted_plugins = nil\n plugin.version ||= \"0.0.0\"\n plugin.source_path = File.dirname(caller(1..1).first)\n plugin\n end",
"def host\n @host ||= Chimps.config[:catalog][:host]\n end",
"def host\n @manager.primary_pool.host\n end",
"def get_plugin_manager\n PluginManager.instance\nend",
"def Host(rh)\n if rh.is_a?(SSHKit::Host)\n rh\n else\n SSHKit::Host.new(rh)\n end\n end",
"def new\n @host = Host.new\n end",
"def host\n @options[:host]\n end",
"def each_host\n @hosts.each do |host|\n yield host: host\n end\n\n self\n end",
"def plugins\n @plugin_list\n end",
"def host\n @connection.host\n end",
"def plugins\n @plugins\n end",
"def host\n nodes[0][0]\n end",
"def plugins\n @plugins ||= Plugins.new\n end",
"def host\n @host ||= @node.inner_text\n end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def plugins ; @plugins ; end",
"def host\n @host || Sapience.config.host\n end",
"def plugin_path\n ::LittlePlugger.default_plugin_path(self)\n end",
"def initialize(host)\n @host = host\n end",
"def initialize(host)\n @host = host\n end",
"def host=(h)\n @host = h\n end",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def plugins; end",
"def plugins\n @plugins ||= ROM.plugins[component_config.type].adapter(component_config.adapter)\n end",
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'The Core plugin provides a lot of the basic functionality required by WebDAV, such as a default implementation for all HTTP and WebDAV methods.',\n 'link' => nil\n }\n end",
"def register_plugin\n @plugins ||= []\n plugin = Homeland::Plugin.new\n yield plugin\n @plugins << plugin\n @sorted_plugins = nil\n plugin\n end",
"def hosts\n if @hosts\n @hosts\n elsif @host\n [@host]\n else\n self.class.hosts\n end\n end",
"def instance plugin\n if @scope\n @plugin_instances[@scope + '::' + plugin]\n else\n @plugin_instances[plugin]\n end\n end",
"def hosts; end",
"def hosts; end",
"def hosts; end",
"def plugins\n @plugins ||= {\n import: {},\n export: {}\n }\n end",
"def getHostConfig(host=nil)\n host=@hostname if host.nil?\n hc=self[host.to_sym]\n raise \"HostConfig not found for #{host}\" if hc.nil?\n HostConfig.new(:hc=>hc, :logger=>@log)\n end",
"def host\n '127.0.0.1'\n end",
"def plugin_module\n ::LittlePlugger.default_plugin_module(plugin_path)\n end",
"def hosts\n @hosts ||= []\n end",
"def host\n return @host if @host\n @host = if host_group_mob.nil? || host_group_rule_type == CLUSTER_VM_HOST_RULE_SHOULD\n mob.host\n else\n host_group_mob.host\n end\n end",
"def host=(value)\n @host = value\n end",
"def host=(value)\n @host = value\n end",
"def host\n @host ||= 'http://open.denglu.cc'\n end",
"def host; config[:host]; end",
"def plugins\n @plugins ||= []\n end",
"def host\n URI(self.uri).host\n end",
"def initialize\n super\n self.plugins = []\n if configuration['plugin']\n configuration['plugin'].each do |config|\n plugin_class = config['class'].split('::').inject(Object) {|mod, string| mod.const_get(string)}\n self.plugins << plugin_class.new(self, config['parameters'])\n end\n end\n self.store = self.class.store\n end",
"def host\n domain\n end",
"def hosts\n\t\tHost.find(:all)\n\tend",
"def list_of_hosts\n super\n end",
"def hosts\n @hosts ||= begin\n r, h, u = [], (config[:hosts] rescue nil), (config[:user] rescue nil)\n h.each {|host| r << Host.new(host, u) } if h && u; r\n end\n end",
"def host_group\n config.host_group_name\n end",
"def hosts\n @hosts ||= Array(Hansolo.target).map { |target| URI.parse(target) }\n end",
"def host\n attributes['host']\n end",
"def host\n HOSTS[locale]\n end",
"def get_plugins()\n return plugins\nend",
"def host\n 'localhost'\n end",
"def plugin_hash; end",
"def host(host)\n @api.host = host\n end",
"def plugins_path; end",
"def host\n @host ||= opts.fetch(:host, parsed_uri.host)\n end",
"def register!\n # Register the plugin.\n @manager.register_plugin! self\n end",
"def host_with_port\n @context.registers[:host_with_port]\n end",
"def host\n @host || SemanticLogger.host\n end",
"def plugin(name)\n @plugins[name]\n end",
"def host\n @host ||= target.split(':',2).first\n end",
"def to_host\n self\n end",
"def hosts\n @hosts.values\n end",
"def plugin_setup!; end",
"def plugin_name\n 'browser'\n end",
"def config\n @bot.config.plugins.options[self.class] || {}\n end"
] |
[
"0.7118239",
"0.6551484",
"0.6373922",
"0.6296605",
"0.6230977",
"0.6203719",
"0.6161976",
"0.60743886",
"0.6065132",
"0.6065132",
"0.60633695",
"0.6018984",
"0.6001991",
"0.58915067",
"0.58776146",
"0.58461607",
"0.58461607",
"0.5799273",
"0.5792682",
"0.57743007",
"0.57411164",
"0.56921345",
"0.56697047",
"0.56477356",
"0.56442845",
"0.5638834",
"0.5619062",
"0.56132907",
"0.56036454",
"0.56002057",
"0.5583038",
"0.5548196",
"0.55452704",
"0.55363613",
"0.553528",
"0.5515585",
"0.5480659",
"0.5480659",
"0.5480659",
"0.5480659",
"0.5480659",
"0.5480659",
"0.5480659",
"0.5480659",
"0.5480659",
"0.5465902",
"0.5460189",
"0.5458251",
"0.545477",
"0.5416628",
"0.54138345",
"0.5406133",
"0.5406133",
"0.5406133",
"0.5406133",
"0.5391623",
"0.53712606",
"0.5368191",
"0.5356566",
"0.53254366",
"0.53171444",
"0.53171444",
"0.53171444",
"0.53005844",
"0.5299738",
"0.5295682",
"0.5295075",
"0.52853304",
"0.52788574",
"0.52646226",
"0.52646226",
"0.5263083",
"0.5235696",
"0.5228922",
"0.5228864",
"0.52176535",
"0.5203844",
"0.5201719",
"0.51968735",
"0.5192224",
"0.518595",
"0.51836467",
"0.5181306",
"0.51786435",
"0.5165531",
"0.5164626",
"0.51542",
"0.5153498",
"0.5141079",
"0.5140846",
"0.513989",
"0.51343423",
"0.51242334",
"0.51017684",
"0.50945854",
"0.5081476",
"0.50782835",
"0.50719583",
"0.5070869",
"0.5069173"
] |
0.7474413
|
0
|
GET /stories/1 GET /stories/1.json
|
def show
@story = Story.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n story = Story.find(params[:id])\n render json: story\n end",
"def index\n @stories = Story.all\n render json: @stories, root: false\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"def index\n @stories = Story.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def show\n @stories = Story.find_by(id: params[:id])\n \n end",
"def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end",
"def story(id, query = {})\n Request.new(self, '/cdn/stories', query, id).get\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def get_stories\n api_url = \"#{CONFIG[:api_location]}/projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| Story.new(:story => story, :project_id => @id, :token => @token)}\n end",
"def index\n # description of @stories is not necessary - it is handled by decent_exposure\n end",
"def index\n render json: Story.all\n end",
"def show\n @yourstory = Yourstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @yourstory }\n end\n end",
"def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\t\t@title = \"Newsy | \" + @story.title\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"def fresh_stories\n get_data(\"stories/fresh\")\n end",
"def show\n render json: @story, root: false\n end",
"def show\n @sprintstory = Sprintstory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprintstory }\n end\n end",
"def index\n @stories = Story.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end",
"def show\n render status: 200, json: UserTrainingStory.find(params[:id])\n end",
"def get_stories\n api_url = \"#{CONFIG[:api_url]}projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| TrackR::Story.new(:story => story, :project_id => @id, :token => @token)}\n end",
"def task_stories(id, options = {})\n request(:get, \"tasks/#{id}/stories\", options)\n end",
"def show\n # params[#id] is form the URL, e.g if /stories/7\n # then params[:id] is 7\n @story = Story.find(params[:id])\n end",
"def show\n redirect_to sections_story_path(params[:id])\n # @story = Story.find_by_id(params[:id])\n\n # respond_to do |format|\n # format.html #show.html.erb\n # format.json { render json: @story }\n # end\n end",
"def stories\n @stories ||= Stories.new(data)\n end",
"def show\n @story_status = StoryStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story_status }\n end\n end",
"def stories ; @stories || get_stories ; end",
"def stories ; @stories || get_stories ; end",
"def show\n\n\t# params[:id] is the number in the url we are looking for\n\n\t\t# @story = Story.find(params[:id])\n\n\tend",
"def stories(query = {})\n Request.new(self, '/cdn/stories', query).get\n end",
"def stories(query = {})\n Request.new(self, '/cdn/stories', query).get\n end",
"def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end",
"def show\n @story = Story.all(:include => :role, :conditions => {:stories => { :id => params[:id] } })\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n end\n end",
"def show\n\t\t# params[:id] is the number in the url that we are looking for\n\t\t# @story = Story.find(params[:id])\n\t\t\n\tend",
"def show\n\t\t#params[:id] is the number in the url we are looking for\n\t\t#@story = Story.find(params[:id])\n\tend",
"def show\n @story = Story.find(params[:id])\n\n # Set meta information\n @page_title = @story.title\n @page_description = @story.subtitle\n\n if Arrowhead.is_arrowhead_story? @story\n @arrowhead_stories = Arrowhead.stories\n @i = @arrowhead_stories.find_index(@story)\n if @i\n @prev = @i > 0 ? @i - 1 : nil \n @next = @i < @arrowhead_stories.length - 1 ? @i + 1 : nil\n end\n set_meta_tags :og => {\n :title => @story.title,\n :description => @story.subtitle,\n :type => 'article',\n :url => url_for(@story),\n :image => URI.join(root_url, view_context.image_path('arrowhead_ogimage.jpg'))\n }\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story.to_json(:include => { :scenes => { :include => :paragraphs }}) }\n end\n end",
"def show\n @text_story = TextStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text_story }\n end\n end",
"def index\n @pic_stories = PicStory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pic_stories }\n end\n end",
"def index\n #@usemap = true\n\n @stories = Story.editable_user(current_user.id) \n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @stories }\n end\n end",
"def index\n @stories = Story(:all, :order => 'value')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end",
"def story(story_id)\n Endpoints::Story.new(self).get_story(story_id)\n end",
"def get_mashable_stories\n\n\ts = JSON.load(RestClient.get('http://mashable.com/stories.json')) \n\ts[\"hot\"].map do |story|\n\ts = {story: story[\"title\"], category: story[\"channel\"]}\n\tget_upvotes(story)\n\tdisplay_new_story\n\tstory\n\tend\nend",
"def show\n @story = Story.find(params[:id])\n @epics = Epic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story }\n end\n end",
"def show\n @storyboard = Storyboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storyboard }\n end\n end",
"def retrieve\n sort = 'created_at DESC'\n\n case params[:sort]\n when 'recent'\n sort = 'created_at DESC'\n when 'popular'\n sort = 'views DESC, likes DESC'\n else\n\n end\n\n stories = Story.where(\"LOWER(name) LIKE ?\", '%' + params[:query].downcase + '%').order(sort).offset(params[:offset]).limit(params[:limit])\n\n render json: stories\n end",
"def show\n @pic_story = PicStory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic_story }\n end\n end",
"def index\n @stories = Story.all\n authorize! :index, @story\n end",
"def index\n @user_stories = UserStory.all\n end",
"def show\n @story = Story.find(params[:id]) # place dans l'objet @story accessible par la vue les infos de la story[id]\n end",
"def find_story\n @story = Story.find(params[:id])\n end",
"def show\n\t\t# @story = Story.find( params[:id] )\n\n\tend",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def show\n @story = Story.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @story }\n end\n end",
"def show\n @story_choice = StoryChoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story_choice }\n end\n end",
"def stories(options = {})\n stories = if options[:id]\n [@project.stories(options[:id]).get.payload]\n else\n @project.stories.get(params: options)\n end\n stories = stories.map { |s| Story.new(s, @project) }\n stories.select(&:estimated)\n end",
"def index\n @project_stories = ProjectStory.all\n end",
"def stories() @stories = Stories.new end",
"def project_story(project_id, story_id, options={})\n response_body = nil\n begin\n response = connection.get do |req|\n req.url \"/api/v1/projects/#{project_id}/story/#{story_id}\", options\n end\n response_body = response.body\n rescue MultiJson::DecodeError => e\n #p 'Unable to parse JSON.'\n end\n \n response_body\n end",
"def index\n page = 1\n page = params[:page] if params[:page]\n @stories = Story.paginate :page => page, :order => 'created_at DESC', :per_page => 5\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @stories }\n end\n end",
"def list_stories(opts = {})\n data, _status_code, _headers = list_stories_with_http_info(opts)\n data\n end",
"def index\n @stories = Story.where(user_id: current_user.id)\n end",
"def show\n @story = Story.find(params[:id])\n @stat = Status.where(:id => @story.status_id).first.descripcion\n @criterios = Criterio.where(:story_id => @story.id)\n @tasks = Task.where(:story_id => @story.id)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @story }\n format.json { render json: @criterios }\n format.json { render json: @tasks }\n end\n end",
"def find_story\n @story = Story.find(params[:id])\n end",
"def find_story\n\n\t\t@story = Story.find(params[:id])\n\n\n\n\n\tend",
"def find_story\n\t\t@story = Story.find(params[:id])\n\tend",
"def retrieve_story(uid)\n response = get(\"/api/v1/stories/#{uid}\")\n Trubl::Story.new.from_response(response)\n end",
"def find_story\n\n\t\t\t@story = Story.find(params[:id])\n\n\tend",
"def show\n @sprint = Sprint.find(params[:id])\n @stat = Status.find(4)\n @stories = Story.where(\"status_id = ?\", @stat.id)\n @examples = @sprint.stories \n @project_id = @examples.first.project_id\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sprint }\n end\n end",
"def stories(project, api_key, filter='')\n\treq = Net::HTTP::Get.new(\n \"/services/v3/projects/#{project}/stories?filter=#{filter}\",\n {'X-TrackerToken'=>api_key}\n )\n res = Net::HTTP.start(@pt_uri.host, @pt_uri.port) {|http|\n http.request(req)\n }\n\n return res.body\nend",
"def find_story\n\t\t@story = Story.find(params[:id])\n\t\t\n\tend",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def index\n @stories = Story.order(params[:sort]).page(params[:page]).per(10)\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def history\n @story = Story.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def index\n @stories = Story.all.page(params[:page]).per(30)\n\n respond_to do |format|\n format.html\n format.js\n end\n end",
"def show\n user = User.find(params[:id])\n # render json: {\n # # user.to_json(include: :stories, except: :password_digest)\n # user: user,\n # stories: user.stories,\n # success: true\n # }\n render json: user.to_json(include: :stories, except: :password_digest)\n end",
"def green_stories\n get_data(\"stories/green\")\n end",
"def index\n @stories = Story.scoped\n\n @stories = @stories.where(:user_id => params[:user]) if params[:user].present? \n @stories = @stories.where(:state => params[:state]) if params[:state].present? \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories.all }\n end\n end",
"def show\n @storylink = Storylink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @storylink }\n end\n end",
"def show \n PivotalTracker::Client.token = current_user.setting.pt_api_key\n @project = PivotalTracker::Project.find(params[:id].to_i)\n @stories = @project.stories.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n end\n end",
"def stories\n @stories.keys.each_with_index.map { |story_name, i| get_story(story_name, i) }\n end",
"def show\n @story_comment = StoryComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @story_comment }\n end\n end",
"def index\n @story_pages = StoryPage.all\n end",
"def index\n @news_stories = NewsStory.all\n end",
"def create\n story_params = {\n title: params[:title],\n summary: params[:summary],\n }\n @story = Story.new(story_params)\n\n if @story.save\n # render :show, status: :created, location: @story\n render json: @story\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.77517796",
"0.7708573",
"0.7525053",
"0.7514882",
"0.7487153",
"0.7486738",
"0.7486738",
"0.746419",
"0.7455591",
"0.7455591",
"0.736725",
"0.736725",
"0.736725",
"0.736725",
"0.736725",
"0.736725",
"0.7365923",
"0.7325072",
"0.73073804",
"0.7269669",
"0.7202681",
"0.71863514",
"0.71552104",
"0.71204364",
"0.70868814",
"0.7076273",
"0.7075205",
"0.70648074",
"0.70577556",
"0.7016694",
"0.6979465",
"0.69683355",
"0.6963905",
"0.6958875",
"0.6955792",
"0.6955792",
"0.6948531",
"0.6944335",
"0.6944335",
"0.6937768",
"0.69246197",
"0.6873154",
"0.6866486",
"0.6837309",
"0.6836953",
"0.68213576",
"0.6771517",
"0.67672443",
"0.6763285",
"0.6747532",
"0.6744951",
"0.67191637",
"0.6717403",
"0.6710239",
"0.6703801",
"0.6701244",
"0.67001843",
"0.66776955",
"0.6664024",
"0.6644793",
"0.6644793",
"0.6644793",
"0.6632936",
"0.6632478",
"0.66307855",
"0.66167146",
"0.6616528",
"0.66140276",
"0.6605247",
"0.66026956",
"0.65986204",
"0.65951455",
"0.6592759",
"0.6574684",
"0.65610456",
"0.65485275",
"0.65473574",
"0.6542817",
"0.6537407",
"0.6537166",
"0.6537166",
"0.6537166",
"0.6537166",
"0.6530321",
"0.65249157",
"0.65249157",
"0.65249157",
"0.65249157",
"0.6505855",
"0.6499249",
"0.6492882",
"0.6491131",
"0.6489515",
"0.64743114",
"0.64631057",
"0.64617264",
"0.6455745",
"0.6407208",
"0.6406328",
"0.6403091"
] |
0.70238024
|
29
|
POST /stories POST /stories.json
|
def create
@story = Story.new(story_params)
if @story.save
redirect_to new_story_path, notice: 'Спасибо за вашу историю! Скоро мы ее проверим и опубликуем.'
else
render :new
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @story = Story.new(story_params)\n if @story.save\n render json: @story, status: :ok\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end",
"def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to stories_path }\n format.json { render :json => @story }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n story_params = {\n title: params[:title],\n summary: params[:summary],\n }\n @story = Story.new(story_params)\n\n if @story.save\n # render :show, status: :created, location: @story\n render json: @story\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end",
"def create\n # Used to make sure a created story is given to current_user\n @story = current_user.stories.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.json { render json: @story, root: false, status: :created, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = @game.stories.build story_params\n story_creator = StoryCreator.new @story\n\n respond_to do |format|\n if story_creator.save\n format.json do\n render status: :created, location: game_story_url(@story.game, @story)\n end\n format.html do\n redirect_to game_path(@game)\n end\n else\n format.json do\n render status: :unprocessable_entity\n end\n format.html do\n redirect_to game_path(@game)\n end\n end\n end\n end",
"def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, :notice => 'Story was successfully created.' }\n format.json { render :json => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, :notice => 'Story was successfully created.' }\n format.json { render :json => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story }\n else\n format.html { render action: 'new' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story \n successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to admin_story_path(@story), notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @yourstory = Yourstory.new(params[:yourstory])\n\n respond_to do |format|\n if @yourstory.save\n format.html { redirect_to @yourstory, notice: 'Yourstory was successfully created.' }\n format.json { render json: @yourstory, status: :created, location: @yourstory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @yourstory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(story_params)\n @story.user = current_user\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(story_params)\n @book = @story.book\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to story_path(@story), notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new, book_id: @book.id }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(story_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(params[:story])\n\t\t@title = \"Nowy news\"\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Wiadomość utworzono pomyślnie.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to(@story, :notice => 'Story was successfully created.') }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_story(attributes = {})\n api_url = URI.parse(\"#{CONFIG[:api_location]}/projects/#{@id}/stories\")\n query_string = attributes.map { |key, value| \"story[#{key}]=#{CGI::escape(value)}\"}.join('&')\n response = Net::HTTP.start(api_url.host, api_url.port) do |http|\n http.post(api_url.path, query_string.concat(\"&token=#{@token}\"))\n end\n\n story = (Hpricot(response.body)/:story)\n Story.new(:story => story, :project_id => @id, :token => @token)\n end",
"def index\n @stories = Story.all\n render json: @stories, root: false\n end",
"def create_story(attributes = {})\n api_url = URI.parse(\"#{CONFIG[:api_url]}projects/#{@id}/stories\")\n query_string = attributes.map { |key, value| \"story[#{key}]=#{CGI::escape(value)}\"}.join('&')\n begin\n http = Net::HTTP.new(api_url.host, api_url.port)\n http.use_ssl = true\n response, data = http.post(api_url.path, query_string.concat(\"&token=#{@token}\"))\n\n raise ResponseError, \"Wrong response code\" unless response.code.to_i == 200\n story = (Hpricot(response.body)/:story)\n TrackR::Story.new(:story => story, :project_id => @id, :token => @token)\n rescue ResponseError => e\n print \"Got response code [#{response.code}]:\\t\"\n puts response.message\n raise\n end\n end",
"def create\n @story = Story.new(params[:story])\n @story.user = User.first\n @story.state = State.first\n @story.project = Project.first\n\n if @story.save\n if request.xhr?\n render 'new_story'\n else\n redirect_to root_path\n end\n end\n end",
"def create\n @story = Story.create()\n url_string = Base64.encode64 @story.id.to_s\n \n story_id = @story.id\n render :json => story_id\n \n end",
"def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n flash[:notice] = 'Story was successfully created.'\n format.html { redirect_to(@story) }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @sprintstory = Sprintstory.new(params[:sprintstory])\n\n respond_to do |format|\n if @sprintstory.save\n format.html { redirect_to [:alumno, @sprintstory], notice: 'Sprintstory was successfully created.' }\n format.json { render json: @sprintstory, status: :created, location: @sprintstory }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sprintstory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(story_params)\n if @story.valid?\n current_user.stories << @story\n redirect_to @story\n else\n # @errors = @story.errors.messages\n render :new\n end\n end",
"def create\n story_part = StoryPart.create(story_part_params)\n \n\n story_part_id = story_part.id\n render :json => story_part_id\n \n # @story = Story.create() \n # story_id = @story.id\n # render :json => story_id\n\n # respond_to do |format|\n # if @story_part.save\n # format.html { redirect_to @story_part, notice: 'Story part was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @story_part }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @story_part.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n\n @snippet = @story.snippets.create(params[:story][:snippet].permit(:content))\n\n format.html { redirect_to root_path, notice: 'Story was successfully created.' }\n #format.html { redirect_to @story, notice: 'Story was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @story }\n else\n format.html { render action: 'new' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @news_story = NewsStory.new(news_story_params)\n\n respond_to do |format|\n if @news_story.save\n format.html { redirect_to @news_story, notice: 'News story was successfully created.' }\n format.json { render :show, status: :created, location: @news_story }\n else\n format.html { render :new }\n format.json { render json: @news_story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @story.save\n flash[:notice] = 'Story was successfully created.'\n @changed << @story.id\n\n format.html { redirect_to stories_path }\n format.js { render 'shared/index'; flash.discard }\n format.json { render json: @story, status: :created, location: @story }\n else\n @edited << 'new'\n @expanded << 'new'\n\n format.html { render action: 'new', template: 'shared/new' }\n format.js { render 'story'; flash.discard }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to admin_stories_path, notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.page_content', count: 1))}\n else\n set_date\n format.html { render :new }\n end\n end\n end",
"def index\n @stories = Story.order(\"created_at DESC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @stories }\n end\n end",
"def create\n @story_page = StoryPage.new(story_page_params)\n\n respond_to do |format|\n if @story_page.save\n format.html { redirect_to @story_page, notice: 'Story page was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story_page }\n else\n format.html { render action: 'new' }\n format.json { render json: @story_page.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_input_mashable(stories)\n response = JSON.parse(RestClient.get 'http://mashable.com/stories.json')\n response['new'].each do |story|\n story[:title] = story['title']\n story[:category] = story['channel']\n stories << {s_title: story[:title], s_story: story[:category]} \n end \n stories\nend",
"def create\n # story_params[:creator] = current_user.id\n @story = Story.new(story_params)\n @story.developer_id = current_user.id\n\n respond_to do |format|\n @story.developer_id = current_user.id\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pic_story = current_user.pic_stories.new(params[:pic_story])\n\n respond_to do |format|\n if @pic_story.save\n format.html { redirect_to @pic_story, notice: 'Pic story was successfully created.' }\n format.json { render json: @pic_story, status: :created, location: @pic_story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pic_story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @story_status = StoryStatus.new(params[:story_status])\n\n respond_to do |format|\n if @story_status.save\n format.html { redirect_to @story_status, :notice => 'Story status was successfully created.' }\n format.json { render :json => @story_status, :status => :created, :location => @story_status }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @story_status.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @story = Story.new(params[:story])\n @story.user_id = current_user.id\n\n if !params[:draft].nil? \n @story.draft = true\n end\n \n if @story.save && @story.update_contents(params[:story][:content])\n respond_to do |format|\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.js { render :js => \"window.location.href = ('#{story_path(@story)}');\"}\n format.json { render json: @story, status: :created, location: @story }\n end\n else\n @errormsg = @story.errors.to_a.each { |e| e.capitalize }.join(\". \")\n story_errors(@errormsg)\n end\n end",
"def create\n \n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n flash[:notice] = 'Story was successfully created.'\n format.html { redirect_to product_story_url(@product,@story) }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def create\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to [:admin,@story], notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.story', count: 1))}\n else\n format.html { render :new }\n end\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end",
"def create\n @text_story = current_user.text_stories.new(params[:text_story])\n @text_story.save\n\n respond_to do |format|\n if @text_story.save\n format.html { redirect_to profile_index_url, notice: 'Text story was successfully created.' }\n format.json { render json: @text_story, status: :created, location: @text_story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @text_story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n render json: Story.all\n end",
"def create\n @story = Story.new(params[:story])\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to stories_path, notice: @story.is_public? ? t('app.msgs.story_add_moderate_public') : t('app.msgs.story_add_moderate') }\n format.json { render json: @story, status: :created, location: @story }\n else\n @css.push('stories.css')\n @genders = [ [t('gender.F'), 'F'], [t('gender.M'), 'M'] ]\n @types = DiscriminationType.sorted.map{|x| [x.name, x.id]}\n\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def stories\n @stories ||= Stories.new(data)\n end",
"def index\n # description of @stories is not necessary - it is handled by decent_exposure\n end",
"def create\n @project_story = ProjectStory.new(project_story_params)\n\n respond_to do |format|\n if @project_story.save\n format.html { redirect_to @project_story, notice: 'Project story was successfully created.' }\n format.json { render :show, status: :created, location: @project_story }\n else\n format.html { render :new }\n format.json { render json: @project_story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def story_params\n params.require(:story).permit(:title, :content, :status)\n end",
"def create\n # validation the user\n if params[:story][:user_id] && User.find(params[ :story ][ :user_id ]) != current_user\n raise \"This operation could be done\"\n end\n\n @story = Story.new(story_params)\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story }\n else\n format.html { render action: 'new' }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_story(board, params)\n params[\"position\"] = board.stories.empty? ? 1 : board.stories.length + 1\n return new_story(board.id, params).merge({\"id\" => get_uuids.first})\n end",
"def create\n @ticket.save\n\n respond_with(@story, @ticket)\n end",
"def new\n @sprintstory = Sprintstory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sprintstory }\n end\n end",
"def create\n @topic = Topic.find(params[:topic_id])\n @story = @topic.stories.build(params[:story])\n @story.views = 0\n\n if logged_in?\n @story.user_id = current_user.id\n @story.update_popularity\n if @story.save\n if @story.is_link?\n current_user.activity_items.create(\n :story_id => @story.id,\n :topic_id => @topic.id,\n :kind => ActivityItem::CreateLinkType)\n else\n current_user.activity_items.create(\n :story_id => @story.id,\n :topic_id => @topic.id,\n :kind => ActivityItem::CreatePostType)\n end\n\n if params[:redirect]\n redirect_to(params[:redirect])\n else\n flash[:notice] = 'Story was successfully created.'\n redirect_to(@story)\n end\n else\n flash[:alert] = 'Story could not be saved.'\n logger.debug \"[DEBUG] Story couldn't be saved, errors: \" + @story.errors.to_s\n render :action => 'new'\n end\n else\n flash[:alert] = \"You need to login to post stories!\"\n logger.debug \"[DEBUG] User didn't log on before trying to create a story.\"\n render :action => 'new'\n end\n end",
"def create\n @story = Story.new(story_params.merge(user_id: current_user.id))\n\n @story.save\n redirect_to stories_path\n end",
"def create\n\t\t@story = Story.new(story_params)\n\n\t\tif @story.save\n\t\t\tflash[:success] = \"Thanks for sharing\"\n\t\t\tredirect_to story_path(@story)\n\t\telse\n\t\t\tflash[:error] = \"Oops, sorry, something went wrong\"\n\t\t\trender :new\n\t\tend\n\tend",
"def create\n @story = current_user.stories.new(params[:story])\n @story.permalink = create_permalink(@story.title)\n\n @story.permalink += \"-#{Time.now.to_i}\" if Story.find_by_permalink(@story.permalink)\n\n respond_to do |format|\n if @story.save\n flash[:notice] = 'Story was successfully created.'\n format.html { redirect_to :action => :show, :id => @story.permalink }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n else\n @categories = Category.find(:all)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def stories() @stories = Stories.new end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def index\n @stories = Story.all\n end",
"def create\n if current_user\n story = current_user.stories.new(story_params)\n story.save\n redirect_to story_path(story)\n else\n redirect_to login_path\n end\n # @story.user = current_user\n # redirect_to story_path(story)\n end",
"def create\n @story = Story.new(params[:story])\n @story.domain_id = session[:domain].id\n @story.bright_text_application_id = session[:br_application_id]\n @story.user_id = session[:user_id]\n @story.story_authors.build().user_id = session[:user_id]\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n format.json { render json: @story, status: :created, location: @story }\n format.js\n else\n #debugger\n format.json{ render :json=> @story.errors }\n# format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n\n\n end",
"def test_story_create\n # skip\n story = Story.create(name: \"rando story name\")\n response = get \"/storyname\"\n json = JSON.parse(response.body)\n assert_equal story.name, json.last[\"name\"]\n # binding.pry\n end",
"def create\n @story = Story.new(params[:story])\n @story.title[0]=@story.title[0].capitalize\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Nowa baśń została dodana.' }\n format.json { render json: @story, status: :created, location: @story }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @new_story = @game.stories.build\n end",
"def index\n @sprintstories = Sprintstory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sprintstories }\n end\n end",
"def create\n @storyboard = Storyboard.new(params[:storyboard])\n\n respond_to do |format|\n if @storyboard.save\n format.html { redirect_to @storyboard, notice: 'Storyboard was successfully created.' }\n format.json { render json: @storyboard, status: :created, location: @storyboard }\n else\n format.html { render action: \"new\" }\n format.json { render json: @storyboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # make story be a blank story but with fields filled in\n @story = Story.new(story_params)\n\n # save this story to the database IF validations pass\n if @story.save\n # let's add a notification to the user to let them know\n # it's been saved to the db\n flash[:success] = \"Yay, you've submitted a story\"\n # make this go back to the homepage\n redirect_to root_path\n else\n render 'new'\n end\n end",
"def create\n @story_comment = StoryComment.new(params[:story_comment])\n @story_comment.user_id = self.current_user.id\n @story = Story.find(params[:story_comment][:story_id])\n @story_comment.story_id = @story.id\n respond_to do |format|\n if @story_comment.save\n format.html { redirect_to @story, :notice => 'Story comment was successfully created.' }\n format.json { render :json => @story_comment, :status => :created, :location => @story_comment }\n else\n format.html { render @story , :notice => 'error' }\n format.json { render :json => @story_comment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @story_choice = StoryChoice.new(params[:story_choice])\n\n respond_to do |format|\n if @story_choice.save\n format.html { redirect_to @story_choice, notice: 'Story choice was successfully created.' }\n format.json { render json: @story_choice, status: :created, location: @story_choice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @story_choice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @yourstory = Yourstory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @yourstory }\n end\n end",
"def save\n @@stories << self \n end",
"def story_params\n params.require(:story).permit(:title, :summary)\n end",
"def create\n @trip_story = TripStory.new(params[:trip_story])\n\n respond_to do |format|\n if @trip_story.save\n flash[:notice] = 'TripStory was successfully created.'\n format.html { redirect_to(@trip_story) }\n format.xml { render :xml => @trip_story, :status => :created, :location => @trip_story }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @trip_story.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def story_params\r\n params.require(:story).permit(:date, :story_type, :description, :person_id)\r\n end",
"def create\n @story = Story.new(story_params)\n @story.project_id = params[:project_id] if current_user.projects.where(id: params[:project_id])\n @story.state = \"to do\"\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story.project, notice: 'Story was successfully created.' }\n format.json { render :show, status: :created, location: @story }\n else\n format.html { render :new }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @story = Story.new\n @roles = Role.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def create\n @social = Story.create(social_params)\n\n redirect_to social_path(@social)\n end",
"def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end",
"def story_params\n params.require(:story).permit(:headline, :body, :image)\n end",
"def show\n render json: @story, root: false\n end",
"def create\n\t#create story set\n story_set = StorySet.new(name: \"storyset#{StorySet.count + 1}\")\n story_set.domain_id = session[:domain].id\n story_set.bright_text_application_id = session[:br_application_id]\n story_set.user_id = current_user.id\n #create story\n @story = Story.new(user_id: current_user.id, story_set: story_set, name: params[:story][:name], category: params[:story][:category], description: \"\", descriptor: \"\")\n @story.name = \"Apology#{Story.where(:user_id => current_user.id).count + 1}\" if @story.name.blank?\n @story.domain_id = session[:domain].id\n @story.bright_text_application_id = session[:br_application_id]\n @story.user_id = session[:user_id]\n @story.story_authors.build().user_id = session[:user_id]\n #set category details\n @story.story_set.story_set_category.domain_id = session[:domain].id\n @story.story_set.story_set_category.application_id = session[:br_application_id]\n @story.story_set.story_set_category.user_id = current_user.id\n @story.rank = 0\n\n respond_to do |format|\n if @story.save\n format.html { redirect_to @story, notice: 'Story was successfully created.' }\n format.xml { render :xml => @story, :status => :created, :location => @story }\n format.json { render json: @story, status: :created}\n format.js\n else\n #debugger\n format.json{ render :json=> @story.errors }\n# format.html { render :action => \"new\" }\n format.xml { render :xml => @story.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @audio_story = AudioStory.new(audio_story_params)\n\n respond_to do |format|\n if @audio_story.save\n format.html { redirect_to @audio_story, notice: 'Audio story was successfully created.' }\n format.json { render :show, status: :created, location: @audio_story }\n else\n format.html { render :new }\n format.json { render json: @audio_story.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @story = Story.new\n\t\t@title = \"Nowy news\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end",
"def get_stories\n api_url = \"#{CONFIG[:api_location]}/projects/#{@id}/stories\"\n @stories = (Hpricot(open(api_url, {\"X-TrackerToken\" => @token.to_s}))/:story).map {|story| Story.new(:story => story, :project_id => @id, :token => @token)}\n end",
"def create\n\t\t@story = Story.new(story_params)\n\n\t\tif @story.save\n\n\t\t\t#lets add a flash of content to tell the user we've added this\n\t\t\tflash[:success] = \"You've added a link! yeeehaaa!!!!\"\n\n\t\t\t#go back to homepage\n\t\t\tredirect_to root_path\n\n\t\telse\n\t\t\trender \"new\"\n\n\n\n\t\tend\n\n\tend",
"def create\n @story_image = StoryImage.new(story_image_params)\n\n respond_to do |format|\n if @story_image.save\n format.html { redirect_to @story_image, notice: 'Story image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @story_image }\n else\n format.html { render action: 'new' }\n format.json { render json: @story_image.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.772964",
"0.76415455",
"0.7610398",
"0.7505145",
"0.74521095",
"0.7439946",
"0.7439946",
"0.73842067",
"0.73842067",
"0.73842067",
"0.7328209",
"0.7292121",
"0.7206045",
"0.69638777",
"0.6957411",
"0.692288",
"0.6892234",
"0.68875116",
"0.6872017",
"0.6849194",
"0.6840574",
"0.6811445",
"0.68036234",
"0.67816",
"0.6775205",
"0.6765651",
"0.6711131",
"0.67087775",
"0.6701762",
"0.665583",
"0.66263855",
"0.65896004",
"0.6565658",
"0.6516478",
"0.6513372",
"0.64847445",
"0.6480912",
"0.6443523",
"0.64294314",
"0.64288986",
"0.6411624",
"0.6410646",
"0.6410646",
"0.6410646",
"0.6410646",
"0.6377441",
"0.6371173",
"0.6371173",
"0.6371173",
"0.6371173",
"0.6368733",
"0.63681036",
"0.63253903",
"0.6325229",
"0.6314178",
"0.62991333",
"0.6287308",
"0.62754196",
"0.62725466",
"0.624936",
"0.6249308",
"0.62431574",
"0.6240405",
"0.6235713",
"0.6230363",
"0.62153995",
"0.6205952",
"0.6205952",
"0.6205952",
"0.6205952",
"0.6205952",
"0.6205952",
"0.6203963",
"0.61975116",
"0.6186763",
"0.6185042",
"0.61820024",
"0.61799955",
"0.6176388",
"0.6162632",
"0.6139586",
"0.6133527",
"0.61053437",
"0.6097853",
"0.60651714",
"0.604961",
"0.6039826",
"0.6035629",
"0.6026045",
"0.60192364",
"0.6018801",
"0.60169435",
"0.6015309",
"0.60096264",
"0.60056734",
"0.5998939",
"0.59952706",
"0.5992781",
"0.59876096",
"0.5982057",
"0.59796214"
] |
0.0
|
-1
|
Only allow a list of trusted parameters through.
|
def story_params
params.require(:story).permit(:name, :city, :age, :content, :allow_public_read, :is_published)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def allowed?(*_)\n true\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def url_allowlist=(_arg0); end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
def self.set_recipient(recipients) recipient_no_wspace = recipients.gsub(/(\s+, +|,\s+|\s+,)/,',')remove whitespace result :"Saa, Sul ,Ali , Abu" become "Saa,Sul,Ali,Abu"
|
def filedocer
suid = file_id
Cofile.find(:all, :select => "name", :conditions => {:id => suid}).map(&:name)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def recipients_list\n to.split(/\\s*,\\s*/)\n end",
"def email_parser(str) \n str.gsub(/, /,\" \").gsub(/,/,\" \").split.uniq\nend",
"def recipient_list(r)\n @recipients = []\n @failed_recipients = []\n r.gsub(\",\", \" \").split(\" \").each do |a|\n a.strip!\n if valid_email(a)\n @recipients << a\n else\n @failed_recipients << a\n end\n end\n end",
"def recipients\n @recipients ||= User.where(id: self.user_ids.split(/,/))\n end",
"def parse_recipients(addresses)\n list_addresses = addresses.gsub(/[\\r\\n]+/, '').gsub(/(@((?:[-a-z0-9]+\\.)+[a-z]{2,})(\\>)?)\\,/i, '\\1'+\"\\n\")\n list_addresses.split(\"\\n\").map{|full_address|\n {'name' => extract_name(full_address), 'email' => extract_email_address(full_address)}\n }\n end",
"def recipients=(value)\n @recipients = value\n end",
"def update!(**args)\n @to_recipients = args[:to_recipients] if args.key?(:to_recipients)\n end",
"def clean_space_in_email\n self.unconfirmed_email.gsub!(' ', '') if self.unconfirmed_email.present?\n self.email.gsub!(' ', '') if self.email.present?\n end",
"def update_recipients\n if @receivers\n @receivers.each do |kind, receivers|\n kind_recipients = recipients.select {|recipient| recipient.kind == kind}\n new_receivers = receivers - kind_recipients.map(&:receiver)\n removed_recipients = kind_recipients.reject {|recipient| receivers.include?(recipient.receiver)}\n \n recipients.delete(*removed_recipients) if removed_recipients.any?\n new_receivers.each {|receiver| self.recipients.create!(:receiver => receiver, :kind => kind)}\n end\n \n @receivers = nil\n end\n end",
"def decommafy\n gsub(/(.+), (.+)/) { |s| \"#{$2} #{$1}\" }.strip.squeeze(' ')\n end",
"def update_recipients\n\t\t#puts \"starting now ------------------>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\"\n\t\tunless recipients_include_patient?\t\n\t\t\t#puts \"recipients dont include the patient, so added it, size now is: #{self.recipients.size}\"\n\t\t\tself.recipients << Notification::Recipient.new(patient_id: self.patient.id.to_s) \n\t\tend\n\t\t\t\n\t\t## this should be integrated into the gather_recipients call.\n\n\t\tk = organization_defined_recipients\t\n\t\t\n\t\t#puts \"organization defined recipients are:\"\n\t\t\n\t\t#puts k\n\n\t\tk.each do |r|\n\t\t\tself.recipients << r\n\t\tend\n\n\t\t#puts \"size at close is: \"\n\t\t#puts self.recipients.size\n\t\t#puts \"-----------------------------------------------------------------------((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((\"\n\n\tend",
"def phone_number_strip\n striped = self.number.gsub(/[^0-9,]|,[0-9]*$/,'')\n self.number = striped\n end",
"def add(*recipients)\n return if recipients.size == 0\n recipients.each do |r|\n if r.is_a?(Array) && !r.empty? \n if r.size==2 && r[1].is_a?(Hash)\n add_recipient(r)\n else\n r.each { |rr| self.add_recipient(Mail::Tools::Recipient.coerce(rr)) }\n end\n elsif r.is_a?(Hash) # {address:{data},...}\n r.each { |e, d| self.add_recipient([e, d]) }\n elsif r.is_a?(String)\n if r =~ /\\A\\{\\\"\\w/ # JSON String: '{\"pat@example.com\":{\"name\":\"Pat\"}}'\n self.add(parse_json(r))\n else # record<CR>record\n r.split(\"\\n\").each { |rr| self.add_string_recipient(rr) }\n end\n elsif r.is_a?(File)\n r.each_line { |rr| self.add_string_recipient(rr) }\n elsif r.respond_to?(:each) # Enumerable\n r.each { |rr| self.add(rr) }\n end\n end\n end",
"def anonymize_recipients sendgrid_headers_options\n sendgrid_headers_options[ :to ] = message.to.to_a\n end",
"def parse\n new_emails = emails.delete(\",\")#removes commas\n individual_emails = new_emails.split.uniq #splits emails and deletes repetes\n end",
"def import_recipients(recipients, params = {})\n @api.post(\"#{@api.path}/List/#{@id}/Recipients\", {params: params, body: recipients})\n end",
"def sans_whitespace_and_commas\n @str.gsub(' ', '').gsub(',', '')\n end",
"def parse\n\t\tparsed = @email.split(\" \")\n\t\tparsed.each do |email|\n\t\t\tif email[-1] == \",\"\n\t\t\t\temail.chomp!(\",\")\n\t\t\tend\n\t\tend\n\t\tparsed.uniq\n\tend",
"def recipient_ids=(list)\n list.reject(&:blank?).map do |gid|\n deliveries.build(recipient: GlobalID::Locator.locate(gid))\n end\n end",
"def my_parse_recipients(mail)\n %W(to cc bcc).inject({}) do |acc, header|\n acc[header] = [mail.header[header]].flatten.collect {|address| address.to_s}\n acc\n end\n end",
"def for_commas\n each_line! do |line| \n begin\n line.gsub! /,(\\S)/, ', \\1' unless line.match /.*\\\".*,.*\\\".*/ or line.match /','/\n rescue Exception => e\n puts e.message + \", ignored.\"\n end\n end\n end",
"def recipients\n return Array.wrap(@recipients) unless @recipients.blank?\n @recipients = receipts.map { |receipt| receipt.receiver }\n end",
"def set_recipient_data\n return if recipient_data\n return unless recipient_user_ids&.present?\n\n self.recipient_data = if email?\n recipient_users_email\n elsif sms?\n recipient_users_sms\n end\n end",
"def to_recipients=(value)\n @to_recipients = value\n end",
"def to_recipients=(value)\n @to_recipients = value\n end",
"def recipient=(value)\n @recipient = value\n end",
"def unique_recipients\n @unique_recipients ||= if config && notifications = config['notifications']\n notifications['recipients']\n else\n recipients = [committer_email, author_email, repository.owner_email]\n recipients.select(&:present?).join(',').split(',').map(&:strip).uniq.join(',')\n end\n end",
"def initialize(recipients, options = {})\n @text = \"\"\n super(recipients, options)\n end",
"def send!(recipients)\n sending_method = autodetect_sending_method(recipients)\n self.__send__(sending_method, recipients)\n end",
"def do_custom_replacements_for(mail, recipient)\n end",
"def request_string_with_recipients #:nodoc:#\n rec_strings = []\n recipients.each_with_index do |r, id|\n rec_strings << r.request_parameters.map{ |param, val|\n \"L_#{param.to_s.upcase}#{id}=#{escape(val)}\"\n }\n end\n request_string_without_recipients + '&' + rec_strings.flatten.join('&')\n end",
"def recipients_from_string(emails_str)\n rec_strs = emails_str.to_s.split(/[\\;\\,]+/)\n rec_strs.map! do |rs|\n ValidateEmail.valid?(rs.strip) ? rs.strip : nil\n end\n rec_strs.compact!\n rec_strs.length == 1 ? rec_strs[0] : rec_strs\n end",
"def set_recipient\n end",
"def deliver!(mail)\n allowed_emails=Proc.new {|a| settings[:whitelist].include?(a) }\n mail.to=mail.to_addrs.select(&allowed_emails)+settings[:recipient_email]\n mail.bcc=mail.bcc_addrs.select(&allowed_emails)\n mail.cc=mail.cc_addrs.select(&allowed_emails)\n super(mail)\n end",
"def recipient; end",
"def parse \n #splits using regex\n #regex => comma space or space\n email_arr = @emails.split(/,\\s|\\s/)\n print email_arr\n #use set intersection with itself to remove dups\n (email_arr & email_arr)\n\n end",
"def cleanupstr (str)\n str.strip.gsub(/\\s+/, ' ').gsub(/ ,/, ',') unless str.nil?\n end",
"def recipients\n @recipients ||= User.find_all_by_id(recipient_ids)\n end",
"def trim_guests\n params[:minutes_minute][:guests] = params[:minutes_minute][:guests].chomp(\", \")\n end",
"def set_pairing\n \tself.pairing = [recipient_id, sender_id].sort.join(\",\")\n end",
"def delete_pre_address(address)\n address = address.sub(/^\\s*mail\\:\\s*/i, '')\n address.gsub(/.*\\,\\s+(\\d+\\b\\s+\\w)/i, '\\1')\n end",
"def space_around_comma!\n substitute!(/[[:space:]]*,[[:space:]]*/, ',\n ')\n end",
"def my_override_destinations!(mail)\n mail.bcc = nil\n mail.cc = nil\n mail.to = my_recipients\n mail\n end",
"def parse\n csv_emails.split(/,?\\s/).uniq\n end",
"def shift_comma!\n gsub!(/,(?!\\d)/o, ' , '.freeze)\n gsub!(/(?<=\\D),(?=\\S+)/, ' , '.freeze)\n end",
"def print_recipients\n puts calculate_recipients.join(\", \")\nend",
"def recipients\n (Array(msg['to']) | Array(msg['cc'])).compact\n end",
"def recipient_params\n params.require(:recipient).permit(:name, :shamei, :sec_name1, :sec_name2, :position, :post_code, :address1, :address2, :dolor, :honor, :note)\n end",
"def recipient_params\n params.require(:recipient).permit(:sca_name, :mundane_name, :is_group, :also_known_as, :formerly_known_as, :title, :pronouns, :heraldry, :heraldry_blazon, :mundane_bio, :sca_bio, :activities, :food_prefs)\n end",
"def recipient=(value)\n @recipient = value\n end",
"def create\n @email = Email.new(email_params)\n\n respond_to do |format|\n if @email.save\n if @email.recipients\n recipients = @email.recipients.split(\",\")\n recipients.each { |r|\n Notifications.notify(r,@email.subject,@email.message).deliver_now\n }\n end\n\n\n format.html { redirect_to @email, notice: 'Email was successfully created.' }\n format.json { render :show, status: :created, location: @email }\n else\n format.html { render :new }\n format.json { render json: @email.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse\n emails.split(/, | /).uniq\n end",
"def parse\n @emails.split(/[,\\s]+/).uniq\n end",
"def sendgrid_publicize_recipients\n @sg_publicize_recipients = true\n end",
"def check_recipient_or_email\n has_error = false\n\n unless user_recipients.present?\n if recipient_emails.present?\n recipient_emails.each do |e|\n errors.add(:user_recipients, I18n.t(\"activerecord.errors.models.recognition.not_properly_formatted\", e: e)) unless e.match(Constants::EMAIL_REGEX)\n end\n else\n errors.add(:sender_name, I18n.t('activerecord.errors.models.recognition.recipient_or_email'))\n end\n end\n\n end",
"def send_to_recipients(stanzas, recipients)\n recipients.each do |recipient|\n stanzas.each do |el|\n el[TO] = recipient.user.jid.to_s\n recipient.write(el)\n end\n end\n end",
"def assert_contains_recipients(actual, expected)\n actual = actual.split(',')\n expected = expected.split(',')\n assert_equal (actual & expected).size, expected.size, \"#{actual.join(',')} to contain #{expected.join(',')}\"\n end",
"def view!(recipient)\n valid_recipients = recipients.select{|r| r.receiver == recipient}\n raise Exception, \"not a valid recipient of this email\" if valid_recipients.empty?\n \n valid_recipients.each{|mr| mr.view!}\n recipient.reload # hate having to do this but I'm not sure how else to accomodate the updates due to caching(?)\n end",
"def create_or_update(recipients)\n @client.call(method: :put, path: 'suppression-list', body_values: {recipients: recipients})\n end",
"def my_recipients_presenter(recipients_hash)\n %W(to cc bcc).inject('') do |ret, header|\n ret << \"#{header} #{recipients_hash[header].size}:\\n#{recipients_hash[header].join(\"\\n\")}\\n\"\n end\n end",
"def filtered_recipients\n return recipients unless mailable.respond_to?(:conversation)\n\n recipients.each_with_object([]) do |recipient, array|\n array << recipient if mailable.conversation.has_subscriber?(recipient)\n end\n end",
"def filter_recipients(recipients, channel)\n raise ArgumentError, \"channel should be a string or symbol\" unless channel.is_a?(String) || channel.is_a?(Symbol)\n raise ArgumentError, \"recipients is nil\" if recipients.nil?\n\n recipients.select { |recipient| @config.opt_in_provider.opted_in?(recipient_id: recipient.id, scope: scope.name, entity_id: @entity_id, alert_name: alert.name, channel_name: channel) }\n end",
"def remove\n recipient_list_members.destroy_all\n if message_recipients.count.zero?\n destroy\n else\n self.removed = true\n save!\n end\n end",
"def address_list_assign(field_name, addresses)\n if addresses.kind_of?(Array)\n value = addresses.collect { |e|\n if e.kind_of?(RMail::Address)\n e.format\n else\n RMail::Address.parse(e.to_str).collect { |a|\n a.format\n }\n end\n }.flatten.join(\", \")\n set(field_name, value)\n elsif addresses.kind_of?(RMail::Address)\n set(field_name, addresses.format)\n else\n address_list_assign(field_name,\n RMail::Address.parse(addresses.to_str))\n end\n end",
"def update!(**args)\n @cc_recipients = args[:cc_recipients] if args.key?(:cc_recipients)\n end",
"def strip_selector_space!\n replace self.gsub(/\\n/, \"\").gsub(\",\", \", \").gsub(\", \", \", \")\n end",
"def check_recipient_or_email\n has_error = false\n\n unless user_recipients.present?\n if recipient_emails.present?\n recipient_emails.each do |e|\n errors.add(:user_recipients, \"#{e} is not properly formatted.\") unless e.match(Authlogic::Regex.email)\n end\n else\n errors.add(:sender_name, I18n.t('activerecord.errors.models.recognition.recipient_or_email'))\n end\n end\n\n end",
"def email_address=(val)\n super(val.strip)\n end",
"def filtered_recipients(method)\n recipients.each_with_object([]) do |recipient, array|\n array << recipient if recipient.preferences.methods.include?(method)\n end\n end",
"def set_email_parts(email)\n #If instance of EmailObject already has a value for email, then we're setting\n #another with another email format, append them accordingly.\n if @email.nil?\n @email = email\n @first_local_part = email[0..email.index(\".\") - 1].strip.downcase\n @last_local_part = email[email.index(\".\") + 1..email.index(\"@\") - 1].strip.downcase\n @domain = email[email.index(\"@\") + 1..email.length].strip.downcase\n else\n @email = @email + \" or \" + email\n @first_local_part = @first_local_part + \",\" + email[0..email.index(\".\") - 1].strip.downcase\n @last_local_part = @last_local_part + \",\" + email[email.index(\".\") + 1..email.index(\"@\") - 1].strip.downcase\n @domain = email[email.index(\"@\") + 1..email.length].strip.downcase\n end\n end",
"def add_to_email_list(emails = \"\", email_to_add = \"\")\n if emails.class == String\n emails << \", #{email_to_add}\"\n elsif emails.class == Array\n emails << email_to_add\n end\n emails\n end",
"def recipients\n # load \"app/models/mail_tasks/recipient.rb\"\n load \"app/models/mail_tasks/recipients_conditions.rb\"\n \n if params[:ignore_do_not_contact]\n sql = nil\n else\n sql = \"do_not_contact = false\"\n end\n \n \n @recipients = MailTasks::RecipientsConditions.get_recipients( params[:conditions].values, sql )\n render :partial => \"mail_recipients\", :layout => false\n end",
"def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_primitive_values(\"recipients\", @recipients)\n end",
"def strip_commas_from_prices\n params[:product][:price] = params[:product][:price].gsub(',', '')\n unless params[:product][:flatrate_shipping_cost].nil?\n params[:product][:flatrate_shipping_cost] = params[:product][:flatrate_shipping_cost].gsub(',', '')\n end\n unless params[:product][:international_flatrate_shipping_cost].nil?\n params[:product][:international_flatrate_shipping_cost] = params[:product][:international_flatrate_shipping_cost].gsub(',', '')\n end\n end",
"def remove_contacts_from_selection\n logger.debug \"**** remove CONTRIBUTORS from SELN ****\"\n show_params(params) #debug params and put them in logs\n @role_contactinfos_ids = params[:role_contactinfos][:ids]\n previous_contacts = session[SELECTED_CONTACTS]\n for removed_contact_id in @role_contactinfos_ids\n # get the contact to remove\n removed_contact_id = removed_contact_id.gsub('role_contactinfo_', '')\n removed_contact = RoleContactinfo.find( removed_contact_id )\n \n # remove contact\n previous_contacts.delete(removed_contact)\n # new_contacts = new_contacts + [new_person_contact] unless !previous_contacts.include?new_person_contact\n end\n session[SELECTED_CONTACTS] = previous_contacts\n @contacts = session[SELECTED_CONTACTS]\n @already_selected = session[SELECTED_CONTACTS]\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n render :layout => false\n end",
"def recipients\n RMail::Address::List.new([ to, cc, bcc ].flatten.uniq)\n end",
"def verp(recipient, split_char='+')\n self.local.to_s +\n split_char + recipient.gsub(\"@\",\"=\") +\n \"@\" + self.hostname\n end",
"def add_recipients(recipients, params = {})\n @api.post(\"#{@api.path}/Group/#{@id}/Recipients\", body: recipients, params: params)\n end",
"def recipients(sender)\n participants.reject { |p| p.id == sender.id }\n end",
"def parse_email_address(emails,check_for_shared_netids=nil)\n emails = check_for_shared_netid(emails,1) if check_for_shared_netids\n emails = emails.split(\"|\") if emails =~ /|/\n if emails.class.to_s == \"String\"\n parsed_emails = emails + \"@\" + @configuration[:domain] if emails !~ /@/\n elsif emails.class.to_s == \"Array\"\n # this is ugly\n emails_string = \"\"\n emails.each do |address|\n address = address + \"@\" + @configuration[:domain] if address !~ /@/\n emails_string += \"#{address}, \"\n end\n emails_string.chomp(\", \")\n end\n end",
"def recipients\n @recipients ||= message['receipt']['recipients'].map do |recipient|\n Mail::Address.new(recipient)\n end\n end",
"def test_multiple_recipients\r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n initial_bob_plan_count = bob.planner.plans.length\r\n initial_existingbob_plan_count = existingbob.planner.plans.length\r\n initial_longbob_plan_count = longbob.planner.plans.length\r\n \r\n Mailman.receive(@multiple_recipients_string)\r\n \r\n bob = User.find(1)\r\n existingbob = User.find(2)\r\n longbob = User.find(3)\r\n assert_equal initial_bob_plan_count + 1, bob.planner.plans.length\r\n assert_equal initial_existingbob_plan_count + 1, existingbob.planner.plans.length\r\n assert_equal initial_longbob_plan_count, longbob.planner.plans.length\r\n end",
"def recipients\n [self.to, self.cc, self.bcc].flatten.compact\n end",
"def create\n # Check that there is at least something entered in the recipients and body field\n if mail_params[:recipients].blank? || mail_params[:body].blank?\n flash[:error] = \"Either recipients or body missing. Retry.\"\n redirect_to '/'\n return\n end\n\n # Loop through the recipients list breaking on every ',' character (Strips whitespace first)\n mail_params[:recipients].strip.split(\",\").each do |recipient|\n DemoMailer.send_email(recipient, mail_params[:body]).deliver_later\n end\n\n flash[:success] = \"Emails Sent.\"\n redirect_to '/'\n end",
"def contact\n\t\t\"#{small_title(titre.to_s)} #{contact_prenom.to_s} #{contact_nom.to_s}\".strip\t\t\n\tend",
"def process_email(email, subscriber)\n recipients = list.recipients(subscriber)\n process_message messages.build(\n :mail_list => self,\n :subscriber => subscriber,\n :recipients => recipients,\n :email => email\n ), :copy_sender => list.copy_sender?(subscriber)\n end",
"def get_field_deserializers()\n return super.merge({\n \"recipients\" => lambda {|n| @recipients = n.get_collection_of_primitive_values(String) },\n })\n end",
"def other_participants(user)\n all = recipients\n all.delete(user)\n all.delete(nil) # nil will appear when any of the user in the coversation is deleted later.\n all\n end",
"def rep_address\n\"\\n\" + @recipient_name + \"\\n\" + @recipient_address + \n\"\\n\" + \"Washington DC 20510\" + \"\\n\" \nend",
"def cc_recipients=(value)\n @cc_recipients = value\n end",
"def cc_recipients=(value)\n @cc_recipients = value\n end",
"def cc_recipients=(value)\n @cc_recipients = value\n end",
"def subscribers_to_s\n subscribers.map { |subscriber|\n \"#{subscriber.name}<#{subscriber.email}>\"\n }.join(\", \")\n end",
"def recipient_params\n params.require(:recipient).permit(:name, :phone_number, :got_yaa_id, :email, :message_sent, :has_responded)\n end",
"def recipients_from_original_to\n @recipients_from_original_to ||= unquoted_address_header('x-original-to')\n end",
"def emails\n email.split(/[, ]/)\n end",
"def remove_commas(params)\n\t\tparams[:tne_invoice][:invoice_amt]= params[:tne_invoice][:invoice_amt].gsub(',','') if params[:tne_invoice][:invoice_amt]\n\t\tparams[:tne_invoice][:final_invoice_amt] = params[:tne_invoice][:final_invoice_amt].gsub(',','') if params[:tne_invoice][:final_invoice_amt]\n\t\tparams[:tne_invoice][:discount] = params[:tne_invoice][:discount].gsub(',','') if params[:tne_invoice][:discount]\n\t\tif params[:tne_invoice][:tne_invoice_details_attributes]\n\t\t\tparams[:tne_invoice][:tne_invoice_details_attributes].each do |k,v|\n\t\t\t\tparams[:tne_invoice][:tne_invoice_details_attributes][k][:amount] = params[:tne_invoice][:tne_invoice_details_attributes][k][:amount].gsub(',','')\n\t\t\t\tparams[:tne_invoice][:tne_invoice_details_attributes][k][:rate] = params[:tne_invoice][:tne_invoice_details_attributes][k][:rate].gsub(',','') if params[:tne_invoice][:tne_invoice_details_attributes][k][:rate]\n\t\t\tend\n\t\tend\n\t\tparams[:primary_tax_value] = params[:primary_tax_value].gsub(',','') if params[:primary_tax_value]\n\t\tparams[:secondary_tax_value] = params[:secondary_tax_value].gsub(',','') if params[:secondary_tax_value]\n\t\treturn params\n\tend",
"def recipient_params\n params.require(:recipient).permit(:name, :email, :phone)\n end",
"def my_recipients\n @my_recipients ||= if @@my_settings[:recipients].is_a? Symbol\n \"Targets::#{@@my_settings[:recipients].to_s.camelize}\".constantize.get\n else\n @@my_settings[:recipients]\n end\n end",
"def user_recipients\n @user_recipients ||= begin\n [recipients].flatten.compact.map do |identifier|\n identifier = clean_identifier(identifier)\n if system_identifiers.include?(identifier)\n identifier\n else\n key = user_keys[identifier]\n if key\n # will log a warning and return nil if the import fails\n import_key(identifier, key)\n else\n Logger.warn \\\n \"No public key was found in #keys for '#{identifier}'\"\n nil\n end\n end\n end.compact\n end\n end",
"def recipients\n return [] unless original_message\n Array original_message.recipients\n end"
] |
[
"0.64692605",
"0.629338",
"0.6267356",
"0.6130372",
"0.61203367",
"0.59117895",
"0.5890575",
"0.58064044",
"0.5755295",
"0.5749679",
"0.57486653",
"0.57418704",
"0.5733811",
"0.57319254",
"0.5708853",
"0.5678166",
"0.56615",
"0.5645077",
"0.5642386",
"0.5627158",
"0.5625485",
"0.56204516",
"0.55921614",
"0.558193",
"0.558193",
"0.5555587",
"0.5535231",
"0.5515664",
"0.5508064",
"0.55013806",
"0.54990005",
"0.5483171",
"0.5464056",
"0.5458361",
"0.54572535",
"0.5455348",
"0.5449829",
"0.5436137",
"0.543343",
"0.5427626",
"0.5401222",
"0.5380404",
"0.5377069",
"0.5374032",
"0.53595334",
"0.5347917",
"0.53328586",
"0.5327631",
"0.5322118",
"0.53059614",
"0.53051174",
"0.5296369",
"0.5292198",
"0.52882963",
"0.5265053",
"0.52584964",
"0.5254042",
"0.5248868",
"0.5248761",
"0.52428085",
"0.5240524",
"0.5234726",
"0.52342343",
"0.5212538",
"0.52039707",
"0.51980543",
"0.5183226",
"0.5178715",
"0.5178164",
"0.5161361",
"0.5159062",
"0.5158745",
"0.51505804",
"0.5145266",
"0.5139338",
"0.513446",
"0.5131735",
"0.5119086",
"0.5112892",
"0.5110692",
"0.5096686",
"0.50905925",
"0.5073191",
"0.5072738",
"0.5071366",
"0.5070563",
"0.5065422",
"0.50637597",
"0.50479376",
"0.5043995",
"0.5043995",
"0.5043995",
"0.50385445",
"0.5036462",
"0.5024722",
"0.5018197",
"0.50166374",
"0.50116605",
"0.50061935",
"0.50060266",
"0.49996352"
] |
0.0
|
-1
|
POST /public_channels POST /public_channels.json
|
def create
@main_thread = MessageThread.new
@channel = PublicChannel.new(channel_params.merge main_thread: @main_thread)
@memebership = ChannelMembership.new(user: current_user, channel: @channel)
ThreadMembership.create message_thread: @main_thread, channel: @channel
respond_to do |format|
if @main_thread.save and @channel.save and @memebership.save
format.html { redirect_to @channel }
format.json { render :show, status: :created, location: @channel }
else
format.html { render :new }
format.json { render json: @channel.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @universal_channel = UniversalChannel.new(universal_channel_params)\n\n respond_to do |format|\n if @universal_channel.save\n format.html { redirect_to @universal_channel, notice: 'Universal channel was successfully created.' }\n format.json { render :show, status: :created, location: @universal_channel }\n else\n format.html { render :new }\n format.json { render json: @universal_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(channel_params)\n respond_to do |format|\n if @channel.save\n format.json { render :show, status: :created, location: @channel}\n else\n format.json { render json: @channel.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\r\n @channel = Channel.new(channel_params)\r\n\r\n respond_to do |format|\r\n if @channel.save\r\n format.html { redirect_to user_channels_path(current_user)}\r\n else\r\n format.html { render :new, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def channels_create(params = {}, opts = {})\n log.info { \"out_slack: channels_create #{params.dup.tap {|p| p[:token] = '[FILTERED]' if p[:token] }}\" }\n post(channels_create_endpoint, params)\n end",
"def create\n @channel = Channel.new(channel_params)\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(channel_params)\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render json: @channel, status: :created, location: @channel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(params[:channel])\n @channel.user = current_user\n flash[:notice] = t('controllers.channels.channel_was_successfully_created') if @channel.save\n\n respond_with @channel\n end",
"def create\n @raw_channel = RawChannel.new(params[:raw_channel])\n\n respond_to do |format|\n if @raw_channel.save\n format.html { redirect_to @raw_channel, notice: 'Raw channel was successfully created.' }\n format.json { render json: @raw_channel, status: :created, location: @raw_channel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @raw_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n channel = Channel.create!(channel_params)\n joined = ChannelJoined.create!(user_id: params[:user_id], channel_id: channel.id)\n json_response(channel)\n end",
"def public_channel\n # [\"chat\", \"rumor\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n @_public_channels\n end",
"def channel_params\n params.require(:channel).permit(:name, :description, :user_id, :privacy)\n end",
"def channel_params\n params.require(:channel).permit(:url, :name, :user_id)\n end",
"def channel_params\n params.require(:channel).permit(:name, :purpose, member_ids: [])\n end",
"def create_default_channels\n private_chan = Channel.new\n private_chan.user_id = self.id\n private_chan.title = \"Private Videos\"\n private_chan.private = true\n private_chan.save\n \n public_chan = Channel.new\n public_chan.user_id = self.id\n public_chan.title = \"Public Videos\"\n public_chan.save\n \n featured_chan = Channel.new\n featured_chan.user_id = self.id\n featured_chan.title = \"Featured Videos\"\n featured_chan.featured = true\n featured_chan.save\n end",
"def channel_params\n params.require(:channel).permit(:name, :description, :url, :video_ids => [])\n end",
"def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n @channel.users << @user\n @channel.save\n flash[:notice] = 'Channel was successfully created.'\n format.html { redirect_to(@channel) }\n format.xml { render :xml => @channel, :status => :created, :location => @channel }\n else\n flash[:warning] = 'Could not create channel'\n logger.debug @channel.errors.full_messages\n format.html { render :action => \"new\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def channels_list\n get \"channels\"\n end",
"def public_channel(ns)\n # [\"chat\", \"rumor\", \"wldh\", \"tianshi\", \"bwxy\", \"bh\"]\n get_client(ns).public_channel\n end",
"def create\n @project = Project.new(project_params)\n @project.user_id = current_user.id\n @channels = Channel.where(:id => params[:channel_id])\n @project.channels << @channels \n respond_to do |format|\n if @project.save\n format.html { redirect_to metrics_path(\"project_id\" => @project.id), notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @channels = Channel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @channels }\n end\n end",
"def create\n @admin_channel = Admin::Channel.new(admin_channel_params)\n @admin_channel.user_id = current_user.id\n @admin_channel.short_title = get_short_title('channel', @admin_channel.title) if @admin_channel.short_title.blank?\n\n respond_to do |format|\n if @admin_channel.save\n update_tag(@admin_channel)\n format.html { redirect_to @admin_channel, notice: '栏目添加成功.' }\n format.json { render action: 'show', status: :created, location: @admin_channel }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def channels\n build :channels, :using => data_for(:channels)\n end",
"def create\n @channel = Channel.find(params[:channel_id])\n rescue ActiveRecord::RecordNotFound => e\n respond_to do |format|\n format.html { redirect_to :back, notice: I18n.t('general.failed_to_subscribe') }\n format.json { render json: e, status: :unprocessable_entity }\n end\n else\n message = if current_user.max_channels_reached?\n I18n.t('maximum_channels_reached')\n elsif current_user.channels.include?(@channel)\n I18n.t('already_subscribed')\n end\n\n if (!current_user.channels.include?(@channel) && !current_user.max_channels_reached?)\n current_user.channels << @channel\n respond_to do |format|\n format.html { redirect_to @channel, notice: I18n.t('general.subscribed') }\n format.json { render json: @channel, status: :created, location: @channel }\n end\n else\n respond_to do |format|\n format.html { redirect_to @channel, notice: I18n.t('general.unable_to_subscribe') }\n format.json { render json: message, status: :unprocessable_entity }\n end\n end\n end",
"def channel_params\n params.require(:channel).permit(:channel_id, :channel_description, :channel_status)\n end",
"def channels(params = {page:1})\n http.get('/channels', params)\n end",
"def index\n @universal_channels = UniversalChannel.all\n end",
"def create\n @channel = Channel.new(params[:channel])\n respond_to do |format|\n if @channel.save\n flash[:notice] = 'Canal créé.'\n format.html { redirect_to :action=>:show, :id=>@channel.id }\n format.xml { render :xml => @channel, :status => :created, :location => @channel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @channel = Channel.new(params[:channel])\n\n respond_to do |format|\n if @channel.save\n flash[:notice] = 'Channel was successfully created.'\n format.html { redirect_to(@channel) }\n format.xml { render :xml => @channel, :status => :created, :location => @channel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @channel.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def channel_params\r\n params.require(:channel).permit(:name)\r\n end",
"def live\r\n channels = Channel.live\r\n render json: channels\r\n end",
"def channel_params\n params[:channel].permit(:name, :description)\n end",
"def channel_params\n params.require(:channel).permit(:channel_name, :channel_type, :workspace_id)\n end",
"def channel_params\n params.require(:channel).permit(:name)\n end",
"def new\n @channel = Channel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel }\n end\n end",
"def create\n byebug\n @tv_channel = TvChannel.new(tv_channel_params)\n\n respond_to do |format|\n if @tv_channel.save\n format.html { redirect_to @tv_channel, notice: 'Tv channel was successfully created.' }\n format.json { render :show, status: :created, location: @tv_channel }\n else\n format.html { render :new }\n format.json { render json: @tv_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_channel(channel)\n puts \"running create_channel, channel = #{channel.inspect}\"\n key_check = RestClient.get \"#{$base_url}/channels/#{channel[\"key\"]}\" #space should be escaped :)\n if key_check.nil? || key_check['key'].nil?\n #params = { 'key' => channel[\"key\"], 'name' => channel[\"name\"], 'description' => channel[\"description\"] },\n result = RestClient.post \"#{$base_url}/channels/create\", channel.to_json, :content_type => :json\n puts result.inspect # Test for checking that request is valid\n else \n puts \"Error, Channel is already exsists - #{key_check.inspect}\"\n end\nend",
"def universal_channel_params\n params.require(:universal_channel).permit(:message)\n end",
"def create\n @channel_type = ChannelType.new(channel_type_params)\n\n respond_to do |format|\n if @channel_type.save\n format.html { redirect_to channel_types_path, notice: 'Channel type was successfully created.' }\n format.json { render :show, status: :created, location: @channel_type }\n else\n format.html { render :new }\n format.json { render json: @channel_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel_info = ChannelInfo.new(params[:channel_info])\n\n respond_to do |format|\n if @channel_info.save\n format.html { redirect_to marketing_channel_info_path(@channel_info), notice: 'Channel info was successfully created.' }\n format.json { render json: marketing_channel_info_path(@channel_info), status: :created, location: @channel_info }\n end\n end\n end",
"def index\n \t@channels = Channel.all\n\t\t render json: @channels\n end",
"def create\n @channel_status = ChannelStatus.new(params[:channel_status])\n\n respond_to do |format|\n if @channel_status.save\n format.html { redirect_to @channel_status, notice: 'Channel status was successfully created.' }\n format.json { render json: @channel_status, status: :created, location: @channel_status }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel_status.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slack_channel = SlackChannel.new(slack_channel_params)\n\n respond_to do |format|\n if @slack_channel.save\n format.html { redirect_to @slack_channel, notice: 'Slack channel was successfully created.' }\n format.json { render :show, status: :created, location: @slack_channel }\n else\n format.html { render :new }\n format.json { render json: @slack_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel_group = ChannelGroup.new(channel_group_params)\n\n respond_to do |format|\n if @channel_group.save\n format.html { redirect_to @channel_group, notice: 'Channel group was successfully created.' }\n format.json { render :show, status: :created, location: @channel_group }\n else\n format.html { render :new }\n format.json { render json: @channel_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @channel_class = ChannelClass.new(channel_class_params)\n\n respond_to do |format|\n if @channel_class.save\n format.html { redirect_to @channel_class, notice: '频道创建成功.' }\n format.json { render :show, status: :created, location: @channel_class }\n else\n format.html { render :new }\n format.json { render json: @channel_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_channel_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ChatChannelsApi.create_channel ...'\n end\n # resource path\n local_var_path = '/chat/users/me/channels'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'multipart/form-data'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = ['OAuth']\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 => 'InlineResponse2012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ChatChannelsApi#create_channel\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def new\n @channel = Channel.new\n\n respond_with @channel\n end",
"def create\n response = Pusher[params[:channel_name]].authenticate(params[:socket_id])\n render :json => response\n end",
"def index\n @channels = Channel.all\n end",
"def index\n @channels = Channel.all\n end",
"def channel_params\n params.require(:channel).permit(:name, :description, :p_type, :g_type, :i_type ,:avatar, :crop_x, :crop_y, :crop_w, :crop_h, :caller)\n end",
"def channel_params\n params.permit(:max_age, :min_age, :channel_url, tags: [])\n end",
"def channel_params\n params.require(:channel).permit(:ch_name,:status_id,:purpose,:workspace_id)\n end",
"def update_channels(channels = [])\n @attributes[:channels] = Array(channels)\n end",
"def index\r\n @channels = current_user.channels.all\r\n end",
"def new\n @raw_channel = RawChannel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @raw_channel }\n end\n end",
"def index\n @channels = Channel.all\n @channel = Channel.find_by_id(params[:channel_id])\n if !@channel.blank?\n @visit = Visit.where(user_id: current_user.id, visitable_id: @channel.id, visitable_type: 'Channel').first\n if !@visit.blank?\n @visit.destroy\n end\n Visit.create(user_id: current_user.id, visitable_id: @channel.id, visitable_type: 'Channel')\n @activity = Activity.create(user_id: current_user.id, activity_type: 'View', target_type: 'Channel', target_id: @channel.id)\n end\n end",
"def broadcast_to_channel(channel)\n\t\tmessage = { :channel => channel, :data => channel }.to_json\n\t\turi = URI.parse(PUSH_SERVER)\n\t\tNet::HTTP.post_form(uri, :message => message)\n\tend",
"def create_dm(recipient_id)\n request(Route.new(:POST, '/users/@me/channels'), json: { recipient_id: recipient_id })\n end",
"def user_channel_params\n params.require(:user_channel).permit(:user_id, :channel_id)\n end",
"def create_group_dm(access_tokens, nicks: :undef)\n json = filter_undef({ access_tokens: access_tokens, nicks: nicks })\n request(Route.new(:POST, '/users/@me/channels'), json: json)\n end",
"def create\n @channel = Channel.new(channel_params)\n @tags = params[:tags].split(',')\n @tagged = []\n if !current_user.id.blank?\n @channel.user_id = current_user.id\n end\n respond_to do |format|\n if @channel.save\n @activity = Activity.create(user_id: current_user.id, activity_type: 'Create', target_type: 'Channel', target_id: @channel.id)\n for tag in @tags\n if !tag.blank?\n @tag = Tag.where(title: tag).first\n if @tag.blank?\n @tag = Tag.create(title: tag, user_id: current_user.id)\n end\n @tagging = Tagging.create(taggable_id: @channel.id, taggable_type: 'Channel', tag_id: @tag.id)\n end\n end\n if params[:channel][:avatar].blank?\n format.html { redirect_to '/channels?channel_id='+@channel.id.to_s, notice: :channel_was_successfully_created }\n else\n format.html { redirect_to '/channels/cropper/'+@channel.id.to_s}\n end\n format.json { render :show, status: :created, location: @channel }\n else\n format.html { render :new }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @user_to_channel_subscription = UserToChannelSubscription.new(user_to_channel_subscription_params)\n\n respond_to do |format|\n if @user_to_channel_subscription.save\n format.html { redirect_to @user_to_channel_subscription, notice: 'User to channel subscription was successfully created.' }\n format.json { render :show, status: :created, location: @user_to_channel_subscription }\n else\n format.html { render :new }\n format.json { render json: @user_to_channel_subscription.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subscribe_to_channel; end",
"def create\n @category_of_playlists_channel = CategoryOfPlaylistsChannel.new(category_of_playlists_channel_params)\n\n respond_to do |format|\n if @category_of_playlists_channel.save\n format.html { redirect_to @category_of_playlists_channel, notice: 'Category of playlists channel was successfully created.' }\n format.json { render :show, status: :created, location: @category_of_playlists_channel }\n else\n format.html { render :new }\n format.json { render json: @category_of_playlists_channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subscribe\n Socky.send( {:action => \"subscribe\",\n :channel => params[:channel],\n :client => (params[:client_id] || '')}.to_json)\n render :text => \"ok\"\n end",
"def create_channel(data)\n channel = Channel.new(data, self)\n server = channel.server\n\n # Handle normal and private channels separately\n if server\n server.channels << channel\n @channels[channel.id] = channel\n else\n @private_channels[channel.id] = channel\n end\n end",
"def create\n @channel_user = ChannelUser.new(channel_user_params)\n\n respond_to do |format|\n if @channel_user.save\n format.html { redirect_to @channel_user, notice: 'Channel user was successfully created.' }\n format.json { render :show, status: :created, location: @channel_user }\n else\n format.html { render :new }\n format.json { render json: @channel_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_to_channel \n new_shared_video ||= Video.add_video_to_channel!(current_user, \n params[:video_id],\n params[:channel_id], \n params[:channel_name],\n params[:channel_is_private])\n \n if new_shared_video.errors.any?\n render :json => { :error => get_errors_for_class(new_shared_video).to_sentence },\n :status => :unprocessable_entity\n else\n render :nothing => true, :status => :created\n end\n end",
"def create\n @channel = Channel.new(channel_params)\n @listener = Listener.create(dj: true)\n session[:current_listener_id] = @listener.id\n #gon.dj= @listener.dj\n\n respond_to do |format|\n if @channel.save\n format.html { redirect_to @channel, notice: 'Channel was successfully created.' }\n format.json { render :show, status: :created, location: @channel }\n else\n format.html { render :new }\n format.json { render json: @channel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_facebook_channel(project_id, opts = {})\n post \"projects/#{project_id}/facebookchannels\", opts\n end",
"def channels \n debug [query[\"channels\"], \" are registered channels\"]\n @channels ||= query[\"channels\"].collect(&:strip).reject(&:empty?) \n @channels[0] ||= nil # Every user should have at last one channel\n @channels\n end",
"def publish(channels, item)\n @clients.each do |pub|\n pub.publish(channels, item)\n end\n end",
"def channel_params\n params.require(:channel).permit(:name, :abstract, :parent_channel_id, :parent_comment_id)\n end",
"def active_channels\n channels = Channel.where(:active => true)\n json_response(channels)\n end",
"def channel\n params['channel'].gsub('/','')\n end",
"def index\n @channels = ChannelDecorator.all\n\n respond_with @channels\n end",
"def create\n @channel_category = ChannelCategory.new(params[:channel_category])\n\n respond_to do |format|\n if @channel_category.save\n format.html { redirect_to marketing_channel_category_path(@channel_category), notice: 'Channel category was successfully created.' }\n format.json { render json: @channel_category, status: :created, location: @channel_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @channel_category.errors, status: :unprocessable_entity }\n end\n end\n end",
"def channels; end",
"def slack_channel_params\n params.require(:slack_channel).permit(:slack_channel_id, :name, :is_general, :is_archived, :is_channel, :created_date, :slack_code, :last_read, :unread_count, :slack_team_id)\n end",
"def create_channel(data)\n channel = data.is_a?(Discordrb::Channel) ? data : Channel.new(data, self)\n server = channel.server\n\n # Handle normal and private channels separately\n if server\n server.add_channel(channel)\n @channels[channel.id] = channel\n elsif channel.private?\n @pm_channels[channel.recipient.id] = channel\n elsif channel.group?\n @channels[channel.id] = channel\n end\n end",
"def create\n megam_rest.post_subscriptions(to_hash)\n end",
"def all\r\n channels = Channel.all.order(:id)\r\n render json: channels\r\n end",
"def subscribed_channels\n @channels\n end",
"def create\n if @chatty_crow_channel.save\n flash[:notice] = l(:notice_successful_create)\n redirect_to_plugin_settings\n else\n render action: :new\n end\n end",
"def set_universal_channel\n @universal_channel = UniversalChannel.find(params[:id])\n end",
"def create\n @channel = Channel.find(params[:channel_id])\n @message = @channel.messages.build(message_params)\n\n respond_to do |format|\n if @message.save\n format.json { render json: @message, status: :created }\n else\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_private(token, bot_user_id, user_id)\n request(\n __method__,\n :post,\n \"#{api_base}/users/#{bot_user_id}/channels\",\n { recipient_id: user_id }.to_json,\n Authorization: token,\n content_type: :json\n )\n rescue RestClient::BadRequest\n raise 'Attempted to PM the bot itself!'\n end",
"def create_private(token, bot_user_id, user_id)\n request(\n __method__,\n :post,\n \"#{api_base}/users/#{bot_user_id}/channels\",\n { recipient_id: user_id }.to_json,\n Authorization: token,\n content_type: :json\n )\n rescue RestClient::BadRequest\n raise 'Attempted to PM the bot itself!'\n end",
"def admin_channel_params\n params.require(:admin_channel).permit(:user_id, :parent_id, :typo, :title, :short_title, :tmp_index, :tmp_list, :tmp_detail, :keywords, :description, :image_path, :content)\n end",
"def create\n conversation = Conversation.new(conversation_params)\n # If the converstation is created and saved, then it will\n # broadcast the channel to the front end\n if conversation.save\n serialized_data = ActiveModelSerializers::Adapter::Json.new(\n ConversationSerializer.new(conversation)\n ).serializable_hash\n ActionCable.server.broadcast 'conversations_channel', serialized_data\n head :ok\n end\n end",
"def new\n @role = Role.find(2) \n @channels = @role.users\n @channel_info = ChannelInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel_info }\n end\n end",
"def notification_channel_params\n params.require(:notification_channel).permit(:name)\n end",
"def new\n @channel_status = ChannelStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel_status }\n end\n end",
"def do_publish(params)\n content_type 'text/plain', :charset => 'utf-8'\n unless params['hub.url'] and not params['hub.url'].empty?\n throw :halt, [400, \"Bad request: Empty or missing 'hub.url' parameter\"]\n end\n begin\n # TODO: move the subscribers notifications to some background job (worker?)\n hash = Topic.to_hash(params['hub.url'])\n topic = DB[:topics].filter(:url => hash)\n if topic.first # already registered\n # minimum 5 min interval between pings\n #time_diff = (Time.now - topic.first[:updated]).to_i\n #throw :halt, [204, \"204 Try after #{(300-time_diff)/60 +1} min\"] if time_diff < 300\n topic.update(:updated => Time.now, :dirty => 1)\n # only verified subscribers, subscribed to that topic\n subscribers = DB[:subscriptions].filter(:topic_id => topic.first[:id], :state => 0)\n atom_diff = Topic.diff(params['hub.url'], true)\n postman(subscribers, atom_diff) if (subscribers.count > 0 and atom_diff)\n topic.update(:dirty => 0)\n else \n DB[:topics] << { :url => hash, :created => Time.now, :updated => Time.now }\n end\n throw :halt, [204, \"204 No Content\"]\n rescue Exception => e\n throw :halt, [404, e.to_s]\n end\n end",
"def publish(channel, data)\n @ws.send(get_publish_object(channel, data, increment_cnt).to_json)\n end",
"def create\n @channel_statistic = ChannelStatistic.new(channel_statistic_params)\n\n respond_to do |format|\n if @channel_statistic.save\n format.html { redirect_to @channel_statistic, notice: 'Channel statistic was successfully created.' }\n format.json { render :show, status: :created, location: @channel_statistic }\n else\n format.html { render :new }\n format.json { render json: @channel_statistic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def channels_to_objects(json)\n\t\tchannels = []\n\t\tjson['channels'].each do |channel|\n\t\t\tchannels.push(Channel.new(id: channel['id'], name: channel['name'], published: published(channel)))\t\n\t\t\tputs \"#{channel['id']} | #{channel['name']} | #{published(channel)}\"\t\n\t\tend\n\n\t\tchannels\n\tend",
"def list_resources\n 'channels'\n end",
"def service\r\n channels = Channel.where(service: channel_params[:service])\r\n render json: channels\r\n end"
] |
[
"0.6960062",
"0.6919562",
"0.6829159",
"0.6677903",
"0.6661259",
"0.6661259",
"0.6650474",
"0.6621106",
"0.65518177",
"0.65156364",
"0.6491725",
"0.6481573",
"0.6462334",
"0.6442045",
"0.6376603",
"0.63719517",
"0.6329773",
"0.6310013",
"0.62715197",
"0.6236849",
"0.6235597",
"0.62251854",
"0.62131065",
"0.6184016",
"0.61769444",
"0.61612797",
"0.61607605",
"0.612586",
"0.61214",
"0.611077",
"0.6092876",
"0.6092522",
"0.6089774",
"0.6081213",
"0.6067565",
"0.6059354",
"0.60563755",
"0.60493493",
"0.60287654",
"0.60236526",
"0.6013808",
"0.6002615",
"0.599681",
"0.59874415",
"0.5979822",
"0.59751934",
"0.59527975",
"0.5941074",
"0.59397095",
"0.59397095",
"0.5935379",
"0.5934757",
"0.5923498",
"0.59105223",
"0.58928615",
"0.589128",
"0.58740175",
"0.58376133",
"0.58326906",
"0.583216",
"0.58204806",
"0.58091664",
"0.58009905",
"0.5787802",
"0.5782125",
"0.57811064",
"0.5775756",
"0.57643116",
"0.57610196",
"0.5747133",
"0.5739982",
"0.5716079",
"0.57079935",
"0.5699052",
"0.5695965",
"0.569588",
"0.5692871",
"0.56831336",
"0.5677437",
"0.5675054",
"0.5666499",
"0.56426585",
"0.5639725",
"0.5637317",
"0.56241846",
"0.5622357",
"0.5621841",
"0.5617124",
"0.5617124",
"0.5610484",
"0.5610434",
"0.5605217",
"0.5603163",
"0.5600116",
"0.5598833",
"0.5595781",
"0.5580584",
"0.55796564",
"0.55646193",
"0.5561334"
] |
0.5627308
|
84
|
Add more helper methods to be used by all tests here...
|
def fixture_file_path(filename)
Rails.root.join('test', 'fixtures', 'files', filename).to_s
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_legacy_helpers\n assert_equal @patron.primary_phone, @patron.primary_address_phone\n assert_equal @patron.secondary_phone, @patron.secondary_address_phone\n assert_nil @patron.primary_address_mobile_phone\n assert_nil @patron.secondary_address_mobile_phone\n end",
"def helpers; end",
"def helpers; end",
"def helpers; end",
"def my_tests\n end",
"def tests; end",
"def tests; end",
"def testing\n # ...\n end",
"def test_legacy\n # Set up legacy handlers\n setup_legacy_handling\n\n common_tests\n end",
"def test_method\n end",
"def define_helpers; end",
"def test_defaults\n end",
"def self_test; end",
"def self_test; end",
"def test_case; end",
"def default_test; end",
"def default_test\r\n end",
"def default_test\n end",
"def __dummy_test__\n end",
"def test_added_methods\r\n assert_respond_to @default_user, :roles\r\n assert_respond_to @default_user, :has_role?\r\n \r\n assert_respond_to @default_user, :permissions\r\n assert_respond_to @default_user, :has_static_permission?\r\n end",
"def test_nothing\n end",
"def default_test\n end",
"def test_cases; end",
"def test_users_searches\n do_users_all\n do_simple_query\n do_tag_query\n do_profile_query\n end",
"def stest_method_1(test); end",
"def test_should_eat()\n yay_or_nay = should_eat(\"ice cream\", \"winter\")\n assert_equal(\"False\", should_eat)\n end",
"def test_nothing\n end",
"def should; super end",
"def before_test(test); end",
"def before_test(test); end",
"def spec; end",
"def spec; end",
"def test_entry_attrs\n raise \"Implement this method in your test class\"\n end",
"def test_get_content_for\n end",
"def test\n end",
"def test\n end",
"def test\n end",
"def test_hack\n assert(true)\n end",
"def test_pet_shop_name # this uses a function calles pet_shop_name ans passes in the argument @petshop (which contains the list of pets and admin info)\n name = pet_shop_name(@pet_shop) # the function should pull out the the name:\n assert_equal(\"Camelot of Pets\", name) # should return Camelot of pets\n end",
"def test \n end",
"def test_nothing; end",
"def test_entry_attrs\n raise 'Implement the method \"test_entry_attrs\" in your test class'\n end",
"def test\n\n end",
"def compare_tests(test_a, test_b); end",
"def compare_tests(test_a, test_b); end",
"def assertions; end",
"def assertions; end",
"def test_setup\r\n \r\n end",
"def test_truth\n end",
"def build_test_helper \n \n return if skip_method(__method__)\n \n puts \"build Rails test helper for #{model_name} in test/helpers\"\n filename = \"#{plural_table_name}_helper_test.rb\"\n\n template = File.read(template(\"rails/test/helper_test.rb\"))\n # #text = ERB.new(template, nil, '-').result(binding)\n text = Erubis::Eruby.new(template).evaluate( self )\n\n path = namespaced_path(\"test/helpers\",filename)\n write_artifact(path,text) \n end",
"def make_assertions_on_tests( tests, method )\n assert_equal false, tests[:bad].__send__( method )\n assert_equal true, tests[:good].__send__( method )\n assert_equal true, tests[:extra_good].__send__( method )\n end",
"def default_test\n end",
"def default_test\n end",
"def test_entry\n raise \"Implement this method in your test class\"\n end",
"def helper_method(*methods); end",
"def integration_test()\n return [\"all\"]\n end",
"def test_entry\n raise 'Implement the method \"test_entry\" in your test class'\n end",
"def test_order; end",
"def test_nothing\n return true\n end",
"def test_a\n end",
"def test_frameworks; end",
"def prepare_helpers\n base = File.join(config[:test_base_path], \"helpers\")\n\n helper_files.each do |src|\n dest = File.join(sandbox_suites_dir, src.sub(\"#{base}/\", \"\"))\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest, preserve: true)\n end\n end",
"def smoke_test ()\n\n smoke_test = [\"rest_get\"]\n return smoke_test\n end",
"def add_testing\n setup_rspec\n setup_rspec_generators\n setup_rails_helper\n setup_factories_file\nend",
"def testHelper arr, description, expected\n\tresult = leastOccuringValueInArray(arr)\n\tString resultType = result.class\n\t \n\tString testStatus = \"Failed\"\n\tif (leastOccuringValueInArray(arr).class == expected.class)\n\t\t(leastOccuringValueInArray(arr) == expected)? testStatus = \"Passed\" : testStatus = \"Failed\"\n\tend\n\t\n\t# Print test results\n\tputs \"| \" + testStatus + \" | \" + description + \", expected: \" + expected.to_s + \"(\" + expected.class.to_s + \")\" + \", actual: \" + result.to_s + \"(\" + resultType.to_s + \")\"\nend",
"def test_respond_to\n assert_respond_to system_wide, :role\n assert_respond_to system_wide, :role=\n assert_respond_to system_wide, :inspect\n assert_respond_to system_wide, :object_id\n end",
"def final_test_methods\n return []\n end",
"def tests=(_arg0); end",
"def tests=(_arg0); end",
"def running_test_case; end",
"def test\n return \"\ndef test_#{@test_name}\n assert_nothing_raised(#{self.class.name}) do\n #{@method} :#{@action}, #{@params.inspect}, #{@session.inspect}, #{@flash.inspect}\n end\nend\n\"\n end",
"def smoke_test()\n return [\"case_aaaa\"]\n end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def setup; end",
"def test_guest_name\n assert_equal('Peter', @guest1.return_guest_name)\n end",
"def test_truth\n april = riders(:rider_1)\n assert_equal \"April Jones\", april.name\n trigger = horses(:horse_1)\n assert_equal \"Trigger\", trigger.name\n event2 = events(:event_2)\n assert_equal \"5 Horse Scramble\", event2.name\n \n end",
"def generate_alltest\n\n end",
"def test_camel_case\n raise NotImplementedError, 'Undecided as to whether to check camel case or not'\n end",
"def test_find_single_item\n\n result=find_single_item(@warehouse_data, :b7)\n assert_equal(\"bath fizzers\",result)\n \nend",
"def test_autocomplete_searches\n do_find_all\n do_autocomplete_query\n end",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend",
"def my_array_splitting_method(source)\n source # This line is here to make sure all tests initially fail. Delete it when you begin coding.\nend"
] |
[
"0.7330966",
"0.701972",
"0.701972",
"0.701972",
"0.6772961",
"0.6679903",
"0.6679903",
"0.6583205",
"0.65507036",
"0.6377433",
"0.63762784",
"0.632961",
"0.6280821",
"0.6280821",
"0.6249786",
"0.6142927",
"0.6137607",
"0.6121912",
"0.6108209",
"0.60972595",
"0.60949636",
"0.6085482",
"0.6077252",
"0.60748607",
"0.603319",
"0.60055846",
"0.60010356",
"0.59755695",
"0.5975158",
"0.5975158",
"0.5973282",
"0.5973282",
"0.59555405",
"0.59167516",
"0.59057903",
"0.59057903",
"0.59057903",
"0.5894578",
"0.5886192",
"0.58858806",
"0.5885474",
"0.58805525",
"0.5860731",
"0.5860412",
"0.5860412",
"0.584998",
"0.584998",
"0.58033717",
"0.5794802",
"0.5785648",
"0.57691133",
"0.57356757",
"0.57356757",
"0.5733712",
"0.5718457",
"0.569885",
"0.5686251",
"0.56847906",
"0.56680214",
"0.5660432",
"0.56465375",
"0.5645647",
"0.5644992",
"0.56355596",
"0.5591017",
"0.55830294",
"0.5579137",
"0.55729306",
"0.55729306",
"0.5563504",
"0.555469",
"0.55488664",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.5540873",
"0.55373555",
"0.5536957",
"0.55365646",
"0.5536232",
"0.5533716",
"0.5533225",
"0.5530253",
"0.5530253",
"0.5530253",
"0.5530253"
] |
0.0
|
-1
|
Using this for the review query.
|
def book_title
self.title
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def review; end",
"def review\n end",
"def review\n @review\n end",
"def review\n fetch('restaurant.review')\n end",
"def show\n @search = Review.where(book_id: @book.id).search(params[:q])\n @reviews = @search.result.paginate(:page => params[:page]).order(rating: :desc)\n @search.build_condition\n end",
"def review(*)\n super.tap do\n __debug_sim('REVIEWER initiates review of the submission.')\n end\n end",
"def show\n @reviews = Review.select { |review| review.item_id == @item.id }\n @review = Review.new(item_id: @item.id)\n @ratingSum = 0.0\n @reviews.each do |review|\n @ratingSum = @ratingSum + review.rating\n end\n @avgRating = (@ratingSum/@reviews.count).round(1)\n if logged_in?\n @isPrevRented = Rental.find_by(user_id: current_user.id, history: true, item_id: params[:id])\n @isPrevReviewed = Review.find_by(user_id: current_user, item_id: params[:id])\n end\n @rentals = Rental.where(item_id: params[:id], history: true)\n end",
"def review\n @users = User.all\n @review = Review.new\n end",
"def view_reviews\n @submission = Submission.find(params[:id])\n @questions = @submission.assignment.questions.sort_by {|obj| obj.created_at }\n evaluation = @evaluations.where(:user_id => current_user.id)[0]\n @responses = @evaluations[0].responses.sort_by {|obj| obj.created_at }\n\n respond_to do |format|\n format.html { render view, :layout => 'no_sidebar' } # show.html.erb\n format.json { render json: @submission }\n end\n end",
"def ratings_query\n super\n end",
"def execute(input_set = nil)\n resp = super(input_set)\n results = GetReviewsResultSet.new(resp)\n return results\n end",
"def set_reviews\n @reviews = Review.where(restaurant_id: @restaurant.id).order(\"created_at DESC\")\n end",
"def review_set\n return @review_set\n end",
"def get_reviews\n @comment_reviews = CommentReview.where('comment_id = ?', params[:comment_id])\n end",
"def reviews\n @items = ProductComment.includes(:account).where({product: @product}).all\n end",
"def find_review\n @review = Review.find(params[:id])\n end",
"def review_feedback\n @reviews = Feedback.where(:expert_id => params[:expert_id]).order(\"id DESC\")\n @review_list = []\n @reviews.each do |review|\n @review_list << {:consumer_id => review.user_id, :consumer_name=> review.user.username,\n :exp_id => review.expert_id, :exp_name => review.expert.first_name,\n :job_id => review.job_id, :issue_name => review.job.issue_name,\n :rating => review.rating, :feedback => review.description, :comp_date => review.job.complete_date, \n :status => review.job.status, :current_status => review.job.current_status}\n end \n end",
"def show\n @review = find_review\n end",
"def show\n @owner_id = @product.originaluser_id \n # @reviews = Review.where('owner_id = ?', @owner_id)\n @reviews = Review.where('owner_id = ?', @owner_id).where('reviews.approved = ?', true)\n \n # Review.joins(:user).where('reviews.approved = ?', true).where('users.id = ?', @owner_id)\n end",
"def reviews\n self.reviews\n end",
"def rating\n # review = Review.where(user_id: user.id, video_id: video.id).first\n #review = Review.find_by(user_id: user.id, video_id: video.id)\n review.rating if review\n end",
"def find_review\n Review.find(params[\"id\"])\n end",
"def my_job_review(job)\n # TODO: Check this, because of\n # my_qualifications issues in sql query construction\n Review.where.not(id: job.reviews.where(owner: self).pluck(:id).compact).first\n end",
"def find_review\n\t\t\t@review = Review.find(params[:id])\n\t\tend",
"def index\n # this is our list page for our review\n # variable is @.\n # creating a filter variable for price\n @price = params[:price]\n #creating a filter variable for cuisine\n @cuisine = params[:cuisine]\n # adding location filter using geocoder\n @location = params[:location]\n\n #filtering properly by get all the reviews \"Review\" model from the database\n #creating new review variable as ruby list[]\n #@reviews = [\"The Smile\", \"Baby Bo's\", \"Chipotle\", \"nandos\"]\n @reviews = Review.all\n\n # filtering by price. this will toggle on/off depend when it has filter\n if @price.present?\n #take all of the review we have and replace the original review with filtered ones\n # find the value of the price in db that matches the param above\n @reviews = @reviews.where(price: @price)\n end\n\n #filter by cuisine\n if @cuisine.present?\n @reviews = @reviews.where(cuisine: @cuisine)\n end\n #search near the location\n if @location.present?\n # .near is what geo lcation given to us - see docs\n @reviews = @reviews.near(@location)\n end\n\n end",
"def reviews\n reviews = []\n katas = Kata.all\n katas.each { |k| reviews += k.reviews.where(user_id: self.id) }\n return reviews\n end",
"def my_reviews\n @owner = current_user\n @reviews = Review.find(:all, :conditions => [\"user_id = ?\", @owner.id])\n render :action => \"index\"\n end",
"def show\n #this is going to be the individual review page using no. in db row using params array of :id. make sure we now create view page\n @review = Review.find(params[:id])\n end",
"def set_review\n @agency_review = Review.find(params[:review_id])\n end",
"def expand_reviews\n @twitter_id = params[:twitter_id]\n @sentiment = params[:sentiment]\n @total_count = params[:count].to_i\n @page = (params[:page] || 1).to_i\n @limit = 25 # hard code for now\n @final_page = (@total_count - 1)/@limit + 1\n _build_pagination_array\n offset = (@page -1 ) * @limit\n @replies = Tweet.replies(@twitter_id, @sentiment, offset, @limit)\n end",
"def my_results(user)\n self.design_review_results.to_ary.find_all { |drr| drr.reviewer == user }\n end",
"def index\n if related_product_label = params[:search] and related_product_label = params[:search][:related_product]\n @related_product = Product.first(:label => related_product_label)\n end\n @max_nb_reviews = params[:max_nb_reviews] || 100\n @date_oldest = if date_oldest = params[:date_oldest]\n Date.new(Integer(date_oldest[\"year\"]), Integer(date_oldest[\"month\"]), Integer(date_oldest[\"day\"]))\n else\n Date.today - 1000\n end\n\n @output_mode = params[:output_mode] || \"standard\"\n @source_categories = params[:source_categories]\n @source_categories ||= Review.categories.collect { |category_name, weight| category_name }\n @state_names = params[:state_names]\n @state_names ||= Review.list_states.collect(&:first)\n\n\n select_options = { :category => @source_categories,\n :state => @state_names,\n :limit => @max_nb_reviews,\n :written_at => { '$gt' => @date_oldest.to_time },\n :order => \"written_at DESC\" }\n select_options[\"product_ids\"] = @related_product.id if @related_product\n\n # puts \"selection options=#{select_options.inspect}\"\n @reviews = Review.all(select_options)\n @nb_reviews = @reviews.size\n\n if @output_mode == \"xml\"\n render(:xml => Rcollection.new(@current_user.rpx_username, \"xml output #{Time.now}\", @reviews) )\n else\n # index.html.erb\n end\n\n\n end",
"def my_reviews\n self.reviews.select do |review|\n review.user.id = self.id \n end \n end",
"def reviews\n @reviews\n end",
"def index\n if current_user.type == \"Student\"\n @reviews = Review.all.search(params[:search])\n \n else\n @reviews = current_user.reviews\n end\n @review = Review.new\n end",
"def get_initial_reviews\n\n\t\t# return api call for just one review\n\tend",
"def review\n # unapproved post viewer\n # MAKE ADMIN ONLY\n @posts = Post.order(\"approved, created_at desc\")\n .paginate(per_page: 7, page: params[:page])\n end",
"def rating\n review.rating if review\n end",
"def find_reviews_by_user(user) \n reviewable = ActiveRecord::Base.send(:class_name_of_active_record_descendant, self).to_s\n \n Review.find(:all,\n :conditions => [\"user_id = ? and reviewable_type = ?\", user.id, reviewable],\n :order => \"created_at DESC\"\n )\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def show\n @id=params[:id]\n @pics = Picture.where(post_id_fk: @id)\n @reviews=Review.where(post_idfk: @id)\n\n @re=Review.new\n\n end",
"def set_review\n @restaurant_review = RestaurantReview.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def review\n @t = T\n @t = @t.paginate :page => params[:page], :per_page => params[:per_page]\n @data = @t.meanings\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @t }\n end\n end",
"def get_relevance(reviews, submissions, num_reviews, pos_tagger, core_NLP_tagger, speller)\n review_vertices = nil\n review_edges = nil\n subm_vertices = nil\n subm_edges = nil\n num_rev_vert = 0\n num_rev_edg = 0\n num_sub_vert = 0\n numSubEdg = 0\n vert_match = 0.0\n edge_without_syn = 0.0\n edge_with_syn = 0.0\n edge_diff_type = 0.0\n double_edge = 0.0\n double_edge_with_syn = 0.0\n \n #since Reviews and Submissions \"should\" contain the same number of records review - submission pairs\n g = GraphGenerator.new\n #generating review's graph\n g.generate_graph(reviews, pos_tagger, core_NLP_tagger, true, false)\n review_vertices = g.vertices\n review_edges = g.edges\n num_rev_vert = g.num_vertices\n num_rev_edg = g.num_edges\n \n #assigning graph as a review graph to use in content classification\n @review = g.clone\n \n #generating the submission's graph\n g.generate_graph(submissions, pos_tagger, core_NLP_tagger, true, false)\n subm_vertices = g.vertices\n subm_edges = g.edges\n num_sub_vert = g.num_vertices\n num_sub_edg = g.num_edges\n\n compareVerticesObj = CompareGraphVertices.new\n compareSVOEdgesObj = CompareGraphSVOEdges.new\n compareEdgesObj = CompareGraphEdges.new\n @vertex_match, vert_match = compareVerticesObj.compare_vertices(@vertex_match, pos_tagger, review_vertices,\n subm_vertices, num_rev_vert, num_sub_vert, speller)\n\n if(num_rev_edg > 0 and num_sub_edg > 0)\n @vertex_match, edge_without_syn =\n compareEdgesObj.compare_edges_non_syntax_diff(@vertex_match, review_edges, subm_edges,num_rev_edg, num_sub_edg)\n @vertex_match, edge_with_syn =\n compareEdgesObj.compare_edges_syntax_diff(@vertex_match, review_edges, subm_edges,num_rev_edg, num_sub_edg)\n @vertex_match, edge_diff_type =\n compareEdgesObj.compare_edges_diff_types(@vertex_match, review_edges, subm_edges,num_rev_edg, num_sub_edg)\n edge_match = (edge_without_syn.to_f + edge_with_syn.to_f )/2.to_f #+ edge_diff_type.to_f\n @vertex_match, double_edge =\n compareSVOEdgesObj.compare_SVO_edges(review_edges, subm_edges,num_rev_edg, num_sub_edg)\n @vertex_match, double_edge_with_syn =\n compareSVOEdgesObj.compare_SVO_diff_syntax(review_edges, subm_edges,num_rev_edg, num_sub_edg)\n double_edge_match = (double_edge.to_f + double_edge_with_syn.to_f)/2.to_f\n else\n edge_match = 0\n double_edge_match = 0\n end\n \n #differently weighted cases\n #tweak this!!\n alpha = 0.55\n beta = 0.35\n gamma = 0.1 #alpha > beta > gamma\n\n #case1's value will be in the range [0-6] (our semantic values)\n relevance = (alpha.to_f * vert_match.to_f) + (beta * edge_match.to_f) + (gamma * double_edge_match.to_f)\n scaled_relevance = relevance.to_f/6.to_f #scaled from [0-6] in the range [0-1]\n\n return scaled_relevance\nend",
"def show\n @fullwidth = true\n if @user.is_artist\n @artist = @user\n if user_signed_in?\n @review = Review.find_by(receiving_user_id: @artist.id, leaving_user_id: current_user.id)\n @review.nil? ? @review = Review.new : @review\n end\n @reviews = @artist.received_reviews.page(params[:page]).order('updated_at DESC').per(25)\n @artist.view_count.present? ? @artist.view_count += 1 : @artist.view_count = 0\n @artist.save\n else\n @reviews = @user.left_reviews.page(params[:page]).order('updated_at DESC').per(25)\n end\n if params[:review].present?\n top_review = Review.find(params[:review])\n if params[:response_link].present?\n render 'show', locals: {top_review: top_review, response_link: true}\n else\n render 'show', locals: {top_review: top_review}\n end\n else\n respond_to do |format|\n format.html { render 'show' }\n format.js { render action: 'paginate_reviews' }\n end\n end\n end",
"def reviews_as_owner\n Review.where(:product_id => product_ids)\n end",
"def set_review\n review = Review.find(params[:id])\n end",
"def review_count\n self.reviews.count\n end",
"def review_count\n self.reviews.count\n end",
"def review_count\n self.reviews.count\n end",
"def set_review\n @review=Review.find(params[:id])\n end",
"def show\n @reviews = Review.where(videogame_id: @videogame.id).order(\"created_at DESC\")\n \n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end",
"def show\n @restaurant = Restaurant.find(params[:id])\n @reviews = Review.where(restaurant_id: params[:id])\n end",
"def review\n @user_quest = UsersQuest.find(params[:id])\n end",
"def index\n @reviews = Review.all\n @review = Review.new(review: params[:review][:review], my_book_id: params[:my_book_id])\n end",
"def review\n expose Challenge.review(@oauth_token,\n params[:technology] ||= nil, \n params[:platform] ||= nil, \n params[:category] ||= nil,\n params[:limit] ||= 25, \n params[:offset] ||= 0)\n end",
"def reviews\n # output = []\n # Review.all.each do |review|\n # if review.user == self\n # output << review\n # end\n # end\n # output\n Review.all.select { |review| review.user == self }\n end",
"def show\n @reviews = Review.where(project_id: @project.id).order(\"created_at DESC\")\n end",
"def my_reviews(user, game, tracer=2)\n router = nil\n message = []\n # base options\n reviews = Review.where(user_id: user.id).limit(32).order(:id)\n options = reviews.map do |review|\n game_name = Game.find(review.game_id).name\n game_name.length < 35 ? game_name = game_name + \" \" * (34 - game_name.length) : game_name = game_name[0,31] + \"...\"\n rat = review.rating.to_s\n until rat.length == 3\n rat = \" \" + rat\n end\n rev = review.review_text\n rev = rev[0,$sp[:w] - 54] + \"...\" if rev.length > $sp[:w] - 51\n line = [game_name + \" | \" + rat + \" | \" + rev, review.id * 100]\n line[0] = line[0] + \" \" * ($sp[:w] - line[0].length - 7) + \"|\\n\" + \" \" * $sp[:l] + \"|\" + \"-\" * ($sp[:w] - 2) if reviews[-1] == review\n line\n end\n options += [\n [\"Previous Menu\", tracer],\n [\"Main Menu\", 2],\n [\"Exit\", 1]\n ]\n until router\n display_menu_header([\"Your reviewed games:\", \"\", \" Game: 1-100: Review:\"], user)\n router = display_options_menu(options, message)\n message = [\"Sorry, invalid selection. Please choose again...\"]\n end\n menu_routing(user, Game.find(Review.find(router / 100).game_id), 15, 13) if router > 99\n menu_routing(user, game, router, 13)\nend",
"def get_Reviews(clean_isbn)\n\t\t# amazon_reviews = Amazon.new\n\t\t# amazon_reviews.get_amazon_review(clean_isbn)\n\t\tgreads_reviews = Getting_Goodreads_Reviews::Greads.new\n\t\tgreads_reviews.all_greads_reviews(clean_isbn)\nend",
"def review(rating)\n user = User.new\n user.read_creddentials\n user.login\n response = user.review rating\n if response\n puts 'Last food reviewed!'\n else\n puts 'Nothing to review'\n end\n end",
"def set_review\n\t\t@review = Review.find(params[:id])\n\tend",
"def index\n @reviews = Review.all\n \n end",
"def show\n @project = @design.project_id\n @reviews = Review.where(design_id: @design.id).order(\"created_at DESC\")\n if @reviews.blank?\n @avg_rating = 0\n else\n @avg_rating = @reviews.average(:rating).round(2)\n end\n end",
"def show\n if user_signed_in?\n @trigger = TriggerAction.pending_action(\"review_required\", current_user, @assignment)\n @my_answers = Answer.where(user: current_user, assignment: @assignment, active: true)\n @my_reviews = Review.where(answer_id: @my_answers, active: true, assignment_id: @assignment.id)\n\n if current_user.get_and_store_experimental_condition!(@assignment.course) == \"batched_email\"\n @my_reviews = Review.where(answer_id: @my_answers, active: true, assignment_id: @assignment.id).where('created_at < ?', 1.day.ago)\n end\n @reviews_by_me = Review.where(active: true, assignment_id: @assignment.id).where(\"user_id = ? or copilot_email = ?\", current_user.id,current_user.email)\n @out_of_box_answers_with_count = Review.where(assignment_id: @assignment.id, out_of_box_answer: true).group(:answer_id).count\n\n unless @out_of_box_answers_with_count.blank?\n @out_of_box_answers = @out_of_box_answers_with_count.reject {|k,v| v < 2 }\n end\n if @out_of_box_answers.blank?\n @out_of_box_answers = {}\n end\n end\n @all_answers = @assignment.answers.reviewable.limit(10)\n @starred_answers = @assignment.answers.reviewable.where(starred: true)\n render layout: \"one_column\"\n end",
"def review_count\n reviews.count\n end",
"def count_ratings\n self.reviews.all.count\n end",
"def openstruct_reviews\r\n @shop.reviews\r\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end",
"def set_review\n @review = Review.find(params[:id])\n end"
] |
[
"0.6924698",
"0.68394214",
"0.65308785",
"0.63406754",
"0.6249963",
"0.62260455",
"0.6172125",
"0.6141527",
"0.60832494",
"0.6059209",
"0.60572183",
"0.60331154",
"0.6030414",
"0.6015279",
"0.6011027",
"0.6005913",
"0.5973382",
"0.59686726",
"0.5963196",
"0.59597284",
"0.59510344",
"0.59141076",
"0.5909195",
"0.5903674",
"0.58922875",
"0.5887775",
"0.5882674",
"0.58822006",
"0.5871999",
"0.58625555",
"0.58561707",
"0.5849118",
"0.5842617",
"0.582816",
"0.58246785",
"0.58159804",
"0.57857144",
"0.577181",
"0.57452035",
"0.57432425",
"0.57432425",
"0.57432425",
"0.57432425",
"0.57432425",
"0.57432425",
"0.57432425",
"0.57425797",
"0.5736595",
"0.5709529",
"0.5704157",
"0.5700687",
"0.56955093",
"0.5690083",
"0.56798947",
"0.5679489",
"0.5679489",
"0.5679489",
"0.56709033",
"0.5665783",
"0.566145",
"0.56574017",
"0.56565195",
"0.56561863",
"0.56494546",
"0.5648852",
"0.5638878",
"0.56380814",
"0.56344175",
"0.56277275",
"0.5625119",
"0.5620755",
"0.5614909",
"0.5613861",
"0.5603576",
"0.56006366",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961",
"0.5598961"
] |
0.0
|
-1
|
Given a hash with numeric values, return the key for the smallest value
|
def key_for_min_value(name_hash)
lowvalue = 0
lowkey = nil
name_hash.each do |k, v|
if lowvalue == 0 || v < lowvalue
lowvalue = v
lowkey = k
end
end
lowkey
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n smallest_value = nil\n smallest_key = nil\n hash.each do |name, num|\n if smallest_value == nil || num < smallest_value\n smallest_value = num\n smallest_key = name\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n min_val = Float::INFINITY\n min_key = nil\n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n \n min_val = Float::INFINITY\n min_key = nil\n hash.each do |k, v|\n if min_val > v\n min_val = v\n min_key = k\n end\n end\n return min_key\nend",
"def key_for_min_value(hash)\n smallest_key = nil\n tiny_value = nil\n hash.each do |key, value|\n if tiny_value == nil || value < tiny_value\n tiny_value = value\n smallest_key = key\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n smallest = nil\n key = nil\n hash.collect do |name, val|\n if smallest == nil || val < smallest\n smallest = val\n key = name\n end\n end\n key\nend",
"def key_for_min_value(hash)\n int_hash = hash.select { |key, val| val.class == Fixnum }\n smallest = int_hash[int_hash.keys.sample]\n # debugger\n int_hash.each do |key, val|\n if val < smallest\n smallest = val \n end\n end\n int_hash.key(smallest)\nend",
"def key_for_min_value(hash)\r\n smallest_key = nil\r\n tiniest_value = nil\r\n hash.each do |key, value|\r\n if tiniest_value == nil || value < tiniest_value\r\n tiniest_value = value\r\n smallest_key = key\r\n end\r\n end\r\n smallest_key\r\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = 0\n\n\n hash.each do |key,value|\n if lowest_value == 0 || value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n min = nil\n hash.each_pair do |key, value|\n min ||= value\n min = value if value < min\n end\n hash.key(min)\nend",
"def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n if smallest == nil\n smallest = key\n end\n if hash[key] < hash[smallest]\n smallest = key\n end\n end\n smallest\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n \n # this way, the smallest value in the hash so far always overwrites the existing tiniest value\n \n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend",
"def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |key, value|\n if hash_value == nil || value < hash_value\n hash_value = value\n hash_key = key\n end\n end\n hash_key\nend",
"def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n min = 99999999\n min_key = nil\n hash.select do |key, value|\n if value < min\n min = value\n min_key = key\n end\n end\n min_key\nend",
"def key_for_min_value(hash)\n if hash.empty?\n return nil\n end\n ans = [hash.first[0],hash.first[1]]\n hash.each do |k,v|\n if v < ans[1]\n ans[1] = v\n ans[0] = k\n end\n end\n return ans[0]\nend",
"def key_for_min_value(hash)\n key = nil\n lowest_value = nil\n hash.each do |name, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n key = name\n end\nend\nkey\nend",
"def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |a, b|\n if hash_value == nil || b < hash_value\n hash_value = b\n hash_key = a\n end\n end\n hash_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil \n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value \n lowest_value = value \n lowest_key = key \n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowestnum = 1000\n name_hash.each_value do |hashvalue|\n if hashvalue < lowestnum\n lowestnum = hashvalue\n end\n end\n name_hash.index(lowestnum)\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_number = nil\n name_hash.each do |name, number|\n if lowest_number == nil || number < lowest_number\n lowest_number = number\n lowest_key = name\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k,v|\n # first iteration\n ## this creates a starting point for comparison\n if lowest_value == nil || lowest_value > v\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n low = Float::INFINITY\n name_hash.each do |k,v|\n if v < low\n low = v\n end\n end\n name_hash.key(low)\nend",
"def key_for_min_value(hash)\n small_key = nil\n small_value = nil\n \n hash.each do |key, value|\n if small_value == nil || value < small_value\n small_value = value\n small_key = key\n end\nend\nsmall_key\nend",
"def key_for_min_value(hash)\n low_min = 1000\n min_key = nil\n hash.each do |key, value|\n if(low_min > value)\n low_min = value\n min_key = key\n end\nend\n min_key\nend",
"def key_for_min_value(name_hash)\n lowest = nil\n key = nil\n if name_hash.length == 0\n return \n end\n \n name_hash.each do |name, number|\n if lowest == nil\n lowest = number\n end\n if key == nil\n key = name\n end\n if number < lowest\n lowest = number\n key = name\n end\n end\n key\nend",
"def key_for_min_value(hash)\n least_value = nil \n least_key = nil\n hash.each do |a, b|\n if least_value == nil || b < least_value\n least_value = b\n least_key = a\n end\n end\n least_key\nend",
"def key_for_min_value(name_hash)\n\tif name_hash == {}\n\t\tnil\n\tend\n\n\tsmallest_key = nil\n\tsmallest_value = nil\n\tname_hash.each do |key, value|\n\t\tif !smallest_value || value < smallest_value\n\t\t\tsmallest_key = key\n\t\t\tsmallest_value = value\n\t\tend\n\tend\n\tsmallest_key\nend",
"def key_for_min_value(hash)\n i = 0\n lowest1 = :key\n lowest = 0\n if hash.empty? == true \n return nil\n end\n hash.each do |name, value|\n if i == 0\n lowest1 = name\n lowest = value\n i =+ 1\n end\n if value < lowest\n lowest1 = name\n lowest = value\n end\n if hash.empty? == true \n lowest1 = nil\n end\n end\n lowest1\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |name, amount|\n if amount < lowest_value\n lowest_value = amount\n lowest_key = name\n end\n end\n lowest_key\n end",
"def key_for_min_value(hash)\n lo_key = nil \n lo_value = nil \n hash.each do |k,v| \n if lo_key == nil || v < lo_value\n lo_key = k \n lo_value = v \n end \n end \n lo_key\n end",
"def key_for_min_value(hash)\n\n lowest_key = nil \n lowest_value = nil \n \n hash.each do |key,value|\n if lowest_value == nil || lowest_value > value\n\n lowest_key = key\n lowest_value = value \n end \n \n end \n lowest_key\nend",
"def key_for_min_value(name_hash)\n small_num = Float::INFINITY\n smallest_key = \"\"\n if name_hash.length == 0\n return nil\n end\n name_hash.each do |key, value|\n if value < small_num\n small_num = value\n smallest_key = key\n end\n end\nsmallest_key\nend",
"def key_for_min_value(hash)\n value_only_array = []\n hash.each_pair do |key, value|\n value_only_array << value\n end\n value_only_array.sort!\n hash.key(value_only_array[0])\nend",
"def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect {|key, value| value}.sort\n hash.each {|key, value| return key if value == arr[0]}\nend",
"def key_for_min_value(hash)\n array = []\n hash.each do |key, value|\n array << value\n end\n array.sort!\n hash.key(array[0])\nend",
"def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_value=Float::INFINITY\n name_hash.each{|key, value| \n if value<lowest_value\n lowest_value=value\n lowest_key=key\n end\n }\n lowest_key\nend",
"def key_for_min_value(name_hash)\n empty_hash = nil\n lowest_value = 10000000000000000000000\n name_hash.collect do |name, value|\n if value < lowest_value\n lowest_value = value\n empty_hash = name\n end\n end\n empty_hash\nend",
"def key_for_min_value(name_hash)\n lowest = \"\"\n lowest = nil if name_hash.empty?\n high_num = 100000000000000000\n name_hash.each do | key, value |\n lowest = key if value < high_num\n high_num = value if value < high_num\n end\n lowest\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name, num|\n if lowest_key == nil || num < lowest_value\n lowest_key = name\n lowest_value = num\n elsif name_hash == nil\n nil\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n num = nil\n name_hash.collect do |key, value|\n if value < num\n num = value\n end\n end \n name_hash.key(num)\nend",
"def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = nil\n name_hash.each do|key, val|\n if smallest_val == 0 || val < smallest_val\n smallest_val = val\n smallest_key = key\n end\n end\n smallest_key\n\nend",
"def key_for_min_value(name_hash)\n smallest_hash_key = nil\n name_hash.each do |key, val|\n if smallest_hash_key == nil\n smallest_hash_key = key\n next\n elsif val < name_hash[smallest_hash_key]\n smallest_hash_key = key\n end\n end\n smallest_hash_key\nend",
"def key_for_min_value(hash)\n if hash.count < 2\n return hash[0]\n else \n num = 42\n hash.each do |key, value|\n if value <= num\n num = value\n end\n end\n hash.invert[num] \n end\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_number = name_hash.first[1];\n key_value = \"\"\n name_hash.each do |key, value|\n if value <= lowest_number\n lowest_number = value\n key_value = key\n end\n end\n key_value\nend",
"def key_for_min_value(name_hash)\n current = 0\n lowest = 0\n lowest_key = nil\n name_hash.collect do |key, value|\n current = value\n if current < lowest || lowest == 0\n lowest = current\n lowest_key = key\n end\n\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowestvalue = 1000\n name_hash.each do |name, value|\n if value < lowestvalue\n lowest_key = name\n lowestvalue = value\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n small_value = 10000000000\n small_key = nil\n name_hash.each do |k,v|\n if v < small_value\n small_value = v\n small_key = k\n end\n end\n small_key\nend",
"def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |k, v|\n if low_value == nil || v < low_value\n low_value = v\n low_key = k\n end\n end\n low_key\n end",
"def key_for_min_value(hash)\n lowest_value = nil\n lowest_key = nil\n\n hash.each do |key, value|\n if lowest_value == nil # tell me if this makes sense\n lowest_value = value\n lowest_key = key\n elsif lowest_value > value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key #you want to return the key for min\nend",
"def key_for_min_value(hash)\n \n if hash.empty?\n return nil\n end\n min_value=500\n min_key=:symbol\n \n hash.each do |key, value|\n if value<min_value\n min_value=value\n min_key=key\n end\n end\n return min_key\nend",
"def key_for_min_value(name_hash)\n lowestKey = nil\n lowestValue = Float::INFINITY\n name_hash.each do |k, v|\n if v < lowestValue\n lowestValue = v\n lowestKey = k\n end\n end\n lowestKey\n\nend",
"def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = 0\n comp = nil\n name_hash.each do |key,val|\n comp = val\n if smallest_key == 0\n smallest_key = key\n smallest_val = val\n end \n if comp < smallest_val\n smallest_val = comp\n smallest_key = key\n end\n end\n if smallest_key == 0 \n return nil \n else\n return smallest_key\n end\nend",
"def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_val=0\n name_hash.collect do |key,value|\n if value<lowest_val or lowest_val==0\n lowest_key=key\n lowest_val=value\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n smallest = nil\n this_num = 0\n previous_num = 1000000\n name_hash.collect { |item, qty|\n this_num = qty\n if this_num < previous_num\n smallest = item\n previous_num = this_num\n end\n }\n smallest\nend",
"def key_for_min_value(name_hash)\n rkey = nil\n rvalue = 10000000000000000\n name_hash.each do |key, value|\n if value < rvalue\n rkey = key\n rvalue = value\n end\n end\n rkey\nend",
"def key_for_min_value(name_hash)\n\tsmallest_value = nil\n\tassociated_key = nil \n\tname_hash.collect do |key, value|\n\t\tif smallest_value == nil || value < smallest_value\n\t\t\tsmallest_value = value \n\t\t\tassociated_key = key\n\t \tend\n\tend\n\tassociated_key\nend",
"def key_for_min_value(hash)\n # binding.pry\n lowest_key = nil\n lowest_value = 0\n # binding.pry\n hash.each do |key, value|\n if lowest_key == nil || value < lowest_value\n # binding.pry\n lowest_value = value\n lowest_key = key\n # binding.pry\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n hash.key(hash.values.min)\nend",
"def key_for_min_value(hash)\n hash.key(hash.values.min)\nend",
"def key_for_min_value(name_hash)\n smallest_value = 100\n name_hash.each do |key, value| \n if value < smallest_value\n smallest_value = value \n end \n end\n name_hash.key(smallest_value)\nend",
"def key_for_min_value(name_hash)\n lowest=\"\"\n lowest=nil if name_hash.empty?\n tracker=100000000\n name_hash.each do |key,value|\n lowest=key if value<tracker\n tracker=value if value<tracker\n # if value<tracker\n end\n lowest\nend",
"def key_for_min_value(name_hash)\n if name_hash.length == 0 \n nil\n else\n smallest_num = nil\n smallest_num_key = nil\n name_hash.collect do |key, value|\n if smallest_num == nil\n smallest_num = value\n smallest_num_key = key\n elsif smallest_num > value\n smallest_num = value\n smallest_num_key = key\n end\n end\n smallest_num_key\n end\n\nend",
"def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |n, s|\n if low_value == nil\n low_value = s\n low_key = n\n elsif low_value > s\n low_value = s\n low_key = n\n end\n end\n low_key\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash == nil || name_hash == {}\n number_array = name_hash.collect do |name, number|\n number\n end\n number_array.sort!\n name_hash.key(number_array[0])\nend",
"def key_for_min_value(name_hash)\n lowestId = nil\n lowestNum = 0\n name_hash.each{ |id, val|\n if lowestNum == 0 \n lowestNum = val\n end\n if val <= lowestNum\n lowestNum = val\n lowestId = id\n end\n }\n return lowestId\nend",
"def key_for_min_value(name_hash)\n lowest_v = nil\n lowest_k = nil\n name_hash.each do |name, value|\n if lowest_v == nil\n lowest_v = value\n lowest_k = name\n elsif value < lowest_v\n lowest_v = value\n lowest_k = name\n end\n end\n lowest_k\n end",
"def key_for_min_value(name_hash)\n smallest_key = nil\n smallest_value = nil\n name_hash.each do |j, r|\n if smallest_value == nil || r < smallest_value\n smallest_value = r\n smallest_key = j\n end\n end\n smallest_key\nend",
"def key_for_min_value(name_hash)\nlowest = 1000000\n low_key = nil\n name_hash.each {|key, value|\n if value < lowest\n lowest = value\n low_key = key\n end\n }\n low_key\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n name_hash.each_key do |key|\n if lowest_key == nil\n lowest_key = key\n elsif name_hash[key] < name_hash[lowest_key]\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n\n if name_hash.empty?\n return nil\n end\n lowest = Float::INFINITY\n name_hash.each_pair do |k, v|\n if v < lowest\n lowest = v\n end\n end\n name_hash.each_pair do |k, v|\n if v == lowest\n return k\n end\n end\nend",
"def key_for_min_value(name_hash)\n output = 0\n smallest = nil\n name_hash.map do |key, value|\n if value < output || output == 0\n output = value\n smallest = key\n end\n end\n\n smallest\nend",
"def key_for_min_value(my_hash)\n #what is my value?\n lowest_value = 500\n lowest_key = nil\n\n my_hash.collect do |key, value|\n # what is my value?\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(name_hash)\n lowest_num = 1000000000\n lowest_num_key = \" \"\n if name_hash == {}\n return nil\n else\n name_hash.each do |name, num|\n if num < lowest_num\n lowest_num = num\n lowest_num_key = name\n end\n end\n return lowest_num_key\n end\nend",
"def key_for_min_value(name_hash)\n nums = name_hash.collect do |item, num|\n num\n end\n nums.sort!\n nums[0]\n \n min_key = nil\n name_hash.map do |item, num|\n if num == nums[0]\n min_key = item\n end\n end\n min_key\nend",
"def key_for_min_value(name_hash)\n vals = name_hash.collect { |key, value| value }\n keys = name_hash.collect { |key, value| key }\n low = vals[0]\n lowkey = keys[0]\n if name_hash.empty?\n nil\n else\n name_hash.collect do |key, value|\n if value < low\n low = value\n lowkey = key\n end\n end\n lowkey\n end\nend",
"def key_for_min_value(name_hash)\n value1 = 0\n lowestKey = nil\n name_hash.each do |key, value|\n if(value1 == 0)\n value1 = value\n lowestKey = key\n end\n if(value1 > value)\n value1 = value\n lowestKey = key\n elsif (value1 < value)\n lowestKey = lowestKey\n value1 = value1\n end\n end\n return lowestKey\nend",
"def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect { |k, v| v }.sort\n hash.each { |k, v| return k if v == arr[0] }\nend",
"def key_for_min_value(name_hash)\n # saves the smaller value in memo, and takes the first elem of memo at the end (the key)\n smallest = name_hash.inject do|memo, (k, v)|\n memo = v < memo[1] ? [k,v] : memo\n end\n #handle the empty hash case...\n smallest ? smallest[0] : nil\nend",
"def key_for_min_value(name_hash)\n key = \"\"\n low_value = nil\n if name_hash.empty? == true\n return nil\n end\n name_hash.each do |name, number|\n if low_value == nil || number < low_value\n low_value = number\n key = name\n end\n end\n key\nend",
"def key_for_min_value(name_hash)\n answer = nil\n smallest = nil\n name_hash.each {|key, value|\n if smallest.nil?\n smallest = value\n end\n if value <= smallest\n smallest = value\n answer = key\n end\n }\n answer\nend",
"def smallest_key(q, hash)\n\t\ttemp = {}\n\t\tq.each do |v|\n\t\t\ttemp[v] = hash[v]\n\t\tend\n\t\treturn temp.key(temp.each_value.min)\n\tend",
"def key_for_min_value(name_hash)\n lowest_value = 0\n lowest_key = \"\"\n if name_hash.empty? == true\n nil\n else\n name_hash.each_with_index do |(key, value), i|\n if i == 0\n lowest_value = value\n lowest_key = key\n elsif value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\n end\nend",
"def key_for_min_value(name_hash)\n low=10000000000000000000\n return_key=nil\n name_hash.each do |key, value|\n if value<low\n low=value\n return_key=key\n end\n end\n return_key\nend",
"def key_for_min_value(hash)\n if hash.length == 0\n return nil\n else\n smallest = 1000\n printme = \"\"\n hash.each do |thing, number|\n if number < smallest\n smallest = number\n printme = thing\n end\n end\n printme\n end\nend",
"def key_for_min_value(name_hash)\n \n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name_key, name_value|\n if lowest_value == nil || name_value < lowest_value\n lowest_value = name_value\n lowest_key = name_key\n end\n end\n lowest_key\n \n end",
"def key_for_min_value(name_hash)\n the_key = nil \n the_value = 1/0.0\n # Infinity...can also be expressed as FLOAT::Infinity\n name_hash.each do |id, num|\n if num <= the_value\n the_value = num\n the_key = id\n end\n end\n the_key\nend",
"def key_for_min_value(hash)\n array = []\n hash.each {|key,value| \n if array.empty? || value < array[1] \n array[0] = key \n array[1] = value \n end }\n if !array.empty? \n array.first \n else \n nil \n end\nend",
"def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |k,v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end \nend\nlowest_key\nend",
"def key_for_min_value(name_hash)\n return nil if name_hash == {}\n smallest_key = name_hash.first[0]\n smallest_val = name_hash.first[1]\n\n name_hash.each do |pair|\n if pair[1] < smallest_val\n smallest_key = pair[0]\n end\n end\n smallest_key\nend",
"def key_for_min_value(name_hash)\n key_of_smallest_value = \"\"\n smallest_value = 99999\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_of_smallest_value = key\n end\n end\n if name_hash.size == 0\n key_of_smallest_value = nil\n end\n key_of_smallest_value\nend",
"def key_for_min_value(name_hash)\n smallest_value = Float::INFINITY\n key_for_smallest_val = nil\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_for_smallest_val = key\n end \n end \n key_for_smallest_val\nend",
"def key_for_min_value(name_hash)\n minKey = nil\n minVal = 2 ** (64 - 2) - 1\n name_hash.each {|key, value|\n if value < minVal\n minVal = value\n minKey = key\n end}\n minKey\nend",
"def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n lowest_number = nil\n name_hash.collect do |name, value|\n if lowest_number == nil\n lowest_number = value\n elsif lowest_number > value\n lowest_number = value\n end\n end\n \n name_hash.each do |name, value|\n if lowest_number == value\n return name\n end\n end\nend",
"def key_for_min_value(hash)\n min_value = hash.values.min\n keys = hash.collect do |key, num|\n \tkey if num == min_value\n end\n keys\nend",
"def key_for_min_value(name_hash)\n lowest_value = nil\n key_value = nil\n name_hash.collect do |name, number|\n if lowest_value == nil || number < lowest_value\n lowest_value = number\n key_value = name\n end\n end\n key_value\nend",
"def key_for_min_value(name_hash)\n smallest_value = 1/0.0\n key_of_smallest_value = nil\n name_hash.each do |key, value|\n if smallest_value > value\n key_of_smallest_value = key\n smallest_value = value\n end\n end\n return key_of_smallest_value\nend"
] |
[
"0.8821222",
"0.8777674",
"0.87769854",
"0.8745862",
"0.8689437",
"0.86553806",
"0.865241",
"0.86165065",
"0.8587693",
"0.8572328",
"0.85674095",
"0.8550907",
"0.8529734",
"0.8529734",
"0.85182345",
"0.84936565",
"0.8475531",
"0.8475531",
"0.8466132",
"0.8449126",
"0.84490585",
"0.84359556",
"0.84328413",
"0.8430745",
"0.8428166",
"0.84090126",
"0.8388222",
"0.83684903",
"0.83568215",
"0.83524764",
"0.8345625",
"0.8343887",
"0.8328773",
"0.83284044",
"0.83269894",
"0.83253354",
"0.83201903",
"0.83164364",
"0.8312503",
"0.8312319",
"0.8304851",
"0.83014053",
"0.83008987",
"0.82917446",
"0.8288315",
"0.82870966",
"0.8274123",
"0.82674986",
"0.8267187",
"0.82527804",
"0.8250538",
"0.82443976",
"0.82439804",
"0.8243696",
"0.82416916",
"0.8240566",
"0.823854",
"0.82375354",
"0.82283455",
"0.82274485",
"0.82205135",
"0.82190055",
"0.82136935",
"0.82136935",
"0.82102376",
"0.82101446",
"0.82060164",
"0.8200657",
"0.81985617",
"0.81966525",
"0.81958514",
"0.81932545",
"0.81874573",
"0.8186549",
"0.8185174",
"0.8183619",
"0.8183068",
"0.8182941",
"0.8179895",
"0.8173536",
"0.81732464",
"0.8172825",
"0.81721044",
"0.8171692",
"0.81681263",
"0.8165602",
"0.81609225",
"0.8160289",
"0.81587887",
"0.815757",
"0.8154019",
"0.81534094",
"0.8152752",
"0.81524456",
"0.8151455",
"0.81511825",
"0.8151019",
"0.8146792",
"0.814368",
"0.8142542",
"0.81412685"
] |
0.0
|
-1
|
Calculates the zone outdoor airflow requirement and divides by the zone area.
|
def outdoor_airflow_rate_per_area()
tot_oa_flow_rate_per_area = 0.0
# Find total area of the zone
sum_floor_area = 0.0
self.spaces.sort.each do |space|
sum_floor_area += space.floorArea
end
# Get the OA flow rate
tot_oa_flow_rate = outdoor_airflow_rate
# Calculate the per-area value
tot_oa_flow_rate_per_area = tot_oa_flow_rate / sum_floor_area
OpenStudio::logFree(OpenStudio::Info, "openstudio.Standards.Model", "For #{self.name}, OA per area = #{tot_oa_flow_rate_per_area.round(8)} m^3/s*m^2.")
return tot_oa_flow_rate_per_area
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def area_wrt_ground ()\n \n end",
"def zone_data\n @zone_data ||= ComplianceCheckerApi.clean_air_zones\n end",
"def calculate_area\n\n \tarea = 3.14*@radius*@radius\n\n end",
"def zone_for(px, pz, sz_bot, sz_top)\n # puts \"calculating zone: #{px}, #{pz}, #{sz_bot}, #{sz_top}\"\n zone = [-0.70833, -0.23611, 0.23611, 0.70833, 100].index{|lower_bound| lower_bound > px} + 1\n zone += 5 * [sz_top, (2*sz_top/3 + sz_bot/3), (2*sz_bot/3 + sz_top/3), sz_bot, -100].index{|bound| bound < pz}\n # puts zone\n return zone\n end",
"def find_area\n\t\t@area = 0.5 * ((@point1.x - @point3.x)*(@point2.y - @point1.y) - (@point1.x - @point2.x)*(@point3.y - @point1.y)).abs\n\tend",
"def area\r\n return (( (@p1.x*(@p2.y - @p3.y)) + (@p2.x*(@p3.y - @p1.y)) + (@p3.x*(@p1.y - @p2.y)) )/2.0).abs\r\n end",
"def get_area()\n # Finds the floor and space parents and assigns them to @floor and @space \n # variables to be used later\n begin\n floor = get_floor()\n space = get_space()\n # Get the keyword value for location\n location = get_keyword_value(\"LOCATION\")\n # Get the keyword value for polygon\n polygon_id = get_keyword_value(\"POLYGON\")\n rescue\n end\n \n \n # if the polygon_id keyword value was nil and the location value was nil, then \n # the height and width are directly defined within the \"exteriorWall\" command\n \n if ( location == \"BOTTOM\" || location == \"TOP\") && (space.get_shape != \"BOX\")\n return space.polygon.get_area \n \n elsif ( location == nil && polygon_id == nil )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n #puts \"Direct:\" + height + \" times \" + width\n height = height.to_f\n width = width.to_f\n \n return height * width\n elsif ( location == nil && polygon_id != nil)\n return space.polygon.get_area\n \n \n # if the location was defined as \"SPACE...\", it is immediately followed by a\n # vertex, upon which lies the width of the exteriorwall\n elsif location.match(/SPACE.*/)\n location = location.sub( /^(.{6})/, \"\")\n width = space.polygon.get_length(location)\n if space.check_keyword?(\"HEIGHT\")\n height = space.get_height\n else\n height = floor.get_space_height\n end\n #puts floor.utype\n #puts \"Space:\" + height.to_s + \" times \" + width.to_s\n return width * height\n # if the shape was a box, the width and height would be taken from the\n # \"SPACE\" object\n elsif ( space.get_shape == \"BOX\" ) \n width = space.get_width\n height = space.get_height\n return width * height\n \n \n else\n raise \"The area could not be evaluated\"\n end\n end",
"def calculate_final_fare(origin_station, destination_station)\n zones = Zone.new(origin_station, destination_station).perform\n if zones[:check_zone_one]\n send(\"#{zones[:count_zone]}_zone_higher_fare\".to_sym)\n else\n send(\"#{zones[:count_zone]}_zone_standard_fare\".to_sym)\n end\n end",
"def apply_multizone_vav_outdoor_air_sizing()\n \n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Started applying HVAC efficiency standards.')\n \n # Multi-zone VAV outdoor air sizing\n self.getAirLoopHVACs.sort.each {|obj| obj.apply_multizone_vav_outdoor_air_sizing} \n\n end",
"def zone() end",
"def area\n return format(\"%.2f\", model.land.area)\n end",
"def area\n (@p1.x * @p2.y + @p2.x * @p3.y + @p3.x * @p1.y - @p1.y * @p2.x - @p2.y * @p3.x - @p3.y * @p1.x).abs / 2.0\n end",
"def calc_zone_residual_demand(operator_id, req_type, zone_id)\n res = Yarray.new(year, arr: @requirements[req_type][zone_id])\n if @competitor_production[operator_id].has_key? zone_id # TODO: e se fossero più di una?\n res -= Yarray.new(year, arr: @competitor_production[operator_id][zone_id])\n end\n if @imports.has_key? zone_id # TODO: e se fossero più di una?\n res -= Yarray.new(year, arr: @imports[zone_id])\n end\n @limits.fetch(zone_id, {}).each_pair do |from_zone_id, v|\n res -= Yarray.new(year, arr: v)\n end\n res\n end",
"def zone; end",
"def current_area\n PoliticalArea.nyc\n end",
"def zone_params\n params.fetch(:zone, {}).permit(\n :stadium_id,\n :gate_id,\n :code,\n :description,\n :price,\n :capacity,\n :zone_type,\n :image\n )\n end",
"def handling_cost(aircraft = nil)\n # mtow = aircraft.mtow\n # mtow = 0.0 if mtow.nil?\n # self.landing_rate_per_tonne * mtow\n\n cost = 0.0\n cost = aircraft.aircraft_type.aircraft_category.handling_cost_grids.where(city_id: self.city_id).first.cost if aircraft.aircraft_type.aircraft_category.handling_cost_grids.where(city_id: self.city_id).present?\n cost\n end",
"def get_opaque_area()\n get_area.to_f - get_window_area().to_f - get_door_area().to_f\n end",
"def zone_params\n return {}\n end",
"def calculate(timezone); end",
"def get_opaque_area()\n get_area.to_f - get_window_area().to_f - get_door_area().to_f\n end",
"def get_area\n return Engine::Area.new(calculate_top_point_internal, @area_width, @area_height)\n end",
"def zone_number\n end",
"def get_area\n\n # get the keyword for the shape of the floor\n case get_keyword_value(\"SHAPE\")\n\n # if the keyword value is \"BOX\", the width and depth values are defined\n when \"BOX\"\n return get_keyword_value(\"WIDTH\").to_f * get_keyword_value(\"DEPTH\").to_f\n\n # if the keyword value is \"POLYGON\", the get_area is defined as the area of the\n # given polygon\n when \"POLYGON\"\n return @polygon.get_area\n\n # if the keyword value of the floor is \"No-SHAPE\", the get_area is given as the\n # get_area keyword value\n when \"NO-SHAPE\"\n return get_keyword_value(\"AREA\").to_f\n else\n raise \"Error: The area could not be evaluated. Please check inputs\\n \"\n end\n end",
"def check_by_zone\n _r = false\n # global_zone_breakdown returns multidimensional array containing different zone in each line\n # Each line contains 5 elements: Zone Id, max_order_total, max_order_price, Net amount sum by project & Item net price\n a = global_zone_breakdown(purchase_order_items.joins(project: :office).order(:zone_id))\n d = a.detect { |f| (f[1] > 0 && (f[3] > f[1])) || (f[2] > 0 && (f[4] > f[2])) }\n _r = d.nil? ? false : true\n end",
"def area\n appellation.region.area\n end",
"def zone\n fetch('games.final_fantasy_xiv.zones')\n end",
"def area\n x, y, z = sides.sort\n (\n 0.25 * Math.sqrt((x + (y + c)) * (z - (x - y)) * (z + (x - y)) * (x + (y - z)))\n ).to_f.round(precision)\n end",
"def find_faa_zones(lat_start, lon_start, lat_end, lon_end)\n\n # start_time = DateTime.now\n\n #read and parse out the faa zones\n unless @zones.present?\n @zones = JSON(File.read(Rails.root.join('lib', 'prediction', 'faa_zones.json').to_s))\n @zones.map! do |zone|\n\n # we only care about restricted zones\n if !(zone['restriction'].present?)\n next\n end\n\n if zone['boundaries']['shape'] == 'circle'\n center = zone['boundaries']['center']\n radius = zone['radius']\n zone = nil if center.nil? || radius.nil?\n\n if zone.present?\n center['lat'] = parse_coordinate center['lat']\n center['lon'] = parse_coordinate center['lon']\n\n #convert the radius to meters\n number = radius.gsub(',', '').to_f\n case radius\n when /(NM)|(nautical-mile)/i\n number *= 1852\n when /mile/i\n number *= 1609.34\n when /(foot)|(feet)|(ft)/i\n number *= 0.3048\n when /(kilometer)|(km)/i\n number *= 1000\n end\n\n zone['boundaries']['center'] = center\n zone['radius'] = number\n end\n elsif zone['boundaries']['shape'] == 'polygon'\n zone['boundaries']['coordinates'] = zone['boundaries']['coordinates'].select{|a|\n a['lat'].present? && a['lon'].present?\n }.map{|a|\n a['lat'] = parse_coordinate a['lat']\n a['lon'] = parse_coordinate a['lon']\n a\n }\n end\n zone\n end\n @zones.select!{|zone|\n zone.present?\n }\n end\n\n @zones.each do |zone|\n if zone['boundaries']['shape'] == 'circle'\n center = zone['boundaries']['center']\n radius = zone['radius']\n\n c_lat = center['lat']\n c_lon = center['lon']\n\n area2 = ((lat_end-lat_start)*(c_lon-lon_start) - (c_lat-lat_start)*(lon_end-lon_start)).abs\n\n #compute the AB segment length\n lab = ((lat_end-lat_start)**2 + (lon_end-lon_start)**2).sqrt\n\n #compute the triangle height\n h = area2/lab\n\n #if the line intersects the circle\n return false\n elsif zone['boundaries']['shape'] == 'polygon'\n coordinates = zone['boundaries']['coordinates']\n\n if coordinates.length < 3\n next\n end\n\n if intersects_polygon?(coordinates, lat_start, lon_start, lat_end, lon_end)\n return false\n end\n end\n end\n\n # puts \"#{(DateTime.now - start_time).to_f.round(5)} seconds finding zones\"\n\n return true\n end",
"def get_area()\n OpenStudio::getArea(self.get_3d_polygon())\n end",
"def build_zone_hash\n zone_hash = {}\n if @space_types\n zone_list = []\n @space_types.each do |space_name, space_type|\n zone_list.concat(get_zones_per_space_type(space_type[:space_type]))\n end\n zone_hash[xget_id] = zone_list\n end\n @building_sections.each do |bldg_subsec|\n zone_list = []\n bldg_subsec.space_types_floor_area.each do |space_type, hash|\n zone_list.concat(get_zones_per_space_type(space_type))\n end\n zone_hash[bldg_subsec.xget_id] = zone_list\n end\n return zone_hash\n end",
"def assign_areas(options={})\n options = {\n }.merge(options)\n\n # assign zip codes to areas\n @area_zips = {\n # Part of Austin\n :south => 0, # south of the river\n :central => 0, # near church, downtown\n :north => 0, # north 183N not quite out of town yet\n :northwest => 0, # cedar park, lake travis\n\n # Austin Outskirts\n :waynorth => 0, # pflugerville, round rock, georgetown\n :east => 0, # manor, elgin, hutto\n\n # Outside Austin\n :texas => 0, # outside austin area but still in Texas\n :outside_texas => 0, # outside Texas\n\n # Debug / Error checking\n :austin => 0, # for error checking / debug\n :other => 0, # for error checking / debug\n }\n\n @final_data.each_index do |i|\n record = @final_data[i]\n\n if record[:state] == 'TX'\n @final_data[i][:area] = :texas # Folks outside any of the cities below but still in Texas\n \n if record[:city] == 'Austin' # Folks in Austin\n @final_data[i][:area] = :austin # Don't want any left in Austin :area, all should here be assigned to a zip code below!\n case @final_data[i][:zip]\n when '78749','78739','78735','78736','78737','78745','78748','78704','78744','78747','78742','78746','78738','78733'\n @final_data[i][:area] = :south\n when '78703','78705','78751','78701','78712','78751','78756','78702','78731','78752','78767'\n @final_data[i][:area] = :central\n when '78758','78757','78759','78753','78729','78708','78727'\n @final_data[i][:area] = :north\n when '78717','78726','78730','78732','78750'\n @final_data[i][:area] = :northwest\n when '78725','78724','78754','78723','78741'\n @final_data[i][:area] = :east\n when '78728'\n @final_data[i][:area] = :waynorth\n end\n # cities near to Austin\n elsif record[:city] == 'Del valle'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Manchaca'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Buda'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Lockhart'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Kyle'\n @final_data[i][:area] = :south\n elsif record[:city] == 'San marcos'\n @final_data[i][:area] = :south\n elsif record[:city] == 'Pflugerville'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Granger'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Round rock'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Georgetown'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Manor'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Webberville'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Elgin'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Bastrop'\n @final_data[i][:area] = :east\n elsif record[:city] == 'Cedar park'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Hutto'\n @final_data[i][:area] = :waynorth\n elsif record[:city] == 'Lake travis'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Lago vista'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Lakeway'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Leander'\n @final_data[i][:area] = :northwest\n elsif record[:city] == 'Spicewood'\n @final_data[i][:area] = :northwest\n end\n\n else # Folks outside of Texas (poor souls!)\n @final_data[i][:area] = :outside_texas\n end\n end\n \n \nend",
"def get_area()\n @space.get_area()\n end",
"def calculate_area\n puts \"Area depends of figure, but we can calculate through triangles\"\n end",
"def get_handling_cost(aircraft, airport)\n cost = 0.0\n aircraft_type = aircraft_type_for_id(aircraft.aircraft_type_id)\n city_id = airport.city_id\n if aircraft_type.present?\n handling_cost_grid = handling_for_aircraft_category(aircraft_type.aircraft_category_id, city_id)\n if handling_cost_grid.present?\n cost = handling_cost_grid.cost\n end\n end\n cost\n end",
"def water_area_km\n water_area * SQUARE_MILES_TO_KILOMETERS if water_area\n end",
"def zone\n @zone\n end",
"def warp_zone\n return @warp_zone\n end",
"def area\n return @pi * (@radio * @radio)\n end",
"def cost(aircraft_type=self.aircraft)\n cost = 0\n [pax_1,pax_2].each do |pax|\n if pax >= aircraft_type.passenger_capacity\n # er is spill\n cost += price * (pax - aircraft_type.passenger_capacity)\n end\n end\n # Kosten aftrekken\n cost += 2 * (aircraft_type.fixed_cost/100.0) * AssignmentParameters.fixed_cost_100\n cost += (flight_time/(60*60)) * AssignmentParameters.var_cost_100 * (aircraft_type.var_cost/100.0)\n cost += swap_penalty(aircraft_type)\n return cost\n end",
"def zone_assignment_params\n params.require(:zone_assignment).permit(:zone_id, :task_id, :user_id, :staff_id, :stage_id)\n end",
"def accommodation_cost_at_airport(airport, nights)\n @accommodation_cost_map ||= {}\n return @accommodation_cost_map[\"#{airport.id}-#{nights}\"] if @accommodation_cost_map[\"#{airport.id}-#{nights}\"].present?\n @accommodation_cost_map[\"#{airport.id}-#{nights}\"] = City::TIER_ACCOMMODATION_COST[city_for_airport(airport).accomodation_category.to_sym] * nights\n @accommodation_cost_map[\"#{airport.id}-#{nights}\"]\n end",
"def setArea\n return unless border_points_changed?\n self.area = 0\n return unless border_points_minus_removed.length >= 3\n centerLat = centerLatitude\n centerLong = centerLongitude\n last = border_points.last\n x1 = (last.longitude > centerLong ? 1 : -1) * (last.dist last.latitude, centerLong)\ny1 = (last.latitude > centerLat ? 1 : -1) * (last.dist centerLat, last.longitude)\n sum = 0\n border_points_minus_removed.each_with_index do |point, index|\n x2 = (point.longitude > centerLong ? 1 : -1) * (point.dist point.latitude, centerLong)\ny2 = (point.latitude > centerLat ? 1 : -1) * (point.dist centerLat, point.longitude)\n sum += x1*y2 - x2*y1\n x1 = x2\n y1 = y2\n end\n self.area = (sum/2).abs\n end",
"def calculate_qly_datetime(race_datetime, circuit)\n case circuit['circuitId']\n when 'americas' || 'villeneuve'\n zone_a_offset(race_datetime)\n when 'albert_park' || 'shanghai' || 'marina_bay' || 'suzuka' || 'sochi'\n zone_b_offset(race_datetime)\n when 'sepang'\n zone_c_offset(race_datetime)\n else\n race_datetime - 24.hours\n end\n end",
"def modeler_description\n return 'This measure goeas through each walkin case and then through each zoneBoundaries. Foe each one, depending on the user inputs, it checks if setStockingDoorOpeningProtectionTypeFacingZone is set to strip curtains and\n it modifies the stocking door schedule to simulate the presence of an automatic door closer.'\n end",
"def outputs\n output_vars = ['Zone Mean Air Temperature', 'Wetbulb Globe Temperature'] # possible list that the user can enter limits for; should get blank column for ones that aren't entered into output_vars arg\n buildstock_outputs = []\n thermal_zones.each do |zone|\n output_vars.each do |output_var|\n buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase(output_var)}_hours_below_lower_threshold\" # hours below lower threshold\n buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase(output_var)}_hours_above_upper_threshold\" # hours above upper threshold\n buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase(output_var)}_degree_hours_below_lower_threshold\" # degree-hours below lower threshold\n buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase(output_var)}_degree_hours_above_upper_threshold\" # degree-hours above upper threshold\n buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase(output_var)}_hours_until_lower_threshold\" # hours until lower threshold\n buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase(output_var)}_hours_until_upper_threshold\" # hours until upper threshold\n end\n # buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase(\"End Of Outage Indoor Drybulb Temperature\")}\"\n buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase('Maximum Wetbulb Globe Temperature During Outage')}\"\n buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase('Minimum Indoor Drybulb Temperature During Outage')}\"\n buildstock_outputs << \"#{OpenStudio::toUnderscoreCase(zone)}_#{OpenStudio::toUnderscoreCase('Maximum Indoor Drybulb Temperature During Outage')}\"\n end\n buildstock_outputs << 'outage_start_datetime'\n buildstock_outputs << 'outage_duration_hours'\n result = OpenStudio::Measure::OSOutputVector.new\n buildstock_outputs.each do |output|\n result << OpenStudio::Measure::OSOutput.makeDoubleOutput(output)\n end\n return result\n end",
"def get_area\n \n # Finds the floor and space parents and assigns them to @floor and @space \n # variables to be used later\n \n parent = get_parents\n parent.each do |findcommand|\n if ( findcommand.commandName == \"FLOOR\" )\n @floor = findcommand\n end\n if ( findcommand.commandName == \"SPACE\")\n @space = findcommand\n end\n end\n \n # Get the keyword values for location and polygon\n begin\n location = get_keyword_value(\"LOCATION\")\n rescue\n end\n \n # if the wall is in a space where the shape of the space is defined as\n # a \"BOX\"\n if ( @space.get_shape == \"BOX\" )\n height = @space.get_height\n width = @space.get_width\n return height * width\n \n # if the wall is in a space where the shape of the space is defined as\n # a \"POLYGON\"\n elsif ( @space.get_shape == \"POLYGON\")\n \n # if the location is thus defined as \"TOP\" or \"BOTTOM\", the space's polygon\n # is used to define the get_area\n if ( location == \"TOP\" || location == \"BOTTOM\" )\n return @space.polygon.get_area\n \n # if this is not the case, then it is defined by a coordinate vector, where\n # the get_area can be found by getting the polygon length for the vertex and the \n # space height of the floor\n elsif location.match(/SPACE.*/)\n location = location.sub( /^(.{6})/, \"\")\n width = @space.polygon.get_length(location)\n height = @floor.get_space_height\n return width * height\n end\n # if the shape of the space is found to be defined as \"NO-SHAPE\", the values\n # for width, height, and get_area could be defined directly in the interior-wall\n # class\n elsif ( @space.get_shape == \"NO-SHAPE\")\n \n begin\n area = get_keyword_value(\"AREA\")\n rescue\n end\n \n begin\n width = get_keyword_value(\"WIDTH\")\n height = get_keyword_value(\"HEIGHT\")\n rescue\n end\n # if the width and height are not defined, then the get_area is directly entered\n # else, the get_area is entered and the width and height are not. If none of these\n # conditions hold, then an exception is raised for invalid inputs\n \n if ( area != nil)\n area = area.to_f\n return area\n elsif ( area == nil && width != nil && height != nil)\n width = width.to_f\n height = height.to_f\n return width * height\n else\n raise \"The area could not be evaluated\"\n \n end\n else\n raise \"The area could not be evaluated\"\n \n end\n\n \n end",
"def area\n\t\treturn @PI * @radius ** 2\n\tend",
"def get_area\n\n # get the keyword value of shape\n shape = get_keyword_value(\"SHAPE\")\n\n # if the shape value is nil, or it is defined as \"NO-SHAPE\", the get_area value\n # would be defined, and would represent the get_area of the space\n if ( shape == nil || shape == \"NO-SHAPE\")\n area = get_keyword_value(\"AREA\")\n area = area.to_f\n return area\n\n # if the shape value is \"BOX\", the height and width key values are given,\n # and the get_area would be defined as their product\n elsif ( shape == \"BOX\" )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n height = height.to_f\n width = width.to_f\n return height * width\n\n # if the shape value is defined as a polygon , the get_area of the polygon would\n # represent the get_area of the space\n elsif ( shape == \"POLYGON\")\n return @polygon.get_area\n else\n raise \"Error: The area could not be evaluated. Please check inputs\\n \"\n\n end\n end",
"def calc_zones_residual_demand(operator_id, req_type, zone_set)\n sum = Yarray.new(year)\n zone_set.each do |zone_id|\n d = @gross_zone_residual_demands.get(operator: operator_id, req_type: req_type, zone: zone_id)\n if d.nil?\n d = calc_zone_residual_demand(operator_id, req_type, zone_id)\n @gross_zone_residual_demands.add(operator: operator_id, req_type: req_type, zone: zone_id, yarray: d)\n end\n sum += d\n zone_set.select{|e| e!=zone_id}.each do |z_id|\n if @limits[zone_id] && @limits[zone_id][z_id]\n v = @limits[zone_id][z_id]\n sum += Yarray.new(year, arr: v)\n end\n end\n end\n sum\n end",
"def area\n respond_to?(:constituencyGroupHasConstituencyArea) ? constituencyGroupHasConstituencyArea.first : nil\n end",
"def area\r\n return ( Math::PI * @radius * @radius).abs\r\n end",
"def zone_params\n # params.require(:zone) #.permit( :zone, :nombre_zona, :color)\n end",
"def area\n return @area || Area.inactive_area\n end",
"def modeler_description\n return \\\n \"For each zone in the model that matches the specified zones and has a \" \\\n \"thermostat with both heating and cooling schedules, apply a symmetric \" \\\n \"offset to the heating and cooling setpoints based on a occupancy \" \\\n \"schedule file and occupant threshhold below which the offset will \" \\\n \"be applied. Overwrites all applicable thermostat schedules with \" \\\n \"schedule files.\"\n end",
"def clean_air_zones_data\n ComplianceCheckerApi.clean_air_zones\n end",
"def get_area\n\n # Finds the floor and space parents and assigns them to @floor and @space\n # variables to be used later\n parent = get_parents\n parent.each do |findcommand|\n if ( findcommand.commandName == \"FLOOR\" )\n @floor = findcommand\n end\n if ( findcommand.commandName == \"SPACE\")\n @space = findcommand\n end\n end\n\n # Get the keyword value for location\n begin\n location = get_keyword_value(\"LOCATION\")\n rescue\n end\n\n # Get the keyword value for polygon\n begin\n polygon_id = get_keyword_value(\"POLYGON\")\n rescue\n end\n\n # if the polygon_id keyword value was nil and the location value was nil, then\n # the height and width are directly defined within the \"roof\" command\n\n\n if ( location == \"BOTTOM\" || location == \"TOP\") && (@space.get_shape != \"BOX\")\n return @space.polygon.get_area\n\n elsif ( location == nil && polygon_id == nil )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n height = height.to_f\n width = width.to_f\n return height * width\n elsif ( location == nil && polygon_id != nil)\n return @space.polygon.get_area\n\n\n # if the location was defined as \"SPACE...\", it is immediately followed by a\n # vertex, upon which lies the width of the roof\n elsif location.match(/SPACE.*/)\n location = location.sub( /^(.{6})/, \"\")\n width = @space.polygon.get_length(location)\n height = @floor.get_space_height\n return width * height\n # if the shape was a box, the width and height would be taken from the\n # \"SPACE\" object\n elsif ( @space.get_shape == \"BOX\" )\n width = @space.get_width\n height = @space.get_height\n return width * height\n else\n raise \"The area could not be evaluated\"\n end\n end",
"def area\n respond_to?(:constituencyGroupHasConstituencyArea) ? constituencyGroupHasConstituencyArea.first : nil\n end",
"def calc_area (base1,base2,height)\r\n\tarea = height * (base1 + base2) / 2.0\r\n\treturn area\r\nend",
"def area\n\t\tMath::PI * (self.radius ^ 2)\n\tend",
"def getArea(ringNumber)\n\t((ringNumber-1)*2+1)**2\nend",
"def area(box)\n nw_lon = box[0][0]\n nw_lat = box[0][1]\n se_lon = box[1][0]\n se_lat = box[1][1]\n y = abs(nw_lat - se_lat)\n x = abs(nw_lon - se_lon)\n x = x < 180 ? x : 360-x\n return x*y\n end",
"def percent_urban_area_land_area\n land_area / urban_area.land_area\n end",
"def percent_land\n land_area / total_area if land_area\n end",
"def delivery_area_params\n params.require(:delivery_area).permit(:delivery_time, :delivery_charges, :min_order_amount)\n end",
"def get_area\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n \n if height == nil || width == nil\n raise \"Error: In the command #{@utype}:#{@command_name} the area could not be evaluated. Either the HEIGHT or WIDTH is invalid.\\n #{output}\"\n end\n \n height = height.to_f\n width = width.to_f\n \n return height * width\n end",
"def adjacent_wall(zone)\n \n end",
"def variable_operation_and_maintenance_costs_per_typical_input\n fetch(:variable_operation_and_maintenance_costs_per_typical_input) do\n return 0.0 if input_capacity.zero?\n return 0.0 if variable_operation_and_maintenance_costs_per_full_load_hour.nil?\n return 0.0 if variable_operation_and_maintenance_costs_for_ccs_per_full_load_hour.nil?\n\n (variable_operation_and_maintenance_costs_per_full_load_hour +\n variable_operation_and_maintenance_costs_for_ccs_per_full_load_hour) / # highlighting\n (input_capacity * 3600.0)\n end\n end",
"def get_area\n \n # Finds the floor and space parents and assigns them to @floor and @space \n # variables to be used later\n parent = get_parents\n parent.each do |findcommand|\n if ( findcommand.commandName == \"FLOOR\" )\n @floor = findcommand\n end\n if ( findcommand.commandName == \"SPACE\")\n @space = findcommand\n end\n end\n \n # Get the keyword value for location\n begin\n location = get_keyword_value(\"LOCATION\")\n rescue\n end\n \n # Get the keyword value for polygon\n begin\n polygon_id = get_keyword_value(\"POLYGON\")\n rescue\n end\n \n # if the polygon_id keyword value was nil and the location value was nil, then \n # the height and width are directly defined within the \"roof\" command\n \n \n if ( location == \"BOTTOM\" || location == \"TOP\") && (@space.get_shape != \"BOX\")\n return @space.polygon.get_area \n \n elsif ( location == nil && polygon_id == nil )\n height = get_keyword_value(\"HEIGHT\")\n width = get_keyword_value(\"WIDTH\")\n height = height.to_f\n width = width.to_f\n return height * width\n elsif ( location == nil && polygon_id != nil)\n return @space.polygon.get_area\n \n \n # if the location was defined as \"SPACE...\", it is immediately followed by a\n # vertex, upon which lies the width of the roof\n elsif location.match(/SPACE.*/)\n location = location.sub( /^(.{6})/, \"\")\n width = @space.polygon.get_length(location)\n height = @floor.get_space_height\n return width * height\n # if the shape was a box, the width and height would be taken from the\n # \"SPACE\" object\n elsif ( @space.get_shape == \"BOX\" ) \n width = @space.get_width\n height = @space.get_height\n return width * height\n else\n raise \"The area could not be evaluated\"\n end\n end",
"def modeler_description\n return 'This measure will clone all of the schedules that are used as OA Ventilation setting for each zone. Then the schedules are adjusted by a specified percentage during a specified time period. If the measure is applied throughout the entire building, the reduction value can be separately defined based on whether this space type is occupied or not.'\n end",
"def calculate_time_from_to_cost\n\n time_cost = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable_out_price', '0')\n if time_cost != '0'\n\n # Check if the reservation correspond to the main season or not\n main_season_month_from = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.month_from', 1).to_i\n main_season_day_from = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.day_from', 1).to_i\n main_season_month_to = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.month_to', 12).to_i\n main_season_day_to = SystemConfiguration::Variable.get_value('booking.pickup_return_main_season.day_to', 31).to_i\n\n if main_season_month_from == 1 and main_season_day_from == 1 and main_season_month_to == 12 and main_season_day_to == 31\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable','0').to_i\n else\n # JAN DIC\n # -------------------------------------\n # ^=======================^\n # from to\n if main_season_month_from <= main_season_month_to or \n (main_season_month_from == main_season_month_to and main_season_day_from <= main_season_day_to) \n if (@date_from.month >= main_season_month_from or \n (@date_from.month == main_season_month_from and @date_from.day >= main_season_day_from)) and\n (@date_to.month <= main_season_month_to or \n (@date_to.month == main_season_month_to and @date_to.day <= main_season_day_to)) # In main season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable','0').to_i\n else # Out of season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable_out_of_season','0').to_i\n end\n else\n # JAN DIC\n # -------------------------------------\n # ======^ ^======\n # to from\n if ((@date_from.month >= main_season_month_from or\n (@date_from.month == main_season_month_from and @date_from.day >= main_season_day_from)) or\n (@date_from.month <= main_season_month_to or \n (@date_from.month == main_season_month_to and @date_from.day <= main_season_day_to))\n ) and\n ((@date_to.month >= main_season_month_from or\n (@date_to.month == main_season_month_from and @date_to.day >= main_season_day_from)) or\n (@date_to.month <= main_season_month_to or\n (@date_to.month == main_season_month_to and @date_to.day <= main_season_day_to))) # In main season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable','0').to_i\n else # Out of season\n timetable_id = SystemConfiguration::Variable.get_value('booking.pickup_return_timetable_out_of_season','0').to_i\n end\n end\n end\n\n #p \"timetable_id: #{timetable_id} -- main season: #{main_season_day_from}-#{main_season_month_from} #{main_season_day_to}-#{main_season_month_to}\"\n\n time_cost = BigDecimal.new(time_cost)\n if timetable_id > 0\n if timetable = ::Yito::Model::Calendar::Timetable.get(timetable_id)\n @time_from_cost = calculate_time_cost(@date_from, @time_from, time_cost, timetable)\n @time_to_cost = calculate_time_cost(@date_to, @time_to, time_cost, timetable)\n end\n end\n\n end\n end",
"def build_geographies\n build_trip_within_area unless trip_within_area\n end",
"def zone_identifier; end",
"def zone_identifier; end",
"def modeler_description\n return 'This measure loops through all Thermal zones connected to Airloops having an Outdoor Air Controller object, and determines a space-weighted occupancy schedule for each attached thermal zone. The resulting occupancy schedules for each thermal zone are stepped through from hour 0 to hour 24. An airloop is considered occupied during a time period if all thermal zones representing occupancy associated with an air loop have a current occupancy value that is greater than 5% of the annual peak occupancy value. The measure generates a new minimum outdoor air schedule having values of 0 where the all connected thermal zones have less than 5% occupancy and values of 1.0 for all other hours. Finally, the measure examines all Zone HVAC Equipment objects associated with an airloop. If Zone HVAC equipment object of type Four Pipe Fan Coil Unit or Unit Ventilator are found, the occupancy patterns associated with the thermal zone are analyzed and outside air schedules are assigned to allow design outside air levels when the thermal zone is occupied by more than 5 percent of thermal zone peak occupancy, otherwise shit the outside air damper of the Zone HVAC Equipment object completely.'\n end",
"def cost_of_parking(entry_time, exit_time)\n duration = exit_time - entry_time\n billable_hours = [(duration / 3600.0).ceil, 1].max\n\n billable_hours * @hourly_cost\n end",
"def area\n ( @width*@top) * ( 1.0 - ( ( 1.0 - @alpha.value) ** 2))\n end",
"def calculateArea\n\n\treturn @length * @breadth\n\t\n\t\nend",
"def mill_out_air_entrance(mill, pCent_x, pCent_y, pMin_radius, pMax_radius, pNum_holes, pBeg_z, pEnd_z, pSpoke_angle, pSpoke_width=0.1)\r\n # # # # # # # # #\r\n # Mill out center holes as large as possible\r\n # without comprimising strength\r\n # # # # # # # # # \r\n degrees_per_hole = 360 / pNum_holes\r\n \r\n \r\n pMin_radius += mill.bit_radius\r\n pMax_radius -= mill.bit_radius\r\n \r\n if (pMax_radius < pMin_radius)\r\n pMax_radius = pMin_radius\r\n end\r\n \r\n \r\n #print \"(pNum_holes=\", pNum_holes, \")\\n\"\r\n #print \"(degrees_per_hole=\", degrees_per_hole, \")\\n\"\r\n #print \"(pMin_radius=\", pMin_radius, \")\\n\"\r\n #print \"( pMax_radius=\", pMax_radius, \"\\n\"\r\n \r\n bit_radius_degree_inner = degrees_for_distance(pMin_radius, mill.bit_radius)\r\n \r\n bit_radius_degree_outer = degrees_for_distance(pMax_radius, mill.bit_radius)\r\n \r\n inner_bit_and_spoke_degree = degrees_for_distance(pMin_radius, (mill.bit_radius * 2 + pSpoke_width))\r\n outer_bit_and_spoke_degree = degrees_for_distance(pMax_radius, (mill.bit_radius * 3 + pSpoke_width))* 1.05\r\n \r\n usable_inner_degrees = degrees_per_hole - inner_bit_and_spoke_degree\r\n #print \"(inner_bit_and_spoke_degree=\", inner_bit_and_spoke_degree, \")\\n\"\r\n #print \"(usable_inner_degrees=\", usable_inner_degrees, \")\\n\"\r\n \r\n if (usable_inner_degrees < 0)\r\n usable_inner_degrees = 0\r\n end\r\n \r\n usable_outer_degree = degrees_per_hole - outer_bit_and_spoke_degree\r\n #print \"(outer_bit_and_spoke_degree=\", outer_bit_and_spoke_degree, \")\\n\"\r\n #print \"(usable_outer_degree=\", usable_outer_degree, \")\\n\"\r\n\r\n if (usable_outer_degree < 0)\r\n usable_outer_degree = 0\r\n end\r\n \r\n if (usable_inner_degrees < 0)\r\n usable_inner_degrees = 0\r\n end\r\n \r\n #print \"(inner_bit_and_spoke_degree=\", inner_bit_and_spoke_degree, \")\\n\"\r\n \r\n \r\n beg_degree = 0\r\n for hole_num in (1..pNum_holes)\r\n mill.retract()\r\n \r\n \r\n end_inner_degree = (beg_degree + usable_inner_degrees)\r\n \r\n end_out_degree = (beg_degree + usable_outer_degree + pSpoke_angle)\r\n \r\n #print \"(beg_degree =\", beg_degree, \" end_inner_degree = \", end_inner_degree, \" end_out_degree=\", end_out_degree, \")\\n\"\r\n \r\n mill_fan_pocket(mill = aMill,\r\n cent_x = pCent_x,\r\n cent_y = pCent_y,\r\n in_radius = pMin_radius,\r\n in_beg_deg=beg_degree + bit_radius_degree_inner, \r\n in_end_deg=end_inner_degree, \r\n out_raius=pMax_radius,\r\n out_beg_deg=beg_degree + pSpoke_angle + bit_radius_degree_inner,\r\n out_end_deg=end_out_degree, \r\n pBeg_z = 0,\r\n pEnd_z= pEnd_z) \r\n \r\n aMill.retract() \r\n \r\n beg_degree += degrees_per_hole \r\n \r\n end #for\r\n aMill.retract() \r\n end",
"def land_area_km\n land_area * SQUARE_MILES_TO_KILOMETERS if land_area\n end",
"def area\n return @side_length * @side_length\n end",
"def area\n info[:area].to_sym\n end",
"def area\n\n return @side_len * @side_len\n\n\n end",
"def zone(&block)\n @zone ||= params.delete(:zone)\n die('You need to specify the zone (-z)') unless @zone\n yield @zone\n end",
"def extract_non_zero_zone_ids\n z = @requirements[:ene].map{|zone_id, arr| arr.any?{|e| !e.zero?} ? zone_id : nil }.compact\n z += @requirements[:pot].map{|zone_id, arr| arr.any?{|e| !e.zero?} ? zone_id : nil }.compact\n z += @imports.map{|zone_id, arr| arr.any?{|e| !e.zero?} ? zone_id : nil }.compact\n z += @limits.map{|to_zone_id, hash| hash.map{|from_zone_id, arr| arr.any?{|e| !e.zero?} ? to_zone_id : nil }}.flatten.compact\n z.uniq.sort\n end",
"def max_flight_distance; end",
"def get_area()\n unless check_keyword?(\"HEIGHT\") and check_keyword?(\"WIDTH\")\n raise \"Error: In the command #{@utype}:#{@command_name} the area could not be evaluated. Either the HEIGHT or WIDTH is invalid.\\n #{output}\"\n end\n return get_keyword_value(\"WIDTH\").to_f * get_keyword_value(\"HEIGHT\").to_f\n end",
"def south_greater_than_north_roads\n north = 78\n east = -100\n south = 79\n west = -101\n OverpassGraph.get_roads(north, east, south, west, [], [])\nend",
"def set_weather_and_climate_zone(climate_zone, epw_file_path, standard_to_be_used, latitude, longitude, ddy_file, *weather_argb)\n initialize_model\n\n determine_climate_zone(standard_to_be_used) if climate_zone.nil?\n\n # here we check if there is an valid EPW file, if there is we use that file otherwise everything will be generated from climate zone\n if !epw_file_path.nil? && File.exist?(epw_file_path)\n @epw_file_path = epw_file_path\n puts \"case 1: epw file exists #{epw_file_path} and climate_zone is: #{climate_zone}\"\n set_weather_and_climate_zone_from_epw(climate_zone, standard_to_be_used, latitude, longitude, ddy_file)\n elsif climate_zone.nil? && @climate_zone.nil?\n weather_station_id = weather_argb[1]\n state_name = weather_argb[2]\n city_name = weather_argb[3]\n puts 'case 2: climate_zone is nil at the Site and Building level'\n if !weather_station_id.nil?\n puts \"case 2.1: weather_station_id is not nil #{weather_station_id}\"\n @epw_file_path = BuildingSync::GetBCLWeatherFile.new.download_weather_file_from_weather_id(weather_station_id)\n elsif !city_name.nil? && !state_name.nil?\n puts \"case 2.2: SITE LEVEL city_name and state_name is not nil #{city_name} #{state_name}\"\n @epw_file_path = BuildingSync::GetBCLWeatherFile.new.download_weather_file_from_city_name(state_name, city_name)\n elsif !@city_name.nil? && !@state_name.nil?\n puts \"case 2.3: BUILDING LEVEL city_name and state_name is not nil #{@city_name} #{@state_name}\"\n @epw_file_path = BuildingSync::GetBCLWeatherFile.new.download_weather_file_from_city_name(@state_name, @city_name)\n end\n\n else\n puts \"case 3: SITE LEVEL climate zone #{climate_zone} BUILDING LEVEL climate zone #{@climate_zone}.\"\n puts \"lat #{latitude} long #{longitude}\"\n if climate_zone.nil?\n climate_zone = @climate_zone\n puts \"Climate Zone set at the Building level: #{climate_zone}\"\n else\n puts \"Climate Zone set at the Site level: #{climate_zone}\"\n end\n @epw_file_path = set_weather_and_climate_zone_from_climate_zone(climate_zone, standard_to_be_used, latitude, longitude)\n @epw_file_path = @epw_file_path.to_s\n end\n\n # Ensure a file path gets set, else raise error\n if @epw_file_path.nil?\n OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Building.set_weather_and_climate_zone', 'epw_file_path is nil and no way to set from Site or Building parameters.')\n raise StandardError, 'BuildingSync.Building.set_weather_and_climate_zone: epw_file_path is nil and no way to set from Site or Building parameters.'\n elsif !@epw_file_path\n OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Building.set_weather_and_climate_zone', \"epw_file_path is false: #{@epw_file_path}\")\n raise StandardError, \"BuildingSync.Building.set_weather_and_climate_zone: epw_file_path is false: #{@epw_file_path}\"\n elsif !File.exist?(@epw_file_path)\n OpenStudio.logFree(OpenStudio::Error, 'BuildingSync.Building.set_weather_and_climate_zone', \"epw_file_path does not exist: #{@epw_file_path}\")\n raise StandardError, \"BuildingSync.Building.set_weather_and_climate_zone: epw_file_path does not exist: #{@epw_file_path}\"\n end\n\n # setting the current year, so we do not get these annoying log messages:\n # [openstudio.model.YearDescription] <1> 'UseWeatherFile' is not yet a supported option for YearDescription\n year_description = @model.getYearDescription\n year_description.setCalendarYear(::Date.today.year)\n\n # add final condition\n OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Building.set_weather_and_climate_zone', \"The final weather file is #{@model.getWeatherFile.city} and the model has #{@model.getDesignDays.size} design day objects.\")\n OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.Building.set_weather_and_climate_zone', \"The path to the epw file is: #{@epw_file_path}\")\n end",
"def compute_free_places\n max_participants - compute_occupied_places\n end",
"def zone_setting(resource)\n resource.multi_az ? 'multi_az' : 'standard'\n end",
"def optimize_for_location(params)\n flight_floor = params[:flight_floor] || 5000 #meters\n flight_ceiling = params[:flight_ceiling] || 60000 #meters\n\n #verify parameters\n params = params.with_indifferent_access\n\n raise 'No start altitude (params[:start][:altitude])' unless params[:start][:altitude].present?\n raise 'No start latitude (params[:start][:lat])' unless params[:start][:lat].present?\n raise 'No start longitude (params[:start][:lon])' unless params[:start][:lon].present?\n raise 'No start time (params[:start][:time])' unless params[:start][:time].present?\n\n raise 'No finish latitude (params[:finish][:lat])' unless params[:finish][:lat].present?\n raise 'No finish longitude (params[:finish][:lon])' unless params[:finish][:lon].present?\n\n # creates a filter lambda to check that any path passes certain conditions\n filter = lambda {|node, previous|\n node.altitude < flight_ceiling &&\n node.altitude > flight_floor &&\n # (!x || y) checks y only if x is true\n (!params[:use_faa] || node.faa_zones_approx(previous)) && #no restricted zones\n (!params[:check_countries] || node.countries(previous))\n }\n\n #run the search with the provided start, duration, and performance factor\n greedy_search({\n start: Node.from_pos(\n params[:start][:lat].to_f, params[:start][:lon].to_f,\n params[:start][:altitude].to_f, params[:start][:time]\n ),\n finish: Node.from_pos(\n params[:finish][:lat].to_f, params[:finish][:lon].to_f,\n params[:start][:altitude].to_f, params[:start][:time]\n ),\n movement_cost: lambda {|current|\n #vent / ballast costs are proportional to the square of the altitude change\n (current.parent.altitude - current.altitude).abs/1200000.0\n },\n heuristic: lambda {|current|\n ((current.parent.lon - current.lon) / Prediction::time_variance)\n },\n neighbors: lambda {|current|\n current.neighbors(filter)\n },\n build_from_finish: lambda{|finish|\n finish.build_chain\n },\n timeout: params[:timeout],\n performance: params[:performance]\n })\n\n end",
"def area()\n return Math::PI*(vRadio**2)\n end",
"def area\n\t\t@side_length * @side_length\n\tend",
"def zone?\n false\n end",
"def test_that_plane_can_land_after_airport_is_full_and_a_take_off_happened\n # Add 75 planes to the airport terminal\n (Airport::DEFAULT_CAPACITY).times do |i|\n @airport.land Plane.new(i)\n end\n\n assert_equal Airport::DEFAULT_CAPACITY, @airport.plane_count\n\n # Remove a plane from terminal, therefore terminal is no longer full\n @airport.takeoff(@plane)\n refute @airport.full?\n end",
"def calculate_bbox_area\n if swlat && swlng && nelat && nelng && (swlat_changed? || swlng_changed? || nelat_changed? || nelng_changed?)\n height = nelat - swlat\n width = straddles_date_line? ? (180 - swlng) + (180 - nelng*-1) : nelng - swlng\n self.bbox_area = width * height\n end\n true\n end",
"def area_params\n permitted = ProductionArea.globalize_attribute_names + [:edrpou_code, :site, :railway_track, :railway_distance,\n :trucks_road, :state_road_distance, :airport_distance,\n :total_area, :building_year, :free_floors_count,\n :free_floors, :production_area, :additional, :phone,\n :email, :rent_year, :sale, :date_info, :main_image,\n :gis_type_name, :status, :map_layer_id, :ownership_id,\n questionnaire_images_attributes: %i[id imgable_type\n imgable_id _destroy],\n questionnaire_file_attributes: %i[id fileable_type file\n fileable_id _destroy],\n geo_json_attributes: %i[id geo_type position],\n balancer_ids: [], infrastructure_type_ids: []]\n params.require(:production_area).permit(permitted)\n end",
"def area_or_perimeter(l , w)\n if l === w\n (l * w)\n else \n 2*(l+w)\n end\nend",
"def getHeatedFloorArea( elements )\n # Initialize vars\n areaRatio = 0\n heatedFloorArea = 0\n\n # Get XML file version that \"elements\" came from. The version can be from the original file (pre-processed inputs)\n # or from the post-processed outputs (which will match the version of the H2K CLI used), depending on the \"elements\"\n # passed to this function.\n versionMajor = elements[\"HouseFile/Application/Version\"].attributes[\"major\"].to_i\n versionMinor = elements[\"HouseFile/Application/Version\"].attributes[\"minor\"].to_i\n versionBuild = elements[\"HouseFile/Application/Version\"].attributes[\"build\"].to_i\n\n if (versionMajor == 11 && versionMinor >= 5 && versionBuild >= 8) || versionMajor > 11 then\n # \"House\", \"Multi-unit: one unit\", or \"Multi-unit: whole building\"\n buildingType = elements[\"HouseFile/House/Specifications\"].attributes[\"buildingType\"]\n areaAboveGradeInput = elements[\"HouseFile/House/Specifications/HeatedFloorArea\"].attributes[\"aboveGrade\"].to_f\n areaBelowGradeInput = elements[\"HouseFile/House/Specifications/HeatedFloorArea\"].attributes[\"belowGrade\"].to_f\n else\n buildingType = \"House\"\n areaAboveGradeInput = elements[\"HouseFile/House/Specifications\"].attributes[\"aboveGradeHeatedFloorArea\"].to_f\n areaBelowGradeInput = elements[\"HouseFile/House/Specifications\"].attributes[\"belowGradeHeatedFloorArea\"].to_f\n end\n\n areaUserInputTotal = areaAboveGradeInput + areaBelowGradeInput\n\n case elements[\"HouseFile/House/Specifications/Storeys\"].attributes[\"code\"].to_f\n when 1\n numStoreysInput = 1\n when 2\n numStoreysInput = 1.5 # 1.5 storeys\n when 3\n numStoreysInput = 2\n when 4\n numStoreysInput = 2.5 # 2.5 storeys\n when 5\n numStoreysInput = 3\n when 6..7\n numStoreysInput = 2 # Split level or Spli entry/raised basement\n end\n\n # Get house area estimates from the first XML <results> section - these are totals of multiple surfaces\n if ( elements[\"HouseFile/AllResults/Results/Other/GrossArea\"].attributes[\"ceiling\"]!= nil ) then\n ceilingAreaOut = elements[\"HouseFile/AllResults/Results/Other/GrossArea\"].attributes[\"ceiling\"].to_i\n else\n ceilingAreaOut = 0\n end\n\n if ( elements[\"HouseFile/AllResults/Results/Other/GrossArea\"].attributes[\"slab\"]!= nil ) then\n slabAreaOut = elements[\"HouseFile/AllResults/Results/Other/GrossArea\"].attributes[\"slab\"].to_f\n else\n slabAreaOut = 0\n end\n\n if ( elements[\"HouseFile/AllResults/Results/Other/GrossArea/Basement\"].attributes[\"floorSlab\"] != nil ) then\n basementSlabAreaOut = elements[\"HouseFile/AllResults/Results/Other/GrossArea/Basement\"].attributes[\"floorSlab\"].to_f\n else\n basementSlabAreaOut = 0\n end\n\n if numStoreysInput == 1 then\n # Single storey house -- avoid counting a basement heated area\n areaEstimateTotal = ceilingAreaOut\n else\n # Multi-storey houses add area of \"heated\" basement & crawlspace (check if heated!)\n loc = \"HouseFile/House/Temperatures/Basement\"\n loc2 = \"HouseFile/House/Temperatures/Crawlspace\"\n if elements[loc].attributes[\"heated\"] == \"true\" || elements[loc].attributes[\"heatingSetPoint\"] == \"true\" || elements[loc2].attributes[\"heated\"] == \"true\"\n areaEstimateTotal = ceilingAreaOut * numStoreysInput + basementSlabAreaOut\n else\n areaEstimateTotal = ceilingAreaOut * numStoreysInput\n end\n end\n\n if areaEstimateTotal > 0\n areaRatio = areaUserInputTotal / areaEstimateTotal\n else\n stream_out(\"\\nNote: House area estimate from results section is zero.\\n\")\n end\n\n if buildingType.include? \"Multi-unit\" then\n # For multis using the \"new\" MURB method assume that heated area comes from a valid user input (not an estimate form ceiling/basement areas)\n heatedFloorArea = areaUserInputTotal\n elsif areaRatio > 0.50 && areaRatio < 2.0 then\n # Accept user input area if it's between 50% and 200% of the estimated area!\n heatedFloorArea = areaUserInputTotal\n else\n # Use user input area for Triplexes (type 4), Apartments (type 5), or\n # row house (end:6 or middle:8) regardless of area ratio (but non-zero)\n houseType = elements[\"HouseFile/House/Specifications/HouseType\"].attributes[\"code\"].to_i\n if (houseType == 4 || houseType == 5 || houseType == 6 || houseType == 8) && areaUserInputTotal > 0\n heatedFloorArea = areaUserInputTotal\n else\n heatedFloorArea = areaEstimateTotal\n end\n end\n\n return heatedFloorArea\nend"
] |
[
"0.5946686",
"0.57066447",
"0.5657436",
"0.5652678",
"0.5532186",
"0.548349",
"0.5475536",
"0.54697883",
"0.5463417",
"0.5409423",
"0.54061574",
"0.53949296",
"0.53713185",
"0.53558147",
"0.5306924",
"0.5298165",
"0.52961504",
"0.5287804",
"0.52870107",
"0.5281989",
"0.52508837",
"0.5233018",
"0.518587",
"0.5185296",
"0.51640433",
"0.51565963",
"0.5125356",
"0.5118413",
"0.510354",
"0.5096473",
"0.5078832",
"0.50768137",
"0.50667053",
"0.50559634",
"0.5055329",
"0.50472987",
"0.50354284",
"0.5023904",
"0.49959663",
"0.49869666",
"0.498669",
"0.4974578",
"0.49694383",
"0.49655923",
"0.49647868",
"0.4949591",
"0.4939617",
"0.49382174",
"0.49300075",
"0.49235988",
"0.492317",
"0.49088812",
"0.49006906",
"0.4900427",
"0.4899846",
"0.48996532",
"0.48948333",
"0.48905566",
"0.48818398",
"0.48797116",
"0.48793566",
"0.4870731",
"0.4851487",
"0.48505113",
"0.48432642",
"0.4836901",
"0.48298436",
"0.482813",
"0.4825588",
"0.48241156",
"0.4821391",
"0.48116016",
"0.48077118",
"0.48077118",
"0.48007724",
"0.47962067",
"0.4779951",
"0.4774947",
"0.47714",
"0.4770066",
"0.47676185",
"0.47566682",
"0.4739389",
"0.47333694",
"0.47269118",
"0.47266984",
"0.47264674",
"0.47242802",
"0.4723301",
"0.47207204",
"0.47189096",
"0.4716401",
"0.47161233",
"0.4713699",
"0.47127536",
"0.47121206",
"0.47077176",
"0.47043806",
"0.47013474",
"0.46998346"
] |
0.69650036
|
0
|
send internal stats to statsd Pass the request on to host given in config[:forwarder]
|
def response(env)
env.trace :response_beg
result_set = fetch_twitter_search(env.params['q'])
fetch_trstrank(result_set)
body = JSON.pretty_generate(result_set)
env.trace :response_end
[200, {}, body]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def send_stats\n first_time = @prev_stat.empty?\n stats = build_request\n @stat.keys.each { |k| stats[k] = @stat[k] - @prev_stat[k] }\n @prev_stat.replace(@stat)\n # These should be reported as absolute values\n [:mt, :ma, :mc].each {|k| @prev_stat[k] = 0}\n return if first_time\n\n req = Net::HTTP::Post.new('/')\n req.set_form_data(stats)\n res = Net::HTTP.start(API, use_ssl: true) { |http| http.request(req) }\n unless res.is_a?(Net::HTTPOK)\n STDERR.puts \"Error sending stat: #{res.message}\"\n end\n res\n end",
"def stats(query = nil, target = nil)\n send_data(\"STATS #{query} #{target}\".strip)\n end",
"def get_dns_forwarder_statistics_with_http_info(forwarder_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesDnsApi.get_dns_forwarder_statistics ...'\n end\n # verify the required parameter 'forwarder_id' is set\n if @api_client.config.client_side_validation && forwarder_id.nil?\n fail ArgumentError, \"Missing the required parameter 'forwarder_id' when calling ManagementPlaneApiServicesDnsApi.get_dns_forwarder_statistics\"\n end\n # resource path\n local_var_path = '/dns/forwarders/{forwarder-id}/statistics'.sub('{' + 'forwarder-id' + '}', forwarder_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DnsForwarderStatistics')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesDnsApi#get_dns_forwarder_statistics\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def proxy_request_to(args)\n @cgi, @http, @fp_log = args[:cgi], args[:http], args[:fp_log]\n \n headers = {\"Hayabusa_mode\" => \"proxy\"}\n @cgi.env.each do |key, val|\n keyl = key.to_s.downcase\n \n if key[0, 5] == \"HTTP_\"\n key = key[5, key.length].gsub(\"_\", \" \")\n key = key.to_s.split(\" \").select{|w| w.capitalize! or w }.join(\" \")\n key = key.gsub(\" \", \"-\")\n keyl = key.downcase\n \n if keyl != \"connection\" and keyl != \"accept-encoding\" and keyl != \"hayabusa-fcgi-config\" and key != \"hayabusa-cgi-config\"\n headers[key] = val\n end\n end\n end\n \n #Make request.\n uri = Knj::Web.parse_uri(@cgi.env[\"REQUEST_URI\"])\n url = File.basename(uri[:path])\n url = url[1, url.length] if url[0] == \"/\"\n \n if @cgi.env[\"QUERY_STRING\"].to_s.length > 0\n url << \"?#{cgi.env[\"QUERY_STRING\"]}\"\n end\n \n @fp_log.puts(\"Proxying URL: '#{url}'.\") if @fp_log\n \n #The HTTP-connection can have closed mean while, so we have to test it.\n raise Errno::ECONNABORTED unless @http.socket_working?\n \n # Count used to know what is the status line.\n @count = 0\n \n if @cgi.env[\"REQUEST_METHOD\"] == \"POST\"\n # Use CGI to parse post.\n real_cgi = Hayabusa::Cgi.new(@cgi)\n params = real_cgi.params\n \n if cgi.env[\"CONTENT_TYPE\"].to_s.downcase.include?(\"multipart/form-data\")\n @http.post_multipart(\n :url => url,\n :post => self.convert_fcgi_post_fileuploads_to_http2(self.convert_fcgi_post(params, :http2_compatible => true)),\n :default_headers => headers,\n :cookies => false,\n :on_content => self.method(:on_content)\n )\n else\n @http.post(\n :url => url,\n :post => self.convert_fcgi_post(params, :http2_compatible => true),\n :default_headers => headers,\n :cookies => false,\n :on_content => self.method(:on_content)\n )\n end\n else\n @http.get(\n :url => url,\n :default_headers => headers,\n :cookies => false,\n :on_content => self.method(:on_content)\n )\n end\n end",
"def send_agent_stats\n curr_time = Time.now\n\n if curr_time - @last_stat_flush > @stats_interval\n t = Process.times\n # amount of user/system cpu time in seconds\n Hastur.gauge(\"hastur.agent.utime\", t.utime, curr_time)\n Hastur.gauge(\"hastur.agent.stime\", t.stime, curr_time)\n # completed child processes' (plugins) user/system cpu time in seconds (always 0 on Windows NT)\n Hastur.gauge(\"hastur.agent.cutime\", t.cutime, curr_time)\n Hastur.gauge(\"hastur.agent.cstime\", t.cstime, curr_time)\n\n @counters.each do |name,count|\n if count > 0\n Hastur.counter(\"hastur.agent.#{name}\", count, curr_time)\n @counters[name] = 0\n end\n end\n\n # reset things\n @last_stat_flush = curr_time\n end\n end",
"def get_dns_forwarder_statistics(forwarder_id, opts = {})\n data, _status_code, _headers = get_dns_forwarder_statistics_with_http_info(forwarder_id, opts)\n data\n end",
"def run\n return if halted?\n\n http = request.em\n http.callback {\n Benchy.logger.info \"#{name}\\t| #{request.method.upcase} #{request.url} - HTTP #{http.response_header.status}\"\n run\n }\n http.errback {\n Benchy.logger.error \"#{name}\\t| Connection error!\"\n halt # TODO - Make this fail the ping and try again, not halt\n }\n end",
"def method_missing symbol, *args, &block\n @forwarder.call symbol, *args, &block\n end",
"def librato_send(stats)\n if @librato_api_key.nil? || @librato_api_key.empty? || @librato_email.nil? || @librato_email.empty?\n puts \"No librato api key and email\"\n return\n end\n begin\n Librato::Metrics.authenticate(@librato_email, @librato_api_key)\n\n metrics = {}\n stats[:plugins].keys.sort.each { |name|\n result = stats[:plugins][name]\n metrics[\"dynosaur.#{@heroku_app_name}.#{name}.value\"] = result[\"value\"]\n metrics[\"dynosaur.#{@heroku_app_name}.#{name}.estimate\"] = result[\"estimate\"]\n }\n metrics[\"dynosaur.#{@heroku_app_name}.combined.actual\"] = stats[:after]\n metrics[\"dynosaur.#{@heroku_app_name}.combined.estimate\"] = stats[:estimate]\n\n Librato::Metrics.submit(metrics)\n rescue Exception => e\n puts \"Error sending librato metrics\"\n puts e.message\n end\n end",
"def update_stats\n @request_count += 1\n discover_server_periodically if(time_to_discover? && !@disconnected_connections.empty?)\n end",
"def forward_request(env)\n rewrite_request(env)\n options = http_request_options(env)\n url = @request[:host] + @request[:uri]\n\n result = Tom::Http.make_request(@request[:method], url, options)\n\n headers = {\"Downstream-Url\" => url}.merge result.response_header\n [result.response_header.status, headers, result.response]\n end",
"def run_host(ip)\n\n\t\tself.target_port = datastore['RPORT']\t\n\n\t\tbegin\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET'\n\t\t\t}, 10)\n\n\t\t\tif (res and res.headers['Server'])\n\t\t\t\textra = http_fingerprint(res)\n\t\t\t\tprint_status(\"#{ip} is running #{res.headers['Server']}#{extra}\")\n\n\t\t\t\trep_id = wmap_base_report_id(\n\t\t\t\t\t\twmap_target_host,\n\t\t\t\t\t\twmap_target_port,\n\t\t\t\t\t\twmap_target_ssl\n\t\t\t\t)\n\t\t\t\twmap_report(rep_id,'WEB_SERVER','TYPE',\"#{res.headers['Server']}#{extra}\",nil)\n\t\t\tend\n\t\t\t\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\n\tend",
"def on_dispatch_request(cli,data)\n peer = \"#{cli.ip_daddr}:\" << (cli.is_udp? ? \"#{cli.udp_dst}\" : \"#{cli.tcp_dst}\")\n # Deal with non DNS traffic\n begin\n req = Packet.encode_drb(data)\n rescue => e\n print_error(\"Could not decode payload segment of packet from #{peer}, check log\")\n dlog e.backtrace\n return\n end\n answered = []\n # Find cached items, remove request from forwarded packet\n req.question.each do |ques|\n cached = service.cache.find(ques.qname, ques.qtype.to_s)\n if cached.empty?\n next\n else\n req.answer = (req.answer + cached).uniq\n answered << ques\n end\n end\n if answered.count < req.question.count and service.fwd_res\n if !req.header.recursive?\n vprint_status(\"Recursion forbidden in query for #{req.question.first.name} from #{peer}\")\n else\n forward = req.dup\n forward.question = req.question - answered\n forwarded = service.fwd_res.send(Packet.validate(forward))\n forwarded.answer.each do |ans|\n rstring = ans.respond_to?(:address) ? \"#{ans.name}:#{ans.address}\" : ans.name\n vprint_status(\"Caching response #{rstring} #{ans.type}\")\n service.cache.cache_record(ans)\n end unless service.cache.nil?\n # Merge the answers and use the upstream response\n forwarded.answer = (req.answer + forwarded.answer).uniq\n req = forwarded\n end\n end\n service.send_response(cli, Packet.validate(Packet.generate_response(req)).data)\n end",
"def send_data\n request = Collector::Request.\n new(self.api_location,\n :user => config[:htpasswd_user],\n :pass => config[:htpasswd_pass])\n\n # convert the array of object to a hash\n server = {\n websites: @websites.map{ |w| w.to_hash(@version).merge({server: config[:client_name].underscore }) }.map{ |w| w[:website] },\n name: config[:client_name].underscore\n }\n\n request.send(server)\n\n end",
"def record_stats(env, start_time)\n statsd_client = Protobuf::Statsd.client\n path = statsd_base_path(env)\n return unless statsd_client && path && env.response\n end_time = Time.now.utc\n\n if env.response.is_a?(Protobuf::Rpc::PbError)\n statsd_client.increment(\"#{path}.failure.total\")\n statsd_client.increment(\"#{path}.failure.#{env.response.error_type}\")\n else\n statsd_client.increment(\"#{path}.success\")\n end\n\n statsd_client.timing(\"#{path}.time\", end_time - start_time)\n rescue => e\n # We insert ourself after Exception handler, so no exceptions allowed!\n logger.warn { \"Error with Statsd middleware: #{e.message}\" }\n end",
"def record_request(status, env)\n now = Time.now\n diff = (now - @start)\n if $statsd\n $statsd.timing(\"response_time\", diff * 1000)\n if VALID_METHODS.include?(env[REQUEST_METHOD])\n stat = \"response_time.#{env[REQUEST_METHOD].downcase}\"\n $statsd.timing(stat, diff * 1000)\n end\n\n if suffix = status_suffix(status)\n $statsd.increment \"status_code.#{status_suffix(status)}\"\n end\n\n api = env[\"API\"]\n if api\n $statsd.timing(\"response_time.#{api}\", diff * 1000)\n $statsd.increment \"status_code.#{status_suffix(status)}.#{api}\"\n end\n\n if @track_gc && GC.time > 0\n $statsd.timing \"gc.time\", GC.time / 1000\n $statsd.count \"gc.collections\", GC.collections\n end\n end\n\n rescue => boom\n warn \"Statsd::Rack#record_request failed: #{boom}\"\n end",
"def fasthttp_statistics\n super\n end",
"def run_host(ip)\n\n\t\t@thost = ip\n\n\t\tbegin\n\t\t\tudp_sock = nil\n\n\t\t\t@probes.each do |probe|\n\n\t\t\t# Send each probe to each host\n\n\t\t\t\tbegin\n\t\t\t\t\tdata, port = self.send(probe, ip)\n\t\t\t\t\t@tport = port\n\n\t\t\t\t\t# Create an unbound UDP socket if no CHOST is specified, otherwise\n\t\t\t\t\t# create a UDP socket bound to CHOST (in order to avail of pivoting)\n\t\t\t\t\tudp_sock = Rex::Socket::Udp.create( {\n\t\t\t\t\t\t'LocalHost' => datastore['CHOST'] || nil,\n\t\t\t\t\t\t'PeerHost' => ip, 'PeerPort' => port,\n\t\t\t\t\t\t'Context' => {'Msf' => framework, 'MsfExploit' => self}\n\t\t\t\t\t})\n\n\t\t\t\t\tudp_sock.put(data)\n\n\t\t\t\t\tr = udp_sock.recvfrom(65535, 0.1) and r[1]\n\t\t\t\t\tparse_reply(r) if r\n\n\t\t\t\trescue ::Interrupt\n\t\t\t\t\traise $!\n\t\t\t\trescue ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionRefused, ::IOError\n\t\t\t\t\tnil\n\t\t\t\tensure\n\t\t\t\t\tudp_sock.close if udp_sock\n\t\t\t\tend\n\n\t\t\tend\n\t\trescue ::Interrupt\n\t\t\traise $!\n\t\trescue ::Exception => e\n\t\t\tprint_status(\"Unknown error: #{@thost}:#{@tport} #{e.class} #{e}\")\n\t\tend\n\tend",
"def instrument!(state, counters, gauges, timers)\n stats = self.json_stats\n return if stats.empty?\n\n backlog = stats[\"backlog\"]\n if backlog.nil?\n backlog = stats[\"worker_status\"].map do |worker_status|\n worker_status[\"last_status\"][\"backlog\"]\n end.reduce(0, :+)\n end\n\n gauges[:'backlog.requests'] = backlog\n end",
"def hunting_info(req, hits)\n info = {\n client_ip: req.env[\"REMOTE_ADDR\"],\n hits: hits.join(\",\"),\n type: \"sleep-warm-hunting\"\n }\n info[:message] = \"#{info[:client_ip]} #{info[:hits]}\"\n\n info\n end",
"def send(metric)\n begin\n open_socket()\n @logger.debug(\"Send metric \\\"#{metric.host_prefix_name}\\\" \" \\\n \"to #{@host}:#{@port}...\")\n @socket.send(metric.format_before_send, 0)\n @socket.close\n rescue\n @logger.error(\"Failed to send metric \\\"#{metric.host_prefix_name}\\\" \" \\\n \"to StatsD\")\n end\n end",
"def set_forward_stat\n @forward_stat = ForwardStat.find(params[:id])\n end",
"def capture_traffic\n check_pcaprub_loaded()\n ::Socket.do_not_reverse_lookup = true # Mac OS X workaround\n open_pcap({'FILTER' => datastore['FILTER']})\n @capture_thread = Rex::ThreadFactory.spawn(\"DNSSpoofer\", false) do\n each_packet do |pack|\n begin\n parsed = PacketFu::Packet.parse(pack)\n reply = reply_packet(parsed)\n service.dispatch_request(reply, parsed.payload)\n rescue => e\n vprint_status(\"PacketFu could not parse captured packet\")\n dlog(e.backtrace)\n end\n end\n end\n end",
"def on_request_uri(cli, request)\n\t\tsend_response(cli, @wpad_data, { 'Content-Type' => \"application/x-ns-proxy-autoconfig\" } )\n\tend",
"def run\n return unless ping_handler && formatter\n\n formatter.header(\n '# It goes PING! .. testing', options[:url],\n (limit ? \"#{limit} times - once\" : nil),\n 'every', interval, 'seconds'\n )\n ping_count = 0\n while limit.nil? || ping_count < limit\n status = ping_handler.ping?\n formatter.log(status, formatter.duration(ping_handler.duration), ping_handler.exception)\n ping_count += 1\n sleep interval if limit.nil? || ping_count < limit\n end\n end",
"def stats(&blk)\n if block_given?\n websocket.subscribe :stats, &blk\n else\n http.get :stats\n end\n end",
"def send_data_impl(*args)\n puts \"send(#{args[0]})\" if $verbose\n event_list = []\n data = []\n args[0].each do |x|\n # if hashring is not nil this is valid metric\n if x[:hashring] != nil\n @@message_queue << {\n :hashring => x[:hashring],\n :timestamp => Time.now.to_f,\n :data => x[:data]\n }\n end\n data << x[:data]\n event_list << x[:event]\n end\n @expected_events << event_list\n @data_socket.send(data.join(\"\\n\") + \"\\n\", 0, '127.0.0.1', SR_DATA_PORT)\n end",
"def log(env, status, response_headers, began_at, body)\n data = {\n :method => env[\"REQUEST_METHOD\"],\n :path => env[\"PATH_INFO\"],\n :query_string => env[\"QUERY_STRING\"],\n :host => Socket.gethostname,\n :status => status.to_i,\n :duration => (Time.now - began_at),\n :remote_addr => env['REMOTE_ADDR'],\n :request => request_line(env),\n :\"X-Forwarded-For\" => response_headers['X-Forwarded-For']\n\n }\n\n # Added calling for the proc and merge the data if it exists\n\n if @proc\n begin\n new_hash = @proc.call(env)\n data = data.merge new_hash if new_hash.class == Hash\n rescue Exception => e\n STDERR.puts \"Exception in your proc : #{e.message}.\"\n end\n end\n\n # This just works for all body types (magic?)... see http://www.rubydoc.info/github/rack/rack/Rack/BodyProxy\n body.each{|x| data[:body] = x[0..@options[:body_len]] }\n @options[:request_headers].each { |header, log_key| env_key = \"HTTP_#{header.upcase.gsub('-', '_')}\" ; data[log_key] = env[env_key] if env[env_key]} if !@options[:request_headers].nil?\n @options[:response_headers].each { |header, log_key| data[log_key] = response_headers[header] if response_headers[header] } if !@options[:response_headers].nil?\n\n data[:error_msg] = env[\"sinatra.error\"] if env.has_key?(\"sinatra.error\")\n\n\n\n @options[:body_regex].each { |k,v| data[k] = data[:body].to_s.match(/#{v}/).captures[0].gsub(\"\\\\\",\"\").gsub(\"\\\"\",\"\") rescue data[k]= \"\" } if !@options[:body_regex].nil?\n\n severity = \"DEBUG\"\n case status\n when 300..399 then severity = \"WARN\"\n when 400..599 then severity = \"ERROR\"\n end\n event = {:severity => severity}.merge data\n # TODO to include this lines\n begin\n device.puts( event.to_json )\n rescue Exception => e\n STDERR.puts \"Error : Failed to write log to : #{@options[:url]}, #{e.message}.\"\n @device = nil\n end\n end",
"def stats\n request :get, \"_stats\"\n end",
"def stats\n request :get, \"_stats\"\n end",
"def run()\n # let's install signal handlers\n Signal.trap(\"INT\") { EventMachine.stop }\n Signal.trap(\"TERM\") { EventMachine.stop }\n # let's generate config file for statsd router\n File.open(SR_CONFIG_FILE, \"w\") do |f|\n f.puts(\"log_level=1\")\n f.puts(\"data_port=#{SR_DATA_PORT}\")\n f.puts(\"control_port=#{SR_CONTROL_PORT}\")\n f.puts(\"downstream_health_check_interval=#{SR_DS_HEALTH_CHECK_INTERVAL}\")\n f.puts(\"downstream_flush_interval=#{SR_DS_FLUSH_INTERVAL}\")\n f.puts(\"downstream_ping_interval=#{SR_DS_PING_INTERVAL}\")\n f.puts(\"ping_prefix=#{SR_PING_PREFIX}\")\n f.puts(\"threads_num=#{THREADS_NUM}\")\n f.puts(\"downstream=#{(0...DOWNSTREAM_NUM).to_a.map {|x| BASE_DS_PORT + 2 * x}.map {|x| \"127.0.0.1:#{x}:#{x + 1}\"}.join(',')}\")\n end\n @downstream = []\n # socket for sending data\n @data_socket = UDPSocket.new\n # here we start event machine\n EventMachine::run do\n # let's init downstreams\n (0...DOWNSTREAM_NUM).each do |i|\n sm = StatsdMock.new(BASE_DS_PORT + 2 * i, BASE_DS_PORT + 2 * i + 1, i, self)\n @downstream << sm\n end\n # start statsd router\n EventMachine.popen(\"#{SR_EXE_FILE} #{SR_CONFIG_FILE}\", OutputHandler, self)\n sleep 1\n # and set timer to interrupt test in case of timeout\n EventMachine.add_timer(@timeout) do\n abort(\"Timeout\")\n end\n advance_test_sequence()\n end\n end",
"def raw_stats\n url = URI.parse(stats_url)\n Net::HTTP.start(url.host, url.port) {|http|\n http.request(Net::HTTP::Get.new(url.path))\n }.body\nend",
"def proxy_service(req, res)\n # Proxy Authentication\n proxy_auth(req, res)\n @config[:forwarder].forward(req, res)\n end",
"def enable_dns_forwarder_enable_with_http_info(forwarder_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesDnsApi.enable_dns_forwarder_enable ...'\n end\n # verify the required parameter 'forwarder_id' is set\n if @api_client.config.client_side_validation && forwarder_id.nil?\n fail ArgumentError, \"Missing the required parameter 'forwarder_id' when calling ManagementPlaneApiServicesDnsApi.enable_dns_forwarder_enable\"\n end\n # resource path\n local_var_path = '/dns/forwarders/{forwarder-id}?action=enable'.sub('{' + 'forwarder-id' + '}', forwarder_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesDnsApi#enable_dns_forwarder_enable\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_stats_for_worker(worker_addr, maxtime)\n stats = {} \n stat_entries = []\n @log_entries.synchronize do\n stat_entries = @log_entries[worker_addr].select { |item| (Time.now - item[:time_local].to_time) <= maxtime }\n end \n \n stats[:request_count] = stat_entries.size\n stats[:response_time] = get_stats_for_one(stat_entries, :upstream_response_time)\n stats[:request_length] = get_stats_for_one(stat_entries, :request_length)\n stats[:response_length] = get_stats_for_one(stat_entries, :body_bytes_sent)\n\n stats\n end",
"def dispatcher\n endpoint_dispatch(params[:address])\n end",
"def update_stats\n StatService.new(self).update_stats\n end",
"def internal_send_request(request, options)\n log_method = request == 'append_error' ? :error : :info\n log_text = AuditFormatter.send(format_method(request), options[:text])[:detail]\n log_text.chomp.split(\"\\n\").each { |l| RightLinkLog.__send__(log_method, l) }\n options[:audit_id] = @audit_id\n RightScale::RequestForwarder.push(\"/auditor/#{request}\", options)\n true\n end",
"def stats_uri(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"stats uri \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def udp_statistics\n super\n end",
"def add_forward_lookup(_ip, _hostname)\n end",
"def emit\n render 'sandbox/service', proxy: @proxy\n end",
"def call request, response\n\t\t\t\tbegin\n\t\t\t\t\thost = get_host(request[:host_name].to_s.downcase) || @hosts[:default]\n\t\t\t\t\treturn false unless host\n\t\t\t\t\trequest[:host_settings] = host.params\n\t\t\t\t\t# render any assets?\n\t\t\t\t\treturn true if render_assets request, response, host.params\n\t\t\t\t\t# send static file, if exists and root is set.\n\t\t\t\t\treturn true if Base::HTTPSender.send_static_file request, response\n\t\t\t\t\t# return if a route answered the request\n\t\t\t\t\thost.routes.each {|r| a = r.on_request(request, response); return a if a}\n\t\t\t\t\t#return error code or 404 not found\n\t\t\t\t\treturn Base::HTTPSender.send_by_code request, response, 404 unless ( @avoid_404 ||= ( Iodine::Http.on_http == ::Iodine::Http::Rack ? 1 : 0 ) ) == 1\n\t\t\t\trescue => e\t\t\t\t\n\t\t\t\t\t# return 500 internal server error.\n\t\t\t\t\tIodine.error e\n\t\t\t\t\tBase::HTTPSender.send_by_code request, response, 500\n\t\t\t\tend\n\t\t\tend",
"def broker_stats\n handling_kestrel_errors do\n client.stats!\n end\n end",
"def metrics_server\n @_metrics_server ||= Thread.new do\n Rack::Handler::WEBrick.run(\n Rack::Builder.new {\n use Prometheus::Middleware::Exporter, registry: SidekiqPrometheus.registry\n run ->(_) { [301, { 'Location' => '/metrics' }, []] }\n },\n Port: SidekiqPrometheus.metrics_port,\n BindAddress: '127.0.0.1',\n )\n end\n end",
"def run(agent)\n @agent = agent\n agent.logger ||= @logger\n register_latency_timer\n end",
"def forward(data)\n timestamp = Time.now\n http = Net::HTTP.new(url.host, url.port)\n \n http.read_timeout = http_read_timeout\n http.open_timeout = http_open_timeout\n \n \n request = Net::HTTP::Post.new(url.request_uri)\n request['Authorization'] = Authorization.new(data, timestamp).header\n request['Content-Type'] = 'application/octet-stream'\n request.body = data\n \n if secure\n http.use_ssl = true\n http.ca_file = OpenSSL::X509::DEFAULT_CERT_FILE if File.exist?(OpenSSL::X509::DEFAULT_CERT_FILE)\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n else\n http.use_ssl = false\n end\n \n response = nil\n \n begin\n response = http.request(request)\n rescue Exception => e\n puts \"Timeout while connecting to the Sentry server\"\n end\n end",
"def enable_dns_forwarder_enable(forwarder_id, opts = {})\n enable_dns_forwarder_enable_with_http_info(forwarder_id, opts)\n nil\n end",
"def poll_stats\n curr_time = Time.now\n # After some timeout, send the incremental difference to Hastur\n if curr_time - @last_stat_flush > @stats_interval\n Hastur.counter(\"router.num_msgs\", @num_msgs, curr_time)\n # reset stats\n @num_msgs = 0\n @last_stat_flush = curr_time\n end\n end",
"def send_request(req); end",
"def run\n @router_socket = Hastur::Util.connect_socket @ctx, ZMQ::DEALER, @routers, :linger => 1, :hwm => 10_000\n @poller.register_readable @router_socket\n\n set_up_local_ports\n\n Hastur.start\n @running = true\n\n last_system_stat_time = Time.now\n last_heartbeat_time = Time.now - 61\n\n while @running\n poll_noop\n poll_registration_timeout\n poll_ohai_info_timeout\n poll_heartbeat_timeout\n poll_ack_timeouts\n poll_plugin_pids\n poll_zmq rescue nil # Temp: 2012-05-02, should properly detect & log bad messages\n send_agent_stats unless @no_agent_stats\n\n if select([@udp_socket], [], [], 0.25)\n poll_udp\n end\n\n now = Time.now\n # agent doesn't use the Hastur background thead, send a heartbeat every minute\n if (now - last_heartbeat_time) >= 60\n Hastur.heartbeat(\"hastur.agent.process_heartbeat\")\n last_heartbeat_time = now\n end\n\n # send Linux stats every 10 seconds\n if (now - last_system_stat_time) >= 10 and File.exists?(\"/proc/net/dev\")\n Hastur::Agent::LinuxStats.run\n last_system_stat_time = now\n end\n end\n\n msg = Hastur::Message::Log.new :from => @uuid, :payload => \"Hastur Agent #{@uuid} exiting.\"\n _send(msg)\n\n @router_socket.close\n end",
"def send_proxy_connect_request(req); end",
"def stats_loop\n sleep 5\n loop do\n @launcher.events.debug \"statsd: notify statsd\"\n begin\n stats = PumaStats.new(fetch_stats)\n @statsd.client.gauge('puma_workers', stats.workers)\n @statsd.client.gauge('puma_booted_workers', stats.booted_workers)\n @statsd.client.gauge('puma_backlog', stats.backlog)\n @statsd.client.gauge('puma_running', stats.running)\n @statsd.client.gauge('puma_pool_capacity', stats.pool_capacity)\n @statsd.client.gauge('puma_max_threads', stats.max_threads)\n rescue StandardError => e\n @launcher.events.error \"! statsd: notify stats failed:\\n #{e.to_s}\\n #{e.backtrace.join(\"\\n \")}\"\n ensure\n sleep 2\n end\n end\n end",
"def start_stats\n @entry = CallStat.new\n @entry.user = @current_user\n if (params[:lon])\n @entry.longitude = params[:lon]\n end\n if (params[:lat])\n @entry.latitude = params[:lon]\n end\n if (params[:t])\n @entry.call_time = Time.parse(params[:t])\n end\n @entry.recv_time = Time.now\n @entry.sessionid = request.session_options[:id]\n @entry.controller = self.controller_name\n @entry.action = self.action_name\n end",
"def process\n send_request @action\n end",
"def format_stats ( server_stats, host = 'localhost', port = 11211, options = {} )\n stats = {}\n carbon_prefix = options[:carbon_prefix]\n server_piece = sprintf(\"%s.port_%s\", \n format_hostname(host, options),\n port)\n\n prefix = [carbon_prefix, server_piece].join('.')\n stats.merge! server_stats.prefix_keys(\"#{prefix}.\")\n\n# only return numeric values\n# & convert to floats\n Hash[stats.map { |k,v| [k, v.to_f] if numeric? v }]\nend",
"def stats(zone, interval = 20)\n send_req({a: :stats, z: zone, interval: interval})\n end",
"def send_request; end",
"def throttle_api\n Rate::Limiter.new(request.env['REMOTE_ADDR'], request.env['REQUEST_PATH']).set\n end",
"def post_init\n port, ip = Socket.unpack_sockaddr_in(get_peername)\n host = Socket.getaddrinfo(ip, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)[0][2]\n ActiveRecord::Base.logger.info \"-- Collector connection established from #{host}\"\n end",
"def stats_refresh(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"stats refresh \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def setup_forwarded_info\n if @forwarded_server = self[\"x-forwarded-server\"]\n @forwarded_server = @forwarded_server.split(\",\", 2).first\n end\n @forwarded_proto = self[\"x-forwarded-proto\"]\n if host_port = self[\"x-forwarded-host\"]\n host_port = host_port.split(\",\", 2).first\n @forwarded_host, tmp = host_port.split(\":\", 2)\n @forwarded_port = (tmp || (@forwarded_proto == \"https\" ? 443 : 80)).to_i\n end\n if addrs = self[\"x-forwarded-for\"]\n addrs = addrs.split(\",\").collect(&:strip)\n addrs.reject!{|ip| PrivateNetworkRegexp =~ ip }\n @forwarded_for = addrs.first\n end\n end",
"def send(stat, delta, type, sample_rate)\n stat = [stat].flatten.compact.collect(&:to_s).join('.').downcase\n stat = stat.gsub('::', '.').gsub(RESERVED_CHARS_REGEX, '_')\n\n k = [Fozzie.c.data_prefix, stat].compact.join('.')\n k << \":\"\n k << [delta, type].join('|')\n k << '@%s' % sample_rate.to_s if sample_rate < 1\n\n sampled(sample_rate) { send_to_socket(k.strip) }\n end",
"def process_http_request\n route_http_request\n end",
"def send(hash)\n Hammer.logger.debug \"Websocket sending: #{hash}\" if config[:logger][:show_traffic]\n super hash.to_json\n end",
"def update_dns_forwarder_with_http_info(forwarder_id, dns_forwarder, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesDnsApi.update_dns_forwarder ...'\n end\n # verify the required parameter 'forwarder_id' is set\n if @api_client.config.client_side_validation && forwarder_id.nil?\n fail ArgumentError, \"Missing the required parameter 'forwarder_id' when calling ManagementPlaneApiServicesDnsApi.update_dns_forwarder\"\n end\n # verify the required parameter 'dns_forwarder' is set\n if @api_client.config.client_side_validation && dns_forwarder.nil?\n fail ArgumentError, \"Missing the required parameter 'dns_forwarder' when calling ManagementPlaneApiServicesDnsApi.update_dns_forwarder\"\n end\n # resource path\n local_var_path = '/dns/forwarders/{forwarder-id}'.sub('{' + 'forwarder-id' + '}', forwarder_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dns_forwarder)\n auth_names = ['BasicAuth']\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 => 'DnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesDnsApi#update_dns_forwarder\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def stats(query = nil, target = nil)\n raw \"STATS #{query} #{target}\".strip << \"\\r\\n\"\n end",
"def reset_udp_statistics\n super\n end",
"def dispatcher_stats\n dispatchers.stats\n end",
"def create_dns_forwader_with_http_info(dns_forwarder, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesDnsApi.create_dns_forwader ...'\n end\n # verify the required parameter 'dns_forwarder' is set\n if @api_client.config.client_side_validation && dns_forwarder.nil?\n fail ArgumentError, \"Missing the required parameter 'dns_forwarder' when calling ManagementPlaneApiServicesDnsApi.create_dns_forwader\"\n end\n # resource path\n local_var_path = '/dns/forwarders'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(dns_forwarder)\n auth_names = ['BasicAuth']\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 => 'DnsForwarder')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesDnsApi#create_dns_forwader\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def listen()\n\t\t\n\t\tputs \"Listening for dns traffic...\"\n\t\t#setup the filter to only grab dns traffic from the victim\n\t\tfilter = \"udp and port 53 and src \" + @victim_ip\n\n\t\t# Start packet sniffing\n cap = PacketFu::Capture.new(:iface => @ifname, :start => true,\n :promisc => true, :filter => filter, :save => true)\n cap.stream.each do |pkt|\n\n \t if PacketFu::UDPPacket.can_parse?(pkt) then\n packet = PacketFu::Packet.parse(pkt)\n\n dns_type = packet.payload[2].unpack('h*')[0].chr + \\\n packet.payload[3].unpack('h*')[0].chr\n\n\t\t\t\t\tif dns_type == '10' #not really ten, rather 1-0 (binnary) flag\n\n\t\t\t\t\t\tdomain_name = extract_domain_name(packet.payload[12..-1])\t\n\n\t\t\t\t\t # Check if domain name field is empty\n if domain_name.nil? then\n puts \"Empty domain name field\"\n next\n end # domain_name.nil?\n\n send_response(packet, domain_name)\n end\n end # UDPPacket.can_parse?\n end #end packet capturing\n end",
"def send! data\n send_output_io! data if @output_io || host\n send_log_io! data if log_io\n self\n end",
"def throttled_responder=(_arg0); end",
"def live_send(destinations,body,clientmessagereference,options = {})\n @options[:method] = 'sendsms'\n @options[:destinations] = to_csv(destinations) \n @options[:clientmessagereference] = clientmessagereference\n @options[:body] = body\n @options.merge(options)\n response = ta_response(send_params)\n return response\n end",
"def proxy(port, num = 1, location = '/')\n pputs \"upstream #{$server.name}_#{port}_cluster {\"\n num.times {|i| pputs \" server 127.0.0.1:#{port+i};\"}\n pputs \"}\\n\"\n\n oputs <<-eos\n location #{location} {\n proxy_pass http://#{$server.name}_#{port}_cluster;\n proxy_redirect off;\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n }\n eos\nend",
"def option_socket_stats\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"option socket-stats \" + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end",
"def proxy_pass; end",
"def create_dns_forwader(dns_forwarder, opts = {})\n data, _status_code, _headers = create_dns_forwader_with_http_info(dns_forwarder, opts)\n data\n end",
"def send_request(req)\n raise TypeError if !req.is_a?(RequestContext)\n raise \"Request context seems to be sent already: #{req.state}\" if req.state != :init\n\n # possible timeout_sec values:\n # timeout_sec == -1.0 : to be overwritten to the default timeout.\n # timeout_sec == 0.0 : never be timed out.\n # timeout_sec > 0.0 : wait for the user set timeout.\n if req.timeout_sec == -1.0\n # set default timeout if no one updated the initial value.\n req.timeout_sec = config_section.timeout_sec\n end\n\n req.process_event(:on_ready)\n\n EventMachine.schedule {\n @stats[:total_request_count] += 1\n if @stats[:peak_wait_response_size] < @active_requests.size\n @stats[:peak_wait_response_size] = @active_requests.size\n end\n if !req.oneshot\n @active_requests[req.ticket] = req\n end\n\n # create receiver queue every time before publish the message.\n # This helps to receive messages from the failed receiver.\n amq.queue(endpoint_queue_name(req.endpoint), {:exclusive=>false, :auto_delete=>true})\n @requested_endpoints[req.endpoint] = 1\n\n amq.default_exchange.publish(Serializer.instance.marshal(req.request_hash),\n {:message_id => req.ticket,\n :key => endpoint_queue_name(req.endpoint),\n :reply_to=>\"command-recv.#{manifest.node_id}\"}\n )\n req.process_event(:on_sent)\n }\n end",
"def send_metric(name, value, type, unit)\n metric = \"gmetric -g Smoker -t #{type} -n \\\"#{name}\\\" -v #{value} -u \\\"#{unit}\\\" -c /etc/ganglia/gmond.conf\"\n puts \"sending: #{metric}\"\n `#{metric}`\nend",
"def process\n return if self.metrics.nil? # failed reports may have no metrics? be safe.\n changes = self.metrics['changes']['total']\n\n if changes > 0\n epochtime = Time.now.utc.to_i\n host_as_underscores = self.host.gsub(/\\./, '_')\n name = \"#{PATH_PREFIX}.#{host_as_underscores}\" \n\n send_metric \"#{name} #{changes} #{epochtime}\"\n end\n end",
"def send_node_stats(node_ip)\n metrics_queue = Librato::Metrics::Queue.new\n\n cadvisor_res = Typhoeus.get(\"http://#{node_ip}:4194/api/v1.3/docker/\")\n data = Oj.load(cadvisor_res.body)\n\n data.values.each do |container|\n # Skip containers that aren't managed by kube:\n next if container['spec']['labels'].nil?\n\n # Parse the container name out of the container name auto-generated by kube\n # see https://github.com/kubernetes/heapster/blob/78ff89c01f52c0ab49dac2d356a8371e79482544/sources/datasource/kubelet.go#L156 \n container_name = container['aliases'].first.split('.').first.sub('k8s_','')\n\n # Join all of this together into a librato source name:\n source_name = ENV['CONTEXT'] + '.' + container['spec']['labels']['io.kubernetes.pod.name'].sub('/', '.') + '.' + container_name\n\n puts source_name\n\n stats = container['stats'].last\n\n # k8s_POD form the virtual network for a pod. We must collect net stats from this container,\n # since net counters for indvidual pod containers are always 0. See http://stackoverflow.com/questions/33472741/what-work-does-the-process-in-container-gcr-io-google-containers-pause0-8-0-d\n # for more info. No need to collect memory and cpu stats for this container.\n if container_name == 'POD'\n metrics_queue.add \"kube.network.tx_bytes\" => { type: :counter, value: stats['network']['tx_bytes'], source: source_name }\n metrics_queue.add \"kube.network.rx_bytes\" => { type: :counter, value: stats['network']['rx_bytes'], source: source_name }\n next\n end\n\n if stats['cpu']\n cpu_ms = stats['cpu']['usage']['total'] / 1000000\n metrics_queue.add \"kube.cpu.usage_ms\" => { type: :counter, value: cpu_ms, source: source_name }\n end\n \n if stats['memory']\n metrics_queue.add \"kube.memory.usage\" => { value: stats['memory']['usage'], source: source_name }\n metrics_queue.add \"kube.memory.rss\" => { value: stats['memory']['working_set'], source: source_name }\n end\n end\n\n metrics_queue.submit\nend",
"def msg_STATS(source, args)\n # :UID STATS letter :targetSID\n u = User.find_by_uid(source)\n if u == nil\n return nil\n end\n\n if !u.isoper\n return [\"481 #{source} :Permission Denied - You're not an IRC operator\",\n \"219 #{source} #{args[0]} :End of /STATS report\"]\n end\n\n # We can assume targetSID is us; we have nowhere else to route it to\n ret = []\n case args[0]\n when 'o', 'O'\n #<07:01:47> :hydra.invalid 243 culex O *@* * fabio admin -1\n $config.opers.each do |oper|\n ret.push(\"243 #{source} O #{oper.to_stats_string()}\")\n end\n end\n ret.push(\"219 #{source} #{args[0]} :End of /STATS report\")\n return ret\n end",
"def outlet\n loop do\n http = Net::HTTP.new(@logplex_url.host, @logplex_url.port)\n http.set_debug_output($stdout) if ENV['DEBUG']\n http.use_ssl = true if @logplex_url.scheme == 'https'\n begin\n http.start do |conn|\n num_reqs = 0\n while num_reqs < @max_reqs_per_conn\n #Blocks waiting for a request.\n req = @request_queue.deq\n @req_in_flight += 1\n resp = nil\n begin\n Timeout::timeout(@conn_timeout) {resp = conn.request(req)}\n rescue => e\n $stdout.puts(\"at=req-error msg=#{e.message}\") if ENV['DEBUG']\n next\n ensure\n @req_in_flight -= 1\n end\n num_reqs += 1\n $stdout.puts(\"at=req-sent status=#{resp.code}\") if ENV['DEBUG']\n end\n end\n rescue => e\n $stdout.puts(\"at=req-error msg=#{e.message}\") if ENV['DEBUG']\n ensure\n http.finish if http.started?\n end\n end\n end",
"def print_rpc_stats(stats)\n out.puts stats.report(\"Task Stats\", false, @verbose)\n end",
"def call(env)\n # Set the trace context (e.g. distributed tracing)\n if configuration[:distributed_tracing] && tracer.provider.context.trace_id.nil?\n context = HTTPPropagator.extract(env)\n tracer.provider.context = context if context.trace_id\n end\n\n tracer.trace(\n Ext::SPAN_REQUEST,\n service: configuration[:service_name],\n span_type: Datadog::Ext::HTTP::TYPE_INBOUND,\n # this is kept nil until we set a correct one (either in the route or with a fallback in the ensure below)\n # the nil signals that there's no good one yet and is also seen by profiler, when sampling the resource\n resource: nil,\n ) do |span|\n begin\n Sinatra::Env.set_datadog_span(env, @app_instance, span)\n\n response = @app.call(env)\n ensure\n Sinatra::Env.request_header_tags(env, configuration[:headers][:request]).each do |name, value|\n span.set_tag(name, value) if span.get_tag(name).nil?\n end\n\n request = ::Sinatra::Request.new(env)\n span.set_tag(Datadog::Ext::HTTP::URL, request.path)\n span.set_tag(Datadog::Ext::HTTP::METHOD, request.request_method)\n span.set_tag(Ext::TAG_SCRIPT_NAME, request.script_name) if request.script_name && !request.script_name.empty?\n\n span.set_tag(Ext::TAG_APP_NAME, @app_instance.settings.name)\n\n # If this app handled the request, then Contrib::Sinatra::Tracer OR Contrib::Sinatra::Base set the\n # resource; if no resource was set, let's use a fallback\n span.resource = env['REQUEST_METHOD'] if span.resource.nil?\n\n # TODO: This backfills the non-matching Sinatra app with a \"#{method} #{path}\"\n # TODO: resource name. This shouldn't be the case, as that app has never handled\n # TODO: the response with that resource.\n # TODO: We should replace this backfill code with a clear `resource` that signals\n # TODO: that this Sinatra span was *not* responsible for processing the current request.\n rack_request_span = env[Datadog::Contrib::Rack::TraceMiddleware::RACK_REQUEST_SPAN]\n span.resource = rack_request_span.resource if rack_request_span && rack_request_span.resource\n\n if response\n if (status = response[0])\n sinatra_response = ::Sinatra::Response.new([], status) # Build object to use status code helpers\n\n span.set_tag(Datadog::Ext::HTTP::STATUS_CODE, sinatra_response.status)\n span.set_error(env['sinatra.error']) if sinatra_response.server_error?\n end\n\n if (headers = response[1])\n Sinatra::Headers.response_header_tags(headers, configuration[:headers][:response]).each do |name, value|\n span.set_tag(name, value) if span.get_tag(name).nil?\n end\n end\n end\n\n # Set analytics sample rate\n Contrib::Analytics.set_sample_rate(span, analytics_sample_rate) if analytics_enabled?\n\n # Measure service stats\n Contrib::Analytics.set_measured(span)\n end\n end\n end",
"def run\n initialize_trackers\n @start_time = Time.now\n @client.send(*@message) do |status|\n puts \"#{status.text}\" if $DEBUG\n @trackers.each do |t|\n t.record(status)\n end\n end\n end",
"def clear_dns_forwarder_cache_clear_cache_with_http_info(forwarder_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesDnsApi.clear_dns_forwarder_cache_clear_cache ...'\n end\n # verify the required parameter 'forwarder_id' is set\n if @api_client.config.client_side_validation && forwarder_id.nil?\n fail ArgumentError, \"Missing the required parameter 'forwarder_id' when calling ManagementPlaneApiServicesDnsApi.clear_dns_forwarder_cache_clear_cache\"\n end\n # resource path\n local_var_path = '/dns/forwarders/{forwarder-id}?action=clear_cache'.sub('{' + 'forwarder-id' + '}', forwarder_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesDnsApi#clear_dns_forwarder_cache_clear_cache\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def scan_host(ip)\n if spoofed?\n datastore['ScannerRecvWindow'] = 0\n scanner_spoof_send(@probe, ip, datastore['RPORT'], datastore['SRCIP'], datastore['NUM_REQUESTS'])\n else\n scanner_send(@probe, ip, datastore['RPORT'])\n end\n end",
"def send_request(ref, msg_id, arg, b)\n if @receiver_socket\n ref = DRbObject.new_with_uri(\"receiver://%s:%s\" % [\"localhost\", Global.relay_port])\n #p ref.__drburi if ref.kind_of?(DRbObject)\n #p msg_id\n #p arg\n @receiver_msg.send_request(@receiver_socket, ref, msg_id, arg, b)\n else\n @proxy_msg.send_request(@proxy_socket, ref, msg_id, arg, b)\n end\n end",
"def process\n Wavefront::Write.new({ proxy: ENDPOINT, port: 2878 },\n tags: setup_tags).write(metrics_as_points)\n update_run_number\n end",
"def send_to(provider_name, http_method='get')\n provider = get_provider(provider_name, @domain_front)\n @request = Net::HTTP.const_get(http_method.capitalize).new(\n @front_target.request_uri, provider[:headers]\n )\n @response = @http.request(@request)\n check_http(@response) # if response failed, give the user some suggestion\n rescue SocketError => e\n puts \"#{self.class}##{__method__}:\".error\n puts e.message\n rescue Net::ReadTimeout => e\n puts \"#{self.class}##{__method__}:\".error\n puts e.message\n puts \"Remote port is closed.\".error\n exit!\n rescue Exception => e\n puts \"#{self.class}##{__method__}:\".error\n puts e.full_message\n end",
"def send(*args)\n @collector.sending_stream.puts pack(*args)\n end",
"def cmd_traceroute argv\n setup argv\n addr = @hash[\"address\"]\n msg run_cmd(\"traceroute #{addr}\")\n end",
"def server_page_stats(params)\n s = \"\"\n params[:stats].each do |stat|\n # Show counters at the top\n if stat.class == Counter and stat.conditions.server == params[:server]\n s << output_counter(stat:stat)\n end\n end\n # @inc = 0 Already in for_each_server\n params[:stats].each do |stat|\n if stat.class == Distribution and stat.conditions.server == params[:server]\n s << output_distrib_normal(stat:stat,tabs:params[:tabs],sort_type:stat.sort_type)\n end\n end\n s\n end",
"def throttled_response; end",
"def get_dns_forwarder_status_with_http_info(forwarder_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiServicesDnsApi.get_dns_forwarder_status ...'\n end\n # verify the required parameter 'forwarder_id' is set\n if @api_client.config.client_side_validation && forwarder_id.nil?\n fail ArgumentError, \"Missing the required parameter 'forwarder_id' when calling ManagementPlaneApiServicesDnsApi.get_dns_forwarder_status\"\n end\n # resource path\n local_var_path = '/dns/forwarders/{forwarder-id}/status'.sub('{' + 'forwarder-id' + '}', forwarder_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DnsForwarderStatus')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiServicesDnsApi#get_dns_forwarder_status\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def throttled_responder; end",
"def feedforward(val)\n @output = val * weight # Compute output\n @sender = a.origin # Start animation at originating neuron\n @sending = true # Turn on sending\n end",
"def stats_url\n @stats_url ||= ENV.fetch('STATS_URL', 'http://127.0.0.1/resque/stats.txt')\nend",
"def send_lookup(lookup)\n lookup.ensure_enough_info\n request = build_request(lookup)\n\n response = @sender.send(request)\n\n raise response.error if response.error\n\n candidates = convert_candidates(@serializer.deserialize(response.payload))\n lookup.result = candidates\n end"
] |
[
"0.6045585",
"0.5724333",
"0.5568101",
"0.55668396",
"0.5530404",
"0.54056144",
"0.532206",
"0.5266261",
"0.52397865",
"0.5228196",
"0.5218105",
"0.51749706",
"0.5154118",
"0.51450944",
"0.5140531",
"0.51368475",
"0.510697",
"0.50928515",
"0.5076645",
"0.5064666",
"0.5050981",
"0.5044486",
"0.5033408",
"0.50315315",
"0.50231135",
"0.5020955",
"0.5011783",
"0.5007842",
"0.5005682",
"0.5005682",
"0.5005114",
"0.5003657",
"0.4999282",
"0.49951512",
"0.4993505",
"0.4986998",
"0.49661493",
"0.49614623",
"0.49610683",
"0.49506947",
"0.49388668",
"0.49307978",
"0.49278486",
"0.49169365",
"0.49091202",
"0.4906927",
"0.4901734",
"0.48993066",
"0.48904178",
"0.4886786",
"0.48703787",
"0.4858818",
"0.48352402",
"0.48341402",
"0.48304582",
"0.48164445",
"0.48132482",
"0.4795389",
"0.47884706",
"0.4787924",
"0.47820482",
"0.47789654",
"0.47770214",
"0.47754696",
"0.4773477",
"0.47719505",
"0.47695157",
"0.47684643",
"0.4766346",
"0.47662282",
"0.4764397",
"0.4756004",
"0.47555274",
"0.47553217",
"0.4750797",
"0.47482628",
"0.47472247",
"0.47407627",
"0.47356388",
"0.47330627",
"0.47328815",
"0.47313341",
"0.47233146",
"0.4722048",
"0.47001943",
"0.46982712",
"0.46936962",
"0.46912608",
"0.46848342",
"0.46833345",
"0.4670649",
"0.4665064",
"0.46611416",
"0.4659181",
"0.46577364",
"0.46502474",
"0.46497598",
"0.46467686",
"0.46313107",
"0.4629484",
"0.4628064"
] |
0.0
|
-1
|
Function for testing a preprocessor
|
def test_preprocessor(preprocessor,input,expected)
# Prepare the output and the input streams
puts "Preparing the input and ouput streams..."
output = StringIO.new("")
# Process the input and exepected arguments.
if !input.respond_to?(:each_line) or input.is_a?(String) then
# input is actually a file name, open it.
input = File.open(input.to_s,"r")
end
if !expected.respond_to?(:each_line) or expected.is_a?(String) then
# expected is actually a file name, open it.
expected = StringIO.new(File.read(expected.to_s))
end
# Apply the preprocessor
puts "Applying the preprocessor..."
preprocessor.preprocess(input,output)
# Check the result
puts "Checking the result..."
output.rewind
check = output.string == expected.read
unless check
puts "*Error*: invalid expansion result."
iline = output.string.each_line
expected.rewind
expected.each_line.with_index do |exp_line,i|
line = iline.next
puts "exp_line=#{exp_line}"
puts "line=#{line}"
if exp_line != line then
puts "Expected line #{i+1}:\n#{exp_line}"
puts "got:\n#{line}"
end
end
return false
end
return true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def preprocess(text, defines={})\n defines = defines.dup\n result = []\n active_stack = []\n active = true\n text.each_line do |line|\n case line\n when /^#\\s*define\\s+(\\w+)\\s+(\\w*)\\s*$/\n defines[$1] = $2 if active\n when /^#\\s*if\\s+(\\w+)\\s*$/\n active_stack.push active\n active = active &&\n case preprocessor_expand($1, defines)\n when '0': false \n when '1': true\n else raise \"Can't parse: #{line}\" end\n when /^#\\s*ifdef\\s+(\\w+)\\s*$/\n active_stack.push active\n active = active && defines.has_key?($1)\n when /^#\\s*ifndef\\s+(\\w+)\\s*$/\n active_stack.push active\n active = active && !defines.has_key?($1)\n when /^#\\s*if\\s+[vV][eE][rR]\\s+(<|>)=?\\s+0x[0-9a-zA-Z]{8}\\s*$/\n # Allow version checks, but always consider the version to be higher\n # than the version compared to.\n active_stack.push active\n active = active && ($1 == \">\")\n when /^#\\s*else\\s*$/\n # If we have a parent if, and it's inactive, we don't actually\n # want to do anything here.\n active = !active if active_stack.empty? || active_stack.last\n when /^#\\s*endif(\\s+(\\w+))?\\s*$/\n active = active_stack.pop\n when /^#\\s*error\\s+(.+)$/\n raise $1 if active\n when /^#.*$/\n raise \"Unknown preprocessor command: #{line}\"\n else\n result << line if active\n end\n end\n raise \"Missing #endif\" unless active_stack.empty?\n result.join\n end",
"def test_preprocessor_exception(preprocessor,string,exception)\n input = StringIO.new(string)\n output = StringIO.new(\"\")\n begin\n $ppr.preprocess(input,output)\n puts \"*Error*: preprocessed without exception.\"\n return false\n rescue Exception => e\n if e.to_s.include?(exception.to_s) then\n puts \"Got exception: <#{e}> as expected.\"\n return true\n else\n puts \"*Error*: unexpected exception.\", \n \"Got <#{e}> but expecting <#{exception}>.\"\n return false\n end\n end\nend",
"def process(source)\n\t\t\t@source = source.respond_to?(:path) ? File.basename(source.path) : 'unknown'\n\t\t\t@line_no = 0\n\t\t\t@last_if = nil\n\t\t\t@outputting = true\n\t\t\tout_lines = []\n\t\t\tsource.each_line do |line|\n\t\t\t\t@line_no += 1\n\t\t\t\tif is_from_preprocessor?(line)\n\t\t\t\t\tparse(line)\n\t\t\t\telse\n\t\t\t\t\tif @outputting\n\t\t\t\t\t\tout_lines << line\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tif @last_if\n\t\t\t\traise PreprocessorError, \"#@source:#@last_if:error: unmatched #if\"\n\t\t\tend\n\t\t\tFakeIO.new(out_lines)\n\t\tend",
"def handle_ifdefs_in(body)\n body.gsub(/^#ifdef HAVE_PROTOTYPES.*?#else.*?\\n(.*?)#endif.*?\\n/m, '\\1')\n end",
"def test_conditional\n\t\tparser = Cfruby::Parser.new\n\t\tassert_equal(\"if isa?('hostname') and isa?('any')\",parser.form_conditional('hostname.any::'))\n\t\tf = File.new Cfruby.regressiontestpath+'/cfruby_conditionals.txt'\n\t\tf.each_line do | line |\n\t\t\tnext if line =~ /^\\#/ or line =~ /^$/\n\t\t\tfrom, to = line.split(/::/)\n\t\t\tassert_equal(to.strip, parser.form_conditional(from.strip+'::').strip) if from\n\t\tend\n\tend",
"def parameterized?\n macro_string.match Regexp.identifier\n end",
"def macro; end",
"def macro; end",
"def handle_ifdefs_in(body)\n body.gsub(/^#ifdef HAVE_PROTOTYPES.*?#else.*?\\n(.*?)#endif.*?\\n/m) { $1 }\n end",
"def test_get_cc_processor\n # TODO: Should this method really be here?\n assert_equal Order.get_cc_processor, Preference.find_by_name('cc_processor').value.to_s\n end",
"def formatPreprocessor(theLines)\n\n\talignEndifs(\t\ttheLines);\n\talignUndefineDefine(theLines);\n\talignDefineValue(\ttheLines);\n\talignContinuations(\ttheLines);\n\n\treturn theLines;\n\nend",
"def test_define_item\n assert @definition.defines? :foo\n end",
"def mock_defines(mock_config)\n family = mock_el_family(mock_config)\n version = mock_el_ver(mock_config)\n defines = \"\"\n if version =~ /^(4|5)$/ or family == \"sles\"\n defines = %(--define \"dist .#{family}#{version}\" \\\n --define \"_source_filedigest_algorithm 1\" \\\n --define \"_binary_filedigest_algorithm 1\" \\\n --define \"_binary_payload w9.gzdio\" \\\n --define \"_source_payload w9.gzdio\" \\\n --define \"_default_patch_fuzz 2\")\n end\n defines\nend",
"def filter(s, file = nil)\n\t\tstate = State.new([], \"\", false)\n\t\tstate.file = file\n\t\tstate.line_number = 0\n\t\ts.each_line do |line,index|\n\t\t\tstate.line = line\n\t\t\tstate.line_number += 1\n\t\t\tcheck_no_mix(state, line)\n\t\t\tcase preprocessor_word(line)\n\t\t\t\twhen \"#if\" then process_if(state, line)\n\t\t\t\twhen \"#ifdef\" then process_ifdef(state, line)\n\t\t\t\twhen \"#ifndef\" then process_ifndef(state, line)\n\t\t\t\twhen \"#elif\" then process_elif(state, line)\n\t\t\t\twhen \"#else\" then process_else(state, line)\n\t\t\t\twhen \"#endif\" then process_end(state, line)\n\t\t\t\telse process_line(state, line)\n\t\t\tend\n\t\tend\n\t\terror(state, \"Preprocessor directives not balanced\") if state.scopes.size != 0\n\t\t\n\t\treturn state.out\n\tend",
"def compileif\n\n end",
"def test_define_namespace\n assert @definition.defines? :bar_foo\n end",
"def test_if\n code = <<CODE\na = 1\nif a\n b = 2\nend\nCODE\n \n js = <<JS\nvar a, b;\na = 1;\nif (a) {\nb = 2;\n};\nJS\n \n assert_equal js, @compiler.compile(code)\n end",
"def debug_include\n'#ifndef NDEBUG\n#include <iostream>\n#endif'\n end",
"def pretest(text)\n return !(@re[:pretest] =~ text).nil?\n end",
"def valid_processors; end",
"def pre_processors\n @pre_processors ||= []\n end",
"def preprocess(&block)\n @site.preprocessor = block\n end",
"def test_truth\n end",
"def preprocess\n true\n end",
"def macro!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 48 )\n\n type = MACRO\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 169:9: 'macro'\n match( \"macro\" )\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__, 48 )\n\n end",
"def test_boolean_parses_true_string\n bc, ctx = compile 'true'\n ci = mkci bc, ctx\n assert ci.run\n end",
"def test_1\n\t\tputs check_custom nil\n\t\tputs check_custom \"hi\"\n\t\tputs check_custom 'hi(there)'\n\tend",
"def test_if_statement_modifiers\n result = :default_value\n result = :true_value if true\n\n assert_equal :true_value, result\n end",
"def check_header(path)\n test_compile(\"#include <\" + path + \">\")\n end",
"def test_and_simple\n bc, ctx = compile 'true and false'\n ci = mkci bc, ctx\n assert_false ci.run\n end",
"def check test\n test = test.gsub(/={1,2}(?!~)/,\"==\").gsub(/(\\[[^\\]]*\\])/,'\\1.to_v')\n (eval(test) ? true : false) rescue false\n end",
"def preprocessText(text)\n output = \"\"\n conditionals = Array.new\n\n text.split(\"\\n\").each do |line|\n currentConditional = conditionals.last\n\n # @if/@ifnot\n ifMatch = line.match(/^@(if[not]*)(.*)\\s*$/)\n if ifMatch\n name = ifMatch[1]\n \n #if must contain an expression\n expression = ifMatch[2].strip\n if expression.length == 0\n puts \"ERROR: @#{name} with no expression\"\n exit 1\n end\n \n # expression must be specific syntax\n expressionMatch = expression.match(/^([A-Z0-9_]+)$/)\n enabled = false\n if expressionMatch\n definitionKey = expressionMatch[1]\n if $defines[definitionKey]\n enabled = true\n end\n else\n puts \"ERROR: Invalid @#{name} expression.\"\n exit 1\n end\n\n if name == \"ifnot\"\n enabled = !enabled\n end\n \n # if the parent conditional is disabled, this is disabled too.\n if currentConditional and !currentConditional.enabled\n enabled = false\n end\n\n newConditional = ConditionalBlock.new\n newConditional.enabled = enabled\n newConditional.name = name\n conditionals.push(newConditional)\n next\n end\n \n # @else\n elseMatch = line.match(/^@(else)$/)\n if elseMatch\n if conditionals.length == 0\n puts \"ERROR: @else without @if\"\n exit 1\n end\n currentConditional.name = elseMatch[1]\n currentConditional.enabled = !currentConditional.enabled\n next\n end\n \n # @endif\n endIfMatch = line.match(/^@endif$/)\n if endIfMatch\n if conditionals.length == 0\n puts \"ERROR: @endif without @if\"\n exit 1\n end\n conditionals.pop\n next\n end\n \n if currentConditional and !currentConditional.enabled\n next\n end\n \n # replace definitions\n $defines.each_key do |key|\n while line[key]\n line[key] = $defines[key]\n end\n end\n \n output += \"#{line}\\n\"\n end\n\n if conditionals.length > 0\n puts \"ERROR: Unterminated @\" + conditionals[-1].name\n exit 1\n end\n\n return output\nend",
"def test_xif\n s = helper_vim_snippet(:name => \"xif\", \n :code => \"<expression> if <condition>;<>\")\n assert_equal '\".st.\"expression\".et.\" if \".st.\"condition\".et.\";\".st.et', s.parse\n end",
"def evaluate_macro(predicted_class, actual_class)\n # Since this is macro, figoure out what the real\n # class is we should be looking at\n# puts \"Params: #{predicted_class}, #{actual_class}\"\n# puts \"Actual class: #{actual_class}, Class 0: #{@classes.to_a[0][0]}\"\n if actual_class == @classes.to_a[0][0] then\n# puts \"They match\"\n if predicted_class == @classes.to_a[0][0] then\n if predicted_class == actual_class then @confusion_matrix_c1['TP'] += 1 end\n if predicted_class != actual_class then @confusion_matrix_c1['FN'] += 1 end\n else\n if predicted_class == actual_class then @confusion_matrix_c1['FP'] += 1 end\n if predicted_class != actual_class then @confusion_matrix_c1['TN'] += 1 end\n end\n else\n# puts \"They DONT match\"\n if predicted_class == @classes.to_a[0][0] then\n if predicted_class == actual_class then @confusion_matrix_c2['TP'] += 1 end\n if predicted_class != actual_class then @confusion_matrix_c2['FN'] += 1 end\n else\n if predicted_class == actual_class then @confusion_matrix_c2['FP'] += 1 end\n if predicted_class != actual_class then @confusion_matrix_c2['TN'] += 1 end\n end\n end\n end",
"def is_code?(line,labelhash)\n if @to_code && line !~ /^#include \"(page|align|pass).i65\".*/ # filter chaffy includes\n if @code.nil?\n # first line is special, the label\n @label = line\nputs @label if @label == \"STUDIO\"\n @addr = labelhash[@label]\n # start with a code quote and a slider button\n @code =\n \"\\n\\n\\n<$button popup=\\\"$:/state/codeSlider\\\">code</$button>\"\\\n \"<$reveal type=\\\"nomatch\\\" text=\\\"\\\" default=\\\"\\\" \"\\\n \"state=\\\"$:/state/codeSlider\\\" animate=\\\"yes\\\">\\n\\n```\"\n end\n # append code line, filter chaff\n @code += \"\\n\"+line\n end\n # turn on code trigger after checking, to avoid capturing the `#endif`\n if (line =~ /^\\#endif$/) # non-`#if 0` should have a comment after #endif in source\n @to_code = true\n end\n end",
"def has_proc?(code)\n hcp_codes = hcp_proc_codes.split(',') rescue nil\n return unless hcp_codes.any?\n hcp_codes.index(code)\n end",
"def mock_tokenizer\n @@mock_tokenizer ||= Regexp.new(/^[[:blank:]]*\\#.*#{TOKENIZER}/)\n end",
"def define_test_for(name, cpp_opts, options = {})\n ignore_cfiles = options.fetch(:ignore, [])\n\n task \"do_#{name}\" do\n Dir.chdir(paths(name)[:dir]) do\n cfiles = []\n Dir.glob(\"./**/*.c\") do |f|\n cfiles << f\n end\n cfiles.delete_if { |e| ignore_cfiles.include? e }\n\n success_list = ThreadSafe::Array.new\n failure_list = ThreadSafe::Array.new\n\n # ignore files are granted as failure\n failure_list += ignore_cfiles\n\n Parallel.each(cfiles, in_threads: N) do |f|\n # Looked at the Makefile\n tmpfile = \"/tmp/#{SecureRandom.random_number(10**32)}.c\"\n `macro-of-inline #{f} #{cpp_opts} -o #{tmpfile}`\n e = $?.exitstatus\n if e == 0\n success_list << f\n `cp #{tmpfile} #{f}`\n else\n failure_list << f\n puts \"[macroize] failed: #{f}\"\n end\n `rm -r #{tmpfile}`\n end\n\n perc = success_list.size.to_f / (success_list.size + failure_list.size)\n File.open(\"../#{paths(name)[:info_log]}\", \"w\") do |f|\n f.write \"\"\"\\\nsuccess: #{perc}%\n\"\"\"\n end\n\n File.open(\"../#{paths(name)[:failure_log]}\", \"w\") do |f|\n f.write \"\"\"\\\n#{failure_list.join(\"\\n\")}\n\"\"\"\n end\n end\n end\n\n desc \"test with #{name} source tree\"\n task name => [\"do_#{name}_grub\", \"do_#{name}_pre\", \"do_#{name}\", \"do_#{name}_post\"]\n\n define_tests_for(name, cpp_opts)\nend",
"def preprocess\n lineno = 0\n shouldWrite = false\n inFunction = false\n printer = File.open(RB_FILE,'w')\n scanner = File.open(TEX_FILE,'r')\n if printer && scanner\n printer.puts RB_REQUIRE\n scanner.each_line do |line|\n lineno = lineno + 1\n if (line.include? TEX_ENV_01_E) && !determineTexCommented(line, TEX_ENV_01_E)\n puts \"Encountered #{TEX_ENV_01_E} on line #{lineno}\"\n shouldWrite = false\n end\n if shouldWrite\n stripped = line.strip\n if (stripped.include? TEX_MOD) && !determineRubyCommented(stripped, TEX_MOD) && !inFunction\n printer.print appendLineNumberToTexPrintCall(stripped, lineno)\n elsif (stripped.include? RB_CLASS_CREATE) && !determineRubyCommented(stripped, RB_CLASS_CREATE) && !inFunction\n printer.print appendLineNumberToInitialization(stripped, lineno)\n elsif (stripped.include? RB_METHOD_S) && !determineRubyCommented(stripped, RB_METHOD_S) && !inFunction\n puts \"Processing function definition: found line containing #{stripped}\"\n inFunction = true\n extracted = extractFunctionMeta stripped\n $fcnref.store(extracted[0], extracted[1])\n $defstack.push 1\n if (stripped.include? '(') && (stripped.include? ')')\n puts \"Injection into formatted def as \\( \\)! Boo!\"\n else\n puts \"Injection into formatted def as _,_! This is preferrable.\"\n end\n printer.print appendLineNumberArgToFunctionDefinition stripped\n elsif inFunction\n puts \"Parsing #{stripped} inside function...\"\n printer.print stripped\n if (line.include? TEX_MOD) && !determineRubyCommented(line, \"Tex\")\n printer.print \", #{RBTEX_INSERT_LINE}\"\n end\n RB_KEYWORD_END.each do |kwd|\n if line.include? kwd\n puts \"Encountered '#{kwd}'; pushing onto stack...\"\n $defstack.push 1\n break\n end\n end\n if line.include? 'end'\n puts \"Encountered 'end'; popping off of stack...\"\n $defstack.pop\n end\n inFunction = $defstack.any?\n else\n print \"STRIPPED: #{stripped}\\t\"\n deffed = false\n printer.print stripped\n $fcnref.each do |fcn, args|\n if stripped.include? fcn\n if (line.include? '(') && (line.include? ')')\n\n else\n printer.print (args != 0) ? (\", #{lineno}\") : (\" #{lineno}\")\n break\n end\n end\n end\n end\n printer.puts \"\"\n end\n if (line.include? TEX_ENV_01_S) && !determineTexCommented(line, TEX_ENV_01_S)\n puts \"Encountered #{TEX_ENV_01_S} on line #{lineno}\"\n $rbenvs = $rbenvs + 1\n shouldWrite = true\n end\n end\n end\n printer.close\n scanner.close\n return 0\nend",
"def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end",
"def test_hardware_cpu_type\n assert [:intel, :ppc].include?(Hardware.cpu_type)\n end",
"def is_test_mode?\n ENV['TEST_MODE'] === 'TRUE'\nend",
"def test_fake_string_1\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(1).eql? '1 fake ruby'\n end",
"def test_mode?\n mode == 'test'\n end",
"def skip_cond_incl!\n nest = 0\n while true\n bol = current_file.column == 1\n skip_space!\n c = readc\n if c.nil? # EOF\n return\n end\n if c == '\\''\n skip_char!\n next\n end\n if c == '\"'\n skip_string!\n next\n end\n if (c != '#' || !bol)\n next\n end\n column = current_file.column - 1\n tok = lex\n if (tok.kind != T::IDENT)\n next\n end\n if (nest == 0) && (Token.is_ident?(tok, \"else\") || Token.is_ident?(tok, \"elif\") || Token.is_ident?(tok, \"endif\"))\n unget_token(tok)\n hash = @token_gen.make_keyword('#')\n hash.bol = true\n hash.column = column\n unget_token(hash)\n return\n end\n if Token.is_ident?(tok, \"if\") || Token.is_ident?(tok, \"ifdef\") || Token.is_ident?(tok, \"ifndef\")\n nest += 1\n elsif (nest > 0) && Token.is_ident?(tok, \"endif\")\n nest -= 1\n end\n skip_line!\n end\n end",
"def test?\n RUBYMOTION_ENV == 'test'\n end",
"def pre_setup_suite()\n @cfg['pre_setup'] =\"defined\"\n return true\n end",
"def const_defined?(p0) end",
"def test_disabled?\n ENV['NO_TEST'] == '1'\nend",
"def test_disabled?\n ENV['NO_TEST'] == '1'\nend",
"def constant_defined?(name); end",
"def process_rb_project(filename, output_path)\n fail 'This feature is under development'.red\nend",
"def test_ruby_string_1\n pros = Prospector.new(0,0,0)\n assert pros.ruby_string(1).eql? '1 ruby'\n end",
"def buildTest()\n return_value = false\n\n arguments = Array.new()\n arguments.concat(@environment.compiler_flags)\n arguments.concat(@definition.compiler_flags)\n arguments.concat(@environment.include_directories.map do |dir| \"-I#{dir}\" end)\n arguments.concat(@environment.library_directories.map do |dir| \"-L#{dir}\" end)\n arguments.concat(@definition.library_directories.map do |dir| \"-L#{dir}\" end)\n arguments.concat(@environment.sources)\n arguments.concat(@definition.source_files)\n arguments.push(\"-o#{@definition.executable}\")\n arguments.concat(@environment.libraries.map do |library| \"-l#{library}\" end)\n arguments.concat(@definition.libraries.map do |library| \"-l#{library}\" end)\n\n stdin, stdout, stderr, wait_thr = Open3.popen3(@environment.compiler, *arguments)\n\n stdin.close\n\n stdout.each do |line|\n if /error/ =~ line\n if @environment.verbose\n puts line\n end\n return_value = true\n end\n if /warning/ =~ line\n if @environment.verbose\n puts line\n end\n return_value = true\n end\n end\n stdout.close\n\n stderr.each do |line|\n if /error/ =~ line\n if @environment.verbose\n puts line\n end\n return_value = true\n end\n if /warning/ =~ line\n if @environment.verbose\n puts line\n end\n return_value = true\n end\n end\n stderr.close\n\n return return_value\n end",
"def test_placeholder\n assert(true)\n end",
"def defined?(name); end",
"def defined?(name); end",
"def start_if(str)\n return str[0, 2] == \"if\";\n end",
"def test_dw967\n instance_eval { setup_from_file.call('DW', '967') }\n @status.validate\n assert(!@status.has_issue_by_name?('road_disconnected'))\n assert(!@status.has_issue_by_name?('not_navigable'))\n end",
"def test_truth\n assert true\n end",
"def filter_out?(line)\n # \"./lib\" in project dir, or \"/usr/local/blahblah\" if installed\n assert_lib_path = File.expand_path(\"../..\", __FILE__)\n assert_macros_path = File.join(assert_lib_path, \"assert/macros\")\n assert_bin_regex = %r{bin/assert\\:}\n (line.rindex(assert_lib_path, 0) &&\n !line.rindex(assert_macros_path, 0)\n ) ||\n line =~ assert_bin_regex\n end",
"def preprocessor_expand str, definitions\n while definitions.has_key? str\n str = definitions[str].to_s\n end\n str\n end",
"def test_truth\r\n assert true\r\n end",
"def test_truth\r\n assert true\r\n end",
"def test_truth\r\n assert true\r\n end",
"def expansion_equal?(expanded_code, code, *macro_objs)\n if parse(expanded_code) == parse(macro_expand(code, *macro_objs))\n true\n else\n false\n end\nend",
"def test; true; end",
"def for_current_impl?\n File.basename(@test_case.folder) =~ /-#{Regexp.quote(@test_case.impl)}/\n end",
"def cmd_if(test, rvm=false)\n load_rvm = \"\"\n load_rvm = \"#{rvm_env} \" if rvm\n r = capture %{#{load_rvm}if #{test} ; then echo true; else echo false; fi}, \n :shell => \"bash\"\n puts \" * Result is: #{r.to_s}\"\n if r.to_s =~ /true/\n true\n else\n false\n end\nend",
"def pre_match() end",
"def test?\n rspec? || env == 'test'\n end",
"def l(t)\n\n if ENV['RUOTE_TEST_SPLIT'].to_s == 'true'\n\n puts\n puts \"=== #{t} :\"\n puts `ruby -I. #{t} #{ARGV.join(' ')}`\n\n es = $?.exitstatus\n es = es.nil? ? 66 : es.to_s.to_i\n\n #return if es != 0 && t.match(/eft_6_/)\n exit(es) if es != 0\n\n else\n\n load(t)\n end\nend",
"def test?\n rspec? || minitest?\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end",
"def test_truth\n assert true\n end"
] |
[
"0.6495349",
"0.62951356",
"0.5799275",
"0.56953293",
"0.56180805",
"0.5600965",
"0.55765927",
"0.55765927",
"0.5574427",
"0.54751796",
"0.5471518",
"0.544628",
"0.5399563",
"0.5360098",
"0.5319129",
"0.52851754",
"0.5283044",
"0.52365017",
"0.5230837",
"0.52171445",
"0.5195894",
"0.5181385",
"0.5162146",
"0.5158256",
"0.5156724",
"0.5117699",
"0.51149684",
"0.509787",
"0.50858957",
"0.5085873",
"0.506975",
"0.50591856",
"0.5048529",
"0.50442046",
"0.5015861",
"0.50070536",
"0.50012356",
"0.49997306",
"0.49815616",
"0.49751368",
"0.49676967",
"0.49620557",
"0.49518993",
"0.49513927",
"0.494549",
"0.49338123",
"0.4926022",
"0.49186447",
"0.49148217",
"0.49148217",
"0.49130765",
"0.49124658",
"0.49094054",
"0.490611",
"0.48862827",
"0.48836163",
"0.48836163",
"0.48777962",
"0.4877464",
"0.48752597",
"0.48750427",
"0.48730588",
"0.48706406",
"0.48706406",
"0.48706406",
"0.48684844",
"0.48591465",
"0.4856303",
"0.4854703",
"0.48481998",
"0.48441508",
"0.48351702",
"0.48306847",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191",
"0.48302191"
] |
0.73244786
|
0
|
Function for testing a preprocessor on +string+ which should raise an +exception+ string.
|
def test_preprocessor_exception(preprocessor,string,exception)
input = StringIO.new(string)
output = StringIO.new("")
begin
$ppr.preprocess(input,output)
puts "*Error*: preprocessed without exception."
return false
rescue Exception => e
if e.to_s.include?(exception.to_s) then
puts "Got exception: <#{e}> as expected."
return true
else
puts "*Error*: unexpected exception.",
"Got <#{e}> but expecting <#{exception}>."
return false
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def expected(s)\n abort \"#{s} Expected\"\nend",
"def expected(s)\n abort \"#{s} Expected\"\nend",
"def expected(s)\n abort \"#{s} Expected\"\nend",
"def expected(s)\n abort(\"#{s} Expected\")\nend",
"def check_and_raise_error(exception, message)\n fail exception unless exception.message.include?(message)\n end",
"def expected(text)\n abort(text + \" Expected\")\nend",
"def assert(str = 'Assertion failed')\n begin\n if(!yield)\n $asserts.push(assertion_string(\"#{GEMNAME} Fail: \", str))\n $ko_test += 1\n print('F')\n else\n $ok_test += 1\n print('.')\n end\n rescue Exception => e\n $asserts.push(assertion_string(\"#{GEMNAME} Error: \", str, e))\n $kill_test += 1\n print('X')\n end\nend",
"def raise_an_exception\n puts \"Going to cause an exception.\"\n # If you include a string, this is a generic RuntimeError\n # It is not rescued.\n # An un-rescued exception will cause the current Ruby process\n # to exit with error code 1 (error code 0 indicates normal\n # execution, anything else something anomalous)\n # You can view the error code of a process in most Unix-like\n # systems by typing echo $? at the prompt after execution.\n raise \"I am the exception\"\n puts \"This line will never be executed\"\nend",
"def test_exception_notification\n raise 'Testing, 1 2 3.'\n end",
"def assert(str = 'Assertion failed', iso = '')\n begin\n if(!yield)\n $asserts.push(assertion_string('Fail: ', str, iso))\n $ko_test += 1\n print('F')\n else\n $ok_test += 1\n print('.')\n end\n rescue Exception => e\n $asserts.push(assertion_string('Error: ', str, iso, e))\n $kill_test += 1\n print('X')\n end\nend",
"def assert_raise(error_to_raise = Exception)\n begin\n # Dangerous Code\n yield\n rescue => the_error_object\n if the_error_object.class == error_to_raise\n print \".\"\n else\n print \"F\"\n end\n else\n print \"E\"\n end\n\nend",
"def error(string); end",
"def error(string); end",
"def assert(str = 'Assertion failed', iso = '')\n begin\n if(!yield)\n $asserts.push(['Fail: ', str, iso])\n $ko_test += 1\n print('F')\n else\n $ok_test += 1\n print('.')\n end\n rescue Exception => e\n $asserts.push(['Error: ', str, iso, e])\n $kill_test += 1\n print('X')\n end\nend",
"def ruby_code?(str)\n checker = FoodCritic::ErrorChecker.new(str)\n checker.parse\n ! checker.error?\n end",
"def test_it_raise_error_if_internal_definition_is_at_wrong_position\n source = \"(define (foo x) (+ x 1) (define y 4) (* x y))\"\n assert_raises(Rubasteme::SchemeSyntaxErrorError) {\n _ = parse(source)\n }\n end",
"def test_print_start_string\n assert_raises(StandardError) { print_start('1') } # pass\n end",
"def test_initialization\n exc_handler = HumanParseExceptionHandler.new\n new_str = exc_handler.get_human_result_for_string(\"foobar\",\"ParseException\")\n assert_equal(false, new_str)\n end",
"def ruby_code?(str)\n str = str.to_s\n return false if str.empty?\n checker = FoodCritic::ErrorChecker.new(str)\n checker.parse\n ! checker.error?\n end",
"def assert(str = 'Assertion failed', iso = '')\n print(str, (iso != '' ? \" [#{iso}]\" : ''), ' : ') if $mrbtest_verbose\n begin\n $mrbtest_assert = []\n $mrbtest_assert_idx = 0\n if(!yield || $mrbtest_assert.size > 0)\n $asserts.push(assertion_string('Fail: ', str, iso, nil))\n $ko_test += 1\n print('F')\n else\n $ok_test += 1\n print('.')\n end\n rescue Exception => e\n $asserts.push(assertion_string('Error: ', str, iso, e))\n $kill_test += 1\n print('X')\n ensure\n $mrbtest_assert = nil\n end\n print(\"\\n\") if $mrbtest_verbose\nend",
"def assert(message=\"Assertion Failed\")\n raise RuntimeError, message unless yield\nend",
"def assertion_string(err, str, iso=nil, e=nil)\n msg = \"#{err}#{str}\"\n msg += \" [#{iso}]\" if iso && iso != ''\n msg += \" => #{e.message}\" if e\n msg += \" (mrbgems: #{GEMNAME})\" if Object.const_defined?(:GEMNAME)\n msg\nend",
"def __\n raise \"__ should be replaced with a value or expression to make the test pass.\"\nend",
"def assert_raises_with_message(exception, message, &block)\n block.call\n rescue exception => e\n assert_match message, e.message\n end",
"def exception\n raise \"It's a bad one!\"\n end",
"def test_palindrome_parameter_string\n err = assert_raises InvalidStringError do\n Palindrome.new('Hola mundo')\n end\n assert_match 'The argunment is a String', err.message\n end",
"def test_code_4\n string = \"Line 2: Unknown keyword dog\\n\"\n assert_output(string) { Errorcode.error(4, 2, 'dog') }\n end",
"def test_wrong_play\n \tassert_raise (SyntaxError) {RockPaperScissors.play('huracan')}\n \tend",
"def throw(message)\n fail \"Cannot compile: #{message}\"\n end",
"def raise(cls, str, junk=nil)\n Rubinius::VM.write_error \"Fatal error loading runtime kernel:\\n \"\n Rubinius::VM.write_error str\n Rubinius::VM.write_error \"\\n\"\n Rubinius::VM.show_backtrace\n Process.exit! 1\n end",
"def isIntegerString?(string)\n Integer(string)\n return true\nrescue ArgumentError\n return false\nend",
"def test_symbols_cannot_be_concatenated\n # Exceptions will be pondered further father down the path\n assert_raise(NoMethodError) do\n :cats + :dogs\n end\n end",
"def assertion_string(err, str, iso=nil, e=nil)\n msg = \"#{err}#{str}\"\n msg += \" [#{iso}]\" if iso && iso != ''\n msg += \" => #{e.message}\" if e\n msg += \" (mrbgems: #{GEMNAME})\" if Object.const_defined?(:GEMNAME)\n if $mrbtest_assert && $mrbtest_assert.size > 0\n $mrbtest_assert.each do |idx, str, diff|\n msg += \"\\n - Assertion[#{idx}] Failed: #{str}\\n#{diff}\"\n end\n end\n msg\nend",
"def exception_on_syntax_error=(_arg0); end",
"def on_rescue(node)\n # either thrown or not\n code, resbody=*(node.children)\n exceptions, e, res = *resbody\n log \"RESCUE: code=#{code} exceptions=#{exceptions} e=#{e} res=#{res}\"\n # handle \"rescue e\" case\n exception_string = if exceptions then exceptions.loc.expression.source else \"Exception\" end\n res_string = if res then res.loc.expression.source else \"nil\" end\n code_string = if code then code.loc.expression.source else \"nil\" end\n log(\"Rewriting rescue as fake if statement\")\n source_rewriter=replace(node.loc.expression, \"if [#{exception_string}].thrown?\\n #{res_string}\\n else\\n #{code_string}\\n end\")\n restart(source_rewriter)\n end",
"def assertion_string(err, str, e=nil)\n msg = \"#{err}#{str}\"\n msg += \" => #{e.message}\" if e\n msg\nend",
"def foorth_raises(source, err=XfOOrth::XfOOrthError, debug=false)\r\n self.assertions += 1\r\n vm = Thread.current[:vm]\r\n vm.debug = debug\r\n failed, msg = false, \"\"\r\n\r\n begin\r\n vm.process_string(source)\r\n msg = \"Expected: #{err}\\n Actual: No exception raised.\"\r\n failed = true\r\n\r\n rescue Exception => e\r\n unless e.class == err\r\n msg = \"Expected: #{err}\\n Actual: #{e.class}\"\r\n failed = true\r\n end\r\n end\r\n\r\n raise MiniTest::Assertion, msg, caller if failed\r\n\r\n ensure\r\n vm.debug = false\r\n vm.interpreter_reset\r\n vm.compiler_reset\r\n end",
"def test_illegal_character_in_value\n assert_ignore_header(\"X-header\", \"First \\000Lin\\037e\")\n end",
"def assert_raises\n [\"assert_raises #{@exception.class.name} do\"] + body + [\"end\"]\n end",
"def test_build_from_string_invalid\n graph = Graph.new\n\n exception = assert_raises ArgumentError do\n graph.build('a=>c=>b')\n end\n\n assert_equal('String representation of the graph is invalid', exception.message)\n end",
"def has_bad?(str)\n # rubocop:enable Naming/PredicateName\n str[0...3].eql?('bad') || str[1...4].eql?('bad')\n end",
"def parse_error(msg)\n say :error, msg\n raise MacroError\n end",
"def string?(string, &block)\n string !~ /\\0/ && runner( String, string, &block )\n end",
"def test_code_1\n string = \"Line 321: Variable x is not initialized\\n\"\n assert_output(string) { Errorcode.error(1, 321, 'x') }\n end",
"def test_build_from_string_invalid2\n graph = Graph.new\n\n exception = assert_raises ArgumentError do\n graph.build('a=>b,=>b')\n end\n\n assert_equal('String representation of the graph is invalid', exception.message)\n end",
"def failure_message_method\n rspec_major_version >= 3 ? :failure_message : :failure_message_for_should\nrescue\n :failure_message_for_should\nend",
"def raise_single_quote_error\n raise ArgumentError, \"Single quotes are not allowed in filenames here.\"\nend",
"def test_symbols_cannot_be_concatenated\n # Exceptions will be pondered further down the path\n ##assert_raise(___) do\n assert_raise(NoMethodError) do\n :cats + :dogs\n end\n\n # Because you can't concatenate symbols, trying to use the \"+\" operator on them returns the NoSuchMethod exception\n end",
"def assert (test_number)\n\traise \"#{test_number} Assertion Failed!\" unless yield\nend",
"def assert(condition, msg = 'Assertion failed! I quit!')\n raise msg unless condition\nend",
"def test_exception\n with_fixture 'exception' do\n system(\"ruby \\\"#{ocra}\\\" exception.rb #{DefaultArgs.join(' ')} 2>NUL\")\n assert $?.exitstatus != 0\n assert !File.exist?(\"exception.exe\")\n end\n end",
"def assert_raise_with_partial_message exception_class, message\n assert_raise exception_class do\n begin\n yield\n rescue Exception => e\n assert_match(message, e.message)\n raise e\n end\n end\n end",
"def assert(message)\n\traise ArgumentError, message unless yield\nend",
"def exception_on_syntax_error; end",
"def assert_throws(sym, msg = T.unsafe(nil)); end",
"def test_wrong_argument_type\n assert_raises \"name should be a string\" do\n pl = Place::new 12\n end\n end",
"def test_of_caller_exception\r\n x = 10\r\n assert_raises(Exception) do\r\n _bar\r\n puts x\r\n end\r\n end",
"def raise_error\n raise SyntaxError, '(ERROR) this error is a thing that is happenened'\nend",
"def assert(message) \n\traise ArgumentError, message unless yield\nend",
"def assert_punched(str)\n assert_includes brf_content, str\n end",
"def violated_convention(name_string)\n convention_name = config['convention'] || 'hyphenated_lowercase'\n\n convention = CONVENTIONS[convention_name] || {\n explanation: \"must match regex /#{convention_name}/\",\n validator: ->(name) { name =~ /#{convention_name}/ }\n }\n\n convention unless convention[:validator].call(name_string)\n end",
"def throw(symb, *rest) end",
"def raise_rescue\n begin\n puts 'I am before the raise.'\n raise 'An error has occured.'\n puts 'I am after the raise.'\n rescue RuntimeError # 指定捕获异常的类型\n puts 'I am rescue!'\n end\n puts 'I am after the rescue.'\nend",
"def game_crash(array)\n raise StandardError, 'Why did you do this to me, John?' if array.include?('-crash')\n end",
"def test_preprocessor(preprocessor,input,expected)\n # Prepare the output and the input streams\n puts \"Preparing the input and ouput streams...\"\n output = StringIO.new(\"\")\n # Process the input and exepected arguments.\n if !input.respond_to?(:each_line) or input.is_a?(String) then\n # input is actually a file name, open it.\n input = File.open(input.to_s,\"r\")\n end\n if !expected.respond_to?(:each_line) or expected.is_a?(String) then\n # expected is actually a file name, open it.\n expected = StringIO.new(File.read(expected.to_s))\n end\n\n # Apply the preprocessor\n puts \"Applying the preprocessor...\"\n preprocessor.preprocess(input,output)\n\n # Check the result\n puts \"Checking the result...\"\n output.rewind\n check = output.string == expected.read\n\n unless check\n puts \"*Error*: invalid expansion result.\"\n iline = output.string.each_line\n expected.rewind\n expected.each_line.with_index do |exp_line,i|\n line = iline.next\n puts \"exp_line=#{exp_line}\"\n puts \"line=#{line}\"\n if exp_line != line then\n puts \"Expected line #{i+1}:\\n#{exp_line}\"\n puts \"got:\\n#{line}\"\n end\n end\n return false\n end\n return true\nend",
"def test_fake_string_1\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(1).eql? '1 fake ruby'\n end",
"def get_exception_with_string\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/error/stringInException'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 444\r\n raise ExceptionWithStringException.new(\r\n 'exception with string',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body) unless\r\n _context.response.raw_body.nil? ||\r\n _context.response.raw_body.to_s.strip.empty?\r\n decoded\r\n end",
"def test_environment_set_env_name_not_exist\n cfg = DBGeni::Config.new\n cfg.load(\"environment('foo') { } \\n\")\n assert_raises DBGeni::EnvironmentNotExist do\n cfg.set_env('bar')\n end\n end",
"def test_match_resolution\n exc_handler = HumanParseExceptionHandler.new\n new_str = exc_handler.get_human_result_for_string(\"foobar\",\"ParseException\")\n assert_equal(false, new_str)\n \n exc_handler.add_human_result_for_string(\"foobar\",\"ParseException\",\"FOOBAR\")\n assert_equal(\"FOOBAR\",exc_handler.get_human_result_for_string(\"foobar\",\"ParseException\"))\n end",
"def test_sql_escaped\n exc_handler = HumanParseExceptionHandler.new\n new_str = exc_handler.get_human_result_for_string(\"fo'ob\\\"ar\",\"ParseException\")\n assert_equal(false, new_str)\n end",
"def isStringConstant(str)\n return (str[0].to_s == \"\\\"\" and str[str.to_s.size - 1].to_s == \"\\\"\") #if statement surrounded by quotation marks of any kinds\n\n return false\nend",
"def assert(message)\n raise message unless yield\nend",
"def test_string\n\n @values_string.each { |x|\n assert_raises RangeError do\n ln(x)\n end\n }\n\n end",
"def global_const_defined? string\n begin\n eval string\n true\n rescue NameError\n false\n end\n end",
"def validate_filename string\n raise BadFilenameError.new string if /[\\?\\*\\\\\\/]/.match(string)\n end",
"def throw_unexpected_token(symbol, line, column)\n line_source = @string.split('\\n')[line - 1]\n\n pad = ' ' * column;\n line_data = \"\\n\\n\" + line_source + \"\\n\" + pad + \"^\\n\"\n\n raise (\n line_data + 'Unexpected token: \"' + symbol.to_s + '\" at ' +\n line.to_s + ':' + column.to_s + '.'\n )\n end",
"def scanstring(string)\n @error_list = \"\"\n work_string = string\n run_pos = 0\n begin\n @validator.valid_encoding?(work_string, true)\n rescue UTF8::ValidationError => e\n # Extract offset of error, keep running offset up to date\n last_colon = e.message.rindex(':')\n last_lparen = e.message.rindex('(')\n epos = e.message[last_colon+1..last_lparen-1]\n sub_start = epos.to_i\n if run_pos == 0\n run_pos += sub_start\n else\n run_pos += sub_start + 1\n end\n # Start again at error offset + 1\n work_string = work_string[sub_start+1..-1]\n # Build next error message\n next_emsg = e.message[0..last_colon] # Part A of current message\n # Add running offset position\n run_pos_str = sprintf \"%d(0x%x)\", run_pos, run_pos\n next_emsg += run_pos_str\n #\n @error_list += next_emsg\n @error_list += \"\\n\"\n retry\n end\n end",
"def test_unknown_type\n assert_raise TypeError do\n DefineVariableEval.new(\"FAKE\", \"name\").eval\n end\n end",
"def assert_throws(sym, msg=nil)\n msg = \"Expected #{sym} to have been thrown\" unless msg\n test = true\n catch(sym) do\n begin\n yield\n rescue ArgumentError => e # 1.9 exception\n default += \", not #{e.message.split(/ /).last}\"\n rescue NameError => e # 1.8 exception\n default += \", not #{e.name.inspect}\"\n end\n test = false\n end\n __assert__(test, msg)\n end",
"def test_fake_string_0\n pros = Prospector.new(0,0,0)\n assert pros.fake_string(0).eql? ''\n end",
"def test_check_args_invalid_string\n args = CheckArgs.new\n assert_equal false, args.check_args(['HI'])\n end",
"def should_not_throw\n if match.output.index(/\\n(\\S*)Exception(.*?)\\n\\S/m)\n raise Bcpm::Tests::AssertionError, \"Player should not have thrown exceptions! \" +\n \"It threw #{$1}Exception#{$2}\"\n end\n if match.chatter.index(/\\n(\\S*)Exception(.*?)\\n\\S/m)\n raise Bcpm::Tests::AssertionError, \"Player should not have thrown exceptions! \" +\n \"It threw #{$1}Exception#{$2}\"\n end\n end",
"def rescue_from(exception); end",
"def block_name_not_matched(ex_type)\n if VarOrInvokeExpr === ex_type && ConstantNameExpr === ex_type.name\n \"rescue_type_not_#{ex_type.name.name}\"\n else\n \"rescue_type_not_matched\"\n end\n end",
"def ignore_comment\n\traise 'Expected #' if gets[ 0 ] != '#'\nend",
"def test_lying_with_magic_comment\n assert_raises(ActionView::Template::Error) do\n @template = new_template(\"# encoding: UTF-8\\nhello \\xFCmlat\", virtual_path: nil)\n render\n end\n end",
"def test_string_sanity\n assert(!'foo'.respond_to?(:uri), \"Someone added an 'uri' method to the String class. This will cause problems.\")\n end",
"def add_working(string)\n write_message(:error, string)\n end",
"def retry_diagnostic(diagnostics)\n diagnostics =~ /RexStatusStr=Rex has not been initialized/\n end",
"def test_assert_raises_skip\n @assertion_count = 0\n\n assert_triggered \"skipped\", Minitest::Skip do\n @tc.assert_raises ArgumentError do\n begin\n raise \"blah\"\n rescue\n skip \"skipped\"\n end\n end\n end\n end",
"def refute_exception\n yield\n rescue StandardError => e\n flunk e.message\n end",
"def warning(string); end",
"def warning(string); end",
"def raise(exception); end",
"def process_unknown_check_id(line, check_id_string)\n raise ParseException, \"Script replied with unknown check id #{$1}\"\n end",
"def exception_state?(sym); @exception_states.include?(sym) end",
"def is_exception?; end",
"def does_not_contain_special str\n !(str.include?(\"#\") || str.include?(\"!\") || str.include?(\"$\"))\n end",
"def assert\n raise \"Found an error!\" unless yield\nend",
"def check_for_special(str)\n if str =~ /^(PHP |)Fatal error: (.+)\\s*/\n $stderr.puts \"Fatal error detected: #{str}\" if @debug\n @fatal = str.strip\n check_alive\n elsif str =~ /^Killed\\s*$/\n $stderr.puts \"Killed error detected: #{str}\" if @debug\n @fatal = \"Process was killed.\"\n check_alive\n end\n end"
] |
[
"0.6391079",
"0.6391079",
"0.6391079",
"0.62662095",
"0.61464554",
"0.59670454",
"0.59539443",
"0.57638824",
"0.56721777",
"0.5646018",
"0.56321967",
"0.5612933",
"0.5612933",
"0.5597484",
"0.55878466",
"0.55815697",
"0.5571182",
"0.55111945",
"0.5491926",
"0.5490103",
"0.54766303",
"0.5460815",
"0.5459222",
"0.5450635",
"0.544951",
"0.5447685",
"0.5437367",
"0.5418646",
"0.5365955",
"0.5351697",
"0.5347231",
"0.5344584",
"0.53356916",
"0.5333964",
"0.5332987",
"0.5332266",
"0.5330174",
"0.5329311",
"0.53098077",
"0.53072274",
"0.5295218",
"0.529438",
"0.5283892",
"0.52621734",
"0.52506435",
"0.5246142",
"0.52460843",
"0.5237733",
"0.5225932",
"0.5212357",
"0.520636",
"0.5187952",
"0.518622",
"0.5185993",
"0.5175188",
"0.51715857",
"0.51613367",
"0.5127532",
"0.5127324",
"0.5127108",
"0.51254684",
"0.5119401",
"0.5109829",
"0.5107058",
"0.5106093",
"0.51022893",
"0.50986916",
"0.5082105",
"0.5080391",
"0.5079508",
"0.5070414",
"0.50665116",
"0.50609773",
"0.5055078",
"0.50539356",
"0.50519294",
"0.50349563",
"0.50296956",
"0.5022883",
"0.5017105",
"0.5014833",
"0.50136966",
"0.50094074",
"0.50065875",
"0.4999447",
"0.49969536",
"0.4996544",
"0.49933368",
"0.4992178",
"0.4986673",
"0.4982338",
"0.49740565",
"0.49740565",
"0.49698982",
"0.49686182",
"0.49476832",
"0.49456057",
"0.49408737",
"0.4937552",
"0.4936506"
] |
0.79451984
|
0
|
Write a statement that allows a member to be updated by their name and age. This should take in the attributes of name, age and id.
|
def update()
sql = "UPDATE members SET (name, age) = ($1, $2) WHERE id = $3"
values = [@name, @age, @id]
SqlRunner.run(sql, values)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @member_type = args[:member_type] if args.key?(:member_type)\n @person_id = args[:person_id] if args.key?(:person_id)\n end",
"def update!(**args)\n @identity = args[:identity] if args.key?(:identity)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @member = args[:member] if args.key?(:member)\n @name = args[:name] if args.key?(:name)\n @role = args[:role] if args.key?(:role)\n @state = args[:state] if args.key?(:state)\n end",
"def update!(**args)\n @person = args[:person] if args.key?(:person)\n end",
"def update!(**args)\n @person = args[:person] if args.key?(:person)\n end",
"def update!(**args)\n @person = args[:person] if args.key?(:person)\n end",
"def update!(**args)\n @person = args[:person] if args.key?(:person)\n end",
"def update!(**args)\n @person = args[:person] if args.key?(:person)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @scope = args[:scope] if args.key?(:scope)\n end",
"def update\n sql = 'UPDATE customers SET name = $1, funds = $2 WHERE id = $3'\n values = [@name, @funds, @id]\n SqlRunner.run(sql, values)\n end",
"def update\n sql = \"UPDATE dogs SET name = ?, breed = ? WHERE id = ?\"\n DB[:conn].execute(sql, self.name, self.breed, self.id)\n end",
"def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @member = args[:member] if args.key?(:member)\n @name = args[:name] if args.key?(:name)\n @state = args[:state] if args.key?(:state)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @role = args[:role] if args.key?(:role)\n @target_account = args[:target_account] if args.key?(:target_account)\n @target_location = args[:target_location] if args.key?(:target_location)\n end",
"def update!(**args)\n @first_name = args[:first_name] if args.key?(:first_name)\n @last_name = args[:last_name] if args.key?(:last_name)\n end",
"def update\n sql = \"UPDATE students SET name = ?, grade = ? WHERE id = ?\"\n DB[:conn].execute(sql, self.name, self.grade, self.id)\nend",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @petacat_id = args[:petacat_id] if args.key?(:petacat_id)\n @probability = args[:probability] if args.key?(:probability)\n end",
"def update(sql, name = nil) end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @location = args[:location] if args.key?(:location)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @admin_name = args[:admin_name] if args.key?(:admin_name)\n @role = args[:role] if args.key?(:role)\n @pending_invitation = args[:pending_invitation] if args.key?(:pending_invitation)\n end",
"def update()\n sql = \"UPDATE customers (name, funds) = ($1, $2) WHERE id = $3\"\n values = [@name, @funds, @id]\n SqlRunner.run(sql,values)\n# => Updating only, no need to return any array\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @condition = args[:condition] if args.key?(:condition)\n @members = args[:members] if args.key?(:members)\n @role = args[:role] if args.key?(:role)\n end",
"def update!(**args)\n @hashed_account_id = args[:hashed_account_id] if args.key?(:hashed_account_id)\n @name = args[:name] if args.key?(:name)\n end",
"def update\n sql =\"UPDATE tags SET (tag_name) = ($1) WHERE id = $2\"\n values = [@tag_name, @id]\n SqlRunner.run(sql, values)\n end",
"def update_person_field(id:, **args)\n params = parameters(args) do\n required_params :name\n optional_params :name, :options\n end\n request(:put, \"personFields/#{id}\", params)\n end",
"def update!(**args)\n @last_name = args[:last_name] if args.key?(:last_name)\n @other_names = args[:other_names] if args.key?(:other_names)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n @insert_time = args[:insert_time] if args.key?(:insert_time)\n @name = args[:name] if args.key?(:name)\n @self_link = args[:self_link] if args.key?(:self_link)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n end",
"def update()\n sql = \"UPDATE countries\n SET\n name\n =\n $1\n WHERE id = $2\"\n values = [@name, @id]\n SqlRunner.run(sql, values)\n end",
"def update\n DB[:conn].execute(\"UPDATE students SET name = ? WHERE id = ?\", @name, @id)\n DB[:conn].execute(\"UPDATE students SET grade = ? WHERE id = ?\", @grade, @id)\n end",
"def update!(**args)\n @customer_name = args[:customer_name] if args.key?(:customer_name)\n @id = args[:id] if args.key?(:id)\n end",
"def update(first_name, id)\n @conn.exec(\"UPDATE students SET first_name = '#{first_name}' WHERE id = '#{id}';\")\nend",
"def update\n sql = \"UPDATE students SET name = ?, grade = ? WHERE id = ?\"\n DB[:conn].execute(sql, self.name, self.grade, self.id)\n end",
"def update!(**args)\n @disjunctive_match_statements = args[:disjunctive_match_statements] if args.key?(:disjunctive_match_statements)\n @name = args[:name] if args.key?(:name)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @value = args[:value] if args.key?(:value)\n end",
"def update!(**args)\n @name = args[:name] if args.key?(:name)\n @value = args[:value] if args.key?(:value)\n end"
] |
[
"0.68316185",
"0.68316185",
"0.68316185",
"0.68316185",
"0.68316185",
"0.68316185",
"0.68316185",
"0.68316185",
"0.68316185",
"0.6823033",
"0.66379356",
"0.6610382",
"0.6575947",
"0.6575947",
"0.6575947",
"0.6575947",
"0.6575947",
"0.6546459",
"0.6511765",
"0.6500765",
"0.64806205",
"0.6469222",
"0.6447941",
"0.6419906",
"0.641092",
"0.6387532",
"0.6383019",
"0.6381275",
"0.63685054",
"0.634803",
"0.63472366",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.6346107",
"0.63363165",
"0.6334336",
"0.6331373",
"0.63286173",
"0.63258886",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.6318403",
"0.631806",
"0.63123673",
"0.6297155",
"0.6294769",
"0.6287015",
"0.6260731",
"0.62575006",
"0.62575006",
"0.62575006",
"0.62575006",
"0.62575006",
"0.62575006",
"0.62575006",
"0.62575006"
] |
0.83937657
|
0
|
GET /layers GET /layers.json
|
def index
@layers = Layer.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def layers\n @layers ||= GeoIQ.get(\"#{path}/layers.json\")#.parsed_response#.map {|layer| GeoIQ::Layer.new(layer.merge('map_id' => id)) }\n end",
"def index\n @layers = Layer.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n # example output:\n # {\"layers\":[{\"id\":14,\"name\":\"coutries\",\"number_of_polygons\":279}]}\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n end\n end",
"def get_layers\n Geoloqi::Session.new(:access_token => CONFIG[:geoloqi][:app_access_token]).get('layer/list')[:layers]\nend",
"def get_layers\n Geoloqi::Session.new(:access_token => CONFIG['geoloqi']['app_access_token']).get('layer/list')[:layers]\nend",
"def get_layers options = {}, &block\n response = self.search :layers => nil\n doc = Nokogiri::XML(response)\n workspace_name = Workspace === options[:workspace] ? options[:workspace].name : options[:workspace]\n layer_nodes = doc.xpath(Layer.root_xpath).collect{|l| l.text.to_s }\n layers = list(Layer, layer_nodes, {}, &block)\n layers = layers.find_all { |layer| layer.workspace.name == workspace_name } if options[:workspace]\n layers\n end",
"def show\n @layers = Layer.where(:soil_id => params[:id])\n respond_to do |format|\n\t redirect_to @layers\n format.json { render json: @layers }\n end\n end",
"def show\n @layer = Layer.find(params[:id])\n areas_json = @layer.areas.map do |area|\n {area_id: area.id, polygon: area.polygon}\n end\n @result = {id: @layer.id, name: @layer.name, number_of_polygons: @layer.areas.count, areas: areas_json }\n\n base_url = \"#{request.protocol}#{request.host_with_port}\"\n permalink_hash = PermalinkController.generate_json(base_url, 'layers/show', @layer, @tolerance)\n @permalink = permalink_hash[:url]\n @data_json = permalink_hash[:data_json]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:layer => @layer, :data_json => @data_json, :permalink => @permalink} }\n format.topojson { render json: @layer.to_topojson }\n end\n end",
"def layers options={}\n standard_list Conjur::API.layer_asset_host, :layer, options\n end",
"def layers \n self.layerlist :layersonly=>true\n end",
"def index\n @map_layers = MapLayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @map_layers }\n end\n end",
"def get_layer\n @layer = Layer.find(params[:layer_id])\n end",
"def get_layer\n @layer = Layer.find(params[:layer_id])\n end",
"def get_layer\n @layer = Layer.find(params[:layer_id])\n end",
"def show\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_layer }\n end\n end",
"def wms_layers\n geonetwork_search_results = URI.parse(@geonetwork_url).read\n geonetwork_search_results_xml = Nokogiri::XML(geonetwork_search_results)\n\n layers = []\n geonetwork_search_results_xml.at_xpath(\"/response\").children.each do |metadata|\n next unless metadata.name == 'metadata'\n\n geonetwork_links = GeonetworkMetadataLinks.new(metadata)\n wms_server, wms_layer = geonetwork_links.wms_link\n\n if wms_server == @geoserver_url && wms_layer\n $logger.info \"Probed layer from Geonetwork: '#{wms_layer}' on '#{wms_server}'\"\n layers << wms_layer\n end\n end\n\n return layers\n end",
"def get_opsworks_layers\n data = opsworks_client.describe_layers(stack_id: opsworks_app[:stack_id])\n layers = {}\n data.layers.each do |layer|\n layers[layer.name] = layer\n end\n layers\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def update\n @layer = Layer.find(params[:id])\n\n respond_to do |format|\n if @layer.update_attributes(params[:layer])\n @layers = Layer.all\n format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def layers\n @layers ||= Dis::Layers.new\n end",
"def create\n @layer = Layer.new(params[:layer])\n\n respond_to do |format|\n if @layer and @layer.save\n @layers = Layer.all\n format.html { redirect_to layers_path, notice: 'Layer was successfully created.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n #@ru = request.original_url\n @ru = request.protocol + request.host_with_port + \"/layers/#{params['id']}\"\n #@ru = params['id']\n @annotation_layer = AnnotationLayer.where(layer_id: @ru).first\n\n # replace @ru with hostUrl environment variable\n host_url_prefix = Rails.application.config.hostUrl\n\n\n #authorize! :show, @annotation_layer\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annotation_layer.to_iiif, content_type: \"application/json\" }\n end\n end",
"def points_in_layer\n # request.path => \"/points/123,-74.006605,40.714623\" or \"/points/123,-74.006605,40.714623.json\"\n json_match = request.path.match('.json')\n query = request.path.gsub('.json', '').split(\"/\").last.split(\";\")\n points = query.inject([]) do |r, _|\n id, lon, lat = _.split(\",\")\n r << {:id => id, :lon => lon, :lat => lat}\n end\n\n points_in_area = Area.contains_points_in_layer_json(params[:layer_id].to_i, points, @tolerance)\n\n if params['idsonly'] && params['idsonly'] == 'true'\n points_in_area.each { |p| p.delete(:points) }\n end\n\n result = {\n :points_in_area => points_in_area\n }\n\n @layer = Layer.find(params[:layer_id])\n @result = result\n\n base_url = \"#{request.protocol}#{request.host_with_port}\"\n permalink_hash = PermalinkController.generate_json(base_url, 'layers/points_in_layer', @layer, @tolerance, @result)\n @permalink = permalink_hash[:url]\n @data_json = permalink_hash[:data_json]\n\n\n if json_match\n render json: @result\n else\n render 'points_in_layer'\n end\n end",
"def new\n @layer = Layer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @layer }\n end\n end",
"def configure_layers_data\n # Http/base layers don't appear at viz.json\n layers = @visualization.data_layers\n layers_data = Array.new\n layers.each do |layer|\n layer_vizjson = VizJSON3LayerPresenter.new(layer, @options, @configuration).to_vizjson\n layers_data.push(data_for_carto_layer(layer_vizjson))\n end\n layers_data\n end",
"def fetch_layers(rc)\n manifest = rc.manifest(@repo, @tag)\n manifest.mf[\"layers\"]\n rescue ::Portus::RequestError, ::Portus::Errors::NotFoundError,\n ::Portus::RegistryClient::ManifestError => e\n Rails.logger.info e.to_s\n nil\n end",
"def show\n @taxon = Taxon.find(params[:id])\n @layers = @taxon.layers.page(page).per(25)\n @geo_contexts = @taxon.geo_contexts.page(page).per(25)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxon }\n end\n end",
"def destroy\n @layer = Layer.find(params[:id])\n @layer.destroy\n\n respond_to do |format|\n format.html { redirect_to layers_url }\n format.json { head :no_content }\n end\n end",
"def show\n @hidden_neuron_layer = HiddenNeuronLayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hidden_neuron_layer }\n end\n end",
"def show\n @map_layer = MapLayer.find(params[:id])\n\n respond_to do |format|\n format.html { render 'show', :layout => false}\n format.xml { render :xml => @map_layer }\n end\n end",
"def show\n @layer_filter = LayerFilter.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @layer_filter }\n format.json { render :json => @layer_filter }\n end\n end",
"def index\n @polygons = Polygon.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @polygons }\n end\n end",
"def index\n @zones = Zone.all\n\n render json: @zones\n end",
"def layer?(name)\n response = get(\"/#{CitySDK::LAYER_PATH}/#{name}/\")\n case response.status\n when 200 then true\n when 404 then false\n else api_error(response)\n end # case\n end",
"def show\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_container }\n end\n end",
"def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end",
"def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end",
"def show\n @map = Map.find(params[:id], :include => \"tiles\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def show\n @overlay = Overlay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @overlay }\n end\n end",
"def show\n @traces = Trace.find_by(id: params[:id])\n url_string = ''\n response = HTTParty.get(url_string)\n data = {\n \"latitude\": @traces.latitude,\n \"longitude\": @traces.longitude,\n \"elevation\": response.body.to_i\n }\n render json: data\n end",
"def destroy\n @layer.destroy\n respond_to do |format|\n format.html { redirect_to layers_url, notice: 'Layer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @positions = Position.all.order :id\n @geojson = Hash.new\n\n @points = Position.geopoints\n @geojson = {\n type: 'FeatureCollection',\n features: @points\n }\n\n respond_to do |format|\n format.html\n format.json { render json: @geojson } # respond with the created JSON object\n end\n end",
"def show\n @laynet_ele = LaynetEle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laynet_ele }\n end\n end",
"def get_levels\n if params[:levels_by_nf] == 'true'\n @foundation = Foundation.find_by(name: params[:name])\n if @foundation\n render json: {levels: @foundation.levels.pluck(:name)}, status: 200\n else\n render json: {\n levels: []\n }, status: 200\n end\n return\n end\n\n @foundation = Foundation.find_by(id: params[:id])\n if @foundation\n render template: 'levels/get_levels.json', status: 200\n else\n render json: {\n levels: []\n }, status: 200\n end\n end",
"def get_layers\n conn = PG.connect(dbname: @base_name)\n conn.exec(\"SELECT * FROM geometry_columns\").field_values(\"f_table_name\")\n end",
"def show\n @polygon = Polygon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @polygon }\n end\n end",
"def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end",
"def show\n @terrain_type = TerrainType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @terrain_type }\n format.json { render :json => @terrain_type.to_json(:only => [:id, :name], :methods => :image_url) }\n \n end\n end",
"def get_layergroups options = {}, &block\n response = unless options[:workspace]\n self.search :layergroups => nil\n else\n self.search :workspaces => options[:workspace], :layergroups => nil\n end\n doc = Nokogiri::XML(response)\n layer_groups = doc.xpath(LayerGroup.root_xpath).collect{|l| l.text.to_s }.map(&:strip)\n list LayerGroup, layer_groups, {workspace: options[:workspace]}, &block\n end",
"def index \n respond_to do |format|\n format.html do\n authenticate_user!\n if params[:all] != \"true\"\n @trails = Trail.where(source: current_user.organization)\n else\n @trails = Trail.all\n end\n end\n format.json do\n @trails = Trail.all\n entity_factory = ::RGeo::GeoJSON::EntityFactory.instance\n features = []\n @trails.each do |trail|\n # taking a trip to Null Island, because RGeo::GeoJSON chokes on empty geometry here\n feature = entity_factory.feature(RGeo::Geographic.spherical_factory.point(0,0), trail.id, trail.attributes)\n features.push(feature)\n end\n collection = entity_factory.feature_collection(features)\n my_geojson = RGeo::GeoJSON::encode(collection)\n render json: Oj.dump(my_geojson)\n end\n end\n end",
"def index\n @ozones = Ozone.all\n render json: @ozones\n end",
"def lws_api_get(path)\n # See also catalog_controller for use of ENV['LWS_...']\n url ||= ENV['LWS_API_URL']\n url ||= \"#{ENV['LWS_CORE_URL']}/api\" if ENV['LWS_CORE_URL']\n \n # http://localhost:8888/api/collections\n resp = Net::HTTP.get_response(URI.parse(\"#{url || 'http://127.0.0.1:8888/api'}#{path}\"))\n result = JSON.parse(resp.body)\n end",
"def index\n @lights = Light.all\n\n render json: @lights\n end",
"def index\n @players = Player.all\n render json: @players\n end",
"def index\r\n markers = Marker.all\r\n render json: markers\r\n end",
"def index\n @laws = Law.ordered_roots\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laws }\n end\n end",
"def show\n render json: @light\n end",
"def index\n limit, offset = Calculator.limit_and_offset(params)\n @key_features = KeyFeature.all.limit(limit).offset(offset).order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @key_features\n end",
"def index\n @leaves = Leaf.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @leaves }\n end\n end",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def test_layers_returns_layers_obj\n obj = Sketchup.active_model.pages.add 'Testup Page'\n layers_obj = obj.layers\n result = layers_obj.class\n expected = Array\n assert_equal(expected, result, 'Expected does not match result.')\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def showJSON\n\n\t\trender json: UrlDataModel.find(params[:id])\n\n\tend",
"def fetchControlPoints(url, mapID)\n url = URI(url.to_s+'maps/'+mapID.to_s+'/control_points.json')\n response = Net::HTTP.get_response(url)\n data = response.body\n JSON.parse(data)\n end",
"def index\n @players = Player.all\n render json: @players, status: 200\n end",
"def geoserver_seeder_main(opts)\n layers = []\n\n if opts[:geonetwork]\n # Get layers from Geonetwork URL\n geonetwork_connector = GeonetworkConnector.new(opts[:geonetwork], opts[:geoserver])\n layers = geonetwork_connector.wms_layers\n else\n # Get layers from command line\n layers = opts[:layers]\n end\n\n return seed_layers(layers, opts)\nend",
"def show\n render json: @ozones\n end",
"def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend",
"def index\n #@world_maps = WorldMap.all\n\n respond_to do |format|\n format.html # index.erb.erb\n format.json { render json: @world_maps }\n end\n end",
"def show\n @bemap = Bemap.find(params[:id])\n @bemap_polylines = []\n @bemap_characters = []\n @bemap.characters.each do |v|\n @bemap_characters << { :lng => v[:longitude], :lat => v[:latitude]}\n end\n @bemap_polylines << @bemap_characters\n @bemap_polylines = @bemap_polylines.to_json\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bemap }\n end\n end",
"def all\n render json: Url.all\n end",
"def index\n @countries = Country.all\n\n render json: @countries\n end",
"def createLayers()\n @layers_array = import() \n end",
"def show\n tile = Tile.find(params[:id]) \n render json: tile\n end",
"def index\n @cabinet_transports = Transport.eager_load(:map_layer)\n end",
"def create\n @layer = Layer.new(layer_params)\n\n respond_to do |format|\n if @layer.save\n format.html { redirect_to @layer, notice: 'Layer was successfully created.' }\n format.json { render :show, status: :created, location: @layer }\n else\n format.html { render :new }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def [](name)\n if ((l = @layers[name]) == nil)\n l = Array.new\n @layers[name] = l\n end\n l\n end",
"def show\n render json: [*@zone]\n end",
"def interesting(options = {})\n response = Typhoeus::Request.get(\"#{DARKSKY_API_URL}/interesting/#{@api_key}\", DEFAULT_OPTIONS.dup.merge(options))\n JSON.parse(response.body) if response.code == 200 \n end",
"def index\n player = Player.all\n render json: players, status: 200\n end",
"def index\n @attribute_layers = @palette.attribute_layers.all\n end",
"def accessories\n render json: { collections: Collection.published_accessories }\n end",
"def show\n @training_level = TrainingLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training_level }\n end\n end",
"def destroy\n #@ru = request.original_url\n @ru = request.protocol + request.host_with_port + \"/layers/#{params['id']}\"\n @annotationLayer = AnnotationLayer.where(layer_id: @ru).first\n #authorize! :delete, @annotation_layer\n if @annotationLayer.version.nil? || @annotationLayer.version < 1\n @annotationLayer.version = 1\n end\n if !version_layer @annotationLayer\n errMsg = \"Annotation Layer could not be updated: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n end\n @annotationLayer.destroy\n request.format = \"json\"\n respond_to do |format|\n format.html { redirect_to annotation_layers_url }\n format.json { head :no_content }\n end\n end",
"def show\n find_map\n respond_to do |format|\n format.html do\n redirect_to edit_map_path(@map)\n end\n format.any(:json, :xml) do\n respond_with @map, :include => :waypoints\n end\n end\n\n end",
"def to_json(*args)\n layer.to_json(*args)\n end",
"def index\n @drawables = Drawable.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @drawables }\n end\n end",
"def new\n @attribute_layer = AttributeLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attribute_layer }\n end\n end",
"def update\n respond_to do |format|\n if @layer.update(layer_params)\n format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }\n format.json { render :show, status: :ok, location: @layer }\n else\n format.html { render :edit }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n end",
"def index\n @countries = Country.all\n json_response(@countries)\n end",
"def index\n @electors = Elector.all\n\n render json: @electors\n end",
"def index\n # filter query by param['group_id'] if it exists\n if params['group_id']\n group = Group.where(group_id: params['group_id']).first\n @annotation_layers = Array.new\n @annotation_layers = group.annotation_layers if !group.nil?\n else\n @annotation_layers = AnnotationLayer.order('order_weight')\n end\n respond_to do |format|\n format.html #index.html.erb\n iiif = []\n @annotation_layers.each do |annotation_layer|\n iiif << annotation_layer.to_iiif\n end\n iiif.to_json\n format.json {render json: iiif, content_type: \"application/json\"}\n end\n end",
"def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end",
"def index\n @teams = Team.all\n render json: @teams\n end",
"def show\n render json: @zone\n end",
"def index\n @maps = current_user.owned_maps\n respond_with @maps, :include => :waypoints\n end",
"def index\n @educacao = Educacao.new\n @educacaos = Educacao.all\n @modal = true\n\n factory = RGeo::GeoJSON::EntityFactory.instance\n features = []\n @educacaos.each do |edu|\n feature = factory.feature(edu.the_geom, nil, {id: edu.id, nome: edu.nome, email: edu.email, contato: edu.contato})\n features << feature\n end\n\n json_edu = RGeo::GeoJSON.encode factory.feature_collection(features)\n\n respond_to do |format|\n format.html\n format.json { render :json => json_edu }\n format.xml { render :xml => @educacaos }\n end\n end",
"def show\n @admin_geonode = Admin::Geonode.find(params[:id])\n @json = @admin_geonode.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_geonode }\n end\n end",
"def destroy\n @map_layer = MapLayer.find(params[:id])\n @map_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_layers_url) }\n format.xml { head :ok }\n end\n end",
"def show\n @outdoor = Outdoor.find(params[:id])\n @json = Outdoor.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outdoor }\n end\n end"
] |
[
"0.7279001",
"0.72497946",
"0.7154866",
"0.7126919",
"0.7081883",
"0.69295835",
"0.6829735",
"0.680823",
"0.67551494",
"0.6469824",
"0.63476837",
"0.63476837",
"0.63476837",
"0.63358384",
"0.63241506",
"0.62927425",
"0.62418884",
"0.6232961",
"0.6230768",
"0.6151616",
"0.61196256",
"0.6025065",
"0.5948176",
"0.594635",
"0.58465546",
"0.577442",
"0.5746203",
"0.57380015",
"0.5730184",
"0.5727619",
"0.56988204",
"0.5674373",
"0.5637356",
"0.56370324",
"0.5610334",
"0.5601297",
"0.5600479",
"0.55642605",
"0.5561123",
"0.5548656",
"0.55430996",
"0.5538462",
"0.55285984",
"0.5521331",
"0.55139995",
"0.55035967",
"0.54989874",
"0.5494612",
"0.54899806",
"0.54637396",
"0.5446348",
"0.5445237",
"0.5441065",
"0.5438662",
"0.5438564",
"0.5430137",
"0.54124004",
"0.54093724",
"0.5395367",
"0.53915256",
"0.53755534",
"0.5369435",
"0.5369138",
"0.5361754",
"0.53423095",
"0.53347546",
"0.533351",
"0.53248656",
"0.532157",
"0.53151774",
"0.5311676",
"0.5308174",
"0.5305719",
"0.53049964",
"0.5300906",
"0.52949125",
"0.5293785",
"0.52782714",
"0.5277067",
"0.5273862",
"0.5270956",
"0.52653015",
"0.52553403",
"0.5253986",
"0.5250312",
"0.5248145",
"0.5245938",
"0.5244239",
"0.52241683",
"0.5216982",
"0.5216809",
"0.5216344",
"0.52121013",
"0.521199",
"0.52098536",
"0.520955",
"0.5205066",
"0.5204315",
"0.520418",
"0.5202468"
] |
0.69002324
|
6
|
GET /layers/1 GET /layers/1.json
|
def show; end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @layers = Layer.where(:soil_id => params[:id])\n respond_to do |format|\n\t redirect_to @layers\n format.json { render json: @layers }\n end\n end",
"def index\n @layers = Layer.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n # example output:\n # {\"layers\":[{\"id\":14,\"name\":\"coutries\",\"number_of_polygons\":279}]}\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n end\n end",
"def show\n @layer = Layer.find(params[:id])\n areas_json = @layer.areas.map do |area|\n {area_id: area.id, polygon: area.polygon}\n end\n @result = {id: @layer.id, name: @layer.name, number_of_polygons: @layer.areas.count, areas: areas_json }\n\n base_url = \"#{request.protocol}#{request.host_with_port}\"\n permalink_hash = PermalinkController.generate_json(base_url, 'layers/show', @layer, @tolerance)\n @permalink = permalink_hash[:url]\n @data_json = permalink_hash[:data_json]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:layer => @layer, :data_json => @data_json, :permalink => @permalink} }\n format.topojson { render json: @layer.to_topojson }\n end\n end",
"def index\n @layers = Layer.all\n end",
"def get_layer\n @layer = Layer.find(params[:layer_id])\n end",
"def get_layer\n @layer = Layer.find(params[:layer_id])\n end",
"def get_layer\n @layer = Layer.find(params[:layer_id])\n end",
"def show\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attribute_layer }\n end\n end",
"def layers\n @layers ||= GeoIQ.get(\"#{path}/layers.json\")#.parsed_response#.map {|layer| GeoIQ::Layer.new(layer.merge('map_id' => id)) }\n end",
"def get_layers\n Geoloqi::Session.new(:access_token => CONFIG[:geoloqi][:app_access_token]).get('layer/list')[:layers]\nend",
"def get_layers options = {}, &block\n response = self.search :layers => nil\n doc = Nokogiri::XML(response)\n workspace_name = Workspace === options[:workspace] ? options[:workspace].name : options[:workspace]\n layer_nodes = doc.xpath(Layer.root_xpath).collect{|l| l.text.to_s }\n layers = list(Layer, layer_nodes, {}, &block)\n layers = layers.find_all { |layer| layer.workspace.name == workspace_name } if options[:workspace]\n layers\n end",
"def get_layers\n Geoloqi::Session.new(:access_token => CONFIG['geoloqi']['app_access_token']).get('layer/list')[:layers]\nend",
"def show\n #@ru = request.original_url\n @ru = request.protocol + request.host_with_port + \"/layers/#{params['id']}\"\n #@ru = params['id']\n @annotation_layer = AnnotationLayer.where(layer_id: @ru).first\n\n # replace @ru with hostUrl environment variable\n host_url_prefix = Rails.application.config.hostUrl\n\n\n #authorize! :show, @annotation_layer\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @annotation_layer.to_iiif, content_type: \"application/json\" }\n end\n end",
"def layers \n self.layerlist :layersonly=>true\n end",
"def update\n @layer = Layer.find(params[:id])\n\n respond_to do |format|\n if @layer.update_attributes(params[:layer])\n @layers = Layer.all\n format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @map_layers = MapLayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @map_layers }\n end\n end",
"def new\n @layer = Layer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @layer }\n end\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def show\n @layer_filter = LayerFilter.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @layer_filter }\n format.json { render :json => @layer_filter }\n end\n end",
"def show\n @map_layer = MapLayer.find(params[:id])\n\n respond_to do |format|\n format.html { render 'show', :layout => false}\n format.xml { render :xml => @map_layer }\n end\n end",
"def create\n @layer = Layer.new(params[:layer])\n\n respond_to do |format|\n if @layer and @layer.save\n @layers = Layer.all\n format.html { redirect_to layers_path, notice: 'Layer was successfully created.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @hidden_neuron_layer = HiddenNeuronLayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hidden_neuron_layer }\n end\n end",
"def layers options={}\n standard_list Conjur::API.layer_asset_host, :layer, options\n end",
"def destroy\n @layer = Layer.find(params[:id])\n @layer.destroy\n\n respond_to do |format|\n format.html { redirect_to layers_url }\n format.json { head :no_content }\n end\n end",
"def show\n @taxon = Taxon.find(params[:id])\n @layers = @taxon.layers.page(page).per(25)\n @geo_contexts = @taxon.geo_contexts.page(page).per(25)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @taxon }\n end\n end",
"def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end",
"def points_in_layer\n # request.path => \"/points/123,-74.006605,40.714623\" or \"/points/123,-74.006605,40.714623.json\"\n json_match = request.path.match('.json')\n query = request.path.gsub('.json', '').split(\"/\").last.split(\";\")\n points = query.inject([]) do |r, _|\n id, lon, lat = _.split(\",\")\n r << {:id => id, :lon => lon, :lat => lat}\n end\n\n points_in_area = Area.contains_points_in_layer_json(params[:layer_id].to_i, points, @tolerance)\n\n if params['idsonly'] && params['idsonly'] == 'true'\n points_in_area.each { |p| p.delete(:points) }\n end\n\n result = {\n :points_in_area => points_in_area\n }\n\n @layer = Layer.find(params[:layer_id])\n @result = result\n\n base_url = \"#{request.protocol}#{request.host_with_port}\"\n permalink_hash = PermalinkController.generate_json(base_url, 'layers/points_in_layer', @layer, @tolerance, @result)\n @permalink = permalink_hash[:url]\n @data_json = permalink_hash[:data_json]\n\n\n if json_match\n render json: @result\n else\n render 'points_in_layer'\n end\n end",
"def show\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_container }\n end\n end",
"def show\n @overlay = Overlay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @overlay }\n end\n end",
"def show\n @map = Map.find(params[:id], :include => \"tiles\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def show\n @laynet_ele = LaynetEle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @laynet_ele }\n end\n end",
"def show\n tile = Tile.find(params[:id]) \n render json: tile\n end",
"def get_opsworks_layers\n data = opsworks_client.describe_layers(stack_id: opsworks_app[:stack_id])\n layers = {}\n data.layers.each do |layer|\n layers[layer.name] = layer\n end\n layers\n end",
"def show\n @polygon = Polygon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @polygon }\n end\n end",
"def layers\n @layers ||= Dis::Layers.new\n end",
"def set_layer\n @layer = Layer.find(params[:id])\n end",
"def layer?(name)\n response = get(\"/#{CitySDK::LAYER_PATH}/#{name}/\")\n case response.status\n when 200 then true\n when 404 then false\n else api_error(response)\n end # case\n end",
"def wms_layers\n geonetwork_search_results = URI.parse(@geonetwork_url).read\n geonetwork_search_results_xml = Nokogiri::XML(geonetwork_search_results)\n\n layers = []\n geonetwork_search_results_xml.at_xpath(\"/response\").children.each do |metadata|\n next unless metadata.name == 'metadata'\n\n geonetwork_links = GeonetworkMetadataLinks.new(metadata)\n wms_server, wms_layer = geonetwork_links.wms_link\n\n if wms_server == @geoserver_url && wms_layer\n $logger.info \"Probed layer from Geonetwork: '#{wms_layer}' on '#{wms_server}'\"\n layers << wms_layer\n end\n end\n\n return layers\n end",
"def show\n @terrain_type = TerrainType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @terrain_type }\n format.json { render :json => @terrain_type.to_json(:only => [:id, :name], :methods => :image_url) }\n \n end\n end",
"def new\n @attribute_layer = AttributeLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attribute_layer }\n end\n end",
"def show\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n end",
"def destroy\n @layer.destroy\n respond_to do |format|\n format.html { redirect_to layers_url, notice: 'Layer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@ru = request.original_url\n @ru = request.protocol + request.host_with_port + \"/layers/#{params['id']}\"\n @annotationLayer = AnnotationLayer.where(layer_id: @ru).first\n #authorize! :delete, @annotation_layer\n if @annotationLayer.version.nil? || @annotationLayer.version < 1\n @annotationLayer.version = 1\n end\n if !version_layer @annotationLayer\n errMsg = \"Annotation Layer could not be updated: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n end\n @annotationLayer.destroy\n request.format = \"json\"\n respond_to do |format|\n format.html { redirect_to annotation_layers_url }\n format.json { head :no_content }\n end\n end",
"def show\n @tile = Tile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tile }\n end\n end",
"def show\n @tile = Tile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tile }\n end\n end",
"def update\n respond_to do |format|\n if @layer.update(layer_params)\n format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }\n format.json { render :show, status: :ok, location: @layer }\n else\n format.html { render :edit }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html { render layout: false }\n format.json\n format.geojson\n end\n end",
"def lws_api_get(path)\n # See also catalog_controller for use of ENV['LWS_...']\n url ||= ENV['LWS_API_URL']\n url ||= \"#{ENV['LWS_CORE_URL']}/api\" if ENV['LWS_CORE_URL']\n \n # http://localhost:8888/api/collections\n resp = Net::HTTP.get_response(URI.parse(\"#{url || 'http://127.0.0.1:8888/api'}#{path}\"))\n result = JSON.parse(resp.body)\n end",
"def new\n @map_layer = MapLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_layer }\n end\n end",
"def geo(id)\n get \"/geo/id/#{id}.json\"\n end",
"def show\n @traces = Trace.find_by(id: params[:id])\n url_string = ''\n response = HTTParty.get(url_string)\n data = {\n \"latitude\": @traces.latitude,\n \"longitude\": @traces.longitude,\n \"elevation\": response.body.to_i\n }\n render json: data\n end",
"def create\n @layer = Layer.new(layer_params)\n\n respond_to do |format|\n if @layer.save\n format.html { redirect_to @layer, notice: 'Layer was successfully created.' }\n format.json { render :show, status: :created, location: @layer }\n else\n format.html { render :new }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @polygons = Polygon.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @polygons }\n end\n end",
"def showJSON\n\n\t\trender json: UrlDataModel.find(params[:id])\n\n\tend",
"def show\n @training_level = TrainingLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @training_level }\n end\n end",
"def new\n @layer_filter = LayerFilter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @layer_filter }\n format.json { render :json => @layer_filter }\n end\n end",
"def show\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @playground }\n end\n end",
"def show\n @client = Client.find(params[:id])\n @pets = @client.pets\n @json = @client.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end",
"def [](name)\n if ((l = @layers[name]) == nil)\n l = Array.new\n @layers[name] = l\n end\n l\n end",
"def show\n @gl = Gl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gl }\n end\n end",
"def show\n @lift = Lift.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lift }\n end\n end",
"def show\n @outdoor = Outdoor.find(params[:id])\n @json = Outdoor.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outdoor }\n end\n end",
"def show\n @plane = Plane.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plane }\n end\n end",
"def show\n render json: @light\n end",
"def get(type, key)\n require_layers!\n\n fetch_count = 0\n result = layers.inject(nil) do |res, layer|\n res || lambda do\n fetch_count += 1\n layer.get(type, key)\n end.call\n end || raise(Dis::Errors::NotFoundError)\n\n store_immediately!(type, result) if fetch_count > 1\n result\n end",
"def configure_layers_data\n # Http/base layers don't appear at viz.json\n layers = @visualization.data_layers\n layers_data = Array.new\n layers.each do |layer|\n layer_vizjson = VizJSON3LayerPresenter.new(layer, @options, @configuration).to_vizjson\n layers_data.push(data_for_carto_layer(layer_vizjson))\n end\n layers_data\n end",
"def layer\n end",
"def destroy\n @map_layer = MapLayer.find(params[:id])\n @map_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_layers_url) }\n format.xml { head :ok }\n end\n end",
"def index\n @maps = Map.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end",
"def index\n # filter query by param['group_id'] if it exists\n if params['group_id']\n group = Group.where(group_id: params['group_id']).first\n @annotation_layers = Array.new\n @annotation_layers = group.annotation_layers if !group.nil?\n else\n @annotation_layers = AnnotationLayer.order('order_weight')\n end\n respond_to do |format|\n format.html #index.html.erb\n iiif = []\n @annotation_layers.each do |annotation_layer|\n iiif << annotation_layer.to_iiif\n end\n iiif.to_json\n format.json {render json: iiif, content_type: \"application/json\"}\n end\n end",
"def show\n find_map\n respond_to do |format|\n format.html do\n redirect_to edit_map_path(@map)\n end\n format.any(:json, :xml) do\n respond_with @map, :include => :waypoints\n end\n end\n\n end",
"def show\n @tinymap2 = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap2 }\n end\n end",
"def index \n respond_to do |format|\n format.html do\n authenticate_user!\n if params[:all] != \"true\"\n @trails = Trail.where(source: current_user.organization)\n else\n @trails = Trail.all\n end\n end\n format.json do\n @trails = Trail.all\n entity_factory = ::RGeo::GeoJSON::EntityFactory.instance\n features = []\n @trails.each do |trail|\n # taking a trip to Null Island, because RGeo::GeoJSON chokes on empty geometry here\n feature = entity_factory.feature(RGeo::Geographic.spherical_factory.point(0,0), trail.id, trail.attributes)\n features.push(feature)\n end\n collection = entity_factory.feature_collection(features)\n my_geojson = RGeo::GeoJSON::encode(collection)\n render json: Oj.dump(my_geojson)\n end\n end\n end",
"def show\n\t\t\t@zoom = Zoom.find(params[:id])\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html # show.html.erb\n\t\t\t\tformat.json { render json: @zoom }\n\t\t\tend\n\t\tend",
"def show\n @dimgeom = Dimgeom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dimgeom }\n end\n end",
"def show\n @admin_geonode = Admin::Geonode.find(params[:id])\n @json = @admin_geonode.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_geonode }\n end\n end",
"def index\n @positions = Position.all.order :id\n @geojson = Hash.new\n\n @points = Position.geopoints\n @geojson = {\n type: 'FeatureCollection',\n features: @points\n }\n\n respond_to do |format|\n format.html\n format.json { render json: @geojson } # respond with the created JSON object\n end\n end",
"def new\n @path = Path.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @path }\n end\n end",
"def destroy\n @attribute_layer = AttributeLayer.find(params[:id])\n @attribute_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to attribute_layers_url }\n format.json { head :no_content }\n end\n end",
"def show\n @surface = Surface.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @surface }\n end\n end",
"def show\n @tinymap = Tinymap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tinymap }\n end\n end",
"def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def show\n @map = Map.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @map }\n end\n end",
"def show\n @outlay = Outlay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outlay }\n end\n end",
"def fetch_layers(rc)\n manifest = rc.manifest(@repo, @tag)\n manifest.mf[\"layers\"]\n rescue ::Portus::RequestError, ::Portus::Errors::NotFoundError,\n ::Portus::RegistryClient::ManifestError => e\n Rails.logger.info e.to_s\n nil\n end",
"def show\n @konfig = Konfig.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @konfig }\n end\n end",
"def show\n @level = Level.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level }\n end\n end",
"def index\n @zones = Zone.all\n\n render json: @zones\n end",
"def index\n @lights = Light.all\n\n render json: @lights\n end",
"def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end",
"def geoserver_seeder_main(opts)\n layers = []\n\n if opts[:geonetwork]\n # Get layers from Geonetwork URL\n geonetwork_connector = GeonetworkConnector.new(opts[:geonetwork], opts[:geoserver])\n layers = geonetwork_connector.wms_layers\n else\n # Get layers from command line\n layers = opts[:layers]\n end\n\n return seed_layers(layers, opts)\nend",
"def show\n @litra = Litra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @litra }\n end\n end",
"def show\n @floor = Floor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @floor }\n end\n end",
"def show\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitty }\n end\n end",
"def wms2\n\n @layer_name = params[:LAYERS]\n begin\n ows = Mapscript::OWSRequest.new\n\n ok_params = Hash.new\n # params.each {|k,v| k.upcase! } frozen string error\n\n params.each {|k,v| ok_params[k.upcase] = v }\n\n [:request, :version, :transparency, :service, :srs, :width, :height, :bbox, :format, :srs, :layers].each do |key|\n\n ows.setParameter(key.to_s, ok_params[key.to_s.upcase]) unless ok_params[key.to_s.upcase].nil?\n end\n\n ows.setParameter(\"STYLES\", \"\")\n #ows.setParameter(\"LAYERS\", \"image\")\n\n map = Mapscript::MapObj.new(File.join(RAILS_ROOT, '/db/maptemplates/wms.map'))\n projfile = File.join(RAILS_ROOT, '/lib/proj')\n map.setConfigOption(\"PROJ_LIB\", projfile)\n #map.setProjection(\"init=epsg:900913\")\n map.applyConfigOptions\n\n # logger.info map.getProjection\n map.setMetaData(\"wms_onlineresource\",\n \"http://\" + request.host_with_port + \"/layers/wms2\")\n unless @layer_name\n\n Layer.visible.each do |layer|\n if layer.rectified_maps_count > 0\n raster = Mapscript::LayerObj.new(map)\n #raster.name = \"layer_\"+layer.id.to_s\n raster.name = \"layer_\"+layer.id.to_s\n raster.type = Mapscript::MS_LAYER_RASTER\n raster.tileindex = layer.tileindex_path\n raster.tileitem = \"Location\"\n\n raster.status = Mapscript::MS_ON\n raster.dump = Mapscript::MS_TRUE\n\n raster.metadata.set('wcs_formats', 'GEOTIFF')\n # raster.metadata.set('wms_title', \"layer \"+layer.id.to_s)\n raster.metadata.set('wms_title', layer.id.to_s + \": \"+snippet(layer.name, 15))\n\n raster.metadata.set('wms_abstract', layer.rectified_maps_count.to_s + \"maps. \"+\n layer.rectified_percent.to_i.to_s + \"% Complete\"+\n \"[Depicts:\"+layer.depicts_year.to_s+\"]\")\n\n raster.metadata.set('wms_keywordlist', 'depictsYear:'+layer.depicts_year.to_s +\n ',totalMaps:' + layer.maps.count.to_s +\n ',numberWarpedMaps:'+ layer.rectified_maps_count.to_s +\n ',percentComplete:'+ layer.rectified_percent.to_i.to_s +\n ',lastUpdated:' + layer.updated_at.to_s )\n raster.metadata.set('wms_srs', 'EPSG:4326 EPSG:4269 EPSG:900913')\n raster.debug = Mapscript::MS_TRUE\n end\n end\n\n else\n single_layer = Layer.find(@layer_name.to_s.delete(\"layer_\"))\n raster = Mapscript::LayerObj.new(map)\n raster.name = \"layer_\"+single_layer.id.to_s\n raster.type = Mapscript::MS_LAYER_RASTER\n raster.tileindex = single_layer.tileindex_path\n raster.tileitem = \"Location\"\n\n raster.status = Mapscript::MS_ON\n raster.dump = Mapscript::MS_TRUE\n\n raster.metadata.set('wcs_formats', 'GEOTIFF')\n raster.metadata.set('wms_title', single_layer.name)\n raster.metadata.set('wms_srs', 'EPSG:4326 EPSG:4269 EPSG:900913')\n raster.metadata.set('wms_keywordlist', 'depictsYear:'+layer.depicts_year.to_s +\n ',totalMaps:' + layer.maps.count.to_s +\n ',warpedMaps:'+ layer.rectified_maps_count.to_s +\n ',percentComplete:'+ layer.rectified_percent.to_i.to_s +\n ',lastUpdated:' + layer.updated_at.to_s )\n\n raster.debug = Mapscript::MS_TRUE\n end\n\n Mapscript::msIO_installStdoutToBuffer\n result = map.OWSDispatch(ows)\n content_type = Mapscript::msIO_stripStdoutBufferContentType || \"text/plain\"\n result_data = Mapscript::msIO_getStdoutBufferBytes\n\n send_data result_data, :type => content_type, :disposition => \"inline\"\n Mapscript::msIO_resetHandlers\n rescue RuntimeError => e\n @e = e\n render :action => 'wms',:layout =>'application'\n end\n end",
"def show\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @playground, :callback => params[:callback] }\n end\n end",
"def show\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @operation }\n end\n end",
"def show\n render status: 200, json: Training.find(params[:id])\n end",
"def show\n render json: Collection.find(params.require(:id))\n end",
"def show\n # proxy to GET /roi/id\n @result = ImageServer.get('/roi/'+params[:id]);\n render :json => @result\n end",
"def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend"
] |
[
"0.7235129",
"0.7104609",
"0.7030094",
"0.68151236",
"0.680925",
"0.680925",
"0.680925",
"0.6799517",
"0.6769139",
"0.6747782",
"0.67386323",
"0.6706228",
"0.65614843",
"0.6478981",
"0.6474849",
"0.64008576",
"0.6391028",
"0.6255259",
"0.6249205",
"0.6248825",
"0.623721",
"0.62370795",
"0.6172048",
"0.60400593",
"0.602",
"0.597661",
"0.5968388",
"0.5912801",
"0.59117454",
"0.5861458",
"0.5800257",
"0.5799622",
"0.5785847",
"0.57836056",
"0.5781676",
"0.5766081",
"0.57567763",
"0.5725229",
"0.5722092",
"0.5697259",
"0.566208",
"0.56467605",
"0.56456095",
"0.5619676",
"0.5619676",
"0.5608267",
"0.55800694",
"0.5576904",
"0.557122",
"0.555538",
"0.5544379",
"0.55343914",
"0.5534055",
"0.5528019",
"0.55245477",
"0.551976",
"0.5511597",
"0.54991186",
"0.54687536",
"0.5466112",
"0.54531735",
"0.5446328",
"0.54351735",
"0.5425307",
"0.54242504",
"0.5416184",
"0.5415245",
"0.54061115",
"0.5403796",
"0.54029876",
"0.5402104",
"0.53933096",
"0.53929937",
"0.5390873",
"0.53902614",
"0.5389777",
"0.5382739",
"0.5382595",
"0.5373693",
"0.5369897",
"0.53623235",
"0.5359032",
"0.5359032",
"0.5351753",
"0.5350926",
"0.5340434",
"0.5335716",
"0.53350294",
"0.5332113",
"0.53305274",
"0.5330326",
"0.5302111",
"0.5294189",
"0.52910614",
"0.5290703",
"0.5280941",
"0.52683854",
"0.5267563",
"0.52600557",
"0.5258339",
"0.5257889"
] |
0.0
|
-1
|
POST /layers POST /layers.json
|
def create
@layer = Layer.new(layer_params)
respond_to do |format|
if @layer.save
format.html { redirect_to @layer, notice: 'Layer was successfully created.' }
format.json { render :show, status: :created, location: @layer }
else
format.html { render :new }
format.json { render json: @layer.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @layer = Layer.new(params[:layer])\n\n respond_to do |format|\n if @layer and @layer.save\n @layers = Layer.all\n format.html { redirect_to layers_path, notice: 'Layer was successfully created.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"new\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @layer = Layer.find(params[:id])\n\n respond_to do |format|\n if @layer.update_attributes(params[:layer])\n @layers = Layer.all\n format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @layerIn = JSON.parse(params.to_json)\n @layer = Hash.new\n #@ru = request.original_url\n @ru = request.original_url.split('?').first\n @ru += '/' if !@ru.end_with? '/'\n @layer['layer_id'] = @ru + SecureRandom.uuid\n @layer['layer_type'] = @layerIn['@type']\n @layer['label'] = @layerIn['label']\n @layer['motivation'] = @layerIn['motivation']\n #@layer['description'] = @layerIn['description']\n @layer['license'] = @layerIn['license']\n @layer['version'] = 1\n @annotation_layer = AnnotationLayer.new(@layer)\n\n #authorize! :create, @annotation_layer\n request.format = \"json\"\n respond_to do |format|\n if @annotation_layer.save\n format.html { redirect_to @annotation_layer, notice: 'Annotation layer was successfully created.' }\n format.json { render json: @annotation_layer.to_iiif, status: :created, location: @annotation_layer, content_type: \"application/json\" }\n else\n format.html { render action: \"new\" }\n format.json { render json: @annotation_layer.errors, status: :unprocessable_entity, content_type: \"application/json\" }\n end\n end\n end",
"def create_layer(attributes = {})\n query = {:query => attributes}\n GeoIQ.post(\"#{path}/layers.json\", query)\n # GeoIQ::Layer.new(GeoIQ.post(\"#{path}/layers.json\", query).parsed_response.merge('map_id' => id))\n end",
"def create\n @map_layer = MapLayer.new(params[:map_layer])\n\n respond_to do |format|\n if @map_layer.save\n flash[:notice] = 'Map Layer was successfully created.'\n format.html { redirect_to(@map_layer) }\n format.xml { render :xml => @map_layer, :status => :created, :location => @map_layer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @map_layer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @attribute_layer = AttributeLayer.new(params[:attribute_layer])\n puts \"---------------------------------------------\"\n respond_to do |format|\n if @attribute_layer.save\n format.html { redirect_to @attribute_layer, notice: 'Attribute layer was successfully created.' }\n format.json { render json: @attribute_layer, status: :created, location: @attribute_layer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @attribute_layer = @palette.attribute_layers.new(attribute_layer_params)\n\n respond_to do |format|\n if @attribute_layer.save\n format.html { redirect_to [@palette, @attribute_layer], notice: 'Attribute layer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attribute_layer }\n else\n format.html { render action: 'new' }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @layer = Layer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @layer }\n end\n end",
"def create\n @view = @workspace.views.build(view_params)\n\n respond_to do |format|\n if @view.save\n @view.layers = Layer.all\n format.html { redirect_to workspace_view_path(@workspace, @view), notice: 'View was successfully created.' }\n format.json { render :show, status: :created, location: @view }\n else\n format.html { render :new }\n format.json { render json: @view.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hidden_neuron_layer = HiddenNeuronLayer.new(params[:hidden_neuron_layer])\n\n respond_to do |format|\n if @hidden_neuron_layer.save\n format.html { redirect_to @hidden_neuron_layer, notice: 'Hidden neuron layer was successfully created.' }\n format.json { render json: @hidden_neuron_layer, status: :created, location: @hidden_neuron_layer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hidden_neuron_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def layer_params\n params.require(:layer).permit(:name, :category_id, :url, :params, :ckan_id, style: [:color])\n end",
"def save_layers()\n @layers_array.each do |layer|\n layer.map_id = self.id\n layer.init\n layer.save!\n end\n end",
"def save_layer(layer)\n if layer.save\n yield\n\n render_jsonp Carto::Api::LayerPresenter.new(layer, viewer_user: current_user).to_poro\n else\n log_error(message: 'Error creating layer', error_detail: layer.errors.full_messages)\n raise UnprocesableEntityError.new(layer.errors.full_messages)\n end\n end",
"def destroy\n @layer = Layer.find(params[:id])\n @layer.destroy\n\n respond_to do |format|\n format.html { redirect_to layers_url }\n format.json { head :no_content }\n end\n end",
"def index\n @layers = Layer.order(:id)\n\n respond_to do |format|\n format.html # index.html.erb\n # example output:\n # {\"layers\":[{\"id\":14,\"name\":\"coutries\",\"number_of_polygons\":279}]}\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n end\n end",
"def destroy\n @layer.destroy\n respond_to do |format|\n format.html { redirect_to layers_url, notice: 'Layer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def createLayers()\n @layers_array = import() \n end",
"def save\n response = @server.post(\"#{@parent_path}/layergroups\", JSON.generate({ \"layerGroup\" => @parameters }))\n raise ArgumentError, \"Error creating layer group.\\n #{response.body}\" if response.code != \"201\"\n @path = response.header[\"Location\"]\n parse(@server.get(@path).body)\n self\n end",
"def new\n @attribute_layer = AttributeLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attribute_layer }\n end\n end",
"def update\n respond_to do |format|\n if @layer.update(layer_params)\n format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }\n format.json { render :show, status: :ok, location: @layer }\n else\n format.html { render :edit }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @polygon_mark = PolygonMark.new(:name => params[:name], :layer_id => params[:layer_id])\n \n respond_to do |format|\n if @polygon_mark.save\n @polygon_mark.the_geom = Polygon.from_coordinates([params[:coordinates]], 4269)\n @polygon_mark.save!\n format.html { redirect_to @polygon_mark, :notice => 'polygon mark was successfully created.' }\n format.json { render :json => @polygon_mark, :status => :created, :location => @polygon_mark }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @polygon_mark.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @layer = Layer.find(params[:id])\n areas_json = @layer.areas.map do |area|\n {area_id: area.id, polygon: area.polygon}\n end\n @result = {id: @layer.id, name: @layer.name, number_of_polygons: @layer.areas.count, areas: areas_json }\n\n base_url = \"#{request.protocol}#{request.host_with_port}\"\n permalink_hash = PermalinkController.generate_json(base_url, 'layers/show', @layer, @tolerance)\n @permalink = permalink_hash[:url]\n @data_json = permalink_hash[:data_json]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {:layer => @layer, :data_json => @data_json, :permalink => @permalink} }\n format.topojson { render json: @layer.to_topojson }\n end\n end",
"def pdk_params\n params.require(:pdk).permit(:name, { :layer_ids => [] })\n end",
"def layers\n @layers ||= GeoIQ.get(\"#{path}/layers.json\")#.parsed_response#.map {|layer| GeoIQ::Layer.new(layer.merge('map_id' => id)) }\n end",
"def destroy\n #@ru = request.original_url\n @ru = request.protocol + request.host_with_port + \"/layers/#{params['id']}\"\n @annotationLayer = AnnotationLayer.where(layer_id: @ru).first\n #authorize! :delete, @annotation_layer\n if @annotationLayer.version.nil? || @annotationLayer.version < 1\n @annotationLayer.version = 1\n end\n if !version_layer @annotationLayer\n errMsg = \"Annotation Layer could not be updated: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n end\n @annotationLayer.destroy\n request.format = \"json\"\n respond_to do |format|\n format.html { redirect_to annotation_layers_url }\n format.json { head :no_content }\n end\n end",
"def set_layer\n @layer = Layer.find(params[:id])\n end",
"def attribute_layer_params\n params.require(:attribute_layer).permit(:label, :palette_id)\n end",
"def add_layer\n puts \"made it to PL add layer\"\n Layer.create(:name => @new_table_name, :table_name => @new_table_name, :geometric_column_name => \"the_geom\")\n end",
"def create\n\n has = params[\"area\"].to_json\n data_has = JSON.parse(has)\n @zone = Zone.new();\n @zone.nombre_zona = params[\"nombre_zona\"]\n @zone.color = params[\"color\"]\n\n respond_to do |format|\n if @zone.save\n \n data_has.each do |geo|\n @coordenada = CoordinateZone.new()\n geo.each do |data|\n @coordenada.zone_id = @zone.id\n @coordenada.latitud = data[\"lat\"].to_f\n @coordenada.longitud = data[\"lng\"].to_f \n end\n @coordenada.save\n end\n\n format.html { redirect_to @zone, notice: 'Zone was successfully created.' }\n format.js \n # format.js { render js: \"window.location.href=#{ directories_path }\" }\n format.json { render :show, status: :created, location: @zone }\n \n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n\n end\n end",
"def create\n @layer_filter = LayerFilter.new(params[:layer_filter])\n respond_to do |format|\n if @layer_filter.save\n flash[:notice] = 'LayerFilter was successfully created.'\n format.html { redirect_to(@layer_filter) }\n format.xml { render :xml => @layer_filter, :status => :created, :location => @layer_filter }\n format.json { render :json => @layer_filter }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @layer_filter.errors, :status => :unprocessable_entity }\n format.json { render :json => @layer_filter.errors }\n end\n end\n end",
"def points_in_layer\n # request.path => \"/points/123,-74.006605,40.714623\" or \"/points/123,-74.006605,40.714623.json\"\n json_match = request.path.match('.json')\n query = request.path.gsub('.json', '').split(\"/\").last.split(\";\")\n points = query.inject([]) do |r, _|\n id, lon, lat = _.split(\",\")\n r << {:id => id, :lon => lon, :lat => lat}\n end\n\n points_in_area = Area.contains_points_in_layer_json(params[:layer_id].to_i, points, @tolerance)\n\n if params['idsonly'] && params['idsonly'] == 'true'\n points_in_area.each { |p| p.delete(:points) }\n end\n\n result = {\n :points_in_area => points_in_area\n }\n\n @layer = Layer.find(params[:layer_id])\n @result = result\n\n base_url = \"#{request.protocol}#{request.host_with_port}\"\n permalink_hash = PermalinkController.generate_json(base_url, 'layers/points_in_layer', @layer, @tolerance, @result)\n @permalink = permalink_hash[:url]\n @data_json = permalink_hash[:data_json]\n\n\n if json_match\n render json: @result\n else\n render 'points_in_layer'\n end\n end",
"def create\n @polygon = Polygon.new(params[:polygon])\n\n respond_to do |format|\n if @polygon.save\n format.html { redirect_to @polygon, notice: 'Polygon was successfully created.' }\n format.json { render json: @polygon, status: :created, location: @polygon }\n else\n format.html { render action: \"new\" }\n format.json { render json: @polygon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dog_poly = DogPoly.new(dog_poly_params)\n\n respond_to do |format|\n if @dog_poly.save\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully created.' }\n format.json { render :show, status: :created, location: @dog_poly }\n else\n format.html { render :new }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def setup_layers\n\tend",
"def show\n @layers = Layer.where(:soil_id => params[:id])\n respond_to do |format|\n\t redirect_to @layers\n format.json { render json: @layers }\n end\n end",
"def layers options={}\n standard_list Conjur::API.layer_asset_host, :layer, options\n end",
"def seed_layers(layers, opts)\n start_zoom = opts[:start_zoom]\n end_zoom = opts[:end_zoom] || start_zoom\n geoserver_wms_url = Utils::local_geoserver_address(opts)\n url_format = Utils::get_url_format_from_url(opts[:url])\n tiles_seed_count = 0\n\n for zoom_level in start_zoom..end_zoom\n layers.each do |layer|\n opts_for_squid_layer_seeder = opts.dup\n opts_for_squid_layer_seeder[:layer] = layer\n opts_for_squid_layer_seeder[:zoom_level] = zoom_level\n opts_for_squid_layer_seeder[:geoserver_wms_url] = geoserver_wms_url\n opts_for_squid_layer_seeder[:url_format] = url_format\n\n layer_seeder = SquidLayerSeeder.new(opts_for_squid_layer_seeder)\n tiles_seed_count += layer_seeder.seed\n end\n end\n\n $logger.info \"Total tiles seeded in operation: '#{tiles_seed_count}'\"\n\n return true\nend",
"def to_json(*args)\n layer.to_json(*args)\n end",
"def create\n # JSONファイルから文字列を抽出する\n file = params['stage']['file']# Upされたファイルにアクセス\n \n p(\"file params:\")\n\n @jsonstring = file.read\n p(@jsonstring)\n @stage = Stage.new(:scene_data => @jsonstring, :title => params[:stage][:title])\n p(\"stage.scene_data:\")\n p(@stage.scene_data)\n #p(@stage.nothing)\n \n if params[:stage][:texture] != nil\n @textures = Texture.new(:data => params[:stage][:texture]['data'])\n @stage.textures << @textures\n end\n\n respond_to do |format|\n if @stage.save!\n format.html { redirect_to @stage, notice: 'Stage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @stage }\n else\n format.html { render action: 'new' }\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @map_layer = MapLayer.find(params[:id])\n @map_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_layers_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @level_container = LevelContainer.new(params[:level_container])\n\n respond_to do |format|\n if @level_container.save\n format.html { redirect_to @level_container, notice: 'Level container was successfully created.' }\n format.json { render json: @level_container, status: :created, location: @level_container }\n else\n format.html { render action: \"new\" }\n format.json { render json: @level_container.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @attribute_layer = AttributeLayer.find(params[:id])\n @attribute_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to attribute_layers_url }\n format.json { head :no_content }\n end\n end",
"def create_nodes(layer, nodes, params = {})\n default_params = {\n create_type: CREATE_TYPE_CREATE,\n node_type: NODE_TYPE_PTSTOP\n }\n params = default_params.merge(params)\n data = { create: { params: params }, nodes: nodes }.to_json\n response = put(\"/nodes/#{layer}\", data)\n if response.status != 200\n fail APIError, response.body\n end # if\n end",
"def layer=(layer)\n end",
"def create\n @level = Level.new(params[:level])\n\n base64png = params[:level][:json]['backgroundUrl']\n filename = Digest::MD5.hexdigest(base64png) + \".png\"\n\n File.open(File.join('public','uploads','maps', filename), 'wb') do |f|\n f.write(Base64.decode64(base64png.sub('data:image/png;base64,','')))\n end\n\n @level.json[\"backgroundUrl\"] = \"/uploads/maps/#{filename}\"\n @level.creator = current_user\n\n respond_to do |format|\n if @level.save\n format.html { redirect_to(@level, :notice => 'Level was successfully created.') }\n format.json { render :json => @level, :status => :created, :location => @level }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @level.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @layers = Layer.all\n end",
"def destroy\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n @attribute_layer.destroy\n respond_to do |format|\n format.html { redirect_to palette_attribute_layers_url(@palette) }\n format.json { head :no_content }\n end\n end",
"def create\n @cat_poly = CatPoly.new(cat_poly_params)\n\n respond_to do |format|\n if @cat_poly.save\n format.html { redirect_to @cat_poly, notice: 'Cat poly was successfully created.' }\n format.json { render :show, status: :created, location: @cat_poly }\n else\n format.html { render :new }\n format.json { render json: @cat_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n data = []\n trace_params.each do |p|\n hash = {\n latitude: p[\"latitude\"],\n longitude: p[\"longitude\"]\n }\n data << hash\n end\n\n if Trace.upload_data(data)\n render json: {status: 'OK'}\n else\n render json: @trace.errors, status: :unprocessable_entity\n end\n end",
"def create\n @zone = Zone.new(zone_params)\n\n if @zone.save\n render json: @zone, status: :created, location: @zone\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end",
"def layers \n self.layerlist :layersonly=>true\n end",
"def create\n @ocean = Ocean.new(ocean_params)\n\n respond_to do |format|\n if @ocean.save\n format.html { redirect_to @ocean, notice: 'Ocean was successfully created.' }\n format.json { render :show, status: :created, location: @ocean }\n else\n format.html { render :new }\n format.json { render json: @ocean.errors, status: :unprocessable_entity }\n end\n end\n end",
"def configure_layers_data\n # Http/base layers don't appear at viz.json\n layers = @visualization.data_layers\n layers_data = Array.new\n layers.each do |layer|\n layer_vizjson = VizJSON3LayerPresenter.new(layer, @options, @configuration).to_vizjson\n layers_data.push(data_for_carto_layer(layer_vizjson))\n end\n layers_data\n end",
"def new\n @map_layer = MapLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_layer }\n end\n end",
"def create\n @zonal = Zonal.new(zonal_params)\n\n respond_to do |format|\n if @zonal.save\n format.html { redirect_to @zonal, notice: 'Zonal was successfully created.' }\n format.json { render :show, status: :created, location: @zonal }\n else\n format.html { render :new }\n format.json { render json: @zonal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_layer\n Layer.create(:name => @new_table_name, :table_name => @new_table_name, :geometric_column_name => \"the_geom\")\n end",
"def create\n @floor = Floor.new(floor_params)\n\n respond_to do |format|\n if @floor.save\n editorData = @floor.editor_data\n editorData = editorData.split(\"<END>\").map{|i| i.split(\"<NEXT>\")}\n editorData.each do |obj|\n if obj[0] == 'submain'\n object = Room.new(name: obj[1],\n description: obj[2],\n capacity: obj[3],\n computers: obj[4],\n roomtype_id: Roomtype.all.where(id: obj[5].to_i)[0],\n floor_id: @floor.id)\n object.save\n elsif obj[0] == 'main'\n object = @floor\n end\n polygon = Polygon.new(imageable: object)\n polygon.save\n points = obj[6].split(\" \").map{|i| i.split(\",\")}\n for i in 0 ... points.size\n point = Point.create(ox: points[i][0].to_f,\n oy: points[i][1].to_f,\n priority: i,\n polygon: polygon\n )\n point.save\n end\n end\n\n format.html { redirect_to @floor, notice: t('flash.floor.create') }\n format.json { render :show, status: :created, location: @floor }\n else\n format.html { render :new }\n format.json { render json: @floor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateLayers()\n layers.each do |layer|\n layer.destroy\n end\n #tilesets.each do |tileset|\n # tilesets.delete(tileset)\n #end\n createLayers()\n end",
"def json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end",
"def create\n @terrain = Terrain.new(terrain_params)\n\n respond_to do |format|\n if @terrain.save\n format.html { redirect_to @terrain, notice: 'Terrain was successfully created.' }\n format.json { render :show, status: :created, location: @terrain }\n else\n format.html { render :new }\n format.json { render json: @terrain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trail = Trail.new(params[:trail])\n respond_to do |format|\n if @trail.save\n\t@trail.lat_map = elevation(@trail.longitude_start, @trail.latitude_start, @trail.longitude_end, @trail.latitude_end)\n\t@trail.gmap = staticmap_uri(@trail.longitude_start + \",\" + @trail.latitude_start + \"|\"+ @trail.longitude_end + \",\" + @trail.latitude_end)\n\t@trail.save\n format.html { redirect_to @trail, notice: 'Trail was successfully created.' }\n format.json { render json: @trail, status: :created, location: @trail }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dot_params\n params.require(:dot).permit(:map_id, :user_id, :name, :x, :y)\n end",
"def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n @dot = @map.dots.new(dot_params)\n\n respond_to do |format|\n if @dot.save\n format.html { redirect_to @dot, notice: 'Dot was successfully created.' }\n format.json { render :show, status: :created, location: @dot }\n else\n format.html { render :new }\n format.json { render json: @dot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\nActionController::Parameters.permit_all_parameters = true\n @tile = Tile.new(tile_params)\n\n if params[:imd] != nil\n @image = Image.find(params[:imd])\n @image.tiles << @tile\n end\n if params[:tti] != nil\n\t\t@terraintype = Terraintype.find(params[:tti]) \n\t\t@terraintype.tiles << @tile\n\t\t#@tile.terraintype = @terraintype \n end\n if params[:lmd] != nil\n @layer = Layer.find(params[:lmd])\n @layer.tiles << @tile\n end\n\n if params[:rid] != nil\n \t@resource = Resource.find(params[:rid])\n\t @resource.tiles << @tile\n\t end \n if params[:rids] != nil\n\t\tparams[:rids].each {\t|x| \n\t \t@resource = Resource.find(x)\t \n\t \t@tile.resources << @resource\n\t\t}\n\tend\t\t\n\tif params[:bids] != nil\n\t\tparams[:bids].each {\t|x| \n\t \t@building = Building.find(x)\t \n\t \t@tile.buildings << @building\n\t\t}\n\tend\t\nRails.logger.debug \"tile params: \" + params[:imd].to_s\n \n respond_to do |format|\n\n if @tile.save \n format.html { redirect_to @tile, notice: 'Tile was successfully created.' }\n format.json { render action: 'id', status: :created, location: @tile }\n else\n format.html { render action: 'new' }\n format.json { render json: @tile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @stage = Stage.new(stage_params)\n\n if @stage.save\n render json: @stage, status: :created\n else\n render json: @stage.errors, status: :unprocessable_entity\n end\n end",
"def create\n map = Map.new;\n map.user_id = session[:user]['id']\n map.name = params['name']\n map.map_json = params['map_json']\n\n if map.save\n render json: {save: true, message: 'zapisano poprawnie mapę', callback: 'map'}\n else\n render json: {save: false, message: 'błąd podczas zapisu mapy', callback: 'map'}\n end\n end",
"def create\n @leaf = Leaf.new(leaf_params)\n\n respond_to do |format|\n if @leaf.save\n format.html { redirect_to leaf_path(@leaf), notice: CREATE_SUCCESS }\n format.json { render :show, status: :created, location: @leaf }\n else\n format.html { render :new }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @leaf = Leaf.new(leaf_params)\n\n respond_to do |format|\n if @leaf.save\n format.html { redirect_to @leaf, notice: t('common.message.created_success')}\n format.json { render :show, status: :created, location: @leaf }\n else\n format.html { render :new }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @leaf = Leaf.new(leaf_params)\n\n respond_to do |format|\n if @leaf.save\n format.html { redirect_to @leaf, notice: 'Leaf was successfully created.' }\n format.json { render json: @leaf, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @floor_stage = Floor::Stage.new(floor_stage_params)\n\n respond_to do |format|\n if @floor_stage.save\n format.html { redirect_to @floor_stage, notice: 'Stage was successfully created.' }\n format.json { render :show, status: :created, location: @floor_stage }\n else\n format.html { render :new }\n format.json { render json: @floor_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @path = Path.new({:layer => @layer})\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @path }\n end\n end",
"def destroy\n @hidden_neuron_layer = HiddenNeuronLayer.find(params[:id])\n @hidden_neuron_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to hidden_neuron_layers_url }\n format.json { head :no_content }\n end\n end",
"def create\n\n post = Post.new(post_params)\n post.location = Location.create(name: params[:post][:location][:name], lat: params[:post][:location][:lat], long: params[:post][:location][:long])\n if post.save\n params[:post][:images].each do |i|\n img = Image.find(i[:id])\n img.update(active: 1, post_id: post.id)\n end\n\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n\n else\n render json: post.errors, status: 404\n end\n end",
"def index\n @map_layers = MapLayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @map_layers }\n end\n end",
"def update\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n respond_to do |format|\n if @attribute_layer.update(attribute_layer_params)\n format.html { redirect_to [@palette, @attribute_layer], notice: 'Attribute layer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @hidden_neuron_layer = HiddenNeuronLayer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hidden_neuron_layer }\n end\n end",
"def create\n @repairing_layer = Repairing::Layer.new(repairing_layer_params)\n\n if current_user.has_role?(:admin)\n @repairing_layer.town = Town.find(repairing_layer_params['town'])\n else\n @repairing_layer.town = Town.where(title: current_user.town).first_or_create\n end\n @repairing_layer.owner = current_user\n @repairing_layer.repairing_category = Repairing::Category.find(repairing_layer_params['repairing_category']) unless repairing_layer_params['repairing_category'].blank?\n\n respond_to do |format|\n if @repairing_layer.save\n\n repairs = read_table_from_file(@repairing_layer.repairs_file.path)\n\n import(@repairing_layer, repairs[:rows])\n\n format.html { redirect_to @repairing_layer, notice: 'Layer was successfully created.' }\n format.json { render :show, status: :created, location: @repairing_layer }\n else\n format.html { render :new }\n format.json { render json: @repairing_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @levels_point = LevelsPoint.new(levels_point_params)\n\n respond_to do |format|\n if @levels_point.save\n format.html { redirect_to @levels_point, notice: 'Levels point was successfully created.' }\n format.json { render :show, status: :created, location: @levels_point }\n else\n format.html { render :new }\n format.json { render json: @levels_point.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @geo = Geo.new(geo_params)\n\n respond_to do |format|\n if @geo.save\n format.html { redirect_to @geo, notice: 'Geo was successfully created.' }\n format.json { render :show, status: :created, location: @geo }\n else\n format.html { render :new }\n format.json { render json: @geo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_layer_object( object )\n layers.push( object )\n end",
"def stage_params\n params.require(:golfer).permit(:title, :country, :city, :holes_count, holes_attributes: [:number, :distance_m, :distance_w, :par])\n end",
"def update\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n if @attribute_layer.update_attributes(params[:attribute_layer])\n format.html { redirect_to @attribute_layer, notice: 'Attribute layer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ozone = Ozone.new(ozone_params)\n\n if @ozone.save\n render json: @ozone, status: :created, location: @ozone \n else\n render json: @ozone.errors, status: :unprocessable_entity \n end\n end",
"def ocean_params\n params.require(:ocean).permit(:name, :image, :place, :area, :volume)\n end",
"def create\n @location = Geolocation.new(params[:geolocation])\n @scene = Scene.new(:title => params[:title])\n @location.scenes << @scene\n @location.save\n @scene.save\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @location, notice: 'Location was successfully create.'}\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\"}\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def zonal_params\n params.require(:zonal).permit(:nombre_zona, :descripcion)\n end",
"def create\n @flat_stage = Flat::Stage.new(flat_stage_params)\n\n respond_to do |format|\n if @flat_stage.save\n format.html { redirect_to @flat_stage, notice: 'Stage was successfully created.' }\n format.json { render :show, status: :created, location: @flat_stage }\n else\n format.html { render :new }\n format.json { render json: @flat_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def hull_params\n params.require(:hull).permit(:hull)\n end",
"def asigna_geoserver_info(v, geoserver_info=nil)\n geo = {}\n\n if geoserver_info.present?\n begin\n geo = JSON.parse(geoserver_info)\n geo[\"Mapa #{geo.count + 1}\"] = { layers: v[:layers], styles: v[:styles], bbox: v[:bbox], anio: v[:anio], autor: v[:autor], geoportal_url: v[:geoportal_url] }\n rescue\n nil\n end\n else\n geo['Mapa 1'] = { layers: v[:layers], styles: v[:styles], bbox: v[:bbox], anio: v[:anio], autor: v[:autor], geoportal_url: v[:geoportal_url] }\n end\n\n geo.to_json\nend",
"def create\n @root_collection = RootCollection.new(root_collection_params)\n\n respond_to do |format|\n if @root_collection.save\n format.html { redirect_to @root_collection, notice: 'Root collection was successfully created.' }\n format.json { render :show, status: :created, location: @root_collection }\n else\n format.html { render :new }\n format.json { render json: @root_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end",
"def create\n @light = Light.new(light_params)\n\n if @light.save\n render json: @light, status: :created, location: @light\n else\n render json: @light.errors, status: :unprocessable_entity\n end\n end",
"def new\n @layer_filter = LayerFilter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @layer_filter }\n format.json { render :json => @layer_filter }\n end\n end",
"def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts JSON.pretty_generate(result)\n result\nend",
"def create\n @geo_datum = GeoDatum.new(geo_datum_params)\n\n respond_to do |format|\n if @geo_datum.save\n format.html { redirect_to @geo_datum, notice: 'Geo datum was successfully created.' }\n format.json { render :show, status: :created, location: @geo_datum }\n else\n format.html { render :new }\n format.json { render json: @geo_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def repairing_layer_params\n params.require(:repairing_layer).permit(:title, :description, :town, :owner, :repairs_file, :repairing_category)\n end",
"def snowflake_params\n params.require(:snowflake).permit(:shape)\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end"
] |
[
"0.72677904",
"0.6310305",
"0.62798345",
"0.614472",
"0.61137336",
"0.6094828",
"0.59819156",
"0.5915292",
"0.58255464",
"0.573704",
"0.5651584",
"0.5592616",
"0.558824",
"0.55731547",
"0.5570241",
"0.55668676",
"0.55303186",
"0.5524599",
"0.5389199",
"0.5388985",
"0.5377295",
"0.5358504",
"0.5358181",
"0.53545034",
"0.52901775",
"0.52504945",
"0.52405775",
"0.52289075",
"0.5215315",
"0.5203593",
"0.5200701",
"0.5179819",
"0.5171062",
"0.51570946",
"0.514923",
"0.5134257",
"0.51216143",
"0.5104349",
"0.50960714",
"0.50953025",
"0.5065954",
"0.50538605",
"0.50491095",
"0.5036048",
"0.5011669",
"0.500222",
"0.500041",
"0.5000141",
"0.499391",
"0.4991261",
"0.498378",
"0.49706182",
"0.49626878",
"0.49531877",
"0.49512246",
"0.4944896",
"0.4933809",
"0.49283773",
"0.4926036",
"0.49252504",
"0.49185762",
"0.49139416",
"0.49080342",
"0.49030522",
"0.49001077",
"0.4897511",
"0.48918322",
"0.48841262",
"0.4879124",
"0.48732457",
"0.48710096",
"0.485711",
"0.48543108",
"0.48491588",
"0.48395854",
"0.4839404",
"0.4812793",
"0.48060706",
"0.47997904",
"0.47909003",
"0.47899854",
"0.47844085",
"0.47674286",
"0.4765671",
"0.47600603",
"0.47561",
"0.4753396",
"0.4749994",
"0.47401652",
"0.47309187",
"0.47279477",
"0.47173673",
"0.47123703",
"0.4709599",
"0.47075194",
"0.4706912",
"0.46995002",
"0.46963462",
"0.4695442",
"0.46952024"
] |
0.6837488
|
1
|
PATCH/PUT /layers/1 PATCH/PUT /layers/1.json
|
def update
respond_to do |format|
if @layer.update(layer_params)
format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }
format.json { render :show, status: :ok, location: @layer }
else
format.html { render :edit }
format.json { render json: @layer.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @layer = Layer.find(params[:id])\n\n respond_to do |format|\n if @layer.update_attributes(params[:layer])\n @layers = Layer.all\n format.html { redirect_to @layer, notice: 'Layer was successfully updated.' }\n format.json { render json: {layers: @layers.map {|layer| {id: layer.id, name:layer.name, number_of_polygons: layer.areas.count}}} }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @attribute_layer = AttributeLayer.find(params[:id])\n\n respond_to do |format|\n if @attribute_layer.update_attributes(params[:attribute_layer])\n format.html { redirect_to @attribute_layer, notice: 'Attribute layer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n respond_to do |format|\n if @attribute_layer.update(attribute_layer_params)\n format.html { redirect_to [@palette, @attribute_layer], notice: 'Attribute layer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attribute_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @annotationLayerIn = params['annotationLayer']\n\n @problem = ''\n if !validate_annotationLayer(@annotationLayerIn)\n errMsg = \"Annotation Layer not valid and could not be updated: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n else\n @annotationLayer = AnnotationLayer.where(layer_id: @annotationLayerIn['@id']).first\n #authorize! :update, @annotationLayer\n\n if @annotationLayer.version.nil? || @annotationLayer.version < 1\n @annotationLayer.version = 1\n end\n\n if !version_layer @annotationLayer\n errMsg = \"Annotation Layer could not be updated: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n end\n\n newVersion = @annotationLayer.version + 1\n request.format = \"json\"\n respond_to do |format|\n if @annotationLayer.update_attributes(\n :layer_id => @annotationLayerIn['@id'],\n :layer_type => @annotationLayerIn['@type'],\n :label => @annotationLayerIn['label'],\n :motivation => @annotationLayerIn['motivation'],\n :license => @annotationLayerIn['license'],\n :description => @annotationLayerIn['description'],\n :version => newVersion\n )\n format.html { redirect_to @annotationLayer, notice: 'AnnotationLayer was successfully updated.' }\n format.json { render json: @annotationLayer.to_iiif, status: 200, content_type: \"application/json\" }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annotationLayer.errors, status: :unprocessable_entity, content_type: \"application/json\" }\n end\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 api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @tbl_layer.update(tbl_layer_params)\n format.html { redirect_to @tbl_layer, notice: 'Tbl layer was successfully updated.' }\n format.json { render :show, status: :ok, location: @tbl_layer }\n else\n format.html { render :edit }\n format.json { render json: @tbl_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @overlay = Overlay.find(params[:id])\n\n respond_to do |format|\n if @overlay.update_attributes(params[:overlay])\n format.html { redirect_to @overlay, notice: 'Overlay was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @overlay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update!(**args)\n @description = args[:description] if args.key?(:description)\n @id = args[:id] if args.key?(:id)\n @layer_type = args[:layer_type] if args.key?(:layer_type)\n @name = args[:name] if args.key?(:name)\n @project_id = args[:project_id] if args.key?(:project_id)\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n @map_layer = MapLayer.find(params[:id])\n\n respond_to do |format|\n if @map_layer.update_attributes(params[:map_layer])\n flash[:notice] = 'MapLayer was successfully updated.'\n format.html { redirect_to(@map_layer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @map_layer.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!(**args)\n @geometries = args[:geometries] if args.key?(:geometries)\n @id = args[:id] if args.key?(:id)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n @patch = Patch.find(params[:id])\n\n respond_to do |format|\n if @patch.update_attributes(params[:patch])\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @ru = Rails.application.config.hostUrl\n\n # Determine from the passed-in layer_id if the layer was changed\n editObject = params\n @layerIdIn = editObject['layer_id'][0]\n @annotationIn = editObject['annotation']\n #use @annotationIn['within'] to determine if the anno already belongs to this layer, if so set updateLists = false\n updateLists = true\n @annotationIn['within'].each do |list_id|\n layers_for_list = Annotation.where(\"annotation_id\": @annotationIn[\"@id\"]).first.annotation_layers \n layers_for_list.each do |layer_for_list|\n if layer_for_list[\"layer_id\"] == @layerIdIn\n updateLists = false\n break\n end\n end\n end\n\n @problem = ''\n @annotation = Annotation.where(annotation_id: @annotationIn['@id']).first\n\n unless check_anno_auth(request, @annotation)\n return render_forbidden(\"There was an error updating the annotation\")\n end\n\n #-------\n if @annotation.nil?\n # No annotation found\n format.json { render json: nil, status: :ok }\n else\n if @annotation.version.nil? || @annotation.version < 1\n # Correctly assign a version number\n @annotation.version = 1\n end\n if !version_annotation @annotation\n errMsg = \"Annotation could not be updated: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n end\n\n if updateLists \n list_id = constructRequiredListId @layerIdIn, @annotation.canvas\n canvas_id = getTargetingAnnosCanvas(@annotation)\n checkListExists(list_id, @layerIdIn, canvas_id)\n\n @annotationIn['within'] = Array.new\n @annotationIn['within'].push(list_id)\n\n @annotation.annotation_lists.each do |list|\n delete_annotation_list_association(@annotation.annotation_id, list.list_id)\n end\n\n # Then reassociate lists and the annotation\n associate_lists(@annotationIn)\n end\n\n newVersion = @annotation.version + 1\n request.format = \"json\"\n respond_to do |format|\n\n if @annotation.update_attributes(\n :annotation_type => @annotationIn['@type'],\n :motivation => @annotationIn['motivation'].to_json,\n :on => @annotationIn['on'].to_json,\n :resource => @annotationIn['resource'].to_json,\n :annotated_by => @annotationIn['annotatedBy'].to_json,\n :version => newVersion,\n :order_weight => @annotationIn['orderWeight']\n )\n\n # Update tags associated with the annotation\n tags = parse_tags(@annotationIn['resource'])\n @annotation.annotation_tags = tags\n\n format.html { redirect_to @annotation, notice: 'Annotation was successfully updated.' }\n format.json { render json: @annotation.to_iiif, status: 200, content_type: \"application/json\"}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @annotation.errors, status: :unprocessable_entity, content_type: \"application/json\" }\n end\n end\n end\nend",
"def update\n @lens = Lens.find(params[:id])\n attrb = select_params(lens_params)\n # linear_data is an array of Objects of Components Properties\n # that needs to be deserialized correctly\n attrb[\"linear_data\"] = JSON.parse(attrb[\"linear_data\"])\n lens = Lens.update(attrb)\n \n # @lens.update(lens_params)\n # render inline: \"<%= @lens.id %>\"\n end",
"def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cat_poly.update(cat_poly_params)\n format.html { redirect_to @cat_poly, notice: 'Cat poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat_poly }\n else\n format.html { render :edit }\n format.json { render json: @cat_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @bbox = args[:bbox] if args.key?(:bbox)\n @creation_time = args[:creation_time] if args.key?(:creation_time)\n @creator_email = args[:creator_email] if args.key?(:creator_email)\n @datasource_type = args[:datasource_type] if args.key?(:datasource_type)\n @datasources = args[:datasources] if args.key?(:datasources)\n @description = args[:description] if args.key?(:description)\n @draft_access_list = args[:draft_access_list] if args.key?(:draft_access_list)\n @etag = args[:etag] if args.key?(:etag)\n @id = args[:id] if args.key?(:id)\n @last_modified_time = args[:last_modified_time] if args.key?(:last_modified_time)\n @last_modifier_email = args[:last_modifier_email] if args.key?(:last_modifier_email)\n @layer_type = args[:layer_type] if args.key?(:layer_type)\n @name = args[:name] if args.key?(:name)\n @processing_status = args[:processing_status] if args.key?(:processing_status)\n @project_id = args[:project_id] if args.key?(:project_id)\n @published_access_list = args[:published_access_list] if args.key?(:published_access_list)\n @publishing_status = args[:publishing_status] if args.key?(:publishing_status)\n @style = args[:style] if args.key?(:style)\n @tags = args[:tags] if args.key?(:tags)\n @writers_can_edit_permissions = args[:writers_can_edit_permissions] if args.key?(:writers_can_edit_permissions)\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 if :opr == 'edit'\n update\n else\n @team = Team.find_by_id(params[:id])\n @team.update_attributes({:id => params[:id], :name => params[:name], :status => params[:status]})\n\n if request.xhr?\n render :json => @team\n end\n end\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, params = {})\n request(:patch, path, params)\n end",
"def patch(path, data, params = {}, request_options = {})\n request(:patch, path, data, params)\n end",
"def update\n team_name = params[:name]\n team_description = params[:description]\n team_id = params[:id]\n\n respond_to do |format|\n if OkrTeam.where(id: team_id).update_all(name: team_name, description: team_description)\n format.json { render json: 'Team is updated successfully!', status: :ok }\n else\n format.json { render json: 'Error!', status: :unprocessable_entity }\n end\n end\n end",
"def update\n @level_container = LevelContainer.find(params[:id])\n\n respond_to do |format|\n if @level_container.update_attributes(params[:level_container])\n format.html { redirect_to @level_container, notice: 'Level container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @level_container.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @json.update(json_params)\n format.html { redirect_to @json, notice: 'Json was successfully updated.' }\n format.json { render :show, status: :ok, location: @json }\n else\n format.html { render :edit }\n format.json { render json: @json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @leaf.update(leaf_params)\n format.html { redirect_to @leaf, notice: 'Leaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end",
"def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end",
"def patch(path, opts = {})\n request(:patch, path, opts).body\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update!(**args)\n @geometries = args[:geometries] if args.key?(:geometries)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n respond_to do |format|\n if @leaf.update(leaf_params)\n format.html { redirect_to leaf_path(@leaf), notice: EDIT_SUCCESS }\n format.json { render :show, status: :ok, location: @leaf }\n else\n format.html { render :edit }\n format.json { render json: @leaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @polygon_mark = PolygonMark.find(params[:id])\n \n respond_to do |format|\n if @polygon_mark.update_attributes(:name => params[:name], :layer_id => params[:layer_id])\n @polygon_mark.the_geom = Polygon.from_coordinates(params[:coordinates], 4269)\n @polygon_mark.save!\n format.html { redirect_to @polygon_mark, :notice => 'polygon mark was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @polygon_mark.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @liftset.update(liftset_params)\n format.html { redirect_to @liftset, notice: 'Liftset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @liftset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(operation, path, value = nil)\n ensure_client && ensure_uri\n body = {\n 'op' => operation,\n 'path' => path,\n 'value' => value\n }\n response = @client.rest_patch(@data['uri'], { 'Content-Type' => 'application/json-patch+json', 'body' => [body] }, @api_version)\n @client.response_handler(response)\n end",
"def update\n @jetty = Jetty.find(params[:id])\n\n respond_to do |format|\n if @jetty.update_attributes(params[:jetty])\n format.html { redirect_to @jetty, notice: 'Jetty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jetty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(body = nil)\n self.service.edit(self.softlayer_hash, body)\n end",
"def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { render :show, status: :ok, location: @patch }\n else\n format.html { render :edit }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(path, **args); 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(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end",
"def update\n respond_to do |format|\n if @dog_poly.update(dog_poly_params)\n format.html { redirect_to @dog_poly, notice: 'Dog poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @dog_poly }\n else\n format.html { render :edit }\n format.json { render json: @dog_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n if @operation.update_attributes(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n if @playground.update_attributes(params[:playground])\n format.html { redirect_to @playground, notice: 'Playground was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @playground.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n end",
"def update\n @surface = Surface.find(params[:id])\n\n respond_to do |format|\n if @surface.update_attributes(params[:surface])\n format.html { redirect_to @surface, notice: 'Surface was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @surface.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n if @playground.update_attributes(params[:playground])\n format.html { redirect_to @playground, :notice => 'Playground was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @playground.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @polygon = Polygon.find(params[:id])\n\n respond_to do |format|\n if @polygon.update_attributes(params[:polygon])\n format.html { redirect_to @polygon, notice: 'Polygon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @polygon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @geometry.update(geometry_params)\n format.html { redirect_to @geometry, notice: 'Geometry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @geometry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fish_poly.update(fish_poly_params)\n format.html { redirect_to @fish_poly, notice: 'Fish poly was successfully updated.' }\n format.json { render :show, status: :ok, location: @fish_poly }\n else\n format.html { render :edit }\n format.json { render json: @fish_poly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kitty = Kitty.find(params[:id])\n\n respond_to do |format|\n if @kitty.update_attributes(params[:kitty])\n format.html { redirect_to @kitty, notice: 'Kitty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to @operation, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @feature_request.update(feature_request_params)\n format.html { redirect_to @feature_request, notice: 'Feature request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @feature_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @group_kinds = args[:group_kinds] if args.key?(:group_kinds)\n @json_path = args[:json_path] if args.key?(:json_path)\n @namespaces = args[:namespaces] if args.key?(:namespaces)\n end",
"def destroy\n #@ru = request.original_url\n @ru = request.protocol + request.host_with_port + \"/layers/#{params['id']}\"\n @annotationLayer = AnnotationLayer.where(layer_id: @ru).first\n #authorize! :delete, @annotation_layer\n if @annotationLayer.version.nil? || @annotationLayer.version < 1\n @annotationLayer.version = 1\n end\n if !version_layer @annotationLayer\n errMsg = \"Annotation Layer could not be updated: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n end\n @annotationLayer.destroy\n request.format = \"json\"\n respond_to do |format|\n format.html { redirect_to annotation_layers_url }\n format.json { head :no_content }\n end\n end",
"def update\n # checks if user is authorized\n if authorise(request)\n # operation parameter tells what put operation should be done on vertex\n operation = params[:operation]\n case operation\n when 'connection'\n update_connection(params[:from_vertex_id], params[:to_vertex_id])\n when 'transformation'\n update_transformation(params[:id], params[:pos_x], params[:pos_y], params[:width],\n params[:height], params[:z_index])\n when 'attribute'\n update_attribute(params[:id], params[:name], params[:estimated_time], params[:clue],\n params[:description])\n else\n render json: { success: false, message: 'Operation does not exist' }, status: :bad_request\n end\n else\n render json: { success: false, message: 'Unauthorized' }, status: 401\n end\n end",
"def update\n respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to admin_operations_path, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kit = Kit.find(params[:id])\n\n respond_to do |format|\n if @kit.update_attributes(params[:kit])\n format.html { redirect_to @kit, notice: 'Kit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @hidden_neuron_layer = HiddenNeuronLayer.find(params[:id])\n\n respond_to do |format|\n if @hidden_neuron_layer.update_attributes(params[:hidden_neuron_layer])\n format.html { redirect_to @hidden_neuron_layer, notice: 'Hidden neuron layer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hidden_neuron_layer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @filters = args[:filters] if args.key?(:filters)\n @line_options = args[:line_options] if args.key?(:line_options)\n @name = args[:name] if args.key?(:name)\n @point_options = args[:point_options] if args.key?(:point_options)\n @polygon_options = args[:polygon_options] if args.key?(:polygon_options)\n @zoom_levels = args[:zoom_levels] if args.key?(:zoom_levels)\n end",
"def update\n respond_to do |format|\n if @glo_collection.update(glo_collection_params)\n format.html { redirect_to @glo_collection, notice: 'Glo collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @glo_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(data = :object || :json)\n end",
"def update\n @path = Path.find(params[:id])\n\n respond_to do |format|\n if @path.update_attributes(params[:path])\n format.html { redirect_to([@layer, @path], :notice => 'Path was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @path.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @extent.update(extent_params)\n format.html { redirect_to @extent, notice: 'Extent was successfully updated.' }\n format.json { render :show, status: :ok, location: @extent }\n else\n format.html { render :edit }\n format.json { render json: @extent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @voxel.update(voxel_params)\n format.html { redirect_to @voxel, notice: '更新されました!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @voxel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @layer_filter = LayerFilter.find(params[:id])\n\n respond_to do |format|\n if @layer_filter.update_attributes(params[:layer_filter])\n flash[:notice] = 'LayerFilter was successfully updated.'\n format.html { redirect_to(@layer_filter) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @layer_filter.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @outlay = Outlay.find(params[:id])\n\n respond_to do |format|\n if @outlay.update_attributes(params[:outlay])\n format.html { redirect_to @outlay, notice: 'Outlay was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @outlay.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fabric = Fabric.find(params[:id])\n\n respond_to do |format|\n if @fabric.update_attributes(params[:fabric])\n format.html { redirect_to @fabric, notice: 'Fabric was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fabric.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(uri, options = T.unsafe(nil)); end",
"def update\n respond_to do |format|\n if @subset.update(subset_params)\n format.html { redirect_to @subset, notice: 'Subset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @light.update(light_params)\n head :no_content\n else\n render json: @light.errors, status: :unprocessable_entity\n end\n end",
"def update!(**args)\n @operations = args[:operations] unless args[:operations].nil?\n end",
"def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end",
"def update\n respond_to do |format|\n if @flat_stage.update(flat_stage_params)\n format.html { redirect_to @flat_stage, notice: 'Stage was successfully updated.' }\n format.json { render :show, status: :ok, location: @flat_stage }\n else\n format.html { render :edit }\n format.json { render json: @flat_stage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @stage = Stage.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @stage.update_attributes(params.required(:stage).permit!)\r\n format.html {redirect_to @stage, :notice => 'Stage was successfully updated.'}\r\n format.json {head :no_content}\r\n else\r\n format.html {render :action => \"edit\"}\r\n format.json {render :json => @stage.errors, :status => :unprocessable_entity}\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @kit.update(kit_params)\n format.html { redirect_to @kit, notice: 'Kit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @three.update(three_params)\n format.html { redirect_to @three, notice: 'Three was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @three.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @container = Container.find(params[:id])\n\n respond_to do |format|\n if @container.update_attributes(params[:container])\n format.html { redirect_to @container, notice: 'Container was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @container.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @kela.update(kela_params)\n format.html { redirect_to @kela, notice: 'Kela was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kela.errors, status: :unprocessable_entity }\n end\n end\n end",
"def updateLayers()\n layers.each do |layer|\n layer.destroy\n end\n #tilesets.each do |tileset|\n # tilesets.delete(tileset)\n #end\n createLayers()\n end",
"def update\n @flag = Flag.find(params[:id])\n\n respond_to do |format|\n if @flag.update_attributes(params[:flag])\n format.html { redirect_to @flag, notice: 'Flag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flag.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @knol.update(knol_params)\n format.html { redirect_to @knol, notice: 'Knol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @knol.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @bare_metal_version = args[:bare_metal_version] if args.key?(:bare_metal_version)\n @binary_authorization = args[:binary_authorization] if args.key?(:binary_authorization)\n @cluster_operations = args[:cluster_operations] if args.key?(:cluster_operations)\n @control_plane = args[:control_plane] if args.key?(:control_plane)\n @create_time = args[:create_time] if args.key?(:create_time)\n @delete_time = args[:delete_time] if args.key?(:delete_time)\n @description = args[:description] if args.key?(:description)\n @endpoint = args[:endpoint] if args.key?(:endpoint)\n @etag = args[:etag] if args.key?(:etag)\n @fleet = args[:fleet] if args.key?(:fleet)\n @load_balancer = args[:load_balancer] if args.key?(:load_balancer)\n @local_name = args[:local_name] if args.key?(:local_name)\n @maintenance_config = args[:maintenance_config] if args.key?(:maintenance_config)\n @maintenance_status = args[:maintenance_status] if args.key?(:maintenance_status)\n @name = args[:name] if args.key?(:name)\n @network_config = args[:network_config] if args.key?(:network_config)\n @node_access_config = args[:node_access_config] if args.key?(:node_access_config)\n @node_config = args[:node_config] if args.key?(:node_config)\n @os_environment_config = args[:os_environment_config] if args.key?(:os_environment_config)\n @proxy = args[:proxy] if args.key?(:proxy)\n @reconciling = args[:reconciling] if args.key?(:reconciling)\n @security_config = args[:security_config] if args.key?(:security_config)\n @state = args[:state] if args.key?(:state)\n @status = args[:status] if args.key?(:status)\n @storage = args[:storage] if args.key?(:storage)\n @uid = args[:uid] if args.key?(:uid)\n @update_time = args[:update_time] if args.key?(:update_time)\n @validation_check = args[:validation_check] if args.key?(:validation_check)\n end",
"def patch(payload)\n post_like payload, Net::HTTP::Patch.new(@uri.path)\n end",
"def update!(**args)\n @bbox = args[:bbox] if args.key?(:bbox)\n @creation_time = args[:creation_time] if args.key?(:creation_time)\n @description = args[:description] if args.key?(:description)\n @id = args[:id] if args.key?(:id)\n @last_modified_time = args[:last_modified_time] if args.key?(:last_modified_time)\n @name = args[:name] if args.key?(:name)\n @project_id = args[:project_id] if args.key?(:project_id)\n @raster_type = args[:raster_type] if args.key?(:raster_type)\n @tags = args[:tags] if args.key?(:tags)\n end",
"def update\n respond_to do |format|\n if @tile.update(tile_params)\n format.html { redirect_to @tile, notice: 'Tile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n feature.update_attributes(feature_params)\n\n respond_with(feature)\n end"
] |
[
"0.68992466",
"0.6510969",
"0.62880987",
"0.6225763",
"0.6203721",
"0.6189952",
"0.6153676",
"0.6041475",
"0.6029222",
"0.5970276",
"0.5939183",
"0.592965",
"0.5904634",
"0.58304435",
"0.58304435",
"0.5784704",
"0.57788324",
"0.57726455",
"0.575167",
"0.5747367",
"0.5741912",
"0.57384676",
"0.56977606",
"0.5695139",
"0.5686103",
"0.5682856",
"0.5638131",
"0.5638131",
"0.5621273",
"0.56145084",
"0.5607809",
"0.56031626",
"0.55812585",
"0.55812585",
"0.55709314",
"0.5567878",
"0.5567666",
"0.5562757",
"0.55567056",
"0.5554438",
"0.5552647",
"0.5533595",
"0.5527079",
"0.5507077",
"0.5506262",
"0.55056417",
"0.54976755",
"0.5493134",
"0.5491168",
"0.5482945",
"0.54769975",
"0.54755706",
"0.54737234",
"0.5468587",
"0.5464044",
"0.5463838",
"0.54632527",
"0.54612005",
"0.5460215",
"0.54591614",
"0.54531527",
"0.54512763",
"0.54371834",
"0.54361385",
"0.5430965",
"0.5422103",
"0.5421261",
"0.54178834",
"0.5414718",
"0.5403148",
"0.54004264",
"0.53971",
"0.5393896",
"0.53925383",
"0.5382158",
"0.5377517",
"0.5376941",
"0.5376268",
"0.53748065",
"0.5374422",
"0.5373513",
"0.53714544",
"0.5370218",
"0.5368601",
"0.5368143",
"0.53679585",
"0.5364258",
"0.53640723",
"0.53622234",
"0.53562504",
"0.53519726",
"0.5344778",
"0.53435224",
"0.5343455",
"0.5343106",
"0.53401816",
"0.53377825",
"0.5335459",
"0.5333397",
"0.53330225"
] |
0.67589664
|
1
|
DELETE /layers/1 DELETE /layers/1.json
|
def destroy
@layer.destroy
respond_to do |format|
format.html { redirect_to layers_url, notice: 'Layer was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @layer = Layer.find(params[:id])\n @layer.destroy\n\n respond_to do |format|\n format.html { redirect_to layers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@ru = request.original_url\n @ru = request.protocol + request.host_with_port + \"/layers/#{params['id']}\"\n @annotationLayer = AnnotationLayer.where(layer_id: @ru).first\n #authorize! :delete, @annotation_layer\n if @annotationLayer.version.nil? || @annotationLayer.version < 1\n @annotationLayer.version = 1\n end\n if !version_layer @annotationLayer\n errMsg = \"Annotation Layer could not be updated: \" + @problem\n render :json => { :error => errMsg },\n :status => :unprocessable_entity\n end\n @annotationLayer.destroy\n request.format = \"json\"\n respond_to do |format|\n format.html { redirect_to annotation_layers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attribute_layer = AttributeLayer.find(params[:id])\n @attribute_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to attribute_layers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map_layer = MapLayer.find(params[:id])\n @map_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_layers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @path = Path.find(params[:id])\n @path.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @hidden_neuron_layer = HiddenNeuronLayer.find(params[:id])\n @hidden_neuron_layer.destroy\n\n respond_to do |format|\n format.html { redirect_to hidden_neuron_layers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @attribute_layer = @palette.attribute_layers.find(attribute_layer_params[:id])\n @attribute_layer.destroy\n respond_to do |format|\n format.html { redirect_to palette_attribute_layers_url(@palette) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @overlay = Overlay.find(params[:id])\n @overlay.destroy\n\n respond_to do |format|\n format.html { redirect_to overlays_url }\n format.json { head :ok }\n end\n end",
"def delete_layer(id)\n if layer = layers.find {|layer| layer.id == id}\n layer.destroy\n end\n end",
"def destroy\n @tbl_layer.destroy\n if session[:oneditslide] == 1\n quer='DELETE FROM tbl_slide_layers Where \"LayerID\"='+params[:id]+\";\"\n ActiveRecord::Base.connection.execute(quer);\n end\n respond_to do |format|\n format.html { redirect_to tbl_layers_url, notice: 'Tbl layer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @layer_filter = LayerFilter.find(params[:id])\n @layer_filter.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_filters_url) }\n format.xml { head :ok }\n format.json { render :json => @layer_filter.attributes }\n end\n end",
"def destroy\n @geometry.destroy\n respond_to do |format|\n format.html { redirect_to geometries_url }\n format.json { head :no_content }\n end\n end",
"def delete_layer(layer_name)\n @cascade.delete(layer_name)\n end",
"def destroy\n @polygon = Polygon.find(params[:id])\n @polygon.destroy\n\n respond_to do |format|\n format.html { redirect_to polygons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @level_container = LevelContainer.find(params[:id])\n @level_container.destroy\n\n respond_to do |format|\n format.html { redirect_to level_containers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dimgeom = Dimgeom.find(params[:id])\n @dimgeom.destroy\n\n respond_to do |format|\n format.html { redirect_to dimgeoms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repairing_layer.destroy\n respond_to do |format|\n format.html { redirect_to repairing_layers_url, notice: 'Layer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @laynet_ele = LaynetEle.find(params[:id])\n @laynet_ele.destroy\n\n respond_to do |format|\n format.html { redirect_to laynet_eles_url, notice: t('laynet_eles.delete.notice') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(layer_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @leaf.destroy\n respond_to do |format|\n format.html { redirect_to leafs_url, notice: DELETE_SUCCESS }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vertices_scene1.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene1s_url, notice: 'Vertices scene1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @three.destroy\n respond_to do |format|\n format.html { redirect_to threes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tile.destroy\n respond_to do |format|\n format.html { redirect_to tiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tile.destroy\n respond_to do |format|\n format.html { redirect_to tiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @straddle = Straddle.find(params[:id])\n @straddle.destroy\n\n respond_to do |format|\n format.html { redirect_to straddles_url }\n format.json { head :no_content }\n end\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @operation = Operation.find(params[:id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geo.destroy\n respond_to do |format|\n format.html { redirect_to geos_url, notice: 'Geo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plane = Plane.find(params[:id])\n @plane.destroy\n\n respond_to do |format|\n format.html { redirect_to planes_url }\n format.json { head :no_content }\n end\n end",
"def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @drawable = Drawable.find(params[:id])\n @drawable.destroy\n\n respond_to do |format|\n format.html { redirect_to drawables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tile = Tile.find(params[:id])\n @tile.destroy\n\n respond_to do |format|\n format.html { redirect_to tiles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @glo_collection.destroy\n respond_to do |format|\n format.html { redirect_to glo_collections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unity3d.destroy\n respond_to do |format|\n format.html { redirect_to unity3ds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @extent.destroy\n respond_to do |format|\n format.html { redirect_to extents_url, notice: 'Extent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shape_type = ShapeType.find(params[:id])\n @shape_type.destroy\n\n\t\tmsg = I18n.t('app.msgs.success_deleted', :obj => I18n.t('app.common.shape_type'))\n\t\tsend_status_update(I18n.t('app.msgs.cache_cleared', :action => msg))\n respond_to do |format|\n format.html { redirect_to admin_shape_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @liftset.destroy\n respond_to do |format|\n format.html { redirect_to liftsets_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @admin_geonode = Admin::Geonode.find(params[:id])\n @admin_geonode.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_geonodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @outlay = Outlay.find(params[:id])\n @outlay.destroy\n\n respond_to do |format|\n format.html { redirect_to outlays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @scene.destroy\n\n respond_to do |format|\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @zona = Zona.find(params[:id])\n @zona.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @floor = Floor.find(params[:id])\n @floor.destroy\n\n respond_to do |format|\n format.html { redirect_to floors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collection.destroy\n\n render json: @collection, status: :ok#, location: @collection\n end",
"def destroy\n id = @api_v1_canvas.id\n @api_v1_canvas.destroy\n respond_to do |format|\n format.html do\n redirect_to api_v1_canvases_url, notice: 'Canvas was successfully destroyed.'\n end\n\n format.json do\n msg = { id: id }\n broadcast(\"deleted\", msg)\n head :no_content\n end\n end\n end",
"def destroy\n @bits_1.destroy\n respond_to do |format|\n format.html { redirect_to bits_1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stroke.destroy\n respond_to do |format|\n format.html { redirect_to strokes_url, notice: 'Stroke was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete!( opts = {} )\n http_action :delete, nil, opts\n end",
"def destroy\n @geo_datum.destroy\n respond_to do |format|\n format.html { redirect_to geo_data_url, notice: 'Geo datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rayon = Rayon.find(params[:id])\n @rayon.destroy\n\n respond_to do |format|\n format.html { redirect_to rayons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @scene.destroy\n respond_to do |format|\n format.html { redirect_to scenes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @skydatum = Skydatum.find(params[:id])\n @skydatum.destroy\n\n respond_to do |format|\n format.html { redirect_to skydata_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visual.destroy\n respond_to do |format|\n format.html { redirect_to visuals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @orbit.destroy\n respond_to do |format|\n format.html { redirect_to orbits_url, notice: 'Orbit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @kit = Kit.find(params[:id])\n @kit.destroy\n\n respond_to do |format|\n format.html { redirect_to kits_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @voxel.destroy\n respond_to do |format|\n format.html { redirect_to voxels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leaf.destroy\n respond_to do |format|\n format.html { redirect_to leafs_url, notice: t('common.message.destroyed_success')}\n format.json { head :no_content }\n end\n end",
"def destroy\n @mini_map_road = MiniMapRoad.find(params[:id])\n @mini_map_road.destroy\n\n respond_to do |format|\n format.html { redirect_to mini_map_roads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @smallmap = Smallmap.find(params[:id])\n @smallmap.destroy\n\n respond_to do |format|\n format.html { redirect_to smallmaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_geo = current_user.post_geos.find(params[:id])\n @post_geo.destroy\n\n respond_to do |format|\n format.html { redirect_to [:client, :post_geos] }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tinymap = Tinymap.find(params[:id])\n @tinymap.destroy\n\n respond_to do |format|\n format.html { redirect_to tinymaps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vertices_scene3.destroy\n respond_to do |format|\n format.html { redirect_to vertices_scene3s_url, notice: 'Vertices scene3 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @flag = Flag.find(params[:id])\n @flag.destroy\n\n respond_to do |format|\n format.html { redirect_to flags_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @leaf.destroy\n respond_to do |format|\n format.html { redirect_to leaves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @surface = Surface.find(params[:id])\n @surface.destroy\n\n respond_to do |format|\n format.html { redirect_to surfaces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @keystroke = Keystroke.find(params[:id])\n @keystroke.destroy\n\n respond_to do |format|\n format.html { redirect_to keystrokes_url }\n format.json { head :no_content }\n end\n end",
"def 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 @earth.destroy\n respond_to do |format|\n format.html { redirect_to earths_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @draw = Draw.find(params[:id])\n @draw.destroy\n\n respond_to do |format|\n format.html { redirect_to draws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cat_poly.destroy\n respond_to do |format|\n format.html { redirect_to cat_polies_url, notice: 'Cat poly was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @knol.destroy\n respond_to do |format|\n format.html { redirect_to knols_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end",
"def destroy\n @kolegij = Kolegij.find(params[:id])\n @kolegij.destroy\n\n respond_to do |format|\n format.html { redirect_to kolegijs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spatial_coverages = SpatialCoverages.find(params[:id])\n @spatial_coverages.destroy\n\n respond_to do |format|\n format.html { redirect_to spatial_coverage_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zonal.destroy\n respond_to do |format|\n format.html { redirect_to zonals_url, notice: 'Zonal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data_collection = DataCollection.find(params[:id])\n @data_collection.destroy\n\n respond_to do |format|\n format.html { redirect_to data_collections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @geopoint = Geopoint.find(params[:id])\n @geopoint.destroy\n\n respond_to do |format|\n format.html { redirect_to geopoints_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ontology.destroy\n respond_to do |format|\n format.html { redirect_to ontologies_url, notice: 'Ontology was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end",
"def destroy\n @jetty = Jetty.find(params[:id])\n @jetty.destroy\n\n respond_to do |format|\n format.html { redirect_to jetties_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.78472996",
"0.7678238",
"0.7382796",
"0.71779114",
"0.69176686",
"0.6854449",
"0.6821357",
"0.6779829",
"0.67483616",
"0.6718837",
"0.666472",
"0.6647262",
"0.66078705",
"0.65818965",
"0.64834356",
"0.6472717",
"0.6464855",
"0.6459053",
"0.64284456",
"0.6367784",
"0.636331",
"0.6359412",
"0.6352271",
"0.6336292",
"0.6336292",
"0.6333754",
"0.6318674",
"0.6310814",
"0.6308485",
"0.63021743",
"0.63004774",
"0.629748",
"0.629748",
"0.62897074",
"0.6285001",
"0.6284461",
"0.6273336",
"0.6254048",
"0.6251924",
"0.6250532",
"0.62497544",
"0.62497544",
"0.6244716",
"0.6235734",
"0.6232914",
"0.6225873",
"0.622032",
"0.6220239",
"0.6219678",
"0.6216616",
"0.62159127",
"0.6209408",
"0.620232",
"0.6187305",
"0.6185635",
"0.61825264",
"0.61788464",
"0.61767787",
"0.6174407",
"0.61717874",
"0.6171046",
"0.6169558",
"0.61690325",
"0.61671716",
"0.61645365",
"0.61644083",
"0.6160992",
"0.615649",
"0.61548364",
"0.6154236",
"0.6144638",
"0.6143902",
"0.6142579",
"0.61422354",
"0.6137584",
"0.6137584",
"0.6137584",
"0.6135966",
"0.6130874",
"0.6127153",
"0.61262846",
"0.6126243",
"0.6125936",
"0.6125936",
"0.6125936",
"0.6125936",
"0.61255634",
"0.6124317",
"0.61230356",
"0.6123013",
"0.6120957",
"0.6120021",
"0.61145157",
"0.61099845",
"0.61079115",
"0.61027634",
"0.60982096",
"0.6091477",
"0.60906684",
"0.6090463"
] |
0.74983555
|
2
|
Use callbacks to share common setup or constraints between actions.
|
def set_layer
@layer = Layer.find(params[:id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end",
"def add_actions; end",
"def callbacks; end",
"def callbacks; end",
"def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end",
"def define_action_helpers; end",
"def post_setup\n end",
"def action_methods; end",
"def action_methods; end",
"def action_methods; end",
"def before_setup; end",
"def action_run\n end",
"def execute(setup)\n @action.call(setup)\n end",
"def define_action_helpers?; end",
"def set_actions\n actions :all\n end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def setup_handler\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def workflow\n end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup\n # override and do something appropriate\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def action\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def config(action, *args); end",
"def setup\n @setup_proc.call(self) if @setup_proc\n end",
"def before_action \n end",
"def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end",
"def action\n end",
"def matt_custom_action_begin(label); end",
"def setup\n # override this if needed\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end",
"def after(action)\n invoke_callbacks *options_for(action).after\n end",
"def pre_task\n end",
"def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end",
"def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end",
"def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end",
"def setup_signals; end",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend",
"def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end",
"def initialize(*args)\n super\n @action = :set\nend",
"def after_set_callback; end",
"def setup\n #implement in subclass;\n end",
"def lookup_action; end",
"def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def around_hooks; end",
"def save_action; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def action_target()\n \n end",
"def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end",
"def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end",
"def before_setup\n # do nothing by default\n end",
"def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end",
"def default_action; end",
"def setup(&blk)\n @setup_block = blk\n end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def duas1(action)\n action.call\n action.call\nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend"
] |
[
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576",
"0.53124547",
"0.529654",
"0.5296262",
"0.52952296",
"0.52600986",
"0.52442724",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.52385926",
"0.5232394",
"0.523231",
"0.5227454",
"0.52226824",
"0.52201617",
"0.5212327",
"0.52079266",
"0.52050185",
"0.51754695",
"0.51726824",
"0.51710224",
"0.5166172",
"0.5159343",
"0.51578903",
"0.51522785",
"0.5152022",
"0.51518047",
"0.51456624",
"0.51398855",
"0.5133759",
"0.5112076",
"0.5111866",
"0.5111866",
"0.5110294",
"0.5106169",
"0.509231",
"0.50873137",
"0.5081088",
"0.508059",
"0.50677156",
"0.50562143",
"0.5050554",
"0.50474834",
"0.50474834",
"0.5036181",
"0.5026331",
"0.5022976",
"0.5015441",
"0.50121695",
"0.5000944",
"0.5000019",
"0.4996878",
"0.4989888",
"0.4989888",
"0.49864885",
"0.49797225",
"0.49785787",
"0.4976161",
"0.49683493",
"0.4965126",
"0.4958034",
"0.49559742",
"0.4954353",
"0.49535993",
"0.4952725",
"0.49467874",
"0.49423352",
"0.49325448",
"0.49282882",
"0.49269363",
"0.49269104",
"0.49252945",
"0.4923091",
"0.49194667",
"0.49174926",
"0.49173003",
"0.49171105",
"0.4915879",
"0.49155936"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def layer_params
params.require(:layer).permit(:name, :category_id, :url, :params, :ckan_id, style: [:color])
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
|
, :only=> [:index], :except=> [:index] GET /itineraries GET /itineraries.xml
|
def index
@travel = Travel.find(params[:travel_id])
@itineraries = Itinerary.order("updated_at DESC").page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @itineraries }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @itineraries = Itinerary.all\n end",
"def index\n @itineraries = Itinerary.all\n end",
"def index\n if current_user.admin?\n @itineraries = Itinerary.all\n else\n @itineraries = current_user.itineraries.where(user_id: current_user)\n end\n end",
"def index\n @trip_enrollments = TripEnrollment.find(:all)\n\n respond_to do |format|\n #format.html # index.html.erb\n format.html { render(:action => :index, :layout => false) && return } \n format.xml { render :xml => @trip_enrollments }\n end\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"def index\n @invitations = Invitation.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\n end",
"def index\n @admin_itineraries= City.find(session[:current_city_id]).discover.itineraries.page(params[:page]).per(10)\n end",
"def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end",
"def index\n @airlines = Airline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @airlines }\n end\n end",
"def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end",
"def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end",
"def index\n @leks = Lek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @leks }\n end\n end",
"def index\n @additions = Addition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @additions }\n end\n end",
"def index\n @borrower_residences = BorrowerResidence.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @borrower_residences.to_xml }\n end\n end",
"def index\n @realtors = Realtor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realtors }\n end\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 index\n @estimate_line_items = EstimateLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estimate_line_items }\n end\n end",
"def index\n @items = Item.accessible_by(current_ability)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n format.xml { render xml: @items }\n end\n end",
"def index\n @invite_requests = InviteRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invite_requests }\n end\n end",
"def index\n @title = 'Invitations'\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @invitations }\n end\n end",
"def show\n @itinerary = Itinerary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def index\n @enrollments ||= @committee.enrollments if @committee\n @enrollments ||= @user.enrollments if @user\n @enrollments = @enrollments.ordered\n\n respond_to do |format|\n format.html { render :action => 'index' } # index.html.erb\n format.xml { render :xml => @enrollments }\n end\n end",
"def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend",
"def retired_index\n @rigs = Rig.inactive\n @main_header = \"Retired Rigs\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rigs }\n end\n end",
"def index\n if current_user.has_role?('administrator')\n @invoices = Invoice.find(:all)\n else \n @invoices = current_user.invoices\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invoices }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @retain_nodes = RetainNode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @retain_nodes }\n format.json { render :json => @retain_nodes }\n end\n end",
"def index\n @amenities = Amenity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @amenities }\n end\n end",
"def index\n authenticate_admin!\n \n @candies = Candy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @candies }\n end\n end",
"def index\n get\n end",
"def index\n @outlines = Outline.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @outlines }\n end\n end",
"def index\n @independents = @member.independents\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @independents }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @instalers = Instaler.all\n end",
"def index\n @diaries = current_user.diaries.all\n respond_to do |format|\n format.html {render :index}\n format.json { render json: @diaries }\n end\n end",
"def index\n @invitations = @event.invitations.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end",
"def index\n redirect_to edit_itinerary_path(current_user.itineraries.last) #not after_sign_in_path since reviewers and admins might pay with paypal and they should be returned to the registration interface\n end",
"def index\n @liner_items = LinerItem.all\n end",
"def index\n @notifiers = Notifier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifiers }\n end\n end",
"def index\n\t\tindex_\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @roles }\n\t\tend\n\tend",
"def index\n @ignites = Ignite.all\n end",
"def index\n# @indices = Index.all\n#\n# respond_to do |format|\n# format.html # index.html.erb\n# format.xml { render :xml => @indices }\n# end\n end",
"def index\n\t\trelators\n\tend",
"def index\n #@applicants = Applicant.paginate(:per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @applicants }\n end\n end",
"def index\n # @invitations = Invitation.all\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @ingredients = Ingredient.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @ingredients.to_xml }\n end\n end",
"def index\n @involvements = Involvement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @involvements }\n end\n end",
"def index\n @roles = @client.roles\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end",
"def index\n @lieus = Lieu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lieus }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @trips = Trip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\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 @trips = Trip.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n @interfaces = Interface.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @interfaces }\n end\n end",
"def index\n @uitgelichts = Uitgelicht.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uitgelichts }\n end\n end",
"def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @partners.to_xml }\n end\n end",
"def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end",
"def index\n @trip = Trip.find_by_name(params[:trip_id])\n @folder = @trip.folders.find_by_name(params[:folder_id])\n @itenaries = @folder.itenaries\n if request.headers['X-PJAX']\n render :layout => false\n else\n render :layout => \"folder\"\n end\n end",
"def index\n @inventory_details = InventoryDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @inventory_details }\n end\n end",
"def index\n @portal_learners = Portal::Learner.search(params[:search], params[:page], nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_learners }\n end\n end",
"def index\n params[:recommended_only]? @recommended_only = true : @recommended_only = false\n respond_to do |format|\n format.html # index.html.erb\n format.xml {render :xml=>@my_archives, :xml=>@all_archives}\n format.json {render :json=>@all_archives}\n end\n end",
"def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invitations }\n end\n end",
"def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resources }\n end\n end",
"def index_portal\n index\n end",
"def index\n redirect_to :root\n return\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end",
"def index\n @universes = Universe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @universes }\n end\n end",
"def index\n\t@trips = Trip.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @trips }\n end\n end",
"def index\n get('')\n end",
"def index\n @aisles = Aisle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aisles }\n end\n end",
"def index\n @ingredients = Ingredient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ingredients }\n end\n end",
"def index\n @partyrelationships = Partyrelationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @partyrelationships }\n end\n end",
"def index\n @invitations = Invitation.all\n respond_with(@invitations)\n end",
"def index; end",
"def index\n @centricsteels = Centricsteel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @centricsteels }\n end\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end"
] |
[
"0.7479249",
"0.7479249",
"0.6942369",
"0.685942",
"0.677032",
"0.6704545",
"0.66994184",
"0.6650342",
"0.659711",
"0.65869355",
"0.6518687",
"0.65094143",
"0.6483438",
"0.64079654",
"0.64033204",
"0.63903254",
"0.6349762",
"0.63488084",
"0.6333364",
"0.6329936",
"0.6328428",
"0.6327981",
"0.6323862",
"0.63176185",
"0.63015944",
"0.62962586",
"0.6292137",
"0.62913424",
"0.6289358",
"0.6287046",
"0.6284672",
"0.62770855",
"0.6276782",
"0.62722915",
"0.62722915",
"0.6268939",
"0.6268645",
"0.62647074",
"0.6259635",
"0.6251693",
"0.62505513",
"0.62496877",
"0.62430114",
"0.62426704",
"0.62388676",
"0.6226237",
"0.62247586",
"0.62237567",
"0.6220793",
"0.6217354",
"0.62061316",
"0.6200727",
"0.620028",
"0.620028",
"0.6195965",
"0.6193208",
"0.6185806",
"0.61755013",
"0.6175436",
"0.61754084",
"0.617163",
"0.6170079",
"0.61629146",
"0.6159616",
"0.61593777",
"0.6158215",
"0.61575884",
"0.61510444",
"0.6149229",
"0.61454916",
"0.6143929",
"0.6142041",
"0.61420274",
"0.61419475",
"0.61368686",
"0.61356634",
"0.61355525",
"0.61355436",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438",
"0.6135438"
] |
0.71393585
|
2
|
GET /itineraries/1 GET /itineraries/1.xml
|
def show
@travel = Travel.find(params[:travel_id])
@itinerary = Itinerary.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @itinerary }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @itineraries = Itinerary.all\n end",
"def index\n @itineraries = Itinerary.all\n end",
"def show\n @itinerary = Itinerary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def index\n @travel = Travel.find(params[:travel_id])\n @itineraries = Itinerary.order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @itineraries }\n end\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"def show\n @itinerary = current_user.itineraries.find(params[:id])\n \n foursquare_connect\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def new\n @itinerary = Itinerary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def index\n @airlines = Airline.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @airlines }\n end\n end",
"def index\n if current_user.admin?\n @itineraries = Itinerary.all\n else\n @itineraries = current_user.itineraries.where(user_id: current_user)\n end\n end",
"def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invitations }\n end\n end",
"def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end",
"def index\n @user = User.find(params[:user_id]) \n @invitations = @user.invitations\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\nend",
"def index\n @invitations = Invitation.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @invitations.to_xml }\n end\n end",
"def index\n @admin_itineraries= City.find(session[:current_city_id]).discover.itineraries.page(params[:page]).per(10)\n end",
"def index\n @leks = Lek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @leks }\n end\n end",
"def new\n @travel = Travel.find(params[:travel_id])\n @itinerary = Itinerary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def show\n @showItin = Itinerary.find(itin_params)\n render json: @showItin, status: 200\n end",
"def do_some_stuff_with_trimet_response trimet\n xml = Nokogiri::XML(trimet)\n xml.xpath(\"//xmlns:itinerary\").each do |itinerary|\n puts \"itinerary #{itinerary[\"id\"]}\"\n legs = itinerary.xpath(\"xmlns:leg\")\n legs.each do |leg|\n if leg == legs.last \n break \n end\n transitMode = leg.attribute('mode').text\n routeName = leg.xpath(\"xmlns:route/xmlns:name\").text.strip\n stopDescription = leg.xpath(\"xmlns:to/xmlns:description\").text.strip\n if transitMode.eql?(\"Walk\") \n puts \"#{transitMode} to #{stopDescription}\"\n else \n puts \"#{transitMode} #{routeName} to #{stopDescription}\"\n end\n end\n end\n end",
"def index\n @borrower_residences = BorrowerResidence.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @borrower_residences.to_xml }\n end\n end",
"def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end",
"def show\n\t\t@destination = Destination.find(params[:id])\n\t\t@itineraries = @destination.itineraries\n\t\tobject = {:destination => @destination, :itineraries => @itineraries}\n\t\tputs object\n\t\trespond_with @destination, object\n\tend",
"def show\n @user = current_user\n @itinerary = Itinerary.find(params[:id])\n @move = Move.find(params[:move_id])\n @installation = @move.end.installation_id\n @trips = @itinerary.trips.find(:all, :order => 'date')\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def show\n @rip = Rip.find params[:id]\n respond_to do |format|\n format.html\n format.xml { render :xml => @rip.to_xml }\n end\n end",
"def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end",
"def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end",
"def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end",
"def index\n @estimate_line_items = EstimateLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estimate_line_items }\n end\n end",
"def airline(id)\n perform_get(\"/airlines/#{id}.xml\")\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 show\n @irb = Irb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @irb }\n end\n end",
"def index\n @lieus = Lieu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lieus }\n end\n end",
"def show\n @interviews_it = Interviews::It.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interviews_it }\n end\n end",
"def index\n @additions = Addition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @additions }\n end\n end",
"def index\n @node = Fedora.rest('rest/')\n end",
"def index\n @outlines = Outline.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @outlines }\n end\n end",
"def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end",
"def show\n \n \n @itineraries = @tour.itinerary\n \n end",
"def index_rest\n @entry_items = EntryItem.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entry_items }\n end\n end",
"def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end",
"def index\n @notifiers = Notifier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @notifiers }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def show\n @lendable = Lendable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lendable }\n end\n end",
"def show\n @county = County.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.xml { render :xml => @county }\n format.xml { render :xml => @county.to_xml(:include => { :libraries => { :include => :departments } }) }\n end\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @universes = Universe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @universes }\n end\n end",
"def show\n @airline = Airline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @airline }\n end\n end",
"def show\n @wrestler = Wrestler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wrestler }\n end\n end",
"def index\n @invite_requests = InviteRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @invite_requests }\n end\n end",
"def index\n @lookup_sets = LookupSet.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lookup_sets }\n end\n end",
"def index\n @sitelinks = Sitelink.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sitelinks }\n end\n end",
"def get_listings_xml(url)\n @client.get_content(url)\n end",
"def show\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @invoiceline }\n end\n end",
"def index\n @trip_enrollments = TripEnrollment.find(:all)\n\n respond_to do |format|\n #format.html # index.html.erb\n format.html { render(:action => :index, :layout => false) && return } \n format.xml { render :xml => @trip_enrollments }\n end\n end",
"def show\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inning }\n end\n end",
"def show\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @inning }\n end\n end",
"def show\n @technician = Technician.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @technician }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end",
"def show\n @renewal = Renewal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @renewal }\n end\n end",
"def show\n @itin = Itinerary.find_by_id(params[:id])\n \n opts = {}\n opts[:include] = [:address]\n render success_response(@itin, opts)\n end",
"def index\n @realtors = Realtor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realtors }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @line_items = LineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @line_items }\n end\n end",
"def index\n @liner_items = LinerItem.all\n end",
"def index\n @interfaces = Interface.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @interfaces }\n end\n end",
"def index\n @portal_learners = Portal::Learner.search(params[:search], params[:page], nil)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @portal_learners }\n end\n end",
"def show\n @initiary = Initiary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @initiary }\n end\n end",
"def show\n @regiment = Regiment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @regiment }\n end\n end",
"def index\n @independents = @member.independents\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @independents }\n end\n end",
"def index\n @referrals = Referral.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @referrals }\n end\n end",
"def index\n @intakes = Intake.search(params[:search])\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @intakes }\n end\n end",
"def show \n @calorie_intake = CalorieIntake.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @calorie_intake }\n end\n end",
"def show\n @intelligence = Intelligence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @intelligence }\n end\n end",
"def index\n @relationships = Relationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @relationships }\n end\n end",
"def show\n @institute = Institute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @institute }\n end\n end",
"def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend",
"def show\n @trip_enrollment = TripEnrollment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trip_enrollment }\n end\n end",
"def show\n @interests = Interests.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interests }\n end\n end",
"def itineraries\n if object.next_trip \n (object.itineraries + object.next_trip.itineraries).map{ |x| ItinerarySerializer.new(x) }\n else \n (object.itineraries).map{ |x| ItinerarySerializer.new(x) }\n end\n end",
"def show\n @analisis = Analisis.find(params[:id])\n\n respond_to do |format|\n format.xml { render :xml => @analisis }\n end\n end",
"def show\n @interest = Interest.find(params[:id])\n @interests = Interest.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @interest }\n end\n end",
"def index\n @search = Issued.search(params[:search])\n @issueds = @search.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # indexoo.html.erb\n format.xml { render :xml => @issueds }\n end\n end",
"def show\n @ii_i = IiI.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ii_i }\n end\n end",
"def show\n @borrower_residence = BorrowerResidence.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @borrower_residence.to_xml }\n end\n end",
"def show\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatorios }\n end\n end",
"def index\n @requirements = Requirement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requirements }\n end\n end",
"def show\n @intake = Intake.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @intake }\n end\n end",
"def index\n @aisles = Aisle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @aisles }\n end\n end",
"def show\n @index = Indice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @index }\n end\n end",
"def index\n @subjects = @client.subjects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subjects }\n end\n end",
"def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @partners.to_xml }\n end\n end",
"def index\n\t\t@people = Person.all\n\t\t# respond_to do |format|\n\t\t# \tformat.xml { send_data @entries.to_xml, :type => 'text/xml; charset=UTF-8;', :disposition => 'attachment; filename=entries.xml'}\n\t\t# end\n\tend",
"def index\n @partyrelationships = Partyrelationship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @partyrelationships }\n end\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def get\n Iterable.request(conf, base_path).get\n end",
"def index\n @landings = Landing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @landings }\n end\n end",
"def show\n @resource = Resource.find(params[:id])\n @terms = Term.all_iit_subjects\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def list_employees(api_object)\n puts \"Current Employees:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('employees/employee/name').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend",
"def index\n @tournaments = @resource_finder.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tournaments }\n end\n end",
"def show\n @versioned_jnlp = MavenJnlp::VersionedJnlp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @versioned_jnlp }\n end\n end"
] |
[
"0.65740645",
"0.65740645",
"0.6447323",
"0.6446343",
"0.5797915",
"0.5753039",
"0.57413757",
"0.5699008",
"0.5695427",
"0.564668",
"0.5640403",
"0.5637766",
"0.5636691",
"0.5635733",
"0.56323534",
"0.561782",
"0.5585485",
"0.5582536",
"0.5530655",
"0.551377",
"0.5512706",
"0.5499592",
"0.54873425",
"0.54742104",
"0.54583806",
"0.54583806",
"0.5453928",
"0.544612",
"0.54325366",
"0.5428478",
"0.5425357",
"0.5423131",
"0.54060227",
"0.54010254",
"0.5398047",
"0.53932554",
"0.5374639",
"0.5370677",
"0.5367725",
"0.5364438",
"0.5352617",
"0.53522813",
"0.53521085",
"0.53401715",
"0.5338348",
"0.5337812",
"0.53318715",
"0.53306806",
"0.5329824",
"0.5328046",
"0.53237116",
"0.5318811",
"0.53183717",
"0.531701",
"0.5309985",
"0.5309985",
"0.53082216",
"0.5302877",
"0.5301749",
"0.5293924",
"0.52937496",
"0.52913517",
"0.52913517",
"0.52873576",
"0.52870286",
"0.52824754",
"0.5277443",
"0.5273773",
"0.52675897",
"0.5264123",
"0.52600896",
"0.52555305",
"0.52553624",
"0.52534103",
"0.52527237",
"0.5252016",
"0.5251693",
"0.5247216",
"0.5242618",
"0.5240387",
"0.52331555",
"0.5230996",
"0.5225789",
"0.5222209",
"0.5220675",
"0.5220182",
"0.5216252",
"0.5211826",
"0.5211247",
"0.520388",
"0.5200814",
"0.51993924",
"0.5196426",
"0.5192977",
"0.5192977",
"0.5191665",
"0.51908654",
"0.51876134",
"0.518031",
"0.5175231"
] |
0.60442054
|
4
|
GET /itineraries/new GET /itineraries/new.xml
|
def new
@travel = Travel.find(params[:travel_id])
@itinerary = Itinerary.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @itinerary }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @itinerary = Itinerary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @itinerary }\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 @county = County.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @county }\n end\n end",
"def new\n @renewal = Renewal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @renewal }\n end\n end",
"def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interest }\n end\n end",
"def new\n @regiment = Regiment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @regiment }\n end\n end",
"def new\n @index = Indice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @index }\n end\n end",
"def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\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\t\t@itinerary = Itinerary.new\n\tend",
"def new\n @irb = Irb.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @irb }\n end\n end",
"def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lease }\n end\n end",
"def new_rest\n @entry_item = EntryItem.new\n\n respond_to do |format|\n #format.html # new.html.erb\n format.xml { render :xml => @entry_item }\n end\n end",
"def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end",
"def new\n @intake = Intake.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @intake }\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 @airline = Airline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @airline }\n end\n end",
"def new\n @gene_ontology = GeneOntology.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gene_ontology }\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",
"def new\n @incentive = Incentive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incentive }\n end\n end",
"def new\n @entry = @resource_finder.new\n initialize_new_resource\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end",
"def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end",
"def new\n @interests = Interests.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interests }\n end\n end",
"def create\n @travel = Travel.find(params[:travel_id])\n @itinerary = @travel.itineraries.new(itinerary_param)\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to(admin_travel_itineraries_url(@travel), :notice => 'Itinerary was successfully created.') }\n format.xml { render :xml => @itinerary, :status => :created, :location => @itinerary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @lendable = Lendable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lendable }\n end\n end",
"def new\n @ministries = Ministries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ministries }\n end\n end",
"def new\n @universe = Universe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @universe }\n end\n end",
"def new\n @relatorios = Relatorio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatorios }\n end\n end",
"def new\n @nlp = Nlp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nlp }\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_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end",
"def new\n @livingroom = Livingroom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @livingroom }\n end\n end",
"def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @reqinfo = Reqinfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reqinfo }\n end\n end",
"def new\n @counterparty = Counterparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @counterparty }\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def new\n @island = Island.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @island }\n end\n end",
"def new\n @partyrelationship = Partyrelationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partyrelationship }\n end\n end",
"def new\n @lyric = Lyric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lyric }\n end\n end",
"def new\n @relationship = Relationship.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relationship }\n end\n end",
"def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end",
"def new\n @identity = Identity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @identity }\n end\n end",
"def new\n @intelligence = Intelligence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @intelligence }\n end\n end",
"def new\n @lb202556 = Lb202556.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb202556 }\n end\n end",
"def new\n @interes = Interes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @interes }\n end\n end",
"def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end",
"def new\n @thing_list = ThingList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @thing_list }\n end\n end",
"def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @enrollment }\n end\n end",
"def new\n @enrollment = Enrollment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @enrollment }\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 create\n @itinerary = Itinerary.new(params[:itinerary])\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to(@itinerary, :notice => 'Itinerary was successfully created.') }\n format.xml { render :xml => @itinerary, :status => :created, :location => @itinerary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@itinerary = Itinerary.create(itin_params)\n\t\n\t\tredirect_to \"/\"\n\tend",
"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 @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @incident = Incident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @imovel = Imovel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @imovel }\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 @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end",
"def new\n @technician = Technician.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @technician }\n end\n end",
"def new\n @solicitation = @representative.solicitations.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitation }\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 new\n @incident = Incident.new\n \n @title = \"New Incident\" \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @incident }\n end\n end",
"def new\n @ii_i = IiI.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ii_i }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @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 @lookup_ethnicity = LookupEthnicity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_ethnicity }\n end\n end",
"def new\n @new_employee_request = NewEmployeeRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_employee_request }\n end\n end",
"def new\n @announcer = Announcer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @announcer }\n end\n end",
"def new\n @prerequisite = Prerequisite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prerequisite }\n end\n end",
"def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end",
"def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end",
"def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @borrow }\n end\n end",
"def new\n @lek = Lek.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lek }\n end\n end",
"def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @neighborhood }\n end\n end",
"def new\r\n @lineitem = Lineitem.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @lineitem }\r\n end\r\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 new\n @rink = Rink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rink }\n end\n end",
"def new\n @institute = Institute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @institute }\n end\n end",
"def new\n @discovery = Discovery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @discovery }\n end\n end",
"def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @monkey }\n end\n end",
"def new\n @invoiceline = Invoiceline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoiceline }\n end\n end",
"def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loan }\n end\n end",
"def new\n @resource = Resource.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resource }\n end\n end",
"def new\n @invite_request = InviteRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invite_request }\n end\n end",
"def new\n @lablocational = Lablocational.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lablocational }\n end\n end",
"def new\n @lookup_eligibility_ineligibility = LookupEligibilityIneligibility.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_eligibility_ineligibility }\n end\n end",
"def new\n @bottle = Bottle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bottle }\n\t\t\tformat.json { render :json => @bottle }\n end\n end",
"def new\n @users = User.find(:all)\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end",
"def new\n @partytype = Partytype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @partytype }\n end\n end",
"def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end",
"def new\n @institution = Institution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @institution }\n end\n end",
"def new\n @inning = Inning.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inning }\n end\n end",
"def new\n @lr45 = Lr45.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr45 }\n end\n end",
"def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end",
"def new\n @add_on = AddOn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @add_on }\n end\n end",
"def new\n @vocab = Vocab.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @vocab }\n end\n end",
"def new\n @sitetype = Sitetype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sitetype }\n end\n end"
] |
[
"0.7140163",
"0.6606518",
"0.6575284",
"0.65515393",
"0.65328044",
"0.6504189",
"0.64822537",
"0.6465794",
"0.64607304",
"0.6457424",
"0.64493275",
"0.6442685",
"0.6440516",
"0.6440371",
"0.6435936",
"0.64218444",
"0.64212686",
"0.64111525",
"0.64109015",
"0.64109015",
"0.64109015",
"0.6408188",
"0.64065194",
"0.6403798",
"0.6395734",
"0.63915116",
"0.63897413",
"0.6379428",
"0.63698906",
"0.636527",
"0.6361809",
"0.63617456",
"0.63550097",
"0.6348938",
"0.63442963",
"0.6343345",
"0.63391054",
"0.63339233",
"0.6332704",
"0.632661",
"0.6317818",
"0.62991476",
"0.6291828",
"0.62910867",
"0.62901944",
"0.62787044",
"0.6278508",
"0.6269038",
"0.62636757",
"0.6261484",
"0.62608606",
"0.62608606",
"0.62599677",
"0.6257941",
"0.62558585",
"0.62556255",
"0.6252271",
"0.6252271",
"0.6249694",
"0.62465084",
"0.6243229",
"0.6242045",
"0.62403715",
"0.62364876",
"0.62345344",
"0.62343204",
"0.6228094",
"0.6227447",
"0.62259924",
"0.62252665",
"0.62161696",
"0.6209721",
"0.6208691",
"0.6208691",
"0.6207297",
"0.6206201",
"0.62051773",
"0.6204849",
"0.6202029",
"0.61982614",
"0.61943626",
"0.61935383",
"0.6185029",
"0.6182748",
"0.6180398",
"0.6174726",
"0.61705333",
"0.61681753",
"0.61674714",
"0.61672676",
"0.61659586",
"0.61624193",
"0.6161138",
"0.61608917",
"0.61584353",
"0.61582196",
"0.61570436",
"0.61527294",
"0.61515474",
"0.6149762"
] |
0.7006599
|
1
|
POST /itineraries POST /itineraries.xml
|
def create
@travel = Travel.find(params[:travel_id])
@itinerary = @travel.itineraries.new(itinerary_param)
respond_to do |format|
if @itinerary.save
format.html { redirect_to(admin_travel_itineraries_url(@travel), :notice => 'Itinerary was successfully created.') }
format.xml { render :xml => @itinerary, :status => :created, :location => @itinerary }
else
format.html { render :action => "new" }
format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @itinerary = Itinerary.new(params[:itinerary])\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to(@itinerary, :notice => 'Itinerary was successfully created.') }\n format.xml { render :xml => @itinerary, :status => :created, :location => @itinerary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@itinerary = Itinerary.create(itin_params)\n\t\n\t\tredirect_to \"/\"\n\tend",
"def create\n @itinerary = Itinerary.new(itinerary_params)\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to @itinerary, notice: \"Itinerary was successfully created.\" }\n format.json { render :show, status: :created, location: @itinerary }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @itinerary = Itinerary.new(itinerary_params)\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully created.' }\n format.json { render :show, status: :created, location: @itinerary }\n else\n format.html { render :new }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_itinerary = Itinerary.new(admin_itinerary_params)\n\n respond_to do |format|\n if @admin_itinerary.save\n format.html { redirect_to session['previous_url'] || admin_itineraries_url, notice: 'Itinerari è stato creato con successo.' }\n format.json { render :show, status: :created, location: @admin_itinerary }\n else\n format.html { render :new }\n format.json { render json: @admin_itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @itinerary = Itinerary.new(itinerary_params)\n @itinerary.user_id = current_user.id\n \n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to @itinerary, notice: \"Itinerary was successfully created.\" }\n format.json { render :show, status: :created, location: @itinerary }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def itinerary_params\n params.require(:itinerary).permit(:name, :date, :user_id, :activity_id, activity_ids: [])\n end",
"def post_outcome_request\n raise IMS::LTI::InvalidLTIConfigError, \"\" unless has_required_attributes?\n\n res = post_service_request(@lis_outcome_service_url,\n 'application/xml',\n generate_request_xml)\n\n @outcome_response = extend_outcome_response(OutcomeResponse.new)\n @outcome_response.process_post_response(res)\n end",
"def index\n @itineraries = Itinerary.all\n end",
"def index\n @itineraries = Itinerary.all\n end",
"def create\n @itinerary = Itinerary.new(params[:itinerary])\n @move = Move.find(params[:move_id])\n @user = current_user\n respond_to do |format|\n if @itinerary.save\n flash[:notice] = 'Itinerary was successfully created.'\n format.html { redirect_to move_itinerary_path(@move, @itinerary)}\n format.xml { render :xml => @itinerary, :status => :created, :location => @itinerary }\n else\n format.html { render :layout => 'form',:action => \"index\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @trip = Trip.find_by_id(params[:trip_id])\n @folder = @trip.folders.find_by_id(params[:folder_id])\n @itenary = @folder.itenaries.create(itenary_params)\n\n respond_to do |format|\n if @itenary.save\n format.html { redirect_to trip_folder_itenaries_path(:trip_id => @trip.name, :folder_id => @folder.name), notice: 'Itenary was successfully created.' }\n format.json { render :show, status: :created, location: trip_folder_itenaries_path(:trip_id => @trip.name, :folder_id => @folder.name) }\n else\n format.html { render :new }\n format.json { render json: @itenary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def itinerary_params\n params.require(:itinerary).permit(:name)\n end",
"def create\n #New itinerary\n @newItinerary = Itinerary.new itin_params\n @newItinerary.save\n #new event and event_itinerary\n @eventArray = event_array\n @eventArray.each do |event|\n event = Event.new(event) #iterate through, add event itinerary to each one with itinerary ID from first save.\n event.save\n @newEventItin = EventItinerary.new(:event_id => event[:id],:itinerary_id => @newItinerary[:id])\n @newEventItin.save\n end\n \n respond_to do |format|\n format.json { render :json => [{:event => @eventArray},{ :itineraries => @newItinerary},{:event_itineraries => @newEventItin} ]}\n end\n end",
"def itinerary_params\n params.require(:itinerary).permit(:latitude, :longuitude, :bus_lines_id)\n end",
"def itinerary_params\n params.require(:itinerary).permit(:title, :description, :phone, :address, :city, :state, :zip, :twitter, :facebook, :instagram, :travel, :user_id)\n end",
"def create_itineraries(params)\n\n transit_response = nil\n Rails.logger.info \"CREATE: \" + params[:modes].collect {|m| m.code}.join(\",\")\n # remove_existing_itineraries\n itins = []\n \n params[:modes].each do |mode|\n\n Rails.logger.info('CREATING ITINERARIES FOR TRIP PART ' + self.id.to_s)\n Rails.logger.info(mode)\n case mode\n # start with the non-OTP modes\n when Mode.taxi\n timed \"taxi\" do\n taxi_itineraries = TaxiItinerary.get_taxi_itineraries(self, [from_trip_place.location.first, from_trip_place.location.last],[to_trip_place.location.first, to_trip_place.location.last], trip_time, trip.user)\n itins << taxi_itineraries if taxi_itineraries.length > 0\n itins.flatten!\n end\n when Mode.paratransit\n timed \"paratransit\" do\n itins += ParatransitItinerary.get_itineraries(self)\n end\n when Mode.rideshare\n timed \"rideshare\" do\n itins += create_rideshare_itineraries\n end\n when Mode.ride_hailing \n timed \"ride_hailing\" do\n itins += RideHailingItinerary.get_itineraries(self)\n end\n else\n # OTP modes\n if (!mode.otp_mode.blank?)\n # Transit modes + Bike, Drive,\n timed \"fixed\" do\n start = Time.now\n new_itins, response = create_fixed_route_itineraries({otp_mode: mode.otp_mode, mode: mode.code, walk_mph: params[:walk_speed], max_walk_miles: params[:max_walk_miles], max_walk_seconds: params[:max_walk_seconds], optimize: params[:optimize], num_itineraries: params[:num_itineraries], min_transfer_time: params[:min_transfer_time], max_transfer_time: params[:max_transfer_time], banned_routes: params[:banned_routes], preferred_routes: params[:preferred_routes]})\n\n if mode.code == \"mode_transit\"\n transit_response = response\n end\n\n puts 'CREATE FIXED_ ROUTE ITINERARIES ###'\n puts Time.now - start\n non_duplicate_itins = []\n start = Time.now\n new_itins.each do |itin|\n unless self.check_for_duplicates(itin, self.itineraries + itins)\n non_duplicate_itins << itin\n end\n end\n puts 'Check for Duplicates ###'\n puts Time.now - start\n\n itins += non_duplicate_itins\n end\n end\n end\n end\n #self.itineraries << itins\n return itins, transit_response\n end",
"def post\n Rentlinx.client.post(self)\n end",
"def new\n @itinerary = Itinerary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def create\n @itinerary = Itinerary.find(params[:itinerary_id])\n @transaction = @itinerary.transactions.build\n authorize! :create, @transaction\n\n @unpaid_line_items = @itinerary.line_items.where(paid: false)\n @transaction.line_items = @unpaid_line_items\n @transaction.tax = @transaction.pre_tax_total * selected_conference.tax_rate\n @transaction.payment_method = params[:payment_method]\n\n if @transaction.save\n redirect_to itinerary_transaction_path(@itinerary, @transaction)\n else\n #TODO there isn't any user input that could cause this action to fail, so probably apologize and send the developer an email..\n end\n end",
"def itinerary_params\n params.require(:itinerary).permit(:transportation, :company, :flight_number, :departure, :arrival, :airport_arrival, :airport_departure)\n end",
"def create\n p'*'*800\n p params\n\n @trainer = Trainer.new(trainer_params)\n\n p @trainer\n\n if @trainer.save\n render json: @trainer, status: :created, location: @trainer\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end",
"def itinerary_params\n params.require(:itinerary).permit(:title, :content)\n end",
"def index\n @itineraryList = Itinerary.all\n render json: @itineraryList, status: 200\n end",
"def new\n @travel = Travel.find(params[:travel_id])\n @itinerary = Itinerary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @itinerary }\n end\n end",
"def enrollment(params = {})\n scope 'default'\n post('enrollment/', params)\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def create_fixed_route_itineraries\n tp = TripPlanner.new\n arrive_by = !is_depart\n from_place = trip.trip_places.first\n to_place = trip.trip_places.last\n result, response = tp.get_fixed_itineraries([from_place.location.first, from_place.location.last],[to_place.location.first, to_place.location.last], trip_datetime.in_time_zone, arrive_by.to_s)\n if result\n tp.convert_itineraries(response).each do |itinerary|\n itineraries << Itinerary.new(itinerary)\n end\n else\n itineraries << Itinerary.new('server_status'=>response['id'], 'server_status'=>response['msg'])\n end\n end",
"def create_inquiry(rental, options = {})\n post(\"rentals/#{rental}/inquiries\", inquiries: [options]).pop\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def itinerary_params\n params.require(:itinerary).permit(:which_team, :airline, :flight_number, :arrival, :depart, :transportation, :user_id)\n end",
"def create\n\t\tdestId = params[:destination_id]\n\t\tdestination = Destination.find_by_id(destId)\n\t\titinerary = Itinerary.create({tags: itinerary_params[:tags].split(\" \")})\n\t\ta = activity_params.first\n\t\tactivity = itinerary.activities.create({title: a[:title], tip: a[:tip], location: a[:location], photo: a[:photo], highlight: a[:highlight]})\n\t\trespond_with itinerary\n\tend",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create(params = {})\n wrapped_params = { insurance: params }\n @client.make_request(:post, 'insurances', MODEL_CLASS, wrapped_params)\n end",
"def index\n @travel = Travel.find(params[:travel_id])\n @itineraries = Itinerary.order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @itineraries }\n end\n end",
"def create\n @workshop = Workshop.new(workshop_params)\n puts \"====================================\"\n puts params['trainers']\n puts \"====================================\"\n trainers = params['trainers'].map do |id|\n Trainer.find(id)\n end\n @workshop.trainers << trainers\n\n\n respond_to do |format|\n if @workshop.save\n format.html { redirect_to @workshop, notice: 'Workshop was successfully created.' }\n format.json { render :show, status: :created, location: @workshop }\n else\n format.html { render :new }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end",
"def itineraries\n if object.next_trip \n (object.itineraries + object.next_trip.itineraries).map{ |x| ItinerarySerializer.new(x) }\n else \n (object.itineraries).map{ |x| ItinerarySerializer.new(x) }\n end\n end",
"def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end",
"def itinerary_params\n params.permit(:dates, :location, :shared, :user_id, :id)\n end",
"def itinerary_params\n params.require(:itinerary).permit(:start_date, :end_date, :available_seat, :projected_eta, :description, :user_id, :avatar_image)\n end",
"def create\n @renewal = Renewal.new(renewal_params)\n\n respond_to do |format|\n if @renewal.save\n format.html { redirect_to insurance_policy_path(@renewal.insurance_policy), notice: 'Renewal was successfully created.' }\n format.json { render :show, status: :created, location: @renewal }\n # for each new renewal added parent policy expiry and policy no will change to match current renewal\n @insurance_policy = @renewal.insurance_policy\n @insurance_policy.update_attributes(current_expiry: @renewal.expiry_date, policyno: @renewal.policyno)\n else\n format.html { render :new }\n format.json { render json: @renewal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def create\n @resource = Resource.new(params[:resource])\n @terms = Term.all_iit_subjects\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @itinerary = Itinerary.find(params[:id])\n @itinerary.destroy\n\n respond_to do |format|\n format.html { redirect_to(itineraries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @itinerary = Itinerary.find(params[:id])\n @itinerary.destroy\n\n respond_to do |format|\n format.html { redirect_to(itineraries_url) }\n format.xml { head :ok }\n end\n end",
"def post(url_variables:, body:)\n ensure_service_document\n\n end",
"def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end",
"def set_itinerary\n @participant = Participant.find(params[:participant_id])\n @itinerary = @participant.itinerary\n end",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def create\n \r\n current_user.readings.create(:listing_id => params[:listing_id])\r\n respond_to do |format|\r\n #need to call create on a listing to increment counter\n format.xml { head :ok }\r\n end\r\n \n end",
"def index\n redirect_to edit_itinerary_path(current_user.itineraries.last) #not after_sign_in_path since reviewers and admins might pay with paypal and they should be returned to the registration interface\n end",
"def create\n @intervenant = Intervenant.new(intervenant_params)\n\n respond_to do |format|\n if @intervenant.save\n format.html { redirect_to @intervenant, notice: 'Intervenant was successfully created.' }\n format.json { render :show, status: :created, location: @intervenant }\n else\n format.html { render :new }\n format.json { render json: @intervenant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n\t\t@itinerary = Itinerary.new\n\tend",
"def post\n @response_body = make_request(\"#{api_url}#{endpoint}\", request_body.to_json)\n puts \"GLIMR POST: #{endpoint} - #{request_body.to_json}\" if ENV.key?('GLIMR_API_DEBUG')\n end",
"def create(name=\"Default Name\", age=\"50\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <name>#{name}</name>\r\n <age>#{age}</age>\r\n </person>\"\r\n \r\n request = Net::HTTP::Post.new(@url)\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n \r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n response.body \r\n end",
"def test_post_request_collection\n params = {\n size: 3,\n employmentTypeUris: ['/dk/atira/pure/person/employmenttypes/academic'],\n employmentStatus: 'ACTIVE'\n }\n response = client.persons.all_complex params: params\n assert_equal response.code, 200\n assert_instance_of HTTP::Response, response\n end",
"def post_request(params, useSSL=false)\n # get a server handle\n port = (useSSL == true) ? 443 : 80\n http_server = Net::HTTP.new(API_HOST, port)\n http_server.use_ssl = useSSL\n \n # build a request\n http_request = Net::HTTP::Post.new(API_PATH_REST)\n http_request.form_data = params\n \n # get the response XML\n return http_server.start{|http| http.request(http_request)}.body\n end",
"def post(body)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true if uri.scheme == 'https'\n\n request = Net::HTTP::Post.new(uri)\n request['Content-Type'] = 'text/xml'\n request['Accept-Language'] = locale if locale\n request.body = body\n\n response = http.request(request)\n\n Response.new(response, uri)\n end",
"def create\n @irb = Irb.new(params[:irb])\n\n respond_to do |format|\n if @irb.save\n format.html { redirect_to(@irb, :notice => 'Irb was successfully created.') }\n format.xml { render :xml => @irb, :status => :created, :location => @irb }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @irb.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def submit_menu\n @order = Order.create! user_id: current_user.id, restaurant_id: @restaurant.id\n\n params[:order].each do |order_item|\n MenuItemOrder.create(order_id: @order.id, menu_item_id: params[:order][order_item][:item], quantity: params[:order][order_item][:quantity])\n end\n respond_to do |format|\n format.html { redirect_to new_order_path(@restaurant), notice: 'Menu items were successfully submitted.' }\n format.json { render :new, status: :created, location: @order }\n end\n end",
"def create\n @trainingitem = Trainingitem.new(trainingitem_params)\n @trainingitem.trainer_id = current_trainer.id\n\n respond_to do |format|\n if @trainingitem.save\n format.html { redirect_to @trainingitem, notice: 'Trainingitem was successfully created.' }\n format.json { render :show, status: :created, location: @trainingitem }\n else\n format.html { render :new }\n format.json { render json: @trainingitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trainer = Trainer.new(params[:trainer])\n\n respond_to do |format|\n if @trainer.save\n format.html { redirect_to @trainer, :notice => 'Trainer was successfully created.' }\n format.json { render :json => @trainer, :status => :created, :location => @trainer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trainer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n if params[\"itinerary_id\"] != \"\"\n @item.itineraries << Itinerary.find(params[\"itinerary_id\"])\n if ( @item.location != nil ) && ( @item.img_url == nil )\n @item.geocode_function\n else\n @item.save\n end\n redirect_to \"/itineraries/#{params[:itinerary_id]}\"\n else\n @item.save\n redirect_to items_path\n end\n\n end",
"def create_rental(options = {})\n post(:rentals, rentals: [options]).pop\n end",
"def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/investmentaccount/v1\")\n end",
"def create\n params.permit!\n @interviews_it = Interviews::It.new(params[:interviews_it])\n\n respond_to do |format|\n if @interviews_it.save\n format.html { redirect_to(@interviews_it, :notice => 'It was successfully created.') }\n format.xml { render :xml => @interviews_it, :status => :created, :location => @interviews_it }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @interviews_it.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @interest = Interest.new(params[:interest])\n \n respond_to do |format|\n if @interest.save\n format.json { render :json => @interest,\n :status => :created, :location => @interest }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def post\n resource.post(request, response)\n end",
"def create\n @itinerary = Itinerary.new(itinerary_params)\n @start_loc = Location.create(address: params[:start_loc], is_origin: true, itinerary_id: @itinerary.id)\n @end_loc = Location.create(address: params[:end_loc], is_origin: false, itinerary_id: @itinerary.id)\n @itinerary.locations.push(@start_loc)\n @itinerary.locations.push(@end_loc)\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully created.' }\n format.json { render :show, status: :created, location: @itinerary }\n\n # origin = @itinerary.locations.new( address: params[:origin], is_origin: true )\n # origin.get_coords\n\n # destination = @itinerary.locations.new( address: params[:destination], is_origin: false )\n # destination.get_coords\n\n else\n format.html { render :new }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trainer = Trainer.new(params[:trainer])\n\n respond_to do |format|\n if @trainer.save\n format.html { redirect_to @trainer, notice: 'Trainer was successfully created.' }\n format.json { render json: @trainer, status: :created, location: @trainer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trainer.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 test_post_invoices_xml \n Redmine::ApiTest::Base.should_allow_api_authentication(:post,\n '/invoices.xml',\n {:invoice => {:project_id => 1, :number => 'INV/TEST-1'}},\n {:success_code => :created})\n \n assert_difference('Invoice.count') do\n post '/invoices.xml', {:invoice => {:project_id => 1, :number => 'INV/TEST-1', :contact_id => 1, :status_id => 1, :invoice_date => Date.today}}, credentials('admin')\n end\n\n invoice = Invoice.first(:order => 'id DESC')\n assert_equal 'INV/TEST-1', invoice.number\n \n assert_response :created\n assert_equal 'application/xml', @response.content_type\n assert_tag 'invoice', :child => {:tag => 'id', :content => invoice.id.to_s}\n end",
"def create\n @rentable_item = RentableItem.new(rentable_item_params)\n @rentable_item.save\n end",
"def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend",
"def create\n @airline = Airline.new(params[:airline])\n\n respond_to do |format|\n if @airline.save\n format.html { redirect_to(@airline, :notice => 'Travel form was successfully created.') }\n format.xml { render :xml => @airline, :status => :created, :location => @airline }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @airline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend",
"def post(path, params={})\n RestClient.post request_base+path, params\n end",
"def create\n @airlin = Airlin.new(params[:airlin])\n\n respond_to do |format|\n if @airlin.save\n format.html { redirect_to @airlin, notice: 'Airlin was successfully created.' }\n format.json { render json: @airlin, status: :created, location: @airlin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @airlin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @iine = Iine.new(iine_params)\n\n respond_to do |format|\n if @iine.save\n format.html { redirect_to @iine, notice: 'Iine was successfully created.' }\n format.json { render :show, status: :created, location: @iine }\n else\n format.html { render :new }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @requisition = Requisition.new(requisition_params)\n respond_to do |format|\n if @requisition.save\n # Send to the Business Insight Model\n RestClient::Resource.new(APP_CONFIG[:insight_url], :verify_ssl => false, :user => APP_CONFIG[:insight_username], :password => APP_CONFIG[:insight_password]).post({\n \"modelId\" => \"Resupply_Ky06ggwO\",\n \"measures\" => [{\n \"name\" => \"TotalCost\",\n \"value\" => @requisition.amount\n }],\n \"identifierValue\" => @requisition.id,\n \"correlationValue\" => @requisition.id,\n \"eventTime\" => Time.now.strftime('%Y-%m-%dT%H:%M:%S'),\n \"milestoneId\" => \"RequsitionRaised\",\n \"dimensions\" => [ {\n \"name\" => \"Location\",\n \"value\" => @requisition.loc\n } ]\n }.to_json, :content_type=>'application/json')\n format.html { redirect_to requisitions_url, notice: 'Requisition was successfully created.' }\n format.json { render :show, status: :created, loc: @requisition }\n else\n format.html { render :new }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def method_missing(method, *args, &block)\n data = { method: method, parameters: args }\n request.post(path: nodes_path, data: data, auth_token: auth_token)\n end",
"def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end",
"def create\n @trainees = TraineeBatch.new(params[:participants][:ids], params[:training_calendar_id])\n respond_to do |format|\n if @trainees.save\n format.html { redirect_to training_calendar_path(params[:training_calendar_id]), :notice => 'The participant(s) were successfully added.' }\n format.json { render :json => @trainees, :status => :created, :location => @trainees }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trainees.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @travel = Travel.find(params[:travel_id])\n @itinerary = @travel.itineraries.find(params[:id])\n\n respond_to do |format|\n if @itinerary.update_attributes(itinerary_param)\n format.html { redirect_to([:admin, @travel, @itinerary], :notice => 'Itinerary was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def extract_itineraries\n return [] unless @response && @response[:plan] && @response[:plan][:itineraries]\n @response[:plan][:itineraries].map {|i| OTPItinerary.new(i)}\n end",
"def create!\n Recliner.put(uri)\n end",
"def create\n @invitation_request = InvitationRequest.new(invitation_request_params)\n\n respond_to do |format|\n if @invitation_request.save\n format.html { redirect_to root_path, notice: 'Invitation received. We will notify you soon!' }\n format.json { render :show, status: :created, location: @invitation_request }\n else\n @interests = Interest.all\n format.html { render :new }\n format.json { render json: @invitation_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_rest\n @entry_item = EntryItem.new(params[:entry_item])\n\n respond_to do |format|\n if @entry_item.save\n flash[:notice] = 'EntryItem was successfully created.'\n #format.html { redirect_to(@entry_item) }\n format.xml { render :xml => @entry_item, :status => :created, :location => @entry_item }\n else\n #format.html { render :action => \"new\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @internship_committee = InternshipCommittee.new(internship_committee_params)\n\n respond_to do |format|\n if @internship_committee.save\n format.html { redirect_to @internship_committee, notice: 'Internship committee was successfully created.' }\n format.json { render :show, status: :created, location: @internship_committee }\n else\n format.html { render :new }\n format.json { render json: @internship_committee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def test_should_create_invite_via_API_XML\r\n get \"/logout\"\r\n post \"/invites.xml\", :api_key=>'testapikey',\r\n :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response :created\r\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n @trainer = Trainer.new(trainer_params)\n\n respond_to do |format|\n if @trainer.save\n format.html { redirect_to @trainer, notice: 'Trainer was successfully created.' }\n format.json { render :show, status: :created, location: @trainer }\n else\n format.html { render :new }\n format.json { render json: @trainer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @trainer = Trainer.new(trainer_params)\n\n respond_to do |format|\n if @trainer.save\n format.html { redirect_to @trainer, notice: 'Trainer was successfully created.' }\n format.json { render :show, status: :created, location: @trainer }\n else\n format.html { render :new }\n format.json { render json: @trainer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end"
] |
[
"0.6235668",
"0.61945355",
"0.608299",
"0.60691816",
"0.59933305",
"0.5863178",
"0.55561763",
"0.5553015",
"0.5519354",
"0.5519354",
"0.5433427",
"0.54239833",
"0.53787416",
"0.5376048",
"0.5360561",
"0.53298366",
"0.527455",
"0.52580273",
"0.52373093",
"0.5227974",
"0.52227986",
"0.5213997",
"0.52100915",
"0.5196481",
"0.5182721",
"0.51549155",
"0.5141155",
"0.51232356",
"0.51156735",
"0.51029325",
"0.509513",
"0.509513",
"0.509513",
"0.509513",
"0.509513",
"0.5078606",
"0.50652987",
"0.50579745",
"0.50231737",
"0.5020988",
"0.50156844",
"0.50122774",
"0.49970746",
"0.49772096",
"0.4970662",
"0.4966441",
"0.49528185",
"0.49517906",
"0.49434483",
"0.49410102",
"0.49410102",
"0.49292752",
"0.49258673",
"0.4925139",
"0.49219143",
"0.49109423",
"0.49099502",
"0.48986596",
"0.4897899",
"0.48948616",
"0.48835838",
"0.48817998",
"0.4881245",
"0.48798826",
"0.48680726",
"0.48676953",
"0.48581085",
"0.4842349",
"0.48348454",
"0.48307753",
"0.48280874",
"0.48180684",
"0.48045632",
"0.48040828",
"0.48026952",
"0.48004904",
"0.47815105",
"0.47803935",
"0.47787556",
"0.47785375",
"0.477508",
"0.4769898",
"0.47696343",
"0.47595865",
"0.47548714",
"0.47522",
"0.47521293",
"0.47519562",
"0.4746853",
"0.47449055",
"0.47404057",
"0.47372398",
"0.47314847",
"0.47311476",
"0.47244927",
"0.47219062",
"0.4720675",
"0.47180605",
"0.47180605",
"0.47177145"
] |
0.63862324
|
0
|
PUT /itineraries/1 PUT /itineraries/1.xml
|
def update
@travel = Travel.find(params[:travel_id])
@itinerary = @travel.itineraries.find(params[:id])
respond_to do |format|
if @itinerary.update_attributes(itinerary_param)
format.html { redirect_to([:admin, @travel, @itinerary], :notice => 'Itinerary was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @itinerary = Itinerary.find(params[:id])\n\n respond_to do |format|\n if @itinerary.update_attributes(params[:itinerary])\n format.html { redirect_to(@itinerary, :notice => 'Itinerary was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @itinerary = Itinerary.find(params[:id])\n\n respond_to do |format|\n if @itinerary.update_attributes(params[:itinerary])\n format.html { redirect_to(@itinerary, :notice => 'Itinerary was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @itin = Itinerary.find_by_id(params[:id])\n\n @itin.update_attributes(itin_params) if @itin\n\n opts = {}\n opts[:include] = [:address]\n render success_response(@itin, opts)\n end",
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def set_itinerary\n @itinerary = Itinerary.find(params[:id])\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @invoiceline = Invoiceline.find(params[:id])\n\n respond_to do |format|\n if @invoiceline.update_attributes(params[:invoiceline])\n format.html { redirect_to(@invoiceline, :notice => 'Invoiceline was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invoiceline.errors, :status => :unprocessable_entity }\n end\n end\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 update\n respond_to do |format|\n if @itinerary.update(itinerary_params)\n format.html { redirect_to @itinerary, notice: \"Itinerary was successfully updated.\" }\n format.json { render :show, status: :ok, location: @itinerary }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @itinerary.update(itinerary_params)\n format.html { redirect_to @itinerary, notice: 'Itinerary was successfully updated.' }\n format.json { render :show, status: :ok, location: @itinerary }\n else\n format.html { render :edit }\n format.json { render json: @itinerary.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 @itinerary.update(itinerary_params)\n format.html { redirect_to @itinerary, notice: \"Itinerary was successfully updated.\" }\n format.json { render :show, status: :ok, location: @itinerary }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n update_resource @ride, ride_params\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 update\n @trainer = Trainer.find(params[:id])\n\n if @trainer.update(trainer_params)\n head :no_content\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end",
"def update\n @itinerary = Itinerary.find(params[:id])\n @move = Move.find(params[:move_id])\n respond_to do |format|\n if @itinerary.update_attributes(params[:itinerary])\n flash[:notice] = 'Itinerary was successfully updated.'\n format.html { redirect_to move_itinerary_path(@move, @itinerary)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend",
"def update\n respond_to do |format|\n if @itenary.update(itenary_params)\n format.html { redirect_to @itenary, notice: 'Itenary was successfully updated.' }\n format.json { render :show, status: :ok, location: @itenary }\n else\n format.html { render :edit }\n format.json { render json: @itenary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(body, params = {}, header = {})\n request = requester.new(:put, \"#{to_url}/#{id}\", body, params, header)\n parameters(request.resource)\n end",
"def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end",
"def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\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 update_rest\n @entry_item = EntryItem.find(params[:id])\n\n respond_to do |format|\n if @entry_item.update_attributes(params[:entry_item])\n flash[:notice] = 'EntryItem was successfully updated.'\n #format.html { redirect_to(@entry_item) }\n format.xml { head :ok }\n else\n #format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_itinerary.update(admin_itinerary_params)\n format.html { redirect_to session['previous_url'] || admin_itineraries_url, notice: 'Itinerari è stato aggiornato con successo.' }\n format.json { render :show, status: :ok, location: @admin_itinerary }\n else\n format.html { render :edit }\n format.json { render json: @admin_itinerary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @entry_instrument = EntryInstrument.find(params[:id])\n\n respond_to do |format|\n if @entry_instrument.update_attributes(params[:entry_instrument])\n flash[:notice] = 'EntryInstrument was successfully updated.'\n format.html { redirect_to(@entry_instrument) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_instrument.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to(@inning, :notice => 'Inning was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inning.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to(@inning, :notice => 'Inning was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inning.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_itinerary\n @itinerary = Itinerary.friendly.find(params[:id])\n end",
"def update\n params.permit!\n @interviews_it = Interviews::It.find(params[:id])\n\n respond_to do |format|\n if @interviews_it.update_attributes(params[:interviews_it])\n format.html { redirect_to(@interviews_it, :notice => 'It was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interviews_it.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @intake = Intake.find(params[:id])\n\n respond_to do |format|\n if @intake.update_attributes(params[:intake])\n format.html { redirect_to(@intake, :notice => t('intake.title2')+\" \"+t('updated')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @intake.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ontology = SYMPH::Ontology.find(params[:id])\n\n respond_to do |format|\n if @ontology.update_attributes(params[:ontology])\n flash[:notice] = 'Ontology was successfully updated.'\n format.html { redirect_to(ontologies_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ontology.errors, :status => :unprocessable_entity }\n end\n end\n\t\n end",
"def edit\n\t\titinerary = Itinerary.find(params[:id])\n\tend",
"def update(id: nil, body: nil)\n perform(:put, \"#{@resource_type}/#{id}\", body)\n end",
"def update\n @trainer = Trainer.find(params[:id])\n\n respond_to do |format|\n if @trainer.update_attributes(params[:trainer])\n format.html { redirect_to @trainer, notice: 'Trainer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trainer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @institute = Institute.find(params[:id])\n\n respond_to do |format|\n if @institute.update_attributes(params[:institute])\n format.html { redirect_to(@institute, :notice => 'Institute was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @institute.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @travel = Travel.find(params[:travel_id])\n @itinerary = @travel.itineraries.new(itinerary_param)\n\n respond_to do |format|\n if @itinerary.save\n format.html { redirect_to(admin_travel_itineraries_url(@travel), :notice => 'Itinerary was successfully created.') }\n format.xml { render :xml => @itinerary, :status => :created, :location => @itinerary }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @itinerary.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @trainer = Trainer.find(params[:id])\n\n respond_to do |format|\n if @trainer.update_attributes(params[:trainer])\n format.html { redirect_to @trainer, :notice => 'Trainer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @trainer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @technician = Technician.find(params[:id])\n\n respond_to do |format|\n if @technician.update_attributes(params[:technician])\n format.html { redirect_to(@technician, :notice => 'Technician was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @technician.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n standard_update(Interest, params[:id], interest_params)\n end",
"def update\n @airline = Airline.find(params[:id])\n\n respond_to do |format|\n if @airline.update_attributes(params[:airline])\n format.html { redirect_to(@airline, :notice => 'Travel form was successfully created.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @airline.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(id, params)\n http.put(\"/nfse/#{id}\", { body: params }) do |response|\n respond_with_entity(response)\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n @calorie_intake = CalorieIntake.find(params[:id])\n\n respond_to do |format|\n if @calorie_intake.update_attributes(params[:calorie_intake])\n format.html { redirect_to(@calorie_intake, :notice => 'CalorieIntake was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @calorie_intake.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @interes = Interes.find(params[:id])\n\n respond_to do |format|\n if @interes.update_attributes(params[:interes])\n format.html { redirect_to(@interes, :notice => 'Interes was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interes.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @interest = Interest.find(params[:id])\n\n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n flash[:notice] = 'Interest was successfully updated.'\n format.html { redirect_to(@interest) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interest.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(*args)\n request :put, *args\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @stationeryrequest = Stationeryrequest.find(params[:id])\n #\n @stationeryrequest.hotelsuppliesrequests.each do |hotelsuppliesrequests|\n \n end\n\n respond_to do |format|\n if @stationeryrequest.update_attributes(params[:stationeryrequest])\n format.html { redirect_to @stationeryrequest, notice: 'Stationeryrequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stationeryrequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incentive = Incentive.find(params[:id])\n\n respond_to do |format|\n if @incentive.update_attributes(params[:incentive])\n format.html { redirect_to(@incentive, :notice => 'Incentive was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incentive.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @airlin = Airlin.find(params[:id])\n\n respond_to do |format|\n if @airlin.update_attributes(params[:airlin])\n format.html { redirect_to @airlin, notice: 'Airlin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @airlin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trip_enrollment = TripEnrollment.find(params[:id])\n\n respond_to do |format|\n if @trip_enrollment.update_attributes(params[:trip_enrollment])\n flash[:notice] = 'TripEnrollment was successfully updated.'\n format.html { redirect_to(@trip_enrollment) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @trip_enrollment.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put(path, params={})\n RestClient.put request_base+path, params\n end",
"def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end",
"def update\n update_resource_response(@headline, headline_params)\n end",
"def update\n @island = Island.find(params[:id])\n\n respond_to do |format|\n if @island.update_attributes(params[:island])\n flash[:notice] = 'Island was successfully updated.'\n format.html { redirect_to(@island) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @island.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @iine.update(iine_params)\n format.html { redirect_to @iine, notice: 'Iine was successfully updated.' }\n format.json { render :show, status: :ok, location: @iine }\n else\n format.html { render :edit }\n format.json { render json: @iine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @county = County.find(params[:id])\n\n respond_to do |format|\n if @county.update_attributes(params[:county])\n flash[:notice] = 'County was successfully updated.'\n format.html { redirect_to(@county) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @county.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @itinerary = Itinerary.find(params[:id])\n @itinerary.destroy\n\n respond_to do |format|\n format.html { redirect_to(itineraries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @itinerary = Itinerary.find(params[:id])\n @itinerary.destroy\n\n respond_to do |format|\n format.html { redirect_to(itineraries_url) }\n format.xml { head :ok }\n end\n end",
"def set_itinerary\n @participant = Participant.find(params[:participant_id])\n @itinerary = @participant.itinerary\n end",
"def put!\n request! :put\n end",
"def update\n @anniversary = Anniversary.find(params[:id])\n\n respond_to do |format|\n if @anniversary.update_attributes(params[:anniversary])\n format.html { redirect_to @anniversary, notice: 'Anniversary was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @anniversary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend",
"def update\n @intelligence = Intelligence.find(params[:id])\n\n respond_to do |format|\n if @intelligence.update_attributes(params[:intelligence])\n flash[:notice] = 'Intelligence was successfully updated.'\n format.html { redirect_to(intelligences_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @intelligence.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n put :update\n end",
"def _update(type, current_name, metadata={})\n type = type.to_s.camelize\n request :update do |soap|\n soap.body = {\n :metadata => {\n :current_name => current_name,\n :metadata => prepare(metadata),\n :attributes! => { :metadata => { 'xsi:type' => \"ins0:#{type}\" } }\n }\n }\n end\n end",
"def update\n @taxinomy = Taxinomy.find(params[:id])\n\n respond_to do |format|\n if @taxinomy.update_attributes(params[:taxinomy])\n format.html { redirect_to @taxinomy, notice: 'Taxinomy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxinomy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sitetype = Sitetype.find(params[:id])\n\n respond_to do |format|\n if @sitetype.update_attributes(params[:sitetype])\n flash[:notice] = 'Sitetype was successfully updated.'\n format.html { redirect_to(@sitetype) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitetype.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n if @sitio.update_attributes(params[:sitio])\n format.html { redirect_to(@sitio, :notice => 'Sitio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sitio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @ii_i = IiI.find(params[:id])\n\n respond_to do |format|\n if @ii_i.update_attributes(params[:ii_i])\n format.html { redirect_to(@ii_i, :notice => 'Ii i was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ii_i.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @intake = Intake.find(params[:id])\n\n respond_to do |format|\n if @intake.update_attributes(params[:intake])\n format.html { redirect_to @intake, notice: 'Intake was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @intake.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n @webinar = Webinar.find(params[:id])\n\n respond_to do |format|\n if @webinar.update_attributes(params[:webinar])\n flash[:notice] = 'Webinar was successfully updated.'\n format.html { redirect_to(@webinar) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @webinar.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @inventory = Inventory.find(params[:id])\n @inventory.subtotal = (params[:inventory][:qty].to_f*@inventory.unit_price) if params[:inventory][:qty].present?\n if @inventory.update_attributes(params[:inventory])\n @inventories = current_company.inventories\n response_message = {:message => \"Item was updated successfully.\", :inventory => @inventory}\n else\n response_message = {:message => \"Please try again\"}\n end\n respond_to do |format|\n format.xml{render :xml => response_message }\n format.json{ render :json => response_message }\n end\n end",
"def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @irb = Irb.find(params[:id])\n\n respond_to do |format|\n if @irb.update_attributes(params[:irb])\n format.html { redirect_to(@irb, :notice => 'Irb was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @irb.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @taxirequest = Taxirequest.find(params[:id])\n\n respond_to do |format|\n if @taxirequest.update_attributes(params[:taxirequest])\n format.html { redirect_to @taxirequest, notice: 'Taxirequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxirequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @industry = Industry.find(params[:id])\n\n respond_to do |format|\n if @industry.update_attributes(params[:industry])\n flash[:notice] = 'Industry was successfully updated.'\n format.html { redirect_to(@industry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @industry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @instructor1 = Instructor1.find(params[:id])\n\n respond_to do |format|\n if @instructor1.update_attributes(params[:instructor1])\n format.html { redirect_to @instructor1, notice: 'Instructor1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @instructor1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n\n respond_to do |format|\n if @instrument_version.update_attributes(params[:instrument_version])\n flash[:notice] = 'InstrumentVersion was successfully updated.'\n format.html { redirect_to(@instrument_version) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_version.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @inning = Inning.find(params[:id])\n\n respond_to do |format|\n if @inning.update_attributes(params[:inning])\n format.html { redirect_to @inning, notice: 'Inning was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inning.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end",
"def update\n @taxi = Taxi.find(params[:id])\n\n respond_to do |format|\n if @taxi.update_attributes(params[:taxi])\n format.html { redirect_to @taxi, notice: 'Taxi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @taxi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @itineraries = Itinerary.all\n end",
"def index\n @itineraries = Itinerary.all\n end",
"def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end",
"def update\n @insurer = Insurer.find(params[:id])\n\n respond_to do |format|\n if @insurer.update_attributes(params[:insurer])\n format.html { redirect_to(@insurer, :notice => 'Insurer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @insurer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @initiary = Initiary.find(params[:id])\n\n respond_to do |format|\n if @initiary.update_attributes(params[:initiary])\n format.html { redirect_to(@initiary, :notice => 'Initiary was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @initiary.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 @rip = Rip.find(params[:id])\n respond_to do |format|\n if @rip.update_attributes(params[:rip])\n format.html { redirect_to rip_url(@rip) }\n format.xml { head :ok }\n else\n format.html { render :action => 'edit' }\n format.xml { render :xml => @rip.errors.to_xml }\n end\n end\n end",
"def update\n @issuer = Issuer.find(params[:id])\n\n respond_to do |format|\n if @issuer.update_attributes(params[:issuer])\n format.html { redirect_to issuers_path, notice: 'Issuer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @issuer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @invite_request = InviteRequest.find(params[:id])\n\n respond_to do |format|\n if @invite_request.update_attributes(params[:invite_request])\n flash[:notice] = 'InviteRequest was successfully updated.'\n format.html { redirect_to(@invite_request) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @invite_request.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @index = Indice.find(params[:id])\n\n respond_to do |format|\n if @index.update_attributes(params[:index])\n format.html { redirect_to(@index, :notice => 'Indice was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @index.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6382612",
"0.6382612",
"0.60382825",
"0.5923111",
"0.5890764",
"0.5890764",
"0.5890764",
"0.5890764",
"0.5890764",
"0.58807003",
"0.58211637",
"0.58105433",
"0.5786504",
"0.5738078",
"0.5725107",
"0.5702062",
"0.56957644",
"0.5679039",
"0.56260663",
"0.561253",
"0.5588719",
"0.5579057",
"0.5550732",
"0.549947",
"0.54921377",
"0.5491253",
"0.54902864",
"0.5490057",
"0.5483062",
"0.54820544",
"0.54820544",
"0.5474844",
"0.54706955",
"0.5464509",
"0.54499215",
"0.5437539",
"0.5435947",
"0.5422765",
"0.54223776",
"0.5422309",
"0.5414652",
"0.5410888",
"0.5410304",
"0.5395951",
"0.53939825",
"0.53850526",
"0.53669304",
"0.53501844",
"0.5341652",
"0.5332669",
"0.5323028",
"0.5322281",
"0.5322017",
"0.532074",
"0.5315895",
"0.5314586",
"0.5314104",
"0.53123665",
"0.5312247",
"0.5304861",
"0.52953523",
"0.5282905",
"0.52810603",
"0.52810603",
"0.5270539",
"0.5267966",
"0.5260259",
"0.5246773",
"0.5242405",
"0.5241089",
"0.5239286",
"0.5239199",
"0.52359",
"0.52311116",
"0.5231081",
"0.5225194",
"0.52235353",
"0.5219404",
"0.5217302",
"0.52168703",
"0.52123547",
"0.52120864",
"0.52106386",
"0.52067846",
"0.52051836",
"0.51997286",
"0.5198361",
"0.5198323",
"0.51858485",
"0.51844317",
"0.5183689",
"0.5183689",
"0.51833034",
"0.51763976",
"0.5175865",
"0.5173659",
"0.5172242",
"0.5171434",
"0.5168584",
"0.5167354"
] |
0.63508064
|
2
|
DELETE /itineraries/1 DELETE /itineraries/1.xml
|
def destroy
@itinerary = Itinerary.find(params[:id])
@itinerary.destroy
respond_to do |format|
format.html {
if params[:travel_id]
redirect_to admin_travels_path
else
redirect_to(admin_itineraries_url)
end
}
format.xml { head :ok }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @itinerary = Itinerary.find(params[:id])\n @itinerary.destroy\n\n respond_to do |format|\n format.html { redirect_to(itineraries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @itinerary = Itinerary.find(params[:id])\n @itinerary.destroy\n\n respond_to do |format|\n format.html { redirect_to(itineraries_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\t\titinerary = Itinerary.find(params[:id])\n\t\titinerary.destroy\n\tend",
"def delete!\n Recliner.delete(uri)\n end",
"def delete\n Iterable.request(conf, base_path).delete\n end",
"def destroy\n @itinerary = Itinerary.find(params[:id])\n @move = Move.find(params[:move_id])\n @itinerary.destroy\n\n respond_to do |format|\n format.html { redirect_to(itineraries_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @request = Request.find(params[:id])\n @request_items = @request.request_items\n @request_items.each do |ri|\n ri.destroy\n end\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @itinerary = Itinerary.find(params[:id])\n @itinerary.destroy\n\n respond_to do |format|\n format.json { head :no_content }\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 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 @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @initiary = Initiary.find(params[:id])\n @initiary.destroy\n\n respond_to do |format|\n format.html { redirect_to(initiaries_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @itinerary.destroy\n respond_to do |format|\n format.html { redirect_to itineraries_url, notice: 'Itinerary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @itinerary.destroy\n respond_to do |format|\n format.html { redirect_to itineraries_url, notice: 'Itinerary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @relatorio = Relatorio.find(params[:id])\n @relatorio.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end",
"def delete_all(xpath); end",
"def destroy\n @invoiceline = Invoiceline.find(params[:id])\n @invoiceline.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoicelines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_itinerary.destroy\n respond_to do |format|\n format.html { redirect_to admin_itineraries_url, notice: 'Itinerari cancellata con successo!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @itinerary.destroy\n respond_to do |format|\n format.html { redirect_to itineraries_url, notice: \"Itinerary was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete_isbn_association(org_unit_id, isbn) # DELETE\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/content/isbn/#{isbn}\"\n _delete(query_string)\nend",
"def destroy\n @irb = Irb.find(params[:id])\n @irb.destroy\n\n respond_to do |format|\n format.html { redirect_to(irb_url) }\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 @estimate_line_item = EstimateLineItem.find(params[:id])\n @estimate_line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(estimate_line_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end",
"def destroy\n @itinerary.destroy\n respond_to do |format|\n format.html { redirect_to itineraries_url, notice: \"Itinerary was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def remove_item(id)\n return nil if self.class.mode == :sandbox\n\n query = { \"type\" => \"delete\", \"id\" => id.to_s, \"version\" => Time.now.to_i }\n doc_request query\n end",
"def destroy\n @instancia_item = InstanciaItem.find(params[:id])\n @instancia_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(instancia_items_url) }\n format.xml { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @lineaedesal = Lineaedesal.find(params[:id])\n @lineaedesal.destroy\n\n respond_to do |format|\n format.html { redirect_to(lineaedesals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @trip_enrollment = TripEnrollment.find(params[:id])\n @trip_enrollment.destroy\n\n respond_to do |format|\n format.html { redirect_to(trip_enrollments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end",
"def delete(*uris); end",
"def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @itenary.destroy\n respond_to do |format|\n format.html { redirect_to itenaries_url, notice: 'Itenary was successfully destroyed.' }\n format.json { head :no_content }\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 delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def delete(id)\r\n connection.delete(\"/#{@doctype}[@ino:id=#{id}]\")\r\n end",
"def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\n end",
"def destroy\n @airline = Airline.find(params[:id])\n @airline.destroy\n\n respond_to do |format|\n format.html { redirect_to(airlines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lek = Lek.find(params[:id])\n @lek.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(leks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @technician = Technician.find(params[:id])\n @technician.destroy\n\n respond_to do |format|\n format.html { redirect_to(technicians_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n client = Connection::MarkLogic.new.client\n client.send_corona_request(\"/v1/documents?uri=/amandments/amandment_#{@amandment.id}.xml\", :delete)\n @amandment.destroy\n respond_to do |format|\n format.html { redirect_to home_meeting_path, notice: 'Amandman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n node = @job.nodes.find(params[:id])\n @job.nodes.delete(node)\n\n respond_to do |format|\n format.html { redirect_to job_url(@job) }\n format.xml { head :ok }\n end\n end",
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.repairs.each do |repair|\n repair.invoice_id = nil\n repair.save!\n end\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend",
"def delete!\n\t\t\tClient.delete @root\n\t\tend",
"def destroy\n @ingredience = Ingredience.find(params[:id])\n @ingredience.destroy\n\n respond_to do |format|\n format.html { redirect_to(ingrediences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def destroy\n @calorie_intake = CalorieIntake.find(params[:id])\n @calorie_intake.destroy\n respond_to do |format|\n format.html { redirect_to(calorie_intakes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @alumini = Alumini.find(params[:id])\n @alumini.destroy\n\n respond_to do |format|\n format.html { redirect_to(aluminis_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @enrollment = Enrollment.find(params[:id])\n @enrollment.destroy\n\n respond_to do |format|\n format.html { redirect_to(enrollment_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def delete\n \n end",
"def delete\n start { |connection| connection.request http :Delete }\n end",
"def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\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 @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 destroy()\n urn_check()\n @sparql.delete([ @urn, :p, :o ])\n @sparql.delete([ :s, :p, @urn ])\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def destroy\n @renewal = Renewal.find(params[:id])\n @renewal.destroy\n\n respond_to do |format|\n format.html { redirect_to(renewals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy_rest\n @entry_item = EntryItem.find(params[:id])\n @entry_item.destroy\n\n respond_to do |format|\n #format.html { redirect_to(entry_items_url) }\n format.xml { head :ok }\n end\n end",
"def delete_row(row_id); rest_delete(\"#{link('rows')}/#{row_id}\"); nil; end",
"def destroy\n @institute = Institute.find(params[:id])\n @institute.destroy\n\n respond_to do |format|\n format.html { redirect_to(institutes_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 delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def delete()\n @ole.Delete()\n end",
"def destroy\n @installation = Installation.find(params[:installation_id]) \n @eat = Eat.find(params[:id])\n @eat.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.xml { head :ok }\n end\n end",
"def destroy\n @interviews_it = Interviews::It.find(params[:id])\n @interviews_it.destroy\n\n respond_to do |format|\n format.html { redirect_to(interviews_its_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @stepsix = Stepsix.find(params[:id])\n @stepsix.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepsixes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @cabo_eleitoral = CaboEleitoral.find(params[:id])\n @cabo_eleitoral.destroy\n\n respond_to do |format|\n format.html { redirect_to(cabo_eleitorals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @intelligence = Intelligence.find(params[:id])\n @intelligence.destroy\n\n respond_to do |format|\n format.html { redirect_to(intelligences_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @settlement = @transaction.settlements.find(params[:id])\n @settlement.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_transaction_settlements_url(@client, @transaction)) }\n format.xml { head :ok }\n end\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 destroy\n @county = County.find(params[:id])\n @county.destroy\n\n respond_to do |format|\n format.html { redirect_to(counties_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @identity = Identity.find(params[:id])\n @identity.destroy\n\n respond_to do |format|\n format.html { redirect_to(identities_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @attri = Attri.find(params[:id])\n @attri.destroy\n\n respond_to do |format|\n format.html { redirect_to attris_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @intake = Intake.find(params[:id])\n @intake.destroy\n\n respond_to do |format|\n format.html { redirect_to(intakes_url) }\n format.xml { head :ok }\n end\n end",
"def test_delete_invoice_resource\n resource = :offer\n\n x = Billomat.res(resource).last\n id = x.id\n\n client_id = x.client_id\n\n x.destroy\n\n assert_raise ActiveResource::ResourceNotFound do\n Billomat.res(resource).find(id)\n end\n\n # Clean up the client created in test_create_invoice_resource\n Billomat.res(:client).find(client_id).destroy\n end",
"def destroy\n @ii_i = IiI.find(params[:id])\n @ii_i.destroy\n\n respond_to do |format|\n format.html { redirect_to(ii_is_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @addition = Addition.find(params[:id])\n @addition.destroy\n\n respond_to do |format|\n format.html { redirect_to(additions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @az_invoice = AzInvoice.find(params[:id])\n @az_invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_invoices_url) }\n format.xml { head :ok }\n end\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 @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to(subways_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n \n end",
"def destroy\n @meant_it_rel = MeantItRel.find(params[:id])\n @meant_it_rel.destroy\n\n respond_to do |format|\n format.html { redirect_to(meant_it_rels_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invite_request = InviteRequest.find(params[:id])\n @invite_request.destroy\n\n respond_to do |format|\n format.html { redirect_to(invite_requests_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to(invoices_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.69956183",
"0.69956183",
"0.6743824",
"0.65382975",
"0.6467187",
"0.63320094",
"0.6329817",
"0.6221559",
"0.61887836",
"0.6125579",
"0.6121814",
"0.6095245",
"0.60870564",
"0.6049358",
"0.60270804",
"0.60270804",
"0.60229075",
"0.60191625",
"0.6019059",
"0.60128295",
"0.6006723",
"0.60033727",
"0.6001077",
"0.5986106",
"0.5966339",
"0.5957591",
"0.59526736",
"0.59482634",
"0.5926853",
"0.59160334",
"0.59090924",
"0.589744",
"0.58884144",
"0.58862954",
"0.5879942",
"0.58704615",
"0.5867053",
"0.58570033",
"0.58550334",
"0.58503735",
"0.5846464",
"0.58346593",
"0.5813948",
"0.5806739",
"0.58061695",
"0.57937187",
"0.5792736",
"0.5787107",
"0.5782376",
"0.57808304",
"0.5775353",
"0.5774897",
"0.57745856",
"0.5769657",
"0.57693905",
"0.5767716",
"0.5765838",
"0.57604223",
"0.57604223",
"0.57592285",
"0.57581973",
"0.5757541",
"0.57574856",
"0.57574856",
"0.57531214",
"0.5743479",
"0.5742118",
"0.5740297",
"0.5735821",
"0.5729643",
"0.5728231",
"0.5728231",
"0.5728231",
"0.5728231",
"0.57282156",
"0.5727979",
"0.57254446",
"0.5724176",
"0.57224584",
"0.57221735",
"0.5720984",
"0.57178843",
"0.5716501",
"0.5716158",
"0.57154053",
"0.57146144",
"0.5714097",
"0.57112175",
"0.57112044",
"0.57059234",
"0.5705087",
"0.57042426",
"0.57033503",
"0.5701889",
"0.57018095",
"0.5701765",
"0.56988573",
"0.5696294",
"0.5693675",
"0.5693675"
] |
0.61605877
|
9
|
private means that the methods defined here are internal to the object. (You can feed your dragon, but you can't ask him whether he's hungry)
|
def hungry?
@stuff_in_belly <= 2
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def private_method; end",
"def a_private_method\n\tend",
"def internal_methods; end",
"def private_method\n\tend",
"def private_method\n\tend",
"def a_private_method\n end",
"def private_method\n end",
"def method_missing(wh,*therest)\n # xxx internal methods must be protected at some point\n end",
"def internal; end",
"def private_method\n end",
"def private; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def public_method; end",
"def methods() end",
"def private_methods(all=true) end",
"def accessibility; end",
"def silly_adjective; end",
"def other_public_method\n end",
"def jack_handey; end",
"def method3 # will be 'private'\r\n\t\t# ...\r\n\tend",
"def internal?; end",
"def public; end",
"def public; end",
"def public_method_here\n\t# stuff\nend",
"def private_instance_methods(include_super=true) end",
"def abstract!; end",
"def method3 # will be 'private'\n #...\n end",
"def hidden_apis=(_arg0); end",
"def hidden_apis; end",
"def private=(_); end",
"def method3 # will be 'private'\n #...\n end",
"def not_private\n !self.private\n end",
"def who_we_are\r\n end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def expose; end",
"def implementation; end",
"def implementation; end",
"def runnable_methods; end",
"def runnable_methods; end",
"def dragon; end",
"def dragon; end",
"def dragon; end",
"def whiny; end",
"def troop; end",
"def sharp; accidental; end",
"def main_method3\n puts greet\n puts pr_method1 #private method worked in sub class like protected\n end",
"def unused\n end",
"def private_call?()\n #This is a stub, used for indexing\n end",
"def private_method\n puts \"private_method invoked\"\n end",
"def secret_method_2 # :nodoc:\n end",
"def protected_method\n\tend",
"def method4 # and this will be 'public'\r\n\t\t#...\r\n\tend",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def protected_method\n end",
"def bake_n_eat\n # we can only call private methods from methods within the class\n # trying to call a private method on an instance will return an error\n p bake\n p eat\n end",
"def starship; end",
"def special\n override\n end",
"def private(*syms) end",
"def my_fare\n\traise NotImplementedError,\n\t \"This class #{self.class.to_s} can not respond to the method::: #{__method__.to_s}\"\n end",
"def invention; end",
"def herald; end",
"def protected_method\n end",
"def demon; end",
"def buzzword; end",
"def buzzword; end",
"def custom; end",
"def custom; end",
"def gounod; end",
"def anchored; end",
"def private?\n !self.public\n end",
"def m2\n# private def m2 ## chamar private in line com def.\n p \"Metodo 2\"\n end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def visibility; end",
"def weber; end",
"def heroine; end",
"def protected_methods(all=true) end",
"def house; end",
"def house; end",
"def public_methods(all=true) end",
"def private_delegate_methods(*symbols); end",
"def spouse; end",
"def print_stuff\n puts \"#{private_method_hello} annnnnd buh-#{private_method_bye}\"\n end",
"def private?\n false\n end",
"def recall; end"
] |
[
"0.75709295",
"0.75308",
"0.72926515",
"0.7290792",
"0.7290792",
"0.7256204",
"0.7248194",
"0.7180161",
"0.71619576",
"0.7072332",
"0.70420307",
"0.6957299",
"0.6957299",
"0.6957299",
"0.6957299",
"0.6798932",
"0.6791247",
"0.6764664",
"0.6747954",
"0.66750795",
"0.6612455",
"0.6607392",
"0.65944636",
"0.65232253",
"0.64896554",
"0.64896554",
"0.6449977",
"0.6436808",
"0.64073193",
"0.6401784",
"0.63761485",
"0.63565266",
"0.634062",
"0.634023",
"0.6334309",
"0.63335323",
"0.63219005",
"0.63219005",
"0.63219005",
"0.63219005",
"0.63219005",
"0.63219005",
"0.63219005",
"0.63219005",
"0.63219005",
"0.63219005",
"0.63219005",
"0.63219005",
"0.6307961",
"0.6302885",
"0.6302885",
"0.6300637",
"0.6300637",
"0.62909615",
"0.62909615",
"0.62909615",
"0.62717813",
"0.62451845",
"0.6228492",
"0.6221952",
"0.6219244",
"0.62148666",
"0.61952245",
"0.61876667",
"0.6182809",
"0.6165605",
"0.6162187",
"0.61570525",
"0.6156741",
"0.6155183",
"0.61498696",
"0.6145814",
"0.61294675",
"0.61203265",
"0.6115037",
"0.6112794",
"0.6092425",
"0.60855263",
"0.60855263",
"0.6082578",
"0.6082578",
"0.6072213",
"0.6071759",
"0.6066548",
"0.60594624",
"0.60470015",
"0.60470015",
"0.60470015",
"0.60470015",
"0.60470015",
"0.6041764",
"0.6040265",
"0.6039218",
"0.6020313",
"0.6020313",
"0.601807",
"0.6015848",
"0.60127866",
"0.6009918",
"0.6009597",
"0.5997274"
] |
0.0
|
-1
|
use a ? if the method returns true or false
|
def poopy?
@stuff_in_intestine >= 8
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def returns_something?; @return_type || !@returned_arguments.empty? end",
"def none?; end",
"def none?; end",
"def none?; end",
"def explicit?; end",
"def maybe; end",
"def result?; end",
"def success?(*) end",
"def ok? \n @funct == nil ? (return false) : (return true)\n end",
"def no? ; false ; end",
"def result?\n false\n end",
"def no? ; true ; end",
"def despined?(*)\n end",
"def success?() end",
"def default?; return !explicit?; end",
"def null?; false end",
"def unknown?; false; end",
"def unknown?; false; end",
"def conditionally(*) end",
"def conditionally(*) end",
"def nil?() end",
"def nil?() end",
"def nil?; false; end",
"def false?(param)\n !true?(param)\n end",
"def single?; false; end",
"def single?; false; end",
"def method_missing(method,*args)\n # if the method ends in ?, then strip it off and see if we\n # respond to the method without the ?\n if (call_method = method.to_s.chomp!(\"?\")) && respond_to?(call_method)\n return send(call_method).nil? ? false : true\n else\n super(method,*args)\n end\n end",
"def result?\n true\n end",
"def false \n \"false\" \n end",
"def false!(msg=nil)\n true\n end",
"def pda?(*)\n end",
"def maybe\n self\n end",
"def value?(value); end",
"def value?(value); end",
"def true(_argvs)\n return nil\n end",
"def optional?\n @optional\n end",
"def conditionally_true\n\t\t!!self\n\tend",
"def value_if_false\n return @value_if_false\n end",
"def sos_piedra?() raise NotImplementedError end",
"def missing?; end",
"def exists?; end",
"def nil?() true; end",
"def returns_nil; end",
"def do_pigs_fly?\n return true,false\nend",
"def is_old? #any tiem you see a method with a ? after it only returns a true or false value\n @age > 80 ? true : false #ternary value\n # the method below\n # if @age > 80\n # true\n # else\n # false\n end",
"def truth?\n truth\n end",
"def pure?\n raise \"Not implemented yet\"\n end",
"def supports_returning?\n false\n end",
"def result_to_get?\n if not @result.nil?\n if @result.downcase == 'true'\n return true\n else\n return false\n end\n else\n return false\n end\n end",
"def missing?; false; end",
"def argument?; end",
"def qwerty\n\t\tfalse\n\tend",
"def right?; end",
"def null?\n false\n end",
"def null?\n false\n end",
"def get?\n @get\n end",
"def true \n \"true\" \n end",
"def single_value?\n raise NotImplementedError\n end",
"def value?(value) true end",
"def internal?; end",
"def is?(*what); end",
"def is?(*what); end",
"def is?(*what); end",
"def usable?; end",
"def simple?\n true\n end",
"def response?(params); end",
"def missed?; end",
"def sos_tijera?() raise NotImplementedError end",
"def ordinary?\n raise \"Not implemented yet\"\n end",
"def positive?; end",
"def absent?; end",
"def none?\n fail NotImplementedError\n end",
"def Bool(arg)\n !!arg\nend",
"def found?\n\t\t\t!!@found\n\t\tend",
"def void_false(*args)\n return false\n end",
"def optional; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def success?; end",
"def conditionally_false\n\t\t!self\n\tend",
"def present?; end",
"def single_value?\n return false\n end",
"def checked?; end",
"def query?\n !qr?\n end",
"def person?\n !!self.person\n end",
"def person?\n !!self.person\n end",
"def to_bool() false end",
"def simple_present; end",
"def good_guess?(val)\n\tval == 42 ? true: false\nend",
"def value?\n return !self.flag?\n end",
"def any?\n false\n end",
"def value?(p0) end",
"def func1 val #missing the symbols for arguments\r\n if val = 1 #missing 1 equal symbol.\r\n return true\r\n else\r\n return false\r\n end\r\nend",
"def drink_milk(thirsty = true)\n return \"I am not thirsty\" if thirsty == false\nend",
"def truth\n\t\t\t\"You can't handle the truth\" ; true\n\t\tend",
"def generic?; true; end",
"def true?\n !false?\n end",
"def aye?\n true\n end"
] |
[
"0.7117324",
"0.70962876",
"0.70962876",
"0.70962876",
"0.703515",
"0.69747925",
"0.693275",
"0.6927996",
"0.6867952",
"0.6851343",
"0.6778832",
"0.6769453",
"0.6763325",
"0.6715651",
"0.67096716",
"0.6693344",
"0.66787106",
"0.66787106",
"0.66654265",
"0.66654265",
"0.6640204",
"0.6640204",
"0.66245884",
"0.6622274",
"0.6618272",
"0.6618272",
"0.66015387",
"0.65759796",
"0.65381104",
"0.6528326",
"0.6519312",
"0.65187657",
"0.65183586",
"0.65183586",
"0.6510061",
"0.65077287",
"0.65044594",
"0.65015125",
"0.64806783",
"0.6469496",
"0.64690113",
"0.64668274",
"0.63874435",
"0.63764095",
"0.6358715",
"0.6349281",
"0.6349111",
"0.6342711",
"0.6332183",
"0.6317033",
"0.6301345",
"0.62646526",
"0.62613064",
"0.62549603",
"0.62549603",
"0.6253157",
"0.62503153",
"0.62390673",
"0.62369674",
"0.6232752",
"0.62295485",
"0.62295485",
"0.62295485",
"0.622797",
"0.62250566",
"0.6217573",
"0.6211334",
"0.6207586",
"0.61985976",
"0.6191579",
"0.6179799",
"0.61795",
"0.6166067",
"0.6165918",
"0.616011",
"0.61454165",
"0.61392176",
"0.61392176",
"0.61392176",
"0.61392176",
"0.61392176",
"0.61392176",
"0.6130588",
"0.61269665",
"0.61265343",
"0.61256635",
"0.6117857",
"0.6116105",
"0.6116105",
"0.6114685",
"0.6113737",
"0.61048394",
"0.60965526",
"0.6086892",
"0.60868466",
"0.6084945",
"0.6081151",
"0.6077897",
"0.6077579",
"0.6073318",
"0.6071951"
] |
0.0
|
-1
|
Confirms a loggedin user.
|
def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please log in."
redirect_to login_url
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end",
"def confirm_logged_in\n \tunless session[:user_id]\n \t\tflash[:notice] = \"Please Log in.\"\n \t\tredirect_to(login_path)\n \tend\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end",
"def confirm\n user = User.find(params[:id])\n authorize user\n if user.state != \"active\"\n user.confirm\n user.make_user_a_member\n\n # assume this type of user just activated someone from somewhere else in the app\n flash['notice'] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end",
"def confirm_logged_in\n unless session[:user_id]\n redirect_to login_path, alert: \"Please log in\"\n end\n end",
"def confirm_user_logged_in\n unless logged_in?\n store_url # So that user is sent to the same URL after they log in\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end",
"def confirm_logged_in\n unless session[:user_id] != nil\n redirect_to root_path\n end\n end",
"def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end",
"def confirm\n if current_visitor && current_visitor.has_role?('admin', 'manager')\n user = User.find(params[:id]) unless params[:id].blank?\n if !params[:id].blank? && user && user.state != \"active\"\n user.confirm!\n user.make_user_a_member\n # assume this type of user just activated someone from somewhere else in the app\n flash[:notice] = \"Activation of #{user.name_and_login} complete.\"\n redirect_to(session[:return_to] || root_path)\n end\n else\n flash[:notice] = \"Please login as an administrator.\"\n redirect_to(root_path)\n end\n end",
"def correct_user\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend",
"def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end",
"def appctrl_confirm_user\n redirect_to( signin_path() ) unless @current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend",
"def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end",
"def switch\n authorize!(:manage, :all)\n user = User.find_by(login: params[:login].upcase)\n if user\n session[:original_user_id] = session[:user_id]\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Sie sind nun der Nutzer mit dem Login #{user.login}.\"\n else\n redirect_to root_url, notice: \"Der Nutzer existiert nicht im System.\"\n end\n end",
"def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def confirm_user\n if session[:user_id]\n return true\n else\n flash[:notice] = \"please login\"\n redirect_to(:controller => 'manage', :action => 'login')\n return false\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end",
"def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend",
"def confirm_logged_in\n unless session[:username]\n redirect_to authenticate_login_path\n else\n true\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend",
"def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) #checks if current_user == @user\n #current_user? defined in session helper\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end",
"def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n redirect_to root_path\n return false # halts the before_action\n else\n return true\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n\n if @user != current_user\n redirect_to(root_path)\n else\n # nothing to do\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end",
"def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless (current_user.id == @user.id)\n end",
"def correct_user\n @user = User.find(params[:id])\n # current_user?() is a sessions_helper method. The user of the params hash has\n # to match the current user or will be redirected to root\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n\t\t@user = User.find(params[ :id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"def confirm_logged_in\r\n unless session[:username]\r\n redirect_to authenticate_index_path\r\n else\r\n true\r\n end\r\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user) # current_user is method in sessions_helper.rb\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end"
] |
[
"0.70087826",
"0.6982988",
"0.6919373",
"0.688131",
"0.6845446",
"0.68326277",
"0.67944413",
"0.67929715",
"0.6642435",
"0.6624581",
"0.66114175",
"0.66022736",
"0.6589018",
"0.65539706",
"0.65349805",
"0.65303934",
"0.6512816",
"0.650312",
"0.64878744",
"0.6487622",
"0.6480418",
"0.6479267",
"0.64705276",
"0.64680994",
"0.64656436",
"0.6457351",
"0.64541256",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.64485556",
"0.6445996",
"0.6437721",
"0.64289176",
"0.64260334",
"0.6424799",
"0.6417934",
"0.64177954",
"0.64163303",
"0.6410097",
"0.6401843",
"0.63820904",
"0.63622755",
"0.63595843",
"0.6355515",
"0.635374",
"0.6351282",
"0.6350864",
"0.63502026",
"0.63502026",
"0.63502026",
"0.6347271",
"0.63426447",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.6342538",
"0.63400817",
"0.63345385",
"0.63329995",
"0.6331134",
"0.6330873",
"0.632984",
"0.6325074",
"0.63200074",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605",
"0.63152605"
] |
0.0
|
-1
|
Confirms the correct user.
|
def correct_user
@user = User.find(params[:id])
redirect_to(root_url) unless current_user?(@user)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end",
"def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end",
"def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end",
"def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end",
"def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end",
"def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end",
"def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user_help?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end",
"def correct_user\n if !is_correct_user\n redirect_to incorrect_user_path_for\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Please don't mess with others' profiles!\"\n # redirect_to root_url\n redirect_to @user\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end",
"def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend",
"def correct_user\n unless @user == current_user\n redirect_to user_notes_path(current_user)\n end\n end",
"def correct_user\n redirect_to(root_url) unless @user == current_user\n end",
"def confirm_with_user\n confirmed = Helper::Util.confirm \"Is this OK? \", true\n return if confirmed\n\n loop do\n Helper::Util.clear\n\n print_identification\n\n say \"<%= color('The following options may be adjusted before continuing.', BOLD) %>\"\n choice = choose do |menu|\n self.class.available_options.reject(&:skip_confirmation).each do |option|\n value = send option.confirm_symbol\n menu.choice \"#{option.label}: #{option.display_value(value)}\"\n end\n\n menu.choice \"Accept and continue\"\n menu.choice \"Quit\"\n menu.readline = true\n menu.prompt = \"What would you like to do?\"\n end\n\n Helper::Util.clear\n\n print_identification\n\n if (option = self.class.available_options.find { |o| choice =~ /^#{Regexp.quote(o.label)}/ })\n loop do\n break if prompt_for_option(option)\n say \"Invalid value for option.\\n\\n\"\n end\n elsif choice =~ /^Accept/\n log\n return\n else\n exit(0)\n end\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end",
"def correct_user(user)\n user == current_user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend",
"def correct_user\n @user = HoacUser.find(params[:id])\n redirect_to(edit_hoac_user_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend",
"def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end",
"def correct_user\n user_id = params[:user_id] || params[:id] || session[:user_id]\n @user = User.find_by(id: user_id)\n unless @user.nil?\n unless current_user?(@user) || current_user.administrator?\n flash[:danger] = \"Only the account owner or an adminstrator to do that.\"\n redirect_to(root_path)\n end\n else\n nonexistent_user_error\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:user_id])\n unless current_user?(@user)\n flash[:danger] = \"You don't have permission for that action.\"\n redirect_to(root_url)\n end\n end",
"def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end",
"def correct_user\n @user = User.find(params[:id])\n logger.debug \"***correct_user - Detected User - #{@user.name}\"\n redirect_to(root_url) unless current_user?(@user) || admin_user\n end",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend",
"def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end",
"def correct_user\n redirect_to(root_url) unless current_user?(@user)\n end",
"def correct_user\n @user = User.find(params[:id])\n redirect_to root_url, notice: \"You do not have permission to view or edit this information because it isn't yours.\" unless current_user?(@user)\n end",
"def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end"
] |
[
"0.7474259",
"0.73411936",
"0.7317917",
"0.7183303",
"0.7174887",
"0.7049758",
"0.70130193",
"0.7012358",
"0.7006517",
"0.7006201",
"0.7003461",
"0.69663024",
"0.69136065",
"0.6911695",
"0.690295",
"0.6892608",
"0.68439376",
"0.6842948",
"0.68397075",
"0.683463",
"0.6826711",
"0.6825813",
"0.6811448",
"0.680094",
"0.67988366",
"0.6793706",
"0.67789406",
"0.67666626",
"0.67421",
"0.6740984",
"0.6740906",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6736732",
"0.6732851",
"0.67279315",
"0.6725006",
"0.6723821",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.67211986",
"0.6720861",
"0.6715527",
"0.6711952",
"0.6684064",
"0.66769403",
"0.66658443",
"0.6663128",
"0.6663128",
"0.6663128",
"0.66540176",
"0.6653203",
"0.66520107",
"0.664873",
"0.66435707"
] |
0.6658565
|
86
|
Confirms an admin user.
|
def admin_user
redirect_to(root_url) unless current_user.admin?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def confirm_admin\n \tunless session[:admin]\n \t\tflash[:notice] = \"You are not an admin.\"\n \t\tredirect_to(user_path( :id => session[:user_id]))\n \tend\n end",
"def admin_user\n\t\t\tflash_text = \"Administrative privilege required to perform this action.\"\n\t\t\tflash[:danger] = flash_text unless current_user.admin?\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n if user_signed_in? && current_user.adminrole?\n flash.now[:success] = \"Admin Access Granted\"\n else\n redirect_to root_path\n end\n end",
"def admin_user\n if(!current_user.admin?)\n flash[:danger] = \"Access Denied. Admin required\"\n redirect_to root_url\n end\n end",
"def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_url) and flash[:danger] = \"Only admins can do that!\" unless current_user.admin?\n\n end",
"def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end",
"def admin\n unless current_user.admin?\n flash[:danger] = \"Sorry, you must be an admin to do that.\"\n redirect_to user_path(current_user)\n end\n end",
"def confirm_admin\n @confirm_admin = true if session[:role_name] == 'Administrator'\n end",
"def confirm_admin\n redirect_to root_path unless current_user.admin?\n end",
"def admin_user\n unless current_user.admin?\n flash[:danger] = \"You do not have the permission to do that.\"\n redirect_to home_path\n end\n end",
"def admin_user\n\t unless current_user.admin?\n flash[:danger] = \"Log in as Admin.\"\n redirect_to(root_url)\n\t end \n\t end",
"def admin_user\n unless current_user && current_user.admin?\n store_location\n flash[:danger] = \"Please log in as admin.\"\n redirect_to users_url\n end\n end",
"def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end",
"def admin_user\n\t\tunless admin? \n\t\t\tflash[:danger] = \"Only administrators have access to this page\"\n\t\t\tredirect_back_or(root_url) \n\t\tend\n\tend",
"def admin_user!\n unless signed_in? and current_user.admin?\n\t flash[:notice]=\"Por favor inicie sesión como administrador\".encode('UTF-8')\n\t redirect_back(fallback_location: root_path) \n end\n end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end",
"def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_path) unless current_user.try(:admin?) || current_user?(@user)\n end",
"def verify_admin\n if !current_user.present? || current_user.email != I18n.t('general.admin_email')\n redirect_to concerts_path\n flash[:notice] = I18n.t('general.log_as_admin')\n end\n end",
"def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\n end",
"def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end",
"def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless !current_user?(@user) && current_user.admin?\n end",
"def admin_user\n \n unless current_user.admin?\n \tflash[:danger] = \"Please log in with the correct user name.\"\n \tredirect_to(root_url)\n end\n end",
"def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end",
"def admin_user\n redirect_to(root_path) unless is_admin?\n end",
"def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend",
"def admin\n unless current_user.admin?\n redirect_to root_url\n flash[:danger] = \"You have no access here\"\n end\n end",
"def admin_user\n if logged_in?\n redirect_to(root_url) unless current_user.admin?\n else\n flash[:danger] = \"You reached an invalid url and have been redirected to the home page.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end",
"def admin_user\n if (!current_user || current_user.username != 'admin')\n redirect_to(root_url)\n end\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end",
"def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end",
"def correct_user\n @userAdmin = UserAdmin.find(params[:id])\n unless current_user?(@userAdmin)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end",
"def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end",
"def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(root_path) unless current_user.admin?\n end",
"def admin\n\t\tauthenticate_user!\n\t if current_user.admin\n\t\t return\n\t else\n\t\t redirect_to root_url\n\t end\n\tend",
"def check_admin_user\n unless current_user && current_user.privilege_admin?\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end",
"def verify_admin_of_user\n redirect_to admins_path,\n flash: { alert: I18n.t(\"administrator.flash.unauthorized\") } unless current_user.admin_of?(@user, \"can_manage_users\")\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end",
"def admin_user\n unless admin_user?\n redirect_to login_url\n end\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end",
"def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end",
"def admin_user\n redirect_to(current_user) unless current_user.admin?\n end",
"def admin!\n redirect_to root_path, alert: \"Not authorized\" and return unless is_admin?\n end",
"def admin_user\n redirect_to(root_url) unless current_user.admin? # se current_user.admin for falso redireciona para pagina principal\n end",
"def authenticate_admin\n\t\tauthenticate_user!\n\t\tunless current_user.approved == 1\n\t\t\tsign_out\n\t\t\tflash[:error] = \"User is not admin! Try again using another username!\"\n\t\t\tredirect_to new_user_session_path\n\t\t\t# redirect_to new_user_session_path\n\t\tend\n\tend",
"def correct_admin\n @admin_admin = Admin::Admin.find(params[:id])\n redirect_to(admin_admins_path) unless current_user?(@admin_admin)\n end",
"def admin_user\n unless logged_in? && current_user.admin?\n redirect_to root_url\n end\n end",
"def req_admin\n unless curr_user.admin\n flash[:danger] = \"You must be admin to go there!\"\n redirect_to root_url\n end\n end"
] |
[
"0.79044944",
"0.767215",
"0.76483077",
"0.76210374",
"0.7605678",
"0.7605678",
"0.75945777",
"0.7588445",
"0.7588445",
"0.7503662",
"0.74675834",
"0.7451482",
"0.7424005",
"0.7411313",
"0.74107665",
"0.7402138",
"0.73993605",
"0.7358812",
"0.7329228",
"0.73179626",
"0.7312765",
"0.72796166",
"0.7269636",
"0.7246544",
"0.72386354",
"0.7231975",
"0.72179013",
"0.7173976",
"0.71720684",
"0.7166012",
"0.71593285",
"0.71537924",
"0.7137113",
"0.7124807",
"0.71221524",
"0.71221524",
"0.7120586",
"0.7120586",
"0.7120474",
"0.7118341",
"0.7118341",
"0.7118329",
"0.7113378",
"0.710956",
"0.710956",
"0.71021533",
"0.71021533",
"0.7098989",
"0.709487",
"0.7092022",
"0.70904475",
"0.70904475",
"0.70904475",
"0.70904475",
"0.7076285",
"0.7067073",
"0.7067073",
"0.7066295",
"0.70532054",
"0.7049086",
"0.7041013",
"0.703546",
"0.70188206",
"0.701779",
"0.70146185"
] |
0.0
|
-1
|
This is where we pull the route out of the submitted slack command eg /tram 96 or tram route 96 will pull out '96' defaults to Route 109 (Montague St)
|
def determine_requested_route(slack_query)
submitted_text = slack_query.to_s
return STOP_INFO[:'96'] if submitted_text.include? '96'
STOP_INFO[:'109']
rescue NoMethodError
STOP_INFO[:'109']
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def route\n @route\n end",
"def get_route\n data = {\n visits: visits,\n fleet: fleet\n }\n\n data[:options] = options if options\n result = Util.send_request(\"POST\", \"vrp\", Routific.token, data)\n RoutificApi::Route.parse(result)\n end",
"def extract_route\n Xhive::Router::Route.find(request.path)\n end",
"def find_route_info(packet, path)\n parts = path.split('/')\n pad = parts.shift\n matched = home(packet, :subsite => true)\n extras = ''\n while (!parts.empty?)\n next_part = parts.shift\n matches = matched.children.first(:slug => next_part)\n if(matches) \n matched = matches\n else\n extras = parts.unshift(next_part).unshift(pad).join('/')\n parts = []\n end\n end\n [extras, matched]\n end",
"def route_for(**url_details)\n @routes.select { |rt| url_details <= rt.url_details }.first\n end",
"def bus_api_getdirections(route)\n url_safe_route = URI.encode(route)\n apiKey = \"UPGw2J5PBxNnF967CAMyHygeB\"\n apiLink = \"http://www.ctabustracker.com/bustime/api/v1/getdirections?key=#{apiKey}&rt=#{url_safe_route}\"\n apiResults = open(apiLink).read\n return Hash.from_xml(apiResults)\n end",
"def route_by_long_name(route_long_name)\n get \"/gtfs/routes/routeLongName/#{route_long_name}\"\n end",
"def route_by_short_name(route_short_name)\n get \"/gtfs/routes/routeShortName/#{route_short_name}\"\n end",
"def route\n return @children['route'][:value]\n end",
"def route14\n end",
"def route(stock_url)\n url=stock_url.split(/\\/+/).join(\"/\")\n @routes.keys.each do |x|\n #@logger.msginfo(\"Main:route:Looking at '#{url}' (#{url[0,@routes[x]['path_length']]}) for '#{x}'\")\n if (x == url[0,@routes[x][\"path_length\"]])\n #@logger.msginfo(\"Main:route: #{@routes[x][\"handler\"].class.to_s} will do '#{url}'\")\n return @routes[x][\"handler\"]\n end\n end\n return nil #Bad, nothing matched\n end",
"def routing_number; end",
"def getCmdForRoute(value)\n param = eval(value)\n operation = param[:op]\n if operation == 'add' || operation == 'del'\n routeCMD = \"route #{operation} -net #{param[:net]} \"\n param.each_pair { |k,v|\n case k\n when :gw\n routeCMD << \"gw #{v} \"\n when :mask\n routeCMD << \"netmask #{v} \"\n end\n }\n routeCMD << \"dev #{@deviceName}\"\n else\n MObject.error \"Route configuration - unknown operation: '#{operation}'\" \n routeCMD = \"route xxx\" # This will raise an error in the calling method\n end\n return routeCMD\n end",
"def find_nearest_route(path)\n\t\t\tpath_parts = path.parts.dup\n\t\t\tloop do\n\t\t\t\troute = routes.navigate(*path_parts)&.first_route\n\t\t\t\tbreak route if route || path_parts.pop.nil?\n\t\t\tend\n\t\tend",
"def direction_same_line( line, route )\n journey = route.join(\", \")\n stop_off = route.last\n stop_on = route.first\n\n route.shift\n stops = route.length\n route.pop\n\n if stops >= 1\n puts `clear`\n puts \"-------------------------------------------------------------\"\n puts\n puts \"Your route #{ journey }\"\n puts\n puts \"Take the: #{ line }\" \n puts \"Get on at: #{stop_on}\"\n puts \"Pass through: #{ route.join(\", \") } \"\n puts \"Get off at: #{ stop_off } \"\n puts\n puts \"There are: #{ stops } stops to your destination\"\n puts\n puts \"-------------------------------------------------------------\"\n \n else\n puts \"Your being a dick\"\n puts \"You are getting on at #{stop_off} and getting off at #{stop_off}\"\n end\nend",
"def get_route_type(rlm_base_url, rlm_username, rlm_password, command, route)\n get_status(rlm_base_url, rlm_username, rlm_password, command, route)\n end",
"def route\n @route ||= Role.available_routes.find {|r| r.conditions[:path_info].to_s == path_info && r.conditions[:request_method].to_s == request_method}\n end",
"def index\n info = ScheduleProcessor.headway_info\n query = params[:text]\n workspace = params[:enterprise_name] || params[:team_domain]\n user_id = params[:user_id]\n\n if query == 'help'\n result = help_response(info[:routes])\n elsif (data = info[:routes].find { |r| r[:id] == query})\n track_event('slash', \"route/#{query}\", user_id, workspace)\n result = route_response(data)\n elsif query == 'delays'\n track_event('slash', 'delays', user_id, workspace)\n result = delays_response(info[:routes])\n else\n track_event('slash', 'default', user_id, workspace)\n result = default_response(info)\n end\n \n render json: result\n end",
"def parse_and_find_distance(full_route)\n cities = full_route.split('-')\n distance=0 \n cities.each_with_index do|city,index|\n if cities[index+1]\n route = prev_find{|route| route.start_city.to_s==city && route.end_city.to_s==cities[index+1]}\n if route\n distance += route.distance.to_i\n else\n return \"No Such Route\"\n end\n end\n end\n distance==0 ? \"No Such Route\" : distance\n end",
"def find_my_routes(*args)\n bounds = args[0][:bounds].nil? ? default_coordinates : args[0][:bounds].dup\n routes = case args[0][:filter]\n when \"recommended\"\n Route.where(:\"overview_points.latlng\".within(:box) => bounds).where(visibility: 'recommended')\n when \"liked\"\n # TODO need to build this\n else # 'my' or blank\n Route.where(:\"overview_points.latlng\".within(:box) => bounds).where(owner_id: id)\n end\n end",
"def getRoutes\n # [[\"MTA NYCT_B65\", \"B65\", \"Downtown Brooklyn - Crown Heights\", \"via Bergen St & Dean St\"]...]\n url = \"http://bustime.mta.info/api/where/routes-for-agency/MTA%20NYCT.xml?key=#{APIKEY}\"\n xml_str = Net::HTTP.get URI(url)\n xml = Nokogiri::XML(xml_str)\n xml.css(\"response data list route\").to_a.map{|rte| [rte.css('id').text, rte.css('shortName').text, rte.css('longName').text, rte.css('description').text]}\nend",
"def route\n #TODO\n end",
"def get(route)\n pattern = route.gsub(/:(\\w+)/, '(?<\\1>[^\\\\/]+)')\n puts pattern # => /hello/(?<name>[^\\/]+)\n end",
"def parse_route(dn, method)\n route, action = @routes.match(\"#{dn},op=#{method.to_s}\")\n if not route or route.empty?\n @logger.warn \"No route defined for \\'#{route}\\'\"\n raise LDAP::ResultError::UnwillingToPerform\n end\n if action.nil?\n @logger.error \"No action defined for route \\'#{route}\\'\"\n raise LDAP::ResultError::UnwillingToPerform\n end\n\n class_name = action.split('#').first\n method_name = action.split('#').last\n\n params = LDAP::Server::DN.new(\"#{dn},op=#{method.to_s}\").parse(route)\n\n return class_name, method_name, params\n end",
"def came_from_route\n @came_from_route\n end",
"def goto(command_line)\n\n route_args = command_line.dup\n route_identifier = route_args.delete(:command)\n\n unless @routes.has_key? route_identifier\n raise RouteNotFound, \"Route for: #{route_identifier} was not found\"\n end\n\n @routes[route_identifier].call command_line\n end",
"def journey_line()\n subway_system = {\n :n_line => [\"Times Square\", \"34th\", \"28th\", \"23rd\", \"Union Square\", \"8th\"],\n :l_line => [\"8th\", \"6th\", \"Union Square\", \"3rd\", \"1st\"],\n :six_line => [\"Grand Central\", \"33rd\", \"28th\", \"23rd\", \"Union Square\", \"Astor Place\"]\n }\n puts \"N Line stations (n_line):\\n #{subway_system[:n_line]}\"\n puts \"\"\n puts \"L Line stations (l_line):\\n #{subway_system[:l_line]}\"\n puts \"\"\n puts \"6 Line stations (six_line):\\n #{subway_system[:six_line]}\"\n print \"\\nLine?\\t\\t\"\n return subway_system[gets.chomp.to_sym]\nend",
"def routes=(_arg0); end",
"def routes=(_arg0); end",
"def routes=(_arg0); end",
"def find(query)\n begin\n answer = \"Unknown Query. We are sorry!! We coludnot answer you\"\n\n case query\n when /^The distance of the route (.+)$/\n distance = parse_and_find_distance($1)\n answer = distance.kind_of?(String) ? distance : query+' is '+distance.to_s\n when /^The length of the shortest route from ([A-Z]{1}) to ([A-Z]{1})$/\n distance = find_shortest_distance($1,$2)\n answer = distance > 0 ? query+' is '+distance.to_s : \"No Such Route\"\n when /^The number of trips starting at ([A-Z]{1}) and ending at ([A-Z]{1}) with a maximum of (\\d+) stops$/\n trips = trip_with_maximum_stops($1,$2,$3)\n answer = query +' are '+trips.size.to_s+\"(#{trips.join(',')})\"\n when /^The number of trips starting at ([A-Z]{1}) and ending at ([A-Z]{1}) with exactly (\\d+) stops$/\n trips = trip_with_maximum_stops($1,$2,$3,'exactly')\n answer = query +' are '+trips.size.to_s+\"(#{trips.join(',')})\"\n when /^The number of different routes from ([A-Z]{1}) to ([A-Z]{1}) with a distance of less than (\\d+)$/\n trips = trip_with_maximum_stops($1,$2,0,false,$3)\n puts \"Here\"\n answer = query +' are '+trips.size.to_s+\"(#{trips.join(',')})\" \n end\n rescue=>e\n puts \"We are sorry due to technical difficulties we can't answer you at present.\"\n end\n answer.to_s\n end",
"def directions(user_address, end_address)\n directions_url = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {:origin => user_address,\n :destination => end_address,\n :sensor => false}\n ).to_s\n\n legs = JSON.parse(RestClient.get(directions_url))[\"routes\"][0][\"legs\"]\n\n directions = legs[0][\"start_address\"] + \"\\n\"\n steps = legs[0][\"steps\"]\n steps.each do |step|\n directions += \"#{Nokogiri::HTML(step[\"html_instructions\"]).text} \" +\n \"[#{step[\"distance\"][\"text\"]}]\\n\"\n end\n directions += legs[0][\"end_address\"]\nend",
"def choose_route(route)\n route.downcase!\n case route\n when \"wyndwood\"\n clear_screen\n spacing\n slowly do\n \"After weighing his options, Duncan trots into the Wyndwood.\"\n end\n sleep(1)\n $game_location = \"wyndwood\"\n when \"house\"\n clear_screen\n spacing\n slowly do\n \"After weighing his options, Duncan trots toward the house.\" \n end\n sleep(1)\n $game_location = \"house\"\n when \"bridge\"\n clear_screen\n spacing\n slowly do\n \"A feast? Duncan can't resist! He sprints to the bridge!\"\n end\n sleep(1)\n $game_location = \"bridge\"\n else \n puts \"Choose: Wyndwood, house, or bridge.\"\n choose_route(STDIN.gets.chomp!)\n end #end of case statement\n end",
"def get_route 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_get_route_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::Datastream::V1::Route.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def parse_command(line)\n line = line.strip\n if %w(MOVE LEFT RIGHT REPORT).include? line\n return line.downcase\n end\n\n if (line =~ /PLACE/) == 0\n args = line[5..-1].strip.split(',')\n return 'place', *args\n end\nend",
"def get_route_description(route)\n description = {\n \"Oral\" => \"Oral administration of vaccine makes immunization easier by \n eliminating the need for a needle and syringe.\",\n\n \"ID\" => \"Intradermal (ID) injection administers the vaccine in the topmost\n layer of the skin. BCG is the only vaccine with this route of administration. \n Intradermal injection of BCG vaccine reduces the risk of neurovascular injury.\n A short narrow needle (15 mm, 26 gauge) is needed for BCG vaccine.\",\n\n \"SC\" => \"Subcutaneous (SC) injection administers the vaccine into the \n subcutaneous layer above the muscle and below the skin. A longer, wider \n needle (commonly 25 mm, 23 gauge) is used.\",\n\n \"IM\" => \"Intramuscular (IM) injection administers the vaccine into the \n muscle mass. Vaccines containing adjuvants should be injected IM to reduce \n adverse local effects. A longer, wider needle (commonly 25 mm, 23 gauge) \n is used.\",\n }\n return description[route]\n end",
"def route_by_id(route_id)\n get \"/gtfs/routes/#{route_id}\"\n end",
"def get_route 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_get_route_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::Datastream::V1alpha1::Route.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def route() request.route end",
"def route(name, group = nil)\n @sets.each { |set|\n if r = set[1].route(name, group)\n return r\n end\n }\n\n raise MissingRoute, \"Could not find route '#{name}'\"\n end",
"def search_routing\n space.team_id\n end",
"def calculate_route\n\t\t@cl = init_loc\n\t\t@steps << cl\n\n\t\twhile not at_rightmost_side?\n\t\t\t@cl = next_step\n\t\t\t@steps << cl\n\t\tend \t\t\n\tend",
"def get_way(id)\n @ways[id.to_i]\n end",
"def get_route_command(path_address,moving_direction)\n cmd_list = []\n \n for i in 0...path_address.size\n curx = path_address[i].x\n cury = path_address[i].y\n \n command_id = 0\n debug_info = \"\"\n case moving_direction[i]\n when 2\n debug_info = \"↓\"\n command_id = 2\n when 4\n debug_info = \"←\"\n command_id = 4\n when 6\n debug_info = \"→\"\n command_id = 6\n when 8\n debug_info = \"↑\"\n command_id = 8\n else\n debug_info = \"O\"\n end #case\n \n puts \"#{debug_info} (#{curx},#{cury})\" if $pathfinding_debug\n if command_id > 0\n #Pixel_Core::Pixel.times{ }\n cmd_list << [command_id, true]\n end # if command_id > 0\n end # for i in path_address.size\n \n return cmd_list\n end",
"def route_onestop_id\n route.onestop_id\n end",
"def routing(rule_name, info)\n\n # Get to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Get to the \"Routing\" page.\n begin\n @ff.link(:text, 'Routing').click\n self.msg(rule_name, :info, 'routing', 'Reached page \\'Routing\\'.')\n rescue\n self.msg(rule_name, :error, 'routing', 'Did not reach \\'Routing\\' page')\n return\n end\n \n # Check the key.\n if ( info.has_key?('section') and info.has_key?('subsection') ) then\n # Right,go on.\n else\n self.msg(rule_name,:error,'routing','Some key NOT found.')\n return\n end\n \n if info.has_key?('Operation') then\n \n\tcase info['Operation']\n\t\n \t##############################\t\n \t# \"New Route\"\n \t##############################\t\n \twhen 'New route'\n\t begin\n\t\t@ff.link(:text,'New Route').click\n\t\tself.msg(rule_name,:info,'Operation','Reached page of \\'Operation\\' route.')\n\t rescue\n\tputs \"baby\"\n\t\tself.msg(rule_name,:error,'Operation','Can not \\'Operation\\' route page.')\t\n\t\treturn\n\t end\n\t \n\t if @ff.text.include?'Route Settings' then\n\t\t# Right,go on;\n\t else\n\t\tself.msg(rule_name,:error,'Route Setting','Does NOT Enter Route Setting page.')\n\t\treturn\n\t end\n\t # Select name for route;\n\t if info.has_key?('Name')\n\t\t\n\t\tcase info['Name']\n\t\t\n\t\t when 'Broadband Connection (Ethernet)'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"Broadband Connection (Ethernet)\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\n\t\t when 'Broadband Connection (Coax)'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"Broadband Connection (Coax)\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\n\t\t when 'WAN PPPoE'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"WAN PPPoE)\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\t\n\t\t when 'WAN PPPoE 2'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"WAN PPPoE 2\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\n\t\t when 'Network (Home/Office)'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"Network (Home/Office)\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\t\t else \n\t\t\t\n\t\t\t# Wrong\n\t\t\tself.msg(rule_name,:error,'Name','Can NOT configure \\'Name\\'.')\n\t\t\treturn\n\t\t \n\t\t end # End of case\n end # End of 'Name'\n\t if info.has_key?('Destination') and info['Destination'].size > 0\n\t\t\n\t\toctets=info['Destination'].split('.')\n\t\t@ff.text_field(:name,'dest0').value=(octets[0])\n\t\t@ff.text_field(:name,'dest1').value=(octets[1])\n\t\t@ff.text_field(:name,'dest2').value=(octets[2])\n\t\t@ff.text_field(:name,'dest3').value=(octets[3])\n\t\tself.msg(rule_name,:info,'Doset_destination',\"Destination = \"+info['Destination'])\n\n\t end\n\t if info.has_key?('Netmask') and info['Netmask'].size > 0\n\t\t\n\t\toctets=info['Netmask'].split('.')\n\t\t@ff.text_field(:name,'netmask0').value=(octets[0])\n\t\t@ff.text_field(:name,'netmask1').value=(octets[1])\n\t\t@ff.text_field(:name,'netmask2').value=(octets[2])\n\t\t@ff.text_field(:name,'netmask3').value=(octets[3])\n\t\tself.msg(rule_name,:info,'Doset_Netmask',\"Netmask = \"+info['Netmask'])\n\n\t end\n\t if info.has_key?('Gateway') and info['Gateway'].size > 0\n\t\t\n\t\toctets=info['Gateway'].split('.')\n\t\t@ff.text_field(:name,'gateway0').value=(octets[0])\n\t\t@ff.text_field(:name,'gateway1').value=(octets[1])\n\t\t@ff.text_field(:name,'gateway2').value=(octets[2])\n\t\t@ff.text_field(:name,'gateway3').value=(octets[3])\n\t\tself.msg(rule_name,:info,'Doset_gateway',\"Gateway = \"+info['Gateway'])\n\n\t end\n\t if info.has_key?('Metric') then\n\t\t\n\t\t@ff.text_field(:name,'metric').value=info['Metric']\n\t\tself.msg(rule_name,:info,'Set metric','Metric value is \\'Metric\\'.')\n\t else\n\t\tself.msg(rule_name,:error,'Set metric','Can Not set metric value to \\'Metric\\'.')\n\t\treturn\n\t end\n\t \n\t # Apply to save new route;\t\t\n\t @ff.link(:text,'Apply').click\n\t self.msg(rule_name,:info,'Apply','\\'Apply\\' to save new route.')\n\n\t if @ff.text.include?'Input Errors'\n\t\t\n\t\t# Find table\n\t\tsTable = false\n\t\t@ff.tables.each do |t|\n\t\t \n\t\t if ( t.text.include? ':' and\n\t\t\t(not t.text.include? 'Input Errors') and \n\t\t\t(not t.text.include? 'Cancel') and\n\t\t\tt.row_count >= 1 ) then\n\t\t\t\tsTable = t\n\t\t\tbreak\n\t\t end\n\t\tend\n\t\t# Wrong here\n\t if sTable == false\n\t\t self.msg(rule_name,:error,'New route','Did NOT find the target table.')\n\t\t return\n\t\tend\n\t\t\n\t\tsTable.each do |row|\n\t\t\t\n\t\t if row[1] == \"\" or row[2] == nil\n\t\t next\n\t\t end\n\t\n\t\t self.msg(rule_name,:error,row[1],row[2])\n\t\tend\n\n\t\t# Cancel\n\t\t@ff.link(:text,'Cancel').click\n\t\treturn\n\t \n\t end # end of 'Input Error'\t\t\t\n\t##############################\t\n \t# \"Multi Route\"\n \t##############################\t\n \twhen 'Multi route'\n\t \n\t if info.has_key?('Max route') then\n\t\tself.msg(rule_name,:info,'Multi route','Go on adding multi-route and Max route is : \\'Max route\\'.')\n\t end\n\t count=1\t\n\t \n\t if info.has_key?('Destination') and info['Destination'].size > 0\n\t\toctets=info['Destination'].split('.')\n\n\t\toctets2=(octets[2]).to_i\n\t\t#puts \"#{octets2}\"\n\t\toctets3=(octets[3]).to_i\n\t\t#puts \"#{octets3}\"\n\t\tself.msg(rule_name,:info,'Get address of destination',\"Destination = \"+info['Destination'])\n\t end\n\t \n\t while count <= info['Max route'].to_i \n\t #for i in octets3.to_i..info['Max route'].to_i\n\t\tbegin\n\t\t @ff.link(:text,'New Route').click\n\t\t self.msg(rule_name,:info,'Operation','Reached page of \\'Operation\\' route.')\n\t\trescue\n\t\t self.msg(rule_name,:error,'Operation','Can not \\'Operation\\' route page.')\t\n\t\t return\n\t\tend\n\t \n\t\tif @ff.text.include?'Route Settings' then\n\t\t # Right,go on;\n\t\telse\n\t\t self.msg(rule_name,:error,'Route Setting','Does NOT Enter Route Setting page.')\n\t\t return\n\t\tend\n\t\t# Select name for route;\n\t\tif info.has_key?('Name')\n\t\t\n\t\t case info['Name']\n\t\t\n\t\t when 'Broadband Connection (Ethernet)'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"Broadband Connection (Ethernet)\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\n\t\t when 'Broadband Connection (Coax)'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"Broadband Connection (Coax)\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\n\t\t when 'WAN PPPoE'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"WAN PPPoE)\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\t\n\t\t when 'WAN PPPoE 2'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"WAN PPPoE 2\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\n\t\t when 'Network (Home/Office)'\n\n\t\t\t# Set name to 'Broadband Connection (Ethernet)'\n\t\t\t@ff.select_list(:name,'combo_device').select(\"Network (Home/Office)\")\t\n\t\t\tself.msg(rule_name,:info,'Name',info['Name'])\n\t\t else \n\t\t\t\n\t\t\t# Wrong\n\t\t\tself.msg(rule_name,:error,'Name','Can NOT configure \\'Name\\'.')\n\t\t\treturn\n\t\t \n\t\t end # End of case\n\t\tend # End of 'Name'\n\t\tif info.has_key?('Destination') and info['Destination'].size > 0\n\t\t\n\t\t octets=info['Destination'].split('.')\n\n\t\t @ff.text_field(:name,'dest0').value=(octets[0])\n\t\t @ff.text_field(:name,'dest1').value=(octets[1])\n\t\t @ff.text_field(:name,'dest2').value=octets2.to_i\n\t\t @ff.text_field(:name,'dest3').value=octets3.to_i\n\t\t self.msg(rule_name,:info,'Doset_destination',\"Destination = \"+info['Destination'])\n\n\t\tend\n\t\tif info.has_key?('Netmask') and info['Netmask'].size > 0\n\t\t\n\t\t octets=info['Netmask'].split('.')\n\t\t @ff.text_field(:name,'netmask0').value=(octets[0])\n\t\t @ff.text_field(:name,'netmask1').value=(octets[1])\n\t\t @ff.text_field(:name,'netmask2').value=(octets[2])\n\t\t @ff.text_field(:name,'netmask3').value=(octets[3])\n\t\t self.msg(rule_name,:info,'Doset_Netmask',\"Netmask = \"+info['Netmask'])\n\n\t\tend\n\t\tif info.has_key?('Gateway') and info['Gateway'].size > 0\n\t\t\n\t\t octets=info['Gateway'].split('.')\n\t\t @ff.text_field(:name,'gateway0').value=(octets[0])\n\t\t @ff.text_field(:name,'gateway1').value=(octets[1])\n\t\t @ff.text_field(:name,'gateway2').value=(octets[2])\n\t\t @ff.text_field(:name,'gateway3').value=(octets[3])\n\t\t self.msg(rule_name,:info,'Doset_gateway',\"Gateway = \"+info['Gateway'])\n\n\t\tend\n\t\tif info.has_key?('Metric') then\n\t\t\n\t\t @ff.text_field(:name,'metric').value=info['Metric']\n\t\t self.msg(rule_name,:info,'Set metric','Metric value is \\'Metric\\'.')\n\t\telse\n\t\t self.msg(rule_name,:error,'Set metric','Can Not set metric value to \\'Metric\\'.')\n\t\t return\n\t\tend # End of if\n\n\t\t# Apply to save new route;\t\t\n\t\t@ff.link(:text,'Apply').click\n\t\tself.msg(rule_name,:info,'Apply','\\'Apply\\' to save new route.')\n\n\t\tif @ff.text.include?'Input Errors'\n\t\t\n\t\t # Find table\n\t\t sTable = false\n\t\t @ff.tables.each do |t|\n\t\t \n\t\t\t if ( t.text.include? ':' and\n\t\t\t (not t.text.include? 'Input Errors') and \n\t\t\t (not t.text.include? 'Cancel') and\n\t\t\t t.row_count >= 1 ) then\n\t\t\t\t sTable = t\n\t\t\t break\n\t\t\t end\n\t\t end\n\t\t # Wrong here\n\t\t if sTable == false\n\t\t\tself.msg(rule_name,:error,'New route','Did NOT find the target table.')\n\t\t\treturn\n\t\t end\n\t\t\n\t\t sTable.each do |row|\n\t\t\t\n\t\t\tif row[1] == \"\" or row[2] == nil\n\t\t\tnext\n\t\t\tend\n\t\n\t\t\tself.msg(rule_name,:error,row[1],row[2])\n\t\t end\n\n\t\t # Cancel\n\t\t @ff.link(:text,'Cancel').click\n\t\t return\n\t \n\t\tend # end of 'Input Error'\n\t\t\n\t\tcount = count + 1\n\t\tputs \"Adding the No.#{count} route.\"\n\t\toctets3 = octets3 + 1\n\t\t#puts octets3\n\t\t# re-setup ipaddress when the ipaddress over 254;\n\t\tif octets3 == 255 then\n\t\t octets3 = 1\n\t\t octets2 = octets2 + 1\n\t\tend\n\t end # End of while\n\n \t##############################\t\n \t# \"del Route\"\n \t##############################\n \twhen 'del route'\n\t\t\n\t if @ff.text.include?'Routing Table'\n\t\t\n\t\t# Find route table\n\t\tsTable = false\n\t\t@ff.tables.each do |t|\n\t\t if ( t.text.include? 'Routing Table' and \n\t\t\t(not t.text.include? 'Routing Protocols') and \n\t\t\t(not t.text.include? 'IGMP') and\n\t\t\t(not t.text.include? 'Domain Routing') and \n\t\t\tt.row_count >= 2 ) then\n\t\t\t\tsTable = t\n\t\t\tbreak\n\t\t end\n\t\tend\n\t\t\n\t\t# Wrong here\n\t\tif sTable == false\n\t\t\t\n\t\t\tself.msg(rule_name,:error,'Del route','Can NOT find right route table.')\n\t\t\treturn\n\t\tend\n\n\t\tnum = 0\n\t\tsTable.each do |row|\n\t\t if row[7] != nil then\n\t\t\t# row[7].links.each do |l|\n\t\t\t# puts l.name\n\t\t\t# end\n\t\t\tif row[7].link(:name,'route_remove').exist?\n\t\t\t #puts \"haha\"\n\t\t\t #puts @ff.text_field(:name,row[7]).to_s\n\t\t\t @ff.link(:href,row[7].link(:name,'route_remove').href).click\n\t\t\tend\n\t\t end\t\n\t\t\t\t# Output the result\n\t\t\t\t#self.msg(rule_name,:info,'Name' + num.to_s,row[1])\n\t\t\t\t#self.msg(rule_name,:info,'Destination' + num.to_s,row[2])\n\t\t\t\t#self.msg(rule_name,:info,'Gateway' + num.to_s,row[3])\n\t\t\t\t#self.msg(rule_name,:info,'Netmask' + num.to_s,row[4])\n\t\t\t\t#self.msg(rule_name,:info,'Metric' + num.to_s,row[5])\n\t\t\t\t#self.msg(rule_name,:info,'Status' + num.to_s,row[5])\n\t\t\t\t#num = num + 1\n\t\tend # End of table;\n\n end # End of 'Del route'\n\n\t\t# pasre the table of route\n\t\t# delete these\n\t\tself.msg(rule_name,:info,'Del route','Delete the list is successful. ')\n\telse\n \t# Wrong here.\n \tself.msg(rule_name,:error,'routing','No \\'New Route\\' key.')\n \treturn\n \tend # End of Case\n\n end # End of 'Operation'\n \n #-------------------------------------------#\n # \"Internet Group Management Protocol(IGMP)\"\n #-------------------------------------------#\n if info.has_key?('Internet Group Management Protocol(IGMP)') then\n\t# \"Internet Group Management Protocol(IGMP)\"\n \tcase info['Internet Group Management Protocol(IGMP)']\n \t \n\t when 'on'\n \t# Select mcast_enabled\n \t@ff.checkbox(:name,'mcast_enabled').set\n \tself.msg(rule_name,:info,'Internet Group Management Protocol(IGMP)','on')\n \t when 'off'\n \t# Don't select it.\n \t@ff.checkbox(:name,'mcast_enabled').clear\n \tself.msg(rule_name,:info,'Internet Group Management Protocol(IGMP)','off')\n else\n \t# Wrong here.\n \tself.msg(rule_name,:error,'routing','No \\'Internet Group Management Protocol(IGMP)\\' key.')\n \treturn\n \tend\n\n end # End of 'IGMP'\n\n #-------------------------------------------#\n # \"Domain Routing\"\n #-------------------------------------------#\n if info.has_key?('Domain Routing') then\n \t\n\t# \"Internet Group Management Protocol(IGMP)\"\n \tcase info['Domain Routing']\n \n\t when 'on'\n \t# Select it\n \t@ff.checkbox(:name,'dns_routing_enabled').set\n \tself.msg(rule_name,:info,'Domain Routing','on')\n when 'off'\n \t# Don't select it.\n \t@ff.checkbox(:name,'dns_routing_enabled').clear\n \tself.msg(rule_name,:info,'Domain Routing','off')\n \t else\n \t# Wrong here.\n \tself.msg(rule_name,:error,'routing','No \\'Domain Routing\\' key.')\n \treturn\n \t end\n\n end # End of 'Domain Routing'\n \n # Apply for the change\n @ff.link(:text,'Apply').click\n \n # Jump out an \"attention\" message?\n if @ff.text.include? 'Attention'\n \t@ff.link(:text,'Apply').click\n end\n \n # routing success\n self.msg(rule_name,:info,'Routing','SUCCESS')\n\n \n end",
"def get_routes from, to, options = {}\n options[:start_type] = check_point_type(from) || options[:start_type]\n options[:target_type] = check_point_type(to) || options[:target_type]\n # default options\n options = {\n :time => Time.now, \n :depth => 0, \n :include_coords => true, \n :limit => 2,\n :time_relation => :depature,\n :identify_part_prices => :none }.merge(options)\n\n options[:time] = options[:time].in_time_zone(\"Berlin\") #+ 10.minutes # Ansonsten liegt die erste Verbindung in der Vergangenheit\n page = @agent.get @@options[:url_route]\n \n result = submit_form page.forms.first, from, to, options\t\t\n routes = []\n links = result.links_with(:href => /details=opened!/).select { |l| l.to_s.size > 0} # only select connection links, no warning links\n links.reverse! if options[:time_relation] == :arrival # respect :time_relation for route processing\n \n link_threads = Array.new\n links.each_index do |idx|\n link_threads[idx] = Thread.new {\n # maybe we are too fast in requesting :-)\n (1..5).each do |i|\n page = links[idx].click \n break unless page.title.match(/Fehler/)\n # puts \"link.click error: %i\" % i\n sleep(1)\n end\n Thread.current[:route] = Route.new(page, options)\n }\n break if idx == options[:limit]\n end\n\n link_threads.each { |t| t.abort_on_exception = true}\n routes = link_threads.map { |t| t.join; t[:route] }\n\n # Keine Station gefunden also suchen wir nach der nächstbesten Adresse/Station\n if links.count == 0 && options[:depth] == 0\n if options[:start_type] == :address\n from = find_address(from, options)\n options[:start_type] = from.station_type\n from = from.name\n elsif options[:start_type] == :station\n from = find_station(from, options)\n options[:start_type] = from.station_type\n from = from.name\n end\n \n if options[:target_type] == :address\n to = find_address(to, options)\n options[:target_type] = to.station_type\n to = to.name\n elsif options[:target_type] == :station\n to = find_station(to, options)\n options[:target_type] = to.station_type\n to = to.name\n end\n \n return get_routes from, to, options.merge(:depth => options[:depth]+1)\n end\n \n raise \"no_route\" if routes.count == 0 || links.count == 0\t\t\t\n\n # attach price information for each routepart if necessary\n identify_part_prices(routes, options) unless options[:identify_part_prices] == :none\n \n return routes\n end",
"def get_route_description(route, params)\n @descriptions = {} # Hash to store station code along with station names.\n route.each do |station|\n @stations.each do |line_stations|\n line_stations.each do |line_station|\n if line_station[0] == station\n station_name = line_station[1]\n @descriptions.store(station, station_name)\n end\n end\n end\n end\n route_description = []\n description_index = 0\n @descriptions.each do |key, value|\n route_description << \"Take #{key[0, 2]} line from #{value} to \" unless key == params[:destination]\n unless description_index.zero?\n if route_description[description_index - 1].include? value\n if key == params[:destination] # Checks whether the destination station is a interchange station\n route_description[description_index - 1] = ''\n @timeline.each do |train_line|\n if train_line[0] == params[:destination][0, 2]\n @total_travel_time = (@total_travel_time - train_line[3])\n end\n end\n else\n route_description[description_index - 1] = \"Change from #{@descriptions.keys[description_index - 1][0, 2]} to #{key[0, 2]} line\"\n end\n else\n route_description[description_index - 1] = route_description[description_index - 1] + value\n end\n end\n description_index += 1\n end\n route_description.reject(&:empty?)\n end",
"def routing_key; opt('routing_key'); end",
"def route\n index = @possible_distances.index(@possible_distances.min)\n @array_of_city_arrangements[index]\n end",
"def split\n @original_route.split('/')[1..-1]\n end",
"def bus_api_getstop(route, directions, latitude, longitude)\n\n url_safe_route = URI.encode(route)\n apiKey = \"UPGw2J5PBxNnF967CAMyHygeB\"\n\n directions.each do |direction|\n url_safe_direction = URI.encode(direction)\n apiLink = \"http://www.ctabustracker.com/bustime/api/v1/getstops?key=#{apiKey}&dir=#{url_safe_direction}&rt=#{url_safe_route}\"\n apiResults = Hash.from_xml(open(apiLink).read)\n stops = apiResults[\"bustime_response\"][\"stop\"]\n stops.each do |stop|\n if (stop[\"lat\"][0, 6] == latitude[0, 6] && stop[\"lon\"][0, 7] == longitude[0, 7])\n return stop\n end\n end\n end\n return 0\n end",
"def FollowingMoveRoute(commands,waitComplete=false)\n $PokemonTemp.dependentEvents.SetMoveRoute(commands,waitComplete)\nend",
"def getRoutesTo(station)\n routeList = @toNodeMap[station]\n \n return routeList == nil ? [] : routeList\n end",
"def inspect\n route.to_s\n end",
"def processed_route\n return @original_route unless any_wildcard?\n as_regex\n end",
"def get_match(match)\n fetch(\"match/#{match}\")\n end",
"def direction_parser(word)\n if (word == \"north\" or word == \"n\") and hero.location.north_room\n hero.location = hero.location.north_room\n elsif (word == \"south\" or word == \"s\") and hero.location.south_room\n hero.location = hero.location.south_room\n elsif (word == \"east\" or word == \"e\") and hero.location.east_room\n hero.location = hero.location.east_room\n elsif (word == \"west\" or word == \"w\") and hero.location.west_room\n hero.location = hero.location.west_room\n elsif (word == \"up\" or word == \"u\") and hero.location.up_room\n hero.location = hero.location.up_room\n elsif (word == \"down\" or word == \"d\") and hero.location.down_room\n hero.location = hero.location.down_room\n else\n invalid_direction\n end\n end",
"def bus_route_name\n bus_route.try(:name)\n end",
"def route part = \"/\", params = {}\n File.join('/', part)+\"#depricated\"\n end",
"def task\n\n case @message['tasker']\n when *NATO then route 'nato'\n else route true\n end\n end",
"def route_name; end",
"def route_name; end",
"def routing_key; delivery_details[:routing_key]; end",
"def get_walk_path(goalx, goaly)\n current_track_address = hash_address(goalx,goaly)\n path = []\n path_address = []\n go_dir = []\n path.push(current_track_address)\n \n while @nodes_parent_id[current_track_address]\n path.unshift( @nodes_parent_id[current_track_address] )\n go_dir.unshift( @move_dir[current_track_address] )\n \n current_track_address = @nodes_parent_id[current_track_address]\n break if current_track_address == @nodes_parent_id[current_track_address]\n end\n \n path.each do |hash_value|\n _address = dehash_address(hash_value)\n path_address.push( Map_Address.new( _address[0], _address[1]) )\n end\n \n return get_route_command(path_address,go_dir)\n end",
"def router\n\n subway_router = {\n \"n\" => [\"times square\", \"34th\", \"n line 28th\", \"23rd\", \"union square\", \"8th\"],\n \"l\" => [\"8th\", \"6th\", \"union square\", \"3rd\", \"1st\"],\n \"6\" => [\"grand central\", \"33rd\", \"line 6 28th\", \"23rd\", \"union square\", \"astor place\"]\n}\n\n # inserts the line got on and off from the HTML form into a local variale\n line_got_on = params[\"line_got_on\"]\n line_get_off = params[\"line_got_off\"]\n\n # saves the stop on and off to a local variable from the form\n stop_got_on = params[\"stop_got_on\"]\n stop_get_off = params[\"stop_get_off\"]\n\n # works out the index of the lines on and off\n first_range = subway_router[line_got_on].index(stop_got_on)\n second_range = subway_router[line_got_on].index(stop_get_off)\n\n # checks the index of the line on or off\n line_on_index = subway_router[line_got_on].index(stop_got_on)\n line_off_index = subway_router[line_get_off].index(stop_get_off)\n\n # checks unions index on your current line\n union_index_on = subway_router[line_got_on].index(\"union square\")\n union_index_off = subway_router[line_get_off].index(\"union square\")\n\n\n # checks if the line you get on at is the same as line got off\n # deals with the cross over and union indexes\n if line_get_off != line_got_on\n\n # checks if the line you got on index is less than the union index\n if line_on_index < union_index_on\n\n #checks if the line you get off index is higher than the union index\n if line_off_index > union_index_off\n\n part1 = subway_router[line_got_on][line_on_index..union_index_on]\n \"----------TRANSFER------------\"\n part2 = subway_router[line_get_off][union_index_off..line_off_index]\n\n @route = part1 | part2\n\n # checks if the line you get off index is less than the union index\n elsif line_off_index < union_index_off\n\n part1 = subway_router[line_got_on][line_on_index..union_index_on]\n \"----------TRANSFER------------\"\n part2 = subway_router[line_get_off][line_off_index..union_index_off].reverse\n\n @route = part1 | part2\n\n end\n end\n\n # checks if the line on index is higher than the union index\n if line_on_index > union_index_on\n\n # checks if the line off index is greter than the union index\n if line_off_index > union_index_off\n\n part1 = subway_router[line_got_on][union_index_on..line_on_index].reverse\n \"----------TRANSFER------------\"\n part2 = subway_router[line_get_off][union_index_off..line_off_index]\n\n @route = part1 | part2\n\n # checks the line off index is less than the union index\n elsif line_off_index < union_index_off\n\n part1 = subway_router[line_got_on][union_index_on..line_on_index].reverse\n \"----------TRANSFER------------\"\n part2 = subway_router[line_get_off][line_off_index..union_index_off].reverse\n\n @route = part1 | part2\n\n end\n end\n # if line_got_on > union_index_on\n\n # For one line trips\n else\n if (first_range < second_range)\n\n \"Your route is:\"\n\n @route = subway_router[line_got_on][first_range..second_range]\n\n elsif (second_range < first_range)\n\n \"Your route is:\"\n\n @route = subway_router[line_got_on][second_range..first_range].reverse\n\n end\n end\n\nend",
"def get_route( request )\n return nil unless defined?( RAILS_ENV ) \n ::ActionController::Routing::Routes.recognize_path( request.path, {:method => request.request_method.downcase.to_sym } )\n end",
"def track_route root_coords, target_coords\n root = Square.new(root_coords[0], root_coords[1])\n target = Square.new(target_coords[0], target_coords[1])\n result = search(root, target)\n\n # initializes route array with target square's coordinates\n route = []\n route << [result.x, result.y]\n \n # backtraces through parents of search items, tracking their coordinates along the way\n current = result.parent\n until current.nil?\n route << [current.x, current.y]\n current = current.parent\n end\n # reverse route to put in 'playing' order for knight moves\n route.reverse!\n\n puts \"You made it in #{route.length - 1} moves! Here is your route:\"\n route.each { |square| p square}\n return nil\nend",
"def print_stations_en_route\n\n start_station_sym = @start_station.gsub(\" \", \"_\").to_sym\n\n end_station_sym = @end_station.gsub(\" \", \"_\").to_sym\n\n start_line_sym = @start_line.to_sym\n\n end_line_sym = @end_line.to_sym\n \n if start_line_sym == :victoria\n start_line_sym_index = 0\n elsif start_line_sym == :bakerloo\n start_line_sym_index = 0\n elsif start_line_sym == :central\n start_line_sym_index = 0\n end\n\n stations_on_start_line = Tube.new.lines.values_at(start_line_sym)\n stations_on_end_line = Tube.new.lines.values_at(end_line_sym)\n \n stations_start = stations_on_start_line[start_line_sym_index]\n\n start_index = stations_start.find_index(start_station_sym) \n\n if start_line_sym != end_line_sym\n\n intersection = (stations_on_start_line[0] & stations_on_end_line[0])[0] \n\n start_int_index = stations_on_start_line[0].index(intersection)\n stops_between = (start_index.to_i - start_int_index.to_i).abs \n\n end_index = stations_on_end_line[0].find_index(end_station_sym)\n\n end_int_index = stations_on_end_line[0].index(intersection)\n between = (end_index.to_i - end_int_index.to_i).abs\n\n stations_on_first = stations_on_start_line[0][start_index, (start_int_index - 1)]\n stations_on_second = stations_on_end_line[0][end_int_index, (end_index + 1)]\n\n number_of_stops = (end_index - start_index).abs\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n\n stations_en_route = stations_on_first + stations_on_second\n \n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n else\n\n end_index = stations_start.find_index(end_station_sym)\n\n number_of_stops = ((end_index.to_i - start_index.to_i).abs + 1)\n\n puts \"\\nThere are #{number_of_stops} stations till your final destination\"\n #Use indexes to print stations between and including\n #\n stations_en_route = stations_start.slice(start_index..end_index)\n #Generate list and make print print ready\n #\n print_stations_en_route = stations_en_route.join(\", \").gsub(\"_\", \" \").split.map(&:capitalize).join(\" \")\n\n puts \"\\nThe stations en route are #{print_stations_en_route}\"\n\n end\n end",
"def fetchRoutes\n\t\t# Bus routes\n\t #http://api.wmata.com/Bus.svc/json/JRoutes?api_key=YOUR_API_KEY\n\t #\n\t # Bus route details...\n\t #\n\t logger.info \"Fetching, fetching...\"\n\t result = fetchUri(\"http://api.wmata.com/Bus.svc/json/JRoutes?api_key=#{@@apiKey}\")\n\n\t # if the hash has 'Error' as a key, we raise an error\n\t logger.info \"Got some data...\"\n\t if result.has_key? 'Error'\n\t \traise \"JSON error\"\n\t end\n\t logger.info \"No error...\"\n\t result['Routes'].each do |route|\n\t \trouteId=route['RouteID']\n\t \tlogger.info \"Processing route #{routeId}...\"\n\t \trouteData = fetchUri(\"http://api.wmata.com/Bus.svc/json/JRouteDetails?routeId=#{URI.escape(routeId)}&api_key=#{@@apiKey}\")\n\t \t#d.keys: [\"Direction0\", \"Direction1\", \"Name\", \"RouteID\"] \n\t \taddRouteData(routeData)\n \t\tend\n\tend",
"def first\n @routes[0]\n end",
"def extract_en_route_aircraft_status(section)\n # We are aiming at find detail string in a structure like:\n # ...\n # <th ...>Status</th>\n # <td ...>\n # <span ...>En Route / On Time</span>\n # <span ...>(2,182 sm down; 436 sm to go)</span>\n # ...\n # </td>\n # ...\n # ...\n extract_aircraft_status_raw_text(section).gsub(' (track log & graph)', '').gsub('En Route / ', '')\n end",
"def airports_normal\n return @routes[:extra_airports]\n end",
"def find_by_route\n @result = Array.new\n @distancias = Array.new\n\n @ride = Ride.order('id')\n if params[:radio] != '0'\n @ride.each do |p|\n distancia1 =Geocoder::Calculations.distance_between([params[:destLatitud],params[:destLongitud]], [p.destPointLat,p.destPointLong])\n distancia2 =Geocoder::Calculations.distance_between([params[:startLatitud],params[:startLongitud]], [p.startPointLat,p.startPointLong])\n if distancia1 <params[:radio].to_f && distancia2 <params[:radio].to_f\n @result.push(p)\n #@distancias.push(distancia1)\n end\n end\n # json_response={\n # result: @result,\n # distancias: @distancias\n # } \n respond_with @result , location: nil\n end\n if params[:radio] == '0'\n respond_with @ride,location: nil\n end \n #Ride.find_by_destPointLat_and_destPointLong(params[:latitud],params[:longitud])\n \n end",
"def show\n @routes = @mountain.routes.order(\"name\")\n end",
"def get_way(id)\n get_object('way', id)\n end",
"def get_command\n\t\ttext = read.chomp\n\t\tcommand = {}\n\t\tif text =~ /PASS/i\n\t\t\tcommand[:pass] = true\n\t\telsif text =~ /(\\d+),\\W+(\\d+)/i\n\t\t\tcommand[:x] = $1.to_i\n\t\t\tcommand[:y] = $2.to_i\n\t\telsif text =~ /\\A([NSEW]|[NS][EW])\\z/i\n\t\t\tdirection = $1.to_sym\n\t\t\tcommand[:x] = @x + @@target_coords[direction][:dx]\n\t\t\tcommand[:y] = @y + @@target_coords[direction][:dy]\n\t\tend\n\t\tcommand\n\tend",
"def route(env)\n routes.each do |route|\n return route if route.match(env)\n end\n\n nil\n end",
"def get_some_room_stuff(roomnumberone,pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{roomnumberone}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend",
"def maproutes(graph_instance)\n url ='http://www.gcmap.com/mapui?P='\n route_strings=''\n graph_instance.node_hash.each_key{ |key|\n linked = graph_instance.node_hash[key].linked_cities\n linked.each{ |tuple|\n route_strings = route_strings + \"#{key}-#{tuple.city},+\"\n }\n }\n Launchy.open(url+route_strings)\nend",
"def test_with_multiple_possible_routes\n routes = Routes.new 'ab1 bc4 bd1 dc1'\n assert_equal('abdc3', routes.find_by_shortest_route('a', 'c').to_s)\n end",
"def get_room_stuff(pos)\r\n my_port = 8083\r\n room_map_message = \"/maps/#{$roomnumber}/#{pos}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{room_map_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n if my_json[\"east\"]\r\n return my_json[\"east\"]\r\n \r\n elsif my_json[\"west\"]\r\n return my_json[\"west\"]\r\n\r\n elsif my_json[\"north\"]\r\n return my_json[\"north\"]\r\n\r\n elsif my_json[\"contents\"]\r\n return my_json[\"contents\"]\r\n\r\n elsif my_json[\"south\"]\r\n return my_json[\"south\"]\r\n\r\n elsif my_json[\"down\"]\r\n return my_json[\"down\"]\r\n\r\n elsif my_json[\"up\"]\r\n return my_json[\"up\"] \r\n end\r\nend",
"def from_slack(input)\n command_pattern = /(\\/[a-zA-Z\\-\\_]+)(.*)/\n\n if matched = command_pattern.match(input)\n command, text = matched[1], matched[2]\n\n return { 'command': command, 'text': text }\n else\n raise StandardError.new\n end\nend",
"def timeline_route\n @timeline_route ||= begin\n result = @timeline.route_for_kind(Activr::Timeline::Route.kind_for_routing_and_activity(@routing_kind, @activity.kind))\n raise \"Failed to find a route for #{@routing_kind} / #{@activity.kind}: #{self.inspect}\" if result.nil?\n result\n end\n end",
"def maneuvers\n if valid\n route[:legs].first[:maneuvers]\n end\n end",
"def route_command(message_body)\n route(\"#{robot.mention_name} #{message_body}\")\n end",
"def get_route_target server_type, msg, route_param, &block\n if @router_type\n router = case @router_type\n when :roundrobin\n method :rr_route\n when :weight_roundrobin\n method :wrr_route\n when :least_active\n method :la_route\n when :consistent_hash\n method :ch_route\n else\n method :rd_route\n end\n router.call(self, server_type, msg) { |err, server_id|\n block_given? and yield err, server_id\n }\n else\n unless @router.respond_to? :call\n block_given? and yield Exception.new 'invalid router method'\n return\n end\n @router.call(route_param, msg, @route_context) { |err, server_id|\n block_given? and yield err, server_id\n }\n end\n end",
"def routes(&block); end",
"def routes(&block); end",
"def query\n payload = JSON.parse(params[:payload]).with_indifferent_access\n info = ScheduleProcessor.headway_info\n\n uri = URI(payload[:response_url])\n workspace = payload.dig(:enterprise)&.dig(:name) || payload.dig(:team)&.dig(:domain)\n user_id = payload.dig(:user)&.dig(:id)\n\n if payload[:actions].first[:action_id] == 'select_route'\n if (data = info[:routes].find { |r| r[:id] == payload[:actions].first[:selected_option][:value]})\n track_event('default', \"route/#{data[:id]}\", user_id, workspace)\n result = route_response(data)\n end\n elsif payload[:actions].first[:action_id] == 'select_line'\n if (borough, _ = info[:lines].find { |borough, lines| data = lines.find { |l| l[:id] == payload[:actions].first[:selected_option][:value]}})\n track_event('default', \"line/#{data[:id]}\", user_id, workspace)\n result = line_response(borough, data)\n end\n end\n\n Net::HTTP.post(uri, result.to_json, \"Content-Type\" => \"application/json\")\n\n render json: result\n end",
"def slack\n self.matched_line(\"SLACK\")&.strip\n end",
"def recognize_path(path_info)\n prepare! unless prepared?\n route = @engine.find_by_pattern(path_info).first\n [route.name, route.params_for(path_info, {})]\n end",
"def _route\n\n _save = self.pos\n while true # sequence\n _save1 = self.pos\n\n _save2 = self.pos\n while true # sequence\n _tmp = apply(:_AT)\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:_ocms)\n unless _tmp\n self.pos = _save2\n break\n end\n _tmp = apply(:_domain)\n unless _tmp\n self.pos = _save2\n end\n break\n end # end sequence\n\n if _tmp\n while true\n\n _save3 = self.pos\n while true # sequence\n _tmp = apply(:_AT)\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = apply(:_ocms)\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = apply(:_domain)\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n break unless _tmp\n end\n _tmp = true\n else\n self.pos = _save1\n end\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = match_string(\":\")\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_route unless _tmp\n return _tmp\n end",
"def get_routes(params)\n graph_data = create_data(params)\n if graph_data.is_a?(Array)\n graph_data.each do |data|\n add_vertex(data[0][0], data[0][1])\n end\n path_array = shortest_path(params[:source], params[:destination])\n if path_array.is_a?(Array)\n get_path_description(path_array, params)\n else\n path_array\n end\n else\n graph_data\n end\n end",
"def show_direct_route options={}\n map unless is_mapped?\n start_cell= options[:start_cell] || random_cell\n end_cell= options[:end_cell] || random_cell\n unhighlight_all\n\n start_stack = [current_cell = start_cell]\n distance=current_cell.distance\n until distance==0 do\n temp=current_cell.neighbors.select {|dir, cell|\n next unless current_cell.passable? dir\n cell.distance == distance-1\n }[0][1]\n distance-=1\n current_cell=temp\n start_stack<< current_cell\n end\n\n end_stack = [current_cell = end_cell]\n distance=current_cell.distance\n until distance==0 do\n current_cell=current_cell.neighbors.select {|dir, cell|\n next unless current_cell.passable? dir\n cell.distance == distance-1\n }[0][1]\n distance-=1\n end_stack<< current_cell\n end\n \n path = start_stack.reverse + end_stack\n common = (start_stack & end_stack).sort_by {|cell| cell.distance }\n path = path - common[0...-1]\n\n path.each {|cell| cell.set_highlight }\n display options\n end",
"def directions(origin, destination)\n directions = []\n\n request = Addressable::URI.new(\n :scheme => \"https\",\n :host => \"maps.googleapis.com\",\n :path => \"maps/api/directions/json\",\n :query_values => {\n :origin => origin.join(','),\n :destination => destination.join(','),\n :sensor => \"false\",\n :mode => \"walking\"\n }\n )\n\n response = RestClient.get(request.to_s)\n\n parsed_response = JSON.parse(response)\n\n parsed_response[\"routes\"][0][\"legs\"][0][\"steps\"].each do |step|\n parsed_html = Nokogiri::HTML(step[\"html_instructions\"])\n directions << parsed_html.text\n end\n\n directions\nend",
"def route_config\n raise StandardError, \"You must set a route_id in Scratch before calling route_config\"\n @route = Nextbus::Route.find @agency_id, @route_id\n sensor_update \"route_title\", @route.title\n set_screen_factors @route.lat_min, @route.lat_max, @route.lon_min, @route.lon_max\n set_stops\n get_vehicle_locations\n end",
"def short_route\n @short_route ||= begin\n sr = \"#{objet}\" # sinon, passage par référence avec '<<' ci-dessous\n method && sr << \"/#{method}\"\n sr\n end\n end",
"def getDirectRoute(startStation, endStation)\n routesFrom = getRoutesFrom(startStation)\n \n routesFrom.each do |route|\n if (route.endStation == endStation)\n return route\n end\n end\n \n return nil\n end",
"def getRoutMenu\n puts 'Option 1: Add Route'\n puts 'Option 2: Exit'\n \n option = gets\n option = checkEndCon(option.to_i, 1, 2)\n \n return option.to_i\n end"
] |
[
"0.6169135",
"0.61304724",
"0.60252565",
"0.60091335",
"0.59387463",
"0.58733886",
"0.5801675",
"0.5563011",
"0.55381125",
"0.55105025",
"0.54996836",
"0.5484865",
"0.5476752",
"0.5425237",
"0.5415232",
"0.5413466",
"0.53956914",
"0.53589046",
"0.5357034",
"0.5327657",
"0.5300541",
"0.52859294",
"0.52747196",
"0.527001",
"0.52660084",
"0.52627224",
"0.52604693",
"0.52585655",
"0.52585655",
"0.52585655",
"0.52526957",
"0.5233097",
"0.52301234",
"0.5222759",
"0.52214986",
"0.52205265",
"0.52202255",
"0.5218866",
"0.5208782",
"0.5187651",
"0.51802003",
"0.51569027",
"0.5150783",
"0.5137501",
"0.51374483",
"0.5129598",
"0.51267874",
"0.51241535",
"0.5119717",
"0.5112509",
"0.50979346",
"0.5096953",
"0.5088495",
"0.508097",
"0.50760126",
"0.50576246",
"0.505259",
"0.50502586",
"0.5050067",
"0.50461024",
"0.5038107",
"0.5037244",
"0.5037244",
"0.5012946",
"0.5010482",
"0.49917865",
"0.49912894",
"0.49797314",
"0.4974845",
"0.49709848",
"0.49621075",
"0.49571568",
"0.4950275",
"0.49403834",
"0.49334627",
"0.4932147",
"0.4931075",
"0.4930299",
"0.49295884",
"0.49116904",
"0.49103102",
"0.4909044",
"0.49063316",
"0.4905595",
"0.490425",
"0.49017742",
"0.49002045",
"0.48998865",
"0.48998865",
"0.48966485",
"0.48853022",
"0.4876961",
"0.48655713",
"0.4861953",
"0.4861485",
"0.48599848",
"0.48502174",
"0.48427743",
"0.48360017",
"0.48350096"
] |
0.71136016
|
0
|
Complete the getMoneySpent function below.
|
def getMoneySpent(keyboards, drives, budget)
#
# Write your code here.
#
highest_combination = -1
keyboards.each do |keyboard|
drives.each do |drive|
sum = keyboard + drive
highest_combination = sum if sum <= budget && sum > highest_combination
end
end
highest_combination;
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def spent\n @spent ||= calculate_spent\n @spent.round(2)\n end",
"def calculate_total_money_spent\n return @trips.inject(0.0) { |sum, trip|\n trip.is_in_progress? ? sum + 0 : sum + trip.cost }\n end",
"def money_spent\n self.purchases.map { |p| p.price }.sum\n end",
"def spent\n self.deliverables.collect(&:spent).delete_if { |d| d.blank?}.inject { |sum, n| sum + n } || 0.0\n end",
"def money_made\n total_crowd * self.ticket_price\n end",
"def time_spent\n return nil if self.finished_at.nil?\n# if self.completed?\n self.finished_at - self.started_at\n# else\n# Time.now - self.started_at\n# end\n end",
"def amount_remaining\n @desired_amount - @bought_amount\n end",
"def spent_hours\n @spent_hours ||= time_entries.sum(:hours) || 0\n end",
"def transfer_pending_to_money\n @pending_money.each do |coin, value|\n @money[coin] += value\n @pending_money[coin] = 0\n end\n update_pending\n update_money\n end",
"def money\n\t\tif @wallet.neg?\n\t\t\t@in_debt = true\n\t\tend\n\t\treturn @wallet.amount\n\tend",
"def budget_left\n budget - total_spent.to_i\n end",
"def amount_owed\n total_price - amount_paid\n end",
"def tot_deposits_made\n Rails.logger.debug(\"*** tot_deposits_made\")\n # note cannot use database sum because big_deposit is not native to database\n dep_result = 0.0\n EmployeeBenefit.where(\n \"employee_id = ? and eff_month = ? and eff_year = ? and deposited_at IS NOT NULL\",\n self.employee_id.to_s,\n self.eff_month.to_s,\n self.eff_year.to_s\n ).each do |eb|\n dep_result += round_money(eb.deposit)\n end\n Rails.logger.debug(\"*** dep_result: #{dep_result.inspect}\")\n return dep_result\n end",
"def spend\n amounts = []\n orders.where(order_status_id: 4).each do |order|\n amounts << order.subtotal\n end\n return amounts.inject(:+)\n end",
"def amount_spent\n \"You have used <strong>#{number_to_currency(money_used)}</strong> out of <strong>#{number_to_currency(incomes)}</strong>\".html_safe\n end",
"def return_sum\n @money = 0\n @transactions.each do |t|\n if t.get_action == 'buy'\n @money = @money + t.get_value\n elsif t.get_action == 'sell'\n @money = @money - t.get_value\n end\n end\n total_value_of_shares - @money\n end",
"def total_spent_hours\n @total_spent_hours ||= TimeEntry.where(:meeting_id => id).sum(:hours).to_f\n end",
"def get_total_billable_time_amount\n @total_amount = 0.0\n @billed_time = 0.0\n unless @saved_time_entries.empty?\n @total_amount = @saved_time_entries.map(&:final_billed_amount).inject(0) do |total,amount|\n total + amount\n end\n @billed_time = @saved_time_entries.inject(0) do | total, time_entry|\n actual_duration = @dur_setng_is_one100th ? one_hundredth_timediffernce(time_entry.actual_duration) : one_tenth_timediffernce(time_entry.actual_duration)\n time_entry.is_billable ? total + actual_duration : total\n end\n @total_amount = @total_amount.to_f.roundf2(2)\n end\n @total_amount || 0.0 \n end",
"def spend\n self\n end",
"def total_spent\n total_cost = 0\n trips.each do |trip|\n total_cost += trip.cost\n end\n return total_cost\n end",
"def investment\n if buy_price\n num_of_shares * buy_price\n end\n end",
"def retrieve_pending_amount\n change = @pending_money.dup\n @pending_money = COIN_MAPPER.dup\n change\n end",
"def profit\n total_before_tax - total_cost\n end",
"def profit\n total_before_tax - total_cost\n end",
"def get_total_expense\n\t\tbills.pluck(:amount).inject(:+) rescue 0\n\tend",
"def update_pending\n @pending_amount = self.class.count_money @pending_money\n end",
"def profit\n \tself.bid - self.payout\n end",
"def total\n Money.new(self.expense_entries.sum('unit_cost_pence * qty'))\n end",
"def spend(amount)\r\n @spend += amount\r\n end",
"def needed_amount_less_savings\n recommended_min_portfolio - portfolio_after_growth\n end",
"def hours_spent\n hours_spent = 0\n project_tasks.each do |project_task|\n hours_spent += project_task.hours_spent\n end\n hours_spent\n end",
"def spent_per_person \n count = real_participants.size\n return (cost / count).round(2)\n end",
"def _spent_on\n return payment\n end",
"def tot_current_benefit\n if self != nil && self.current_package != nil && self.current_package.calc_hourly_benefit != nil\n (self.calc_tot_hours * self.current_package.calc_hourly_benefit * 100.0).round / 100.0\n else\n 0.00\n end\n # check ?\n # ( @employee_benefit[\"deposit\"] -\n # ( @employee_benefit[\"monthly_benefit\"] - @employee_benefit[\"tot_deposits_made\"] )\n # ) > 0.005\n end",
"def hours_spent\n \thours_spent = 0\n \tinputs.each do |input|\n \t\thours_spent += input.hours\n \tend\n \thours_spent\n end",
"def place_bet(amount)\n @total_money -= amount\n end",
"def paid_sum\n paid = Money.new(0, 'USD')\n paid += @paid_splits.inject(Money.new(0, 'USD')){ |memo, split| memo + split.sum } if @paid_splits.present?\n paid\n end",
"def add_money_to_till(amount)\n @till += amount\nend",
"def get_btc_profit\n quantity - close_positions.sum(:quantity)\n end",
"def build_spent()\n\t\treturn @build.calculate_cost\n\tend",
"def work_needed(project_minutes, freelances)\n freelance_hours = 0\n freelance_minutes = 0\n my_hours = 0\n my_minutes = 0\n\n freelances.each do |f|\n freelance_hours += f[0]\n freelance_minutes += f[1]\n end\n\n freelance_total = (freelance_hours * 60) + freelance_minutes\n remaining = project_minutes - freelance_total\n\n p freelance_total\n p remaining\n\n if remaining >= 60\n my_hours = remaining / 60\n my_minutes = remaining - (my_hours * 60)\n else\n my_minutes = remaining\n end\n\n if remaining < 1\n return \"Easy Money!\"\n else\n return \"I need to work #{my_hours} hour(s) and #{my_minutes} minute(s)\"\n end\n\nend",
"def remaining_total\n total\n end",
"def calculate_total\n self.total = total_money(total_gross)\n end",
"def get_btc_profit\n close_positions.sum(:quantity) - quantity\n end",
"def total_money_for_job(job_id)\n total_money = 0\n accepted_contract = Contract.find_by(job_id: job_id, accept_status: 2)\n if accepted_contract.present?\n accepted_contract.timeslots.all.each do |each_timeslot|\n if each_timeslot.paid_time.present?\n total_money = total_money + each_timeslot.time_length * each_timeslot.contract.job.hour_rate\n end\n end\n end\n\n return total_money\n\n end",
"def total_working_hours_balance\n @total_working_hours_balance\n end",
"def amount_owed\n invoice_total - total_amount_paid\n end",
"def percentage_change\n return_sum / @money * 100\n end",
"def amount_spent_on(project)\n self.expenses.where(:project_id => project.id).sum(:amount)\n end",
"def effective_total\n total = effective_total_money\n \"#{total.currency} #{total.format}\"\n end",
"def total_amount\n self.tickets.inject(0) do |amount, ticket|\n amount += ticket.price_minus_discount\n end\n end",
"def profit\n revenue - total_costs\n end",
"def profit()\n profit = margin() * @quantity\n return profit\n end",
"def buy_a_ticket()\n tickets = self.tickets()\n ticket_price = tickets.map{|ticket| ticket.price}\n return @funds - ticket_price\n end",
"def update_money\n @amount = self.class.count_money @money\n end",
"def amount_payment_outstanding\n capital_required - amount_payment_collected\n end",
"def money; end",
"def total_debt\n self.amount\n end",
"def unpaid_amount\n gross_amount - paid_amount\n end",
"def total_value_cents\n total_benefits_value\n end",
"def btc_profit\n break_even.abs\n end",
"def final_price\n return if @result.result[:final_price].blank?\n (@result.result[:final_price]&.delete('^0-9').to_i/100) - savings\n end",
"def profit_calculation\r\n @total_profit = @cocktail_profit + @beer_profit + @water_profit\r\n end",
"def total_quantity\n cached_qty_bank.to_f + cached_qty_consigned.to_f\n end",
"def total_price\n worker_profile.price_per_hour * hours.to_i + material_cost\n end",
"def get_money!(money_hash)\n raise NotEnoughMoneyError, 'Not enough money for found combination' unless enough_money_for?(money_hash)\n\n money_hash.keys.each { |key| @money[key] -= money_hash[key] }\n save!\n end",
"def amount\n @amount ||= begin\n amount = Txaction.calculate_amount(params[:amount]).to_d.abs\n amount = -amount if params[:amount_type] == 'spent'\n amount\n end\n end",
"def withdraw(amount_of_money)\n return @balance - amount_of_money\n end",
"def percent_of_budget\n if budget_dollars_billed.nil? || budget_dollars_billed == 0\n rv = 0\n elsif current_total_billed.nil? \n rv = 0\n else\n rv = current_total_billed / budget_dollars_billed\n end\n rv\n end",
"def total_funds\n #binding.pry\n funding_rounds.map{|fr| fr.investment}.sum\n end",
"def pending_sum\n\t\tpending.sum(\"amount * (artist_percentage / 100)\").to_f.round(2)\n\tend",
"def balance_owed\n discounted_price - amount_paid\n end",
"def pending_amount\n @calculator.pending_amount\n end",
"def actual_travel\n actual_travel = travel_expenses.reduce(0) {|sum, expense| sum += expense.amount }\n end",
"def left\n return self.budget - self.spent\n end",
"def progress\n return 100 unless self.deliverables.size > 0\n return 100 if self.budget == 0.0\n \n balance = 0.0\n \n self.deliverables.each do |deliverable|\n balance += deliverable.budget * deliverable.progress\n end\n \n return (balance / self.budget).round\n end",
"def estimate_crypto_profit\n quantity - close_positions.sum(:quantity)\n end",
"def remainder_to_pay\n self.total_amount - self.checkout_wallet.unconfirmed_value_paid\n end",
"def labor_budget_left\n return self.labor_budget - self.spent\n end",
"def actual_income\n outgoing_invoices.where(:status => \"deposited\").inject(0) do |mem, invoice|\n mem += invoice.amount\n end # inject invoice\n end",
"def final_bill\n total + tax + @tip_amount\n end",
"def money\n end",
"def amount_after_tax\n if waitlist_deduct_amount.present?\n amount_after_discounted + amount_of_tax - waitlist_deduct_amount\n else\n amount_after_discounted + amount_of_tax\n end\n end",
"def calculate_change\n\t\t## by this point in time the cart has already been set, and prepared, so we know the total pending amount. \n\t\tif self.amount > self.cart.cart_pending_balance\n\t\t\tself.cash_change = self.amount - self.cart.cart_pending_balance\n\t\telse\n\t\t\tself.cash_change = 0\n\t\tend\n\tend",
"def hours_spent_percentage\n return 1 if hours_planned == 0\n (hours_spent.to_f / hours_planned).round(2)\n end",
"def hours_spent_percentage\n return 1 if hours_planned == 0\n (hours_spent.to_f / hours_planned).round(2)\n end",
"def amount\n available_amount - blocked_amount\n end",
"def amount\n difference\n end",
"def total\n format_money(@total)\n end",
"def estimate_crypto_profit\n close_positions.sum(:quantity) - quantity\n end",
"def unit_saving(point)\n point.price - price\n end",
"def show_decimal_budget()\n return Money.convert_to_decimal_string(@budget)\n end",
"def total_funds\n sum_funds = 0\n self.funding_rounds.each do |funding_round|\n sum_funds += funding_round.investment\n end \n sum_funds\nend",
"def get_expense_details\n @total_expenses = 0.0\n @billed_expenses = 0.0\n @expense_entries = {}\n @expense_entries = @saved_expense_entries\n for time_entry in @saved_time_entries\n @expense_entries += time_entry.tne_invoice_expense_entries\n end\n unless @expense_entries.empty?\n @total_expenses = @expense_entries.map(&:expense_amount).inject(0) do |total,amount|\n total + amount\n end\n @billed_expenses = @expense_entries.map(&:final_expense_amount).inject(0) do |total,amount|\n total + amount\n end\n @billed_expenses = @billed_expenses.to_f.roundf2(2)\n end\n end",
"def benefits_transfers\n self.offers_as_seller.accepted.inject(0) {|sum, offer| sum += offer.pay}\n end",
"def add_money\n @total += fee\n end",
"def current_amount\n items.reduce(0) do |sum, item|\n sum + item.current_amount * item.price\n end\n end",
"def total_price\n Money.new(quantity * price_per_serving)\n end",
"def final_amount\n amount_paid - discount_value - discount_percent\n end",
"def estimated_profit\n day_rate = avg_rate_card_amount_cents.round(2)\n mins_tracked = Timing.minute_duration_submitted_for_client(id)\n days_tracked = (mins_tracked.to_s.to_d / account.account_setting.working_day_duration_minutes).round(2)\n\n task_estimate_mins = Task.total_estimated_minutes_for_client(id)\n task_estimate_days = (task_estimate_mins.to_s.to_d / account.account_setting.working_day_duration_minutes).round(2)\n\n ((task_estimate_days * day_rate.to_s.to_d) - (days_tracked * day_rate.to_s.to_d)).round(2)\n end",
"def current_subtotal\n debt_claim_items.reject(&:marked_for_destruction?).sum(&:current_debt)\n end"
] |
[
"0.7412486",
"0.69516444",
"0.6569346",
"0.65418947",
"0.64871365",
"0.6442926",
"0.6400391",
"0.63180745",
"0.6279987",
"0.62655973",
"0.62361443",
"0.6215522",
"0.62104845",
"0.6206831",
"0.62035567",
"0.61856353",
"0.6165371",
"0.6160469",
"0.612236",
"0.6104932",
"0.6098658",
"0.6093394",
"0.60312253",
"0.60312253",
"0.60173184",
"0.5993535",
"0.59361094",
"0.5918607",
"0.59089655",
"0.5908758",
"0.5904315",
"0.58773243",
"0.58691084",
"0.58677083",
"0.5858746",
"0.58460313",
"0.584095",
"0.5838363",
"0.58364654",
"0.58354586",
"0.58280826",
"0.5817193",
"0.5810076",
"0.5808379",
"0.58017755",
"0.5783359",
"0.57788765",
"0.57665145",
"0.57662696",
"0.57603216",
"0.575881",
"0.5756893",
"0.5754024",
"0.5750544",
"0.5746911",
"0.5746523",
"0.5738608",
"0.57347864",
"0.5721668",
"0.57167006",
"0.5706797",
"0.57055104",
"0.57033384",
"0.5703162",
"0.56981575",
"0.56841713",
"0.5683826",
"0.5682324",
"0.5681056",
"0.56809926",
"0.56794155",
"0.5674983",
"0.56748915",
"0.56665456",
"0.56617177",
"0.56559515",
"0.56531316",
"0.5647707",
"0.5638313",
"0.5635601",
"0.5630912",
"0.56286156",
"0.5621749",
"0.5620587",
"0.5618283",
"0.5618283",
"0.56166065",
"0.56149215",
"0.56140393",
"0.5611082",
"0.56077254",
"0.56040496",
"0.55939865",
"0.55931455",
"0.55890757",
"0.55865264",
"0.5584456",
"0.5579533",
"0.5571491",
"0.55648875",
"0.556288"
] |
0.0
|
-1
|
calls 'choose_hero' to display all the cards to the user, and assigns their choice to 'card' TTY prompt for the yes/no menu if 'yes', creates a new row in the card table for that specific user_id, assigning them that card_id asks if user wants to select another card, if they do it calls on itself to offer the choices again (and so on)
|
def choose_and_add_card_to_user_deck
prompt = TTY::Prompt.new
card = choose_hero
response = prompt.select('Do you want to add this card to your collection?', %w(Yes No))
if response == "Yes"
added_card = UserCard.create(user_id: self.id, card_id: card.id)
puts "#{added_card.card.name.upcase} was added to your collection."
sleep(1)
end
system('clear')
title
response = prompt.select('Do you want to look for another card?', %w(Yes No))
if response == "Yes"
self.choose_and_add_card_to_user_deck
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def choose_hero\n prompt = TTY::Prompt.new\n names = Cards.all.map {|cards| cards[\"name\"]}\n selected_name = prompt.select('Choose a character', names, filter: true, cycle: true, help: \"(Start typing to filter results)\",help_color: :green, active_color: :yellow)\n hero = Cards.find_by(name: selected_name)\n display_card_details(hero)\n hero\nend",
"def choose_hero\n buffer\n display_heros\n buffer\n line\n puts \"Choose a Hero by typing the number they are labeled with into your console.\"\n line\n choice = gi_integer - 1\n if choice <= Hero.all.length\n buffer\n line\n puts \"You chose: #{Hero.all[choice].alter_ego}\"\n line\n hero = Hero.all[choice]\n generate_hero_nemesis(hero)\n else line\n puts \"Your choice does not exist. Press 1 to rechoose, Press 2 to generate a Hero, Press 3 to go back.\"\n line\n choice = gi_integer\n if choice == 1\n choose_hero\n elsif choice == 2\n generate_hero_name\n elsif choice == 3\n hero_setup\n end\n end\n end",
"def hero_setup\n line\n puts \"Press 1 to choose a Hero. Press 2 to generate your own Hero. Press 3 to go back.\"\n line\n choice = gi_integer\n if choice == 1\n choose_hero\n elsif choice == 2\n generate_hero_name\n elsif choice == 3\n greeting\n else line\n puts \"Sorry, please enter either 1, 2, or 3.\"\n hero_setup\n line\n end\n \n end",
"def purchase_card(turn)\n own_money = turn.player.money\n keep_repeating = true\n while keep_repeating == true do\n keep_repeating = false \n @@cli.say \"Now it is time to purchase a card; you have <%= color('#{own_money}', BOLD) %> money.\"\n # Create a hash for the cards in the town\n town_cards = Hash[ @mk.town.deck.map {|e| [\"#{e[1]} x #{e[0].attribute[:name]} (#{e[0].attribute[:cost]})\", [:establishment, e[0], e[0].attribute[:cost]]]} ]\n card_name_list = town_cards.sort_by { |key, val| val[1].attribute[:from_roll] }.to_h\n # add the landmarks\n card_name_list.merge!(Hash[ turn.player.unbuilt_landmarks.map {|l| [\"#{l.name} (#{l.cost})\", [:landmark, l, l.cost]]} ])\n @@cli.choose do |menu|\n menu.prompt = \"Which card to do you want to buy? \"\n menu.choices(*card_name_list.keys) do |chosen|\n @@cli.say \"You have chosen <%= color('#{chosen}', BOLD) %>. \"\n if own_money < card_name_list[chosen][2]\n @@cli.say \"You can't afford that! It costs #{card_name_list[chosen][2]} but you only have #{own_money}\"\n keep_repeating = true\n else\n process_purchase_of_card(turn, card_name_list[chosen])\n end\n end\n menu.choice(:none, {:text => \"NOTHING TO ME, AH VIENNA\"}) { @@cli.say \"OK, you have chosen to not purchase any card.\"}\n menu.choice(:databank) { databank_menu; keep_repeating = true}\n end\n end\n end",
"def display_and_add_a_superhero\n #binding.pry\n user.reload\n system 'clear'\n choices=iterator_heros\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts \"\n \n ████████╗██╗ ██╗███████╗ ██╗ ██╗███████╗██████╗ ██████╗ ███████╗\n ╚══██╔══╝██║ ██║██╔════╝ ██║ ██║██╔════╝██╔══██╗██╔═══██╗██╔════╝\n ██║ ███████║█████╗ ███████║█████╗ ██████╔╝██║ ██║███████╗\n ██║ ██╔══██║██╔══╝ ██╔══██║██╔══╝ ██╔══██╗██║ ██║╚════██║\n ██║ ██║ ██║███████╗ ██║ ██║███████╗██║ ██║╚██████╔╝███████║\n ╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝\n \n \".colorize(:yellow)\n choosen_superhero=prompt.select(\"Choose A Superhero Please\", choices )\n userSup= UserSuperhero.create(user_id: self.user.id, superhero_id: choosen_superhero)\n # binding.pry\n system 'clear'\n self.main_menu()\n \n end",
"def set_todays_hero\n system \"clear\"\n title_print\n new_user = TTY::Prompt.new.yes?(\"Would you like to create a new character?\") do |q|\n q.positive 'Yes'\n q.negative 'No'\n q.convert -> (input) { !input.match(/^agree$/i).nil?}\n end\n if new_user\n @todays_hero = create_new_player\n else\n select_hero = TTY::Prompt.new.select(\"Who would you like to be today?\", Superhero.all.map(&:name), \n per_page: 25, filter: true)\n @todays_hero = Superhero.find_by(name: select_hero)\n end\n end",
"def use_card\n waiting_to_confirm_placement = true\n waiting_to_use_card = true\n invalid_usage = nil\n invalid_confirmation = nil\n remind_cannot_discard = nil\n \n while waiting_to_confirm_placement\n while waiting_to_use_card\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s} #{'* you cannot discard this card' if @drew_from_discard}\" unless @selected_card.nil?\n puts \"You cannot discard this card because you drew it from the discard pile.\" if remind_cannot_discard\n remind_cannot_discard = false\n \n @card_to_replace = nil\n @card_to_discard = nil\n\n puts InputManager.input_options({ negative: 'Discard this Card', rack_positions: 'Switch With Card at Position' }, invalid_usage)\n invalid_usage = nil\n\n @placement_response = InputManager.get\n\n # If player chooses a location in their rack\n # Get ready to exchange those cards\n if InputManager::INPUTS[:rack_positions].include?(@placement_response)\n prep_place_card_in_rack(@placement_response)\n waiting_to_use_card = false\n\n # If player chooses to discard their card\n # get ready to discard their card\n # Disallow discard if card was drawn from the discard pile\n elsif InputManager.negative?(@placement_response)\n if @drew_from_discard\n remind_cannot_discard = true\n else\n prep_discard_drawn_card\n waiting_to_use_card = false\n end\n else\n invalid_usage = @placement_response\n end\n end\n\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s}\"\n\n if @card_to_replace\n puts \"You want to exchange #{@card_to_replace.to_s} with #{@selected_card.to_s}.\"\n else\n puts \"You do not want to use #{@selected_card.to_s}.\"\n end\n\n puts \"You are discarding #{@card_to_discard.to_s}.\"\n\n puts InputManager.input_options({ affirmative: 'Save and Complete Turn', negative: 'Do Something Different' }, invalid_confirmation)\n invalid_confirmation = nil\n confirm_response = InputManager.get\n\n # If player confirms their decision\n # persist their decision\n if InputManager.affirmative?(confirm_response)\n save_and_discard(@placement_response)\n waiting_to_confirm_placement = false\n \n # If player changes their mind\n # allow them to choose how to use their card again \n elsif InputManager.negative?(confirm_response)\n waiting_to_use_card = true\n else\n invalid_confirmation = confirm_response\n end\n end\n end",
"def delete_card\n prompt = TTY::Prompt.new\n your_cards = self.cards\n card_names = your_cards.map { |card| card[\"name\"] }\n selected_card_name = prompt.select('Choose a character to delete', card_names, filter: true, cycle: true, help: \"(Start typing to filter results)\", help_color: :green, active_color: :yellow)\n selected_card = Card.find_by(name: selected_card_name)\n choice = UserCard.find_by user_id: self.id, card_id: selected_card.id\n response = prompt.select(\"Are you sure you want to delete #{selected_card_name.upcase}?\", %w(Yes No))\n if response == \"Yes\"\n choice.destroy\n bar = TTY::ProgressBar.new(\"Deleting #{selected_card_name.upcase} [:bar]\", total: 30)\n 30.times do\n sleep(0.05)\n bar.advance(1)\n end\n puts \"#{choice.card.name.upcase} was deleted from your collection!\"\n sleep(1)\n system('clear')\n title\n else\n check_collection\n end\n end",
"def draw_card\n waiting_to_pick_pile = true\n\n invalid_pile = nil\n while waiting_to_pick_pile\n DisplayManager.prepare_ingame_display\n show_state\n\n puts \"Do you want to draw a new card, or use the top discarded card?\"\n puts InputManager.input_options({ affirmative: 'Draw New Card', negative: 'Take Last Discarded Card' }, invalid_pile)\n invalid_pile = nil\n \n response = InputManager.get\n\n # If player picks the draw pile\n # draw the top card from that pile\n if InputManager.affirmative?(response)\n choose_new_card\n waiting_to_pick_pile = false\n\n # If player picks from discard pile\n # draw top card from that pile\n # player cannot discard this card\n elsif InputManager.negative?(response)\n choose_discard\n waiting_to_pick_pile = false\n else\n invalid_pile = response\n end\n end\n end",
"def list_hand_cards(card_array) \n user_choice = \"\"\n while user_choice != \"⬅️ BACK ⬅️\" && user_choice != \"🗑 DELETE READING 🗑\" do\n user_choice = prompt.select(\"🔮 #{self.user.name}, Select a card to see more details.\") do |menu|\n card_emoji_string = \"🂠\"\n crystal_ball_emoji_string = \"🔮\"\n card_array.map do |handCard|\n string=\" 🂠 TAROT #{crystal_ball_emoji_string} 🂠 \"\n menu.choice \" 🂠 TAROT #{crystal_ball_emoji_string} 🂠 \", -> {reading_card(handCard.card, card_array,string); \" 🂠 TAROT #{crystal_ball_emoji_string} 🂠 \"}\n card_emoji_string += \"🂠\"\n crystal_ball_emoji_string += \" 🔮\"\n end\n menu.choice \"🗑 DELETE READING 🗑\", -> {self.delete_reading(card_array); \"🗑 DELETE READING 🗑\"}\n menu.choice \"⬅️ BACK ⬅️\", -> {self.main_menu;\"⬅️ BACK ⬅️\"}\n end \n end \n end",
"def determine_cards(card,hsh)\n case card.number\n when 1\n assign_to_hsh(hsh,card,:ace)\n when 2\n assign_to_hsh(hsh,card,:two)\n when 3\n assign_to_hsh(hsh,card,:three)\n when 4\n assign_to_hsh(hsh,card,:four)\n when 5\n assign_to_hsh(hsh,card,:five)\n when 6\n assign_to_hsh(hsh,card,:six)\n when 7\n assign_to_hsh(hsh,card,:seven)\n when 8\n assign_to_hsh(hsh,card,:eight)\n when 9\n assign_to_hsh(hsh,card,:nine) \n when 10\n assign_to_hsh(hsh,card,:ten)\n when 11\n assign_to_hsh(hsh,card,:jack)\n when 12\n assign_to_hsh(hsh,card,:queen)\n when 13\n assign_to_hsh(hsh,card,:king)\n end\n end",
"def auto_turn\n #TODO:\n #returns card, true or false for play or discard\n #choose a random card\n #discard a random card if no cards can be played\n #come up with a prioritized hand based on winning potential (play the best, discard the worst)\n end",
"def generate_hero_hp(hero)\n buffer\n line\n puts \"Your hero's hp is being calculated...\"\n buffer\n hp = rand(500..1000)\n hero.hp = hp\n puts \"Your hero's health point are #{hero.hp}\"\n puts \"Is this enough health? Press 1 if it is enough, press 2 to re-roll power level.\"\n line\n choice = gi_integer\n if choice == 1\n generate_hero_gender(hero)\n elsif choice == 2\n generate_hero_hp(hero)\n else line\n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_hero_hp(hero)\n end\n end",
"def superhero_choosen?\n\n if self.user.superheros.empty?\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts\"\n \n ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ███████╗██╗\n ██╔═══██╗██╔═══██╗██╔═══██╗██╔═══██╗██╔═══██╗██╔══██╗██╔════╝██║\n ██║ ██║██║ ██║██║ ██║██║ ██║██║ ██║██████╔╝███████╗██║\n ██║ ██║██║ ██║██║ ██║██║ ██║██║ ██║██╔═══╝ ╚════██║╚═╝\n ╚██████╔╝╚██████╔╝╚██████╔╝╚██████╔╝╚██████╔╝██║ ███████║██╗\n ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝╚═╝\n \n \n \".colorize(:red)\n \n puts \"\\n\\nYou have no Superheros yet! Select option 2 in main menu!\"\n \n \n sleep 3\n self.main_menu()\n end\n end",
"def player_deal_card\n player.add_card(deck.deal_card)\n player.add_card(deck.deal_card)\n player.show_hand\n end",
"def choose_cards(turn, player)\n if turn.turn_card_on_deck?\n rand_num = rand(2)\n list_of_cards = case\n when rand_num == 0: Array.new.push(turn.turn_get_a_card_from_deck)\n when rand_num == 1: turn.turn_get_cards_from_stack(1)\n end\n else\n list_of_cards = turn.turn_get_cards_from_stack(1)\n end\n list_of_cards.concat(turn.turn_get_cards_from_stack(1))\n end",
"def deal(hsh, user, *hide)\n cached_total = hsh[user][:hand_total]\n user_hand = hsh[user][:cards]\n new_card = []\n deck = hsh[:deck]\n suit = deck.keys.sample\n cards = deck[suit][:cards]\n single_card = select_valid_cards(cards).keys.sample\n value = cards[single_card].sample\n card_display = inspect_card(single_card)\n suit_display = suit.to_s.capitalize[0]\n new_card << card_display.to_s\n new_card << suit_display.to_s\n new_card << remove_card(cards[single_card], value)\n if ace?(card_display) && will_user_bust?(cached_total)\n modify_ace_value!(new_card)\n end\n if hide == []\n display_single_card(user, new_card)\n sleep(1)\n end\n cached_total[0] += new_card[2]\n user_hand << new_card\n if twentyone?(cached_total.sum) && user == :player\n display_banner(\"#{user.capitalize} got 21!\")\n sleep(1)\n end\nend",
"def card_from_user(hand, cards_played)\n next_card_prompt(hand)\n\n puts \"What card would you like to play?\"\n card = get_card_following_suit(hand, cards_played)\n\n puts \"You picked #{card}\"\n hand.delete(card)\n\n card\n end",
"def show_dealer_cards(dlr_first_hand, game_status)\n c1_pic = dlr_first_hand[:show_card_1][:picture]\n c1_name = dlr_first_hand[:show_card_1][:name]\n c2_pic = dlr_first_hand[:show_card_2][:picture]\n c2_name = dlr_first_hand[:show_card_2][:name]\n hits = dlr_first_hand[:hit_cards].map { |n| n[:name] }\n dealer_hand_total = game_status[:dealer_hand]\n\n if game_status[:show_all_hands] == false\n c2_pic = '? '\n dealer_hand_total = \"unknown\"\n end\n\n prompt \"***** Dealers Cards *****\"\n prompt \"Here are the dealers first 2 cards\"\n prompt \"First card => #{c1_name}\"\n prompt \"Second card => Dealer to know, you to find out..\"\n prompt \"+-----+ +-----+\"\n prompt \"| | | |\"\n prompt \"| #{c1_pic} | | #{c2_pic} |\"\n prompt \"| | | |\"\n prompt \"+-----+ +-----+\"\n prompt \" \"\n prompt \"Dealers 'hit cards' #{hits}\"\n prompt \"The dealers total card count is #{dealer_hand_total}\"\nend",
"def pick_player_card\n # TODO: Use Random to get a new random card\n rand(1..11)\nend",
"def show_dealer_cards(dlr_first_hand, game_status)\n c1_pic = dlr_first_hand[:show_card_one][:picture]\n c1_name = dlr_first_hand[:show_card_one][:name]\n c2_pic = dlr_first_hand[:show_card_two][:picture]\n c2_name = dlr_first_hand[:show_card_two][:name]\n hits = dlr_first_hand[:hit_cards].map { |n| n[:name] }\n dealer_hand_total = game_status[:dealer_hand]\n\n if game_status[:show_all_hands] == false\n c2_pic = '? '\n dealer_hand_total = \"unknown\"\n end\n\n prompt \"***** Dealers Cards *****\"\n prompt \"Here are the dealers first two cards\"\n prompt \"First card => #{c1_name}\"\n prompt \"Second card => Dealer to know, you to find out..\"\n prompt \"+-----+ +-----+\"\n prompt \"| | | |\"\n prompt \"| #{c1_pic} | | #{c2_pic} |\"\n prompt \"| | | |\"\n prompt \"+-----+ +-----+\"\n prompt \" \"\n prompt \"Dealers 'hit cards' #{hits}\"\n prompt \"The dealers total card count is #{dealer_hand_total}\"\nend",
"def choose_cards(turn, player)\n num = rand(turn.turn_stack_inspect.size)\n num += 1\n\n if turn.turn_card_on_deck?\n rand_num = rand(2)\n case\n when rand_num == 0: Array.new.push(turn.turn_get_a_card_from_deck)\n when rand_num == 1: turn.turn_get_cards_from_stack(num)\n end\n else\n turn.turn_get_cards_from_stack(num)\n end\n end",
"def display_hero(input)\n #use a find by name method to get the right hero and then display the information\n if Hero.find_by_name(input)\n hero = Hero.find_by_name(input)\n hero.display_information\n menu\n else\n puts \"\\nSorry could not find a hero by that name. Please try again.\".colorize(:green)\n menu\n end\n end",
"def display_menu\n title_print\n puts \"Hi #{@todays_hero.name}!\"\n puts \"***************************\"\n selection = TTY::Prompt.new.select(\"What would you like to do?\", per_page: 10, cycle: true) do |menu|\n menu.enum '>'\n\n menu.choice 'Start a fight', 1\n menu.choice 'Train for battle', 2\n menu.choice 'Go on a Quest', 3\n menu.choice 'Show Stats', 4\n menu.choice 'Display Instructions', 5\n menu.choice 'Display Leaderboard', 6\n menu.choice 'Exit', 7\n end\n self.start_game_loop(selection)\n end",
"def create\n # new instance of a card with parameters of card details\n @card = Card.create(card_params)\n # current user info gets associated with card?? ASK\n # if card is valid based on our criteria (validations)\n # then the card will be saved and added to list of all cards\n # and user will be redirected to list of all cards\n if @card.valid?\n @card.save!\n \n redirect_to cards_path\n # if card doesn't fit our criteria, then user will get an\n # error message\n else\n render :new\n flash[:alert] = \"There was an error with your submission\"\n end\n end",
"def choose_card \n\n @cards.shift\n end",
"def play_game\n\n Console_Screen.cls #Clear the display area\n \n #Assist the player and dealer an initial starting card\n playerHand = get_new_card\n dealerHand = get_new_card\n \n #Call the method responsible for dealing new cards to the player\n playerHand = complete_player_hand(playerHand, dealerHand)\n \n #If the player has not gone bust, call the method responsible for managing\n #dealer's hand\n if playerHand <= 21 then\n dealerHand = play_dealer_hand(dealerHand)\n end\n\n #call the method responsible for determining the results of the game\n determine_winner(playerHand, dealerHand)\n\n end",
"def reading_card(card_obj, card_array, card_string)\n system \"clear\"\n puts card_string\n user_choice = \"\"\n while user_choice != \"⬅️ BACK ⬅️\" do\n user_choice = prompt.select(\"🔮 #{self.user.name}, please choose from the list below.\") do |menu|\n menu.choice \"🔮 READ TYPE 🔮\", -> {card_obj.display_type}\n menu.choice \"🔮 READ NAME 🔮\", -> {card_obj.display_name}\n menu.choice \"🔮 READ VALUE 🔮\", -> {card_obj.display_value}\n menu.choice \"🔮 READ DESCRIPTION 🔮\", -> {card_obj.display_description}\n menu.choice \"⬅️ BACK ⬅️\", -> {self.list_hand_cards(card_array); \"⬅️ BACK ⬅️\"}\n end\n end\n end",
"def next_card\n if [\"pass\",\"fail\"].include?(params[:card_status])\n quiz = Quiz.find(params[:quiz_id])\n user = quiz.user\n card = Card.find(params[:card_id])\n\n card.pass(user) if params[:card_status] == \"pass\"\n card.fail(user) if params[:card_status] == \"fail\"\n\n cv = CardView.find_or_create(user, card)\n quiz.shuffle_card_into_queue(cv)\n\n current_card = quiz.current_card\n redirect_to quiz_card_path(quiz, current_card)\n else\n flash[:error] = \"Couldn't figure out whether you passed or failed that particular card... try again?\"\n redirect_to :back\n end\n end",
"def take_turn(player)\n p player.render_hand\n #render their hand\n p \"Which cards do you want to discard? (first, second..etc) i.e. '1,2' If none, reply 'none'\"\n discarded_cards = gets.chomp\n indices = parse(discarded_cards)\n discard(indices, player)\n #promt for how many new cards? => quantity\n #rerender the hand\n #promt for fold?\n #prompt them for a bet.. show their current bet\n end",
"def take_turn(session, card, player)\n session.choose(card)\n session.choose(player)\n session.click_on(\"Take Turn\")\nend",
"def get_user_cards\n\tloop do\n\t\tprint \"\\nEnter your set or type 'help': \"\n\t\tcase user_array = gets.chomp.downcase.split(\",\")\n\t\twhen [\"help\"]\n\t\t\tsystem('clear'); system('cls')\n\t\t\tputs \"Command list:\" +\n\t\t\t\"\\n\\thelp\\tRedisplay this help menu.\" +\n\t\t\t\"\\n\\thint\\tDisplay a correct set. Removes one hint from the hint counter.\" +\n\t\t\t\"\\n\\tquit\\tQuit to main menu without saving.\" +\n\t\t\t\"\\n\\tsave\\tSave the game. Game continues.\" +\n\t\t\t\"\\n\\tshow\\tRedisplay the current hand. Useful if screen is full.\"\n\t\t\tputs \"Valid set:\" +\n\t\t\t\"\\n\\tInteger,Integer,Integer\" +\n\t\t\t\"\\n\\tInteger must be between min and max card number in hand to be valid.\"\n\t\t\tputs \"\\nHit enter to continue.\"\n\t\t\tgets\n\t\t\tshow_hand\n\t\twhen [\"hint\"]\n\t\t\tputs get_hint # returns hint (+ number left) or \"No more hints available.\"\n\t\twhen [\"quit\"]\n\t\t\t# setting up conditions to allow for quiting\n\t\t\t@top_card = 81\n\t\t\t@hand = []\n\t\t\treturn [\"quit\"]\n\t\twhen [\"save\"]\n\t\t\tsave_game\n\t\twhen [\"show\"]\n\t\t\tshow_hand\n\t\telse\n\t\t\tif good_set_syntax? user_array\n\t\t\t\t# return user defined set in ascending card order\n\t\t\t\treturn user_array.map {|card_num| card_num.to_i}.sort\n\t\t\tend\n\t\t\tputs \"Invalid command or set syntax.\"\n\t\tend\n\tend\nend",
"def display_hands(player_hand, dealer_hand, hide_dealer=false)\n system('clear') || system('cls')\n puts \">>>>>> Twenty-One <<<<<<\"\n prompt(\"Dealer's Hand:\")\n print_cards(dealer_hand, hide_dealer)\n puts\n prompt(\"Player's Hand:\")\n print_cards(player_hand)\nend",
"def hero_add (fwt, owner_id, hero_id, rating_id)\n\n\town_hero = false\n\t\tfwt.execute(\"SELECT heros_id FROM acquisitions WHERE owners_id=?\",[owner_id]).each do |value|\n\t\t\tif value[0] == hero_id\n\t\t\t\tputs \"\\n\\nYou already own this hero!\"\n\t\t\t\town_hero = true\n\t\t\tend\n\t\tend\n\n\tif own_hero == false\n\t\tfwt.execute(\"INSERT INTO acquisitions (owners_id, heros_id, ratings_id) VALUES (?, ?, ?)\", [owner_id, hero_id, rating_id])\n\t\tputs \"\\n\\nHero has been added!\"\n\tend\nend",
"def main\n welcome\n card1, card2, upcard = ask_user\n advice(card1, card2, upcard)\n # puts \"card1: \" + card1.to_s\n # puts \"card2: \" + card2.to_s\n # puts \"upcard: \" + upcard.to_s\nend",
"def play_game\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Assign the player and dealer an initial starting card\r\n playerHand = get_new_card\r\n dealerHand = get_new_card\r\n\r\n #Call the method responsible for dealing new cards to the player\r\n playerHand = complete_player_hand(playerHand, dealerHand)\r\n\r\n #If the player has not gone bust, call the method responsible for managing\r\n #dealer's hand\r\n if playerHand <= 21 then\r\n dealerHand = play_dealer_hand(dealerHand)\r\n end\r\n\r\n #call the method responsible for determining the results of the game\r\n determine_winner(playerHand, dealerHand)\r\n\r\n end",
"def select_credit_card\n chooses \"credit card\"\n clicks_button \"Continue\"\n end",
"def action_useCard(pockerCard_id)\n\n if check_cardOwn(pockerCard_id) and check_currentTurn()#only owner can play card and current turn on\n if check_usableNumShape(pockerCard_id) #check bottom number and shape\n\n sourcePlayer_id = Game.last.players.by_user(current_user).id\n destPlayer_id = Game.last.players.dummy.id # destPlayer_id = 2 (dummy) \n\n action_moveCard(dest_id: destPlayer_id, source_id: sourcePlayer_id, card_id: pockerCard_id)\n\n #check effect of cards\n card_effect = Pockercard.find(pockerCard_id).effect\n action_addDummyList(pockerCard_id)\n action_putBottomCard(pockerCard_id)\n if card_effect == \"none\"\n action_endTurn(1) #move to next player=[\n elsif card_effect == \"back\" \n Game.last.toggle_order!\n action_endTurn(1) #skip next player\n elsif card_effect == \"jump\" \n action_endTurn(2) #move to next next player\n elsif card_effect == \"attack\"\n action_attackCard(pockerCard_id)\n action_endTurn(1) #move to next next player\n elsif card_effect == \"change\"\n action_setBottomCardStep()\n elsif card_effect == \"onemore\" \n else\n action_endTurn(1) #skip next player\n end\n check_winOrLose() \n end\n end\n\n\n\n end",
"def show_hand(player_ID)\n card_ID = 0\n print_with_pause(\"Here are your cards...\".colorize(:red))\n print_with_pause(\"Choose wisely.\".colorize(:red))\n waits(2)\n puts `clear`\n while card_ID < @players[player_ID].cards.length\n line_number = card_ID + 1\n puts (line_number.to_s + \". \" + @players[player_ID].cards[card_ID].value).colorize(:black).on_white\n card_ID = card_ID + 1\n end\n end",
"def hcard\n if @profile.nil?\n flash[:notice]= 'You must create your profile first'\n redirect_to new_space_user_profile_path(@space, :user_id=>current_user.id)\n else\n render :partial=>'hcard'\n end\n end",
"def opponent_turn\n #set variables\n game = Game.find(self.game_id)\n player = Player.find(game.players.last)\n draw_card = Card.where(player_id: -2).first\n opponent_cards = Card.where(player_id: self.id)\n possible_plays = []\n colors = [\"blue\", \"green\", \"red\", \"yellow\"]\n\n #determine eligible cards in hand.\n opponent_cards.each do |card|\n if card.color == draw_card.color || card.number == draw_card.number || (card.card_action != nil && card.card_action == draw_card.card_action)\n possible_plays.push(card)\n end\n end\n #starts decision logic for card to play, otherwise draws a card and looks for possible plays\n if possible_plays.any?\n #discard current draw pile card\n draw_card.player_id = -1\n draw_card.save\n\n #determines card to be played, sets card to be the new draw pile card\n selected_card = possible_plays.sample\n selected_card.player_id = -2\n selected_card.save\n\n #determines if card has special action, and executes action if it does.\n if selected_card.card_action != nil\n\n if selected_card.card_action === \"skip\" || selected_card.card_action === \"reverse\"\n self.opponent_turn\n elsif selected_card.card_action === \"draw\"\n draw_two = Card.where(player_id: 0).sample(2)\n draw_two.each do |card|\n card.player_id = game.players.first.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"draw_four\"\n draw_four = Card.where(player_id: 0).sample(4)\n draw_four.each do |card|\n card.player_id = player.id\n card.save\n end\n self.opponent_turn\n elsif selected_card.card_action === \"wild_color\"\n selected_card.color = colors.sample\n selected_card.save\n end\n\n else\n #switches current turn once card has been selected and played\n if game.current_turn = self.id\n game.current_turn = player.id\n game.save\n else\n game.current_turn = self.id\n game.save\n end\n\n end\n\n else\n #draws a card from the draw pile and repeats opponent_turn process.\n drawn_card = Card.where(player_id: 0).sample\n drawn_card.player_id = self.id\n drawn_card.save\n self.opponent_turn\n end\n end",
"def generate_hero_name\n buffer\n hero = Hero.new\n line\n puts \"What is your hero's given name?\"\n line\n choice = gi_string\n hero.name = choice\n line\n puts \"#{hero.name} is the name you chose. If this is correct, press 1? Press 2 if not. Press 3 to go back.\"\n line\n choice = gi_integer\n if choice == 1\n generate_hero_alter_ego(hero)\n elsif choice == 2\n generate_hero_name\n elsif choice == 3\n hero_setup\n else line \n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_hero_name\n end\n end",
"def generate_your_hero_battle(hero)\n buffer\n line\n puts \"Get ready #{hero.alter_ego}, the people need you!\"\n puts \"What evil wretch are you going to throw behind bars today?\"\n display_villains\n puts \"Would you like to fight any of these Villains?\"\n line\n puts \"Press 1 to fight a Villain from the list. Press 2 to generate a random Villain.\"\n line\n choice = gi_integer\n if choice == 1\n choose_villain_from_list(hero)\n elsif choice == 2\n villain = Villain.create(name: Faker::Name.name_with_middle, alter_ego: Faker::Superhero.name, super_power: Faker::Superhero.power, power_lvl: Faker::Number.within(range: 50..300), resistance: Faker::Number.within(range: 1..40), hp: Faker::Number.within(range: 500..1000), gender: Faker::Gender.binary_type, race: Faker::Games::DnD.species, origin_story: Faker::Lorem.paragraphs(number: 3), nemesis: nil, grievance: Faker::Verb.base, insane_asylum: false, mental_health: Faker::Number.within(range: 1..10))\n hero_battle_sequence(hero, villain)\n else line\n puts \"Your input was not recognized, and the world needs you! Please begin this step again.\"\n line\n generate_your_hero_battle(hero)\n end\n end",
"def play_card(user, card, args)\n player_name = user.to_s\n unless user == active_user\n return [false, nil, {player_name => 'You must wait your turn.'}]\n end\n player = find_player(user)\n\n id = card.to_i\n index = player.hand.index { |c| c.id == id }\n\n if player.hand.size == 1\n raise \"#{player_name} played before drawing\"\n end\n\n if !index\n return [false, nil, {player_name => \"You do not have a #{card}\"}]\n end\n\n # Since there will only be two cards in hand, index will either be 0 or 1\n other_index = 1 - index\n\n if player.ministered? && id != 7\n seven = Card.new(7)\n msg = \"You MUST play your #{seven}: #{seven.usage}.\"\n return [false, nil, {player_name => msg}]\n end\n\n pubtext = nil\n privtext = {}\n\n args = args ? args.split : []\n\n if NEED_TARGET.include?(id)\n if args.empty?\n msg = \"You must specify a target for #{Card.name(id)}.\"\n return [false, nil, {player_name => msg}]\n end\n\n target = resolve_name(args[0])\n unless target\n msg = args[0] + ' is not a valid target.'\n return [false, nil, {player_name => msg}]\n end\n\n if target == player && id != 5\n msg = \"You can only self-target with a #{Card.name(5)}\"\n return [false, nil, {player_name => msg}]\n end\n end\n\n prefix = \"#{player} plays #{Card.name(id)}\"\n case id\n when 1\n # Guess\n guess = args[1] ? args[1].to_i : 0\n if 2 > guess || guess > 8\n msg = 'You must guess a number between 2 and 8.'\n return [false, nil, {player_name => msg}]\n end\n prefix << \" to see if #{target} has #{Card.name(guess)}. \"\n\n if target.protected?\n pubtext = prefix + \"But #{target} is protected!\"\n elsif target.card.id == guess\n pubtext = prefix + \"#{target} does and is out of the round!\"\n kill_player(target)\n else\n pubtext = prefix + \"But #{target} does not.\"\n end\n\n when 2\n # Peek at card\n pubtext = prefix + \" to see #{target}'s card.\"\n if target.protected?\n pubtext << \" But #{target} is protected!\"\n else\n privtext[player_name] = \"#{target} has a #{target.card}.\"\n privtext[target.name] = \"You showed #{player} your #{target.card}.\"\n end\n\n when 3\n # Battle!\n my_card = player.hand[other_index]\n\n prefix << \" to battle with #{target}. \"\n if target.protected?\n pubtext = prefix + \"But #{target} is protected!\"\n elsif target.card.id < my_card.id\n pubtext = prefix + \"#{target}'s #{target.card} is clearly \" +\n \"inferior, so #{target} is out of the round!\"\n kill_player(target)\n elsif target.card.id > my_card.id\n pubtext = prefix + \"#{player}'s #{my_card} is clearly \" +\n \"inferior, so #{player} is out of the round!\"\n kill_player(player)\n else\n pubtext = prefix + 'It was a great battle, but the match was ' +\n 'inconclusive.'\n end\n\n when 4\n # Protect\n player.protected = true\n pubtext = prefix + \". #{player} is protected for one turn!\"\n\n when 5\n # Force discard\n if deck_size > 0\n new_card = @deck.shift\n source = 'a card from the deck'\n else\n new_card = @facedown_card\n source = 'the facedown card'\n end\n\n if target == player\n replace_index = other_index\n old_card = player.hand[replace_index]\n else\n replace_index = 0\n old_card = target.card\n end\n\n pubtext = prefix + \" to make #{target} discard.\"\n\n if target.protected?\n pubtext << \" But #{target} is protected!\"\n elsif old_card.id == 8\n kill_player(target)\n pubtext << \" Because #{target} discarded a #{old_card}, \" +\n \"#{target} is out of the round!\"\n else\n pubtext << \" #{target} discards #{old_card} then picks up #{source}.\"\n target.discard_and_replace(new_card, replace_index)\n privtext[target.name] = \"#{player} made you discard your \" +\n \"#{old_card}. Your new card is #{new_card}.\"\n end\n\n when 6\n # Trade hands\n pubtext = prefix + \" to trade hands with #{target}.\"\n if target.protected?\n pubtext << \" But #{target} is protected!\"\n else\n my_card, their_card = player.trade_hand_with(target, other_index)\n privtext[player_name] =\n \"You traded with #{target} and got a #{my_card}.\"\n privtext[target.name] =\n \"#{player} traded with you giving you a #{their_card}.\"\n end\n\n when 7\n pubtext = prefix + '.'\n\n when 8\n # Die!\n pubtext = prefix + \". #{player_name} is out of the round!\"\n kill_player(player)\n end\n\n if player.alive?\n # If I'm still alive, play my card.\n # If I died, I've already discarded my cards so don't play.\n player.play_card_at(index)\n\n # Let next player take turn.\n # If I'm alive, that means I must rotate to the back.\n # If I'm dead, next player is already in position, so no rotate.\n @round_player_order.rotate!\n end\n\n compare_cards if deck_size == 0\n\n [true, pubtext, privtext]\n end",
"def create\n @card = Card.new(params[:card])\n @current_user = User.find_by_id(session[:user_id])\n\n unless @current_user.admin?\n flash[:error] = \"You do not have permission to create a card\"\n redirect_to cards_path(@cards)\n return\n end\n\n respond_to do |format|\n if @card.save\n format.html { redirect_to @card, notice: 'Card was successfully created.' }\n format.json { render json: @card, status: :created, location: @card }\n else\n format.html { render action: \"new\" }\n format.json { render json: @card.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pick_random\n @card_list.pick_random\n end",
"def pick_random\n @card_list.pick_random\n end",
"def select_hero\n puts @hero_preference.shift\n end",
"def select_hero\n puts @hero_preference.shift\n end",
"def show\n set_card\n end",
"def draw_card(user_id)\n card_number = DrawnCard.draw_card(self.drawn_cards.pluck(:card_number))\n self.drawn_cards.create({user_id: user_id, card_number: card_number})\n self.check_for_stop user_id\n end",
"def addCard(givenCard)\n \tcards_users.create(card_id: givenCard.id, is_shared: false)\n end",
"def set_has_card\n @has_card = HasCard.find(params[:id])\n end",
"def start_game\n @deck_current = @deck_default\n @hand_dealer = []\n @hand_player = []\n get_card_and_put_in_hand(\"dealer\")\n get_card_and_put_in_hand(\"dealer\")\n get_card_and_put_in_hand(\"player\")\n get_card_and_put_in_hand(\"player\")\n\n display_board_screen(true)\n\n result_player = turn_player\n\n if result_player === \"over\"\n puts \"player is over 21, press enter to continue\"\n gets\n bet_attribution(\"lose\")\n display_betting_screen(false)\n elsif result_player === \"stay\"\n result_dealer = turn_dealer\n end\n \n if result_dealer === \"over21\"\n puts \"Dealer over 21, press enter to continue\"\n gets\n bet_attribution(\"win\")\n display_betting_screen(false)\n elsif result_dealer === \"over17\"\n final_result = check_who_wins(calculate_hand_total_value(@hand_dealer), calculate_hand_total_value(@hand_player))\n if final_result === \"draw\"\n puts \"It's a draw, press enter to continue\"\n bet_attribution(\"push\")\n elsif final_result === \"player\"\n puts \"Player wins, press enter to continue\"\n bet_attribution(\"win\")\n elsif final_result === \"dealer\"\n puts \"Dealer wins, press enter to continue\"\n bet_attribution(\"lose\")\n end\n \n gets\n display_betting_screen(false)\n end\n\nend",
"def generate_hero_gender(hero)\n buffer\n line\n puts \"Is your hero male, female, or any other?\"\n line\n choice = gi_string\n hero.gender = choice\n line\n puts \"Your hero's gender is #{hero.gender}. If this is correct, press 1. Press 2 if not. Press 3 to go back.\"\n line\n choice = gi_integer\n if choice == 1\n generate_hero_race(hero)\n elsif choice == 2\n generate_hero_gender(hero)\n elsif choice == 3\n generate_hero_hp(hero)\n else line\n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_hero_gender(hero)\n end\n end",
"def handle_user_choice\n ans = nil # track user input\n while true\n puts \"\\nChoose one of the following options.\"\n puts \"1. Enter set.\"\n puts \"2. Redeal cards (if no sets).\"\n ans = gets.chomp.to_i\n\n if ans == 1\n break\n elsif ans == 2\n redeal # redeal cards\n print_cards\n else\n puts \"Invalid input.\"\n end\n end\n\n ans # return user input\nend",
"def gets_user_guess\n @guess = gets.strip.downcase\n generate_new_card\n end",
"def choose_cards(turn, player)\n num = rand(turn.turn_stack_inspect.size)\n num += 2\n\n turn.turn_get_cards_from_stack(num)\n end",
"def game\n horse_playing = true\n while horse_playing == true\n selecting = TTY::Prompt.new\n horses = ['PinkLightning', 'WildCat', 'Eclipse', 'Delphi', 'TheDaringDrunk', 'CrazySisterSeline', 'JackSparrow', 'RunningBull', \"RazMaTazz\"]\n racers = []\n selector = 0\n 4.times{\n racer = horses.sample\n horses.delete(racer)\n racers.push(racer)\n }\n puts \"The following horses are racing\"\n puts racers\n choice = selecting.select(\"Who do you think will win\", racers)\n bet = gamble()\n winner = racers.sample\n case winner == choice\n when true\n if choice != \"RazMaTazz\"\n puts \"#{winner} comes thundering over the line, you have won this time\"\n @balance = bet + @balance\n else\n puts \"#{winner} comes in last, better luck next time!\"\n @balance = @balance - bet\n end\n when false\n puts \"#{winner} comes in first, better luck next time!\"\n @balance = @balance - bet\n end\n horse_playing = selecting.select(\"Would you like to bet on the next race\" , [\"Yes\",\"No\"]) == \"Yes\"\n end\n puts \"Returning to Game Menu\"\n end",
"def menu \n prompt = TTY::Prompt.new\n choices = [\"Race🏎️\", \"Go to Garage🧰\", \"Open Shop🔑\", \"Leaderboards📈\", \"Log Out\"]\n choice = prompt.select(\"\", choices) \n if choice == choices[0] && user.user_cars.size > 0 \n system(\"clear\")\n race_meth() #############RACEMETH\n elsif choice == choices[0] && user.user_cars.size == 0 \n system(\"clear\")\n puts \"You have no cars to race. Purchase one from the shop first!\"\n menu()\n elsif choice == choices[1] && user.user_cars.size > 0 \n system(\"clear\")\n garage()\n elsif choice == choices[1] && user.user_cars.size == 0 \n system(\"clear\")\n puts \"You have no cars in your garage. Purchase one from the shop first!\"\n menu()\n elsif choice == choices[2] \n system(\"clear\")\n shop()\n elsif choice == choices[3]\n leaderboards()\n else\n intro() \n end \nend",
"def choose_club\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"For which club?\", filter: true) do |menu|\n all_clubs.each do |club|\n menu.choice club.name\n end\n end\nend",
"def show_cards\r\n @user_cards = User.find(params[:id]).cards\r\n end",
"def show\n @card_one = Card.find( params[:id] )\n setup_for_display \n end",
"def pick_random\r\n @card_list.pick_random\r\n end",
"def add_hero(superhero_conn)\n name = get_answer_to(\"What is your Superhero's name?\")\n cover = get_answer_to(\"What is their alias?\")\n has_cape = get_answer_to(\"Do they have a cape?\")\n if has_cape.include? 'y'\n has_cape = true\n cape = \"a derpy cape\"\n else\n has_cape = false\n cape = \"no cape\"\n end\n strength = get_answer_to(\"What is their power?\")\n rival = get_answer_to(\"Who is their rival?\")\n superhero_conn.exec(\"INSERT INTO super_heros (name, cover, has_cape, strength, rival) VALUES ('#{name}', '#{cover}', '#{has_cape}', '#{strength}', '#{rival}');\")\n puts \"#{name}, or \\\"#{cover}\\\" *wink wink*, has #{cape} and with the power of #{strength} and a rival named #{rival}\"\nend",
"def draw_card(card)\r\n\t\thand.add_card(card)\r\n\tend",
"def choose_character\n char_move = CharacterMove.all \n characters = Character.all \n move = Move.all\n # puts status_bar\n\n # puts \"1) Wolverine 2)Jean Grey 3)Quick-Silver\"\n \n # puts \"Choose Your Character..\"\n # user_input = gets.chomp\n ch = @prompt.select(\"Choose Your Character..\", %w(Martian-Manhunter Superman Flash Help))\n \n if ch == \"Martian-Manhunter\"\n # binding.pry\n @current_character = characters[0]\n first = characters[0].name\n @life_count = characters[0].lives\n puts \"You Have Chosen #{first}. You have #{@life_count} lives\"\n if char_move[0].char_id == characters[0].id\n @special_move = move[0].name\n end\n system('clear')\n\n \n elsif ch == \"Superman\"\n @current_character = characters[1]\n second = characters[1].name\n @life_count = characters[1].lives\n puts \"You Have Chosen #{second}. You have #{@life_count} lives\"\n if char_move[1].char_id == characters[1].id\n @special_move = move[1].name\n end\n \n elsif ch == \"Flash\"\n @current_character = characters[2]\n third = characters[2].name\n @life_count = characters[2].lives\n puts \"You Have Chosen #{third} You have #{@life_count} lives\"\n if char_move[2].char_id == characters[2].id\n @special_move = move[2].name\n \n end\n \n \n \n elsif ch == \"Help\" \n help \n puts \"\\n\"\n \n choose_character\n \n \n \n \n else\n puts \"Invalid Command\"\n end\n \n end",
"def display_board_screen(hidden_dealer)\n display_hand_dealer = []\n display_hand_player = []\n\n if hidden_dealer\n dealer_card = [generate_ASCII_card(@hand_dealer[0]),generate_ASCII_card(@hidden_card)]\n display_hand_dealer = concatenate_cards(dealer_card)\n\n else\n dealer_card = []\n @hand_dealer.each do |card|\n dealer_card.push(generate_ASCII_card(card))\n end\n display_hand_dealer = concatenate_cards(dealer_card)\n end\n \n\n @hand_player.each do |card|\n player_card = []\n @hand_player.each do |card|\n player_card.push(generate_ASCII_card(card))\n end\n display_hand_player = concatenate_cards(player_card)\n end\n\n system \"clear\" or system \"cls\"\n puts \"Dealer:\"\n puts display_hand_dealer\n puts\n puts \"Player:\"\n puts display_hand_player\n puts\n puts \"Do you want to (h)it or (s)tay?\"\nend",
"def set_card\n @card = @plan.cards.find(params[:id])\n end",
"def get_chosen_card(player, match_card, deck)\n begin\n puts 'Enter colour (R, B, Y, G) followed by a number(0-9) - Eg to play a Red 7, enter R7'\n puts 'Or, R, B, Y, G followed by R-Reverse, S-Skip or P2-Pickup 2 - Eg to play a Green Pickup 2, enter GP2'\n puts 'Enter WC for Wild Card, WP4 for Wild Pickup 4 '\n puts 'Enter D to pick up from the deck'\n puts 'What would you like to play? '\n option = gets.downcase\n color = option[0]\n number = option[1, 2].strip\n color = validate_color(color)\n if color == 'Draw'\n player.cards << deck.take_card\n return false\n end\n number = validate_number(number)\n chosen_card = validate_card_in_hand(color, number, player)\n validate_card_matches_discard(color, number, match_card)\n rescue InvalidColorError => e\n puts e.message\n retry\n rescue InvalidNumberError => e\n puts e.message\n retry\n rescue InvalidCardInHandError => e\n puts e.message\n retry\n rescue InvalidCardMatchError => e\n puts e.message\n retry\n end\n chosen_card\n end",
"def show_card\n\t\t@cards.shuffle.first\n\tend",
"def character_check(character)\n system \"clear\"\n puts character\n user_happy = $prompt.select(\"Are you happy with this character?\", [\"Yes\", \"No\"])\n if user_happy == \"Yes\"\n $player = character\n pick_difficulty\n else\n sleep(1)\n make_character\n end\nend",
"def create\n # create the guess object based on the params passed form the form, i.e the text of the guess, the user_id and the card_id\n # we are able to find the @card and the @round becuase we passed their id's as hidden fields in the form that was submitted\n @guess = Guess.create(guess_params)\n # find the card the guess is associated with\n @card = Card.find(guess_params[:card_id]);\n # find the round the guess is associated with\n @round = Round.find(guess_params[:round_id])\n\n respond_to do |format|\n # calling the card instance method 'check_guess' and passing it the @guess object\n # this method will compare the guess to the card's answer and return true if correct, false if incorrect\n # you can find this check_guess method in models/card.rb\n result = @card.check_guess(@guess)\n \n # if the result of the guess was true, that means it was correct\n if result == true\n # the guess was correct, so update the \"correct\" attribute on the guess to true (it was false by default)\n @guess.update_attributes(correct: true)\n # delete the card_id that was answered correctly from our array of cards_not_answered, which is stored in the session\n # if we delete the card_id of the card that was answered, it will no longer be showin in the game\n session[:cards_not_answered].delete(@card.id)\n\n # this is checking if there aren't any cards left in the cards_not_answered\n # if its greater than 0, then there are still cars left to anser\n if session[:cards_not_answered].length > 0\n # randomly select a card_id from the cards_not_answered array\n next_card_id = session[:cards_not_answered].sample\n # redirect to play that card, using the variable next_card_id that we just made\n # this is redirecting to the /cards/:id/play/:round_id route, which will trigger the play_card method. the play_card method will render the view with the new card's question and a submit form to anser it\n format.html {redirect_to \"/cards/#{next_card_id}/play/#{@round.id}\"}\n else\n # if there aren't any cards left in the cards_not_answered array then the game must be over - we have answered all the cards\n # in this case, we should redirect to the results route which will show our results\n format.html {redirect_to \"/rounds/#{@round.id}/results\"}\n end\n else\n # down here is the block for if the guess was not correct\n # if the guess was incorrect, we simply pick a new card_id from the cards_not_answered array that is stored in the session\n next_card_id = session[:cards_not_answered].sample\n # with that next_card_id we can redirect to /cards/:id/play/:round_id route, which will trigger the play_card method which will render the view with the next card's question and a submit form to answer\n format.html {redirect_to \"/cards/#{next_card_id}/play/#{@round.id}\"} \n end\n end\n end",
"def new_game\n puts \"Start A New Game?\".colorize(:light_magenta,)\n puts \"------------------------------------------------------\".colorize(:yellow)\n prompt = TTY::Prompt.new\n choices = [\n {name: 'Yes', value: 1},\n {name: 'No', value: 2},\n ]\n players_input = prompt.select(\"Select An Option:\", choices) \n case players_input\n when 1\n return execute_game\n when 2\n return main_menu\n end \nend",
"def build_card\n @items = game.reset_items\n @card = BingoBuilder::Card.new(@game.title, @game.size)\n add_mandatory_items\n add_discretionary_items\n @card\n end",
"def playerTurn\n\t\tGem.win_platform? ? (system \"cls\") : (system \"clear\")\n\t\tputs \"#{@active.name}'s turn\"\n\t\tgets\n\t\tcontinue = true\n\t\twhile continue\n\t\t\t# Print board and hand\n\t\t\tprintBoard\n\t\t\t@active.printHand\n\t\t\tsize = @active.handSize\n\t\t\tputs \"(B) Buy a card\"\n\t\t\tputs \"(E) End turn\"\n\t\t\tprint \"Enter Selection: \"\n\t\t\tinput = gets.chomp.downcase\n\t\t\tnumInput = input.to_i\n\n\t\t\tif(input == 'b')\n\t\t\t\t# Automatically use treasure cards\n\t\t\t\tcoins = @active.coins\n\t\t\t\t@coins += coins\n\t\t\t\t# End the player's turn if they bought at least one card\n\t\t\t\tcontinue = !buyMenu\n\t\t\t\t@coins -= coins\n\t\t\telsif(input == 'e')\n\t\t\t\tcontinue = false\n\t\t\telsif(numInput > 0 and numInput <= size)\n\t\t\t\tcardPlayMenu(@active.getCard(numInput))\n\t\t\telse\n\t\t\t\tputs \"Invalid input\"\n\t\t\t\tgets\n\t\t\tend\n\t\tend\n\n\t\t@active.endTurn\n\tend",
"def deck_options(deck_option)\n case deck_option\n when 1 \n result = []\n counter = 0\n answer1 = Question.find(1).answers[0]\n answer2 = Question.find(1).answers[1]\n answer3 = Question.find(1).answers[2]\n puts Deck.find(1).questions[0].question\n puts \"a) #{answer1.name}\"\n puts \"b) #{answer2.name}\"\n puts \"c) #{answer3.name}\"\n answer1_user = gets.chomp\n if answer1_user == \"a\"\n answer1_user = answer1\n elsif answer1_user == \"b\"\n answer1_user = answer2\n elsif answer1_user == \"c\"\n answer1_user = answer3\n end\n a = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[0].id, answer_id: answer1_user.id, correct: answer1_user.correct)\n result << a.correct\n #\n #\n answer4 = Question.find(2).answers[0]\n answer5 = Question.find(2).answers[1]\n answer6 = Question.find(2).answers[2]\n puts Deck.find(1).questions[1].question\n puts \"a) #{answer4.name}\"\n puts \"b) #{answer5.name}\"\n puts \"c) #{answer6.name}\"\n answer2_user = gets.chomp\n if answer2_user == \"a\"\n answer2_user = answer4\n elsif answer2_user == \"b\"\n answer2_user = answer5\n elsif answer2_user == \"c\"\n answer2_user = answer6\n end\n b = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[1].id, answer_id: answer2_user.id, correct: answer2_user.correct)\n result << b.correct\n #\n #\n answer7 = Question.find(3).answers[0]\n answer8 = Question.find(3).answers[1]\n answer9 = Question.find(3).answers[2]\n\n puts Deck.find(1).questions[2].question\n puts \"a) #{answer7.name}\"\n puts \"b) #{answer8.name}\"\n puts \"c) #{answer9.name}\"\n answer3_user = gets.chomp \n if answer3_user == \"a\"\n answer3_user = answer7\n elsif answer3_user == \"b\"\n answer3_user = answer8\n elsif answer3_user == \"c\"\n answer3_user = answer9\n end\n c = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[2].id, answer_id: answer3_user.id, correct: answer3_user.correct)\n result << c.correct\n #\n #\n answer10 = Question.find(4).answers[0]\n answer11 = Question.find(4).answers[1]\n answer12 = Question.find(4).answers[2]\n puts Deck.find(1).questions[3].question\n puts \"a) #{answer10.name}\"\n puts \"b) #{answer11.name}\"\n puts \"c) #{answer12.name}\"\n answer4_user = gets.chomp\n if answer4_user == \"a\"\n answer4_user = answer10\n elsif answer4_user == \"b\"\n answer4_user = answer11\n elsif answer4_user == \"c\"\n answer4_user = answer12\n end\n d = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[3].id, answer_id: answer4_user.id, correct: answer4_user.correct)\n result << d.correct\n #\n #\n answer13 = Question.find(5).answers[0]\n answer14 = Question.find(5).answers[1]\n answer15 = Question.find(5).answers[2]\n puts Deck.find(1).questions[4].question\n puts \"a) #{answer13.name}\"\n puts \"b) #{answer14.name}\"\n puts \"c) #{answer15.name}\"\n answer5_user = gets.chomp\n if answer5_user == \"a\"\n answer5_user = answer13\n elsif answer5_user == \"b\"\n answer5_user = answer14\n elsif answer5_user == \"c\"\n answer5_user = answer15\n end\n e = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[4].id, answer_id: answer5_user.id, correct: answer5_user.correct)\n result << e.correct\n #\n #\n answer16 = Question.find(6).answers[0]\n answer17 = Question.find(6).answers[1]\n answer18 = Question.find(6).answers[2]\n puts Deck.find(1).questions[5].question\n puts \"a) #{answer16.name}\"\n puts \"b) #{answer17.name}\"\n puts \"c) #{answer18.name}\"\n answer6_user = gets.chomp\n if answer6_user == \"a\"\n answer6_user = answer16\n elsif answer6_user == \"b\"\n answer6_user = answer17\n elsif answer6_user == \"c\"\n answer6_user = answer18\n end\n f = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[5].id, answer_id: answer6_user.id, correct: answer6_user.correct)\n result << f.correct\n #\n #\n answer19 = Question.find(7).answers[0]\n answer20 = Question.find(7).answers[1]\n answer21 = Question.find(7).answers[2]\n puts Deck.find(1).questions[6].question\n puts \"a) #{answer19.name}\"\n puts \"b) #{answer20.name}\"\n puts \"c) #{answer21.name}\"\n answer7_user = gets.chomp\n if answer7_user == \"a\"\n answer7_user = answer19\n elsif answer7_user == \"b\"\n answer7_user = answer20\n elsif answer7_user == \"c\"\n answer7_user = answer21\n end\n g = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[6].id, answer_id: answer7_user.id, correct: answer7_user.correct)\n result << g.correct\n #\n #\n answer22 = Question.find(8).answers[0]\n answer23 = Question.find(8).answers[1]\n answer24 = Question.find(8).answers[2]\n puts Deck.find(1).questions[7].question\n puts \"a) #{answer22.name}\"\n puts \"b) #{answer23.name}\"\n puts \"c) #{answer24.name}\"\n answer8_user = gets.chomp\n if answer8_user == \"a\"\n answer8_user = answer22\n elsif answer8_user == \"b\"\n answer8_user = answer23\n elsif answer8_user == \"c\"\n answer8_user = answer24\n end\n h = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[7].id, answer_id: answer8_user.id, correct: answer8_user.correct)\n result << h.correct\n #\n #\n answer25 = Question.find(9).answers[0]\n answer26 = Question.find(9).answers[1]\n answer27 = Question.find(9).answers[2]\n puts Deck.find(1).questions[8].question\n puts \"a) #{answer25.name}\"\n puts \"b) #{answer26.name}\"\n puts \"c) #{answer27.name}\"\n answer9_user = gets.chomp\n if answer9_user == \"a\"\n answer9_user = answer25\n elsif answer9_user == \"b\"\n answer9_user = answer26\n elsif answer9_user == \"c\"\n answer9_user = answer27\n end\n i = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[8].id, answer_id: answer9_user.id, correct: answer9_user.correct)\n result << i.correct\n #\n #\n answer28 = Question.find(10).answers[0]\n answer29 = Question.find(10).answers[1]\n answer30 = Question.find(10).answers[2]\n puts Deck.find(1).questions[9].question\n puts \"a) #{answer28.name}\"\n puts \"b) #{answer29.name}\"\n puts \"c) #{answer30.name}\"\n answer10_user = gets.chomp\n if answer10_user == \"a\"\n answer10_user = answer28\n elsif answer10_user == \"b\"\n answer10_user = answer29\n elsif answer10_user == \"c\"\n answer10_user = answer30\n end\n j = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[9].id, answer_id: answer10_user.id, correct: answer10_user.correct)\n result << j.correct\n pp Stat.where(game_id: @new_game.id)\n result.each do |answers_do|\n if answers_do == 1\n counter += 1\n end\n end\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter} correct answers and #{10-counter} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n when 2 \n result_2 = []\n counter_2 = 0\n answer1_1 = Question.find(11).answers[0]\n answer2_1 = Question.find(11).answers[1]\n answer3_1 = Question.find(11).answers[2]\n puts Deck.find(2).questions[0].question\n puts \"a) #{answer1_1.name}\"\n puts \"b) #{answer2_1.name}\"\n puts \"c) #{answer3_1.name}\"\n answer1_1user = gets.chomp\n if answer1_1user == \"a\"\n answer1_1user = answer1_1\n elsif answer1_1user == \"b\"\n answer1_1user = answer2_1\n elsif answer1_1user == \"c\"\n answer1_1user = answer3_1\n end\n k = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[0].id, answer_id: answer1_1user.id, correct: answer1_1user.correct)\n result_2 << k.correct\n #\n #\n answer4_1 = Question.find(12).answers[0]\n answer5_1 = Question.find(12).answers[1]\n answer6_1 = Question.find(12).answers[2]\n puts Deck.find(2).questions[1].question\n puts \"a) #{answer4_1.name}\"\n puts \"b) #{answer5_1.name}\"\n puts \"c) #{answer6_1.name}\"\n answer2_1user = gets.chomp\n if answer2_1user == \"a\"\n answer2_1user = answer4_1\n elsif answer2_1user == \"b\"\n answer2_1user = answer5_1\n elsif answer2_1user == \"c\"\n answer2_1user = answer6_1\n end\n m = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[1].id, answer_id: answer2_1user.id, correct: answer2_1user.correct)\n result_2 << m.correct\n #\n #\n answer7_1 = Question.find(13).answers[0]\n answer8_1 = Question.find(13).answers[1]\n answer9_1 = Question.find(13).answers[2]\n\n puts Deck.find(2).questions[2].question\n puts \"a) #{answer7_1.name}\"\n puts \"b) #{answer8_1.name}\"\n puts \"c) #{answer9_1.name}\"\n answer3_1user = gets.chomp \n if answer3_1user == \"a\"\n answer3_1user = answer7_1\n elsif answer3_1user == \"b\"\n answer3_1user = answer8_1\n elsif answer3_1user == \"c\"\n answer3_1user = answer9_1\n end\n n = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[2].id, answer_id: answer3_1user.id, correct: answer3_1user.correct)\n result_2 << n.correct\n #\n #\n answer10_1 = Question.find(14).answers[0]\n answer11_1 = Question.find(14).answers[1]\n answer12_1 = Question.find(14).answers[2]\n puts Deck.find(2).questions[3].question\n puts \"a) #{answer10_1.name}\"\n puts \"b) #{answer11_1.name}\"\n puts \"c) #{answer12_1.name}\"\n answer4_1user = gets.chomp\n if answer4_1user == \"a\"\n answer4_1user = answer10_1\n elsif answer4_1user == \"b\"\n answer4_1user = answer11_1\n elsif answer4_1user == \"c\"\n answer4_1user = answer12_1\n end\n l = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[3].id, answer_id: answer4_1user.id, correct: answer4_1user.correct)\n result_2 << l.correct\n #\n #\n answer13_1 = Question.find(15).answers[0]\n answer14_1 = Question.find(15).answers[1]\n answer15_1 = Question.find(15).answers[2]\n puts Deck.find(2).questions[4].question\n puts \"a) #{answer13_1.name}\"\n puts \"b) #{answer14_1.name}\"\n puts \"c) #{answer15_1.name}\"\n answer5_1user = gets.chomp\n if answer5_1user == \"a\"\n answer5_1user = answer13_1\n elsif answer5_1user == \"b\"\n answer5_1user = answer14_1\n elsif answer5_1user == \"c\"\n answer5_1user = answer15_1\n end\n o = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[4].id, answer_id: answer5_1user.id, correct: answer5_1user.correct)\n result_2 << o.correct\n #\n #\n answer16_1 = Question.find(16).answers[0]\n answer17_1 = Question.find(16).answers[1]\n answer18_1 = Question.find(16).answers[2]\n puts Deck.find(2).questions[5].question\n puts \"a) #{answer16_1.name}\"\n puts \"b) #{answer17_1.name}\"\n puts \"c) #{answer18_1.name}\"\n answer6_1user = gets.chomp\n if answer6_1user == \"a\"\n answer6_1user = answer16_1\n elsif answer6_1user == \"b\"\n answer6_1user = answer17_1\n elsif answer6_1user == \"c\"\n answer6_1user = answer18_1\n end\n p = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[5].id, answer_id: answer6_1user.id, correct: answer6_1user.correct)\n result_2 << p.correct\n #\n #\n answer19_1 = Question.find(17).answers[0]\n answer20_1 = Question.find(17).answers[1]\n answer21_1 = Question.find(17).answers[2]\n puts Deck.find(2).questions[6].question\n puts \"a) #{answer19_1.name}\"\n puts \"b) #{answer20_1.name}\"\n puts \"c) #{answer21_1.name}\"\n answer7_1user = gets.chomp\n if answer7_1user == \"a\"\n answer7_1user = answer19_1\n elsif answer7_1user == \"b\"\n answer7_1user = answer20_1\n elsif answer7_1user == \"c\"\n answer7_1user = answer21_1\n end\n q = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[6].id, answer_id: answer7_1user.id, correct: answer7_1user.correct)\n result_2 << q.correct\n #\n #\n answer22_1 = Question.find(18).answers[0]\n answer23_1 = Question.find(18).answers[1]\n answer24_1 = Question.find(18).answers[2]\n puts Deck.find(2).questions[7].question\n puts \"a) #{answer22_1.name}\"\n puts \"b) #{answer23_1.name}\"\n puts \"c) #{answer24_1.name}\"\n answer8_1user = gets.chomp\n if answer8_1user == \"a\"\n answer8_1user = answer22_1\n elsif answer8_1user == \"b\"\n answer8_1user = answer23_1\n elsif answer8_1user == \"c\"\n answer8_1user = answer24_1\n end\n r = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[7].id, answer_id: answer8_1user.id, correct: answer8_1user.correct)\n result_2 << r.correct\n #\n #\n answer25_1 = Question.find(19).answers[0]\n answer26_1 = Question.find(19).answers[1]\n answer27_1 = Question.find(19).answers[2]\n puts Deck.find(2).questions[8].question\n puts \"a) #{answer25_1.name}\"\n puts \"b) #{answer26_1.name}\"\n puts \"c) #{answer27_1.name}\"\n answer9_1user = gets.chomp\n if answer9_1user == \"a\"\n answer9_1user = answer25_1\n elsif answer9_1user == \"b\"\n answer9_1user = answer26_1\n elsif answer9_1user == \"c\"\n answer9_1user = answer27_1\n end\n s = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[8].id, answer_id: answer9_1user.id, correct: answer9_1user.correct)\n result_2 << s.correct\n #\n #\n answer28_1 = Question.find(20).answers[0]\n answer29_1 = Question.find(20).answers[1]\n answer30_1 = Question.find(20).answers[2]\n puts Deck.find(2).questions[9].question\n puts \"a) #{answer28_1.name}\"\n puts \"b) #{answer29_1.name}\"\n puts \"c) #{answer30_1.name}\"\n answer10_1user = gets.chomp\n if answer10_1user == \"a\"\n answer10_1user = answer28_1\n elsif answer10_1user == \"b\"\n answer10_1user = answer29_1\n elsif answer10_1user == \"c\"\n answer10_1user = answer30_1\n end\n y = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[9].id, answer_id: answer10_1user.id, correct: answer10_1user.correct)\n result_2 << y.correct\n result_2\n result_2.each do |answers_do|\n if answers_do == 1\n counter_2 += 1\n end\n end\n pp Stat.where(game_id: @new_game.id)\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter_2} correct answers and #{10-counter_2} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n when 3 \n counter_3 = 0\n result_3 = []\n answer1_2 = Question.find(21).answers[0]\n answer2_2 = Question.find(21).answers[1]\n answer3_2 = Question.find(21).answers[2]\n puts Deck.find(3).questions[0].question\n puts \"a) #{answer1_2.name}\"\n puts \"b) #{answer2_2.name}\"\n puts \"c) #{answer3_2.name}\"\n answer1_2user = gets.chomp\n if answer1_2user == \"a\"\n answer1_2user = answer1_2\n elsif answer1_2user == \"b\"\n answer1_2user = answer2_2\n elsif answer1_2user == \"c\"\n answer1_2user = answer3_2\n end\n a_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[0].id, answer_id: answer1_2user.id, correct: answer1_2user.correct)\n result_3 << a_1.correct\n #\n #\n answer4_2 = Question.find(22).answers[0]\n answer5_2 = Question.find(22).answers[1]\n answer6_2 = Question.find(22).answers[2]\n puts Deck.find(3).questions[1].question\n puts \"a) #{answer4_2.name}\"\n puts \"b) #{answer5_2.name}\"\n puts \"c) #{answer6_2.name}\"\n answer2_2user = gets.chomp\n if answer2_2user == \"a\"\n answer2_2user = answer4_2\n elsif answer2_2user == \"b\"\n answer2_2user = answer5_2\n elsif answer2_2user == \"c\"\n answer2_2user = answer6_2\n end\n b_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[1].id, answer_id: answer2_2user.id, correct: answer2_2user.correct)\n result_3 << b_1.correct\n #\n #\n answer7_2 = Question.find(23).answers[0]\n answer8_2 = Question.find(23).answers[1]\n answer9_2 = Question.find(23).answers[2]\n\n puts Deck.find(3).questions[2].question\n puts \"a) #{answer7_2.name}\"\n puts \"b) #{answer8_2.name}\"\n puts \"c) #{answer9_2.name}\"\n answer3_2user = gets.chomp \n if answer3_2user == \"a\"\n answer3_2user = answer7_2\n elsif answer3_2user == \"b\"\n answer3_2user = answer8_2\n elsif answer3_2user == \"c\"\n answer3_2user = answer9_2\n end\n c_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[2].id, answer_id: answer3_2user.id, correct: answer3_2user.correct)\n result_3 << c_1.correct\n #\n #\n answer10_2 = Question.find(24).answers[0]\n answer11_2 = Question.find(24).answers[1]\n answer12_2 = Question.find(24).answers[2]\n puts Deck.find(3).questions[3].question\n puts \"a) #{answer10_2.name}\"\n puts \"b) #{answer11_2.name}\"\n puts \"c) #{answer12_2.name}\"\n answer4_2user = gets.chomp\n if answer4_2user == \"a\"\n answer4_2user = answer10_2\n elsif answer4_2user == \"b\"\n answer4_2user = answer11_2\n elsif answer4_2user == \"c\"\n answer4_2user = answer12_2\n end\n d_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[3].id, answer_id: answer4_2user.id, correct: answer4_2user.correct)\n result_3 << d_1.correct\n #\n #\n answer13_2 = Question.find(25).answers[0]\n answer14_2 = Question.find(25).answers[1]\n answer15_2 = Question.find(25).answers[2]\n puts Deck.find(3).questions[4].question\n puts \"a) #{answer13_2.name}\"\n puts \"b) #{answer14_2.name}\"\n puts \"c) #{answer15_2.name}\"\n answer5_2user = gets.chomp\n if answer5_2user == \"a\"\n answer5_2user = answer13_2\n elsif answer5_2user == \"b\"\n answer5_2user = answer14_2\n elsif answer5_2user == \"c\"\n answer5_2user = answer15_2\n end\n f_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[4].id, answer_id: answer5_2user.id, correct: answer5_2user.correct)\n result_3 << f_1.correct\n #\n #\n answer16_2 = Question.find(26).answers[0]\n answer17_2 = Question.find(26).answers[1]\n answer18_2 = Question.find(26).answers[2]\n puts Deck.find(3).questions[5].question\n puts \"a) #{answer16_2.name}\"\n puts \"b) #{answer17_2.name}\"\n puts \"c) #{answer18_2.name}\"\n answer6_2user = gets.chomp\n if answer6_2user == \"a\"\n answer6_2user = answer16_2\n elsif answer6_2user == \"b\"\n answer6_2user = answer17_2\n elsif answer6_2user == \"c\"\n answer6_2user = answer18_2\n end\n g_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[5].id, answer_id: answer6_2user.id, correct: answer6_2user.correct)\n result_3 << g_1.correct\n #\n #\n answer19_2 = Question.find(27).answers[0]\n answer20_2 = Question.find(27).answers[1]\n answer21_2 = Question.find(27).answers[2]\n puts Deck.find(3).questions[6].question\n puts \"a) #{answer19_2.name}\"\n puts \"b) #{answer20_2.name}\"\n puts \"c) #{answer21_2.name}\"\n answer7_2user = gets.chomp\n if answer7_2user == \"a\"\n answer7_2user = answer19_2\n elsif answer7_2user == \"b\"\n answer7_2user = answer20_2\n elsif answer7_2user == \"c\"\n answer7_2user = answer21_2\n end\n h_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[6].id, answer_id: answer7_2user.id, correct: answer7_2user.correct)\n result_3 << h_1.correct\n #\n #\n answer22_2 = Question.find(28).answers[0]\n answer23_2 = Question.find(28).answers[1]\n answer24_2 = Question.find(28).answers[2]\n puts Deck.find(3).questions[7].question\n puts \"a) #{answer22_2.name}\"\n puts \"b) #{answer23_2.name}\"\n puts \"c) #{answer24_2.name}\"\n answer8_2user = gets.chomp\n if answer8_2user == \"a\"\n answer8_2user = answer22_2\n elsif answer8_2user == \"b\"\n answer8_2user = answer23_2\n elsif answer8_2user == \"c\"\n answer8_2user = answer24_2\n end\n i_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[7].id, answer_id: answer8_2user.id, correct: answer8_2user.correct)\n result_3 << i_1.correct\n #\n #\n answer25_2 = Question.find(29).answers[0]\n answer26_2 = Question.find(29).answers[1]\n answer27_2 = Question.find(29).answers[2]\n puts Deck.find(3).questions[8].question\n puts \"a) #{answer25_2.name}\"\n puts \"b) #{answer26_2.name}\"\n puts \"c) #{answer27_2.name}\"\n answer9_2user = gets.chomp\n if answer9_2user == \"a\"\n answer9_2user = answer25_2\n elsif answer9_2user == \"b\"\n answer9_2user = answer26_2\n elsif answer9_2user == \"c\"\n answer9_2user = answer27_2\n end\n j_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[8].id, answer_id: answer9_2user.id, correct: answer9_2user.correct)\n result_3 << j_1.correct\n #\n #\n answer28_2 = Question.find(30).answers[0]\n answer29_2 = Question.find(30).answers[1]\n answer30_2 = Question.find(30).answers[2]\n puts Deck.find(3).questions[9].question\n puts \"a) #{answer28_2.name}\"\n puts \"b) #{answer29_2.name}\"\n puts \"c) #{answer30_2.name}\"\n answer10_2user = gets.chomp\n if answer10_2user == \"a\"\n answer10_2user = answer28_2\n elsif answer10_2user == \"b\"\n answer10_2user = answer29_2\n elsif answer10_2user == \"c\"\n answer10_2user = answer30_2\n end\n k_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[9].id, answer_id: answer10_2user.id, correct: answer10_2user.correct)\n result_3 << k_1.correct\n pp Stat.where(game_id: @new_game.id)\n result_3\n result_3.each do |answers_do|\n if answers_do == 1\n counter_3 += 1\n end\n end\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter_3} correct answers and #{10-counter_3} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n end\nend",
"def set_hero\n @hero = Hero.find(params[:id])\n end",
"def set_hero\n @hero = Hero.find(params[:id])\n end",
"def main\n # TODO: handle settings better\n $History = 7 # minimum spacing between cards from the same word\n $defaultDelay = 1 # default long-term delay, in days\n $Noise = 0.2 # noise in assigning long-term duedates\n $optimalStreak = 5 # how long should we go before switching categories?\n $Magic = 2 # affects the desired size of CardManager's queue\n $Adventure = 0.3 # percentage of novel cards to show the user\n\n # load data from data.yml\n dm = DeckManager.new('data.yml')\n loop do\n puts dm.getPrompt\n print \">> \"\n x = gets[0...-1] # discard trailing \\n\n if x == \"quit\"\n dm.closeEverything\n puts \"ნახვამდის!\" # \"goodbye!\" ქართულად\n return\n else\n response = dm.acceptAnswer(x) # response might be nil\n puts response if response\n end\n end\nend",
"def display_card_details(choice)\n puts \"=====================\"\n puts \"| #{choice[\"name\"].upcase}\"\n puts \"=====================\"\n puts \"| INTELLIGENCE:.. #{choice[\"intelligence\"]}\"\n puts \"| STRENGTH:...... #{choice[\"strength\"]}\"\n puts \"| SPEED:......... #{choice[\"speed\"]}\"\n puts \"| DURABILITY:.... #{choice[\"durability\"]}\"\n puts \"| POWER:......... #{choice[\"power\"]}\"\n puts \"| COMBAT:........ #{choice[\"combat\"]}\"\n puts \"=====================\"\nend",
"def runner\n welcome\n deal_card\n display_card_total\n prompt_user\n get_user_input\nend_game\ninitial_round\nhit\ninvalid_command\nend",
"def user_profile \n system 'clear'\n CoffeeMan.stay_logo\n choice = @prompt.select(\"~P R O F I L E~\") do |menu|\n puts \"HELLO #{@userid.username}\".colorize(:light_blue)\n menu.choice \"Update Username\", -> {change_username}\n menu.choice \"Update Password\", -> {change_password}\n menu.choice \"Delete Account\", -> {delete_profile}\n menu.choice \"Back\", -> {main_menu}\n end\n sleep 1\n end",
"def generate_hero_race(hero)\n buffer\n line\n puts \"What race is your hero?\"\n line\n choice = gi_string\n hero.race = choice\n buffer\n line\n puts \"Your hero's race is #{hero.race}. If this is correct, press 1. Press 2 if not. Press 3 to go back.\"\n line\n choice = gi_integer\n if choice == 1\n generate_hero_origin_story(hero)\n elsif choice == 2\n generate_hero_race(hero)\n elsif choice == 3\n generate_hero_gender(hero)\n else line\n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_hero_race(hero)\n end\n end",
"def play_game\n until win_game? == true do\n get_user_selection\n get_comp_selection\n play_round\n end #end of until\n\n #adding option to play best of out of 5\n puts \"You you like to play best out of 5? (enter \\\"yes\\\" or \\\"no\\\")\"\n user_answer = gets.chomp.downcase\n\n if user_answer == \"y\" || user_answer == \"yes\"\n until best_out_of_five? == true do\n get_user_selection\n get_comp_selection\n play_round\n end\n else\n puts \"Until next time, have a great day!!\"\n end\n\n end",
"def process_purchase_of_card(turn, chosen_data)\n @purchased_card = chosen_data[1] #TODO I don't think this should be in the CLI\n type_of_card, card, card_cost = chosen_data[0], chosen_data[1], chosen_data[2]\n turn.player.money = turn.player.money - card_cost\n if type_of_card == :landmark\n turn.player.unbuilt_landmarks.delete(card)\n turn.player.built_landmarks.push(card)\n elsif type_of_card == :establishment\n @mk.town.remove_card(card)\n turn.player.tableau.add_card(card)\n while @mk.town.distinct_count < TOWN_SIZE\n new_card = card.attribute[:to_roll] <= 6 ? @mk.stockpile.random_card(1, 6) : @mk.stockpile.random_card(7, 14)\n @mk.town.add_card(new_card)\n @mk.stockpile.remove_card(new_card)\n @@cli.say \"Town replenished by adding <%= color('#{new_card.attribute[:name]}', BOLD) %>. \"\n end\n else false #method has recieved some weird unexpected data\n end\n end",
"def create_card(character_id, quantity_released)\n available = true #default value\n quantity_released.to_i.times do |card_edition|\n user_id = current_user()[\"id\"]\n \n params = [character_id, card_edition + 1, available, user_id]\n sql_query = \"INSERT INTO cards(character_id, card_edition, available, owner_id) values($1, $2, $3, $4);\"\n run_sql(sql_query, params)\n\n # Add new card listing to the marketplace. Default listing by admin\n latest_card = get_latest_card()\n card_id = latest_card[\"id\"]\n price = latest_card[\"initial_price\"]\n\n create_card_listing(user_id, card_id, price)\n end\nend",
"def add_one_card\n if request.post?\n front = params[:card][:front]\n back = params[:card][:back]\n\n if front.blank? || back.blank?\n flash[:error] = 'Front and Back must not be blank'\n else\n @deck = Deck.all.select{|x| x.title =~ /^Misc/}.sort_by(&:created_at).last\n\n # first time only\n if @deck.nil?\n @deck = Deck.new(:title => 'Misc 1', :front_description => 'Thai', :back_description => 'English', :active => true)\n @deck.save!(false)\n end\n\n # already have ten cards, make a new one\n if @deck.cards.length >= 10\n @deck.title =~ /^Misc (.*)/\n number = $1.to_i + 1\n @deck = Deck.new(:title => \"Misc #{number}\", :front_description => 'Thai', :back_description => 'English', :active => true)\n @deck.save!(false)\n end\n\n Card.create(:front => front, :back => back, :deck_id => @deck.id)\n flash[:notice] = \"Added card to deck #{@deck.title}, front: #{front}, back: #{back}\"\n end\n end\n\n render :layout => false\n end",
"def enter_credit_card_info (credit_card_type, credit_card_number, exp_month, exp_year, sec_code)\n if credit_card_type != \"PowerUp Rewards Credit Card\"\n chkout_credit_card_selector.value = credit_card_type\n chkout_credit_card_number_field.value = credit_card_number\n chkout_credit_card_month_selector.value = exp_month\n chkout_credit_card_year_selector.value = exp_year\n chkout_security_code_number_field.value = sec_code\n else\n chkout_credit_card_selector.value = credit_card_type\n chkout_credit_card_number_field.value = credit_card_number\n chkout_credit_card_month_selector.is_visible.should be_false\n chkout_credit_card_year_selector.is_visible.should be_false\n chkout_security_code_number_field.is_visible.should be_false\n end\n\n end",
"def gen_cards\n # done in a verbose manner so that code is easy to understand\n %w[H D S C].each do |suit|\n @cards.push(Card.new('Ace', suit, 1))\n @cards.push(Card.new('Two', suit, 2))\n @cards.push(Card.new('Three', suit, 3))\n @cards.push(Card.new('Four', suit, 4))\n @cards.push(Card.new('Five', suit, 5))\n @cards.push(Card.new('Six', suit, 6))\n @cards.push(Card.new('Seven', suit, 7))\n @cards.push(Card.new('Eight', suit, 8))\n @cards.push(Card.new('Nine', suit, 9))\n @cards.push(Card.new('Ten', suit, 10))\n @cards.push(Card.new('Jack', suit, 10))\n @cards.push(Card.new('Queen', suit, 10))\n @cards.push(Card.new('King', suit, 10))\n end\n end",
"def randomCard\n\t\trarity = randomRarity\n\t\tgolden = randomGold(rarity)\n\t\tmakeCard(rarity, golden)\n\tend",
"def generate_hero_nemesis(hero)\n buffer\n line\n puts \"Who is your hero's nemesis?\"\n line\n choice = gi_string\n hero.nemesis = choice\n buffer\n line\n puts \"Your hero's nemesis is #{hero.nemesis}. If this is correct, press 1. Press 2 if not. Press 3 to go back. Avoid this if you do not want to rewrite your origin story.\"\n line\n choice = gi_integer\n if choice == 1\n hero.save\n Villain.create(name: Faker::Name.name_with_middle, alter_ego: hero.nemesis, super_power: Faker::Superhero.power, power_lvl: Faker::Number.within(range: 50..300), resistance: Faker::Number.within(range: 1..40), hp: Faker::Number.within(range: 500..1000), gender: Faker::Gender.binary_type, race: Faker::Games::DnD.species, origin_story: Faker::Lorem.paragraphs(number: 3), nemesis: nil, grievance: Faker::Verb.base, insane_asylum: false, mental_health: Faker::Number.within(range: 1..10))\n generate_your_hero_battle(hero)\n elsif choice == 2\n generate_hero_nemesis(hero)\n elsif choice == 3\n generate_hero_origin_story(hero)\n else line\n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_hero_nemesis(hero)\n end \n end",
"def test_06_normaluser_share_donation_FR_NewCard()\n\t\t\n\t\tputs \"------------------------ START OF SCENARIO 6 ----------------------- \"\n\t\tcreateRazooAccount($normal1_firstname, $normal1_lastname, $normal1_emailId, $normal1_password)\n\t\tsearchOrg($org_name)\n\t\tcreateStoryPage($mynpo_ein, $org_name, $fr_name, $story_summary, $page_story, \n\t\t\t\t\t$youtube_url, $desig_value, $goal_amount, \"link=30\", \"link=Donations\", \n\t\t\t\t\t$sug_amount, $sug_desc)\n\t\tdonateUsingNewCard($amount_cent, $normal1_nameoncard, $street, $state, \n\t\t\t\t\t$city, $pin_code, $visacard_number, $visa_seccode, $normal1don_emailId)\n\t\tpostComments(\"Give and be Blessed!!\")\n\t\tlogout()\n\t\tputs \"------------------------ END OF SCENARIO 6 ----------------------- \"\n\tend",
"def show_cards2(dck, dlr, plyr, plyr_points, dlr_points)\n system \"clear\"\n puts \"=========================\"\n prompt \"Dealer has...#{dlr_points}\"\n dlr.each do |card|\n prompt \" \" + dck[card][:name] + ' ' + dck[card][:value].to_s\n end\n puts\n prompt \"Player has...#{plyr_points}\"\n plyr.each do |card|\n prompt \" \" + dck[card][:name] + ' ' + dck[card][:value].to_s\n end\nend",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def set_card\n @card = Card.find(params[:id])\n end",
"def draw_card\n #suit = Card::SUITS.sample\n #rank = Card::RANKS.sample\n #Card.new(suit: suit, rank: rank)\n @cards.pop\n end"
] |
[
"0.7150788",
"0.6612205",
"0.62899435",
"0.61564034",
"0.6040731",
"0.5967543",
"0.5849028",
"0.5836454",
"0.5829843",
"0.58213675",
"0.57313234",
"0.5695235",
"0.5665268",
"0.5647897",
"0.5610488",
"0.557705",
"0.5571621",
"0.55615777",
"0.5554705",
"0.5548276",
"0.55435485",
"0.55073524",
"0.55055386",
"0.54724467",
"0.5451894",
"0.5450756",
"0.5438172",
"0.54375285",
"0.5429422",
"0.5419992",
"0.5412428",
"0.54047936",
"0.5388509",
"0.53661233",
"0.5364907",
"0.5352951",
"0.53505737",
"0.5333517",
"0.53298515",
"0.5324316",
"0.53039646",
"0.52998847",
"0.52943975",
"0.529362",
"0.5292157",
"0.5281216",
"0.5281216",
"0.52760065",
"0.52760065",
"0.5274724",
"0.5266435",
"0.52641636",
"0.52615565",
"0.52589804",
"0.52531177",
"0.52513486",
"0.5248871",
"0.5245565",
"0.52450246",
"0.5240581",
"0.5239427",
"0.52366996",
"0.5234975",
"0.52272135",
"0.52247816",
"0.521919",
"0.5215176",
"0.5211501",
"0.52091306",
"0.52073044",
"0.5198745",
"0.51963276",
"0.51833135",
"0.51744276",
"0.51722014",
"0.5169476",
"0.51686543",
"0.5165859",
"0.5165859",
"0.5161555",
"0.51604503",
"0.51584965",
"0.5156564",
"0.5150022",
"0.5148848",
"0.51438767",
"0.5137941",
"0.51360726",
"0.51312226",
"0.5120657",
"0.5120559",
"0.5116456",
"0.5115657",
"0.5112847",
"0.5112156",
"0.5112156",
"0.5112156",
"0.5112156",
"0.5112156",
"0.5107529"
] |
0.7984649
|
0
|
get 5 random cards from the cards table, add them to the user's collection
|
def open_pack
cards = Card.all.sample(5)
cards.each { |card| UserCard.create(user_id: self.id, card_id: card.id)}
names = cards.map { |card| card.name }
puts "#{names.join(", ").upcase} ...were added to your collection!"
sleep(3)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pick_random\n @card_list.pick_random\n end",
"def pick_random\n @card_list.pick_random\n end",
"def pick_random\r\n @card_list.pick_random\r\n end",
"def get_random_user_list \n @users = user_list.sample(5).insert(rand(5), {name: \"ME\", bot: false})\n end",
"def pick_player_card\n # TODO: Use Random to get a new random card\n rand(1..11)\nend",
"def random\n card_dealt = @possible_cards.sample\n end",
"def randomise\n @random_articles = Article.limit(5).order(\"RANDOM()\")\n @random_users = User.limit(5).order(\"RANDOM()\")\n @random_diarys = Diary.limit(5).order(\"RANDOM()\")\n @random_groups = Group.limit(5).order(\"RANDOM()\")\n end",
"def random\n random_card = self.class.get('/cards/random')\n end",
"def get_random_card\n return self.cards.where(:location => -1)[rand(self.cards.where(:location => -1).length)]\n end",
"def initialize_cards\n cards = []\n 4.times { cards += (2..14).to_a }\n cards.sample(52)\n end",
"def deal_card\n rand(1...12)\nend",
"def random_flush\n suit = [\"♠\", \"♣\", \"♡\", \"♢\"].sample\n Card.where(suit: suit).sample(5)\nend",
"def insert_random(card)\n @cards.insert(Random.new().rand(0...@cards.count), card)\n end",
"def random_user\n\t\tUser.find([*1..40].sample)\n\tend",
"def newCard\n\t@card = Cards.new\n \t@card.random\n end",
"def deal_card\n return rand(1..11)\nend",
"def shuffle!\n @cards = self.cards.sort_by { rand }\n end",
"def deal5cards (n)",
"def index\n @cards = current_user.cards.ordered_by_created_at\n @new_card = Card.new\n end",
"def random_remaining_card\n correct_guesses_array = self.guesses.where(correctness: true)\n correct_guess_id_array = correct_guesses_array.map do |guess|\n guess.card_id\n end\n if correct_guess_id_array == []\n cards = self.deck.cards\n else\n cards = self.deck.cards.where('id not in (?)', correct_guess_id_array)\n end\n cards.sample\n end",
"def initialize\n @cards = ((1..6).to_a * 3 + (7..10).to_a * 4 + (11..17).to_a * 2 + (18..25).to_a).shuffle\n end",
"def deal_card\n card = rand(11) + 1\nend",
"def populate_deck\n # self.initial_size.times do\n # new_card_class = Card.library.values.sample\n # new_card = new_card_class.new\n # self.cards << new_card\n # end\n 40.times do\n new_card_type = Card.library.values.sample\n new_card = new_card_type.create\n self.cards << new_card\n end\n end",
"def pick_random_card\n random_card = @all_cards.sample\n remove_card(random_card)\n return random_card\n end",
"def createDeck\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\t@deck.shuffle!\t\n\tend",
"def add card\r\n # Unlucky for some !\r\n # Sometimes Moody Players won't play.\r\n if rand(40)==13\r\n puts \"Moody player didn't play!\"\r\n else\r\n @card_list.add card\r\n end\r\n end",
"def index\n @ship_users = User.pays.where.not(avatar:nil).order(\"RANDOM()\").limit(4)\n end",
"def random_users\n @users = User.where.not(id: current_user.id) - current_user.all_following\n render json: @users.sample(5) #this method fetches 5 random users from @users\n end",
"def draw_four_cards\n cards = DrawnCard.first_four_cards\n cards.each_with_index do |card_number, index|\n if index%2 == 0 #player_cards\n self.drawn_cards.create({user_id: self.user_id, card_number: card_number})\n else #dealer cards\n self.drawn_cards.create({user_id: nil, card_number: card_number})\n end\n end\n self.check_for_stop self.user_id\n end",
"def deal_card\n random = rand(@playable_cards.size)\n @playable_cards.delete_at(random)\n end",
"def random_card\n return @deck[rand(@deck.length)]\n end",
"def deal_card\n @eg_users.each do |user|\n user << @pokerdeck.pop\n end\n @eg_users\n end",
"def index\n @user_cards = UserCard.all\n end",
"def index\n @user_cards = UserCard.all\n end",
"def addCard(givenCard)\n \tcards_users.create(card_id: givenCard.id, is_shared: false)\n end",
"def deal_card\r\n random = rand(@playable_cards.size)\r\n @playable_cards.delete_at(random)\r\n end",
"def cards\n #Card.joins(:duel_user_cards).\n end",
"def randomCard\n\t\trarity = randomRarity\n\t\tgolden = randomGold(rarity)\n\t\tmakeCard(rarity, golden)\n\tend",
"def generate_credit_cards_for_checked_out_orders\n checked_out_orders = Order.all.select(\"DISTINCT user_id\").\n where(\"checkout_date IS NOT NULL\")\n\n checked_out_orders.each do |order|\n card = CreditCard.new\n card[:user_id] = order.user_id\n\n # last 4 digits only\n card[:card_number] = Faker::Number.number(16)\n card[:exp_month] = rand(12) + 1\n\n #so far, only good cards\n card[:exp_year] = Time.now.year + rand(5)\n card[:brand] = ['VISA', 'MasterCard', 'Discover', 'Amex'].sample\n\n card.save\n\n affiliated_orders = Order.where(\"user_id = ?\", order.user_id).where(\"checkout_date IS NOT NULL\")\n affiliated_orders.each do |aff_ord|\n aff_ord.credit_card_id = card.id\n aff_ord.save\n end\n end\nend",
"def random_card\n result = @deck.sample(1)\n @deck.delete result\n result.first\n end",
"def current_repetition\n @cards = current_user.cards_due\n @card = @cards.sample\n end",
"def load_card #(draw card?)\n @cards_array.shuffle!.shift\n end",
"def random_user\n User.offset(rand(User.count)).first\nend",
"def get_card\n all_cards = self.deck.cards\n correct_cards = self.guesses.where(correct: true).map { |guess| guess.card }\n (all_cards - correct_cards).shuffle.sample\n end",
"def select_card\n num_random = rand(@cards.length)\n card = @cards[num_random]\n @cards.delete_at(num_random)\n card\n end",
"def random_straight\n name = [\"2\", \"3\", \"4\", \"5\", \"6\"].sample\n straight = []\n straight << Card.where(\"name = ? AND suit = ?\", (name), ([\"♠\", \"♣\", \"♡\", \"♢\"].sample))\n straight << Card.where(\"name = ? AND suit = ?\", ((name.to_i)+1).to_s, ([\"♠\", \"♣\", \"♡\", \"♢\"].sample))\n straight << Card.where(\"name = ? AND suit = ?\", ((name.to_i)+2).to_s, ([\"♠\", \"♣\", \"♡\", \"♢\"].sample))\n straight << Card.where(\"name = ? AND suit = ?\", ((name.to_i)+3).to_s, ([\"♠\", \"♣\", \"♡\", \"♢\"].sample))\n straight << Card.where(\"name = ? AND suit = ?\", ((name.to_i)+4).to_s, ([\"♠\", \"♣\", \"♡\", \"♢\"].sample))\n straight\nend",
"def shuffle\n @cards.replace @cards.sort_by {rand}\n end",
"def random \n if params[:random]\n @card = Card.where(:first => params[:random]).sample\n else\n # @card = Card.all.sample\n rand_id = rand(Card.count)\n @card = Card.first(:conditions => ['id >= ?', rand_id])\n end\n\n respond_to do |format|\n format.html #first.html.erb\n format.json { render json: @card }\n end\n end",
"def fill_player_cards(player)\n \tp_cards = []\n \n \tif self.cards_set.length > 0\n \t\tp_cards = player.get_player_cards\n\t \twhile ((p_cards.length < 6) and (self.cards_set.length > 0)) do\n\t card_from_set = rand(self.cards_set.length-1)\n\t p_cards << self.cards_set[card_from_set]\n\t self.cards_set.delete_at(card_from_set)\n\t end\n \tend\n\n \ttmp = player.player_cards | p_cards\n \tplayer.player_cards = tmp\n \tself.sort_player_cards(player)\n send_update\n \treturn player.player_cards\n end",
"def ownedCards\n \tcus_owned_by_user = cards_users.where(is_shared: false)\n\n \t# Have a list of CardsUsers, but want a list of Owned Cards\n \towned_cards = []\n \tcus_owned_by_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\towned_cards.push(card)\n \tend\n \towned_cards\n end",
"def shuffleCards!()\n\t\t@cards.shuffle!\n\tend",
"def populate()\n @card_values.shuffle!\n i = 0\n (0...@size).each do |row|\n (0...@size).each do |col|\n @grid[row][col] = Card.new(@card_values[i])\n i += 1\n end\n end\n end",
"def add_card_to_collection\n @collection.cards << Card.find(params[:card_id])\n end",
"def shuffle_card(cards, value, suit)\n suit.each do |ele1|\n value.each do |ele2|\n cards.push(suit: ele1, value: ele2)\n end\n end\n\n cards = cards * 4\n cards.shuffle!\nend",
"def initialize\n self.cards = []\n (0..51).each { |i| cards << Card.new(i) }\n self.cards.shuffle! \n end",
"def create_card(deck)\n card = deck.shuffle.pop\nend",
"def create_shuffled_deck\n # value = (2..10).to_a\n ranks = (2..10).to_a + [\"J\", \"Q\", \"k\", \"A\"]\n values = (2..14).to_a\n suits = [\"Spades\", \"Diamonds\", \"Hearts\", \"Clubs\"]\n\n # suits.each do |suit|\n # ranks.each_with_index do |rank|\n # @deck << Card.new(rank, value[index], suit)\n # end\n # end\n\n i = 0\n counter = 0\n temp_deck = []\n until i == 4\n (0...ranks.length).each do |j|\n temp_deck << Card.new(ranks[j], values[j], suits[i])\n counter += 1\n end\n i += 1\n end\n\n #Shuffling cards\n until temp_deck.length == 0\n index = rand(0...temp_deck.length)\n self.add_card(temp_deck[index])\n temp_deck.delete_at(index)\n end\n counter\n end",
"def random_card\r\nsuit = [' of hearts', ' of spades', ' of diamonds', ' of clubs']\r\nrank = [2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King', 'Ace']\r\n\tcard_rank = rank[rand(13)]\r\n\tcard_suit = suit[rand(4)]\r\n\tcard = card_rank.to_s + card_suit\r\n card\r\nend",
"def new_users\n print \"\\nadding 5 new users: \"\n users = []\n 5.times do\n print '.'\n user = User.create!(\n email: Faker::Internet.unique.email,\n password: \"password\",\n first_name: Faker::Superhero.descriptor,\n last_name: Faker::Superhero.suffix\n )\n users << user\n end\n users\nend",
"def get_card()\n return @cards.delete_at(rand(@cards.length))\n end",
"def draw_random\n @cards.delete_at(Random.new().rand(0...@cards.count))\n end",
"def index\n @card = @deck.cards.find(:first, :order => 'RAND()')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @cards }\n end\n end",
"def show_cards\r\n @user_cards = User.find(params[:id]).cards\r\n end",
"def unique_collection_card\n !!!Collection.find_by(\n card_id: self.card_id,\n user_id: self.user_id,\n magic_set_id: self.magic_set_id,\n premium: self.premium,\n wishlist: self.wishlist,\n condition: self.condition\n )\n end",
"def get_cards\n cards = []\n index = 0\n [2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 11].each do |num|\n 24.times do\n cards[index] = num\n index += 1\n end\n end\n shuffle(cards)\n end",
"def gen_cards\n # done in a verbose manner so that code is easy to understand\n %w[H D S C].each do |suit|\n @cards.push(Card.new('Ace', suit, 1))\n @cards.push(Card.new('Two', suit, 2))\n @cards.push(Card.new('Three', suit, 3))\n @cards.push(Card.new('Four', suit, 4))\n @cards.push(Card.new('Five', suit, 5))\n @cards.push(Card.new('Six', suit, 6))\n @cards.push(Card.new('Seven', suit, 7))\n @cards.push(Card.new('Eight', suit, 8))\n @cards.push(Card.new('Nine', suit, 9))\n @cards.push(Card.new('Ten', suit, 10))\n @cards.push(Card.new('Jack', suit, 10))\n @cards.push(Card.new('Queen', suit, 10))\n @cards.push(Card.new('King', suit, 10))\n end\n end",
"def accounts(group)\n if group.length % 5 == 0\n return group.shuffle.each_slice(5).to_a\n end\nend",
"def the_draw_card(deck_value, deck_card_name, cards, cards_value, random)\n cards = cards[random]\n deck_card_name.delete_at(random.to_i)\n return cards\n end",
"def random_hugs\n huglist_sample = []\n 5.times { huglist_sample.push(Huglist.all.sample[:id]) }\n return huglist_sample.uniq\nend",
"def shuffle_list\n @cardList.shuffle!\n end",
"def shuffle\n @cards.shuffle! \n end",
"def deal_hand no_of_cards\n hand = Hand.new\n no_of_cards.times do\n hand.add pick_random\n end\n hand\n end",
"def deal_cards\n if @deck.length != 0\n puts \"Dealt 3 more cards\"\n for i in 0...3\n r = rand(0...@deck.length)\n @cards_in_play.append(@deck[r])\n @deck.delete_at(r)\n end\n else\n puts \"There are no more cards in the deck!\"\n end\nend",
"def playcard\n @cards.shuffle.slice!(0,2)\n end",
"def shuffle\r\n @cards.shuffle!\r\n end",
"def random_card\n # @deck[1].rank\n size = @deck.size\n \"#{@deck[rand(size)].rank} #{@deck[rand(size)].suit}\"\n end",
"def generate_deck\n (1..3).to_a.product(@colors, @shapes, @textures).each{|arr| @deck.push(Card.new(arr[0], arr[1], arr[2], arr[3]))}\n @deck.shuffle!\nend",
"def shuffle\n shuffled_order = cards.pluck('card_order').shuffle\n counter = 0\n cards.each do |r|\n r.update_attribute(:card_order, shuffled_order[counter])\n counter += 1\n end\n end",
"def random\n card = rand(1..52)\n card.to_i\n end",
"def random\n card = rand(1..52)\n card.to_i\n end",
"def shuffle\n @cards.shuffle!\n end",
"def shuffle!\n cards.shuffle!\n end",
"def shuffle\n @cards.shuffle!\n end",
"def shuffle\n facedown_cards = cards.find_all {|card| card.facedown? }\n shuf_cards = facedown_cards.sort_by { rand }\n shuf_cards.each_with_index do |sc, i|\n # assigning ordering position manually. This code pre-empts\n # acts_as_list for increased speed -- DO NOT reload Card objects!\n # (not reloading the objects is a feature here, not a bug.)\n sc.facedown_position = i + 1\n sc.save!\n end\n save!\n end",
"def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = choose_hero\n response = prompt.select('Do you want to add this card to your collection?', %w(Yes No))\n if response == \"Yes\"\n added_card = UserCard.create(user_id: self.id, card_id: card.id)\n puts \"#{added_card.card.name.upcase} was added to your collection.\"\n sleep(1)\n end\n system('clear')\n title\n response = prompt.select('Do you want to look for another card?', %w(Yes No))\n if response == \"Yes\"\n self.choose_and_add_card_to_user_deck\n end\n end",
"def initialize\n @cards = []\n suits = [:hearts, :diamonds, :spades, :clubs]\n suits.each do |suit|\n (2..10).each do |value|\n @cards << Card.new(suit, value)\n end\n [\"J\", \"Q\", \"K\", \"A\"].each do |facecard|\n @cards << Card.new(suit, facecard)\n end\n end\n\n def shuffle!\n cards.shuffle!\n end\n\n def empty?\n self.cards.empty?\n end\n\n\nend",
"def generate_card\n\t suit = %w[s d h c]\n\t rank = %w[1 2 3 4 5 6 7 8 9 10 j q k]\n\t #(0...size).map{ charset.to_a[rand(charset.size)] }.join\n\t suit[rand(suit.size)] + rank[rand(rank.size)] + \".gif\"\n\tend",
"def generate_deck # ANTHONY\n @suits.each do |suit|\n @rank.each do |rank|\n color = (suit == 'Spades' || suit == 'Clubs') ? 'Black' : 'Red'\n @cards << Card.new(rank, suit, color)\n end\n end\n end",
"def select_players_for_gryffindor(full_list_of_players, already_used_players)\n players = []\n while(players.size < 5) do\n player = full_list_of_players[rand(full_list_of_players.size)]\n if !players.include?(player)\n players << player\n end\n end\n players\nend",
"def show\n cards = @deck.cards\n cards = cards.where(is_disabled: false)\n @cards = cards.shuffle\n end",
"def add_cards\n\t\t3.times { @board << @deck.draw }\n\tend",
"def add card\n @card_list.add card\n end",
"def add card\n @card_list.add card\n end",
"def add card\n @card_list.add card\n end",
"def add_random_players\n\tplayer_number_array = [1,2,3,4,5,6,7,8,9,10,11].shuffle\n\tp player_number_array\n\tplayer_number_array.each do |each_number|\n\t\t\tfill_team_with_players(@team_name, Faker::Name.name, each_number)\n\t\tend\nend",
"def index\n @cards = Card.where(\"user_id = ?\", current_user.id).order('default_card DESC')\n end",
"def loop_it(users, trait)\n users.each do |user|\n users.each do |boozer|\n rand_num = rand(1..100)\n Rating.create(value: rand_num, rater_id: user.id, ratee_id: boozer.id, trait_id: trait.id)\n end\n end\nend",
"def initialize\n # puts \"Shuffling now!\"\n # puts Kernel.caller\n @cards = self.class.all.shuffle\n end",
"def take_card(card)\n @cards << card\n end",
"def all_cards(user)\n user.cards.count\n end"
] |
[
"0.6734276",
"0.6734276",
"0.66865104",
"0.6645731",
"0.6640976",
"0.6620047",
"0.6483026",
"0.64768994",
"0.64655495",
"0.6432756",
"0.6413382",
"0.6413295",
"0.63901496",
"0.63281554",
"0.63027066",
"0.6283214",
"0.6276174",
"0.62429744",
"0.62324756",
"0.61876684",
"0.617586",
"0.61489445",
"0.6139052",
"0.61299795",
"0.6129104",
"0.6102077",
"0.610059",
"0.6088599",
"0.60751843",
"0.6046937",
"0.6021711",
"0.60160774",
"0.60085344",
"0.60085344",
"0.59987706",
"0.59915346",
"0.5958747",
"0.5951155",
"0.59479856",
"0.59442633",
"0.59168",
"0.59150004",
"0.5913938",
"0.5911436",
"0.5906205",
"0.58949536",
"0.58865774",
"0.5880809",
"0.588036",
"0.58795184",
"0.5876669",
"0.5867908",
"0.58655035",
"0.5861152",
"0.5858199",
"0.5852727",
"0.5851956",
"0.5838504",
"0.5831478",
"0.58292717",
"0.5826991",
"0.5814923",
"0.5814744",
"0.581436",
"0.58130866",
"0.5800766",
"0.58005875",
"0.5798776",
"0.5796003",
"0.5795267",
"0.57891864",
"0.5784321",
"0.578265",
"0.5781405",
"0.5779548",
"0.5770337",
"0.5769461",
"0.576422",
"0.576399",
"0.5763908",
"0.5753607",
"0.5745742",
"0.57279503",
"0.57254344",
"0.5700858",
"0.5700503",
"0.56970763",
"0.56912315",
"0.56849563",
"0.568165",
"0.5680669",
"0.56802434",
"0.56802434",
"0.56802434",
"0.56793195",
"0.5666708",
"0.56647205",
"0.5662962",
"0.5661499",
"0.5655519"
] |
0.6795567
|
0
|
gets all the users cards and displays them in number order also displays count message, depending on whether they have some or none had to use 'reload' because rails was using cached array, had to force to go back to db and refresh the card for the user.
|
def check_collection
system('clear')
title
your_cards = self.reload.cards.sort
if your_cards == []
puts "====================================================================="
puts "Your collection is empty"
puts "====================================================================="
else
puts "====================================================================="
puts "----- YOU HAVE #{your_cards.length} CARD(S) IN YOUR COLLECTION ------"
puts "====================================================================="
your_cards.each do |card|
puts "|NUMBER: #{card["id"]} |NAME: #{card["name"].upcase} |INTELLIGENCE: #{card["intelligence"]} |STRENGTH: #{card["strength"]} |SPEED: #{card["speed"]} |DURABILITY: #{card["durability"]} |POWER: #{card["power"]} |COMBAT: #{card["combat"]}"
end
puts "====================================================================="
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def all_cards(user)\n user.cards.count\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 index\n @user_cards = UserCard.all\n end",
"def index\n @user_cards = UserCard.all\n end",
"def index\n @cards = Card.where(\"user_id = ?\", current_user.id).order('default_card DESC')\n end",
"def show_cards\r\n @user_cards = User.find(params[:id]).cards\r\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 cardsByUser\n results = HTTParty.get(\"http://192.168.99.104:3003/credit_cards/user?id=\"+ @current_user[\"id\"].to_s)\n render json: results.parsed_response, status: results.code\n end",
"def index\n @box = CardBox.find_or_create_by(user_id: current_user.id)\n @cards = Card.where(card_box_id: @box.id).order(:element).order(power: :desc)\n @count = Card.where(card_box_id: @box.id).count\n end",
"def cards_left_to_collect\n card_ids = UserCard.select {|card| card[\"user_id\"] == self.id}\n remaining = Card.all.count - card_ids.map { |card| card[\"card_id\"] }.uniq.count\n if remaining == 0\n puts \"=====================================================================\"\n puts \"Congratulations, you have completed the Superhero card album!!\"\n puts \"=====================================================================\"\n else\n puts \"=====================================================================\"\n puts \"You still have #{remaining} cards left to collect...\"\n puts \"=====================================================================\"\n end\n end",
"def show\n @owner = Owner.find(params[:id])\n @cards = []\n @owner.cards.each do |card|\n @cards << [\"#{card.name} (#{card.brand.category})\", card.count]\n end \n end",
"def total_cards\n cards.count\n end",
"def no_of_cards\r\n @card_list.no_of_cards\r\n end",
"def no_of_cards\r\n @card_list.no_of_cards\r\n end",
"def count\n @cards.count\n end",
"def index\n @cards = Card.all\n\n if @cards.count < 5\n store_call_words\n end\n\n render json: @cards\n end",
"def index\n @cards = current_user.cards.ordered_by_created_at\n @new_card = Card.new\n end",
"def count\n cards.count\n end",
"def card_numbers(user_id)\n self.drawn_cards.where(user_id: user_id).pluck(:card_number)\n end",
"def no_of_cards\n @card_list.no_of_cards\n end",
"def no_of_cards\n @card_list.no_of_cards\n end",
"def no_of_cards\n @card_list.no_of_cards\n end",
"def count\n @cards.count\n end",
"def count\n @cards.count\n end",
"def count\n @cards.count\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 total_cards\n @total = PkCard.count\n render json: @total\n end",
"def count\n @cards.length\n end",
"def index\n @casein_page_title = 'Current all'\n\n calculate_cards(CurrentCard.all)\n end",
"def count\n @cards.size\n end",
"def count\n @cards.size\n end",
"def index\n @loyalty_cards = current_user.loyalty_cards\n end",
"def index\n @card_details = CardDetail.where(user_id: params[:user_id])\n end",
"def index\n if params[:user_id]\n @user = User.find params[:user_id]\n @cards = @user.cards\n @actions = [{\"YGO战网\" => users_path}, @user, \"常用卡片\"]\n else\n @cards = Card.joins(:duel_user_cards)\n @actions = [{\"YGO战网\" => users_path}, \"卡片排行\"]\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 index\n @name_cards = @user.name_cards.page(params[:page])\n end",
"def draw\n @deck = Deck.find(params[:id])\n drawed_cards = @deck.draw_five_cards\n render json: {\n cards: drawed_cards,\n deck_id: @deck.id,\n remaining: @deck.card_codes.count\n }\n end",
"def index\n @cards = @tarot.cards.order(number: :asc)\n end",
"def ownedCards\n \tcus_owned_by_user = cards_users.where(is_shared: false)\n\n \t# Have a list of CardsUsers, but want a list of Owned Cards\n \towned_cards = []\n \tcus_owned_by_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\towned_cards.push(card)\n \tend\n \towned_cards\n end",
"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 count\n @cards.length\n end",
"def cards_in_deck\n Card.where(game_id: @game.id, owner: 0).size\n end",
"def count\n return cards.length \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 remaining_cards\r\n @deck_of_cards.each do |card|\r\n card.output_card\r\n end\r\n end",
"def index\n @credit_cards = current_user.credit_cards.where(:is_active => true).all\n end",
"def user_service_cards\n @user = User.where(_id: params[:user_id]).first\n if current_user.id.to_s == params[:user_id]\n @cards = @user.service_cards\n else\n @cards = @user.service_cards.where(status: ServiceCard::SERVICE_CARD[:ON])\n #@cards = @user.service_cards\n end\n render json: @cards\n rescue => e\n rescue_message(e)\n end",
"def cards\n @cards\n end",
"def fetch_cards\n log 'fetch_cards'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n data['datosSalidaTarjetas']['tarjetas'].map{ |data| build_card(data) }\n end",
"def deal_hand no_of_cards\r\n @card_list.deal_hand no_of_cards\r\n end",
"def index\n #@cards = Card.all\n end",
"def index\n @user_story_cards = UserStoryCard.all\n end",
"def no_of_cards\n @cards.length\n end",
"def deal_hand no_of_cards\n @card_list.deal_hand no_of_cards\n end",
"def index\n @deck_of_cards = DeckOfCard.all\n end",
"def display_count(user, force_recount = false)\n @display_count = nil if force_recount\n @display_count ||= count(unread_conditions(user, true))\n end",
"def cards\n questions.count + answers.count\n end",
"def deal_card\n @eg_users.each do |user|\n user << @pokerdeck.pop\n end\n @eg_users\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 display_stats\n \n if current_user && current_user.role == \"admin\"\n @valuesArray = params.values[0,(params.values).length-2]\n @keysArray = params.keys[0,(params.keys).length-2]\n @match_data = ClubMatch.joins(:club).where(:matched=>1).order('COUNT(club_matches.club_id)DESC').limit(5)\n @user_interest_data = UserInterest.joins(:interest).order('COUNT(user_interests.interest_id)DESC').limit(7)\n @club_interest_data = ClubInterest.joins(:interest).order('COUNT(club_interests.interest_id)DESC').limit(7)\n \n if @valuesArray[0] != \"All\" \n @users = User.where(\"#{@keysArray[0]}\": params[\"#{@keysArray[0]}\".to_sym])\n else\n @users = User.all\n end\n \n\n @title = ' users'\n @keysArray.each_index{|x|\n if x > 0 && @valuesArray[x] != \"\" \n @users = @users.where(\"#{@keysArray[x]}\": params[\"#{@keysArray[x]}\".to_sym])\n end\n\n if @keysArray[x] == \"gender\"\n @title = @valuesArray[x] + @title\n end\n\n if @keysArray[x] == \"grad_year\" && @valuesArray[x] != \"\"\n @title = @title + ' graduating in ' + @valuesArray[x]\n end\n } \n\n @total = @users.length\n else\n redirect_to new_user_session_path\n end \n \n end",
"def order_list\n\t\t@cards = @cards.order(:cmc)\n\tend",
"def index\n pagination = pagination_params\n filter = filter_params\n\n @cards = Card.filter_query(filter).page(pagination[:page]).per(pagination[:quantity]).ordered\n end",
"def number_for_profile\n # byebug\n # @user=User.where(username: count_params[:username])\n @user = User.find(decode_jwt(cookies.signed[:jwt])[\"user_id\"])\n numfollowers=Follow.where(followee_id: @user.id).count \n numblocked=Block.where(blockee_id: @user.id).count\n render json: {followers: numfollowers, blocked: numblocked}\n end",
"def index\n @card = Card.paginate(:page => params[:page], :per_page => 15)\n end",
"def user_counter \n RecipeCard.all.select{|cards|cards.recipe == self}.count \n end",
"def cards\n #Card.joins(:duel_user_cards).\n end",
"def index\n # TODO: pagination\n @cards = @cards.order('created_at desc')\n render json: @cards, status: :ok\n end",
"def number_readied\n readied_cards.count\n end",
"def size\n @cards.size\n end",
"def size\n @cards.size\n end",
"def card_exists?(user)\n all_cards = user.cards.all.count\n all_cards >= 0\n end",
"def display_deck\n @deck_array.each do |x|\n x.display_card\n end\n end",
"def size\n @cards.size\n end",
"def card_list usr, aFlg\n if usr.is_admin? && aFlg \n User.joins(:card_accounts).include_list.where('card_accounts.status = ?', 'active').uniq.reorder('first_name ASC') \n else\n CardAccount.inc_list.where(user_id: usr, status: 'active')\n end\n end",
"def index\n @cards = Card.order(:full_name).page params[:page]\n end",
"def cards\n\t\t@cards.each do |card|\n\t\t\tputs card.card\n\t\tend\n\tend",
"def index\n @cards = @deck.cards\n end",
"def index\n @card_instances = CardInstance.all\n end",
"def index\n @card_instances = CardInstance.all\n end",
"def user_stats\n system 'clear'\n puts \"-----MY STATS-----\"\n @current_user.display_stats\n end",
"def size\n return @cardsShown.length\n end",
"def index\n if (approve_access)\n @cards = Card.all.order(:in_cycle)\n @cyclelist = Cycle.order(\"start desc\")\n else\n flash.now[:notice] = I18n.t('blacklight.no_access')\n end\n end",
"def deal_cards\n Print.heading('Dealing initial cards')\n deal_card_to_players\n dealer_card_to_dealer(false) #false to hide first dealer card\n deal_card_to_players\n dealer_card_to_dealer(true)\n end",
"def index\n @score_cards = ScoreCard.all\n end",
"def index\n authorize User\n @users = User.order(admin: :desc).order(active: :desc).order(:plan_id).order(first_name: :asc).order(last_name: :asc).includes(:plan).all.page(params[:page] || 0).per(20)\n\n @stripe_total = 0\n\n User.includes(:plan).each do |user|\n if user.plan\n @stripe_total += user.plan.stripe_plan_amount\n end\n end\n\n end",
"def index\n @name_cards = NameCard.all\n end",
"def show\n # @card = current_user.cards.find(params[:id])\n @card = Card.all.find(params[:id])\n respond_to do |format|\n format.html\n format.json {\n render json: { \"data\": { \"card\": @card.as_json(include: [:book, :user]) } },\n status: :ok\n }\n end\n end",
"def index\n @usersprofs = Usersprof.all.sort_by {|x| [x.name] }\n @count_users = 0\n @usersprofs.each {|i| @count_users+=1}\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 @cards = Card.reorder(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n @vote = Vote.new(params[:vote])\n @user = current_user\n end",
"def index\n @cards = @deck.cards.all\n end",
"def index\n @m_cards = MCard.all\n end",
"def index\n @timecards = current_user.timecards.paginate(:page => params[:page], :per_page => 15)\n end",
"def index\n if params[:comment_id].nil?\n render json: {\n comments: @card.comments.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n else\n @comment = Comment.find(params[:comment_id])\n render json: {\n comment: @comment,\n replaies: @comment.replaies.paginate(page: params[:page], per_page: 3)\n }, statues: :ok\n end\n end",
"def index\n @entry_cards = EntryCard.all\n end",
"def show\n @make_card = MakeCard.find(params[:id])\n @rechargeable_cards_ids = @make_card.rechargeable_cards.ids\n @rechargeable_cards = RechargeableCard.find(@rechargeable_cards_ids)\n @rechargeable_cards = RechargeableCard.paginate(page: params[:page])\n\n end",
"def deal_cards\n\t\t\tend",
"def draw_four_cards\n cards = DrawnCard.first_four_cards\n cards.each_with_index do |card_number, index|\n if index%2 == 0 #player_cards\n self.drawn_cards.create({user_id: self.user_id, card_number: card_number})\n else #dealer cards\n self.drawn_cards.create({user_id: nil, card_number: card_number})\n end\n end\n self.check_for_stop self.user_id\n end"
] |
[
"0.73596275",
"0.69653857",
"0.68645096",
"0.68645096",
"0.6731877",
"0.672236",
"0.66587573",
"0.6658604",
"0.65686303",
"0.6558864",
"0.6306203",
"0.6298849",
"0.6282824",
"0.6282824",
"0.6262068",
"0.6242672",
"0.6233264",
"0.62326777",
"0.6229537",
"0.622274",
"0.622274",
"0.622274",
"0.6180627",
"0.6180627",
"0.6180627",
"0.6152032",
"0.6096607",
"0.6069267",
"0.60629785",
"0.6051237",
"0.6051237",
"0.60388386",
"0.60338235",
"0.6010476",
"0.6010385",
"0.6004656",
"0.59884244",
"0.59667057",
"0.595187",
"0.5934069",
"0.5923112",
"0.58978564",
"0.5887834",
"0.5884399",
"0.5869315",
"0.585551",
"0.58395267",
"0.5822265",
"0.58185565",
"0.580675",
"0.58028305",
"0.57997453",
"0.5796078",
"0.57752746",
"0.5768856",
"0.5748161",
"0.57481366",
"0.5721346",
"0.5721346",
"0.5721346",
"0.5721346",
"0.5710518",
"0.5694425",
"0.5687491",
"0.5686036",
"0.5669231",
"0.5654496",
"0.56462234",
"0.56370074",
"0.5628165",
"0.56233215",
"0.56233215",
"0.562219",
"0.5622128",
"0.5616916",
"0.5610691",
"0.5602275",
"0.5600862",
"0.5593113",
"0.55851614",
"0.55851614",
"0.5584861",
"0.558041",
"0.5578433",
"0.55779934",
"0.55705154",
"0.5564684",
"0.55631816",
"0.55564004",
"0.5554254",
"0.5553426",
"0.5550974",
"0.5548559",
"0.55438626",
"0.5539364",
"0.5530565",
"0.5526085",
"0.55181867",
"0.5517293",
"0.5513453"
] |
0.57744557
|
54
|
iterates over all the cards for that user, passes resulting array of names to TTY prompt to display choices. choice from the list of names is stored in selected_card_name the card object for that choice is stored in selected_card the UserCard object from that specific user's collection is stored in choice choice is destroyed if the user chooses yes, confirmation message displayed. if user decides not to delete, check_collection is called to return to users card list
|
def delete_card
prompt = TTY::Prompt.new
your_cards = self.cards
card_names = your_cards.map { |card| card["name"] }
selected_card_name = prompt.select('Choose a character to delete', card_names, filter: true, cycle: true, help: "(Start typing to filter results)", help_color: :green, active_color: :yellow)
selected_card = Card.find_by(name: selected_card_name)
choice = UserCard.find_by user_id: self.id, card_id: selected_card.id
response = prompt.select("Are you sure you want to delete #{selected_card_name.upcase}?", %w(Yes No))
if response == "Yes"
choice.destroy
bar = TTY::ProgressBar.new("Deleting #{selected_card_name.upcase} [:bar]", total: 30)
30.times do
sleep(0.05)
bar.advance(1)
end
puts "#{choice.card.name.upcase} was deleted from your collection!"
sleep(1)
system('clear')
title
else
check_collection
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def list_hand_cards(card_array) \n user_choice = \"\"\n while user_choice != \"⬅️ BACK ⬅️\" && user_choice != \"🗑 DELETE READING 🗑\" do\n user_choice = prompt.select(\"🔮 #{self.user.name}, Select a card to see more details.\") do |menu|\n card_emoji_string = \"🂠\"\n crystal_ball_emoji_string = \"🔮\"\n card_array.map do |handCard|\n string=\" 🂠 TAROT #{crystal_ball_emoji_string} 🂠 \"\n menu.choice \" 🂠 TAROT #{crystal_ball_emoji_string} 🂠 \", -> {reading_card(handCard.card, card_array,string); \" 🂠 TAROT #{crystal_ball_emoji_string} 🂠 \"}\n card_emoji_string += \"🂠\"\n crystal_ball_emoji_string += \" 🔮\"\n end\n menu.choice \"🗑 DELETE READING 🗑\", -> {self.delete_reading(card_array); \"🗑 DELETE READING 🗑\"}\n menu.choice \"⬅️ BACK ⬅️\", -> {self.main_menu;\"⬅️ BACK ⬅️\"}\n end \n end \n end",
"def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = choose_hero\n response = prompt.select('Do you want to add this card to your collection?', %w(Yes No))\n if response == \"Yes\"\n added_card = UserCard.create(user_id: self.id, card_id: card.id)\n puts \"#{added_card.card.name.upcase} was added to your collection.\"\n sleep(1)\n end\n system('clear')\n title\n response = prompt.select('Do you want to look for another card?', %w(Yes No))\n if response == \"Yes\"\n self.choose_and_add_card_to_user_deck\n end\n end",
"def reading_card(card_obj, card_array, card_string)\n system \"clear\"\n puts card_string\n user_choice = \"\"\n while user_choice != \"⬅️ BACK ⬅️\" do\n user_choice = prompt.select(\"🔮 #{self.user.name}, please choose from the list below.\") do |menu|\n menu.choice \"🔮 READ TYPE 🔮\", -> {card_obj.display_type}\n menu.choice \"🔮 READ NAME 🔮\", -> {card_obj.display_name}\n menu.choice \"🔮 READ VALUE 🔮\", -> {card_obj.display_value}\n menu.choice \"🔮 READ DESCRIPTION 🔮\", -> {card_obj.display_description}\n menu.choice \"⬅️ BACK ⬅️\", -> {self.list_hand_cards(card_array); \"⬅️ BACK ⬅️\"}\n end\n end\n end",
"def choose_hero\n prompt = TTY::Prompt.new\n names = Cards.all.map {|cards| cards[\"name\"]}\n selected_name = prompt.select('Choose a character', names, filter: true, cycle: true, help: \"(Start typing to filter results)\",help_color: :green, active_color: :yellow)\n hero = Cards.find_by(name: selected_name)\n display_card_details(hero)\n hero\nend",
"def get_user_cards\n\tloop do\n\t\tprint \"\\nEnter your set or type 'help': \"\n\t\tcase user_array = gets.chomp.downcase.split(\",\")\n\t\twhen [\"help\"]\n\t\t\tsystem('clear'); system('cls')\n\t\t\tputs \"Command list:\" +\n\t\t\t\"\\n\\thelp\\tRedisplay this help menu.\" +\n\t\t\t\"\\n\\thint\\tDisplay a correct set. Removes one hint from the hint counter.\" +\n\t\t\t\"\\n\\tquit\\tQuit to main menu without saving.\" +\n\t\t\t\"\\n\\tsave\\tSave the game. Game continues.\" +\n\t\t\t\"\\n\\tshow\\tRedisplay the current hand. Useful if screen is full.\"\n\t\t\tputs \"Valid set:\" +\n\t\t\t\"\\n\\tInteger,Integer,Integer\" +\n\t\t\t\"\\n\\tInteger must be between min and max card number in hand to be valid.\"\n\t\t\tputs \"\\nHit enter to continue.\"\n\t\t\tgets\n\t\t\tshow_hand\n\t\twhen [\"hint\"]\n\t\t\tputs get_hint # returns hint (+ number left) or \"No more hints available.\"\n\t\twhen [\"quit\"]\n\t\t\t# setting up conditions to allow for quiting\n\t\t\t@top_card = 81\n\t\t\t@hand = []\n\t\t\treturn [\"quit\"]\n\t\twhen [\"save\"]\n\t\t\tsave_game\n\t\twhen [\"show\"]\n\t\t\tshow_hand\n\t\telse\n\t\t\tif good_set_syntax? user_array\n\t\t\t\t# return user defined set in ascending card order\n\t\t\t\treturn user_array.map {|card_num| card_num.to_i}.sort\n\t\t\tend\n\t\t\tputs \"Invalid command or set syntax.\"\n\t\tend\n\tend\nend",
"def card_from_user(hand, cards_played)\n next_card_prompt(hand)\n\n puts \"What card would you like to play?\"\n card = get_card_following_suit(hand, cards_played)\n\n puts \"You picked #{card}\"\n hand.delete(card)\n\n card\n end",
"def selection_cards cards\n puts 'Please select 3 cards for your chosen set or enter \\'q\\' as your first card to quit.'\n print 'First card: '\n card_one = gets.chomp\n if card_one.eql? 'q'\n puts 'Quiting current game...'\n return ['q']\n else\n print 'Second card: '\n card_two = gets.chomp\n printf 'Third card: '\n card_three = gets.chomp\n card_one, card_two, card_three = *(dupes card_one, card_two, card_three)\n validRng = 0...cards.size\n until (validRng.cover? card_one) && (validRng.cover? card_two) && (validRng.cover? card_three)\n puts 'A card choice was found to be invalid. Please select 3 new cards.'\n print 'First card: '\n card_one = gets.chomp\n print 'Second card: '\n card_two = gets.chomp\n print 'Third card: '\n card_three = gets.chomp\n card_one, card_two, card_three = *(dupes card_one, card_two, card_three)\n end\n end\n [cards[card_one], cards[card_two], cards[card_three]]\nend",
"def deal_card\n @eg_users.each do |user|\n user << @pokerdeck.pop\n end\n @eg_users\n end",
"def use_card\n waiting_to_confirm_placement = true\n waiting_to_use_card = true\n invalid_usage = nil\n invalid_confirmation = nil\n remind_cannot_discard = nil\n \n while waiting_to_confirm_placement\n while waiting_to_use_card\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s} #{'* you cannot discard this card' if @drew_from_discard}\" unless @selected_card.nil?\n puts \"You cannot discard this card because you drew it from the discard pile.\" if remind_cannot_discard\n remind_cannot_discard = false\n \n @card_to_replace = nil\n @card_to_discard = nil\n\n puts InputManager.input_options({ negative: 'Discard this Card', rack_positions: 'Switch With Card at Position' }, invalid_usage)\n invalid_usage = nil\n\n @placement_response = InputManager.get\n\n # If player chooses a location in their rack\n # Get ready to exchange those cards\n if InputManager::INPUTS[:rack_positions].include?(@placement_response)\n prep_place_card_in_rack(@placement_response)\n waiting_to_use_card = false\n\n # If player chooses to discard their card\n # get ready to discard their card\n # Disallow discard if card was drawn from the discard pile\n elsif InputManager.negative?(@placement_response)\n if @drew_from_discard\n remind_cannot_discard = true\n else\n prep_discard_drawn_card\n waiting_to_use_card = false\n end\n else\n invalid_usage = @placement_response\n end\n end\n\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s}\"\n\n if @card_to_replace\n puts \"You want to exchange #{@card_to_replace.to_s} with #{@selected_card.to_s}.\"\n else\n puts \"You do not want to use #{@selected_card.to_s}.\"\n end\n\n puts \"You are discarding #{@card_to_discard.to_s}.\"\n\n puts InputManager.input_options({ affirmative: 'Save and Complete Turn', negative: 'Do Something Different' }, invalid_confirmation)\n invalid_confirmation = nil\n confirm_response = InputManager.get\n\n # If player confirms their decision\n # persist their decision\n if InputManager.affirmative?(confirm_response)\n save_and_discard(@placement_response)\n waiting_to_confirm_placement = false\n \n # If player changes their mind\n # allow them to choose how to use their card again \n elsif InputManager.negative?(confirm_response)\n waiting_to_use_card = true\n else\n invalid_confirmation = confirm_response\n end\n end\n end",
"def show_cards2(dck, dlr, plyr, plyr_points, dlr_points)\n system \"clear\"\n puts \"=========================\"\n prompt \"Dealer has...#{dlr_points}\"\n dlr.each do |card|\n prompt \" \" + dck[card][:name] + ' ' + dck[card][:value].to_s\n end\n puts\n prompt \"Player has...#{plyr_points}\"\n plyr.each do |card|\n prompt \" \" + dck[card][:name] + ' ' + dck[card][:value].to_s\n end\nend",
"def purchase_card(turn)\n own_money = turn.player.money\n keep_repeating = true\n while keep_repeating == true do\n keep_repeating = false \n @@cli.say \"Now it is time to purchase a card; you have <%= color('#{own_money}', BOLD) %> money.\"\n # Create a hash for the cards in the town\n town_cards = Hash[ @mk.town.deck.map {|e| [\"#{e[1]} x #{e[0].attribute[:name]} (#{e[0].attribute[:cost]})\", [:establishment, e[0], e[0].attribute[:cost]]]} ]\n card_name_list = town_cards.sort_by { |key, val| val[1].attribute[:from_roll] }.to_h\n # add the landmarks\n card_name_list.merge!(Hash[ turn.player.unbuilt_landmarks.map {|l| [\"#{l.name} (#{l.cost})\", [:landmark, l, l.cost]]} ])\n @@cli.choose do |menu|\n menu.prompt = \"Which card to do you want to buy? \"\n menu.choices(*card_name_list.keys) do |chosen|\n @@cli.say \"You have chosen <%= color('#{chosen}', BOLD) %>. \"\n if own_money < card_name_list[chosen][2]\n @@cli.say \"You can't afford that! It costs #{card_name_list[chosen][2]} but you only have #{own_money}\"\n keep_repeating = true\n else\n process_purchase_of_card(turn, card_name_list[chosen])\n end\n end\n menu.choice(:none, {:text => \"NOTHING TO ME, AH VIENNA\"}) { @@cli.say \"OK, you have chosen to not purchase any card.\"}\n menu.choice(:databank) { databank_menu; keep_repeating = true}\n end\n end\n end",
"def check_collection\n system('clear')\n title\n your_cards = self.reload.cards.sort\n if your_cards == []\n puts \"=====================================================================\"\n puts \"Your collection is empty\"\n puts \"=====================================================================\"\n else\n puts \"=====================================================================\"\n puts \"----- YOU HAVE #{your_cards.length} CARD(S) IN YOUR COLLECTION ------\"\n puts \"=====================================================================\"\n your_cards.each do |card|\n puts \"|NUMBER: #{card[\"id\"]} |NAME: #{card[\"name\"].upcase} |INTELLIGENCE: #{card[\"intelligence\"]} |STRENGTH: #{card[\"strength\"]} |SPEED: #{card[\"speed\"]} |DURABILITY: #{card[\"durability\"]} |POWER: #{card[\"power\"]} |COMBAT: #{card[\"combat\"]}\"\n end\n puts \"=====================================================================\"\n end\n end",
"def draw_cards(selected_cards, card_owner)\n system \"clear\"\n puts \"#{card_owner}'s Cards ...\"\n selected_cards.each do |selected_card|\n puts \"\\u250C\" + \"\\u2501\"+ \"\\u2501\"+ \"\\u2501\" + \"\\u2501\" + \"\\u2501\"+ \"\\u2511\"\n puts \"\\u2502\" + \" \" + \"\\u2502\"\n puts \"\\u2502\" + \" \" + \"\\u2502\"\n if selected_card[0].to_s.size > 1\n puts \"\\u2502\" + \" \" + selected_card[0].to_s + \" \" + \"\\u2502\"\n else\n puts \"\\u2502\" + \" \" + selected_card[0].to_s + \" \" + \"\\u2502\"\n end\n case selected_card[1]\n when 'S'\n puts \"\\u2502 \\u2660 \\u2502\" \n when 'C'\n puts \"\\u2502 \\u2663 \\u2502\"\n when 'H'\n puts \"\\u2502 \\u2665 \\u2502\" \n when 'D'\n puts \"\\u2502 \\u2666 \\u2502\" \n end\n puts \"\\u2502\" + \" \" + \"\\u2502\"\n puts \"\\u2502\" + \" \" + \"\\u2502\"\n puts \"\\u2514\" + \"\\u2501\"+ \"\\u2501\"+ \"\\u2501\" + \"\\u2501\" + \"\\u2501\"+ \"\\u251A\"\n end\nend",
"def card(hand)\n loop do\n print \"What card do you want (only from sets you have): \"\n wanted_card_name = gets.chomp\n # check against sets, and validate input (i.e. wanted card set in hand, but wanted card is not)\n unless Deck.card_id(wanted_card_name).nil?\n if (hand.collect { |e| e[0] }.include? (Deck.card_id(wanted_card_name)[0])) && !(hand.include? (Deck.card_id(wanted_card_name)))\n return Deck.card_id(wanted_card_name)\n else\n print \"Please enter a valid card name...\\n\"\n end\n else\n print \"Please enter a valid card name...\\n\"\n end\n end\n end",
"def display_cards (cards, name)\n puts \"#{name} has been dealt:\"\n cards.each do |card|\n puts \"#{card.value} of #{card.suit}\"\n end \n end",
"def show_cards\r\n @user_cards = User.find(params[:id]).cards\r\n end",
"def get_user_selection\r\n clear\r\n test_banner\r\n puts\r\n puts \"---------- User selection----------\\n\\n\"\r\n # First get the name to represent the user\r\n user_name = @prompt.ask(\"Hello, visitor! Can I have you name please?\\n\\n\") do |input|\r\n input.required true\r\n input.validate(/\\A\\w+\\Z/)\r\n input.modify :capitalize\r\n input.messages[:valid?] =\r\n 'My dear friend, only letters, numbers and underscore are allowed. Please try again.'\r\n end\r\n clear\r\n test_banner\r\n puts\r\n # Get the time attribute from the test model\r\n level_selections = [\r\n { name: 'Easy: 16s', value: lambda {\r\n @test.time_level[:Easy]\r\n } },\r\n { name: 'Normal: 12s', value: lambda {\r\n @test.time_level[:Normal]\r\n } },\r\n { name: 'Hard: 8s', value: lambda {\r\n @test.time_level[:Hard]\r\n } },\r\n { name: 'I want to change my name. Please let me go back', value: lambda {\r\n interface\r\n } }\r\n ]\r\n selection = @prompt.select(\r\n \"Please select one time mode for answering each question in a quiz.\\nIf you can not selection a option in the limited time\\nIt will be considered as false amswer\".colorize(:light_magenta), level_selections, help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always, per_page: 5\r\n )\r\n\r\n clear\r\n test_banner\r\n puts\r\n # Choose default or custom collections\r\n test_collections = [\r\n { name: 'Default collections', value: lambda {\r\n pick_collection('Default', user_name, selection)\r\n } },\r\n { name: 'Custom collections', value: lambda {\r\n pick_collection('Custom', user_name, selection)\r\n } },\r\n { name: 'I want to change the time setting. Please let me go back to main menu', value: lambda {\r\n interface\r\n } }\r\n ]\r\n test_collection = @prompt.select('Please select one group of collecctions', test_collections,\r\n help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\", show_help: :always, per_page: 3)\r\n end",
"def set_name_card\n @name_card = @user.name_cards.find(params[:id])\n end",
"def play_cards\n selection = get_card_numbers\n selection_cards = selection.map {|i| @game.field[i] }\n if (selection_cards.compact.length != 3)\n flash[:error] = 'You did not select three cards.'\n return false\n end\n @found_set = @game.make_set_selection( @player, *selection_cards )\n unless @found_set\n flash[:notice] = 'The three cards you selected are not a set.'\n return false\n end\n flash[:notice] = nil\n flash[:error] = nil\n true\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 choose_card \n\n @cards.shift\n end",
"def find_user_recipe_cards\n RecipeCard.all.map{|rcard| rcard if rcard.user_O == self}.compact\n\n end",
"def handle_user_choice\n ans = nil # track user input\n while true\n puts \"\\nChoose one of the following options.\"\n puts \"1. Enter set.\"\n puts \"2. Redeal cards (if no sets).\"\n ans = gets.chomp.to_i\n\n if ans == 1\n break\n elsif ans == 2\n redeal # redeal cards\n print_cards\n else\n puts \"Invalid input.\"\n end\n end\n\n ans # return user input\nend",
"def name_confirmation\n puts \"Been here before? (y/n)\"\n user_response = gets.chomp.downcase\n system \"clear\" \n if user_response == \"y\"\n find_user\n elsif user_response == \"n\"\n create_user\n else\n name_confirmation\n end\n end",
"def desk_options\n#items that can be found in the desk\n desk_items = [\n \"\\u{1F511}\" + \" \" + \"key\",\n \"\\u{270F}\" + \" \" + \"pencil\",\n \"\\u{1F4B5}\" + \" \" + \"money\",\n \"\\u{1F354}\" + \" \" + \"hamburger\",]\n\n# Ask user to pick an item\n\tputs \"Choose and item to take with you: \"\n\n# Loop through desk items array and print options to console\n# prints the desk items and its value\n (0...desk_items.length).each do |i|\n\t\tputs \"#{i+1} - #{desk_items[i]}\"\n\tend\n\n# user input placeholder\n\tprint \"> \"\n\n# getting the users choice\n\tchoice = $stdin.gets.chomp.to_i - 1\n\t@selected_from_desk = desk_items[choice]\n\n# if-statement to determine which item they chose and then adding it to the items_collected array\n\tif choice == 0\n\t\tputs \"\\nThe #{@selected_from_desk} has been added to your bag\"\n $items_collected << \"key\"\n clear_screen\n\t\tputs \"\\nYou found a letter on the desk. It says 'Find your way to the castle and bring me my things!'\"\n sleep(5)\n options_when_walking_away_from_desk\n\telsif choice == 1\n\t\tputs \"\\nThe #{@selected_from_desk} has been added to your bag\"\n $items_collected << \"pencil\"\n clear_screen\n\t\tputs \"\\nYou found a letter on the desk. It says 'Find your way to the castle and bring me my things!'\"\n sleep(5)\n options_when_walking_away_from_desk\n\telsif choice == 2\n\t\tputs \"\\nThe #{@selected_from_desk} has been added to your bag\"\n $items_collected << \"money\"\n clear_screen\n\t\tputs \"\\nYou found a letter on the desk. It says 'Find your way to the castle and bring me my things!'\"\n sleep(5)\n options_when_walking_away_from_desk\n\telsif choice == 3\n\t\tputs \"\\nThe #{@selected_from_desk} has been added to your bag\"\n $items_collected << \"hamburger\"\n clear_screen\n\t\tputs \"\\nYou found a letter on the desk. It says 'Find your way to the castle and bring me my things!'\"\n sleep(5)\n options_when_walking_away_from_desk\n else\n puts \"\\n***Please choose an item that is available!***\\n\\n\"\n desk_options\n# printing out users selection\n puts \"\\nYou selected: #{@selected_from_desk}\"\n end\nend",
"def select_player_from_list(my_players)\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"Here's a list of the players: \", filter: true) do |menu|\n my_players.each do |player|\n menu.choice player.name\n end\n end\nend",
"def deck_options(deck_option)\n case deck_option\n when 1 \n result = []\n counter = 0\n answer1 = Question.find(1).answers[0]\n answer2 = Question.find(1).answers[1]\n answer3 = Question.find(1).answers[2]\n puts Deck.find(1).questions[0].question\n puts \"a) #{answer1.name}\"\n puts \"b) #{answer2.name}\"\n puts \"c) #{answer3.name}\"\n answer1_user = gets.chomp\n if answer1_user == \"a\"\n answer1_user = answer1\n elsif answer1_user == \"b\"\n answer1_user = answer2\n elsif answer1_user == \"c\"\n answer1_user = answer3\n end\n a = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[0].id, answer_id: answer1_user.id, correct: answer1_user.correct)\n result << a.correct\n #\n #\n answer4 = Question.find(2).answers[0]\n answer5 = Question.find(2).answers[1]\n answer6 = Question.find(2).answers[2]\n puts Deck.find(1).questions[1].question\n puts \"a) #{answer4.name}\"\n puts \"b) #{answer5.name}\"\n puts \"c) #{answer6.name}\"\n answer2_user = gets.chomp\n if answer2_user == \"a\"\n answer2_user = answer4\n elsif answer2_user == \"b\"\n answer2_user = answer5\n elsif answer2_user == \"c\"\n answer2_user = answer6\n end\n b = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[1].id, answer_id: answer2_user.id, correct: answer2_user.correct)\n result << b.correct\n #\n #\n answer7 = Question.find(3).answers[0]\n answer8 = Question.find(3).answers[1]\n answer9 = Question.find(3).answers[2]\n\n puts Deck.find(1).questions[2].question\n puts \"a) #{answer7.name}\"\n puts \"b) #{answer8.name}\"\n puts \"c) #{answer9.name}\"\n answer3_user = gets.chomp \n if answer3_user == \"a\"\n answer3_user = answer7\n elsif answer3_user == \"b\"\n answer3_user = answer8\n elsif answer3_user == \"c\"\n answer3_user = answer9\n end\n c = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[2].id, answer_id: answer3_user.id, correct: answer3_user.correct)\n result << c.correct\n #\n #\n answer10 = Question.find(4).answers[0]\n answer11 = Question.find(4).answers[1]\n answer12 = Question.find(4).answers[2]\n puts Deck.find(1).questions[3].question\n puts \"a) #{answer10.name}\"\n puts \"b) #{answer11.name}\"\n puts \"c) #{answer12.name}\"\n answer4_user = gets.chomp\n if answer4_user == \"a\"\n answer4_user = answer10\n elsif answer4_user == \"b\"\n answer4_user = answer11\n elsif answer4_user == \"c\"\n answer4_user = answer12\n end\n d = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[3].id, answer_id: answer4_user.id, correct: answer4_user.correct)\n result << d.correct\n #\n #\n answer13 = Question.find(5).answers[0]\n answer14 = Question.find(5).answers[1]\n answer15 = Question.find(5).answers[2]\n puts Deck.find(1).questions[4].question\n puts \"a) #{answer13.name}\"\n puts \"b) #{answer14.name}\"\n puts \"c) #{answer15.name}\"\n answer5_user = gets.chomp\n if answer5_user == \"a\"\n answer5_user = answer13\n elsif answer5_user == \"b\"\n answer5_user = answer14\n elsif answer5_user == \"c\"\n answer5_user = answer15\n end\n e = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[4].id, answer_id: answer5_user.id, correct: answer5_user.correct)\n result << e.correct\n #\n #\n answer16 = Question.find(6).answers[0]\n answer17 = Question.find(6).answers[1]\n answer18 = Question.find(6).answers[2]\n puts Deck.find(1).questions[5].question\n puts \"a) #{answer16.name}\"\n puts \"b) #{answer17.name}\"\n puts \"c) #{answer18.name}\"\n answer6_user = gets.chomp\n if answer6_user == \"a\"\n answer6_user = answer16\n elsif answer6_user == \"b\"\n answer6_user = answer17\n elsif answer6_user == \"c\"\n answer6_user = answer18\n end\n f = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[5].id, answer_id: answer6_user.id, correct: answer6_user.correct)\n result << f.correct\n #\n #\n answer19 = Question.find(7).answers[0]\n answer20 = Question.find(7).answers[1]\n answer21 = Question.find(7).answers[2]\n puts Deck.find(1).questions[6].question\n puts \"a) #{answer19.name}\"\n puts \"b) #{answer20.name}\"\n puts \"c) #{answer21.name}\"\n answer7_user = gets.chomp\n if answer7_user == \"a\"\n answer7_user = answer19\n elsif answer7_user == \"b\"\n answer7_user = answer20\n elsif answer7_user == \"c\"\n answer7_user = answer21\n end\n g = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[6].id, answer_id: answer7_user.id, correct: answer7_user.correct)\n result << g.correct\n #\n #\n answer22 = Question.find(8).answers[0]\n answer23 = Question.find(8).answers[1]\n answer24 = Question.find(8).answers[2]\n puts Deck.find(1).questions[7].question\n puts \"a) #{answer22.name}\"\n puts \"b) #{answer23.name}\"\n puts \"c) #{answer24.name}\"\n answer8_user = gets.chomp\n if answer8_user == \"a\"\n answer8_user = answer22\n elsif answer8_user == \"b\"\n answer8_user = answer23\n elsif answer8_user == \"c\"\n answer8_user = answer24\n end\n h = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[7].id, answer_id: answer8_user.id, correct: answer8_user.correct)\n result << h.correct\n #\n #\n answer25 = Question.find(9).answers[0]\n answer26 = Question.find(9).answers[1]\n answer27 = Question.find(9).answers[2]\n puts Deck.find(1).questions[8].question\n puts \"a) #{answer25.name}\"\n puts \"b) #{answer26.name}\"\n puts \"c) #{answer27.name}\"\n answer9_user = gets.chomp\n if answer9_user == \"a\"\n answer9_user = answer25\n elsif answer9_user == \"b\"\n answer9_user = answer26\n elsif answer9_user == \"c\"\n answer9_user = answer27\n end\n i = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[8].id, answer_id: answer9_user.id, correct: answer9_user.correct)\n result << i.correct\n #\n #\n answer28 = Question.find(10).answers[0]\n answer29 = Question.find(10).answers[1]\n answer30 = Question.find(10).answers[2]\n puts Deck.find(1).questions[9].question\n puts \"a) #{answer28.name}\"\n puts \"b) #{answer29.name}\"\n puts \"c) #{answer30.name}\"\n answer10_user = gets.chomp\n if answer10_user == \"a\"\n answer10_user = answer28\n elsif answer10_user == \"b\"\n answer10_user = answer29\n elsif answer10_user == \"c\"\n answer10_user = answer30\n end\n j = Stat.create(game_id: @new_game.id, question_id: Deck.find(1).questions[9].id, answer_id: answer10_user.id, correct: answer10_user.correct)\n result << j.correct\n pp Stat.where(game_id: @new_game.id)\n result.each do |answers_do|\n if answers_do == 1\n counter += 1\n end\n end\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter} correct answers and #{10-counter} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n when 2 \n result_2 = []\n counter_2 = 0\n answer1_1 = Question.find(11).answers[0]\n answer2_1 = Question.find(11).answers[1]\n answer3_1 = Question.find(11).answers[2]\n puts Deck.find(2).questions[0].question\n puts \"a) #{answer1_1.name}\"\n puts \"b) #{answer2_1.name}\"\n puts \"c) #{answer3_1.name}\"\n answer1_1user = gets.chomp\n if answer1_1user == \"a\"\n answer1_1user = answer1_1\n elsif answer1_1user == \"b\"\n answer1_1user = answer2_1\n elsif answer1_1user == \"c\"\n answer1_1user = answer3_1\n end\n k = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[0].id, answer_id: answer1_1user.id, correct: answer1_1user.correct)\n result_2 << k.correct\n #\n #\n answer4_1 = Question.find(12).answers[0]\n answer5_1 = Question.find(12).answers[1]\n answer6_1 = Question.find(12).answers[2]\n puts Deck.find(2).questions[1].question\n puts \"a) #{answer4_1.name}\"\n puts \"b) #{answer5_1.name}\"\n puts \"c) #{answer6_1.name}\"\n answer2_1user = gets.chomp\n if answer2_1user == \"a\"\n answer2_1user = answer4_1\n elsif answer2_1user == \"b\"\n answer2_1user = answer5_1\n elsif answer2_1user == \"c\"\n answer2_1user = answer6_1\n end\n m = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[1].id, answer_id: answer2_1user.id, correct: answer2_1user.correct)\n result_2 << m.correct\n #\n #\n answer7_1 = Question.find(13).answers[0]\n answer8_1 = Question.find(13).answers[1]\n answer9_1 = Question.find(13).answers[2]\n\n puts Deck.find(2).questions[2].question\n puts \"a) #{answer7_1.name}\"\n puts \"b) #{answer8_1.name}\"\n puts \"c) #{answer9_1.name}\"\n answer3_1user = gets.chomp \n if answer3_1user == \"a\"\n answer3_1user = answer7_1\n elsif answer3_1user == \"b\"\n answer3_1user = answer8_1\n elsif answer3_1user == \"c\"\n answer3_1user = answer9_1\n end\n n = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[2].id, answer_id: answer3_1user.id, correct: answer3_1user.correct)\n result_2 << n.correct\n #\n #\n answer10_1 = Question.find(14).answers[0]\n answer11_1 = Question.find(14).answers[1]\n answer12_1 = Question.find(14).answers[2]\n puts Deck.find(2).questions[3].question\n puts \"a) #{answer10_1.name}\"\n puts \"b) #{answer11_1.name}\"\n puts \"c) #{answer12_1.name}\"\n answer4_1user = gets.chomp\n if answer4_1user == \"a\"\n answer4_1user = answer10_1\n elsif answer4_1user == \"b\"\n answer4_1user = answer11_1\n elsif answer4_1user == \"c\"\n answer4_1user = answer12_1\n end\n l = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[3].id, answer_id: answer4_1user.id, correct: answer4_1user.correct)\n result_2 << l.correct\n #\n #\n answer13_1 = Question.find(15).answers[0]\n answer14_1 = Question.find(15).answers[1]\n answer15_1 = Question.find(15).answers[2]\n puts Deck.find(2).questions[4].question\n puts \"a) #{answer13_1.name}\"\n puts \"b) #{answer14_1.name}\"\n puts \"c) #{answer15_1.name}\"\n answer5_1user = gets.chomp\n if answer5_1user == \"a\"\n answer5_1user = answer13_1\n elsif answer5_1user == \"b\"\n answer5_1user = answer14_1\n elsif answer5_1user == \"c\"\n answer5_1user = answer15_1\n end\n o = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[4].id, answer_id: answer5_1user.id, correct: answer5_1user.correct)\n result_2 << o.correct\n #\n #\n answer16_1 = Question.find(16).answers[0]\n answer17_1 = Question.find(16).answers[1]\n answer18_1 = Question.find(16).answers[2]\n puts Deck.find(2).questions[5].question\n puts \"a) #{answer16_1.name}\"\n puts \"b) #{answer17_1.name}\"\n puts \"c) #{answer18_1.name}\"\n answer6_1user = gets.chomp\n if answer6_1user == \"a\"\n answer6_1user = answer16_1\n elsif answer6_1user == \"b\"\n answer6_1user = answer17_1\n elsif answer6_1user == \"c\"\n answer6_1user = answer18_1\n end\n p = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[5].id, answer_id: answer6_1user.id, correct: answer6_1user.correct)\n result_2 << p.correct\n #\n #\n answer19_1 = Question.find(17).answers[0]\n answer20_1 = Question.find(17).answers[1]\n answer21_1 = Question.find(17).answers[2]\n puts Deck.find(2).questions[6].question\n puts \"a) #{answer19_1.name}\"\n puts \"b) #{answer20_1.name}\"\n puts \"c) #{answer21_1.name}\"\n answer7_1user = gets.chomp\n if answer7_1user == \"a\"\n answer7_1user = answer19_1\n elsif answer7_1user == \"b\"\n answer7_1user = answer20_1\n elsif answer7_1user == \"c\"\n answer7_1user = answer21_1\n end\n q = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[6].id, answer_id: answer7_1user.id, correct: answer7_1user.correct)\n result_2 << q.correct\n #\n #\n answer22_1 = Question.find(18).answers[0]\n answer23_1 = Question.find(18).answers[1]\n answer24_1 = Question.find(18).answers[2]\n puts Deck.find(2).questions[7].question\n puts \"a) #{answer22_1.name}\"\n puts \"b) #{answer23_1.name}\"\n puts \"c) #{answer24_1.name}\"\n answer8_1user = gets.chomp\n if answer8_1user == \"a\"\n answer8_1user = answer22_1\n elsif answer8_1user == \"b\"\n answer8_1user = answer23_1\n elsif answer8_1user == \"c\"\n answer8_1user = answer24_1\n end\n r = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[7].id, answer_id: answer8_1user.id, correct: answer8_1user.correct)\n result_2 << r.correct\n #\n #\n answer25_1 = Question.find(19).answers[0]\n answer26_1 = Question.find(19).answers[1]\n answer27_1 = Question.find(19).answers[2]\n puts Deck.find(2).questions[8].question\n puts \"a) #{answer25_1.name}\"\n puts \"b) #{answer26_1.name}\"\n puts \"c) #{answer27_1.name}\"\n answer9_1user = gets.chomp\n if answer9_1user == \"a\"\n answer9_1user = answer25_1\n elsif answer9_1user == \"b\"\n answer9_1user = answer26_1\n elsif answer9_1user == \"c\"\n answer9_1user = answer27_1\n end\n s = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[8].id, answer_id: answer9_1user.id, correct: answer9_1user.correct)\n result_2 << s.correct\n #\n #\n answer28_1 = Question.find(20).answers[0]\n answer29_1 = Question.find(20).answers[1]\n answer30_1 = Question.find(20).answers[2]\n puts Deck.find(2).questions[9].question\n puts \"a) #{answer28_1.name}\"\n puts \"b) #{answer29_1.name}\"\n puts \"c) #{answer30_1.name}\"\n answer10_1user = gets.chomp\n if answer10_1user == \"a\"\n answer10_1user = answer28_1\n elsif answer10_1user == \"b\"\n answer10_1user = answer29_1\n elsif answer10_1user == \"c\"\n answer10_1user = answer30_1\n end\n y = Stat.create(game_id: @new_game.id, question_id: Deck.find(2).questions[9].id, answer_id: answer10_1user.id, correct: answer10_1user.correct)\n result_2 << y.correct\n result_2\n result_2.each do |answers_do|\n if answers_do == 1\n counter_2 += 1\n end\n end\n pp Stat.where(game_id: @new_game.id)\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter_2} correct answers and #{10-counter_2} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n when 3 \n counter_3 = 0\n result_3 = []\n answer1_2 = Question.find(21).answers[0]\n answer2_2 = Question.find(21).answers[1]\n answer3_2 = Question.find(21).answers[2]\n puts Deck.find(3).questions[0].question\n puts \"a) #{answer1_2.name}\"\n puts \"b) #{answer2_2.name}\"\n puts \"c) #{answer3_2.name}\"\n answer1_2user = gets.chomp\n if answer1_2user == \"a\"\n answer1_2user = answer1_2\n elsif answer1_2user == \"b\"\n answer1_2user = answer2_2\n elsif answer1_2user == \"c\"\n answer1_2user = answer3_2\n end\n a_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[0].id, answer_id: answer1_2user.id, correct: answer1_2user.correct)\n result_3 << a_1.correct\n #\n #\n answer4_2 = Question.find(22).answers[0]\n answer5_2 = Question.find(22).answers[1]\n answer6_2 = Question.find(22).answers[2]\n puts Deck.find(3).questions[1].question\n puts \"a) #{answer4_2.name}\"\n puts \"b) #{answer5_2.name}\"\n puts \"c) #{answer6_2.name}\"\n answer2_2user = gets.chomp\n if answer2_2user == \"a\"\n answer2_2user = answer4_2\n elsif answer2_2user == \"b\"\n answer2_2user = answer5_2\n elsif answer2_2user == \"c\"\n answer2_2user = answer6_2\n end\n b_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[1].id, answer_id: answer2_2user.id, correct: answer2_2user.correct)\n result_3 << b_1.correct\n #\n #\n answer7_2 = Question.find(23).answers[0]\n answer8_2 = Question.find(23).answers[1]\n answer9_2 = Question.find(23).answers[2]\n\n puts Deck.find(3).questions[2].question\n puts \"a) #{answer7_2.name}\"\n puts \"b) #{answer8_2.name}\"\n puts \"c) #{answer9_2.name}\"\n answer3_2user = gets.chomp \n if answer3_2user == \"a\"\n answer3_2user = answer7_2\n elsif answer3_2user == \"b\"\n answer3_2user = answer8_2\n elsif answer3_2user == \"c\"\n answer3_2user = answer9_2\n end\n c_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[2].id, answer_id: answer3_2user.id, correct: answer3_2user.correct)\n result_3 << c_1.correct\n #\n #\n answer10_2 = Question.find(24).answers[0]\n answer11_2 = Question.find(24).answers[1]\n answer12_2 = Question.find(24).answers[2]\n puts Deck.find(3).questions[3].question\n puts \"a) #{answer10_2.name}\"\n puts \"b) #{answer11_2.name}\"\n puts \"c) #{answer12_2.name}\"\n answer4_2user = gets.chomp\n if answer4_2user == \"a\"\n answer4_2user = answer10_2\n elsif answer4_2user == \"b\"\n answer4_2user = answer11_2\n elsif answer4_2user == \"c\"\n answer4_2user = answer12_2\n end\n d_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[3].id, answer_id: answer4_2user.id, correct: answer4_2user.correct)\n result_3 << d_1.correct\n #\n #\n answer13_2 = Question.find(25).answers[0]\n answer14_2 = Question.find(25).answers[1]\n answer15_2 = Question.find(25).answers[2]\n puts Deck.find(3).questions[4].question\n puts \"a) #{answer13_2.name}\"\n puts \"b) #{answer14_2.name}\"\n puts \"c) #{answer15_2.name}\"\n answer5_2user = gets.chomp\n if answer5_2user == \"a\"\n answer5_2user = answer13_2\n elsif answer5_2user == \"b\"\n answer5_2user = answer14_2\n elsif answer5_2user == \"c\"\n answer5_2user = answer15_2\n end\n f_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[4].id, answer_id: answer5_2user.id, correct: answer5_2user.correct)\n result_3 << f_1.correct\n #\n #\n answer16_2 = Question.find(26).answers[0]\n answer17_2 = Question.find(26).answers[1]\n answer18_2 = Question.find(26).answers[2]\n puts Deck.find(3).questions[5].question\n puts \"a) #{answer16_2.name}\"\n puts \"b) #{answer17_2.name}\"\n puts \"c) #{answer18_2.name}\"\n answer6_2user = gets.chomp\n if answer6_2user == \"a\"\n answer6_2user = answer16_2\n elsif answer6_2user == \"b\"\n answer6_2user = answer17_2\n elsif answer6_2user == \"c\"\n answer6_2user = answer18_2\n end\n g_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[5].id, answer_id: answer6_2user.id, correct: answer6_2user.correct)\n result_3 << g_1.correct\n #\n #\n answer19_2 = Question.find(27).answers[0]\n answer20_2 = Question.find(27).answers[1]\n answer21_2 = Question.find(27).answers[2]\n puts Deck.find(3).questions[6].question\n puts \"a) #{answer19_2.name}\"\n puts \"b) #{answer20_2.name}\"\n puts \"c) #{answer21_2.name}\"\n answer7_2user = gets.chomp\n if answer7_2user == \"a\"\n answer7_2user = answer19_2\n elsif answer7_2user == \"b\"\n answer7_2user = answer20_2\n elsif answer7_2user == \"c\"\n answer7_2user = answer21_2\n end\n h_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[6].id, answer_id: answer7_2user.id, correct: answer7_2user.correct)\n result_3 << h_1.correct\n #\n #\n answer22_2 = Question.find(28).answers[0]\n answer23_2 = Question.find(28).answers[1]\n answer24_2 = Question.find(28).answers[2]\n puts Deck.find(3).questions[7].question\n puts \"a) #{answer22_2.name}\"\n puts \"b) #{answer23_2.name}\"\n puts \"c) #{answer24_2.name}\"\n answer8_2user = gets.chomp\n if answer8_2user == \"a\"\n answer8_2user = answer22_2\n elsif answer8_2user == \"b\"\n answer8_2user = answer23_2\n elsif answer8_2user == \"c\"\n answer8_2user = answer24_2\n end\n i_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[7].id, answer_id: answer8_2user.id, correct: answer8_2user.correct)\n result_3 << i_1.correct\n #\n #\n answer25_2 = Question.find(29).answers[0]\n answer26_2 = Question.find(29).answers[1]\n answer27_2 = Question.find(29).answers[2]\n puts Deck.find(3).questions[8].question\n puts \"a) #{answer25_2.name}\"\n puts \"b) #{answer26_2.name}\"\n puts \"c) #{answer27_2.name}\"\n answer9_2user = gets.chomp\n if answer9_2user == \"a\"\n answer9_2user = answer25_2\n elsif answer9_2user == \"b\"\n answer9_2user = answer26_2\n elsif answer9_2user == \"c\"\n answer9_2user = answer27_2\n end\n j_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[8].id, answer_id: answer9_2user.id, correct: answer9_2user.correct)\n result_3 << j_1.correct\n #\n #\n answer28_2 = Question.find(30).answers[0]\n answer29_2 = Question.find(30).answers[1]\n answer30_2 = Question.find(30).answers[2]\n puts Deck.find(3).questions[9].question\n puts \"a) #{answer28_2.name}\"\n puts \"b) #{answer29_2.name}\"\n puts \"c) #{answer30_2.name}\"\n answer10_2user = gets.chomp\n if answer10_2user == \"a\"\n answer10_2user = answer28_2\n elsif answer10_2user == \"b\"\n answer10_2user = answer29_2\n elsif answer10_2user == \"c\"\n answer10_2user = answer30_2\n end\n k_1 = Stat.create(game_id: @new_game.id, question_id: Deck.find(3).questions[9].id, answer_id: answer10_2user.id, correct: answer10_2user.correct)\n result_3 << k_1.correct\n pp Stat.where(game_id: @new_game.id)\n result_3\n result_3.each do |answers_do|\n if answers_do == 1\n counter_3 += 1\n end\n end\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n puts \"Yor result was: #{counter_3} correct answers and #{10-counter_3} incorrect answers\"\n puts \"----------------------------^^^^^^^^^^^^^^^^^^^^^^-----------------------------\"\n options(@view.menu)\n end\nend",
"def cards_left_to_collect\n card_ids = UserCard.select {|card| card[\"user_id\"] == self.id}\n remaining = Card.all.count - card_ids.map { |card| card[\"card_id\"] }.uniq.count\n if remaining == 0\n puts \"=====================================================================\"\n puts \"Congratulations, you have completed the Superhero card album!!\"\n puts \"=====================================================================\"\n else\n puts \"=====================================================================\"\n puts \"You still have #{remaining} cards left to collect...\"\n puts \"=====================================================================\"\n end\n end",
"def draw_card\n waiting_to_pick_pile = true\n\n invalid_pile = nil\n while waiting_to_pick_pile\n DisplayManager.prepare_ingame_display\n show_state\n\n puts \"Do you want to draw a new card, or use the top discarded card?\"\n puts InputManager.input_options({ affirmative: 'Draw New Card', negative: 'Take Last Discarded Card' }, invalid_pile)\n invalid_pile = nil\n \n response = InputManager.get\n\n # If player picks the draw pile\n # draw the top card from that pile\n if InputManager.affirmative?(response)\n choose_new_card\n waiting_to_pick_pile = false\n\n # If player picks from discard pile\n # draw top card from that pile\n # player cannot discard this card\n elsif InputManager.negative?(response)\n choose_discard\n waiting_to_pick_pile = false\n else\n invalid_pile = response\n end\n end\n end",
"def available_cards(correct_card_ids)\n # Exclude cards that have already been successfully answered\n self.cards.reject do |card|\n puts \"correct_card_ids = #{correct_card_ids}\"\n correct_card_ids.include?(card.id)\n end\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 cards\n RecipeCard.all.select do |recipe_card|\n recipe_card.user == self\n end\n end",
"def user_selection(selection)\n case selection\n when \"1\"\n puts \"You have chosen to add more students\\n\".center(100)\n @students = input_students\n when \"2\"\n puts \"You have chosen to see our current student list\\n\".center(100)\n student_displayer\n when \"3\"\n \"You have save our current student list to a csv file\\n\".center(100)\n save_students\n when \"4\"\n \"You have chosen to load students from a csv file\\n\".center(100)\n load_students\n when \"9\"\n puts \"Okay bye\".center(100)\n exit \n else \n puts \"I do not recognise this input, please choose again\".center(100)\n end\nend",
"def choose_club\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"For which club?\", filter: true) do |menu|\n all_clubs.each do |club|\n menu.choice club.name\n end\n end\nend",
"def receiveInfo( playerIndex, card )\n if(playerIndex == -1 && card == nil)\n puts \"No one could answer. \"\n else\n # since the computer player doesn't make bad guess, \n # we delete the card just showed by other players from the lists of potential right cards.\n if( card.type == :person )\n i = 0\n while( i < @listOfAllSuspects.length )\n if(@listOfAllSuspects[i].value == card.value)\n @listOfAllSuspects.delete_at(i)\n else\n i = i + 1\n end\n end\n elsif( card.type == :place )\n i = 0\n while( i < @listOfAllLocations.length )\n if(@listOfAllLocations[i] == card)\n @listOfAllLocations.delete_at(i)\n else\n i = i + 1\n end\n end\n elsif( card.type == :weapon )\n i = 0\n while( i < @listOfAllWeapons.length )\n if(@listOfAllWeapons[i] == card)\n @listOfAllWeapons.delete_at(i)\n else\n i = i + 1\n end\n end\n end\n end #if\n end",
"def choose_cards(turn, player)\n if turn.turn_card_on_deck?\n rand_num = rand(2)\n list_of_cards = case\n when rand_num == 0: Array.new.push(turn.turn_get_a_card_from_deck)\n when rand_num == 1: turn.turn_get_cards_from_stack(1)\n end\n else\n list_of_cards = turn.turn_get_cards_from_stack(1)\n end\n list_of_cards.concat(turn.turn_get_cards_from_stack(1))\n end",
"def custom_collection\r\n clear\r\n custom_banner\r\n puts\r\n options = [\r\n { name: 'Add custom quiz collection', value: lambda {\r\n add_collection\r\n } },\r\n { name: 'Check out custom quiz collection', value: lambda {\r\n select_collection\r\n } },\r\n { name: 'Edit a quiz collection', value: lambda {\r\n edit_collection\r\n } },\r\n { name: 'Delete a quiz collection', value: lambda {\r\n display_delete_collections\r\n } },\r\n { name: 'Back', value: lambda {\r\n clear\r\n interface\r\n } }\r\n ]\r\n option = @prompt.select(\"Please select from the following options:\\n\\n\", options,\r\n help: \"(Choose using ↑/↓ arrow keys, press Enter to select)\\n\\n\", show_help: :always)\r\n end",
"def show_dealer_cards(dlr_first_hand, game_status)\n c1_pic = dlr_first_hand[:show_card_1][:picture]\n c1_name = dlr_first_hand[:show_card_1][:name]\n c2_pic = dlr_first_hand[:show_card_2][:picture]\n c2_name = dlr_first_hand[:show_card_2][:name]\n hits = dlr_first_hand[:hit_cards].map { |n| n[:name] }\n dealer_hand_total = game_status[:dealer_hand]\n\n if game_status[:show_all_hands] == false\n c2_pic = '? '\n dealer_hand_total = \"unknown\"\n end\n\n prompt \"***** Dealers Cards *****\"\n prompt \"Here are the dealers first 2 cards\"\n prompt \"First card => #{c1_name}\"\n prompt \"Second card => Dealer to know, you to find out..\"\n prompt \"+-----+ +-----+\"\n prompt \"| | | |\"\n prompt \"| #{c1_pic} | | #{c2_pic} |\"\n prompt \"| | | |\"\n prompt \"+-----+ +-----+\"\n prompt \" \"\n prompt \"Dealers 'hit cards' #{hits}\"\n prompt \"The dealers total card count is #{dealer_hand_total}\"\nend",
"def the_draw_card(deck_value, deck_card_name, cards, cards_value, random)\n cards = cards[random]\n deck_card_name.delete_at(random.to_i)\n return cards\n end",
"def deal_cards\n Print.heading('Dealing initial cards')\n deal_card_to_players\n dealer_card_to_dealer(false) #false to hide first dealer card\n deal_card_to_players\n dealer_card_to_dealer(true)\n end",
"def affordable_cards\n answer = Array.new()\n (@game.all_displayed_cards + @player.tableau.reserved_cards).each do |card|\n @cost = @player.tableau.tokens_required(card)\n answer << card if !@cost==false\n end\n answer\n end",
"def show_dealer_cards(dlr_first_hand, game_status)\n c1_pic = dlr_first_hand[:show_card_one][:picture]\n c1_name = dlr_first_hand[:show_card_one][:name]\n c2_pic = dlr_first_hand[:show_card_two][:picture]\n c2_name = dlr_first_hand[:show_card_two][:name]\n hits = dlr_first_hand[:hit_cards].map { |n| n[:name] }\n dealer_hand_total = game_status[:dealer_hand]\n\n if game_status[:show_all_hands] == false\n c2_pic = '? '\n dealer_hand_total = \"unknown\"\n end\n\n prompt \"***** Dealers Cards *****\"\n prompt \"Here are the dealers first two cards\"\n prompt \"First card => #{c1_name}\"\n prompt \"Second card => Dealer to know, you to find out..\"\n prompt \"+-----+ +-----+\"\n prompt \"| | | |\"\n prompt \"| #{c1_pic} | | #{c2_pic} |\"\n prompt \"| | | |\"\n prompt \"+-----+ +-----+\"\n prompt \" \"\n prompt \"Dealers 'hit cards' #{hits}\"\n prompt \"The dealers total card count is #{dealer_hand_total}\"\nend",
"def display_hand(hand)\n card_names = {\n \"c2\" => \"the 2 of clubs\", \"c3\" => \"the 3 of clubs\", \"c4\" => \"the 4 of clubs\", \"c5\" => \"the 5 of clubs\", \"c6\" => \"the 6 of clubs\", \"c7\" => \"the 7 of clubs\", \"c8\" => \"the 8 of clubs\", \"c9\" => \"the 9 of clubs\", \"c10\" => \"the 10 of clubs\", \"cj\" => \"the jack of clubs\", \"cq\" => \"the queen of clubs\", \"ck\" => \"the king of clubs\", \"ca\" => \"the ace of clubs\",\n \"d2\" => \"the 2 of diamonds\", \"d3\" => \"the 3 of diamonds\", \"d4\" => \"the 4 of diamonds\", \"d5\" => \"the 5 of diamonds\", \"d6\" => \"the 6 of diamonds\", \"d7\" => \"the 7 of diamonds\", \"d8\" => \"the 8 of diamonds\", \"d9\" => \"the 9 of diamonds\", \"d10\" => \"the 10 of diamonds\", \"dj\" => \"the jack of diamonds\", \"dq\" => \"the queen of diamonds\", \"dk\" => \"the king of diamonds\", \"da\" => \"the ace of diamonds\",\n \"h2\" => \"the 2 of hearts\", \"h3\" => \"the 3 of hearts\", \"h4\" => \"the 4 of hearts\", \"h5\" => \"the 5 of hearts\", \"h6\" => \"the 6 of hearts\", \"h7\" => \"the 7 of hearts\", \"h8\" => \"the 8 of hearts\", \"h9\" => \"the 9 of hearts\", \"h10\" => \"the 10 of hearts\", \"hj\" => \"the jack of hearts\", \"hq\" => \"the queen of hearts\", \"hk\" => \"the king of hearts\", \"ha\" => \"the ace of hearts\",\n \"s2\" => \"the 2 of spades\", \"s3\" => \"the 3 of spades\", \"s4\" => \"the 4 of spades\", \"s5\" => \"the 5 of spades\", \"s6\" => \"the 6 of spades\", \"s7\" => \"the 7 of spades\", \"s8\" => \"the 8 of spades\", \"s9\" => \"the 9 of spades\", \"s10\" => \"the 10 of spades\", \"sj\" => \"the jack of spades\", \"sq\" => \"the queen of spades\", \"sk\" => \"the king of spades\", \"sa\" => \"the ace of spades, aww yeah!\"\n}\n puts \"Your hand contains the following cards:\"\n hand.each do |key, _|\n puts card_names[key]\n end\nend",
"def find_user\n puts \"Please enter your name.\"\n name_input = gets.chomp\n system \"clear\"\n actual_user = User.find_by(name: name_input) #look up user name\n if !actual_user #check if name matches user input\n puts \"we could not find that user name. Please try again.\"\n find_user\n else\n @user = actual_user #set the user name to a class variable for later user\n main_menu_options #send user to main menue\n end\n end",
"def choose_character\n char_move = CharacterMove.all \n characters = Character.all \n move = Move.all\n # puts status_bar\n\n # puts \"1) Wolverine 2)Jean Grey 3)Quick-Silver\"\n \n # puts \"Choose Your Character..\"\n # user_input = gets.chomp\n ch = @prompt.select(\"Choose Your Character..\", %w(Martian-Manhunter Superman Flash Help))\n \n if ch == \"Martian-Manhunter\"\n # binding.pry\n @current_character = characters[0]\n first = characters[0].name\n @life_count = characters[0].lives\n puts \"You Have Chosen #{first}. You have #{@life_count} lives\"\n if char_move[0].char_id == characters[0].id\n @special_move = move[0].name\n end\n system('clear')\n\n \n elsif ch == \"Superman\"\n @current_character = characters[1]\n second = characters[1].name\n @life_count = characters[1].lives\n puts \"You Have Chosen #{second}. You have #{@life_count} lives\"\n if char_move[1].char_id == characters[1].id\n @special_move = move[1].name\n end\n \n elsif ch == \"Flash\"\n @current_character = characters[2]\n third = characters[2].name\n @life_count = characters[2].lives\n puts \"You Have Chosen #{third} You have #{@life_count} lives\"\n if char_move[2].char_id == characters[2].id\n @special_move = move[2].name\n \n end\n \n \n \n elsif ch == \"Help\" \n help \n puts \"\\n\"\n \n choose_character\n \n \n \n \n else\n puts \"Invalid Command\"\n end\n \n end",
"def delete_decision(custom, collection)\r\n clear\r\n custom_banner\r\n puts\r\n options = []\r\n options.push(\r\n # Comfirm the decision again!\r\n { name: 'Yes!!! I want to delete it so bad!!!!', value: lambda {\r\n conduct_deletion(custom, collection)\r\n } },\r\n # This option provide access to go back if user pull back\r\n { name: 'All right. I want to keep it there now', value: lambda {\r\n display_delete_collections\r\n } }\r\n )\r\n option = @prompt.select(\r\n 'The collection will be delete permanently!!! Think carefully before you act.'.colorize(:blue).colorize(background: :red), options, help: \"(Select with pressing ↑/↓ arrow keys, and then pressing Enter)\\n\\n\\n\", show_help: :always\r\n )\r\n end",
"def player_action\n loop do\n @input = STDIN.gets.chomp\n # Checks to see if the user is in a safe position to view their hand.\n if @input.downcase == 'y' || @input.downcase == 'yes'\n\n # Outputs all of the necessary information for the user.\n player_info(@active_players[0], @pot_size)\n current_info(@active_players, @table_current_bet)\n\n # If community cards have been dealt yet, output them for the user in a nice format.\n if @stage_of_play.positive?\n print 'The current community cards are '\n card_output(@community_cards)\n puts ''\n end\n puts ''\n print 'You have the '\n # Outputs the user's hole cards in a nice format.\n card_output(@active_players[0].hole_cards)\n\n puts ''\n puts ''\n\n puts 'What you you like to do?'\n # If the player has already acted this turn and their bet is equal to the highest bet, it means that they were the initial raiser (or checker).\n # So we break out of the loop asking for input so we can move to the next stage of the hand.\n if @active_players[0].acted == true && @active_players[0].current_bet == @table_current_bet\n # && @active_players[0].current_bet.positive?\n break\n\n # If we get to here and the player's current bet is equal to the tables highest bet, it means they're the first to act this turn, or they are the big blind and no one has bet.\n # Although a user is allowed to fold here, we don't provide the option as it is 100% free to check here with no downside.\n elsif @active_players[0].current_bet == @table_current_bet\n puts 'You can ' + '(C)heck'.light_yellow + ' or ' + '(R)aise.'.light_green\n\n loop do\n @input = STDIN.gets.chomp\n\n # If the player chooses to check, we adjust chips (using check_action) and rotate the @active_players array to move onto the next player.\n if @input.downcase == 'c' || @input.downcase == 'check'\n check_action\n @active_players.rotate!\n break\n\n # If the player chooses to raise, we adjust chips (using raise_action)\n elsif @input.downcase == 'r' || @input.downcase == 'raise'\n raise_bet\n # If @input_string is true, it means that the player has entered a correct value so we rotate the array and break out of the loop.\n # Otherwise, the player has changed their mind regarding the raise and wants to see the options again, so we don't rotate/break out.\n unless @input_string\n @active_players.rotate!\n break\n end\n else\n puts 'Please enter a valid input.'.light_red\n end\n end\n\n # Break out of asking for user input - the user input has already been entered.\n # Don't worry, we'll be back soon doing the same thing for the next player (if needed!)\n break\n\n # If the player's current bet is below the highest bet, they can't check, so we offer all other options.\n elsif @active_players[0].current_bet < @table_current_bet\n puts 'You can ' + '(C)all, '.light_yellow + '(R)aise,'.light_green + ' or ' + '(F)old.'.light_red\n\n loop do\n @input = STDIN.gets.chomp\n # Behaviour here is the same as checking/raising above - we just call different methods to adjust chips as necessary.\n if @input.downcase == 'c' || @input.downcase == 'call'\n call_bet\n @active_players.rotate!\n break\n elsif @input.downcase == 'r' || @input.downcase == 'raise'\n raise_bet\n unless @input_string\n @active_players.rotate!\n break\n end\n elsif @input.downcase == 'f' || @input.downcase == 'fold'\n fold_hand\n @active_players.rotate!\n break\n else\n puts 'Please enter a valid input.'\n end\n end\n break\n end\n # This means the player has entered a response other than Yes when asked if they want to view their hand.\n # Exiting out of the game mid hand would have disastrous effects on chip calculations so we just wait until they say yes!\n else\n puts \"That's okay - no rush!\"\n end\n end\nend",
"def remaining_cards\r\n @deck_of_cards.each do |card|\r\n card.output_card\r\n end\r\n end",
"def ownedCards\n \tcus_owned_by_user = cards_users.where(is_shared: false)\n\n \t# Have a list of CardsUsers, but want a list of Owned Cards\n \towned_cards = []\n \tcus_owned_by_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\towned_cards.push(card)\n \tend\n \towned_cards\n end",
"def select_cards cards\n Timeout::timeout(10) {\n puts 'Please select 3 cards for your chosen set or enter \\'q\\' as your first card to quit.'\n print 'First card: '\n card_one = gets.chomp\n if card_one.eql? 'q'\n puts 'Quiting current game...'\n return ['q']\n else\n print 'Second card: '\n card_two = gets.chomp\n print 'Third card: '\n card_three = gets.chomp\n card_one, card_two, card_three = *(dupes card_one, card_two, card_three)\n validRng = 0...cards.size\n until (validRng.cover? card_one) && (validRng.cover? card_two) && (validRng.cover? card_three)\n puts 'A card choice was found to be invalid. Please select 3 new cards.'\n print 'First card: '\n card_one = gets.chomp\n print 'Second card: '\n card_two = gets.chomp\n print 'Third card: '\n card_three = gets.chomp\n card_one, card_two, card_three = *(dupes card_one, card_two, card_three)\n end\n end\n [cards[card_one], cards[card_two], cards[card_three]]\n }\nrescue Timeout::Error\n puts\n puts \"You took too long to enter, quiting game\"\n exit\nend",
"def perform_action(choice)\n\n until OPTIONS.any? { |option| option.include? choice } #validates user input\n print \"'#{choice}' is an invalid option, try again. > \"\n choice = gets.strip.downcase\n end \n \n case choice \n when *OPTIONS[0]\n puts \"\\n\\n>>>>>>> LIST OF USERS\"\n count = 0\n my_proc = Proc.new{count = count + 1}\n tp @workspace.users, {user: lambda{ |u| my_proc.call }}, :id, :user_name, :real_name => {:display_method => :name}\n\n when *OPTIONS[1]\n puts \"\\n\\n>>>>>>> LIST OF CHANNELS\"\n # tp @workspace.channels, :include => :id\n count = 0\n my_proc = Proc.new{count = count + 1}\n tp @workspace.channels, {channel: lambda{ |u| my_proc.call }}, :id, :name, :topic, :member_count\n\n when *OPTIONS[2]\n make_selection(\"user\", @workspace.users)\n \n when *OPTIONS[3]\n make_selection(\"channel\", @workspace.channels)\n\n when *OPTIONS[4] #details\n if @workspace.selected.nil?\n puts \"ERROR: Oops, you haven't made a selection yet. Make a selection first.\"\n else\n puts @workspace.selected.details\n end\n\n when *OPTIONS[5] #post message\n if @workspace.selected.nil?\n puts \"ERROR: Who ya trying to send a message to? Pick someone first, silly.\"\n else\n print \"Enter the message that you want to send to #{@workspace.selected.name} > \"\n message = gets\n @workspace.selected.post_message(message)\n end\n end\n\nend",
"def edit_cat_info\n puts \"\\nPlease enter your cat's name and then press the RETURN key.\"\n kitty_name = gets.chomp\n kitty = Cat.all.find_by(name: kitty_name)\n if kitty.nil?\n puts \"\\nThat meowzer doesn't yet exist. You'll now be transferred to the ADD CAT menu.\"\n add_cat\n end\n\n prompt = TTY::Prompt.new\n choices = {\n \" 1 - #{kitty_name}'s current owner\" => 1,\n \" 2 - #{kitty_name}'s favorite food\" => 2,\n \" 3 - #{kitty_name}'s temperament with other cats\" => 3,\n \" 4 - Return to the Main Menu\" => 4 }\n choice = prompt.select(\"\\nHowdy, #{kitty_name}'s owner! What information would you like to update?\\n\", choices, per_page: 4)\n\n case (choice.to_i)\n\n when 1 #current owner?\n current_owner_loop = true\n \n puts \"\\nWhat is the first name of #{kitty_name}'s current owner?\"\n new_owner = gets.chomp\n new_owner_id = Owner.all.find_by(name: new_owner)\n if new_owner_id.nil?\n puts \"\\nThat user doesn't yet exist. You'll now be transferred to the ADD USER menu.\"\n add_owner\n else\n kitty.owner_id = new_owner_id.id\n puts \"\\nYay! #{new_owner} is now #{kitty_name}'s owner!\\n\"\n current_owner_loop = false\n end\n \n when 2 #food\n puts \"\\nWhich type of cat food does #{kitty_name} prefer, wet or dry?\"\n new_fav_food = gets.chomp\n kitty.favorite_food = new_fav_food\n when 3 #temperament\n new_temp_loop = true\n while new_temp_loop do\n puts \"\\nDoes #{kitty_name} get along with other cats? Please enter 'y' or 'n'.\"\n new_temperament = gets.chomp\n if new_temperament == \"y\"\n new_temperament = true\n new_temp_loop = false\n elsif new_temperament == \"n\"\n new_temperament = false\n new_temp_loop = false\n else\n puts \"\\nPlease enter 'y' or 'n'.\"\n end\n end\n kitty.temperament = new_temperament\n when 4\n main_menu\n end\n kitty.save\n end",
"def play_card(user, card, args)\n player_name = user.to_s\n unless user == active_user\n return [false, nil, {player_name => 'You must wait your turn.'}]\n end\n player = find_player(user)\n\n id = card.to_i\n index = player.hand.index { |c| c.id == id }\n\n if player.hand.size == 1\n raise \"#{player_name} played before drawing\"\n end\n\n if !index\n return [false, nil, {player_name => \"You do not have a #{card}\"}]\n end\n\n # Since there will only be two cards in hand, index will either be 0 or 1\n other_index = 1 - index\n\n if player.ministered? && id != 7\n seven = Card.new(7)\n msg = \"You MUST play your #{seven}: #{seven.usage}.\"\n return [false, nil, {player_name => msg}]\n end\n\n pubtext = nil\n privtext = {}\n\n args = args ? args.split : []\n\n if NEED_TARGET.include?(id)\n if args.empty?\n msg = \"You must specify a target for #{Card.name(id)}.\"\n return [false, nil, {player_name => msg}]\n end\n\n target = resolve_name(args[0])\n unless target\n msg = args[0] + ' is not a valid target.'\n return [false, nil, {player_name => msg}]\n end\n\n if target == player && id != 5\n msg = \"You can only self-target with a #{Card.name(5)}\"\n return [false, nil, {player_name => msg}]\n end\n end\n\n prefix = \"#{player} plays #{Card.name(id)}\"\n case id\n when 1\n # Guess\n guess = args[1] ? args[1].to_i : 0\n if 2 > guess || guess > 8\n msg = 'You must guess a number between 2 and 8.'\n return [false, nil, {player_name => msg}]\n end\n prefix << \" to see if #{target} has #{Card.name(guess)}. \"\n\n if target.protected?\n pubtext = prefix + \"But #{target} is protected!\"\n elsif target.card.id == guess\n pubtext = prefix + \"#{target} does and is out of the round!\"\n kill_player(target)\n else\n pubtext = prefix + \"But #{target} does not.\"\n end\n\n when 2\n # Peek at card\n pubtext = prefix + \" to see #{target}'s card.\"\n if target.protected?\n pubtext << \" But #{target} is protected!\"\n else\n privtext[player_name] = \"#{target} has a #{target.card}.\"\n privtext[target.name] = \"You showed #{player} your #{target.card}.\"\n end\n\n when 3\n # Battle!\n my_card = player.hand[other_index]\n\n prefix << \" to battle with #{target}. \"\n if target.protected?\n pubtext = prefix + \"But #{target} is protected!\"\n elsif target.card.id < my_card.id\n pubtext = prefix + \"#{target}'s #{target.card} is clearly \" +\n \"inferior, so #{target} is out of the round!\"\n kill_player(target)\n elsif target.card.id > my_card.id\n pubtext = prefix + \"#{player}'s #{my_card} is clearly \" +\n \"inferior, so #{player} is out of the round!\"\n kill_player(player)\n else\n pubtext = prefix + 'It was a great battle, but the match was ' +\n 'inconclusive.'\n end\n\n when 4\n # Protect\n player.protected = true\n pubtext = prefix + \". #{player} is protected for one turn!\"\n\n when 5\n # Force discard\n if deck_size > 0\n new_card = @deck.shift\n source = 'a card from the deck'\n else\n new_card = @facedown_card\n source = 'the facedown card'\n end\n\n if target == player\n replace_index = other_index\n old_card = player.hand[replace_index]\n else\n replace_index = 0\n old_card = target.card\n end\n\n pubtext = prefix + \" to make #{target} discard.\"\n\n if target.protected?\n pubtext << \" But #{target} is protected!\"\n elsif old_card.id == 8\n kill_player(target)\n pubtext << \" Because #{target} discarded a #{old_card}, \" +\n \"#{target} is out of the round!\"\n else\n pubtext << \" #{target} discards #{old_card} then picks up #{source}.\"\n target.discard_and_replace(new_card, replace_index)\n privtext[target.name] = \"#{player} made you discard your \" +\n \"#{old_card}. Your new card is #{new_card}.\"\n end\n\n when 6\n # Trade hands\n pubtext = prefix + \" to trade hands with #{target}.\"\n if target.protected?\n pubtext << \" But #{target} is protected!\"\n else\n my_card, their_card = player.trade_hand_with(target, other_index)\n privtext[player_name] =\n \"You traded with #{target} and got a #{my_card}.\"\n privtext[target.name] =\n \"#{player} traded with you giving you a #{their_card}.\"\n end\n\n when 7\n pubtext = prefix + '.'\n\n when 8\n # Die!\n pubtext = prefix + \". #{player_name} is out of the round!\"\n kill_player(player)\n end\n\n if player.alive?\n # If I'm still alive, play my card.\n # If I died, I've already discarded my cards so don't play.\n player.play_card_at(index)\n\n # Let next player take turn.\n # If I'm alive, that means I must rotate to the back.\n # If I'm dead, next player is already in position, so no rotate.\n @round_player_order.rotate!\n end\n\n compare_cards if deck_size == 0\n\n [true, pubtext, privtext]\n end",
"def get_useranme\n status = true\n while status == true\n @username = @@prompt.ask(\"Create a username:\")\n question = @@prompt.select(\"you created #{@username}, are you sure?\") do |opt|\n opt.choice \"Yes\"\n opt.choice \"No\"\n end\n if question == \"Yes\"\n status = false\n break\n system(\"clear\")\n else question == \"No\"\n status = true\n end\n end\n end",
"def correct_user\n list = current_user.lists.find_by(params[:list_id]) \n card = list.cards.find_by(id: params[:card_id])\n redirect_to root_url if card.nil?\n end",
"def select_fan_from_list(my_fans)\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n puts \"\\n \\n\"\n\n prompt.select(\"Here's a list of the players: (you can type the name of the player to filter through the players)\", filter: true) do |menu|\n my_fans.each do |fan|\n menu.choice fan.name\n end\n end\n \nend",
"def index\n @name_cards = @user.name_cards.page(params[:page])\n end",
"def display_board_screen(hidden_dealer)\n display_hand_dealer = []\n display_hand_player = []\n\n if hidden_dealer\n dealer_card = [generate_ASCII_card(@hand_dealer[0]),generate_ASCII_card(@hidden_card)]\n display_hand_dealer = concatenate_cards(dealer_card)\n\n else\n dealer_card = []\n @hand_dealer.each do |card|\n dealer_card.push(generate_ASCII_card(card))\n end\n display_hand_dealer = concatenate_cards(dealer_card)\n end\n \n\n @hand_player.each do |card|\n player_card = []\n @hand_player.each do |card|\n player_card.push(generate_ASCII_card(card))\n end\n display_hand_player = concatenate_cards(player_card)\n end\n\n system \"clear\" or system \"cls\"\n puts \"Dealer:\"\n puts display_hand_dealer\n puts\n puts \"Player:\"\n puts display_hand_player\n puts\n puts \"Do you want to (h)it or (s)tay?\"\nend",
"def recipe_cards \n RecipeCard.all.select do |recipe|\n recipe.user == self\n end \n end",
"def pick_up\n\n slow_type(\"\\nHere's what's in #{find_room_by_id(@current_room_id).name}:\\n\")\n\n current_cell_items.each do |item_id|\n item = find_item_by_id(item_id)\n puts \"#{item.name}\" unless @inventory.include?(item.item_id) || item.show_item == false || item.class == Person\n end\n \n pick_up = TTY::Prompt.new\n\n choices = []\n current_cell_items.each do |item_id|\n item = find_item_by_id(item_id)\n choices << { name: item.name, value: item.item_id } unless @inventory.include?(item.item_id) || item.show_item == false || item.class == Person\n end\n \n input = pick_up.select(slow_type(\"\\nWhat would you like to pick up?\\n\"), choices)\n\n # RUN PICK UP RULES TO CHECK IF WE CAN PICK IT UP\n\n if current_cell_items.include?(input) && !@inventory.include?(input)\n pick_up_checks(input)\n\n else current_cell_items.include?(input) && !@inventory.include?(input)\n put_item_in_inventory(input)\n end\n end",
"def display_card_details(choice)\n puts \"=====================\"\n puts \"| #{choice[\"name\"].upcase}\"\n puts \"=====================\"\n puts \"| INTELLIGENCE:.. #{choice[\"intelligence\"]}\"\n puts \"| STRENGTH:...... #{choice[\"strength\"]}\"\n puts \"| SPEED:......... #{choice[\"speed\"]}\"\n puts \"| DURABILITY:.... #{choice[\"durability\"]}\"\n puts \"| POWER:......... #{choice[\"power\"]}\"\n puts \"| COMBAT:........ #{choice[\"combat\"]}\"\n puts \"=====================\"\nend",
"def menu \n prompt = TTY::Prompt.new\n choices = [\"Race🏎️\", \"Go to Garage🧰\", \"Open Shop🔑\", \"Leaderboards📈\", \"Log Out\"]\n choice = prompt.select(\"\", choices) \n if choice == choices[0] && user.user_cars.size > 0 \n system(\"clear\")\n race_meth() #############RACEMETH\n elsif choice == choices[0] && user.user_cars.size == 0 \n system(\"clear\")\n puts \"You have no cars to race. Purchase one from the shop first!\"\n menu()\n elsif choice == choices[1] && user.user_cars.size > 0 \n system(\"clear\")\n garage()\n elsif choice == choices[1] && user.user_cars.size == 0 \n system(\"clear\")\n puts \"You have no cars in your garage. Purchase one from the shop first!\"\n menu()\n elsif choice == choices[2] \n system(\"clear\")\n shop()\n elsif choice == choices[3]\n leaderboards()\n else\n intro() \n end \nend",
"def selected_class_cards\n logger.info \"class_info: #{params[:class_selected_id]}\"\n @class_deck = SkillCard.where(class_id: params[:class_selected_id])\n render \"user/_class_selected\",\n locals: { selected_class: @class_deck },\n layout: false\n end",
"def user_list\n appWelcome\n @path = Dir.glob('*').join(', ').to_s\n if File.exist?(@path)\n clear\n appWelcome\n puts 'Select your profile'\n profile_menu = [\n { File.basename(@path, '.yml') => -> do user_menu end },\n { 'Quit' => -> do exit_app end }\n ]\n $prompt.select('', profile_menu)\n\n # user_menu\n else\n no_creation_of_profile\n clear\n end\n end",
"def display_compare_cards(player_cards, dealer_cards)\n # compare cards!\n puts \"==============\"\n prompt \"Dealer has #{dealer_cards}, for a total of: #{total(dealer_cards)}\"\n prompt \"Player has #{player_cards}, for a total of: #{total(player_cards)}\"\n puts \"==============\"\nend",
"def print_cards\n str_arr = @cards.map { |card| card.to_s }\n cards_str = str_arr.join(\", \")\n \"#{@name}'s cards: #{cards_str}\"\n end",
"def show_hand(player_ID)\n card_ID = 0\n print_with_pause(\"Here are your cards...\".colorize(:red))\n print_with_pause(\"Choose wisely.\".colorize(:red))\n waits(2)\n puts `clear`\n while card_ID < @players[player_ID].cards.length\n line_number = card_ID + 1\n puts (line_number.to_s + \". \" + @players[player_ID].cards[card_ID].value).colorize(:black).on_white\n card_ID = card_ID + 1\n end\n end",
"def user_profile \n system 'clear'\n CoffeeMan.stay_logo\n choice = @prompt.select(\"~P R O F I L E~\") do |menu|\n puts \"HELLO #{@userid.username}\".colorize(:light_blue)\n menu.choice \"Update Username\", -> {change_username}\n menu.choice \"Update Password\", -> {change_password}\n menu.choice \"Delete Account\", -> {delete_profile}\n menu.choice \"Back\", -> {main_menu}\n end\n sleep 1\n end",
"def actions\n answer = @prompt.select(\"Where will you go?\", %w(Foward Back Status Items), cycle:true, per_page:4)\n if answer == \"Foward\"\n if @zone_cur == 10\n narrate(\"you leave the #{self.name}\")\n leave(self.exit_name)\n else\n @zone_cur += 1\n narrate(\"you continue foward\")\n encounter_check\n end\n elsif answer == \"Back\"\n if @zone_cur == 0\n narrate(\"you leave the #{self.name}\")\n leave(self.entrance_name)\n else\n @zone_cur -= 1\n narrate(\"you retreat backwards\")\n encounter_check\n end\n elsif answer == 'Status'\n narrate(\"#{@player.name} has #{@player.hp} hp, #{@player.attack} attack, and #{@player.defence} defence\")\n str = \"\"\n a = @player.equipment.map do |el|\n el.name\n end\n b = a.join(\", \")\n narrate(\"#{@player.name} has the following items equipped: #{b}\")\n here\n elsif answer == 'Items'\n answer = @prompt.select(\"Items Menu\", %w(Equip_item Look_item), cycle:true, per_page:4)\n if answer == 'Equip_item'\n #list inventory\n stuff = @player.items.map do |el|\n el.name\n end\n #select an item from inventory\n answer = @prompt.select(\"Items Menu\", stuff, cycle:true, per_page:4)\n #find that item again\n to_eq = @player.items.find do |el|\n el.name == answer\n end\n binding.pry\n #equip that item\n @player.equip(to_eq)\n narrate( \"You have equipped the #{to_eq.name}!\")\n actions\n end\n end\n end",
"def view_other_users\n other_user_name = TTY::Prompt.new.select(\"Which fellow drinker would you like to see more about?\", Consumer.where.not(name: self.name).pluck(:name))\n other_user = Consumer.find_by(name: other_user_name)\n TTY::Prompt.new.select(\"What would you like to see about #{other_user_name}?\") do |menu|\n menu.choice \"View #{other_user_name}'s fridge\", -> {other_user.view_fridge}\n menu.choice \"View #{other_user_name}'s quick stats\", -> {other_user.quick_stats}\n end\n end",
"def create\n # new instance of a card with parameters of card details\n @card = Card.create(card_params)\n # current user info gets associated with card?? ASK\n # if card is valid based on our criteria (validations)\n # then the card will be saved and added to list of all cards\n # and user will be redirected to list of all cards\n if @card.valid?\n @card.save!\n \n redirect_to cards_path\n # if card doesn't fit our criteria, then user will get an\n # error message\n else\n render :new\n flash[:alert] = \"There was an error with your submission\"\n end\n end",
"def player_info\n \n clear_terminal\n @prompt = TTY::Prompt.new\n puts \"Enter the name of the player\"\n query = get_user_input\n if Player.all.find_by(name: \"#{query}\") == nil\n clear_terminal\n puts \"Try with hockey, that guy doesn't play soccer!\"\n pause\n pause\n player_info \n else player_info = Player.all.find_by(name: \"#{query}\") \n end\n clear_terminal\n divider\n choice = @prompt.select(\"#{player_info.name} is a great #{player_info.position} who plays in #{player_info.club_id} and has score #{player_info.goals} playing #{player_info.minutes} minutes this season. He had comitted #{player_info.fouls_committed} fouls and has #{player_info.yellow_cards} yellow cards and #{player_info.red_cards}\",\n [\"-> Back\",\"-> Quit\",\"-> Restart\"])\n case choice\n when \"-> Back\"\n players_home\n when \"-> Quit\" || \"QUIT\"\n when \"-> Restart\" || \"RESTART\"\n run\n else\n error\n end\n end",
"def action_choice(a_player)\n print (\"#{a_player}\").yellow\n puts \", it is your turn to play.\"\n puts \"This is the board situation :\"\n puts @board.the_board\n puts\n puts \"Which box do you want to tick?\"\n print \">\"\n choice = gets.chomp\n while board.boxes.include?(choice) == false\n puts \"Invalid box reference. Please, pick up another box reference.\"\n choice = gets.chomp\n end\n return choice\n end",
"def remove\n prompt = TTY::Prompt.new\n choices = {\n \" 1 - Yourself\" => 1,\n \" 2 - A cat\" => 2,\n \" 3 - Return to the Main Menu\" => 3 }\n choice = prompt.select(\"\\nWhat would you like to remove from the directory?\\n\", choices, per_page: 3)\n\n case (choice.to_i)\n when 1\n puts \"\\nWhat is your name?\"\n owner_name = gets.chomp\n destroy = Owner.find_by(name: owner_name)\n puts \"\\nAll set, #{owner_name}! ☹️ So sad to see you go!\"\n if destroy.nil?\n puts \"\\nSorry, this owner doesn't exist.\"\n remove\n else\n destroy.destroy\n puts \"\\nBye, #{owner_name}!\"\n end\n when 2\n puts \"\\n😿 What is the cat's name?\"\n cat_name = gets.chomp\n destroy = Cat.find_by(name: cat_name)\n if destroy.nil?\n puts \"\\nSorry, this cat doesn't exist.\"\n remove\n else\n destroy.destroy\n puts \"\\nSo long, sweet #{cat_name}!\"\n end\n when 3\n main_menu\n end\n end",
"def get_chosen_card(player, match_card, deck)\n begin\n puts 'Enter colour (R, B, Y, G) followed by a number(0-9) - Eg to play a Red 7, enter R7'\n puts 'Or, R, B, Y, G followed by R-Reverse, S-Skip or P2-Pickup 2 - Eg to play a Green Pickup 2, enter GP2'\n puts 'Enter WC for Wild Card, WP4 for Wild Pickup 4 '\n puts 'Enter D to pick up from the deck'\n puts 'What would you like to play? '\n option = gets.downcase\n color = option[0]\n number = option[1, 2].strip\n color = validate_color(color)\n if color == 'Draw'\n player.cards << deck.take_card\n return false\n end\n number = validate_number(number)\n chosen_card = validate_card_in_hand(color, number, player)\n validate_card_matches_discard(color, number, match_card)\n rescue InvalidColorError => e\n puts e.message\n retry\n rescue InvalidNumberError => e\n puts e.message\n retry\n rescue InvalidCardInHandError => e\n puts e.message\n retry\n rescue InvalidCardMatchError => e\n puts e.message\n retry\n end\n chosen_card\n end",
"def get_candidates\n\t$cand_table.each do |x|\n\t\tputs \"Give me a candidate name:\"\n\t\tx[0] = gets.chomp\n\tend\nend",
"def update_owner_info\n puts \"\\nPlease enter your first name and then press the RETURN key\"\n first_name = gets.chomp\n owner = Owner.all.find_by(name: first_name)\n if owner.nil?\n puts \"\\nThat user doesn't yet exist. You'll now be transferred to the ADD USER menu.\"\n add_owner\n end\n\n prompt = TTY::Prompt.new\n choices = {\n \" 1 - Your address\" => 1,\n \" 2 - The type of food you leave on the porch (please enter 'wet' or 'dry')\" => 2,\n \" 3 - Your cat ownership status\" => 3,\n \" 4 - Your dog ownership status\" => 4,\n \" 5 - Your current neighborhood\" => 5,\n \" 6 - Return to the Main Menu\" => 6 }\n choice = prompt.select(\"\\nHowdy, #{first_name}! What information would you like to update?\\n\", choices, per_page: 6)\n\n case (choice.to_i)\n when 1 #address\n puts \"\\nWhat is your new address? format: 221-B Baker Street\"\n new_address = gets.chomp\n owner.address = new_address\n when 2 #food\n puts \"\\nWhat type of food are you leaving out on your porch? Please enter 'wet' or 'dry'.\"\n new_food = gets.chomp\n owner.food_provided = new_food\n when 3 #cat?\n cat_status_loop = true\n while cat_status_loop do\n puts \"\\nDo you currently own a cat? Please enter 'y' or 'n'.\"\n cat_status = gets.chomp\n if cat_status == \"y\"\n cat_status = true\n cat_status_loop = false\n elsif cat_status == \"n\"\n cat_status = false\n cat_status_loop = false\n else\n puts \"\\nPlease enter 'y' or 'n'.\"\n end\n end\n owner.cat_already = cat_status\n when 4 #dog?\n dog_status_loop = true\n while dog_status_loop do\n puts \"\\nDo you currently own a dog? Please enter 'y' or 'n'.\"\n dog_status = gets.chomp\n if dog_status == \"y\"\n dog_status = true\n dog_status_loop = false\n elsif dog_status == \"n\"\n dog_status = false\n dog_status_loop = false\n else\n puts \"\\nPlease enter 'y' or 'n'.\"\n end\n end\n owner.dog = dog_status\n when 5 #neighborhood\n puts \"\\nIn which neighborhood are you currently living?\"\n new_hood = gets.chomp\n puts \"\\nCity and state?\"\n city_state = gets.chomp\n hood = Neighborhood.find_by(name: new_hood, location: city_state)\n owner.neighborhood = hood\n if hood.nil?\n new_hood_instance = Neighborhood.create(name: new_hood, location: city_state)\n owner.neighborhood_id = new_hood_instance.id\n end\n when 6\n main_menu\n end\n owner.save\n end",
"def draw_card\n #suit = Card::SUITS.sample\n #rank = Card::RANKS.sample\n #Card.new(suit: suit, rank: rank)\n @cards.pop\n end",
"def select_recipe(user_input)\n i = 0\n while i <= @recipe_name.size\n index = @recipe_name.find_index {|item| item == @recipe_name[i]}\n if index == user_input\n system(\"clear\")\n puts @recipe_name[i].colorize(:cyan)\n\n puts \"\\nDescription : \".colorize(:yellow)\n puts @recipe_description[i]\n\n puts \"\\nIngredients : \".colorize(:yellow)\n puts @recipe_ingredients[i]\n\n puts \"\\nDirections : \".colorize(:yellow)\n puts @recipe_directions[i]\n\n puts \"\"\n break\n elsif index != user_input\n\n else \n puts \"That wasn't correct... try again.\".colorize(:red)\n end\n i = i+1\n end\n end",
"def take_turn(player)\n p player.render_hand\n #render their hand\n p \"Which cards do you want to discard? (first, second..etc) i.e. '1,2' If none, reply 'none'\"\n discarded_cards = gets.chomp\n indices = parse(discarded_cards)\n discard(indices, player)\n #promt for how many new cards? => quantity\n #rerender the hand\n #promt for fold?\n #prompt them for a bet.. show their current bet\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 prompt_for_name\n return if not @rep\n model = @rep.model\n return if not model\n cameras = CameraRep.cameras_in_model model\n name = \"Camera\"\n name << \" #{cameras.length}\" if cameras.length > 0\n prompts = [\"Name\"]\n values = [name]\n results = inputbox prompts, values, \"Camera Name\"\n \n if( results )\n self.name = results[0]\n @@last_selected_name = results[0]\n end\n\nend",
"def open_pack\n cards = Card.all.sample(5)\n cards.each { |card| UserCard.create(user_id: self.id, card_id: card.id)}\n names = cards.map { |card| card.name }\n puts \"#{names.join(\", \").upcase} ...were added to your collection!\"\n sleep(3)\n end",
"def shuffle\r\n @playable_cards = []\r\n SUITES.each do |suite|\r\n NAME_VALUES.each do |name, value|\r\n @playable_cards << Card.new(suite, name, value)\r\n end \r\n end\r\n puts \"PLAYABLE CARDS\"\r\n end",
"def user_commands\n puts sep = \"------------------------------------------------------\".colorize(:yellow)\n prompt = TTY::Prompt.new\n commands = [\n {name: 'Place', value: 1},\n {name: 'Move', value: 2},\n {name: 'Left', value: 3},\n {name: 'Right', value: 4},\n {name: 'Report', value: 5},\n {name: 'Execute Selected Commands', value: 6},\n ]\n players_input = prompt.select(\"Select Your Commands:\", commands) \n case players_input\n when 1\n place_command = prompt_place\n @commands_sequence.push(place_command)\n p @commands_sequence\n puts sep\n user_commands\n when 2\n move_command = validate_move\n @commands_sequence.push(move_command)\n p @commands_sequence\n puts sep\n user_commands\n when 3\n left_command = validate_left\n @commands_sequence.push(left_command)\n p @commands_sequence\n puts sep\n user_commands\n when 4\n right_command = validate_right\n @commands_sequence.push(right_command)\n p @commands_sequence\n puts sep\n user_commands\n when 5\n report_command = validate_report\n @commands_sequence.push(report_command)\n p @commands_sequence\n puts sep\n user_commands\n when 6\n legal_commands = valid_commands(@commands_sequence)\n if legal_commands.length == 0\n puts \"Command sequence must begin with a Place Command\".colorize(:red)\n user_commands\n else \n return legal_commands\n end\n end \n end",
"def single_options\n if self.single_scoring?\n print \"What would you like to do?\\n\"\n print \"1. Remove all single scroing dice\\n\"\n print \"2. Select which dice you wish to remove\\n\"\n\n print \"Choice: \"\n choice = gets.chomp.to_i\n\n case choice\n when 1\n self.collect_single_dice\n when 2\n print \"Please enter the number of dice you want to remove: \"\n remove_count = gets.chomp.to_i\n\n removed_dice = Array.new\n\n remove_count.times do\n print \"value: \"\n removed_dice << gets.chomp.to_i\n print \"\\n\"\n end\n\n self.collect_single_dice(remove_dice)\n\n else\n print \"Nothing Happened\\n\"\n end\n\n else\n print \"invalid, no single scoring dice\\n\"\n end\n end",
"def display_deck\n @deck_array.each do |x|\n x.display_card\n end\n end",
"def match?(choices)\n\n @choices = choices\n raise ArgumentError, 'Checker received non-card input' unless @choices.kind_of?(Array)\n raise ArgumentError, 'A set has 3 cards! Please select 3 cards!' unless @choices.size == 3\n\n # Logic: \"MAKE THIS TERSE\"\n numbers = Array.new(3) { |i| choices[i].number }\n symbols = Array.new(3) { |i| choices[i].symbol }\n shadings = Array.new(3) { |i| choices[i].shading }\n colors = Array.new(3) { |i| choices[i].color }\n\n features = [numbers, symbols, shadings, colors]\n @result = features.all? { |feature| feature.uniq.size != 2 }\n end",
"def prompt_user\n system \"clear\"\n puts \"Hello, let's play Blackjack. First, tell me your name: \"\n name = gets.chomp\n puts \"Welcome, #{name.capitalize}, get ready to lose all of your money.\"\n puts\n name\n end",
"def create_or_view(user, mood_arg)\n system(\"clear\")\n prompt = TTY::Prompt.new\n selected = prompt.select(\"Choose Options:\") do |menu|\n menu.choice \"1. ADD NEW SONG\", 1\n menu.choice \"2. VIEW EXISTING SONGS\", 2\n menu.choice \"3. DELETE EXISTING SONGS\", 3\n menu.choice \"4. UPDATE SONG MOOD\", 4\n menu.choice \"5. BACK\", 5\n end\n\n if selected == 1\n enter_title = prompt.ask('Enter Song Title:', required: true, default: ENV['Song'])\n enter_artist = prompt.ask('Enter Artist Name:', required: true, default: ENV['Song'])\n puts Song.create_new_song(mood_arg, enter_title, enter_artist, user)\n system('clear')\n puts \"Song was Added. Returning to Main Menu\"\n user.reload\n sleep 4\n # binding.pry\n create_or_view(mood_arg, user)\n\n elsif selected == 2\n # binding.pry\n match = user.songs.select do |s|\n # binding.pry\n s.mood.mood == mood_arg\n end\n match.map do |s|\n puts s.title\n end\n prompt = TTY::Prompt.new\n back = prompt.select(\"These are all your Songs for this mood!\") do |back|\n back.choice \"BACK\",1\n end\n if back == 1\n create_or_view(mood_arg, user)\n end\n\n elsif selected == 3\n puts \"These are the songs you can delete:\"\n match = user.songs.select do |s| #songs instance. accessing songs through user instance.(def user)\n s.mood.mood == mood_arg\n end\n if match.length == 0\n puts \"********************************\"\n puts \"List is Empty! Returning to Menu\"\n puts \"********************************\"\n sleep 4\n create_or_view(mood_arg, user)\n end\n match.map do |s|\n # binding.pry\n list = s.title\n puts list\n end\n puts \"***********************************\"\n puts \"Type the name of a song to delete:\"\n puts \"***********************************\"\n u_input = prompt.ask('Enter Song Title:', required: true)\n delete_title = u_input\n deleting = user.songs.find_by(title: delete_title)\n if deleting != nil\n deleting.destroy\n puts \"Song was deleted! Returning to Main Menu\"\n sleep 3\n user.reload\n create_or_view(mood_arg, user)\n else\n # binding.pry\n puts \"Input does not Match the Song Title! Returning to Menu\"\n sleep 4\n create_or_view(mood_arg, user)\n end\n elsif selected == 4\n puts \"****************************************\"\n puts \"Change song mood by typing in song name:\"\n puts \"****************************************\"\n match = user.songs.select do |s| #songs instance. accessing songs through user instance.(def user)\n s.mood.mood == mood_arg\n end\n if match.length == 0\n puts \"List is Empty! Returning to Menu\"\n sleep 4\n create_or_view(mood_arg, user)\n end\n match.map do |s|\n puts s.title\n end\n puts \"------------------------------\"\n song_name = gets.chomp\n get_title = Song.find_by(title: song_name) #get the song instance\n puts \"Enter a new mood: Happy, Sad, or Relaxed:\"\n new_mood = gets.chomp\n if new_mood == \"Happy\" || new_mood == \"Sad\" || new_mood == \"Relaxed\"\n update_song_mood = Mood.find_by(mood: new_mood) #get instance of a mood that user chose.\n get_title.update(mood_id: update_song_mood.id)\n # binding.pry\n puts \"Mood was Updated to #{new_mood}! Returning to Main Menu\"\n sleep 4\n user.reload\n create_or_view(mood_arg, user)\n else\n puts \"********************************************************\"\n puts \"Input must be Happy, Sad, or Relaxed! Returning to Menu\"\n puts \"********************************************************\"\n sleep 4\n create_or_view(mood_arg, user)\n end\n elsif selected == 5\n getUserMood(user)\n end\n end",
"def adopt_pet(shelter)\n\n puts \"*** Adopt a pet ***\"\n puts \"Please select user:\"\n if shelter.clients.any?\n shelter.clients.each do |key, x|\n puts \"ID: #{key}, Name: #{x.name}\"\n end \n user_id = validate_input(shelter.clients) {prompt {\"Enter user ID: \"}}\n puts\n name = validate_input(shelter.animals) {prompt {\"Enter the name of the pet you want to adopt: \"}}\n if name != 'q'\n shelter.clients.fetch(user_id).pets << shelter.animals.fetch(name).name\n shelter.animals.delete(name)\n puts \"You have a new pet!!\"\n puts \"***Pet removed***\"\n end\n else\n puts \"We have no clients left! We need to rethink our strategy!\"\n end\n \nend",
"def find_card(name)\n api = trello_api\n all_cards = api.all_cards_on_board_of(list_id)\n if card = all_cards.find { |card| card.name == name }\n card\n end\n end",
"def recipe_cards\n RecipeCard.all.select { |recipe_card| recipe_card.user == self}\n end",
"def print_user_list\n puts \"Please write down the slected movies onto piece of paper.\"\n puts \"Ability so save list will be implemented in near future.\"\n puts \"Please stand by :) \\n\\n\"\n\n puts \"Here are your selected movies:\"\n for film in @user_list\n puts \" - #{film}\"\n end\n puts \"\"\n end",
"def prompt(myGame)\n #binding.pry\n loop do\n print \"\\nThis is a card game. Please enter number of players or quit: \"\n\n # Difficult reading, but wanted to see if I could do it. :)\n myGame.playersSet(wantsToContinue(gets.chomp()).to_i)\n\n print \"\\nEnter number of cards to be dealt each player or quit: \"\n myGame.cardsSetDealt(wantsToContinue(gets.chomp()).to_i)\n\n puts \"\\nCalculations indicate we will need #{myGame.cardsNeededPretty} cards and have #{myGame.cardsAvailablePretty}\"\n puts \"#{$dm} Does myGame have enough cards: #{myGame.hasEnoughCards}\" if $debug\n puts \"#{$dm} Players is #{myGame.players} cards dealt are #{myGame.cardsDealtPretty} deck count #{myGame.deckCountPretty}\" if $debug\n break if myGame.hasEnoughCards\n break if myGame.agreesToAddMoreDecks\n end\nend",
"def puts_up_for_adoption\n puts \"What is your name?\"\n name = gets.chomp\n current_client = self.clients().find do |client|\n client.name == name\n end\n self.clients().delete(current_client)\n puts \"You've been deleted from our client roster.\"\n puts \"Can you give us the details about your former pet, so we can add him to the adoption list again?\"\n create_animal\n end",
"def see_all_games\n system \"clear\"\n puts \"Here is the catalog of games.\"\n game_list = Game.pluck(:name)\n puts game_list\n puts puts\n prompt = TTY::Prompt.new\n prompt.select(\"What would you like to do?\") do |menu|\n menu.choice \"Go back to main menu\", -> {welcome}\n menu.choice \"Exit\", -> {clear}\n end\n end",
"def delete_favorite_player_for_user(user)\n require \"tty-prompt\"\n prompt = TTY::Prompt.new\n\n if favorite_players(user).length == 0\n puts \"You have no favorite players right now :(\"\n return\n end\n\n chosen_player = select_player_from_list(favorite_players(user))\n player_to_use = Player.find_by(name: chosen_player) #access the instance of object Player with the name chosen_player\n fan_to_use = Fan.find_by(name: user) #access the instance of fan that is the current user\n if PlayerFan.find_by(player_id: player_to_use.id, fan_id: fan_to_use.id) #check that player is not already a favorite\n PlayerFan.find_by(player_id: player_to_use.id, fan_id: fan_to_use.id).destroy #deletes favorite player from user\n puts \"#{chosen_player} was deleted from your favorite players :)\" \n else\n puts \"This is not one of your favorite players :)\" #otherwise tell user that the player is already one of their favorite players\n end\nend",
"def users\n my_recipe_cards.map do |recipecard|\n recipecard.user\n end\n end",
"def getplayername\n puts \"Enter your username:\\n\\n\"\n puts \"To exit the game, enter \" + \"EXIT\\n\\n\".red\n\n print \">> \"\n name = gets.chomp\n system('clear')\n if name.downcase == \"exit\" #if user input is exit, end the app\n end_program\n return nil\n elsif User.all.any? { |user| user.name.downcase == name.downcase } #if the user exists, get the user object\n user = User.all.select { |user| user.name.downcase == name.downcase}[0]\n puts \"Welcome back, #{user.name}\\n\\n\"\n else #create the user and give them a how to play instructions method call instead of just going to menu\n user = User.create(name: name)\n how_to_play(user)\n end\n user\nend"
] |
[
"0.7013456",
"0.6899509",
"0.640083",
"0.616436",
"0.60829204",
"0.58941877",
"0.5840707",
"0.5636257",
"0.56241745",
"0.5516593",
"0.5497286",
"0.5464719",
"0.53647786",
"0.53544223",
"0.5337183",
"0.53226656",
"0.53090215",
"0.53084224",
"0.5281249",
"0.52529925",
"0.52425975",
"0.52120936",
"0.520893",
"0.5207516",
"0.5192393",
"0.5180995",
"0.5174631",
"0.5168299",
"0.5167611",
"0.5163981",
"0.5144361",
"0.5137827",
"0.51368386",
"0.5123925",
"0.5118608",
"0.50947696",
"0.5068245",
"0.5030989",
"0.50255275",
"0.5021583",
"0.5018214",
"0.5017177",
"0.49823922",
"0.49805835",
"0.495917",
"0.49551457",
"0.4920972",
"0.49203423",
"0.49057564",
"0.48992455",
"0.4876871",
"0.4875685",
"0.4871959",
"0.48702896",
"0.48681262",
"0.48643938",
"0.48607916",
"0.48589826",
"0.48583704",
"0.48533735",
"0.48474103",
"0.48456454",
"0.48446003",
"0.48350823",
"0.4814909",
"0.4814592",
"0.48143685",
"0.48131782",
"0.48088518",
"0.48051336",
"0.48049662",
"0.48017016",
"0.47976297",
"0.4790304",
"0.47871855",
"0.47868398",
"0.47863284",
"0.47831035",
"0.47819275",
"0.47728828",
"0.47724396",
"0.477012",
"0.4766026",
"0.47631043",
"0.4758996",
"0.4752376",
"0.47519276",
"0.47507343",
"0.47384772",
"0.47376573",
"0.4736678",
"0.4727851",
"0.47240707",
"0.47199973",
"0.47184736",
"0.47179577",
"0.47139302",
"0.47097626",
"0.47079185",
"0.47056618"
] |
0.7135518
|
0
|
finds the users cards, removes any duplicates and subtracts that number from total cards (160) Displays message showing how many cards user still needs to complete colletion.
|
def cards_left_to_collect
card_ids = UserCard.select {|card| card["user_id"] == self.id}
remaining = Card.all.count - card_ids.map { |card| card["card_id"] }.uniq.count
if remaining == 0
puts "====================================================================="
puts "Congratulations, you have completed the Superhero card album!!"
puts "====================================================================="
else
puts "====================================================================="
puts "You still have #{remaining} cards left to collect..."
puts "====================================================================="
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_cards(to_remove)\n to_remove.each { |num| @cards.delete_at(num - 1) }\n end",
"def full_dance_card\n\t\tif @card.length > 5\n\t\t\tputs \"Your dance card is full! You have to dance with #{@card[0]} before you can add #{@card[-1]}\"\n\t\t\t@card.delete_at(-1)\n\t\tend\n\t\t@card\n\tend",
"def remove remove_card\r\n @card_list.remove remove_card\r\n end",
"def deal5cards (n)",
"def deal_card\n @eg_users.each do |user|\n user << @pokerdeck.pop\n end\n @eg_users\n end",
"def delete_card\n prompt = TTY::Prompt.new\n your_cards = self.cards\n card_names = your_cards.map { |card| card[\"name\"] }\n selected_card_name = prompt.select('Choose a character to delete', card_names, filter: true, cycle: true, help: \"(Start typing to filter results)\", help_color: :green, active_color: :yellow)\n selected_card = Card.find_by(name: selected_card_name)\n choice = UserCard.find_by user_id: self.id, card_id: selected_card.id\n response = prompt.select(\"Are you sure you want to delete #{selected_card_name.upcase}?\", %w(Yes No))\n if response == \"Yes\"\n choice.destroy\n bar = TTY::ProgressBar.new(\"Deleting #{selected_card_name.upcase} [:bar]\", total: 30)\n 30.times do\n sleep(0.05)\n bar.advance(1)\n end\n puts \"#{choice.card.name.upcase} was deleted from your collection!\"\n sleep(1)\n system('clear')\n title\n else\n check_collection\n end\n end",
"def remove remove_card\n @card_list.remove remove_card\n end",
"def remove_card_row_cards\n card_row.each do |gc|\n gc.discard! if gc && gc.position < self.card_row_discard_size\n end\n end",
"def remove_card\n @cards.delete_at(0)\n end",
"def cards_in_deck\n Card.where(game_id: @game.id, owner: 0).size\n end",
"def remaining_cards\r\n @deck_of_cards.each do |card|\r\n card.output_card\r\n end\r\n end",
"def out_of_cards\n display(\"---Dealer ran out of cards this round!---\\n\\n\")\n end",
"def remove_cards\n\t\t@cards.slice!(0,2)\n\tend",
"def deal_cards\n MAX_CARDS.times do |d|\n @player_manager.players.each do |player| \n player.rack.add_card(@decks_manager.draw_pile.draw_card)\n end\n end\n\n # prep the discard pile with one card from the top of the draw pile\n @decks_manager.discard_top_card\n end",
"def deal_hand no_of_cards\r\n @card_list.deal_hand no_of_cards\r\n end",
"def all_cards(user)\n user.cards.count\n end",
"def destroy\n if @card.card_box.user == current_user\n if !@card.in?(@used_cards)\n @card.destroy\n respond_to do |format|\n format.html { redirect_to cards_url, notice: 'カードを削除しました。' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to cards_url, alert: \"カードは使用中です。\" }\n format.json { head :no_content }\n end\n end\n else\n respond_to do |format|\n format.html { redirect_to cards_url, alert: \"自分のカードではありません。\" }\n format.json { head :no_content }\n end\n end\n end",
"def deal_hand no_of_cards\n @card_list.deal_hand no_of_cards\n end",
"def remove_card\n self.cards.delete_at(0)\n end",
"def calculatetotal(cards) # calculating the total of the two cards dealt, first to player then to dealer\n array = cards.map {|card| card[0]} # using the map method to lay out all the cards which are like so [[\"A\", \"S\"], [\"5\", \"C\"]]\n # We then only take the first element of the array and initialize that to the total\n total = 0 # total at the outset is zero\n array.each do |value|\n if value == \"A\" # in the event you get an ace card. \"A\" is as is unlike the bottom ones below\n total += 11 # total should now increase to 11\n elsif value.to_i == 0 # this is to cover for getting J, K, Q cards which defaults value to integer is zero\n total += 10\n else\n total += value.to_i\n end\nend # finished the array\n\n# Correcting Aces in case there are more than one. It should convert aces to 1 instead of 11 if total is more than 21\narray.select {|card| card.include?(\"A\")}.count.times do\n total -= 10 if total > 21\nend\ntotal # don't forget to include total here before exiting. IMPORTANT!!\nend",
"def remove_card(card)\n @all_cards.delete(card)\n end",
"def count_cut(value)\n\t\t# cuts 'value' cards from the top of the deck and inserts them\n\t\t# right before the last element\n\t\tvalue.times do\n\t\t\tcard = @deck_of_cards.delete_at(0)\n\t\t\t@deck_of_cards.insert(-2, card)\n\t\tend\n\tend",
"def calculate_total(cards)\n #create a new array card_values to just contain the values of the cards\n card_values = cards.map {|value| value[1]}\n total = 0\n\n #loop through these card values. If the value is an Ace, give it 11, if it is J, Q, or K, give it a value of 10. Otherwise just use the face value\n card_values.each do |card|\n if card == 'Ace'\n total += 11\n elsif card.to_i == 0 \n total = total + 10\n else\n total += card.to_i\n end\n end\n\n #count all the Aces we have using the select and count methods. And then go through the loop the number of times Ace is in the array and subtract 10 each time the total value is over 21.\n\n card_values.select {|e| e == \"A\"}.count.times do\n if total > 21\n total -= 10\n end\n end\n total\n end",
"def total_cards\n cards.count\n end",
"def num_cards_owned(tracked_deck)\n\t\tquantity_same_cards = quantity_same_query(coll_id, tracked_deck_id(tracked_deck))\n\t\tquantity_diff_cards = quantity_diff_query(coll_id, tracked_deck_id(tracked_deck))\n\t\tsame_card_count = quantity_same_cards.inject(0) do |quantity, card|\n\t\t\tquantity + card_quantity(card)\n\t\tend\n\t\tsame_card_count + quantity_diff_cards.count\n\tend",
"def completion\n\t\t@cards[0..TOTAL_UNIQUE_CARDS-1].reduce(0) {|memo, card| card.complete? ? memo + 1 : memo} / TOTAL_UNIQUE_CARDS.to_f\n\tend",
"def flush?\n cards_by_suit.any? {|_, v| v.count >= cards_needed}\n end",
"def numCards\n\t\t@cards.reduce(0) {|memo, card| memo += card.copies}\n\tend",
"def calculate_total\n #create a new array card_values to just contain the values of the cards\n card_values = cards.map {|value| value[1]}\n total = 0\n\n #loop through these card values. If the value is an Ace, give it 11, if it is J, Q, or K, give it a value of 10. Otherwise just use the face value\n card_values.each do |card|\n if card == 'Ace'\n total += 11\n elsif card.to_i == 0 \n total = total + 10\n else\n total += card.to_i\n end\n end\n\n #count all the Aces we have using the select and count methods. And then go through the loop the number of times Ace is in the array and subtract 10 each time the total value is over 21.\n\n card_values.select {|e| e == \"A\"}.count.times do\n if total > 21\n total -= 10\n end\n end\n @total = total\n end",
"def check_cards_for_warnings\n # Check for two or more cards with the same name\n duplicate_names = card_templates.select(:name).group(:name).count.select { |name, count| count > 1 }.map(&:first)\n add_warning_on_cards('duplicate_cards', duplicate_names.sort)\n end",
"def remove remove_card\n @cards.each_with_index do |card, i|\n if card.to_string == remove_card.to_string\n @cards.delete_at(i)\n return true\n end\n end\n false\n end",
"def disenchantGoldens\n\t\tdust = 0\n\t\tn = 0\n\t\tfor card in @cards[TOTAL_UNIQUE_CARDS..2*TOTAL_UNIQUE_CARDS-1]\n\t\t\textras = card.removeAll\n\t\t\tdust += card.disenchant_value * extras\n\t\t\tn += extras\n\t\tend\n\t\treturn dust, n\n\tend",
"def pop_cards(num_pops)\r\n #p @deck_todisp.size\r\n num_pops.times{|ix| @deck_todisp.pop}\r\n if @briscola and @card_briscola_todisp and @deck_todisp.size == 0\r\n #if @card_briscola_todisp and @realgame_num_cards == 0\r\n # no more cards on deck, pick the briscola\r\n @card_briscola_todisp.visible = false\r\n end\r\n #p @deck_todisp.size\r\n end",
"def get_high_cards(cards)\n @cards_by_score.each_key do |card|\n if cards.length < 5 && !cards.include?(card)\n cards << card\n end\n end\n end",
"def subtractSet(chosenCards)\n @cardsOnTable.each { |c|\n if c = chosenCards[0]\n @cardsOnTable.delete_at(0)\n elsif c = chosencards[1]\n @cardsOnTable.delete_at(1)\n elsif c = chosenCards[2]\n @cardsOnTable.delete_at(2)\n end\n }\n end",
"def remove_card\n @cards.shift\n end",
"def cards_needed\n [@size, 5].min\n end",
"def removeCard(card)\n @cards.delete(card)\n end",
"def remove_card\n cards.shift\n return cards\n end",
"def remove_card\n @cards.shift\n\n end",
"def deal_cards(deck, playing_cards)\n return if deck.length == 0\n\n #initializing deck.\n if playing_cards.length == 0\n for count in 0...12\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n return\n end\n\n if (valid_table(playing_cards)).length == 0\n #continually adds cards until there is a set or there are no more cards.\n while ((valid_table(playing_cards)).length == 0) && deck.length > 0\n #print(\"\\n Empty: #{(valid_table(playingCards)).length == 0} \\n\")\n for count in 0...3\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n end\n elsif playing_cards.length < 12\n # Adds cards if there is a set but less than 12 playing cards.\n for count in 0...3\n card = deck.delete_at(rand(deck.length))\n card.set_id($card_count)\n $card_count += 1\n playing_cards.push(card)\n end\n\n end\n\nend",
"def defend(attacking_card)\n min = 15\n min_c = nil\n if attacking_card.suit == @trump_suit\n self.trump_cards.each do |c|\n if c.int_val > attacking_card.int_val &&\n c.int_val < min\n min_c = c\n min = c.int_val\n end\n end\n else\n self.non_trump_cards.each do |c|\n if c.int_val > attacking_card.int_val &&\n c.int_val < min && attacking_card.suit == c.suit\n min_c = c\n min = c.int_val\n end\n end\n end\n @cards.delete(min_c)\n min_c\n end",
"def update_vote_count(card)\n card.increment!(:votes)\n self.used_cards.push(self.unused_cards.shift, self.unused_cards.shift)\n end",
"def deleteCard(pos)\n @cardsShown.delete_at(pos)\n end",
"def calc_hand_total(cards)\r\n total = 0\r\n numbers_only_array = cards.map {|g| g[0]}\r\n numbers_only_array.each do |h|\r\n if h == 'ace'\r\n total += 11\r\n elsif h.to_i == 0\r\n total += 10\r\n else\r\n total += h.to_i\r\n end\r\n end\r\n\r\n numbers_only_array.select {|k| k == \"ace\"}.count.times do\r\n total -= 10 if total > 21 \r\n end\r\n\r\n total\r\nend",
"def calculate_total\n total = 0\n cards.each {|a_card| total += a_card.value }\n #correct for Aces, if we have blown over 21\n cards.each do |a_card| \n if a_card.face == ACE \n total -= (ACE_VALUE - ACE_ALT_VALUE) if total > BLACKJACK\n end\n end\n total\n end",
"def attack\n min = 14\n min_c = nil\n self.non_trump_cards.each do |c|\n if c.int_val < min\n min_c = c\n min = c.int_val\n end\n end\n if min_c.nil?\n self.trump_cards.each do |c|\n if c.int_val < min\n min_c = c\n min = c.int_val\n end\n end\n end\n @cards.delete(min_c)\n min_c\n end",
"def remove_students(users)\n counter = 0\n\n users.each do |user|\n counter += remove_student(user)\n end\n\n return counter\n end",
"def card_total(hand)\n total = 0\n ace = hand.select {|x| x[0] == 'A'}\n # Calculation of hand without aces.\n if ace == []\n hand.each do |x|\n x = x[0..-2].to_i\n x == 0? total += 10 : total += x\n end\n total\n else\n # Calculation of hand with ace(s)\n # Delete aces from hand array\n ace.each do |a|\n hand.each {|x| hand.delete(a) if x == a}\n end\n # Calculate hand without aces\n hand.each do |x|\n x = x[0..-2].to_i\n x == 0? total += 10 : total += x\n end\n ace.each {|a| hand << a}\n # Add the value of ace(s) to the current total\n nr_ace = ace.length\n case nr_ace\n when 1\n total <= 10? total += 11 : total += 1\n when 2\n total <= 9? total += 12 : total += 2\n when 3\n total <= 8? total += 13 : total += 3\n else\n total <= 7? total += 14 : total += 4\n end\n total \n end\nend",
"def no_of_cards\r\n @card_list.no_of_cards\r\n end",
"def no_of_cards\r\n @card_list.no_of_cards\r\n end",
"def remove_card_from_deck (card)\n\t\t@deck -= [card]\n\tend",
"def no_of_cards\n @card_list.no_of_cards\n end",
"def no_of_cards\n @card_list.no_of_cards\n end",
"def no_of_cards\n @card_list.no_of_cards\n end",
"def discard_and_replace(number = 1)\n number = faceup.count if number > faceup.count\n gamefield.slice(0, number).each_with_index do |card, i|\n card.faceup_position = nil\n card.facedown_position = nil\n return false unless card.save\n end\n gamefield.each do |card|\n card.faceup_position = card.faceup_position - number\n return false unless card.save\n end\n deal number\n end",
"def deal_card\n @deck.remove(:front)\n end",
"def remaining_slots\n @count = 0\n self.booked_customers.each do |booked_customer|\n @count += booked_customer.number_students.to_i\n end\n return self.cap - @count\n\n end",
"def count_cut\n bottom_card = $deck.last\n bottom_card = 53 if ['A', 'B'].include? bottom_card # joker's value is 53\n $deck = [$deck.slice(bottom_card, $deck.length - bottom_card - 1), $deck.slice(0, bottom_card), $deck.last].flatten\nend",
"def flush_cards(cards)\n\t\thsh = {}\n\t\tcards.each {|c| hsh[c.suit] ||= []; hsh[c.suit] << c}\n\t\tret = []\n\t\thsh.each {|suit, suit_cards| ret = suit_cards if suit_cards.size > ret.size}\n\t\tret.sort_by {|x| x.sort_value}\n\tend",
"def total_card_combs(star_counter)\n c = 0\n star_counter.each { |num_of_stars| c += prmutation(5) * cmbnation(num_of_stars) if num_of_stars > 4 }\n return c\nend",
"def ownedCards\n \tcus_owned_by_user = cards_users.where(is_shared: false)\n\n \t# Have a list of CardsUsers, but want a list of Owned Cards\n \towned_cards = []\n \tcus_owned_by_user.each do | cu |\n \t\tcard = Card.find(cu.card_id)\n \t\towned_cards.push(card)\n \tend\n \towned_cards\n end",
"def deal()\n loop_size = Constant::CARD_COUNT / 6\n loop_size.times do\n @players.each do |player|\n break if @deck.cards.empty?\n player.hand += @deck.cards.pop(2)\n end\n end\n end",
"def reset_unused!\n @cards += @used\n @used = []\n end",
"def check_collection\n system('clear')\n title\n your_cards = self.reload.cards.sort\n if your_cards == []\n puts \"=====================================================================\"\n puts \"Your collection is empty\"\n puts \"=====================================================================\"\n else\n puts \"=====================================================================\"\n puts \"----- YOU HAVE #{your_cards.length} CARD(S) IN YOUR COLLECTION ------\"\n puts \"=====================================================================\"\n your_cards.each do |card|\n puts \"|NUMBER: #{card[\"id\"]} |NAME: #{card[\"name\"].upcase} |INTELLIGENCE: #{card[\"intelligence\"]} |STRENGTH: #{card[\"strength\"]} |SPEED: #{card[\"speed\"]} |DURABILITY: #{card[\"durability\"]} |POWER: #{card[\"power\"]} |COMBAT: #{card[\"combat\"]}\"\n end\n puts \"=====================================================================\"\n end\n end",
"def remove_accounts_below_disk_free_percentage\n return @remove_accounts_below_disk_free_percentage\n end",
"def deleteCard\n if !(Integer(params[:id]) rescue false)\n renderError(\"Not Acceptable (Invalid Params)\", 406, \"The parameter id is not an integer\")\n return -1\n end\n resultsGet = HTTParty.get(\"http://192.168.99.104:3003/credit_card?id=\"+params[:id])\n userA = (resultsGet[\"user_id\"])\n puts(userA)\n puts( @current_user[\"id\"])\n if userA != (@current_user[\"id\"])\n renderError(\"Forbidden\",403,\"current user has no access\")\n return -1\n else\n results = HTTParty.delete(\"http://192.168.99.104:3003/credit_cards?id=\"+params[:id])\n if results.code == 200\n head 200\n else\n render json: results.parsed_response, status: results.code\n end\n end\n end",
"def sums_up(cards) \n\tsum = 0\n new_arr = cards.map{|e| e[0]} # generate a new array contain the values returned by the block\n\n new_arr.each do |x| \n \tif x == 'Ace'\n \t\tsum += 11\n elsif x.to_i == 0\n \t# instead of \"x == 'Jack' || x == 'Queen' || x == 'King'\"\"\n \tsum += 10\n else \n \tsum += x.to_i\n end\n end\n\n # correct for Aces\n new_arr.select{|e| e == \"Ace\"}.count.times do # count how many \"ace\"s and do n times\n sum -= 10 if sum >21\n end\n\n\tsum\nend",
"def remove_assistants(users)\n counter = 0\n\n users.each do |user|\n counter += remove_assistant(user)\n end\n\n return counter\n end",
"def deal_cards\n if @deck.length != 0\n puts \"Dealt 3 more cards\"\n for i in 0...3\n r = rand(0...@deck.length)\n @cards_in_play.append(@deck[r])\n @deck.delete_at(r)\n end\n else\n puts \"There are no more cards in the deck!\"\n end\nend",
"def unique_collection_card\n !!!Collection.find_by(\n card_id: self.card_id,\n user_id: self.user_id,\n magic_set_id: self.magic_set_id,\n premium: self.premium,\n wishlist: self.wishlist,\n condition: self.condition\n )\n end",
"def affordable_cards\n answer = Array.new()\n (@game.all_displayed_cards + @player.tableau.reserved_cards).each do |card|\n @cost = @player.tableau.tokens_required(card)\n answer << card if !@cost==false\n end\n answer\n end",
"def calculate_totals(cards) \n card_values = cards.map{|card| card[1]}\n total_socre = 0\n card_values.each do |value|\n if value == \"Ace\"\n total_socre += 11\n elsif value.to_i == 0\n total_socre += 10\n else\n total_socre += value.to_i\n end\n end\n#correct for Aces\n card_values.select {|e| e == \"Ace\"}.count.times do\n total_socre -= 10 if total_socre > 21\n end\n total_socre\nend",
"def deal_card\r\n random = rand(@playable_cards.size)\r\n @playable_cards.delete_at(random)\r\n end",
"def test_deck_cards_uniq\n arr = @deck.cards.uniq\n assert_equal(52, arr.length, \"Num unique cards\")\n end",
"def remaining_candidates\n @candidate_deck - candidates\n end",
"def available_cards(correct_card_ids)\n # Exclude cards that have already been successfully answered\n self.cards.reject do |card|\n puts \"correct_card_ids = #{correct_card_ids}\"\n correct_card_ids.include?(card.id)\n end\n end",
"def count\n return cards.length \n end",
"def cards_has_required_count\n return if errors.messages.size.zero? &&\n cards.sum(&:amount) == DECK_REQUIRED_CARDS_COUNT\n\n errors.add(:cards, 'cards must add up to 30')\n end",
"def determine_players_best_total(current_player)\n # @player1_hand = ['ace of spades', '5 of spades', '4 of spades', 'ace of diamonds']\n # @player1_hand = ['3 of spades', 'ace of hearts', '4 of spades', 'ace of clubs']\n # @player1_hand = ['ace of clubs', '2 of clubs', 'ace of hearts', '4 of hearts']\n sum_of_players_hand = 0\n number_of_aces_in_hand = 0\n if current_player == 1 then\n @player1_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n\n sum_of_players_hand = sum_of_players_hand - 10\n\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 1\n\n if current_player == 2 then\n @player2_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 2\n\n if current_player == 3 then\n @player3_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 3\n\n if current_player == 4 then\n @player4_hand.each {|x| #begin loop adding players hand\n card_value = @deckhash.fetch(x)\n if card_value == 1 then #adjust aces to a value of 11\n card_value = 11\n number_of_aces_in_hand = number_of_aces_in_hand + 1\n end #end of ace adjustment\n sum_of_players_hand = sum_of_players_hand + card_value\n } #end of loop adding players hand\n if sum_of_players_hand > 21 then #must set one or more aces back to one\n loop do\n if number_of_aces_in_hand == 0 then break end\n sum_of_players_hand = sum_of_players_hand - 10\n# $stdout.write(\"sum of players hand #{sum_of_players_hand} :\")\n if sum_of_players_hand < 22 then break end\n number_of_aces_in_hand = number_of_aces_in_hand - 1\n end #end of loop do\n end #end of sum_of_players_hand > 21\n end #end if current player = 4\n # ### This method returns sum of player's best hand\n return sum_of_players_hand\n end",
"def no_of_cards\n @cards.length\n end",
"def remove_removed_user\n begin\n followers = get_followers\n followings = get_followings\n need_to_remove = followings - followers\n rescue\n error_log 'error in remove_removed_user'\n end\n\n log 'need to remove: '\n for id in need_to_remove do\n log \" #{id}\"\n end\n\n for id in need_to_remove do\n remove_user id\n end\n\n return followings.size - need_to_remove.size\n end",
"def cleanup\n if params[:pw] && params[:pw] == Server::Application.config.pw\n num = {killed: 0, finished: 0}\n Bet.all.each do |b|\n end_d = (b.created_at.to_date + b.duration).to_time\n expiration = (end_d - b.created_at) / 3 * 86400 #to get seconds\n current = Time.now - b.created_at\n # if the bet has gone more than a third of it's length without being accepted\n if b.status == \"pending\" && current > expiration\n push_notify_user(b.owner, \"Your bet has been deleted, due to time expiring without anyone accepting the bet.\")\n num[:killed] += 1\n b.destroy\n elsif b.status == \"accepted\" && Time.now > end_d\n if b.verb != 'Stop'\n finish_bet(b, false)\n else\n finish_bet b\n end\n num[:finished] += 1\n elsif Time.now > (end_d - (60*60*24+60)) && b.status != \"won\" && b.status != \"lost\"\n push_notify_user(b.owner, \"You are down to your last day. The bet will close at 11:59pm (Eastern Time) tonight!\")\n end\n end\n \n # check each User's card\n num[:deleted] = 0\n# User.all.each do |u|\n# begin\n# customer = Braintree::Customer.find(u.fb_id)\n# rescue\n# next\n# end\n# card = nil # card is the default credit card listed for a user\n# customer.credit_cards.each do |cc|\n# card = cc if cc.default?\n# end\n# # remove cards that have expired\n# if card.expiration_date.to_date < Date.today\n# num[:deleted] += 1\n# Braintree::CreditCard.delete(card.token)\n# end\n\n# # once every 90 days, verify that the card is legit\n# if (Date.today.to_time.to_i / (24*60*60)) % 90 == 0\n# Braintree::CreditCard.update(card.token, :options => {:verify_card => true })\n# end\n# end\n render json: \"cleaned #{num[:killed]} and fininshed #{num[:finished]} and deleted #{num[:deleted]}\"\n else\n render nothing: true\n end\n end",
"def user_counter \n RecipeCard.all.select{|cards|cards.recipe == self}.count \n end",
"def dealCards\n @players.times do |p|\n c=p + 1\n tmp = []\n puts \"#{$dm} Dealing #{c} of #{cardsDealt} Cards for player #{c} of #{players}\" if $debug\n while c <= cardsNeeded do\n puts \"#{$dm} INSIDE While #{c} up to #{cardsNeeded}\" if $debug\n #d=c-1 # This is ugly... :( Needed to start at array 0 beginning\n tmp.push(@deckOfCards[@deckA[c-1]])\n c += @players\n end\n @playersCards[(p+1)] = tmp\n end\n end",
"def deal_card\n random = rand(@playable_cards.size)\n @playable_cards.delete_at(random)\n end",
"def faceup\n cards.find_all {|card| !(card.facedown?) }.sort\n end",
"def discard_card(player)\n if player.player_hand.size == 0\n nil\n else\n rand_index = rand(5)\n rand_index += 1\n Keepem.new(Image.new(\"keepem.gif\"), rand_index)\n end\n end",
"def card_in_game\n (2..14).each {|r| (1..4).each { |i| @pack_of_card << [i, r] }}\n @cards = @pack_of_card.shuffle.take(7)\n # @hash_7_card is hash prepared for analyze combinations and the highest combination to win\n $hash_7_card = array_suit_rank\n end",
"def discard(card)\n discard_pile << card\n end",
"def deal_cards (num_cards, deck)\n dealt_cards = []\n num_cards.times {dealt_cards << deck.pop}\n dealt_cards\nend",
"def your_request\n $your_card = $playerMount.first\n $cpu_card = $cpuMount.first\n if $playerMount.first.forca < $cpuMount.first.forca\n $cpuMount.delete($cpuMount.first)\n $playerMount.delete($playerMount.first)\n $cpuMount.push($your_card)\n $cpuMount.push($cpu_card)\n else\n $playerMount.delete($playerMount.first)\n $cpuMount.delete($cpuMount.first)\n $playerMount.push($cpu_card)\n $playerMount.push($your_card)\n end\n end",
"def card_total(player_or_dealer_array)\n value_array = player_or_dealer_array.map { |v| v[1] }\n card_value_counter = 0\n \n value_array.each do |value|\n if value.is_a? Integer\n card_value_counter += value\n elsif value != 'Ace'\n card_value_counter += 10\n else\n card_value_counter += 11\n end\n end\n \n #decided total based on total number of aces. Will keep adjusting ace value to 1 until the toal is 21 or under\n value_array.select { |v| v == 'Ace'}.count.times do\n card_value_counter -= 10 if card_value_counter > 21\n end\n \n card_value_counter\nend",
"def deal_cards\n Print.heading('Dealing initial cards')\n deal_card_to_players\n dealer_card_to_dealer(false) #false to hide first dealer card\n deal_card_to_players\n dealer_card_to_dealer(true)\n end",
"def delete_assigned_members\n @card.members.each{|member| @card.remove_member member}\n end",
"def count_down\n top_card = $deck.first\n top_card = 53 if ['A', 'B'].include? top_card\n chosen_number = $deck[top_card]\n return '' if ['A', 'B'].include? chosen_number\n\n (chosen_number + (chosen_number > 26 ? 38 : 64)).chr\nend",
"def rule_3 *cards\n if cards.all?(&:face?)\n puts \"Upping the anti! #{cards.map(&:face?)}\"\n cards.raw_integer_value + 50\n end\n end",
"def calculate_total(cards)\n\tarr = cards.map { |e| e[1] }\n\n\ttotal = 0\n\tarr.each do |value|\n\t\tif value == 'A'\n\t\t\ttotal += 11\n\t\telsif value.to_i == 0 #only works for J, Q, K\n\t\t\ttotal += 10\n\t\telse\n\t\t\ttotal += value.to_i\n\t\tend\n\tend\n\t#Code to make Aces work\n\tarr.select{|e| e == \"A\"}.count.times do\n\t\ttotal -=10 if total > 21\n\tend\n\n\tif arr.include?(\"A\") && total > 21\n\t\ttotal -= 10\n\tend\n\n\ttotal\nend",
"def available_cards\n (@deck.size + board.size)\n end",
"def the_draw_card(deck_value, deck_card_name, cards, cards_value, random)\n cards = cards[random]\n deck_card_name.delete_at(random.to_i)\n return cards\n end"
] |
[
"0.63603973",
"0.628325",
"0.6102922",
"0.6093756",
"0.60720515",
"0.60661525",
"0.60602164",
"0.6051767",
"0.60204136",
"0.5976792",
"0.59513927",
"0.5942144",
"0.5912989",
"0.59125614",
"0.59082735",
"0.59044975",
"0.5869017",
"0.5859576",
"0.5817744",
"0.5808296",
"0.5801795",
"0.5715008",
"0.5708052",
"0.57078475",
"0.57070684",
"0.57062113",
"0.57045436",
"0.5703818",
"0.56683975",
"0.56667906",
"0.56623924",
"0.5641657",
"0.56402165",
"0.5630653",
"0.5626335",
"0.56217563",
"0.5614489",
"0.5606944",
"0.5603598",
"0.55967057",
"0.5582419",
"0.55464953",
"0.5546202",
"0.55378443",
"0.55344087",
"0.5523075",
"0.55193484",
"0.5516149",
"0.55098915",
"0.5500043",
"0.5500043",
"0.5496109",
"0.54930896",
"0.54930896",
"0.54930896",
"0.5491288",
"0.54858327",
"0.5476182",
"0.5468923",
"0.5459405",
"0.54539025",
"0.5448976",
"0.54371136",
"0.54216725",
"0.5420383",
"0.5418994",
"0.5417566",
"0.5413205",
"0.54008377",
"0.5399272",
"0.53880715",
"0.5378419",
"0.5369389",
"0.53686523",
"0.5368586",
"0.5368385",
"0.5356225",
"0.5349091",
"0.53485864",
"0.53444123",
"0.5335037",
"0.53330487",
"0.5329754",
"0.5329724",
"0.5318069",
"0.5317739",
"0.53113043",
"0.5299757",
"0.52989453",
"0.5289256",
"0.52865756",
"0.5284904",
"0.52795434",
"0.5270113",
"0.5268935",
"0.52674204",
"0.52657086",
"0.5251197",
"0.5249597",
"0.5248491"
] |
0.76203895
|
0
|
Sin definicion de autoridad por ser requerido por no autenticados
|
def atributos_index
[ :id,
:nusuario,
:nombre,
:email,
:grupo_ids,
:foto,
:habilitado,
]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def auth\n end",
"def auth\n end",
"def set_usuario\n \n end",
"def auth\n {}\n end",
"def force_authn?\n force_authn == true\n end",
"def verificar_autenticado_admin\n unless session[:usuario_admin] #else if,tiene quer ser falso\n bitacora \"Intento de accceso sin autenticacion a la zona del admin\"\n flash[:error]=\"Debe autenticarse como Administrador\"\n redirect_to :action => \"index\" , :controller => \"externo\"\n return false\n end\n end",
"def active_for_authentication?\n super && bloqueado == 0\n end",
"def capable_login_auth?; end",
"def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend",
"def auth?\n false\n end",
"def authorization; end",
"def active_for_authentication?; end",
"def active_for_authentication?; end",
"def authen_method_none!()\n @authen_method = TAC_PLUS_AUTHEN_METH_NONE\n end",
"def ha_accedido?\n\t\t!usuario_actual.nil?\n\tend",
"def authorize\n if current_user.nil? || current_user.tipo_usuario == \"Empleado\"\n redirect_to login_url, notice: \"No esta autorizado para ver esto. Por favor ingrese al sistema o reingrese como administrador.\"\n end\n end",
"def set?\n @auth_default || @auth.any?\n end",
"def require_no_authentication\n end",
"def require_login\n end",
"def authorization_mode; end",
"def fully_authed?\n !(user.nil? || password.nil?)\n end",
"def authen_method_notset!()\n @authen_method = TAC_PLUS_AUTHEN_METH_NOT_SET\n end",
"def auth?\n true\n end",
"def auth_param; end",
"def needs_login?() false end",
"def set?\n @auth.any?\n end",
"def usuario_actual\n \t#se guarda al usuario actual que esta loggeado por cuestion de eficiencia\n \t#para no accesar a la base de datos todo el tiempo\n \t@usuario_actual ||= Alumno.find(session[:alumno_id]) if session[:alumno_id]\n end",
"def skip_authorization; end",
"def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end",
"def authenticated?; super; end",
"def http_auth?; end",
"def auth(value); end",
"def show\n authorize! :ver, @usuario_prestamo\n end",
"def save\r\n SystemConfig.set :auth, to_h, true\r\n end",
"def revisa_conectado\n unless conectado?\n redirect_to root_path\n end\n end",
"def auth_store; end",
"def http_authenticatable?; end",
"def logado?\n !admin_atual.nil?\n end",
"def plivo_auth_id_required\n # bypass plivo auth creation for admin users \n if self.role == \"admin\"\n return false\n else\n plivo_auth_id.blank?\n end\n end",
"def needs_authorization?\n true\n end",
"def authenticate!\n # Do nothing yet\n end",
"def iniciarSesion (email,nombre,apellido,id)\n session[:email] = email\n session[:nombre] = nombre\n session[:apellido] = apellido\n session[:id] = id\n @persona = Persona.find(id)\n if !(@persona.empleados_id.nil?)\n session[:rol] = @persona.empleados_id\n else\n session[:rol] = nil\n end\n end",
"def current_user\n #carico l'user da sessione con auth esterna tramite omniauth\n @current_user ||= AuthHub::User.find_by(id: session['warden.user.user.key'][0][0]) unless session['warden.user.user.key'].blank?\n #se non ho fatto login esterna carico id salvato (usato in sign_in omniauth e anche login con email e psw devise)\n @current_user ||= AuthHub::User.find_by(id: session[:user_id], stato: 'confermato')\n #se ho uno user corrente carico in sessione l'ente corrente\n #se ha un ente principale carico quello, altrimenti l'ho fissato col cambia ente\n if !@current_user.blank? && session['ente_corrente'].blank?\n ente_principale ||= ( AuthHub::EnteGestito.ente_principale_da_user(@current_user.id)[0] unless AuthHub::EnteGestito.ente_principale_da_user(@current_user.id).blank? )\n #se non era stato inserito l'ente principale per lo user prendo il primo dell'array\n ente_principale ||= @current_user.enti_gestiti[0] unless @current_user.enti_gestiti.blank?\n session['ente_corrente'] = ente_principale #unless ente_principale.blank?\n end\n #se session['ente_corrente'] è un hash devo caricare l'istanza di ente_gestito\n if session['ente_corrente'].is_a?(Hash)\n begin\n session['ente_corrente'] = AuthHub::EnteGestito.find(session['ente_corrente']['id'])\n rescue ActiveRecord::RecordNotFound => exc\n #metto l'ente principale\n unless AuthHub::EnteGestito.ente_principale_da_user(@current_user.id).blank?\n session['ente_corrente'] = AuthHub::EnteGestito.ente_principale_da_user(@current_user.id)[0] \n else\n session['ente_corrente'] = nil\n end\n end \n end\n @current_user\n end",
"def es_propietario\n set_entrega\n if @entrega.recolector != current_user\n render json: {entrega: [\"No permitido para este usuario\"]}, status:401\n end\n end",
"def require_no_authentication\n if professor_signed_in? && current_professor.email.to_s == \"root@hanyang.ac.kr\"\n return true#redirect_to new_professor_session_path, notice: \"루트 만이 관리자 계정을 만들 수 있습니다.\"\n else\n return super\n end\n end",
"def authorize_for_none\n # Clear all authorizations and create an allow-all entry\n ContentAuthorization.transaction do\n update_privacy_level(ContentAuthorization::AuthInvisible)\n clear_accessors\n end\n end",
"def save\n id and ensure_authentication and super\n end",
"def actualizar\n if toca_actualizar\n actualizar_privado\n end\n end",
"def authentication_method\n super\n end",
"def authorization_object\n nil\n end",
"def authorization_object\n nil\n end",
"def autoset_owner\n bypass_auth do\n if accessor\n self.owner_id ||= accessor.id\n end\n end\n\n true # this is very important!\n end",
"def call\n ap \"Llamando a Authentica User\"\n JsonWebToken.encode(usuario_id: usuario.id) if usuario\n end",
"def password_required?\n super && authorizations.length == 0 && !auth_temp_token\n end",
"def user_authentication\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def unauthorized\n end",
"def set_user; end",
"def comprobar_usuario_login\n @usuario_actual=nil\n return unless session[:user_id]\n @usuario_actual = Usuario.find_by_id(session[:user_id])\n end",
"def show\n authorize @almoxarifado_entrada\n end",
"def restrict_access \n \t# Não sei o porque, mas é precisa instanciar esse objeto\n \tresponse = nil\n \t\n \t# Verifica se o TOKEN existe\n \t# TODO: Fazer uma validação do TOKEN quando for chamá-lo\n \t# ao invés de fazer isso aqui, pois economiza uma chamada\n \tif params[:token].nil?\n \t\t# bloqueia o acesso\n \t\thead :unauthorized # retirar no futuro quando melhorar a analise do token\n \telse\n \t\t# Faz a chamada pro API da Arich mediante parâmetros no CONFIG da aplicação Rails\n\t\tNet::HTTP.start(Rails.application.config.authentication_location, Rails.application.config.authentication_port) {|http|\n\t\t\t\tresponse = http.head(Rails.application.config.authentication_complement + params[:token])\n\t\t}\n\n\t\t# Analisa o retorno da chamada da API, se algo diferente de\n\t\t# 200 ele rejeita a autenticação\n\t\tif response.code != \"200\"\n\t\t\thead :unauthorized\n\t\tend \n\tend\n end",
"def set?\n @cred || @auth.any?\n end",
"def set_autho\n @autho = Autho.find(params[:id])\n end",
"def authenticate\n self.get && true\n end",
"def has_auth?\n !current_person.nil?\n end",
"def access_robot\n raise 'unauthorised' if current_user != @robot.user \n end",
"def solo_perfilados\n redirect_to root_path if current_user.perfilado !=true\n end",
"def set_paciente\n @paciente = Paciente.find params[:id]\n unless current_user.id == @paciente.user_id\n flash[:notice] = \"No tienes acceso a ese paciente.\"\n redirect_to home_path()\n return\n end\n end",
"def require_user\n end",
"def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end",
"def require_auth\n head :unauthorized unless current_user\n end",
"def verify_id!\n authenticate_user!\n unless (@empresa.user == current_user)\n redirect_to root_path, alert: \"No eres el propietario de esta empresa y no puedes editarla.\"\n end\n end",
"def authorized?\n true\n end",
"def logado?\n !current_user.nil?\n end",
"def before_save\n if self.access_token.blank?\n self.authenticated = Twitter::Client.new.authenticate?(self.username, self.password)\n end\n \n return true\n end",
"def authorized?\n !auth.nil?\n end",
"def auth_methods; end",
"def ensure_auth_token\n unless self.auth_token\n self.auth_token = User.generate_token\n end\n end",
"def authenticate_correct_user\n redirect_unauthorized unless current_user? @run.user_id\n end",
"def exibe_para_usuario?\n \t\tif usuario_signed_in?\n \t\t\tif current_usuario.admin?\n \t\t\t\treturn true\n \t\t\telse\n \t\t\t\treturn false\n \t\t\tend\n \t\telse\n \t\t\treturn false\n \t\tend\n \tend",
"def needs_one_authorization?\n self.encrypted_password.blank? && self.authorizations.count == 1\n end",
"def active_for_authentication?\n super && assigned?\n end",
"def correсt_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless (current_user?(@user) or is_admin?)\n\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def active_for_authentication? \n \tsuper && approved?\n \t\n\tend",
"def author_login\r\n user.login if user\r\n end",
"def authen_method_guest!()\n @authen_method = TAC_PLUS_AUTHEN_METH_GUEST\n end",
"def auth_process\n\t\tif @auth_file.authorization.nil?\n \t\t\tmake_auth\n\t\telse\n\t\t\t@client.authorization = @auth_file.authorization\n\t\tend\n\tend",
"def enforce_requested_account_authorized!\n clear_authorization! unless requested_account_authorized?\n end",
"def autor(nombre, opciones = {})\n autor = nombre\n autores << autor\n end",
"def autor(nombre, opciones = {})\n autor = nombre\n autores << autor\n end",
"def authenticate_once_state\n super\n end",
"def authen_method_none?()\n return true if (@authen_method == TAC_PLUS_AUTHEN_METH_NONE)\n return false\n end",
"def require_no_authentication\n # skip this!\n end",
"def authorize\n end",
"def authorize\n end",
"def activar\n # flash[:notice] = \"klkkkk\"\n \n session[:cliente_id] = \"desktop\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n session[:tipo_cliente] = \"123\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n\n @tipo_cliente = \"desktop\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n @cliente_id = \"123\" # SETEADO MANUAL ADMINISTRATIVAMENTE OK TED.\n session[:chekeado] = \"chekeado\"\n\n if (session[:terminal_autorizada] == false)\n sign_out(current_user) \n end\n session[:terminal_autorizada] = true\n #creado para complemento (convention over configuration) del controlador del view de acticion de equipos. ok ted.\n end",
"def authorization_mode=(mode); end",
"def apresentacao\n if @permissao === \"convidado\"\n puts \"o usuário selecionado possui a permissao de Convidado\"\n end\n if @permissao === \"autenticado\"\n puts \"o usuário selecionado possui a permissao de Autenticado\"\n end\n if @permissao === \"admin\"\n puts \"o usuário selecionado possui a permissao de Admin\"\n end\n end",
"def conf_universidad\n reset_session\n @valin = params['in']\n @alert = params['alert']\n valor = @valin.split(\"_\")\n cod = desencriptar(valor[0].to_i)\n id = desencriptar(valor[1].to_i)\n data = Usuario.find_by(cod_recovery: cod, id: id)\n if data.blank?\n redirect_to({:action=>\"index\", :controller=>\"perfil\"})\n else\n if data['validado'] == SIN_VALIDAR\n @nombre = data['nombre']\n session[:id] = id\n session[:email] = data['correo']\n render layout: \"login\"\n else\n redirect_to({:action => 'index', :controller=>\"login\"})\n end\n end\n end"
] |
[
"0.67458934",
"0.67458934",
"0.67062426",
"0.6643799",
"0.66048145",
"0.6585316",
"0.65173703",
"0.65037376",
"0.6490919",
"0.64673775",
"0.6428895",
"0.6423133",
"0.6423133",
"0.64113796",
"0.6404891",
"0.6384968",
"0.63591146",
"0.63507587",
"0.6345943",
"0.6340451",
"0.6334776",
"0.633296",
"0.6305411",
"0.6272313",
"0.6268321",
"0.6261795",
"0.6250604",
"0.6233366",
"0.6223002",
"0.62130916",
"0.6212143",
"0.6162883",
"0.616153",
"0.61592793",
"0.6154145",
"0.61484843",
"0.6143574",
"0.6138777",
"0.61299706",
"0.6119944",
"0.6118755",
"0.6111181",
"0.61100864",
"0.60993487",
"0.6089641",
"0.6086336",
"0.60770845",
"0.6075504",
"0.6066366",
"0.60503644",
"0.60503644",
"0.6050206",
"0.60489255",
"0.60381734",
"0.6027367",
"0.60224515",
"0.60224515",
"0.602034",
"0.6011279",
"0.60069156",
"0.6004514",
"0.60031706",
"0.59936196",
"0.5964679",
"0.59620094",
"0.5957033",
"0.595568",
"0.59548795",
"0.59532773",
"0.59530807",
"0.59484595",
"0.59466916",
"0.5941585",
"0.5934549",
"0.59218436",
"0.59203005",
"0.59157866",
"0.59132177",
"0.5911041",
"0.5907683",
"0.59053373",
"0.59041995",
"0.5900161",
"0.5897474",
"0.5883227",
"0.58734274",
"0.5872628",
"0.5870014",
"0.5864335",
"0.58624846",
"0.5861645",
"0.5861645",
"0.58554685",
"0.58545375",
"0.58482057",
"0.58477205",
"0.58477205",
"0.58459055",
"0.5841607",
"0.5841376",
"0.58359945"
] |
0.0
|
-1
|
Parse JSON object using version 1 formatting
|
def build_balances(balance_hashes, updated_at, config, user)
balances = []
balance_hashes.each do |balance|
balance = balance.to_h.compact.symbolize_keys
config = config.to_h.compact.symbolize_keys
next unless user == balance[:user]
balances << Balance.new(
user: balance.fetch(:user).to_s,
project: balance.fetch(:project, nil).to_s,
value: balance.fetch(:value).to_i,
project_type: config.fetch(:project_type, nil).to_s,
unit: config[:unit].to_s,
updated_at: Time.at(updated_at.to_i),
)
end
balances
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def reparsed_from_json\n self.is_a?(String) ? JSON.parse(self) : JSON.parse(self.to_json)\n end",
"def parse_json(json)\n ::JSON.parse(json, :create_additions => false)\n end",
"def parse json; return JSON.parse File.read json end",
"def parse json; return JSON.parse File.read json end",
"def json_parse(json)\n JSON.parse(json, symbolize_names: true)\n end",
"def parse_json(json_)\n from_json_object(::JSON.parse(json_))\n end",
"def parse\n (type, subtype) = parse_object([@name], JSON.parse(@json))\n (subtype || type).to_s.gsub(/\\n\\n$/, \"\\n\")\n end",
"def parse\n JSON.parse(raw)\n rescue RuntimeError\n raise \"cannot read from #{path}\"\n end",
"def parse_json str\n JSON.parse str rescue raise ConfigError, \"Invalid JSON\"\n end",
"def parse\n return if @id\n\n data = @json.is_a?(String) ? JSON.parse(@json) : @json\n @id = data[\"id\"]\n @time = data[\"created_at\"]\n @text = parse_text(data[\"text\"])\n end",
"def parseJsonString(jsonString) \n $jsonObjectMain = JSON.parse(jsonString);\n return $jsonObjectMain;\nend",
"def parse(json_str)\n Oj.load(json_str)\n end",
"def from_json\n JSON.parse(self)\n end",
"def parse_json content\n json = ActiveSupport::JSON.decode(content)\n\n # validation\n validate json.kind_of?(Array), \"JSON was not an array\"\n\n json.each do |item|\n validate item.kind_of?(Hash), \"JSON was not an array of objects\"\n validate (item.keys.to_set == json.first.keys.to_set),\n \"JSON objects did not have consistent keys\"\n end\n end",
"def json_parse (s)\n\n #defined?(ActiveSupport::JSON) ? ActiveSupport::JSON.decode(s) :\n #JSON.parse(s)\n OpenWFE::Json.decode( s )\nend",
"def from_json(source, opts = {})\n ::JSON.parse(source, opts_add_max_nesting(opts))\n end",
"def parse(json)\n JSON.parse(json) rescue nil\n end",
"def readable_json(json)\n\t\t JSON.parse(json) rescue nil\n\t\tend",
"def parsed_json\n @parsed_json ||= JSON.parse(@json)\n end",
"def _convertJSON() \n js=\"\"\n \tbegin\n gem \"json\"\n\t\t js = JSON.parse(self.response)\n rescue\n puts \"Error during JSON. #{$!}\"\n end\n\n return js\n\tend",
"def convert_json(json)\n\n return JSON.parse(json)\n\nend",
"def from_json(source)\n return if source.blank?\n\n case source\n when ::String\n from_hash Yajl::Parser.parse(source)\n when ::Hash\n from_hash source\n end\n end",
"def parse_json(body)\n JSON.parse(body, { symbolize_names: true })\n end",
"def json5_parse(data)\n # read with JSON5 to be more liberal about trailing commas.\n # But that doesn't have a 'symbolize_names' so rountrip through JSON\n JSON.parse(JSON5.parse(data).to_json, symbolize_names: true)\n end",
"def parse_json(stream)\n ::JSON.parse(stream)\n end",
"def parse_json(str)\n Yajl::Parser.parse(str)\n end",
"def parse response\n JSON.parse(response, symbolize_names: true)\n end",
"def parse(json_str)\n e = Pointer.new(:object)\n NSJSONSerialization.JSONObjectWithData(\n json_str.dataUsingEncoding(NSUTF8StringEncoding),\n options: 0,\n error: e)\n end",
"def json\n data = yield\n raise_error = false\n\n begin\n JSON.parse(data)\n rescue JSON::JSONError\n # We retried already, raise the issue and be done\n raise VagrantPlugins::Parallels::Errors::JSONParseError, data: data if raise_error\n\n # Remove garbage before/after json string[GH-204]\n data = data[/({.*}|\\[.*\\])/m]\n\n # Remove all control characters unsupported by JSON [GH-219]\n data.tr!(\"\\u0000-\\u001f\", '')\n\n raise_error = true\n retry\n end\n end",
"def pjson(str)\n Oj.load(str)\nend",
"def validate_format\n data = JSON.decode(data) if data.class == Hash\n JSON.parse(data) && nil if data.present?\n rescue JSON::ParserError\n nil\n end",
"def parse(value)\n data = ::JSON.parse(value)\n Result.success(data)\n rescue ::JSON::ParserError, TypeError\n Result.error.code!(:invalid_json)\n end",
"def json_to_object(json)\n JSON(json)\nend",
"def parse_json (json)\n begin\n return json if json.class == Hash\n return json if json.class == Array\n return JSON.parse(json)\n rescue Exception => e\n # Assuming it would be string.\n # Boolean type\n return true if json =~ (/^(true)$/i)\n return false if json =~ (/^(false)$/i)\n # Fixnum type\n return json.to_i if (json.to_i.to_s == json)\n # Float type\n return json.to_f if (json.to_f.to_s == json)\n return json\n end\n end",
"def from_json(source, opts = {})\n obj = parse(source, opts)\n\n # JSON gem requires top level object to be a Hash or Array (otherwise\n # you get the \"must contain two octets\" error). Yajl doesn't impose the\n # same limitation. For compatibility, we re-impose this condition.\n unless obj.kind_of?(Hash) || obj.kind_of?(Array)\n raise JSON::ParseError, \"Top level JSON object must be a Hash or Array. (actual: #{obj.class})\"\n end\n\n # The old default in the json gem (which we are mimicing because we\n # sadly rely on this misfeature) is to \"create additions\" i.e., convert\n # JSON objects into ruby objects. Explicit :create_additions => false\n # is required to turn it off.\n if opts[:create_additions].nil? || opts[:create_additions]\n map_to_rb_obj(obj)\n else\n obj\n end\n end",
"def from_json\n return nil unless okay?\n\n require \"json\"\n\n JSON.parse(body)\n end",
"def json_parse(str)\n results = JSON.parse(str)\n case results\n when Hash\n results.extend Sym_Keys_For_Hash\n results.symbolize_keys\n when Array\n results.symbolize_hash_keys\n else\n results\n end\nend",
"def json_to_obj json_str\n hash_to_obj(parse_json(json_str))\n end",
"def validate_format\n JSON.parse(content) && nil if content\n rescue JSON::ParserError => err\n err.message\n end",
"def validate_format\n JSON.parse(content) && nil if content\n rescue JSON::ParserError => err\n err.message\n end",
"def parse_json(json_)\n ::NTable.parse_json(json_)\n end",
"def new_from_json_string(json_string)\n hash = JSON.parse(json_string)\n new_from_response_data(hash.first[1])\n end",
"def json_for_version(version)\n JSON.parse(json_pathname(version).read)['content']\n end",
"def json_parse(body)\n json = JSON.parse body\n convert_to_obj(json[\"response\"][\"result\"])\n end",
"def from_json(json)\n deserialize JSON.parse(json)\n end",
"def json_from_text(name)\n JSON.parse(read_text(name))\nend",
"def convert(json)\n # The data may be an array of metadata, in the case of the `yesterday`\n # or `today` APIs, or an object where the values are the metadata.\n json = json.values unless json.is_a? Array\n\n # Remove weird junk that is not metadata\n json.select { |package| package.is_a? Hash }\n end",
"def parse\n reset\n obj = nil\n while !eos? && skip(IGNORE) do end\n if eos?\n raise ParserError, \"source is not valid JSON!\"\n else\n obj = parse_value\n UNPARSED.equal?(obj) and raise ParserError,\n \"source is not valid JSON!\"\n obj.freeze if @freeze\n end\n while !eos? && skip(IGNORE) do end\n eos? or raise ParserError, \"source is not valid JSON!\"\n obj\n end",
"def get_json(result)\n #result.split(\"\\n\").select {|str| str.match(/^{version/) }.first\n result.split(\"\\n\").last\n end",
"def parse_json(message)\n\t\t# Check JSON message format\n\t\tbegin\n\t\t\tparsed_message = JSON.parse(message) # parse json message\n\t\trescue JSON::ParserError => e\n\t\t\t# If JSON not valid, return with errors\n\t\t\tlogger.error \"JSON parsing: #{e.to_s}\"\n\t\t\treturn message, e.to_s + \"\\n\"\n\t\tend\n\n\t\treturn parsed_message, nil\n\tend",
"def _parse_json(s)\n begin\n Sequel.parse_json(s)\n rescue Sequel.json_parser_error_class => e\n raise Sequel.convert_exception_class(e, Sequel::InvalidValue)\n end\n end",
"def parse_json(message)\n begin\n parsed_message = ::JSON.parse(message) # parse json message\n rescue => e\n puts 'Error'\n puts e\n rescue JSON::ParserError => e\n return message, e.to_s + \"\\n\"\n end\n [parsed_message, nil]\n end",
"def parse_json (json)\n begin\n return JSON.parse(json)\n rescue Exception => e\n # Assuming it would be string.\n # Boolean type\n return true if json =~ (/^(true)$/i)\n return false if json =~ (/^(false)$/i)\n # Fixnum type\n return json.to_i if (json.to_i.to_s == json)\n # Float type\n return json.to_f if (json.to_f.to_s == json)\n return json\n end\n end",
"def parseJSON(data)\n return JSON.parse data.body.read\nend",
"def from_json(source, opts = {})\n obj = ::Yajl::Parser.parse(source)\n # JSON gem requires top level object to be a Hash or Array (otherwise\n # you get the \"must contain two octets\" error). Yajl doesn't impose the\n # same limitation. For compatibility, we re-impose this condition.\n unless obj.kind_of?(Hash) or obj.kind_of?(Array)\n raise JSON::ParserError, \"Top level JSON object must be a Hash or Array. (actual: #{obj.class})\"\n end\n\n # The old default in the json gem (which we are mimicing because we\n # sadly rely on this misfeature) is to \"create additions\" i.e., convert\n # JSON objects into ruby objects. Explicit :create_additions => false\n # is required to turn it off.\n if opts[:create_additions].nil? || opts[:create_additions]\n map_to_rb_obj(obj)\n else\n obj\n end\n end",
"def from_json(serialized_data)\n Yajl::Parser.parse(serialized_data, :symbolize_keys => true)\n end",
"def from_json(source, opts = {})\n obj = ::Yajl::Parser.parse(source)\n\n # JSON gem requires top level object to be a Hash or Array (otherwise\n # you get the \"must contain two octets\" error). Yajl doesn't impose the\n # same limitation. For compatibility, we re-impose this condition.\n unless obj.kind_of?(Hash) or obj.kind_of?(Array)\n raise JSON::ParserError, \"Top level JSON object must be a Hash or Array. (actual: #{obj.class})\"\n end\n\n # The old default in the json gem (which we are mimicing because we\n # sadly rely on this misfeature) is to \"create additions\" i.e., convert\n # JSON objects into ruby objects. Explicit :create_additions => false\n # is required to turn it off.\n if opts[:create_additions].nil? || opts[:create_additions]\n map_to_rb_obj(obj)\n else\n obj\n end\n end",
"def from_json(json)\n new JSON.parse(json)\n end",
"def parse_json(message)\n # Check JSON message format\n begin\n parsed_message = JSON.parse(message) # parse json message\n rescue JSON::ParserError => e\n # If JSON not valid, return with errors\n logger.error \"JSON parsing: #{e.to_s}\"\n return message, e.to_s + \"\\n\"\n end\n return parsed_message, nil\n end",
"def parse_fetched_json(json_from_url)\n JSON.parse(json_from_url)\n end",
"def parseFromJSON(json_pattern)\n @sequence = Rho::JSON.parse(json_pattern)\n @sequence\n end",
"def parse_json(json)\n return nil if json.nil?\n h = JSON.parse(json)\n data = h['results']['bindings']\n {\n :headings => h['head']['vars'], \n :rows => data.map {|i| i.to_a.map {|x| x[1]['value']}}\n }\nend",
"def parse_response(response)\n # @todo Parse the response based on the @format (\"txt\", \"json\" or \"xml\")\n JSON.parse(response)\n end",
"def parse_response(response)\n # @todo Parse the response based on the @format (\"txt\", \"json\" or \"xml\")\n JSON.parse(response)\n end",
"def parse_json(message)\n # Check JSON message format\n begin\n parsed_message = JSON.parse(message) # parse json message\n rescue JSON::ParserError => e\n # If JSON not valid, return with errors\n # logger.error \"JSON parsing: #{e}\"\n return message, e.to_s + \"\\n\"\n end\n\n return parsed_message, nil\nend",
"def json\n @obj.get_json_regex\n end",
"def json(body)\n JSON.parse(body, symbolize_name: true)\n end",
"def parse_data data\n JSON.parse(data.body)\n end",
"def json_parse(string)\n json_string_to_hash(string)\n # if string.class == String && string == \"null\"\n # nil\n # else\n # JSON.parse(string, {:symbolize_names => true})\n # end\nend",
"def parse_json(message)\n # Check JSON message format\n begin\n parsed_message = JSON.parse(message) # parse json message\n rescue JSON::ParserError => e\n # If JSON not valid, return with errors\n logger.error \"JSON parsing: #{e}\"\n return message, e.to_s + \"\\n\"\n end\n [parsed_message, nil]\n end",
"def parse_json(json)\n case json[\"type\"]\n when \"track\"\n {\n title: json[\"name\"],\n artist: json[\"artists\"].map { |i| i[\"name\"] }.join(\", \"),\n album: json[\"album\"][\"name\"],\n thumbnail: json[\"album\"][\"images\"].sort_by { |i| i[\"height\"] }.last[\"url\"],\n length: json[\"duration_ms\"].to_i / 1000.0,\n preview_url: json[\"preview_url\"],\n }\n when \"album\"\n {\n\n }\n end\nend",
"def parse_json(message)\n # Check JSON message format\n begin\n parsed_message = JSON.parse(message) # parse json message\n rescue JSON::ParserError => e\n # If JSON not valid, return with errors\n logger.error \"JSON parsing: #{e}\"\n return message, e.to_s + \"\\n\"\n end\n\n [parsed_message, nil]\n end",
"def convert_json_trace_to_object(trace)\n JSON.parse(trace[1...-1].insert(0, '{'), object_class: OpenStruct)\n end",
"def to_h\n JSON.parse(@body)\n rescue Exception => e\n log.error Howitzer::ParseError, e.message\n end",
"def json(body)\n JSON.parse(body, symbolize_names: true)\n end",
"def json(body)\n JSON.parse(body, symbolize_names: true)\n end",
"def fix_malformed_json(malformed_json)\n return malformed_json.gsub(/([a-z][a-zA-Z0-9_]+):(?!\\s)/, '\"\\1\":')\n end",
"def to_json(json)\n begin\n JSON.parse(json)\n rescue\n json\n end\n end",
"def from_json string\n _assign_attributes JSON.parse(string)\n end",
"def load(json)\n require 'json'\n from_json(JSON.parse(json))\n end",
"def parse_response(response)\n JSON.parse response if response && !response.blank\n end",
"def parse(body)\n MultiJson.load(body, symbolize_keys: true)\n rescue MultiJson::ParseError\n body\n end",
"def parse_message(message)\n begin\n JSON.parse(message)\n rescue => e\n raise \"Failed trying to parse response: #{e}\"\n end\n end",
"def parse_payload(json)\n JSON.parse(json)\n end",
"def parse_string_to_json(response)\n JSON.parse(response)\n rescue JSON::ParserError\n response\n end",
"def json( *args )\n ::Logging::Layouts::Parseable.json(*args)\n end",
"def formatJSON\n # @formattedContents = .... whatever puts it into JSON\n end",
"def jmaki_parse_json(input, filename)\n eval(input.gsub(/([\"'])\\s*:\\s*(['\"-?0-9tfn\\[{])/){\"#{$1}=>#{$2}\"}, binding, filename)\n rescue\n return nil\n end",
"def parse_rendered(rendered)\n JSON.parse(rendered)\n end",
"def dirty_json_decode(json_string)\n json_string.gsub!(/^(\\s*\\{)/, \"\")\n if $1\n json_string.gsub!(/\\s*\\}\\s*$/, \"\")\n end\n json_string.split(',').inject({}) do |memo, kv|\n (k,v) = kv.split(\":\", 2)\n v.strip!\n memo[k.strip] = case v\n when /^['\"](.*?)['\"]$/: $1\n when \"true\": true\n when \"false\": false\n else\n v\n end\n memo\n end\nend",
"def json_parse(json, opts = {})\n ret = {}\n if json.empty?\n return ret\n end\n begin\n ::JSON.parse(json)\n rescue ::JSON::ParserError => e\n return ErrorUsage::Parsing.new(\"JSON parsing error #{e} in file\", opts[:file_path], Opts.new(log_error: false)) if opts[:do_not_raise]\n raise ErrorUsage::Parsing.new(\"JSON parsing error #{e} in file\", opts[:file_path])\n end\n end",
"def from_json(data)\n hash = Oj.load(data, symbol_keys: true)\n from_h(hash, :from_json)\n end",
"def from_json(data, _ = {} , spec: nil)\n data = JSON.parse(data) if data.is_a?(String)\n if spec\n Data.import(self.class.json_spec_path, spec, self, data)\n elsif defined?(super)\n super\n end\n end",
"def parse_json(json_file)\r\n\t\t\tjfile = File.read(json_file)\r\n\t\t\treturn JSON.parse(jfile)\r\n\t\tend",
"def valid_json(json)\n JSON(json)\n #NOTE: Rescuing TypeError too in case json is not a String\n rescue ::JSON::ParserError, TypeError\n nil\n end",
"def prepare_response(response)\n JSON.parse(response)\n end",
"def json\n JSON.parse @body\n end",
"def pbParseJson(str)\n if !pbIsJsonString(str)\n return nil\n end\n stringRE=/(\\\"(\\\\[\\\"\\'\\\\rntbf]|\\\\u[0-9A-Fa-f]{4,4}|[^\\\\\\\"])*\\\")/ #\"\n strings=[]\n str=str.gsub(stringRE){\n sl=strings.length\n ss=$1\n if ss.include?(\"\\\\u\")\n ss.gsub!(/\\\\u([0-9A-Fa-f]{4,4})/){\n codepoint=$1.to_i(16)\n if codepoint<=0x7F\n next sprintf(\"\\\\x%02X\",codepoint)\n elsif codepoint<=0x7FF\n next sprintf(\"%s%s\",\n (0xC0|((codepoint>>6)&0x1F)).chr,\n (0x80|(codepoint &0x3F)).chr)\n else\n next sprintf(\"%s%s%s\",\n (0xE0|((codepoint>>12)&0x0F)).chr,\n (0x80|((codepoint>>6)&0x3F)).chr,\n (0x80|(codepoint &0x3F)).chr)\n end\n }\n end\n strings.push(eval(ss))\n next sprintf(\"strings[%d]\",sl)\n }\n str=str.gsub(/\\:/,\"=>\")\n str=str.gsub(/null/,\"nil\")\n return eval(\"(\"+str+\")\")\nend",
"def decode_json(json_str)\n convert_dates_from(JSON.parse(json_str, symbolize_names: true))\n end",
"def validate_as_json(response)\n JSON.parse(response)\n rescue JSON::NestingError\n raise Client::Error::InvalidResponseContent, 'Too deep response'\n rescue JSON::ParserError\n raise Client::Error::InvalidResponseContent, 'Unexpected response'\n rescue JSON::MissingUnicodeSupport\n raise Client::Error::InvalidResponseContent, 'Invalid character in response'\n rescue JSON::UnparserError\n raise Client::Error::InvalidResponseContent, 'Unable to parse response'\n rescue JSON::JSONError\n raise Client::Error::InvalidResponseContent, 'Invalid response'\n end",
"def serialize_in(json_string, options = {})\n super(ActiveSupport::JSON.decode(json_string), options)\n end"
] |
[
"0.6935208",
"0.6877814",
"0.6757478",
"0.6757478",
"0.6548818",
"0.6495447",
"0.6486765",
"0.6416369",
"0.6413831",
"0.6337644",
"0.63295853",
"0.62641597",
"0.6240166",
"0.62400115",
"0.6239351",
"0.62240165",
"0.62106436",
"0.62076354",
"0.6179142",
"0.6171906",
"0.6166485",
"0.61432",
"0.6141489",
"0.61367947",
"0.612272",
"0.611454",
"0.61052454",
"0.6091251",
"0.6090312",
"0.6079998",
"0.6079849",
"0.6051682",
"0.6040463",
"0.6021235",
"0.6014239",
"0.6009116",
"0.6006273",
"0.59920764",
"0.5959796",
"0.5959796",
"0.59417963",
"0.5881833",
"0.58705664",
"0.5863278",
"0.5856144",
"0.5846638",
"0.5846388",
"0.58354104",
"0.5805069",
"0.580044",
"0.58001316",
"0.57913625",
"0.5789502",
"0.5786673",
"0.5786551",
"0.5771265",
"0.57696694",
"0.5768432",
"0.5768304",
"0.5767869",
"0.5764254",
"0.57551545",
"0.5753653",
"0.5753653",
"0.5753361",
"0.5752553",
"0.57391757",
"0.5730803",
"0.57157385",
"0.57108593",
"0.5703613",
"0.56954014",
"0.5693083",
"0.5688797",
"0.5684203",
"0.5684203",
"0.56743145",
"0.5661808",
"0.5661512",
"0.566114",
"0.56583434",
"0.5652171",
"0.56386685",
"0.5626117",
"0.56255555",
"0.56085926",
"0.55769295",
"0.5574053",
"0.5572207",
"0.55659974",
"0.55595684",
"0.5557045",
"0.55547565",
"0.5550048",
"0.554742",
"0.5546134",
"0.5512767",
"0.55096924",
"0.55030733",
"0.54954827",
"0.54914415"
] |
0.0
|
-1
|
Unit + balance text
|
def units_balance
return "#{@unit} balance" if @unit.present?
'Balance'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def balance_inquiry\n \"$#{'%.2f' % @balance}\"\n end",
"def acc_balance\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.to_f\n end",
"def display_balance\n \"Your balance is $#{self.balance}.\"\n end",
"def print_balance\n # $50.00\n # \"$\" + balance.to_s + \".00\"\n \"$#{balance}.00\"\n end",
"def display_balance\n \"Your balance is $#{balance}.\" \n end",
"def bank_bloc(num)\n return \"Total of $\" + num.to_s\nend",
"def display_balance\n \"Your balance is $#{@balance}.\"\n end",
"def prt_balance\n b = self.balance\n return \"#{'-' if b.cents<0}#{b.currency.symbol}#{b.abs.to_s}\"\n end",
"def display_balance\n \"Your balance is $#{@balance}.\"\n end",
"def get_account_balance\n has_account_balance_txt? ? account_balance_txt.text.gsub('– $', '') : ''\n end",
"def get_prix_unitaire_unit\n return \"\" if self.unit.blank?\n return \"€/\" + self.unit\n end",
"def display_amount\n self.symbol + self.to_s\n end",
"def unitprice_label(unitprice)\n \"#{sprintf(\"%g\", unitprice.unit)} #{unitprice.product.unitdesc} - #{to_users_currency(unitprice.currency, unitprice.price)} #{current_user.currency}\"\n end",
"def mark_up_amt\n rounder5(self.vehicle.price * 0.082)\n end",
"def unit_s\n self.unit.to_s if self.unit\n end",
"def pending_balance_display\n number_to_currency(pending_balance)\n end",
"def acc_currency\n @page.css(\"span[data-semantic = 'header-available-balance-amount']\").text.to_money.currency.to_s\n end",
"def account_name_balance\n name + ' (' + current_balance_display + ')'\n end",
"def current_balance_display\n number_to_currency(current_balance)\n end",
"def statement\n if @amount.positive?\n \"#{@amount.round(2).to_f}\\t\\t\\t\\t\\t\\tCredited in Bank \"\n else\n \"\\t\\t\\t#{-@amount.round(2).to_f}\\t\\t\\tDebited From Bank\"\n end\n end",
"def show_current_balance\n return \"Balance: $#{sprintf \"%.2f\", @balance}\"\n end",
"def pretty_balance\n puts \"You have $#{balance} in the bank\"\n end",
"def to_s\n if currency.decimal_places == 0\n return \"-#{@unit}\" if exact_number.to_f < 0\n return @unit\n end\n subunit = ((\"0\" * currency.decimal_places) + @subunit.to_i.to_s)[(-1*currency.decimal_places)..-1]\n\n return \"-#{@unit}#{decimal_mark}#{subunit}\" if exact_number.to_f < 0\n \"#{@unit}#{decimal_mark}#{subunit}\"\n end",
"def unit_t\n I18n.t \"#{self.unit_s}\", :count => 1\n end",
"def to_s\n \"Name: #{name}, Balance: #{sprintf(\"%0.2f\", balance)}\"\n end",
"def display_balance\nputs = \"Your balance is $#{self.balance}.\"\nend",
"def non_pending_balance_display\n number_to_currency(non_pending_balance)\n end",
"def to_s\n\t\t\"Name: #{name}, Balance: #{sprintf(\"%0.2f\", balance)}\"\n\tend",
"def balance_display(balance)\n puts \"Your current balance is $#{@balance}.\"\n end",
"def money; end",
"def current_balance\n \"EUR. #{sprintf('%.2f', bankaccount.reload.balance)}\"\n end",
"def money\n end",
"def to_s\n unit, subunit = cents.abs.divmod(currency.subunit_to_unit).map{|o| o.to_s}\n if currency.decimal_places == 0\n return \"-#{unit}\" if cents < 0\n return unit\n end\n subunit = ((\"0\" * currency.decimal_places) + subunit)[(-1*currency.decimal_places)..-1]\n return \"-#{unit}#{decimal_mark}#{subunit}\" if cents < 0\n \"#{unit}#{decimal_mark}#{subunit}\"\n end",
"def amount_spent\n \"You have used <strong>#{number_to_currency(money_used)}</strong> out of <strong>#{number_to_currency(incomes)}</strong>\".html_safe\n end",
"def amount; end",
"def inspect\n \"#{\"%0.02f\" % @amount} #{@base_currency}\"\n end",
"def unit_formats(type)\n #find statements\n #if sales[0]< 1000 and tot assets[0] < 1000\n #$xxx,xxx.x\n #else\n #$xxx,xxx\n #end\n end",
"def number_with_current_balance\n\t\t\"#{number} -- (#{current_balance.to_currency()})\"\n\tend",
"def format_balance\n format(\"%.2f\", balance.to_f)\n end",
"def to_s\n\t\t puts \"Bank Account:\\t#{name}\\n\"\n\t\t puts \"Your current balance is:\\t#{sprintf(\"%0.2f\", balance)} USD\" \n\tend",
"def formatted_balance\n format_monetary_value(balance)\n end",
"def dollar amt\n #TOOD: need commas in the right places\n sprintf \"$%0.02f\", amt\nend",
"def monetize\n (object.unit_price * 0.01).to_s\n end",
"def show_total_cash\n \"Total: #{total_cash}\"\n end",
"def currency_unit\n @currency_unit\n end",
"def subamount unit_price , quantity\n unit_price.to_f * quantity.to_i\n end",
"def amount\n case mode\n when 'set', 'fixed' then money\n when 'percentage' then percentage\n end\n end",
"def amt\n amount.gsub(/,|\\)'/, '')\n end",
"def discount_display\n if unit == :percent\n \"-#{discount.to_i}%\"\n else\n \"-#{discount.in_euro.to_yuan.display}\"\n end\n end",
"def parse_amount_owed text_amount\n (parse_amount_cents text_amount).abs\n end",
"def price_per_unit\n\t\t\"$ #{(self.sale_amount/self.units_sold).round(2)}\"\n\tend",
"def show_decimal_budget()\n return Money.convert_to_decimal_string(@budget)\n end",
"def usage\n \"#{balance_details 2}GB of #{balance_details 3}GB remaining\"\n end",
"def to_s\n \"#{@qty.to_s} #{@description}: #{(\"%.02f\" % @total).to_s}#{Constants::CR_LF}\"\n end",
"def total_volume(with_unit)\n if with_unit\n (quantity * volume.to_d).to_s + unit\n else\n quantity * volume.to_d\n end\n end",
"def credit_description(amount)\n \"Credited Transaction where platform credit covers $#{(amount/100)} of the original $#{total} for transaction ID: #{id} -- #{user.email} just bought a #{item_bought.title} for $#{total}, from #{merchant.title}\"\n end",
"def total\n format_money(@total)\n end",
"def total_text\n 'Total: %d' % total\n end",
"def get_settlement(settlement_amount, user_name)\n\t\tsettlement_amount = settlement_amount.round(2)\n\t\t#settlement_amount = \"%0.2f\" % settlement_amount\n\t\tsettle_text = \"Some error in function....\"\n\t\tif settlement_amount > 0\n\t\t\tsettle_text = \"You need to pay <b>$\" + settlement_amount.to_s + \"</b> to \" + user_name + \".\"\n\t\telsif settlement_amount < 0\n\t\t\tsettlement_amount *= -1\n\t\t\tsettle_text = \"You need to collect <b>$\" + settlement_amount.to_s + \"</b> from \" + user_name + \".\"\n\t\telse\n\t\t\tsettle_text = \"You are <b>even</b> with \" + user_name + \".\"\n\t\t\t\n\t\tend\n\t\treturn settle_text\n\tend",
"def total_tuition_cost\n tuition_cost = courses.inject(0) {|sum, c| sum + c.cost}\n tuition_cost = sprintf( \"%0.02f\", tuition_cost).to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse\n puts \"\\nTotal tuition paid: $#{tuition_cost}\n \\n\"\n\n # puts tp self.courses,:subject,:cost\n tp self.courses,:subject, {\"Course Coste\" => {:display_method => lambda{|x| \"$\" + \"#{sprintf( \"%0.02f\", x.cost).to_s.reverse.gsub(/(\\d{3})(?=\\d)/, '\\\\1,').reverse}\"}}}\n\n end",
"def order_total_amount_label\n\t\t$tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-ordttlamtlbl\")), __method__)\n\tend",
"def display_balance()\n puts \"Balance:$#{@balance}.\"\n returned\n end",
"def balance_btc_ui\n balance_btc.to_f * 10 ** -8\n end",
"def to_ps_money\n return nil if self.nil?\n return \"00\" if self.to_f == 0\n \n value = self.to_s\n\n # obtem a parte fracionaria e transforma em string.\n frac = value.to_f - value.to_i\n frac = frac.to_s + \"0\" \n frac = frac[2..3]\n # Se tiver parte inteira, concatena com a parte fracionaria\n inteiro = \"\"\n inteiro = value.to_i.to_s if value.to_f.truncate > 0\n inteiro + frac\n end",
"def gratuity_amount_formatted\n format_amount(gratuity_amount)\n end",
"def effective_total\n total = effective_total_money\n \"#{total.currency} #{total.format}\"\n end",
"def base_unit\n units[0]\n end",
"def amount_for_display(amt, opts={})\n if amt.abs < CUTOFF_FOR_BTC and not amt.zero?\n satoshi = amt * BigDecimal.new(\"100000000\")\n if opts[:no_html]\n \"#{satoshi.truncate} Satoshi\"\n else\n \"#{satoshi.truncate} \" +\n link_to(\"Satoshi\",\n \"https://en.bitcoin.it/wiki/Satoshi\",\n :target => '_blank')\n end\n else\n \"#{amt.to_s('F')} BTC\"\n end\n end",
"def price_string\n\n money = self.price || 0\n copper = money % 100\n amount = (money - copper) / 100\n silver = amount % 100\n gold = (amount - silver) / 100\n\n parts = []\n parts << \"#{number_with_delimiter(gold.to_i)}g\" if gold > 0\n parts << \"#{silver.to_i}s\" if silver > 0\n parts << \"#{copper.to_i}c\" if copper > 0\n\n parts.join(' ')\n \n end",
"def pretty_unit\n return if unitless?\n\n numerator = Inspection.prettify_unit_part(numerators)\n denominator = Inspection.prettify_unit_part(denominators)\n\n numerator = '1' if numerator.empty?\n return \" #{numerator}\" if denominator.empty?\n\n UNIT_FORMAT % [numerator, denominator]\n end",
"def unit_amount_inc_tax\n unit_amount + unit_tax\n end",
"def bank_account_tax_due( account_type, account_amount )\nif account_type == \"normal\"\n return account_amount * 0.10\nelse\n return 0\nend\nend",
"def inspect\n \"#{'%.2f' % self.amount} #{self.currency}\"\n end",
"def currency; end",
"def currency; end",
"def print_register\n puts \"#{name}'s' Bank Account\"\n puts \"/\" * 40\n\n puts \"Description\".ljust(30) + \"Amount\".rjust(10)\n puts \"/\" * 40\n @transactions.each do |transaction|\n puts transaction[:description].ljust(30) + sprintf(\"%0.2f\", transaction[:amount]).rjust(10)\n end\n\n puts \"-\" * 40\n\n puts \"Ending Balance:\".ljust(30) + sprintf(\"%0.2f\", balance).rjust(10)\n puts \"-\" * 40\n end",
"def dealer_markup\n (origin_price*0.08).round\n end",
"def subtotal_amount_label\n\t $tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-subttlamtlbl\")), __method__)\n\tend",
"def value\n if eng_unit_type\n \"#{data} #{eng_unit_type.tag}\"\n else\n data.to_s\n end\n end",
"def total_amount\n unit_amount * quantity\n end",
"def toString\n sprintf('%6.2f', @value) + \" \" + @unit\n end",
"def total_debt\n self.amount\n end",
"def draw_currency_value(value, unit, x, y, width, enable = true)\n cx = text_size(unit).width\n change_color(normal_color, enable)\n draw_text(x, y, width - cx - 2, line_height, value, 2)\n change_color(system_color)\n draw_text(x, y, width, line_height, unit, 2)\n end",
"def format\n \"#{amount} #{currency}\"\n end",
"def money\n to_d.money.to_s\n end",
"def money\n to_d.money.to_s\n end",
"def test_returns_10_percent_for_normal_bank_account\n test_balance = 100\n account_type = \"normal\"\n tax_due = 100/10\n assert_equal(10, tax_due)\n end",
"def loan_item_total_string(loan_item)\n if t = loan_item.total_items\n t\n else\n 'undefined'\n end\n end",
"def draw_both_cost\n text = @teleport.mp.to_s + \" \" + Vocab::mp\n draw_text(0, line_height*2, contents.width, line_height, text, 1)\n draw_item_cost\n end",
"def mark_up()\n return @retail_price-@buying_cost\n end",
"def card_fee_str(transaction, bin = nil)\n amount = transaction.amount\n if bin\n data = estimate_fee(amount, bin)\n data[:fee_str]\n else\n low, high = calculate_fee(transaction)\n result = \"$#{format_amount(low)}\"\n result += \"-#{format_amount(high)} (depends on card type)\" if high\n result\n end\n end",
"def name \n case type\n when \"percentage\"\n return \"#{@multiplier.round(0)}\\% Off\"\n when \"deduction\"\n return \"£#{@multiplier.round(0)} Off\"\n end\n end",
"def cents; end",
"def unit_helper(number, from_unit_string, to_unit_string)\n OpenStudio.convert(OpenStudio::Quantity.new(number, OpenStudio.createUnit(from_unit_string).get), OpenStudio.createUnit(to_unit_string).get).get.value\n end",
"def draw_currency_value(value, unit, x, y, width)\n @negative = false\n if value < 0\n @negative = true\n value *= -1\n end\n icon_width = IconOverlay ? 12 : 24\n bronzes = get_bronzes(value)\n silvers = get_silvers(value)\n golds = get_golds(value)\n w2 = width\n if bronzes > 0\n draw_icon(ICONBRONZE, x + w2 - 24, y)\n w2 -= icon_width\n w1 = text_size(bronzes).width\n draw_text(x, y, w2, line_height, bronzes, 2)\n w2 -= w1\n end\n if silvers > 0\n draw_icon(ICONSILVER, x + w2 - 24, y)\n w2 -= icon_width\n w1 = text_size(silvers).width\n draw_text(x, y, w2, line_height, silvers, 2)\n w2 -= w1\n end\n if golds > 0\n draw_icon(ICONGOLD, x + w2 - 24, y)\n w2 -= icon_width\n w1 = text_size(golds).width\n draw_text(x, y, w2, line_height, golds, 2)\n w2 -= w1\n end\n if @negative #draws a minus with negative numbers\n draw_text(x, y, w2, line_height, \"-\", 2)\n end\n end",
"def total_amount\r\n quantity * unit_price\r\n end",
"def balance\n @balance\n end",
"def currency_amount\n # define this elsewhere\n currencymark = '$'\n if self.credit?\n sprintf(\"%s%0.2f\",currencymark,self.amount)\n else\n # put minus sign before dollar\n sprintf(\"-%s%0.2f\", currencymark, self.amount.abs)\n end\n end",
"def discount_amount\n $tracer.trace(format_method(__method__))\n tt = ToolTag.new(@tag.find(\"td\")[2], format_method(__method__))\n return tt.inner_text\n end",
"def amount(n)\n case n\n when 0\n \"0 #{self}s\"\n when 1, -1\n \"#{n} #{self}\"\n else\n \"#{n} #{self}s\"\n end\n end"
] |
[
"0.69723725",
"0.6871718",
"0.6818697",
"0.6796447",
"0.67860216",
"0.67765105",
"0.66903144",
"0.6674578",
"0.66383916",
"0.66375893",
"0.6589841",
"0.65782994",
"0.64387417",
"0.6420365",
"0.6417079",
"0.63910955",
"0.63707876",
"0.635426",
"0.6338826",
"0.6311554",
"0.62881815",
"0.6261632",
"0.625997",
"0.6255416",
"0.6252213",
"0.6240075",
"0.6216868",
"0.6214689",
"0.6190815",
"0.61845136",
"0.6163859",
"0.615787",
"0.6132475",
"0.6125657",
"0.6119692",
"0.6111498",
"0.6107966",
"0.6095935",
"0.6093625",
"0.60841215",
"0.60727644",
"0.6071137",
"0.60578775",
"0.605638",
"0.6053801",
"0.605311",
"0.6049255",
"0.6040603",
"0.599536",
"0.59857273",
"0.598526",
"0.59505904",
"0.59360164",
"0.593044",
"0.592617",
"0.5925441",
"0.5924284",
"0.5921735",
"0.5921575",
"0.59112096",
"0.58994234",
"0.5889146",
"0.58886904",
"0.5887959",
"0.5883711",
"0.58821386",
"0.58817756",
"0.58811164",
"0.5875918",
"0.58542526",
"0.58536977",
"0.58448625",
"0.5839682",
"0.583861",
"0.583861",
"0.5834899",
"0.5834835",
"0.5828137",
"0.58252627",
"0.5805188",
"0.5804755",
"0.580413",
"0.57819533",
"0.57816607",
"0.5779018",
"0.5779018",
"0.5776832",
"0.57649016",
"0.5762163",
"0.5760158",
"0.5757982",
"0.57565075",
"0.57563543",
"0.57550263",
"0.5754772",
"0.5752206",
"0.57392794",
"0.57342553",
"0.57310194",
"0.57202804"
] |
0.80642486
|
0
|
GET /purchase_templates/1 GET /purchase_templates/1.json
|
def show
@purchase_template = PurchaseTemplate.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @purchase_template }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def new\n @purchase_template = PurchaseTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_template }\n end\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def list\n @client.make_request :get, templates_path\n end",
"def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end",
"def get_templates(opts={})\n path = '/template/list'\n opts[:query] = create_search_string(opts[:query]) if opts[:query]\n query = create_query_string(opts, [:page, :page_size, :query])\n path += query\n HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template\n end",
"def retrieve_single_template( template_id )\n puts \"Retrieving template id #{template_id}.\"\n\n uri = URI(@config['endpoint'] + '/' + template_id)\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n template = JSON.parse( response.body )\n end",
"def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end",
"def index\n @product_templates = ProductTemplate.all\n end",
"def show\n @invoice_template = InvoiceTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice_template }\n end\n end",
"def list\n @client.call(method: :get, path: 'templates')\n end",
"def get_item_templates_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreApi.get_item_templates ...\"\n end\n # resource path\n local_var_path = \"/store/items/templates\"\n\n # query parameters\n query_params = {}\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 => 'PageResourceStoreItemTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreApi#get_item_templates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_templates(limit = 100, offset = 0)\n params = { :limit => limit, :offset => offset }\n\n request :get, \"/v3/templates.json\", params\n end",
"def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end",
"def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end",
"def index\n @templates = Spree::Template.all\n end",
"def index\n @item_templates = ItemTemplate.all\n end",
"def index\n @policy_templates = PolicyTemplate.all\n end",
"def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end",
"def index\n @my_templates = MyTemplate.all\n end",
"def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'template'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Policy Templates:\", :style => :table)\n end",
"def index\n redirect_to root_path unless ViewTemplate.new(current_merchant_user, current_admin).check\n @templates = Template.all\n end",
"def index\n @request_templates = RequestTemplate.all\n end",
"def show\n respond_ok \"template\", @templates\n end",
"def get_driver_templates\n @client.raw('get', '/content/email-templates/driver/templates')\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = Template.all\n end",
"def index\n @templates = @firm.templates\n @template = Template.new\n end",
"def editor_templates (type, uuid)\n res = http_get(:uri=>\"/editor/#{type}/templates/#{uuid}\", :fields=>x_cookie)\n end",
"def tbu_list\n @client.make_request :get, templates_path('tbu')\n end",
"def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template }\n end\n end",
"def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end",
"def create\n @purchase_template = PurchaseTemplate.new(params[:purchase_template])\n\n respond_to do |format|\n if @purchase_template.save\n format.html { redirect_to @purchase_template, notice: 'Purchase template was successfully created.' }\n format.json { render json: @purchase_template, status: :created, location: @purchase_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template }\n end\n end",
"def list_templates(args = {})\n filter = args[:filter] || 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n params['projectid'] = args[:project_id] if args[:project_id]\n params['zoneid'] = args[:zone_id] if args[:zone_id]\n \n json = send_request(params)\n json['template'] || []\n end",
"def index\n @survey_item_templates = SurveyItemTemplate.all\n end",
"def template_details(template_id)\n @api.get(\"#{@api.path}/List/#{@id}/Templates/#{template_id}\")\n end",
"def index\n @question_templates = QuestionTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_templates }\n end\n end",
"def index\n @templates = ::Template.all\n end",
"def index\n @induction_templates = InductionTemplate.all\n end",
"def show\n @admin_template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template }\n end\n end",
"def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end",
"def index\n if params[:name]\n @template = Template.find_by_name(params[:name])\n if @template\n respond_ok \"template\", @template\n else\n respond_err \"template\", Template.new, \"i18> No template found\"\n end\n else\n @templates = Template.all\n if !@templates.empty?\n respond_ok \"template\", @templates\n else\n respond_err \"template\", @templates, \"i18> No template found\"\n end\n end\n end",
"def templates\n\n add_breadcrumb \"Download Template\"\n\n @message = \"Creating inventory template. This process might take a while.\"\n\n end",
"def new\n @invoice_template = InvoiceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_template }\n end\n end",
"def index\n @templates = EmailTemplate.all\n end",
"def destroy\n @purchase_template = PurchaseTemplate.find(params[:id])\n @purchase_template.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_templates_url }\n format.json { head :no_content }\n end\n end",
"def index\n @email_templates = EmailTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_templates }\n end\n end",
"def show\n @admin_template_software = TemplateSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template_software }\n end\n end",
"def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def template(name)\n @conn.templates.get(name)\n end",
"def get_templates(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end",
"def show\n @gift_template = GiftTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gift_template }\n end\n end",
"def get_template(name)\n response = request('Action' => 'GetTemplate', 'StackName' => name)\n rid = response.xpath('//aws:GetTemplateResponse/aws:ResponseMetadata/aws:RequestId', NS).text\n template_body = response.xpath('//aws:GetTemplateResponse/aws:GetTemplateResult/aws:TemplateBody', NS).text\n return {:request_id => rid, :body => JSON.parse(template_body)}\n end",
"def index\n @admin_template_softwares = TemplateSoftware.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_software_types }\n end\n end",
"def show\n @project_template = ProjectTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_template }\n end\n end",
"def index\n type = params[:type].present? ? params[:type] : \"invoice\"\n @print_templates = PrintTemplate.by_store_and_type(current_store.id, type)\n p @print_templates\n end",
"def get_template(template_name)\n self.api_get(:template, {:template => template_name})\n end",
"def index\n @review_templates = ReviewTemplate.all\n end",
"def index\n @templates = Template.order(:name).page params[:page]\n end",
"def index\n @custom_templates = CustomTemplate.page params[:page]\n end",
"def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end",
"def show\n @bulk_message_template = BulkMessageTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bulk_message_template }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template_package }\n end\n end",
"def index\n @meal_templates = MealTemplate.all\n end",
"def index\n @purchases = Purchase.where(user_id: get_current_user.id.to_i)\n\n render json: @purchases\n end",
"def get_item_template\n get_type_template(@source.types)\n end",
"def index\n authorize Template\n templates = Template.latest_version.where(customization_of: nil)\n published = templates.count { |t| t.published? || t.draft? }\n\n @orgs = Org.includes(identifiers: :identifier_scheme).managed\n @title = _('All Templates')\n @templates = templates.includes(:org).page(1)\n @query_params = { sort_field: 'templates.title', sort_direction: 'asc' }\n @all_count = templates.length\n @published_count = (published.presence || 0)\n @unpublished_count = if published.present?\n (templates.length - published)\n else\n templates.length\n end\n render :index\n end",
"def index\n @purchases = Purchase.find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def show\n @print_template = PrintTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @print_template }\n end\n end",
"def index\n @q = policy_scope(ServiceTemplate).ransack params[:q]\n @service_templates = @q.result.order(\"updated_at DESC\").page params[:page]\n end",
"def get_producttemplates_with_http_info(sku, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ProducttemplatesApi#get_producttemplates ...\"\n end\n \n # verify the required parameter 'sku' is set\n fail \"Missing the required parameter 'sku' when calling get_producttemplates\" if sku.nil?\n \n # resource path\n local_var_path = \"/producttemplates/\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'sku'] = sku\n query_params[:'languageCode'] = opts[:'language_code'] if opts[:'language_code']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ProductBuildInfoResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ProducttemplatesApi#get_producttemplates\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def index\n @templates = Template.includes(:template_elements).all\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 @purchases = purchases.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def show\n @inventory_template = InventoryTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js \n format.json { render json: @inventory_template }\n end\n end",
"def index\r\n template=params[:survey_template_id]\r\n @survey_template=SurveyTemplate.find(template)\r\n if current_user.is_admin?\r\n @survey_responses = SurveyResponse.where(:survey_template_id=>@survey_template.id)\r\n else\r\n @survey_responses = SurveyResponse.where(:survey_template_id=>@survey_template.id, :user_id => current_user.id)\r\n end\r\n\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @survey_responses }\r\n end\r\n end",
"def details(type, template_uuid)\n response = @client.get(\"editor/#{type}/templates/#{template_uuid}\")\n verify response,\n forbidden: 'You do not have permission to open the template',\n not_found: 'Template does not exist',\n internal_server_error: 'Internal server error occurred.'\n end",
"def templates; end",
"def show\n redirect_to edit_request_path(@request) if current_user.admin? && @request.pending?\n @request_templates = RequestTemplate.all\n end",
"def show\n @email_template = EmailTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_template }\n end\n end",
"def show\n @email_template = EmailTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_template }\n end\n end",
"def index\n @invitation_templates = InvitationTemplate.all\n end",
"def get_template(template); end",
"def index\n @question_templates = QuestionTemplate.all\n end",
"def index\n @post_templates = PostTemplate.all\n end",
"def index\n @_templates = @site.templates.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @_templates }\n end\n end",
"def index\n @message_templates = @company.message_templates\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @message_templates }\n end\n end",
"def index\n @bulk_message_templates = BulkMessageTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bulk_message_templates }\n end\n end",
"def index\n authorize @organization, :show_templates?\n @survey_templates = @organization.survey_templates\n end",
"def show\n @newsletters_template = Newsletters::Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @newsletters_template }\n end\n end",
"def show\n @question_template = QuestionTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_template }\n end\n end",
"def index\n # @custom_pet_templates = CustomPetTemplate.all\n end",
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def get_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _get(path)\n # return: JSON course template data\nend",
"def fetch_template(endpoint)\n url = URI.parse(endpoint)\n region = url.host.split('.').first.split('-', 2).last\n if(region == 's3')\n region = 'us-east-1'\n end\n bucket, path = url.path.sub('/', '').split('/', 2)\n MultiJson.load(\n storage_api(region).buckets.get(\n bucket.sub('/', '')\n ).files.get(path).body.read\n )\n end"
] |
[
"0.7033742",
"0.6797822",
"0.6760187",
"0.6628869",
"0.6519792",
"0.6475918",
"0.6446626",
"0.6438746",
"0.6418988",
"0.64068156",
"0.6380155",
"0.63623977",
"0.6353484",
"0.63275087",
"0.6316209",
"0.6314859",
"0.6303227",
"0.62912726",
"0.6265755",
"0.61693954",
"0.61551005",
"0.6143854",
"0.61431545",
"0.61395675",
"0.6131308",
"0.6122208",
"0.6114779",
"0.6111615",
"0.6111615",
"0.6111615",
"0.61115044",
"0.60937476",
"0.60925245",
"0.6072179",
"0.60717267",
"0.6048166",
"0.6039326",
"0.60318846",
"0.60254157",
"0.6012996",
"0.60054076",
"0.59812605",
"0.5966936",
"0.5958137",
"0.59296906",
"0.5928645",
"0.59274006",
"0.5923488",
"0.5918054",
"0.5917324",
"0.5914752",
"0.5892858",
"0.5887194",
"0.5887194",
"0.5881045",
"0.5880256",
"0.58734983",
"0.5856858",
"0.584495",
"0.5841306",
"0.5837637",
"0.5824348",
"0.5810286",
"0.5798684",
"0.5796802",
"0.5789987",
"0.5783536",
"0.57767993",
"0.5763886",
"0.5753966",
"0.5751247",
"0.574982",
"0.5747074",
"0.5746099",
"0.5740316",
"0.5738521",
"0.57367146",
"0.5731502",
"0.57236123",
"0.5714859",
"0.5691431",
"0.5690182",
"0.56663513",
"0.5664943",
"0.5648382",
"0.5648382",
"0.5646424",
"0.5646344",
"0.56385386",
"0.5636615",
"0.56364644",
"0.56357884",
"0.5632966",
"0.5623994",
"0.5623003",
"0.5623002",
"0.56204647",
"0.5619166",
"0.5618723",
"0.56173754"
] |
0.7163538
|
0
|
GET /purchase_templates/new GET /purchase_templates/new.json
|
def new
@purchase_template = PurchaseTemplate.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @purchase_template }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end",
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end",
"def new\n @invoice_template = InvoiceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_template }\n end\n end",
"def create\n @purchase_template = PurchaseTemplate.new(params[:purchase_template])\n\n respond_to do |format|\n if @purchase_template.save\n format.html { redirect_to @purchase_template, notice: 'Purchase template was successfully created.' }\n format.json { render json: @purchase_template, status: :created, location: @purchase_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @project_template = ProjectTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_template }\n end\n end",
"def new\n @page_template = PageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_template }\n end\n end",
"def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end",
"def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end",
"def new\n @_template = @site.templates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @_template }\n end\n end",
"def new\n @inventory_template = InventoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @inventory_template }\n end\n end",
"def new\n @template_task = TemplateTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_task }\n end\n end",
"def new\n @gift_template = GiftTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gift_template }\n end\n end",
"def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end",
"def new\n @admin_template_software = TemplateSoftware.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template_software }\n end\n end",
"def new\n @print_template = PrintTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @print_template }\n end\n end",
"def new\n @template_package = TemplateAuthor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_package }\n end\n end",
"def new\n @newsletters_template = Newsletters::Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletters_template }\n end\n end",
"def new\n @question_template = QuestionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_template }\n end\n end",
"def new\n @message_template = @company.message_templates.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_template }\n end\n end",
"def new\n @bulk_message_template = BulkMessageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bulk_message_template }\n end\n end",
"def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end",
"def new\n @template_shift = TemplateShift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_shift }\n end\n end",
"def new\n @purchase = Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end",
"def new\n @purchase = Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end",
"def new\n @purchase = Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end",
"def new\n @node_template = NodeTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_template }\n end\n end",
"def create\n @template = Spree::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @title = t('view.transfer_products.new_title')\n @transfer_product = TransferProduct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transfer_product }\n end\n end",
"def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template }\n end\n end",
"def new\n @policy_template = PolicyTemplate.new\n end",
"def create\n @invoice_template = InvoiceTemplate.new(params[:invoice_template])\n\n respond_to do |format|\n if @invoice_template.save\n format.html { redirect_to @invoice_template, notice: 'Invoice template was successfully created.' }\n format.json { render json: @invoice_template, status: :created, location: @invoice_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @templates = EmailTemplate.find(:all) \n @email_template = EmailTemplate.new\n @email_template.name = params[:name]\n @email_template.content = EmailTemplate.fetch_default(@email_template.name)\n @email_template.subject = EmailTemplate.fetch_subject_default(@email_template.name) \n @page_title = t('email_templates.new.title', :email_template_name => @email_template.name)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @email_template }\n end\n end",
"def new\n @title = \"New region\"\n @region = RegionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @region }\n end\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @module_template = ModuleTemplate.new\n\t@module_template.module_parameters.build\n\t@module_template.module_instances.build\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @module_template }\n end\n end",
"def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n\n if @template.save\n render :show, status: :created, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\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 @purchase_item = PurchaseItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_item }\n end\n end",
"def new\n @trtype = Trtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trtype }\n end\n end",
"def create\n @gift_template = GiftTemplate.new(params[:gift_template])\n\n respond_to do |format|\n if @gift_template.save\n format.html { redirect_to gift_templates_path, notice: 'Gift template was successfully created.' }\n format.json { render json: @gift_template, status: :created, location: @gift_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gift_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item template was successfully created.' }\n format.json { render :show, status: :created, location: @item_template }\n else\n format.html { render :new }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @purchaseorder = Purchaseorder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchaseorder }\n end\n end",
"def new\n @title = \"New item\"\n @item = ItemTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def create\n @template = ::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n ## Intitializing the temple object\n @temple = Temple.new\n\n if params[:trust_id]\n @trust = Trust.find_by_id(params[:trust_id])\n @temple.trust = @trust\n end\n\n respond_to do |format|\n format.html { get_collections and render :index }\n format.json { render json: @temple }\n format.js {}\n end\n end",
"def new\n @host_tpl = HostTpl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host_tpl }\n end\n end",
"def new\n @templete = Templete.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @templete }\n end\n end",
"def new\n @config_template = ConfigTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @config_template }\n format.xml { render :xml => @config_template }\n end\n end",
"def new\n authorize! :create, NotificationTemplate.new\n\n @notification_template = NotificationTemplate.new\n @supported_events = Notifier.supported_events\n @supported_formats = Notifier.supported_formats\n #prepare some help text arrays for available tokens\n @available_tokens = self.notification_tokens\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification_template }\n end\n end",
"def create\n restricted\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @quest_template = QuestTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @quest_template }\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @goaltemplate = Goaltemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @goaltemplate }\n end\n end",
"def create\n @policy_template = PolicyTemplate.new(policy_template_params)\n\n respond_to do |format|\n if @policy_template.save\n format.html { redirect_to @policy_template, notice: 'Policy template was successfully created.' }\n format.json { render :show, status: :created, location: @policy_template }\n else\n format.html { render :new }\n format.json { render json: @policy_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @product = Product.find(params[:product_id])\n @purchase = Purchase.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end",
"def new\n @template_field = TemplateField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template_field }\n end\n end",
"def new\n @contract_template = ContractTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract_template }\n end\n end",
"def new\n @temporary_source = TemporarySource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @temporary_source }\n end\n end",
"def new\n @template2 = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template2 }\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html {\n redirect_to @template,\n notice: \"Template #{@template.template_name} was successfully created.\"\n }\n format.json {\n render :show, status: :created, location: @template\n }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @press = Press.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @press }\n end\n end",
"def create\n authorize! :manage, :all\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: @question_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cv_template = CvTemplate.new(cv_template_params)\n respond_to do |format|\n if @cv_template.save\n current_user.cv_templates << @cv_template\n format.html { redirect_to action: :index, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @cv_template }\n else\n format.html { render :new }\n format.json { render json: @cv_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @temp_table_for_cust = TempTableForCust.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @temp_table_for_cust }\n end\n end",
"def new\n @tenure = Tenure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tenure }\n end\n end",
"def new\n @shop_purchase = Shop::Purchase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_purchase }\n end\n end",
"def new\n @transcription = Transcription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transcription }\n end\n end",
"def new\n @step = Step.new :phase_template_id => params[:phase_template_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @step }\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render json: @template, status: :created, location: @template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end",
"def create\n @template = Template.new(template_params) \n respond_to do |format|\n if @template.save \n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end",
"def create\n @my_template = MyTemplate.new(my_template_params)\n\n respond_to do |format|\n if @my_template.save\n format.html { redirect_to @my_template, notice: 'My template was successfully created.' }\n format.json { render :show, status: :created, location: @my_template }\n else\n format.html { render :new }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @template = CustomTemplate.new\n\n \trender :layout => \"templates\"\t\n end",
"def new\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end",
"def new\n @tax_type = TaxType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tax_type }\n end\n end",
"def new\n @template_container = TemplateContainer.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template_container }\n end\n end",
"def create\n @email_template = EmailTemplate.new(params[:email_template])\n\n respond_to do |format|\n if @email_template.save\n format.html { redirect_to email_templates_path, notice: 'Email template was successfully created.' }\n format.json { render json: @email_template, status: :created, location: @email_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n template = Template.includes(:phases).find(params[:template_id])\n if template.latest?\n nbr = template.phases.maximum(:number)\n phase = Phase.new(\n template: template,\n modifiable: true,\n number: (nbr.present? ? nbr + 1 : 1)\n )\n authorize phase\n local_referrer = (request.referer.presence || org_admin_templates_path)\n render('/org_admin/templates/container',\n locals: {\n partial_path: 'new',\n template: template,\n phase: phase,\n referrer: local_referrer\n })\n else\n render org_admin_templates_path,\n alert: _('You cannot add a phase to a historical version of a template.')\n end\n end",
"def new\n @settlement = Settlement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @settlement }\n end\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def create\n @newsletters_template = Newsletters::Template.new(params[:newsletters_template])\n\n respond_to do |format|\n if @newsletters_template.save\n format.html { redirect_to @newsletters_template, notice: 'Template was successfully created.' }\n format.json { render json: @newsletters_template, status: :created, location: @newsletters_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newsletters_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end",
"def create\n @project_template = ProjectTemplate.new(params[:project_template])\n\n respond_to do |format|\n if @project_template.save\n format.html { redirect_to @project_template, notice: 'Project template was successfully created.' }\n format.json { render json: @project_template, status: :created, location: @project_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @tasktype = Tasktype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tasktype }\n end\n end",
"def new\n @tier = Tier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tier }\n end\n end",
"def new\n @purchase_item_status = PurchaseItemStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_item_status }\n end\n end",
"def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end",
"def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end",
"def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end",
"def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end",
"def create\n @template = EmailTemplate.new(template_params)\n respond_to do |format|\n if @template.save\n format.html { redirect_to email_templates_path, notice: 'template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @purchase_receipt = PurchaseReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_receipt }\n end\n end",
"def new\n @breadcrumb = 'create'\n @inventory_transfer = InventoryTransfer.new\n @stores = stores_dropdown\n @products = products_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_transfer }\n end\n end",
"def create\n begin\n @cf_template.validate_template\n rescue StandardError => ex\n flash[:alert] = ex.message\n render action: 'new' and return\n end\n\n respond_to do |format|\n if @cf_template.save\n format.html { redirect_to cf_templates_path, notice: I18n.t('cf_templates.msg.created') }\n format.json { render action: 'show', status: :created, location: @client }\n else\n format.html do\n flash.now[:alert] = @cf_template.errors[:json] if @cf_template.errors[:json]\n render action: 'new'\n end\n format.json { render json: @cf_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @purchase_requisition = PurchaseRequisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_requisition }\n end\n end",
"def create\n @review_template = ReviewTemplate.new(review_template_params)\n\n respond_to do |format|\n if @review_template.save\n format.html { redirect_to @review_template, notice: 'Review template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @review_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @review_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @purchase = current_user.purchases.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase }\n end\n end"
] |
[
"0.7423524",
"0.73924184",
"0.7304808",
"0.7259726",
"0.7040678",
"0.6951944",
"0.6935729",
"0.6935729",
"0.6934248",
"0.6933504",
"0.6931821",
"0.69216204",
"0.6919294",
"0.68666327",
"0.68563426",
"0.6841217",
"0.6820332",
"0.6755063",
"0.6751302",
"0.67326474",
"0.66989315",
"0.6665306",
"0.6661468",
"0.6661468",
"0.6661468",
"0.6644376",
"0.65322405",
"0.6478741",
"0.6473786",
"0.64290017",
"0.6425276",
"0.6411266",
"0.64083034",
"0.64041984",
"0.6389988",
"0.63787234",
"0.6377509",
"0.63678426",
"0.63637364",
"0.63501805",
"0.6342392",
"0.6334751",
"0.63319",
"0.6330839",
"0.63269114",
"0.63262546",
"0.6314724",
"0.6312054",
"0.63044715",
"0.63007134",
"0.62925947",
"0.62858653",
"0.6283128",
"0.6282498",
"0.6279644",
"0.6277286",
"0.6271839",
"0.62633353",
"0.6252884",
"0.6252708",
"0.62521875",
"0.62490875",
"0.62349063",
"0.62232006",
"0.6216252",
"0.621443",
"0.6209645",
"0.6205264",
"0.6196042",
"0.61953926",
"0.6189843",
"0.6183924",
"0.61755395",
"0.6171134",
"0.61710286",
"0.6169695",
"0.6163445",
"0.6159979",
"0.6158718",
"0.61494833",
"0.6143877",
"0.61405253",
"0.6140428",
"0.61368006",
"0.6130599",
"0.61294764",
"0.6122648",
"0.61203414",
"0.611944",
"0.6114852",
"0.6114852",
"0.6114852",
"0.6112067",
"0.61112994",
"0.61111",
"0.61110854",
"0.61098707",
"0.6108737",
"0.6108377",
"0.61050177"
] |
0.7994639
|
0
|
POST /purchase_templates POST /purchase_templates.json
|
def create
@purchase_template = PurchaseTemplate.new(params[:purchase_template])
respond_to do |format|
if @purchase_template.save
format.html { redirect_to @purchase_template, notice: 'Purchase template was successfully created.' }
format.json { render json: @purchase_template, status: :created, location: @purchase_template }
else
format.html { render action: "new" }
format.json { render json: @purchase_template.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end",
"def new\n @purchase_template = PurchaseTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_template }\n end\n end",
"def create\n @invoice_template = InvoiceTemplate.new(params[:invoice_template])\n\n respond_to do |format|\n if @invoice_template.save\n format.html { redirect_to @invoice_template, notice: 'Invoice template was successfully created.' }\n format.json { render json: @invoice_template, status: :created, location: @invoice_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def purchase_template(template_id)\n return false unless can_purchase_templates?\n\n # Copy data from Template\n template = GspTemplate.find(template_id)\n OrganizationTemplate.create :agency => template.agency, :description => template.description,\n :display_name => template.display_name, :frequency => template.frequency,\n :full_name => template.full_name, :objectives => template.objectives,\n :regulatory_review_name => template.regulatory_review_name,\n :purchased_by => self, :organization => self.organization,\n :tasks => template.tasks\n end",
"def template_params\n params.require(:template).permit(:name, :description, :template_type, :accounting_plan, :accounting_plan_id)\n end",
"def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end",
"def create\n @logistic_order_template = LogisticOrderTemplate.new(logistic_order_template_params)\n\n if @logistic_order_template.save\n render :show, status: :created, location: @logistic_order_template\n else\n render json: @logistic_order_template.errors, status: :unprocessable_entity\n end\n end",
"def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end",
"def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end",
"def create\n @exercise_template = ExerciseTemplate.new(exercise_template_params)\n\n if @exercise_template.save\n render json: @exercise_template, status: :created, location: @exercise_template\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item template was successfully created.' }\n format.json { render :show, status: :created, location: @item_template }\n else\n format.html { render :new }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @user = current_user\n if params[:order_id]\n order = Order.find(params[:order_id])\n order.line_items.each do |item|\n product = Product.find(item.product_id)\n #@template = @user.templates.build(:product => product)\n @template = @user.add_product(product.id)\n if !@template.save\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n elsif params[:product_id]\n product = Product.find(params[:product_id])\n @template = @user.templates.build(:product => product)\n #@user.add_product(product.id)#Template.new(params[:template])\n if !@template.save\n format.html { render :action => \"new\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n respond_to do |format|\n #if @template.save\n format.html { redirect_to(:back, :notice => 'Шаблоны добавлены') }#redirect_to(@template\n format.xml { render :xml => @template, :status => :created, :location => @template }\n #else\n # format.html { render :action => \"new\" }\n # format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n #end\n end\n end",
"def create\n @template = Spree::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey_item_template = SurveyItemTemplate.new(survey_item_template_params)\n\n respond_to do |format|\n if @survey_item_template.save\n format.html { redirect_to @survey_item_template.survey_item_category_template.survey_template, notice: 'Survey item template was successfully created.' }\n format.json { render :show, status: :created, location: @survey_item_template }\n else\n format.html { render :new }\n format.json { render json: @survey_item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @emailtemplate = Spree::EmailTemplate.new(emailtemplate_params)\n\n respond_to do |format|\n if @emailtemplate.save\n format.html { redirect_to email_templates_url, notice: 'EmailTemplate was successfully created.' }\n format.json { render action: 'show', status: :created, location: @emailtemplate }\n else\n format.html { render action: 'new' }\n format.json { render json: @emailtemplate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:discount_template][:shop_id] = current_shop.id unless params[:discount_template].nil?\n \n @discount_template = DiscountTemplate.new(params[:discount_template])\n\n respond_to do |format|\n if @discount_template.save\n format.html { redirect_to(discount_templates_path, :notice => 'Discount template was successfully created.') }\n format.js\n else\n @discount_templates = DiscountTemplate.all\n format.html { render :action => \"index\", :error => 'Oops! Please fix the missing or incorrect details' }\n format.js\n end\n end\n end",
"def create\n @gift_template = GiftTemplate.new(params[:gift_template])\n\n respond_to do |format|\n if @gift_template.save\n format.html { redirect_to gift_templates_path, notice: 'Gift template was successfully created.' }\n format.json { render json: @gift_template, status: :created, location: @gift_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gift_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @policy_template = PolicyTemplate.new(policy_template_params)\n\n respond_to do |format|\n if @policy_template.save\n format.html { redirect_to @policy_template, notice: 'Policy template was successfully created.' }\n format.json { render :show, status: :created, location: @policy_template }\n else\n format.html { render :new }\n format.json { render json: @policy_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n\n if @template.save\n render :show, status: :created, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def template_params\n params.fetch(:template, {}).permit([:title, :data])\n end",
"def create\n @template = EmailTemplate.new(template_params)\n respond_to do |format|\n if @template.save\n format.html { redirect_to email_templates_path, notice: 'template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @survey_template = @organization.survey_templates.build(survey_template_params)\n authorize @survey_template\n\n respond_to do |format|\n if @survey_template.save\n format.html { redirect_to @survey_template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @survey_template }\n else\n @record = [@organization, @survey_template]\n format.html { render :new }\n format.json { render json: @survey_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(data)\n result = @client.api_request(:method => \"template.create\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\n end",
"def create\n @questionnaire_template = QuestionnaireTemplate.new(questionnaire_template_params)\n\n respond_to do |format|\n if @questionnaire_template.save\n format.html { redirect_to @questionnaire_template, notice: 'questionnaire template was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire_template }\n else\n format.html { render :new }\n format.json { render json: @questionnaire_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @templates = @firm.templates\n @template = Template.new(template_params)\n @template.user = @user\n @template.firm = @firm\n if File.extname(@template.file.file.filename) == '.docx'\n content = ''\n if @template.valid_zip?\n doc = Docx::Document.open(@template.file.path)\n doc.paragraphs.each do |p|\n if p.node.xpath('w:r//w:lastRenderedPageBreak').present?\n content = content + %q(<div class=\"-page-break\"></div>) + p.to_html\n else\n content = content + p.to_html\n end\n\n end\n @template.html_content = content\n respond_to do |format|\n if @template.save\n format.html { redirect_to template_path(@template), notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n else\n @template.errors.add(:file, 'is corrupted')\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def template_params\n params.require(:template).permit(:subject, :body, :merchant_id, :created_by, :last_updated_by)\n end",
"def create\n @request_template = RequestTemplate.new(request_template_params)\n\n respond_to do |format|\n if @request_template.save\n respond format, 'Request template was successfully created.'\n else\n format.html { render :new }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n current_user.templates << @template\n\n respond_to do |format|\n if current_user.save\n Field.all.each do |field|\n t_field = TemplateField.new(val: \"\")\n t_field.field = field\n t_field.template = @template \n t_field.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_added') }\n else\n format.html { redirect_to dashboard_path, notice: @template.errors.full_messages[0]}\n end\n end\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def create\n @print_template = PrintTemplate.new(print_template_params)\n @print_template.user = current_user\n @print_template.store = current_store\n\n respond_to do |format|\n if @print_template.save\n format.html { redirect_to print_templates_path(type: @print_template.template_type), notice: 'Print template was successfully created.' }\n format.json { render :show, status: :created, location: @print_template }\n else\n format.html { render :new }\n format.json { render json: @print_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @email_template = EmailTemplate.new(params[:email_template])\n\n respond_to do |format|\n if @email_template.save\n format.html { redirect_to email_templates_path, notice: 'Email template was successfully created.' }\n format.json { render json: @email_template, status: :created, location: @email_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_template_lists(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/template/lists.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'type' => options['type'],\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'Shortcode' => options['shortcode']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end",
"def create\n @product_template = ProductTemplate.new(product_template_params)\n\n respond_to do |format|\n if @product_template.save\n format.html { redirect_to @product_template, notice: 'Product template was successfully created.' }\n format.json { render :show, status: :created, location: @product_template }\n else\n format.html { render :new }\n format.json { render json: @product_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, :path, elements: [:key, :type, :content])\n end",
"def create\n authorize! :manage, :all\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: @question_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n\n if @purchase.save\n render json: @purchase, status: :created, location: @purchase\n else\n render json: {errors: @purchase.errors}, status: :unprocessable_entity\n end\n end",
"def create\n @invitation_template = InvitationTemplate.new(invitation_template_params)\n\n respond_to do |format|\n if @invitation_template.save\n format.html { redirect_to @invitation_template, notice: 'Invitation template was successfully created.' }\n format.json { render :show, status: :created, location: @invitation_template }\n else\n format.html { render :new }\n format.json { render json: @invitation_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def templates\n\n add_breadcrumb \"Download Template\"\n\n @message = \"Creating inventory template. This process might take a while.\"\n\n end",
"def set_templates(name, templates)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n raise('wrong type: String required') unless templates.is_a?(String)\n raise('wrong value: templates must be valid') unless !templates.nil? && !templates.empty?\n\n @client.post({\n 'action' => 'settemplate',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [name, templates],\n }.to_json)\n end",
"def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n\n respond_to do |format|\n if @purchase.save\n format.json { render action: 'show', status: :created, location: @purchase }\n else\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @review_template = ReviewTemplate.new(review_template_params)\n\n respond_to do |format|\n if @review_template.save\n format.html { redirect_to @review_template, notice: 'Review template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @review_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @review_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @email_template = EmailTemplate.new(params[:email_template])\n\n respond_to do |format|\n if @email_template.save\n format.html { redirect_to @email_template, notice: 'Email template was successfully created.' }\n format.json { render json: @email_template, status: :created, location: @email_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @invoice_template = InvoiceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_template }\n end\n end",
"def add\n @object = JSON.parse(File.read(\"data/templates/#{params[:identifier]}.js\"))\n @object['identifier'] = \"#{@object['identifier']}_#{current_user.id}\"\n @template = Template.create! @object\n @template.identifier = \"#{@template.id}_#{@template.identifier}\"\n @template.status = 100\n @template.count = 0\n\n current_user.templates.push @template\n respond_to do |format|\n format.html { redirect_to @template }\n end if @template.save\n end",
"def create\n @bulk_message_template = BulkMessageTemplate.new(params[:bulk_message_template])\n\n respond_to do |format|\n if @bulk_message_template.save\n format.html { redirect_to @bulk_message_template, notice: 'Bulk message template was successfully created.' }\n format.json { render json: @bulk_message_template, status: :created, location: @bulk_message_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bulk_message_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inspection_template = InspectionTemplate.new(inspection_template_params)\n\n respond_to do |format|\n if @inspection_template.save\n format.html { redirect_to @inspection_template, notice: 'Inspection template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inspection_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @inspection_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html {\n redirect_to @template,\n notice: \"Template #{@template.template_name} was successfully created.\"\n }\n format.json {\n render :show, status: :created, location: @template\n }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @my_template = MyTemplate.new(my_template_params)\n\n respond_to do |format|\n if @my_template.save\n format.html { redirect_to @my_template, notice: 'My template was successfully created.' }\n format.json { render :show, status: :created, location: @my_template }\n else\n format.html { render :new }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html { redirect_to @question_template, notice: 'Question template was successfully created.' }\n format.json { render :show, status: :created, location: @question_template }\n else\n format.html { render :new }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @errors = []\n @compiled = []\n otp = params[:otp]\n totp = ROTP::TOTP.new(session[:secret_key])\n #Must be verified within 30 seconds\n respond_to do |format|\n\n unless totp.verify(otp, drift_behind: 30).nil?\n current_user.cart.cart_items.each do |cart_item|\n @purchase = current_user.purchases.build()\n @purchase.student = current_user\n @purchase.section = cart_item.section\n @purchase.price = cart_item.section.course.price\n unless @purchase.save\n @errors.append @purchase.errors\n else\n @compiled.append @purchase\n message = PurchaseMailer.enrollment_email(cart_item.section.teacher, current_user, cart_item.section).deliver!\n cart_item.destroy\n end\n end\n\n if @compiled.any?\n message = PurchaseMailer.purchase_email(current_user_auth, @compiled).deliver!\n end\n\n unless @errors.any?\n format.html { redirect_to purchases_url, notice: 'Purchase was successfully created.' }\n format.json { render :show, status: :created, location: purchases_url }\n else\n format.html { render :new }\n format.json { render json: @errors, status: :unprocessable_entity }\n end\n\n else\n format.html { redirect_to cart_path, notice: 'Incorrect password. Purchase declined.' }\n format.json { head :no_content }\n end\n end\n end",
"def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cv_template = CvTemplate.new(cv_template_params)\n respond_to do |format|\n if @cv_template.save\n current_user.cv_templates << @cv_template\n format.html { redirect_to action: :index, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @cv_template }\n else\n format.html { render :new }\n format.json { render json: @cv_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = Purchase.new(purchase_params)\n\n respond_to do |format|\n if @purchase.save\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { render :new }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post_template = PostTemplate.new(post_template_params)\n\n respond_to do |format|\n if @post_template.save\n format.html { redirect_to @post_template, notice: 'Post template was successfully created.' }\n format.json { render :show, status: :created, location: @post_template }\n else\n format.html { render :new }\n format.json { render json: @post_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end",
"def create\n restricted\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name)\n end",
"def create\n @template = ::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @newsletters_template = Newsletters::Template.new(params[:newsletters_template])\n\n respond_to do |format|\n if @newsletters_template.save\n format.html { redirect_to @newsletters_template, notice: 'Template was successfully created.' }\n format.json { render json: @newsletters_template, status: :created, location: @newsletters_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newsletters_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase = current_user.purchases.build(params[:purchase])\n\n respond_to do |format|\n if @purchase.save\n Notifications.new_purchase(@purchase).deliver\n format.html { redirect_to @purchase, notice: 'Purchase was successfully created.' }\n format.json { render json: @purchase, status: :created, location: @purchase }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @print_template = PrintTemplate.new(params[:print_template])\n\n respond_to do |format|\n if @print_template.save\n format.html { redirect_to @print_template, notice: 'Print template was successfully created.' }\n format.json { render json: @print_template, status: :created, location: @print_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @print_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, :body, :active_flg)\n end",
"def template_params\n params.require(:template).permit(:name, :action)\n end",
"def create\n @template = Template.new(template_params) \n respond_to do |format|\n if @template.save \n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n data = ConfigurationTemplate.new(name: params[:name], description: params[:description],user: current_user)\n data.save\n render json: data\n\n end",
"def supported_templates\n [\n double_opt_in_template,\n admin_forgot_password_template,\n user_forgot_password_template,\n kyc_issue_template,\n admin_invite_template,\n test_webhook_result_template,\n\n # kyc_data_mismatch_template,\n # kyc_document_id_issue_template,\n # kyc_selfie_image_issue_template,\n # kyc_residency_image_issue_template,\n\n kyc_approved_template,\n kyc_denied_template,\n purchase_confirmation,\n altdrop_sent,\n contact_us_template,\n low_whitelister_balance_template,\n manual_review_needed_template,\n billing_plan_notification_template,\n update_ethereum_request_outcome_template,\n open_case_request_outcome_template,\n contact_us_ost_partner_autoresponder_template,\n contact_us_ost_kyc_autoresponder_template,\n kyc_report_download_template,\n low_balance_whitelisting_suspended_template,\n contract_address_update_template\n ]\n end",
"def create\n @track_template = TrackTemplate.new(track_template_params)\n\n respond_to do |format|\n if @track_template.save\n format.html { redirect_to @track_template, notice: 'Track template was successfully created.' }\n format.json { render :show, status: :created, location: @track_template }\n else\n format.html { render :new }\n format.json { render json: @track_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @templates = @firm.templates\n @template = Template.new\n end",
"def template_params\n params.require(:template).permit(:title, :desc, :creator, :templateVersion, :fields, :aprovable, :acknowledgeable, :defaultemail, :parent)\n end",
"def template_params\n params.permit(\n :certificate_serial,\n :identity,\n { template_contents_attributes: [:id, :template_id, :locale, :title, :content] }\n )\n end",
"def create\n @template = Template.new(template_params)\n if @template.save\n respond_ok \"template\", @template\n else\n respond_err \"template\", @template, @template.errors\n end\n end",
"def destroy\n @purchase_template = PurchaseTemplate.find(params[:id])\n @purchase_template.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_templates_url }\n format.json { head :no_content }\n end\n end",
"def create_course_template(course_template_data)\n # TODO: make a bridge function that allows this to be done with 4 arguments, rather than\n # just a JSON.\n # Path- root path to use for this course offering’s course content\n # if your back-end service has path enforcement set on for\n # new org units, leave this property as an empty string\n # Define a valid, empty payload and merge! with the user_data. Print it.\n payload = {\n 'Name' => '', # String\n 'Code' => 'off_SEMESTERCODE_STARNUM', # String\n 'Path' => '', # String\n 'ParentOrgUnitIds' => [99_989], # number: D2L_ID\n }.merge!(course_template_data)\n check_course_template_data_validity(payload)\n puts 'Creating Course Template:'\n ap payload\n # Define a path referencing the courses path\n # requires: CreateCourseTemplate JSON block\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/\"\n _post(path, payload)\n puts '[+] Course template creation completed successfully'.green\n # returns: CourseTemplate JSON block containing the new data.\nend",
"def my_template_params\n params.require(:my_template).permit(:name, :desc)\n end",
"def post_template_params\n params.require(:post_template).permit(:new_thing, :other_thing, :another_thing)\n end",
"def template_params\n params.require(:template).permit(:name, :content)\n end",
"def create_template\n\n add_breadcrumb \"Download Template\"\n\n # Figure out which approach was used to access this method\n file_content_type = nil\n # From the form. This is managed via a TemplateProxy class\n if params[:template_proxy].present?\n # Inflate the proxy\n template_proxy = TemplateProxy.new(params[:template_proxy])\n Rails.logger.debug template_proxy.inspect\n\n # See if an org was set, use the default otherwise\n if template_proxy.organization_id.blank?\n org = nil\n else\n o = Organization.find(template_proxy.organization_id)\n org = Organization.get_typed_organization(o)\n end\n\n # The form defines the FileContentType which identifies the builder to use\n file_content_type = FileContentType.find(template_proxy.file_content_type_id)\n # asset_types are an array of asset types\n\n elsif params[:targets].present?\n # The request came from the audit results page. We have a list of asset\n # object keys\n file_content_type = FileContentType.find(params[:file_content_type_id])\n assets = Rails.application.config.asset_base_class_name.constantize.operational.where(:object_key => params[:targets].split(','))\n org = nil\n end\n\n is_component = params[:is_component]\n fta_asset_class_id = params[:fta_asset_class_id]\n\n # Find out which builder is used to construct the template and create an instance\n builder = file_content_type.builder_name.constantize.new(:organization => org, :asset_class_name => template_proxy.try(:asset_class_name), :asset_seed_class_id => template_proxy.try(:asset_seed_class_id), :organization_list => @organization_list, :is_component => is_component, :fta_asset_class_id => fta_asset_class_id)\n\n # Generate the spreadsheet. This returns a StringIO that has been rewound\n if params[:targets].present?\n builder.assets = assets\n end\n stream = builder.build\n\n # Save the template to a temporary file and render a success/download view\n file = Tempfile.new ['template', '.tmp'], \"#{Rails.root}/tmp\"\n ObjectSpace.undefine_finalizer(file)\n #You can uncomment this line when debugging locally to prevent Tempfile from disappearing before download.\n @filepath = file.path\n @filename = \"#{org.present? ? org.short_name.downcase : 'MultiOrg'}_#{file_content_type.class_name.underscore}_#{Date.today}.xlsx\"\n begin\n file << stream.string\n rescue => ex\n Rails.logger.warn ex\n ensure\n file.close\n end\n # Ensure you're cleaning up appropriately...something wonky happened with\n # Tempfiles not disappearing during testing\n respond_to do |format|\n format.js\n format.html\n end\n\n end",
"def create_item_template_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreApi.create_item_template ...\"\n end\n # resource path\n local_var_path = \"/store/items/templates\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'item_template_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'StoreItemTemplateResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreApi#create_item_template\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @event_template = EventTemplate.new(event_template_params)\n\n respond_to do |format|\n if @event_template.save\n format.html { redirect_to @event_template, notice: \"Event template was successfully created.\" }\n format.json { render :show, status: :created, location: @event_template }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @event_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def survey_item_template_params\n params.require(:survey_item_template).permit(:question_title, :description, :survey_template_id, :srvy_item_category_template_id, {survey_data_type_ids: []})\n end",
"def create\n @timetable_template = TimetableTemplate.new(timetable_template_params)\n\n respond_to do |format|\n if @timetable_template.save\n format.html { redirect_to @timetable_template, notice: 'Timetable template was successfully created.' }\n format.json { render :show, status: :created, location: @timetable_template }\n else\n format.html { render :new }\n format.json { render json: @timetable_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @purchase_request = PurchaseRequest.new(purchase_request_params)\n\n respond_to do |format|\n if @purchase_request.save\n format.html { redirect_to @purchase_request, notice: 'Purchase request was successfully created.' }\n format.json { render :show, status: :created, location: @purchase_request }\n else\n format.html { render :new }\n format.json { render json: @purchase_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @purchase_template = PurchaseTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_template }\n end\n end",
"def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render json: @template, status: :created, location: @template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getPaymentRequestTemplate\n {\n order_number: '',\n amount: 0,\n language: '',\n customer_ip: '',\n term_url: '',\n comments: '',\n billing: {\n name: '',\n address_line1: '',\n address_line2: '',\n city: '',\n province: '',\n country: '',\n postal_code: '',\n phone_number: '',\n email_address: ''\n },\n shipping: {\n name: '',\n address_line1: '',\n address_line2: '',\n city: '',\n province: '',\n country: '',\n postal_code: '',\n phone_number: '',\n email_address: ''\n },\n custom: {\n ref1: '',\n ref2: '',\n ref3: '',\n ref4: '',\n ref5: ''\n }\n }\n end",
"def survey_template_params\n params.require(:survey_template).permit(:name, :status, :survey_type)\n end",
"def create\n @email_template = EmailTemplate.new(email_template_params.merge(user_id: current_user.id))\n respond_to do |format|\n if @email_template.save\n update_contact_category\n format.html { redirect_to @email_template, notice: 'Email template was created.' }\n else\n format.html { render :new }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @templates = EmailTemplate.find(:all) \n @email_template = EmailTemplate.new(params[:email_template])\n @page_title = t('email_templates.new.title', :email_template_name => @email_template.name) \n respond_to do |format|\n if @email_template.save\n flash[:notice] = t('email_templates.new.success', :email_template_name => @email_template.name)\n format.html { redirect_to(edit_email_template_url(@email_template)) }\n format.xml { render :xml => @email_template, :status => :created, :location => @email_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @email_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show_template_params\n params.require(:show_template).permit(:name, :dow, :showtime, :calltime, :group_id, skill_ids: [])\n end",
"def questionnaire_template_params\n params.require(:questionnaire_template).permit(:name, :qt_type_id, :instructions, :comments)\n end",
"def track_template_params\n params.require(:track_template).permit(:name, :order, :course_id, :description)\n end",
"def create\n @email_template = EmailTemplate.new(email_template_params)\n @email_template.org_id = @active_org.id\n\n respond_to do |format|\n if @email_template.save\n format.html { redirect_to email_templates_path, notice: 'Email template was successfully created.' }\n format.json { render :show, status: :created, location: @email_template }\n else\n format.html { render :new }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:identifier, :title, :help, :publisher, :variables, :payload, :memory, :count, :last_execute_at, :created_at, :updated_at, :method, :content,:uri, :cache, :checked, :headers, :delimiter, :host, :port, :database, :username, :password, :query, :selectors, :server, :to, :cc, :bcc, :subject, :message)\n end"
] |
[
"0.6356242",
"0.6261244",
"0.6189218",
"0.61683726",
"0.60694146",
"0.60101485",
"0.59717405",
"0.5919194",
"0.5919087",
"0.59183186",
"0.5911822",
"0.5900967",
"0.5896168",
"0.5880846",
"0.58708686",
"0.5852473",
"0.5828609",
"0.5827926",
"0.5781348",
"0.5766396",
"0.5756258",
"0.572977",
"0.572239",
"0.57161295",
"0.57124877",
"0.57071173",
"0.56980485",
"0.569426",
"0.56894624",
"0.5685912",
"0.5683816",
"0.5672375",
"0.566023",
"0.5656608",
"0.5644839",
"0.56373227",
"0.5632602",
"0.5614981",
"0.56062245",
"0.5596037",
"0.55812335",
"0.55811805",
"0.55811375",
"0.5580241",
"0.556738",
"0.5564253",
"0.5562909",
"0.55565786",
"0.554934",
"0.554528",
"0.55397284",
"0.55391634",
"0.55321693",
"0.55235684",
"0.55235684",
"0.55235684",
"0.55225736",
"0.5505241",
"0.5497257",
"0.54962116",
"0.5485891",
"0.54853785",
"0.54838413",
"0.54709846",
"0.5470388",
"0.5469297",
"0.5469049",
"0.5468726",
"0.5452336",
"0.54522926",
"0.54476535",
"0.54391205",
"0.5436054",
"0.5423999",
"0.5417311",
"0.54131556",
"0.5410781",
"0.5409726",
"0.5409411",
"0.5409221",
"0.54035366",
"0.54031926",
"0.5402894",
"0.54001796",
"0.5399675",
"0.5396318",
"0.53913856",
"0.53790194",
"0.5376837",
"0.5375648",
"0.5372578",
"0.53693986",
"0.5369172",
"0.53623873",
"0.53519094",
"0.5349436",
"0.53480595",
"0.53354436",
"0.5335045",
"0.5331959"
] |
0.70198846
|
0
|
PUT /purchase_templates/1 PUT /purchase_templates/1.json
|
def update
@purchase_template = PurchaseTemplate.find(params[:id])
respond_to do |format|
if @purchase_template.update_attributes(params[:purchase_template])
format.html { redirect_to @purchase_template, notice: 'Purchase template was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @purchase_template.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @purchase_template = PurchaseTemplate.new(params[:purchase_template])\n\n respond_to do |format|\n if @purchase_template.save\n format.html { redirect_to @purchase_template, notice: 'Purchase template was successfully created.' }\n format.json { render json: @purchase_template, status: :created, location: @purchase_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template\n @template = Spree::Template.find(params[:id])\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # put\n end",
"def update\n @invoice_template = InvoiceTemplate.find(params[:id])\n\n respond_to do |format|\n if @invoice_template.update_attributes(params[:invoice_template])\n format.html { redirect_to @invoice_template, notice: 'Invoice template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(name, html_url, zip_url, screenshot_url)\n options = { :body => { \n :Name => name,\n :HtmlPageURL => html_url,\n :ZipFileURL => zip_url,\n :ScreenshotURL => screenshot_url }.to_json }\n response = CreateSend.put \"/templates/#{template_id}.json\", options\n end",
"def template_params\n params.require(:template).permit(:name, :description, :template_type, :accounting_plan, :accounting_plan_id)\n end",
"def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end",
"def update\n update_elements if elements_params.present?\n @template.update(name: template_params[:name]) if template_params[:name].present?\n\n if @template.errors.empty?\n render :show, status: :ok, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end",
"def template_update(id, type, filename)\n check_id_or_raise id\n check_template_type_or_raise type\n check_filename_or_raise filename\n response = http_request_multipart :put, @base_url + \"/templates/#{id}.xml\", 200,\n { :provider_key => @provider_key,\n :draft => File.read(filename), \n :multipart => true}\n puts 'at update call'\n _id, _updated_at = parse_response response, type\n response = http_request :put, \"#{@base_url}/templates/#{id}/publish\", 200,\n { :params => { :provider_key => @provider_key } }\n puts 'at publish call'\n parse_response response, 'page'\n end",
"def purchase_template(template_id)\n return false unless can_purchase_templates?\n\n # Copy data from Template\n template = GspTemplate.find(template_id)\n OrganizationTemplate.create :agency => template.agency, :description => template.description,\n :display_name => template.display_name, :frequency => template.frequency,\n :full_name => template.full_name, :objectives => template.objectives,\n :regulatory_review_name => template.regulatory_review_name,\n :purchased_by => self, :organization => self.organization,\n :tasks => template.tasks\n end",
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def set_templates(name, templates)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n raise('wrong type: String required') unless templates.is_a?(String)\n raise('wrong value: templates must be valid') unless !templates.nil? && !templates.empty?\n\n @client.post({\n 'action' => 'settemplate',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [name, templates],\n }.to_json)\n end",
"def destroy\n @purchase_template = PurchaseTemplate.find(params[:id])\n @purchase_template.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_templates_url }\n format.json { head :no_content }\n end\n end",
"def update(name, html_url, zip_url)\n options = { :body => {\n :Name => name,\n :HtmlPageURL => html_url,\n :ZipFileURL => zip_url }.to_json }\n put \"/templates/#{template_id}.json\", options\n end",
"def update(id, values, update_published = false)\n @client.call(method: :put, path: \"templates/#{id}\", body_values: values, query_values: { update_published: update_published })\n end",
"def update\n @inventory_template = InventoryTemplate.find(params[:id])\n # @inventory_template.restaurant = current_owner.restaurant\n\n respond_to do |format|\n if @inventory_template.update_attributes(params[:inventory_template])\n format.html { redirect_to @inventory_template, notice: 'Inventory template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @exercise_template = ExerciseTemplate.find(params[:id])\n\n if @exercise_template.update(exercise_template_params)\n head :no_content\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @item_template.update(item_template_params)\n format.html { redirect_to @item_template, notice: 'Item template was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_template }\n else\n format.html { render :edit }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end",
"def new\n @purchase_template = PurchaseTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_template }\n end\n end",
"def update_template(key, value)\n t = { key => value }\n raw = read_attribute(\"template\") \n d = raw.nil? ? {} : JSON.parse(raw) \n merged = d.deep_merge(t)\n self.template = JSON.generate(merged)\n self.save!\n end",
"def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @template_content = args[:template_content] if args.key?(:template_content)\n @template_name = args[:template_name] if args.key?(:template_name)\n @template_type = args[:template_type] if args.key?(:template_type)\n end",
"def update\n Spree::Template.update_all(:selected => false)\n @template = Spree::Template.find(params[:id])\n @template.selected = true\n @template.theme_color = params[:template][:theme_color]\n @template.variant_display_type = params[:template][:variant_display_type]\n @template.is_allowed_custom_theme = params[:template][:is_allowed_custom_theme]\n \n respond_to do |format|\n if @template.save!\n format.html { redirect_to admin_templates_path, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"#{@template.errors.full_messages.first}\"\n format.html { redirect_to admin_templates_path }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def populate_template( template_id, imported_template )\n puts \"Populating new tempalte id: #{template_id}...\"\n\n uri = URI(@config['endpoint']+\"/#{template_id}/versions\")\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Post.new( uri.request_uri, initheader = {'Content-Type:' => 'application/json'} )\n request.basic_auth(@secondary_username, @secondary_password)\n\n\n # If versions exist, transfer each to new template\n imported_template['versions'].each do |version|\n version.delete(\"id\")\n version.delete(\"user_id\")\n version.delete(\"template_id\")\n version.delete(\"updated_at\")\n\n puts \" Adding template version #{version['name']}...\"\n payload = version.to_json\n request.body = payload\n response = http.request( request )\n response_message = JSON.parse( response.body )\n end\n end",
"def create\n @invoice_template = InvoiceTemplate.new(params[:invoice_template])\n\n respond_to do |format|\n if @invoice_template.save\n format.html { redirect_to @invoice_template, notice: 'Invoice template was successfully created.' }\n format.json { render json: @invoice_template, status: :created, location: @invoice_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n current_site.grid_templates.find(params[:id]).update(params.require(:grid_template).permit(:name, :description))\n index\n end",
"def update\n puts template_params\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_template\n self.template = \"template 14231\"\n end",
"def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to email_templates_path, notice: 'template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_template.update(product_template_params)\n format.html { redirect_to @product_template, notice: 'Product template was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_template }\n else\n format.html { render :edit }\n format.json { render json: @product_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item_template.update(item_template_params)\n format.html { redirect_to @item_template, notice: 'Item Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @logistic_order_template.update(logistic_order_template_params)\n render :show, status: :ok, location: @logistic_order_template\n else\n render json: @logistic_order_template.errors, status: :unprocessable_entity\n end\n end",
"def set_item_template\n @item_template = ItemTemplate.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @policy_template.update(policy_template_params)\n format.html { redirect_to @policy_template, notice: 'Policy template was successfully updated.' }\n format.json { render :show, status: :ok, location: @policy_template }\n else\n format.html { render :edit }\n format.json { render json: @policy_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def orgn_template_update\n @event.template_id = params[:template_id]\n\n if !params[:template_id]\n #redirect_to orgn_template_events_path, :flash => { :error => 'Select a template.' }\n flash[:alert] = 'Select a template.'\n render :action => :orgn_template\n return\n end\n \n @event.template_id = @event.template_id\n \n respond_to do |format|\n if @event.update(template_params)\n format.html { redirect_to event_invite_events_path }\n format.json { head :no_content }\n else\n format.html { redirect_to event_invite_events_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @mytemplate = Mytemplate.get(params[:id])\n \n @mytemplate.name = params[:mytemplate][:name]\n @mytemplate.folder = params[:mytemplate][:folder]\n @mytemplate.description = params[:mytemplate][:description]\n \n respond_to do |format|\n if @mytemplate.save\n format.html { redirect_to mytemplates_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mytemplate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @induction_template.update(induction_template_params)\n format.html { redirect_to @induction_template, notice: 'Induction template was successfully updated.' }\n format.json { render :show, status: :ok, location: @induction_template }\n else\n format.html { render :edit }\n format.json { render json: @induction_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @survey_item_template.update(survey_item_template_params)\n format.html { redirect_to @survey_item_template.survey_item_category_template.survey_template, notice: 'Survey item template was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_item_template }\n else\n format.html { render :edit }\n format.json { render json: @survey_item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gift_template = GiftTemplate.find(params[:id])\n\n respond_to do |format|\n if @gift_template.update_attributes(params[:gift_template])\n format.html { redirect_to gift_templates_path, notice: 'Gift template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_course_template(org_unit_id, new_data)\n # Define a valid, empty payload and merge! with the new data.\n payload = {\n 'Name' => '', # String\n 'Code' => 'off_SEMESTERCODE_STARNUM', # String\n }.merge!(new_data)\n puts \"Updating course template #{org_unit_id}\"\n check_course_template_updated_data_validity(payload)\n # ap payload\n # requires: CourseTemplateInfo JSON block\n # Define a path referencing the courses path\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/\" + org_unit_id.to_s\n _put(path, payload)\n puts '[+] Course template update completed successfully'.green\nend",
"def update\n @templates = EmailTemplate.find(:all) \n @email_template = EmailTemplate.find(params[:id])\n @page_title = t('email_templates.new.title', :email_template_name => @email_template.name) \n respond_to do |format|\n if @email_template.update_attributes(params[:email_template])\n flash[:notice] = t('email_templates.new.success', :email_template_name => @email_template.name)\n format.html { redirect_to(edit_email_template_url(@email_template)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end",
"def create\n @template = Spree::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @template.update(template_params)\n handle_save_success @template, :ok, t('templates.update_success')\n else\n handle_save_error @template.errors, :edit\n end\n end",
"def set_item_template\n @item_template = ItemTemplate.find(params[:id])\n end",
"def upload_templates(templates, bucket)\n templates.each do |path|\n puts \"Uploading #{path} to #{bucket}/#{path}\"\n template = JSON.parse(File.open(path).read)\n\n @s3.put_object(\n acl: \"authenticated-read\",\n body: JSON.pretty_generate(template),\n bucket: bucket,\n key: path)\n end\n end",
"def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template\n tid = Integer(params[:id]) rescue nil\n if tid\n @template = Template.find_by_id(tid)\n else\n @template = Template.find_by_name(params[:id])\n end\n respond_err \"template\", @templates, \"i18> Template #{params[:id]} not found\" unless @template\n end",
"def show\n @purchase_template = PurchaseTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_template }\n end\n end",
"def update\n respond_to do |format|\n if @track_template.update(track_template_params)\n format.html { redirect_to @track_template, notice: 'Track template was successfully updated.' }\n format.json { render :show, status: :ok, location: @track_template }\n else\n format.html { render :edit }\n format.json { render json: @track_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @_template = @site.templates.find(params[:id])\n @_template.updated_by = current_user\n\n respond_to do |format|\n if @_template.update_attributes(params[:template])\n flash[:notice] = \"Template was successfully updated.\"\n format.html { redirect_to([:admin, @site, @_template]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_product_template\n @product_template = ProductTemplate.find(params[:id])\n end",
"def update\n @template = CustomTemplate.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n\t\tformat.html { redirect_to(\"/custom_templates/\" + @template.id.to_s + \"/edit\", :notice => 'CustomTemplate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to template_path(@template), notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.fetch(:template, {}).permit([:title, :data])\n end",
"def template_params\n params.require(:template).permit(:subject, :body, :merchant_id, :created_by, :last_updated_by)\n end",
"def update\n respond_to do |format|\n if @request_template.update(request_template_params)\n respond format, 'Request template was successfully updated.'\n else\n format.html { render :edit }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @custom_template.update custom_template_params\n redirect_to @custom_template\n else\n render 'edit'\n end\n end",
"def update\n\n respond_to do |format|\n if @template.update(template_params)\n params[:template_fields].each do |p|\n # name: p[0], val: p[1]\n field = Field.find_by(:code => p[0])\n tf = TemplateField.find_by(:field_id => field.id, :template_id => @template.id)\n tf.val = p[1]\n tf.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_updated') }\n else\n format.html { render :edit}\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name)\n end",
"def update\n respond_to do |format|\n if @survey_template.update(survey_template_params)\n format.html { redirect_to @survey_template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_template }\n else\n @record = @survey_template\n format.html { render :edit }\n format.json { render json: @survey_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @country = args[:country] if args.key?(:country)\n @template_name = args[:template_name] if args.key?(:template_name)\n @test_order = args[:test_order] if args.key?(:test_order)\n end",
"def update\n authorize! :manage, :all\n respond_to do |format|\n if @question_template.update(question_template_params)\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully updated.'\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def template_params\n params.require(:template).permit(:name, :action)\n end",
"def update\n respond_to do |format|\n if @my_template.update(my_template_params)\n format.html { redirect_to @my_template, notice: 'My template was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_template }\n else\n format.html { render :edit }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template\n Settings.reload!\n @template = Template.find(params[:id])\n end",
"def update\n restricted\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end",
"def update\n @region = RegionTemplate.find(params[:id])\n\n respond_to do |format|\n if @region.update_attributes(params[:region_template])\n format.html { redirect_to(@region, :notice => 'Region was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @region.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_template.update(event_template_params)\n format.html { redirect_to @event_template, notice: \"Event template was successfully updated.\" }\n format.json { render :show, status: :ok, location: @event_template }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @event_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def guardian_update_enrollment_verification_templates(body)\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty?\n\n path = \"#{guardian_factors_path}/sms/templates\"\n put(path, body)\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def set_template\n @template = Template.find(params[:id])\n end",
"def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end",
"def edit\n template = Template.includes(:org, :phases).find(params[:id])\n authorize template\n # Load the info needed for the overview section if the authorization check passes!\n phases = template.phases.includes(sections: { questions: :question_options })\n .order('phases.number',\n 'sections.number',\n 'questions.number',\n 'question_options.number')\n .select('phases.title',\n 'phases.description',\n 'phases.modifiable',\n 'sections.title',\n 'questions.text',\n 'question_options.text')\n if template.latest?\n render 'container', locals: {\n partial_path: 'edit',\n template: template,\n phases: phases,\n referrer: get_referrer(template, request.referer)\n }\n else\n redirect_to org_admin_template_path(id: template.id)\n end\n end",
"def update\n @contract_template = ContractTemplate.find(params[:id])\n\n respond_to do |format|\n if @contract_template.update_attributes(params[:contract_template])\n format.html { redirect_to(@contract_template, :notice => 'ContractTemplate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n if @question_template.update(question_template_params)\n format.html { redirect_to @question_template, notice: 'Question template was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_template }\n else\n format.html { render :edit }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @email_template = EmailTemplate.find(params[:id])\n\n respond_to do |format|\n if @email_template.update_attributes(params[:email_template])\n format.html { redirect_to email_templates_path, notice: 'Email template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize @service_template\n\n respond_to do |format|\n if @service_template.update(service_template_params)\n format.html { redirect_to service_template_path(@service_template), notice: 'Service template was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_template }\n else\n format.html { render :edit }\n format.json { render json: @service_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user = current_user\n if @user.commission_request_template_json.nil? \n @user.commission_request_template_json = {\"categories\" => []}.to_json\n end\n json = build_json_from_params \n @user.commission_request_template_json = nil\n @user.save\n @user.commission_request_template_json = json\n if @user.save\n flash[:notice] = \"Commission Template Saved!\"\n else\n flash[:alert] = \"Error Saving Template\"\n end \n redirect_to root_url\n end",
"def update\n @quest_template = QuestTemplate.find(params[:id])\n\n respond_to do |format|\n if @quest_template.update_attributes(params[:quest_template])\n flash[:notice] = 'QuestTemplate was successfully updated.'\n format.html { redirect_to(@quest_template) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quest_template.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = ItemTemplate.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item_template])\n format.html { redirect_to(@item, :notice => 'Item was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @email_template = EmailTemplate.find(params[:id])\n\n respond_to do |format|\n if @email_template.update_attributes(params[:email_template])\n format.html { redirect_to @email_template, notice: 'Email template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n \n #@template.creator = current_user.id\n if @template.update(template_params)\n @template.creator=current_user.id\n @template.save\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @docu_template.update(docu_template_params)\n format.html { redirect_to @docu_template, notice: 'Docu sign was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docu_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @site.setup_template_capacities\n order_template_capacities\n respond_to { |format| format.html }\n end",
"def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item template was successfully created.' }\n format.json { render :show, status: :created, location: @item_template }\n else\n format.html { render :new }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_template\n @template = Template.find(params[:id])\n\n rescue ActiveRecord::RecordNotFound\n head 404\n end",
"def create\n @exercise_template = ExerciseTemplate.new(exercise_template_params)\n\n if @exercise_template.save\n render json: @exercise_template, status: :created, location: @exercise_template\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end"
] |
[
"0.63873535",
"0.621092",
"0.61192244",
"0.6111065",
"0.5955919",
"0.5936143",
"0.5934081",
"0.59271586",
"0.5885969",
"0.5873962",
"0.58681446",
"0.58678555",
"0.5860224",
"0.5846383",
"0.582313",
"0.5819126",
"0.58014965",
"0.5798079",
"0.57956415",
"0.578678",
"0.5750142",
"0.57499194",
"0.5741516",
"0.5738716",
"0.5732155",
"0.5719422",
"0.57126915",
"0.5702297",
"0.5699764",
"0.5693369",
"0.56858957",
"0.5678011",
"0.56656885",
"0.56477153",
"0.5645912",
"0.5642777",
"0.56412023",
"0.5626804",
"0.5613403",
"0.55977917",
"0.5592035",
"0.55847144",
"0.5579213",
"0.5576287",
"0.5575474",
"0.5565964",
"0.55646783",
"0.5558112",
"0.5548234",
"0.5533509",
"0.55320865",
"0.55320865",
"0.55204827",
"0.5516138",
"0.55036396",
"0.55016017",
"0.5495575",
"0.5494777",
"0.5492409",
"0.5479478",
"0.547851",
"0.5477149",
"0.54748595",
"0.54736257",
"0.54726964",
"0.5467863",
"0.5465459",
"0.5460537",
"0.5450641",
"0.54484636",
"0.5447123",
"0.54406154",
"0.5437591",
"0.5437309",
"0.543435",
"0.54242045",
"0.54242045",
"0.54242045",
"0.54242045",
"0.54242045",
"0.54242045",
"0.54242045",
"0.54242045",
"0.54184866",
"0.54181856",
"0.5413994",
"0.53875935",
"0.538547",
"0.5379097",
"0.5378106",
"0.5373079",
"0.5370253",
"0.53581107",
"0.53553575",
"0.5355329",
"0.53532493",
"0.5348398",
"0.53467953",
"0.53392905",
"0.53379923"
] |
0.68874705
|
0
|
DELETE /purchase_templates/1 DELETE /purchase_templates/1.json
|
def destroy
@purchase_template = PurchaseTemplate.find(params[:id])
@purchase_template.destroy
respond_to do |format|
format.html { redirect_to purchase_templates_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n super \"/templates/#{template_id}.json\", {}\n end",
"def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end",
"def destroy\n @invoice_template = InvoiceTemplate.find(params[:id])\n @invoice_template.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end",
"def destroy\n @inventory_template = InventoryTemplate.find(params[:id])\n @inventory_template.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend",
"def destroy\n @induction_template.destroy\n respond_to do |format|\n format.html { redirect_to induction_templates_url, notice: 'Induction template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url, notice: 'Item template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\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 @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :ok }\n end\n end",
"def delete(name)\n r = request('DeleteTemplate', { :name => name })\n return r['status'] == ' ok ' \n end",
"def destroy\n @gift_template = GiftTemplate.find(params[:id])\n @gift_template.destroy\n\n respond_to do |format|\n format.html { redirect_to gift_templates_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @emailtemplate.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @policy_template.destroy\n respond_to do |format|\n format.html { redirect_to policy_templates_url, notice: 'Policy template was successfully destroyed.' }\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 @template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_path, notice: 'template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template = set_template\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @admin_template = Template.find(params[:id])\n @admin_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discount_template = DiscountTemplate.find(params[:id])\n @discount_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(discount_templates_url) }\n format.xml { head :ok }\n end\n end",
"def delete(id)\n @client.call(method: :delete, path: \"templates/#{id}\")\n end",
"def destroy\n @purchase.destroy\n\n head :no_content\n end",
"def destroy\n @template_package.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @docu_template.destroy\n respond_to do |format|\n format.html { redirect_to docu_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @custom_pet_template.destroy\n respond_to do |format|\n format.html { redirect_to custom_pet_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_template.destroy\n respond_to do |format|\n format.html { redirect_to my_templates_url, notice: 'My template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_template(opts)\n post(\"/template/delete/#{opts[:template_id]}\")\n end",
"def destroy\n @bulk_message_template = BulkMessageTemplate.find(params[:id])\n @bulk_message_template.destroy\n\n respond_to do |format|\n format.html { redirect_to bulk_message_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @show_template.destroy\n respond_to do |format|\n format.html { redirect_back_to show_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete(data)\n result = @client.api_request(:method => \"template.delete\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\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 @contract_template = ContractTemplate.find(params[:id])\n @contract_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(contract_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @custom_template.destroy\n redirect_to custom_templates_url\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 @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 @cf_template.destroy\n respond_to do |format|\n format.html { redirect_to cf_templates_url, notice: I18n.t('cf_templates.msg.deleted') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n DNSimple::Client.delete(\"/v1/templates/#{id}\", options)\n end",
"def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_template.destroy\n respond_to do |format|\n format.html { redirect_to product_templates_url, notice: 'Product template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n audit(@service_template, \"destroy\", @service_template.name)\n authorize @service_template\n\n @service_template.destroy\n respond_to do |format|\n format.html { redirect_to service_templates_url, notice: 'Service template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @newsletters_template = Newsletters::Template.find(params[:id])\n @newsletters_template.destroy\n\n respond_to do |format|\n format.html { redirect_to newsletters_templates_url }\n format.json { head :no_content }\n end\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 @purchases.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase deleted with success.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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 destroy\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_path, notice: t('template_destroyed') }\n end\n\n end",
"def destroy\n @page_template = PageTemplate.find(params[:id])\n @page_template.destroy\n\n respond_to do |format|\n format.html { redirect_to page_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @attr_template.destroy\n respond_to do |format|\n format.html { redirect_to attr_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url, notice: 'Email template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template.destroy\n end",
"def destroy\n @inspection_template.destroy\n respond_to do |format|\n format.html { redirect_to inspection_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @survey_template.destroy\n respond_to do |format|\n format.html { redirect_to organization_survey_templates_url(@organization), notice: 'Survey was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @meal_template.destroy\n respond_to do |format|\n format.html { redirect_to meal_templates_url, notice: 'Meal template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_request.destroy\n respond_to do |format|\n format.html { redirect_to purchase_requests_url, notice: 'Purchase request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @review_template.destroy\n respond_to do |format|\n format.html { redirect_to review_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @email_template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url, notice: 'Email template was destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n mytemplate = Mytemplate.get(params[:id])\n close_document(mytemplate)\n \n begin\n if mytemplate != nil\n if File.exist?(mytemplate.path) \n FileUtils.rm_rf mytemplate.path\n end\n \n if File.exist?(mytemplate.file_path+mytemplate.id.to_s) \n FileUtils.rm_rf mytemplate.file_path+mytemplate.id.to_s\n end\n\n end\n rescue\n puts_message \"Error! in progress of mytemplate file deletion.\"\n end\n\n mytemplate.destroy\n \n respond_to do |format|\n format.html { redirect_to(mytemplates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rcadmin_email_template.destroy\n respond_to do |format|\n\t flash[:notice] = 'Email template was successfully deleted.'\n format.html { redirect_to rcadmin_email_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crawler_template = CrawlerTemplate.find(params[:id])\n @crawler_template.destroy\n\n respond_to do |format|\n format.html { redirect_to crawler_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :manage, :all\n @question_template.destroy\n respond_to do |format|\n format.html { redirect_to question_templates_url, notice: 'Question template was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @goaltemplate = Goaltemplate.find(params[:id])\n @goaltemplate.destroy\n\n respond_to do |format|\n format.html { redirect_to(goaltemplates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @region = RegionTemplate.find(params[:id])\n @region.destroy\n\n respond_to do |format|\n format.html { redirect_to(region_templates_url) }\n format.xml { head :ok }\n end\n end",
"def delete(data)\n result = @client.api_request(:method => \"template.delete\", :params => [:templateid => data])\n result.empty? ? nil : result['templateids'][0].to_i\n end",
"def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to(templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @questionnaire_template.destroy\n respond_to do |format|\n format.html { redirect_to questionnaire_templates_url, notice: 'questionnaire template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nagios_service_escalation_template = NagiosServiceEscalationTemplate.find(params[:id])\n @nagios_service_escalation_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(nagios_service_escalation_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @_template = @site.templates.find(params[:id])\n @_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_site_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = ItemTemplate.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n destroy_resource @template, templates_url, t('templates.delete_success')\n end",
"def destroy\n @deposit_template = current_user.family.deposit_templates.find(params[:id])\n @deposit_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(deposit_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @post_template.destroy\n respond_to do |format|\n format.html { redirect_to post_templates_url, notice: 'Post template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_purchases_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @invitation_template.destroy\n respond_to do |format|\n format.html { redirect_to invitation_templates_url, notice: 'Invitation template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest_template = QuestTemplate.find(params[:id])\n \n begin\n @quest_template.quest_giver.destroy\n @quest_template.quest_involver.destroy\n rescue Exception => e\n end\n @quest_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(quest_templates_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end",
"def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end",
"def destroy\n @config_template = ConfigTemplate.find(params[:id])\n json=@config_template.to_json\n xml=@config_template.to_xml\n\n @config_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_templates_url) }\n format.json { render :json => json }\n format.xml { render :xml => xml }\n end\n end",
"def destroy\n survey_template = @survey_item_template.survey_item_category_template.survey_template\n @survey_item_template.destroy\n respond_to do |format|\n format.html { redirect_to polymorphic_path([survey_template.surveyable, survey_template]), notice: 'Survey item template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @project_template = ProjectTemplate.find(params[:id])\n @project_template.destroy\n\n respond_to do |format|\n format.html { redirect_to project_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: t(\"activerecord.models.purchase\") + t(\"messages.successfully_destroyed\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @template_cate.destroy\n respond_to do |format|\n format.html { redirect_to template_cates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n @purchase_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_path(@purchase) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @print_template = PrintTemplate.find(params[:id])\n @print_template.destroy\n\n respond_to do |format|\n format.html { redirect_to print_templates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end"
] |
[
"0.7832097",
"0.74690986",
"0.7395878",
"0.71783584",
"0.7145888",
"0.7102929",
"0.7047544",
"0.6977394",
"0.69690007",
"0.6961701",
"0.69601715",
"0.69389844",
"0.6924059",
"0.6904915",
"0.6900637",
"0.68830615",
"0.6869523",
"0.6860889",
"0.68577814",
"0.6842971",
"0.6840577",
"0.6821111",
"0.6821111",
"0.68013954",
"0.677691",
"0.6776325",
"0.67708576",
"0.6769186",
"0.6768272",
"0.6761831",
"0.6756847",
"0.6756074",
"0.6755884",
"0.67551005",
"0.6741961",
"0.6741961",
"0.6741961",
"0.6741961",
"0.6741961",
"0.6740873",
"0.6733531",
"0.67313963",
"0.67297363",
"0.67297363",
"0.6720432",
"0.67196196",
"0.67196196",
"0.67196196",
"0.67175215",
"0.67075133",
"0.6696348",
"0.66858757",
"0.66787064",
"0.66770643",
"0.6674145",
"0.66726416",
"0.6669708",
"0.66686004",
"0.66682154",
"0.6666585",
"0.6664662",
"0.6661477",
"0.6657573",
"0.6651996",
"0.6651735",
"0.66509706",
"0.665097",
"0.6645414",
"0.6643017",
"0.6643017",
"0.6643017",
"0.6643017",
"0.66412824",
"0.6634738",
"0.66253763",
"0.66201067",
"0.6609323",
"0.6607784",
"0.6604742",
"0.6602059",
"0.6599277",
"0.6597988",
"0.65903956",
"0.6588031",
"0.6587148",
"0.65840715",
"0.6579828",
"0.65773237",
"0.65752596",
"0.6572449",
"0.6559021",
"0.6557399",
"0.65573055",
"0.6552069",
"0.6549876",
"0.65479237",
"0.65418386",
"0.65394205",
"0.6531935",
"0.6530374"
] |
0.7988417
|
0
|
A callback initiated after successfully authenticating. This can be used to insert your own logic that is only run after the user successfully authenticates.
|
def after_custom_authentication
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def after_custom_authentication; end",
"def callback\n rpx_auth\n after_auth(params[:on_complete_url])\n end",
"def callback\n # This stores all the user information that came from Auth0\n # and the IdP\n userinfo = request.env['omniauth.auth']\n\n begin\n result = SessionService.process!(userinfo, session)\n\n if result.new_user?\n redirect_to welcome_path\n else\n # Redirect to the URL you want after successful auth\n redirect_to services_path,\n flash: {\n success: I18n.t(:welcome_html, scope: [:auth, :existing_user])\n }\n end\n rescue SignupNotAllowedError\n # no new user or existing user, so they weren't allowed to sign up\n redirect_to signup_not_allowed_path\n end\n end",
"def after_login(&block)\n add_callback(:login, block)\n end",
"def authentication_succeed(oidresp)\n end",
"def callback\n @user = User.find_by_hash(auth_hash)\n if @user\n login(@user)\n redirect_to \"/\" and return\n else\n # We store the authorization so that the user cannot modify\n # the provider/uid details in the form\n @authorization = Authorization.create_from_hash(auth_hash)\n session[:auth_id] = @authorization.id\n @user = User.new_from_hash(auth_hash)\n end\n end",
"def after_crowd_authentication\n end",
"def on_success(&block)\n apply_hook(:success, &block)\n end",
"def callback\n auth = build_auth\n respond_to do |format|\n if logged_in?\n add_identity_to_current_user(auth)\n welcome_user(current_user)\n format.html { redirect_logged_in_user }\n format.json { render_jsend_success(:logged_in) }\n else\n user = find_or_create_user_from_auth(auth)\n if user\n user.remember_me! if session.delete(:remember_me)\n if user.connected?\n setup_new_user(user, auth)\n format.html { redirect_to_signup_flow_entry_point }\n format.json { render_jsend_success(:connected, new_profile_data(user, auth)) }\n elsif user.registered?\n setup_existing_user(user)\n format.html { redirect_after_onboarding_check(user, request.env['omniauth.origin']) }\n format.json { render_jsend_success(:registered) }\n else\n notify_visitor_user_creation_failed(user)\n format.html { redirect_after_auth(request.env['omniauth.origin'] || login_path) }\n format.json { render_jsend(error: :user_creation) }\n end\n else\n format.html { redirect_to(login_path) }\n format.json { render_jsend(error: :no_user) }\n end\n end\n end\n end",
"def successfully_authenticated\n unless self.ok == true\n self.errors.add(:ok, \"Response must include ok true!\")\n end\n end",
"def pre_authorize_cb; end",
"def successful_authentication(user)\n set_brute_force_counter(user, 0)\n super\n end",
"def controller_account_success_authentication_after(context={})\n context[:controller].flash[:kittens] = \"Yay! Welcome #{context[:user].firstname}!\"\n end",
"def after_token_authentication\n end",
"def after_token_authentication\n end",
"def auth_succeeded( request, credentials )\n\t\tself.log.info \"Authentication for %p succeeded.\" % [ credentials ]\n\t\t# No-op by default\n\tend",
"def pre_authorize_cb=(_arg0); end",
"def after_database_authentication; end",
"def callback_phase\n ym_session_id = env['rack.session'][RACK_SESSION_KEY]\n fail!(E_YM_SESSION_ID_BLANK) if ym_session_id.blank?\n ym_session = YourMembership::Session.new(ym_session_id, 100)\n\n begin\n fail! 'Failed To Log In' unless ym_session.authenticated?\n rescue YourMembership::Error => e\n fail! e.error_description\n end\n\n @user_id = ym_session.user_id\n @access_token = ym_session.to_s\n\n super\n end",
"def callback_phase\n @auth_token = get_auth_token(request.params[\"username\"], request.params[\"sid\"])\n @user_info = get_user_info(request.params[\"username\"], @auth_token)\n ap @user_info\n super\n rescue => ex\n fail!(\"Failed to retrieve user info from ebay\", ex)\n end",
"def after_hash_token_authentication\n end",
"def authentication_successful?\n current_user.present?\n end",
"def user_verification?; end",
"def after_successful_token_authentication\n @user = current_user\n end",
"def callback_phase\n @user_info = get_user(@auth_token = fetch_auth_token(session['omniauth.ebay.session_id']))\n super\n end",
"def on_success( &block )\n @on_success = block\n end",
"def user_verified?; end",
"def verify_callback; end",
"def verify_callback; end",
"def auth_after\n url = session[:auth_redirect] || root_path\n redirect_to url\n end",
"def auth_ok(*args, &blk)\n block_given? ? @auth_ok_cbs << blk : @auth_oks.push(args)\n while (ok_data = @auth_oks.shift)\n @auth_ok_cbs.each { |cb| cb.call(*ok_data) }\n end\n end",
"def on_success(&block)\n @handlers[:success] = block\n self\n end",
"def authentication_response_status\n authenticate_user.success? ? :ok : :unauthorized\n end",
"def successful_login!\n unthrottle_user\n clear_bad_login_counter\n end",
"def auth_success_redirect(path = nil, user: nil, message: nil, **opt)\n set_flash_notice(message, **opt) if message.present?\n path ||= after_sign_in_path_for(user || resource)\n redirect_to path\n end",
"def authentication_successful?\n @user.present?\n end",
"def on_success!(response, sreg_response)\n if user = find_user_by_identity_url(response.identity_url)\n user\n else\n request.session[:'openid.url'] = response.identity_url\n required_reg_fields.each do |f|\n session[:\"openid.#{f}\"] = sreg_response.data[f] if sreg_response.data[f]\n end if sreg_response\n redirect!(Merb::Router.url(:signup))\n end\n end",
"def on_success(&block); end",
"def callback\n\t\tself.twitagent.exchange_request_for_access_token( session[:request_token], session[:request_token_secret], params[:oauth_verifier] )\n\t\t\n\t\tuser_info = self.twitagent.verify_credentials\n\t\t\n\t\t#raise OauthSystem::RequestError unless user_info['id'] && user_info['screen_name'] && user_info['profile_image_url']\n\t\t\n\t\t# We have an authorized user, save the information to the database.\n\t\t@user = User.find_by_screen_name(user_info['screen_name'])\n\t\tif @user\n\t\t\t@user.token = self.twitagent.access_token.token\n\t\t\t@user.secret = self.twitagent.access_token.secret\n\t\t\t@user.profile_image_url = user_info['profile_image_url']\n\t\telse\n\t\t\t@user= User.new({ \n\t\t\t\t:twitter_id => user_info['id'],\n\t\t\t\t:screen_name => user_info['screen_name'],\n\t\t\t\t:token => self.twitagent.access_token.token,\n\t\t\t\t:secret => self.twitagent.access_token.secret,\n\t\t\t\t:profile_image_url => user_info['profile_image_url'] })\n\t\tend\n\t\tif @user.save!\n\t\t\tself.current_user = @user\n\t\telse\n\t\t\traise OauthSystem::RequestError\n\t\tend\n\t\t# Redirect to the show page\n\t\tredirect_to user_path(@user)\n\t\t\n\trescue\n\t\t# The user might have rejected this application. Or there was some other error during the request.\n\t\tRAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n\t\tflash[:error] = \"Twitter API failure (account login)\"\n\t\tredirect_to root_url\n\tend",
"def callback\n\n\n # Access the authentication hash for omniauth\n data = request.env['omniauth.auth']\n\n # Temporary for testing!\n render json: data.to_json\n\n\n # Access the authentication hash for omniauth\n # data = request.env['omniauth.auth']\n\n # microsoft_email_address = data.dig(:extra, :raw_info, :mail) || data.dig(:extra, :raw_info, :userPrincipalName)\n\n # if user_account = UserAccount.find_by(email: microsoft_email_address)\n # session[:user_account_id] = user_account.id\n # if session[:previously_requested_page]\n # last_page = session[:previously_requested_page]\n # session.delete(:previously_requested_page)\n # redirect_to last_page\n # else\n # redirect_to root_path\n # end\n # else\n # redirect_to new_session_path, notice: \"An account could not be found for #{microsoft_email_address}.\"\n # end\n end",
"def user_verified; end",
"def user_authentication\n end",
"def authentication_succeeded(message = 'You have logged in successfully.', destination = '/followees')\n flash[:notice] = message\n redirect_back_or_default destination\n end",
"def valid_for_authentication?; end",
"def valid_for_authentication?; end",
"def user_verification; end",
"def complete\n response = consumer.complete(params)\n \n case response.status\n when OpenID::SUCCESS\n\n @user = User.get(response.identity_url)\n \n # create user object if one does not exist\n if @user.nil?\n @user = User.new(:openid_url => response.identity_url)\n @user.save\n end\n\n # storing both the openid_url and user id in the session for for quick\n # access to both bits of information. Change as needed.\n session[:user_id] = @user.id\n\n flash[:notice] = \"Logged in as #{CGI::escape(response.identity_url)}\"\n \n redirect_back_or_default :action => \"welcome\"\n return\n\n when OpenID::FAILURE\n if response.identity_url\n flash[:notice] = \"Verification of #{response.identity_url} failed.\"\n\n else\n flash[:notice] = 'Verification failed.'\n end\n\n when OpenID::CANCEL\n flash[:notice] = 'Verification cancelled.'\n\n else\n flash[:notice] = 'Unknown response from OpenID server.'\n end\n \n redirect_to :action => 'login'\n end",
"def on_connection_success &block\n @connection_success_callback = block\n end",
"def callback\n return unless passes_whitelist?\n session[:user_id] = User.from_omniauth(@auth_hash, current_tenant.tenant_id, unmangle_orcid).id\n redirect_to dashboard_path\n end",
"def callback\n access_token = client.web_server.get_access_token(params[:code], :redirect_uri => oauth_callback_url)\n \n current_user.update_attribute(:oauth2_token, access_token.token)\n flash[:notice] = \"Authorized successfully!\"\n \n redirect_to root_url\n end",
"def handle_successful_login(response)\n Log.success(\"success!\")\n @cookie = /session=[^;]*/.match(response.headers[\"set-cookie\"])[0]\n set_user_info\n end",
"def redirect_after_signup &blk\n self.lwt_authentication_system_options[:redirect_after_signup] = blk\n end",
"def callback\n @request_token = OAuth::RequestToken.new(TwitterauthController.consumer, session[:request_token], session[:request_token_secret])\n # Exchange the request token for an access token.\n @access_token = @request_token.get_access_token\n @response = TwitterauthController.consumer.request(:get, '/account/verify_credentials.json', @access_token, { :scheme => :query_string })\n case @response\n when Net::HTTPSuccess\n user_info = JSON.parse(@response.body)\n unless user_info['screen_name']\n flash[:notice] = \"Authentication failed\"\n redirect_to :action => :index\n return\n end\n @user = User.find_or_initialize_by_twitter_id(user_info['id'])\n if @user.new_record? || @user.twitter_token != @access_token.token\n @user.twitter_token = @access_token.token\n @user.twitter_secret = @access_token.secret\n @user.save!\n end\n # Store the user in the session\n UserSession.create(@user)\n # Redirect to the show page\n redirect_back_or_default root_url\n else\n RAILS_DEFAULT_LOGGER.error \"Failed to get user info via OAuth\"\n # The user might have rejected this application. Or there was some other error during the request.\n flash[:notice] = \"Authentication failed\"\n redirect_to login_url\n return\n end\n end",
"def authok?\n @authok\n end",
"def authok?\n @authok\n end",
"def authok?\n @authok\n end",
"def authok?\n @authok\n end",
"def authenticate\r\n if User.exists?(email: auth_params[:email])\r\n auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\r\n render json: {\r\n code: 200,\r\n success: true,\r\n message: \"Logged in Successfully\",\r\n auth_token: auth_token\r\n }\r\n else\r\n render json: {\r\n code: 400,\r\n success: false,\r\n message: \"Invalid credentials\"\r\n }\r\n end\r\n end",
"def handle_response!\n logger.debug \"Attempting OpenID auth: #{provider_response.inspect}\"\n\n case provider_response.status\n when :success\n resource = find_resource || build_resource || create_resource\n\n if resource && validate(resource)\n begin\n update_resource!(resource)\n rescue\n fail! $!\n else\n success!(resource)\n end\n else\n fail! \"This OpenID URL is not associated with any registered user\"\n end\n\n when :cancel\n fail! \"OpenID authentication cancelled\"\n when :failure\n fail! \"OpenID authentication failed\"\n end\n end",
"def after_login!(user, username = '', password = '', options = {})\n sorcery_config.after_login.each do |callback|\n send(callback, user, username, password, options)\n end\n end",
"def after_auth(user)\n # Push the avatar (Just in case any clients support it)\n # AvatarUpdaterService.new(user).update\n\n # Set rooms, groups, etc.\n UserService.update(user).save\n\n # We're done here\n sign_in_and_redirect user\n end",
"def user_verified=(_arg0); end",
"def after_successful_sign_in\n invite = current_account.claim_invitation\n if invite\n invitable = invite.invitable\n invitable_name = invitable.class.name.downcase\n anchor = '/%s/%d' % [invitable_name.pluralize, invitable.id]\n\n flash[:success] = _('%s invited you to collaborate on %s %s.') % [\n invite.user.nicename, invitable.title, invitable_name ]\n\n redirect_to root_path(:anchor => anchor)\n else\n super\n end\n end",
"def on_before_koala_success(koala_user)\n self.send(:before_koala_success, koala_user) if self.respond_to?(:before_koala_success)\n end",
"def connection_successful\n @authenticating = false\n opened!\n\n exec_callback_yielding_self(:connect)\n end",
"def do_success; end",
"def on_success(&blk)\n @on_success = blk\n @on_success.call(@response) if @response\n end",
"def authorize_user_on(lmda)\n\t\tcurrent_user = get_user_by_token\n\t\trender_unauthorized_msg unless current_user && lmda.call(current_user)\n\tend",
"def after_successful_token_authentication\n # binding.pry\n # Make the authentication token to be disposable - for example\n # renew_authentication_token!\n end",
"def before_method(request, response)\n if @current_principal\n # We already have authentication information. This means that the\n # event has already fired earlier, and is now likely fired for a\n # sub-request.\n #\n # We don't want to authenticate users twice, so we simply don't do\n # anything here. See Issue #700 for additional reasoning.\n #\n # This is not a perfect solution, but will be fixed once the\n # \"currently authenticated principal\" is information that's not\n # not associated with the plugin, but rather per-request.\n #\n # See issue #580 for more information about that.\n return nil\n end\n\n if @backends.empty?\n fail Dav::Exception, 'No authentication backends were configured on this server.'\n end\n\n reasons = []\n @backends.each do |backend|\n result = backend.check(request, response)\n\n if !result.is_a?(Array) ||\n result.size != 2 ||\n !(result[0].is_a?(TrueClass) || result[0].is_a?(FalseClass)) ||\n !result[1].is_a?(String)\n fail Dav::Exception, 'The authentication backend did not return a correct value from the check method.'\n end\n\n if result[0]\n @current_principal = result[1]\n # Exit early\n return nil\n end\n reasons << result[1]\n end\n\n # If we got here, it means that no authentication backend was\n # successful in authenticating the user.\n @current_principal = nil\n\n @backends.each do |backend|\n backend.challenge(request, response)\n end\n fail Exception::NotAuthenticated, reasons.join(', ')\n end",
"def logged_in_user\n return if logged_in?\n\n store_location\n flash[:danger] = 'Please log in first'\n render 'sessions/new', status: :unauthorized\n true # return true to indicate that this triggered things\n end",
"def callback\n # Authentication redirects here\n code = params[:code]\n\n # Used in the template\n @name = auth_hash.info.name\n @email = auth_hash.info.email\n\n # Request an access token\n result = acquire_access_token(code, ENV['REPLY_URL'])\n\n # Associate token/user values to the session\n session[:access_token] = result.access_token\n session[:name] = @name\n session[:email] = @email\n\n # Debug logging\n logger.info \"Code: #{code}\"\n logger.info \"Name: #{@name}\"\n logger.info \"Email: #{@email}\"\n logger.info \"[callback] - Access token: #{session[:access_token]}\"\n end",
"def authenticate\n if signed_in? == false\n flash.now[:error] = \"User not logged in.\"\n respond_with(flash)\n end\n end",
"def callback_phase\n raw_response = request.params.symbolize_keys[:SAMLResponse]\n raise OneLogin::RubySaml::ValidationError.new(\"SAML response missing\") unless raw_response\n\n with_settings do |settings|\n # Handle the response.\n handle_response(raw_response, settings) do\n # yield the response to the omniauth controller.\n super\n end\n end\n rescue OneLogin::RubySaml::ValidationError\n fail!(:invalid_response, $!)\n end",
"def custom_user_auth\n\t\t\tunless student_signed_in? || admin_signed_in?\n\t\t\t\tredirect_to root_path, notice: \"You have to sign in.\"\n\t\t\tend\n\t\tend",
"def after_authentication\n @initiating_url = session[:initiating_url]\n session[:initiating_url] = nil\n render :'authentication/after_authentication'\n end",
"def callback\n\t\t\n\t\t@dbsession = DropboxSession.deserialize(@@dropbox_session)\n\t\t@dbsession.get_access_token #we've been authorized, so now request an access_token\n\t\t@dropbox_session = @dbsession.serialize\n\t\tdropbox = Linkdropbox.new\n\t\tdropbox.dropbox_token = @dropbox_session\n\t dropbox.save\n\t\t#read_prices(DropboxSession.deserialize(@dropbox_session))\n\t\tflash[:success] = \"You have successfully authorized with dropbox.\"\n\n\t\tredirect_to services_show_path\n\n\t#rescue \n\t\t#session[:dropbox_session] = nil\n\t #flash[:success] = \"Failed to authorize\"\n\t\t#redirect_to services_show_path\n\n\t\t#redirect_to session[:return_to]\t\n\tend",
"def authorize_callback\n @request_token = OAuth::RequestToken.new(@oauth,\n session[:request_token], \n session[:request_token_secret])\n\n @access_token = @request_token.get_access_token(:oauth_verifier => params[:oauth_verifier])\n session[:access_token] = @access_token.token\n session[:secret_token] = @access_token.secret\n session[:user_id] = @access_token.params[\"user_id\"] rescue \"\"\n session[:screen_name] = @access_token.params[\"screen_name\"] rescue \"\"\n session[:authorized] = true\n @log.info \"authorized, user [#{session[:screen_name]}]\"\n \n if session[:redirect_to]\n url = session[:redirect_to]\n session[:redirect_to] = nil \n redirect url\n else\n redirect '/'\n end\n\n end",
"def callback_call\n setup_phase\n log :debug, 'Callback phase initiated.'\n @env['omniauth.origin'] = session.delete('omniauth.origin')\n @env['omniauth.origin'] = nil if env['omniauth.origin'] == ''\n @env['omniauth.params'] = session.delete('omniauth.params') || {}\n OmniAuth.config.before_callback_phase.call(@env) if OmniAuth.config.before_callback_phase\n callback_phase\n end",
"def authenticated?; super; end",
"def callback\n @T_OAUTH = TwitterOAuth::Client.new(:consumer_key => TWITTER_KEY, :consumer_secret => TWIITER_SECRET )\n @oauth_verifier = params[:oauth_verifier]\n access_token = @T_OAUTH.authorize(session['token'], session['secret'], auth_verifier => @oauth_verifier)\n if (@result = @T_OAUTH.authorized?)\n current_user.create_or_update_twitter_account_with_oauth_token(access_token.token, access_token.secret)\n session['token'] = nil\n session['secret'] = nil\n flash[:notice] = \"Authorize complete\"\n else\n flash[:notice] = \"Authorize failed\"\n end\n\n rescue\n flash[:notice] = \"Authorize failed\"\n end",
"def verify_callback=(verify_callback); end",
"def verify_callback=(verify_callback); end",
"def on_after_oauth2_connect(oauth2_user_attributes)\n if self.respond_to?(:after_oauth2_connect)\n self.send(:after_oauth2_connect, oauth2_user_attributes)\n end\n end",
"def after_failed_sign_in\n flash[:error] = _('Something went wrong. Please try again.')\n redirect_to root_path\n end",
"def authenticate!\n\n # mapping comes from devise base class, \"mapping.to\" is the class of the model\n # being used for authentication, typically the class \"User\". This is set by using\n # the `devise` class method in that model\n #byebug\n klass = mapping.to\n\n if request.headers['X-HC-FB-AUTH'].present?\n # the returned user object will be saved and serialised into the session\n\n decoded = Base64.decode64(request.headers['X-HC-FB-AUTH'])\n user_and_token = decoded.split(':')\n\n users = klass.includes(:identities).where(socify_identities: { uid: user_and_token[0], token: user_and_token[1], provider: \"facebook\"})\n begin\n if users.size == 1\n u = users.first\n identity = u.identities.find_by!(uid: user_and_token[0], token: user_and_token[1], provider: \"facebook\")\n if !identity.expires_at || (identity.expires_at && identity.expires_at > Time.now)\n success! u\n else\n fail! \"token expired\"\n end\n else\n fail! \"invalid uid and/or token\"\n end\n rescue\n fail!\n end\n end\n\n # if we wanted to stop other strategies from authenticating the user\n end",
"def authenticate\n redirect_to login_url, alert: 'Please log in first' if current_user.nil?\n end",
"def azure_auth\n if (email = authenticated?)\n email_pat = /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i\n unless email =~ email_pat\n flash[:alert] = \"Unknown email: #{email}\"\n redirect_to root_path\n return\n end\n user = User.where(:email => email).first\n unless user\n password = Devise.friendly_token[0,8]\n user = User.create(\n email:email,\n password:password,\n password_confirmation:password\n )\n end\n \n if user.email_confirmed?\n sign_in_and_redirect user, :event => :authentication\n else\n redirect_to root_path, :notice => I18n.t(:conf_msg, :scope => [:messages, :controllers, :invitations])\n end\n else\n flash[:alert] = \"No email found.\"\n redirect_to root_path\n end\n end",
"def authenticate\n\t\tif user_signed_in?\n\t\t\ttrue\n\t\telse\n\t\t\tredirect_to new_user_session_path, format: 'js', alert: \"please login to vote\"\n\t\tend\n\tend",
"def capable_login_auth?; end",
"def login_required\n authenticate_user! \n end",
"def default_oauth_callback(&on_fail)\n auth = request.env['omniauth.auth']\n\n @user = User.send(\"find_for_#{auth.provider.to_s}_oauth\", auth, current_user)\n unless @user.persisted?\n # save oauth data if user creation failed\n session[\"devise.#{auth.provider.to_s}_data\"] = auth.except(:extra)\n end\n auth.fail_redirect ||= new_user_registration_path\n\n unless handle_oauth_login\n if on_fail\n yield auth\n else\n default_oauth_fail\n end\n end\n end",
"def authCallback\n begin\n auth_code = params.fetch(\"code\")\n rescue KeyError\n raise \"error: no code param provided\"\n end\n\n from_sso = params.fetch(\"from_sso\", \"0\") == \"1\" \n origin = params[\"origin\"] if params.key?(\"origin\")\n\n redirect_uri_sso = URI(api_args[\"redirect_uri\"])\n redirect_uri_sso.query = URI.encode_www_form(params.select{|k, v| [\"from_sso\", \"origin\"].include? k})\n\n redirect_uri = from_sso ? redirect_uri_sso.to_s : api_args[\"redirect_uri\"]\n\n password_reset = sign_in(auth_code, redirect_uri)\n\n if from_sso\n # we got here from sso, redirect to origin(the page where user entered \n # the site)\n redirect_to origin\n elsif password_reset\n # we got here from email password reset, redirect to change password\n redirect_to \"/#{app.name}/profile_change_password\"\n else\n # since we are in an iframe, reload the parent, not the current window,\n # otherwise we will get nesting.\n render :text => \"<script>window.parent.location.reload()</script>\"\n end \n end",
"def authenticate!\n if resource = mapping.to.fb_authenticate(params[scope])\n success!(resource)\n else\n redirect!(\"/#{scope.to_s.pluralize}/facebook_connect_create\", params)\n end\n end",
"def authenticate!\n # Do nothing yet\n end",
"def authorized!\n unless current_user and current_user.email.present?\n redirect_to root_path, alert: \"You need to be logged in to view that!\" and return if !current_user\n redirect_to email_path, alert: \"To finish signing up, please supply your email address.\" and return if current_user.email.blank?\n else\n # WARNING: It is a little DB heavy to do this, but OK for low traffic.\n current_user.update_attributes(last_signed_in_at: Time.now) if !current_user.last_signed_in_at || current_user.last_signed_in_at < 1.hour.ago\n end\n end",
"def callback\n auth = env['omniauth.auth']\n\n person = Person.find_by(email: auth.info.email)\n if person\n user = User.find_by(person: person)\n if not user\n user = User.new\n user.person = person\n end\n user.oauth_token = auth.credentials.token\n user.oauth_expires_at = Time.at(auth.credentials.expires_at)\n user.save!\n\n session[:user_id] = user.id\n if person.mentees.empty? && !person.admin?\n redirect_to root_path\n else\n redirect_to '/dashboard/'\n end\n\n else\n redirect_to google_unregistered_path\n end\n end",
"def autenticathe_login!\n unless someone_is_logged_in?\n store_location\n flash[:danger] = \"Por favor, Inicie sesion.\"\n redirect_to welcome_path\n end\n end",
"def authenticate_signin\n\t Client.authenticate(params[:email], params[:password]) || render_unauthorized\n\t end",
"def auth_response\n @auth_response ||= self.authenticate\n end"
] |
[
"0.71794266",
"0.7014709",
"0.6980848",
"0.6835151",
"0.6830764",
"0.6717308",
"0.65840584",
"0.65593106",
"0.6554135",
"0.65537554",
"0.6539213",
"0.6475947",
"0.64705765",
"0.64536464",
"0.64536464",
"0.64243644",
"0.63222504",
"0.6286123",
"0.6268505",
"0.6256627",
"0.62466645",
"0.6227689",
"0.6224606",
"0.6223014",
"0.6213288",
"0.6210447",
"0.6164537",
"0.6153436",
"0.6153436",
"0.61465377",
"0.6132973",
"0.6127141",
"0.6120428",
"0.6120004",
"0.6113265",
"0.6110982",
"0.6103853",
"0.6040462",
"0.6038306",
"0.60359234",
"0.6018181",
"0.6010976",
"0.59937173",
"0.5980462",
"0.5980462",
"0.5974062",
"0.59605986",
"0.59560776",
"0.59527075",
"0.5931131",
"0.5910281",
"0.58811873",
"0.5880313",
"0.5875148",
"0.5875148",
"0.5875148",
"0.5875148",
"0.5871917",
"0.58644164",
"0.58642626",
"0.5852833",
"0.5849802",
"0.58488935",
"0.58481145",
"0.5843632",
"0.5835955",
"0.58350694",
"0.58343446",
"0.5822477",
"0.5821343",
"0.5821102",
"0.58148354",
"0.5808364",
"0.5801925",
"0.5793811",
"0.579136",
"0.57900566",
"0.5780754",
"0.57612026",
"0.575789",
"0.5755222",
"0.57543397",
"0.57543397",
"0.57365155",
"0.57308835",
"0.57305735",
"0.5729789",
"0.57258695",
"0.57137996",
"0.5706738",
"0.57059526",
"0.57014596",
"0.56938976",
"0.5686184",
"0.5681734",
"0.56801957",
"0.5678448",
"0.567276",
"0.56722116",
"0.56711847"
] |
0.7001163
|
2
|
returns two arrays that contain first half and second half of OG array, respectively if OG array conatins odd no. of elements, middle element should be placed in first array
|
def halvsies(array)
first_half = array.slice(0, (array.size / 2.0).ceil)
second_half = array.slice(first_half.size, array.size - first_half.size)
[first_half, second_half]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def halvsies(arr)\n \n left_array = []\n right_array = []\n middle_index = arr.size / 2\n if arr.size.even?\n left_array = arr[0...middle_index]\n right_array = arr[middle_index..-1]\n elsif\n left_array = arr[0..middle_index]\n right_array = arr[(middle_index + 1)..-1]\n end\n [left_array, right_array]\nend",
"def halvsies(array)\n second_half, middle_element = array.size.divmod(2)\n first_half_size = second_half + middle_element\n output_array = []\n first_half_array = []\n second_half_array = []\n\n array.each_with_index do |el, idx|\n if idx <= first_half_size - 1\n first_half_array << el\n else\n second_half_array << el\n end\n end\n\n output_array << first_half_array << second_half_array\nend",
"def merge(first_half, second_half)\n \n# empty array\n merged_array = []\n \n# while both halves have elements\n while first_half.size > 0 && second_half.size > 0 do\n \n# i think it's going to compare 0 elements\n if first_half [0] <= second_half[0]\n \n# if the first half 0 element is larger, push it onto the merged array\n# To retrieve and at the same time remove the first item, use shift\n merged_array.push(first_half.shift)\n \n elsif second_half[0] < first_half[0]\n merged_array.push(second_half.shift)\n end\n end\n\n#once only one (sorted) array remains, just add on the rest of that array\n#only one of these loops will ever run\n while first_half.size > 0 do \n merged_array.push(first_half.shift)\n end\n while second_half.size > 0 do \n merged_array.push(second_half.shift)\n end\n\n merged_array\nend",
"def halvsies(arr)\n if arr.size.odd?\n first = arr[0..(arr.size/2)]\n second = arr[(arr.size/2 + 1)..-1]\n else\n first = arr[0..(arr.size/2 - 1)]\n second = arr[(arr.size/2)..-1]\n end\n final_arr = [first, second]\nend",
"def halvsies(array)\r\n middle = (array.size / 2.0).ceil\r\n first_half = array.slice(0, middle)\r\n second_half = array.slice(middle, array.size - middle)\r\n [first_half, second_half]\r\nend",
"def first_half(array)\n\n new_arr = []\n even_arr = array.length / 2\n odd_arr = even_arr + 1\n \n i = 0\n \n if array.length % 2 == 0\n \t \n while i < even_arr\n \t \n \tnew_arr << array[i] \n i += 1\n \n end\n elsif array.length % 2 == 1\n \t\n\twhile i < odd_arr\n \t\n \tnew_arr << array[i]\n \ti += 1\n \n end\n \n end\n \n return new_arr\nend",
"def halvsies(arr)\n middle = (arr.size/2.0).ceil\n first = arr.slice(0, middle)\n second = arr.slice(middle, arr.size - middle)\n [first, second]\nend",
"def halvsies(arr)\n halfway = arr.size / 2\n halfway += 1 if arr.size.odd?\n first_half = arr[0..(halfway - 1)]\n second_half = arr[halfway..-1]\n [first_half, second_half]\nend",
"def merge_halves(left_array, right_array)\n result_array = []\n array_length = left_array.length + right_array.length\n array_length.times do\n if left_array[0].nil?\n result_array.push(right_array.slice!(0))\n elsif right_array[0].nil?\n result_array.push(left_array.slice!(0))\n elsif left_array[0] < right_array[0]\n result_array.push(left_array.slice!(0))\n else\n result_array.push(right_array.slice!(0))\n end\n end\n result_array\nend",
"def halvsies(arr)\n midpoint = arr.length.even? ? arr.length / 2 : (arr.length / 2) + 1\n arr1 = arr[0,midpoint]\n arr2 = arr[midpoint..-1]\n [arr1, arr2]\nend",
"def halvsies(array)\n first_half = []\n second_half = []\n array.each_with_index do |elem, idx|\n if idx < (array.length/2.0).ceil\n first_half << elem\n else\n second_half << elem\n end\n end\n [first_half, second_half]\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 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(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 halvsies(array)\n new_array = [[],[]]\n half_way = array.length / 2.0\n array.each_with_index do | element, index |\n if index < half_way\n new_array[0] << element\n else\n new_array[1] << element\n end\n end\n new_array\nend",
"def halvsies(array)\n array1 = []\n array2 = []\n n = 0\n array.size.odd? ? m = 1 : m = 0\n\n (array.size / 2 + m).times do\n array1 << array[n]\n n += 1\n end\n\n (array.size / 2).times do\n array2 << array[n]\n n += 1\n end\n\n [array1, array2]\nend",
"def halvsies(array)\n first = []\n second = []\n \n first_of_last_array = (array.size/2.0).round(0)\n\n array.each_with_index do |num, index|\n if index < first_of_last_array\n first << num\n else\n second << num\n end\n end\n [first, second]\n\nend",
"def halvsies(ary)\n first_half, second_half = [], []\n return first_half, second_half if ary.empty? # handle empty array\n half = ary.length.odd? ? (ary.length / 2) + 1 : ary.length / 2\n first_half = ary[0...half]\n second_half = ary[half..-1]\n\n [first_half, second_half]\nend",
"def halve array\n middle = (array.size / 2.0).round - 1\n left = array[0..middle]\n right = array[(middle+1)..(array.last)]\n [left,right]\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 halve array\n middle = (array.length / 2.0).round\n left = [0..middle]\n right = [middle..(array.last)]\n [left,right]\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 halvsies(array)\n half = []\n middle = (array.length / 2.0 ).ceil\n half << array.slice(0,middle) #start, # of elements\n half << array.slice(middle, array.length) #can use middle and not middle+1 because middle equals the index of the element after middle.\n half\nend",
"def halvsies(array)\n result = [[],[]]\n array.each_index do |i|\n if i < (array.size / 2.0)\n result[0] << array[i]\n else\n result[1] << array[i]\n end\n end\n result\nend",
"def first_half(array)\n \ti = 0\n \tnewArray = []\n\twhile i < (array.length / 2.0)\n newArray << array[i]\n i += 1\n end\n \treturn newArray\nend",
"def halvsies(arr)\n first_halve_length = (arr.size / 2.0).round\n first_halve = arr[0, first_halve_length]\n second_halve = arr[first_halve_length, arr.size - first_halve_length]\n [first_halve, second_halve]\nend",
"def merge_sort_two(array)\n size = array.size\n return array if size < 2\n\n ##Find the mid_point\n mid_point = size / 2\n\n ##Divide\n left = (array.slice(0, mid_point))\n right = (array.slice(mid_point, array.size)) ##the right part may be odd\n\n merge_two(merge_sort_two(left), merge_sort_two(right))\nend",
"def halvsies(array)\n arr1 = []\n arr2 = []\n half_length_round_down = array.length/2\n \n index = 0\n index2 = half_length_round_down\n index2 += 1 if array.length.odd?\n \n loop do\n break if index == half_length_round_down\n arr1 << array[index]\n arr2 << array[index2]\n index += 1\n index2 += 1\n end\n \n if array.length.odd?\n arr1 << array[index]\n # because break statement is after index increases we don't have to increase it again\n end\n \n [arr1, arr2]\nend",
"def halvsies(arr)\n index = (arr.length) / 2\n if arr.length.odd?\n [arr[0..index], arr[index+1..-1]]\n else\n [arr[0..index-1], arr[index..-1]]\n end\nend",
"def halvsies(arr)\n middle = arr.size / 2\n cut = arr.size.even? ? middle : middle + 1\n a = arr.take(cut)\n b = arr.drop(cut)\n [a, b]\nend",
"def first_half(array)\n\tnew_array = []\n \n\ti = 0\n\twhile i < (array.length / 2.0)\n\t\tnew_array << array[i]\n\t\ti += 1\n end\n \n\treturn new_array\nend",
"def halvsies(original_array)\n if original_array.size.even?\n halfway = original_array.size / 2\n first_half = original_array[0, halfway]\n second_half = original_array[halfway, original_array.size - halfway]\n return [first_half, second_half]\n else\n halfway = (original_array.size / 2) + 1\n first_half = original_array[0, halfway]\n second_half = original_array[halfway, original_array.size - halfway]\n return [first_half, second_half]\n end\nend",
"def first_half(array)\n i = 0\n newArr = []\n while i < array.length / 2.0\n newArr << array[i]\n i += 1\n end\n return newArr\n end",
"def halve array\n middle = (array.size / 2.0).round\n left = array[0..middle]\n right = array[middle..(array.size)]\n return [left,right] # explicit return for clarity :P\nend",
"def first_half(array)\n\ti = 0\n \tarry = []\n while i < (array.length / 2.0)\n arry << array[i]\n i += 1\n end\n return arry\nend",
"def first_half(array)\n\n\ti = 0\n\n\tnew_array = []\n\n\twhile i < array.length / 2.0 # This is makes sure that the loop runs while i is less than half of the length; thus the divided by two expression. This will always include the middle element since the index value is still less than half the whole array length value.\n\n\t\tnew_array << array[i] # Array of i is important here or else it wont add the specific array value into the new array variable\n\n\t\ti += 1\n\t\t\n\tend\n\treturn new_array\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 halvsies (arr)\n midpoint = (arr.size/2.0).ceil\n first_half = (0...midpoint)\n second_half = (midpoint..-1)\n\n return [arr[first_half], arr[second_half]]\nend",
"def first_half(array)\n half_arr = []\n\n i = 0\n\n while i < array.length / 2.0\n half_arr << array[i]\n i += 1\n end\n return half_arr\nend",
"def halvsies(arr)\n return_array = [[],[]]\n arr.each_with_index do |item, index|\n if arr.size.even?\n index < (arr.size) /2 ? return_array[0] << item : return_array[1] << item\n else\n index <= (arr.size) /2 ? return_array[0] << item : return_array[1] << item\n end\n end\n return_array\nend",
"def middle_way(list1, list2) #return list with middle of lists (assume both lists have odd number of elements)\n return [list1[list1.size/2], list2[list2.size/2]]\nend",
"def create_inner_arrays(array)\n size = array.size\n array = [array.first((size + 1) / 2), array.last(size / 2)]\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 halvsies(arr)\n first_half_el = (arr.size / 2.0).round - 1 \n second_half_el = arr.size == 1 ? 0 : (arr.size / 2.0).to_i * -1\n first_half = arr[0..first_half_el]\n second_half = second_half_el == 0 ? [] : arr[second_half_el..-1]\n\n halvsies = [first_half, second_half]\nend",
"def halvsies(array)\n new_array = []\n array_size = array.size\n left_array_size = if array_size.odd?\n array_size / 2 + 1\n else\n array_size / 2\n end\n new_array[0] = array.slice!(0, left_array_size)\n new_array[1] = array\n # new_array[0] = array.slice(0, left_array_size)\n # new_array[1] = array.slice(left_array_size, array_size - left_array_size)\n new_array\nend",
"def halvsies(array)\n halvs = []\n first_half_size = array.size % 2 == 0 ? array.size / 2 : array.size / 2 + 1\n halvs[0] = array[0...first_half_size]\n halvs[1] = array[first_half_size..-1]\n halvs\nend",
"def first_half(array)\n half = []\n i = 0\n max = array.length - (array.length / 2)\n while i < max\n half << array[i]\n i += 1\n end\n return half\n \n end",
"def middle_in_array(array)\n array[array.length / 2]\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 merge_sort(array)\n return array if array.length < 2\n middle_idx = array.length / 2\n first_half = array.take middle_idx\n last_half = array.drop middle_idx\n\n merge_helper(merge_sort(first_half), merge_sort(last_half))\nend",
"def halvsies(arr)\n sizing = (arr.size.to_f / 2).ceil\n first, second = arr[0..sizing-1], arr[sizing.. -1]\nend",
"def first_half(arr)\n original_arr_length = arr.length/2\n split1 = arr.reverse\n first_half = []\n while (split1.length > original_arr_length)\n first_half << split1.pop \n end\n first_half.reverse\nend",
"def merge_sort(array)\n middle_index = (array.length - 1) / 2\n if array.length == 0 || array.length == 1\n return array\n end\n first_half = merge_sort(array[0..middle_index])\n last_half = merge_sort(array[middle_index + 1..array.length - 1])\n return merge(first_half, last_half)\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 halvsies(array)\n first_half = array.slice(0, (array.size / 2.0).ceil)\n [first_half, (array - first_half)]\nend",
"def halvsies(arr)\n num_in_first_half = (arr.size / 2.0).ceil\n [arr[0, num_in_first_half], arr[num_in_first_half, arr.size - num_in_first_half]]\nend",
"def first_half(array)\n new_array = []\n max = array.length / 2.0\n i = 0\n while i < max\n new_array << array[i]\n i += 1\n end\n\n return new_array\nend",
"def first_half(array)\n elements = []\n \n i = 0\n while i <= array.length / 2.0\n elements << array[i]\n \n i += 1\n end\n \n return elements\nend",
"def merge_sort(array) # ***\n return array if array.length <= 1\n mid_idx = (array.length - 1) / 2\n\n first_half = merge_sort(array[0..mid_idx])\n second_half = merge_sort(array[mid_idx + 1..-1])\n\n merge(first_half, second_half)\n # merge(merge_sort(array[0..mid_idx]), merge_sort(array[mid_idx + 1..-1]))\nend",
"def halvsies(ary)\r\n length = ary.size\r\n ary2 = []\r\n (length / 2).times{ ary2.unshift(ary.pop) }\r\n results = [ary, ary2]\r\nend",
"def middle\n len = self.size\n return nil if len.zero?\n div = len.div(2)\n if len.modulo(2).zero?\n [self[div-1],self[div]] \n else\n self[div]\n end\n end",
"def halvsies(arr)\n halvsies_arr1 = []\n halvsies_arr2 = []\n halves = arr.length / 2\n arr.length % 2 == 0 ? halves -= 1 : halves\n arr.each_with_index do |item, index|\n if index <= (halves)\n halvsies_arr1.push(item)\n else\n halvsies_arr2.push(item)\n end\n end\n [halvsies_arr1, halvsies_arr2]\nend",
"def merge_sort(array)\n return array if array.length <= 1\n\n first_half = array.take(array.length / 2)\n second_half = array.drop(first_half.length)\n\n merge( merge_sort(first_half), merge_sort(second_half) )\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 halvsies(arr)\n sliced_arr = []\n half = arr.length / 2.0\n if arr.size.even?\n sliced_arr << arr[0..half - 1] << arr[half..-1]\n else\n sliced_arr << arr[0..half] << arr[half+1..-1]\n end\n sliced_arr\nend",
"def merge_sort(array)\n return array if array.length == 1\n\n mid_index = array.length / 2\n end_index = array.length - 1\n\n left_half = array[0..mid_index - 1]\n right_half = array[mid_index..end_index]\n\n left_half_sorted = merge_sort(left_half)\n right_half_sorted = merge_sort(right_half)\n\n sorted = []\n until left_half_sorted.empty? || right_half_sorted.empty?\n sorted << (left_half_sorted.first < right_half_sorted.first ? left_half_sorted.shift : right_half_sorted.shift)\n end\n sorted + left_half_sorted + right_half_sorted\nend",
"def halvsies(ary)\n first_ary = []\n second_ary = []\n while ary.empty? == false\n first_ary << ary.shift\n break if ary.empty?\n second_ary.unshift(ary.pop)\n end\n p [first_ary, second_ary]\nend",
"def merge_sort(arr)\n if arr.length == 1\n return arr\n elsif arr.empty?\n return arr\n else\n first_half = merge_sort(arr[0..arr.length/2-1])\n second_half = merge_sort(arr[arr.length/2..-1])\n sorted_array = []\n idx_first = 0\n idx_second = 0\n until idx_first == first_half.length || idx_second == second_half.length\n if first_half[idx_first] < second_half[idx_second]\n sorted_array << first_half[idx_first]\n idx_first += 1\n elsif first_half[idx_first] > second_half[idx_second]\n sorted_array << second_half[idx_second]\n idx_second += 1\n end\n end\n\n if idx_first == first_half.length\n sorted_array += second_half[idx_second..-1]\n else sorted_array += first_half[idx_first..-1]\n end\n return sorted_array\n end\nend",
"def even_odd_half_of(splits)\n odd = splits.select.with_index{|_,i| (i+1) % 2 == 1}\n even = splits.select.with_index{|_,i| (i+1) % 2 == 0}\n # necessary to reverse order of 2nd half\n # otherwise someone would have to manually reverse\n # all the printed pages after having printed\n # the first half of the document.\n even.reverse!\n [odd, even]\n end",
"def halvsies(arr)\n midpoint = (arr.length / 2.0).ceil\n [arr[0...midpoint], arr[midpoint..-1]]\nend",
"def merge_sort(arr)\n return arr if arr.length <= 1\n\n if arr.length.odd?\n mid_idx = arr.length / 2\n else\n mid_idx = arr.length / 2 - 1\n end\n\n first_half = arr[0..mid_idx]\n second_half = arr[mid_idx + 1..-1]\n\n fh_split = merge_sort(first_half)\n sh_split = merge_sort(second_half)\n\n merge(fh_split, sh_split)\nend",
"def first_half(array)\n\tarr = [] # initialize arr\n \ti = 0 # start at first indice\n\n while i < (array.length / 2.0) # while indice is less than the length of the array rounded up by half\n push_this = array[i] # add corresponding item into variable \n arr << push_this # add variable into the array\n\n i += 1 # iterate next\n end\n\n return arr\nend",
"def first_half(array)\n max = array.length / 2.0 \n puts max\n half = [] \n index = 0 \n \n while index < max\n half << array[index]\n index += 1 \n end \n \n return half\n \nend",
"def merge_sort(array)\n if array.length < 2\n return array\n end\n first_half = array[0...array.length / 2]\n second_half = array[array.length / 2..-1]\n\n merge(merge_sort(first_half), merge_sort(second_half))\nend",
"def merge_sort(arr)\n return arr if arr.length <= 1\n # define middle element where array will be split\n case arr.length % 2 == 0\n when true\n middle_index = (arr.length - 1) / 2\n when false\n middle_index = arr.length / 2\n end\n\n left_half = arr[0..middle_index]\n right_half = arr[middle_index + 1..-1]\n sorted_left = merge_sort(left_half)\n sorted_right = merge_sort(right_half)\n merge(sorted_left, sorted_right)\nend",
"def merge_sort(arr)\n return arr if arr.length < 2\n middle_index = arr.length / 2\n one_half = arr[0...middle_index]\n two_half = arr[middle_index..-1]\n merge(merge_sort(one_half), merge_sort(two_half))\nend",
"def get_middle(s)\n (s.size.odd?) ? s[(s.size / 2)] : s[(s.size - 1) / 2, 2]\nend",
"def merge_sort(array)\n# base case of array size 1\n return array if array.size == 1\n \n# first half array\n first_half = array[0..((array.size-1)/ 2)]\n \n# second half array\n second_half = array [(((array.size - 1) / 2) + 1)..array.size - 1]\n \n# idk which array is bigger, just make sure that one gets the median, the other gets below or above it\n \n# get the sorted first half by calling the method on the first half \n first_half = merge_sort(first_half)\n second_half = merge_sort(second_half)\n \n# merge the first & second half\n merge(first_half, second_half)\nend",
"def get_combined_interval(interval_arr, left_edge, right_edge)\n p \"interval_arr: #{interval_arr}\"\n interval_arr.each do |interval| # get combined interval\n p \"interval: #{interval}\"\n p \"left_edge: #{left_edge} right_edge: #{right_edge}\"\n if interval[0] >= 0 && interval[0] < left_edge && interval[1] >= left_edge\n left_edge = interval[0]\n interval_arr.delete(interval)\n elsif interval[0] < 0 && interval[0] > left_edge && interval[1] <= left_edge\n left_edge = interval[0]\n interval_arr.delete(interval)\n elsif interval[1] >= 0 && interval[1] > right_edge && interval[0] <= right_edge\n right_edge = interval[1]\n interval_arr.delete(interval)\n elsif interval[1] < 0 && interval[1] < right_edge && interval[0] >= right_edge\n right_edge = interval[1]\n interval_arr.delete(interval)\n end\n end\n\n interval_arr.each do |interval| # get intervals not part of combined interval\n \n end\n puts\n [interval_arr, left_edge, right_edge]\nend",
"def median_middle(arr)\n \n # p arr\n # puts\n \n even_arr = []\n \n if arr.length.odd?\n # p \"its odd\"\n # puts\n middle_index = (arr.length / 2)\n # p middle_index\n return middle_index\n else\n # p \"its even\"\n # puts\n middle1= (arr.length/2) - 1\n middle2= (arr.length/2)\n even_arr << middle1\n even_arr << middle2\n # p even_arr\n return even_arr\n \n #formula\n #middle_index = (middle1 + middle2) / 2\n end\n \n \n end",
"def merge_sort arr\n\tif arr.length <= 1\n\t\tarr\n\telse\n\t\tmid = arr.length/2\n\t\tfirst_half = arr.slice(0...mid)\n\t\tsecond_half = arr.slice(mid...arr.length)\n\t\tmerge merge_sort(first_half), merge_sort(second_half)\n\tend\nend",
"def middle_way(list1, list2)\n mid = list1.size / 2 \n mid2 = list2.size / 2\n return [list1[mid], list2[mid2]]\nend",
"def group(array)\n\t\tif (array.length%2) == 0 \n\t\t\tarray2=array[0..(array.length-1)/2]\n\t\t\tarray=array[(array.length)/2..array.length]\n\t\t\treturn array.zip(array2)\n\t\telse\n\t\t\todd_man = array[-1]\n\t\t\tarray = array[0..array.length-2]\n\t\t\tgrouped = group(array)\n\t\t\tgrouped[-1] = grouped[-1].push(odd_man)\n\t\t\tgrouped\n\t\tend\nend",
"def find_middle_array_element(array)\n\n return 0 if array.size == 1 \n if array.size.odd?\n array.size/2\n elsif array.size.even? \n (array.size/2) - 1\n end\n\nend",
"def quadruplet_recombine array\n left, right = halve(array)\n\n # ternary\n left_sorted = left.first > left.last ? [left.last, left.first] : left\n right_sorted = right.first > right.last ? [right.last, right.first] : right\n\n sorted = left_sorted[0] < right_sorted [0] ? [left_sorted,right_sorted] : [right_sorted,left_sorted]\n\n sorted.flatten\nend",
"def find_outlier(array)\n odd_array=[]\n even_array=[]\n array.each do |i|\n odd_array << i if i % 2 == 0\n even_array << i if i % 2 != 0\n end\n odd_array.size > even_array.size ? even_array[0] : odd_array[0]\nend",
"def halvsies(array)\n half = (array.length / 2.0).round\n [array.take(half), array.drop(half)]\nend",
"def merge_sort(arr)\n return arr if arr.length <= 1\n first_half = arr[0...(arr.length / 2)]\n second_half = arr[(arr.length / 2)..-1]\n merge(merge_sort(first_half), merge_sort(second_half))\nend",
"def halvsies(ary)\n ary.size.even? ? [ary[0...(ary.size/2)], ary[(ary.size/2)..-1]] : [ary[0..(ary.size/2)], ary[(ary.size/2 + 1)..-1]]\nend",
"def halvsies(array1)\n num = (array1.length / 2.0).ceil\n num = array1.length - num\n array2 = []\n \n loop do\n break if num == 0\n array2 << array1.pop\n num -= 1\n end\n \n big_array = [array1, array2.reverse!]\n big_array\nend",
"def merge_sort array\n return array if array.length <= 1\n # arr1, arr2 = array.each_slice((array.size/2.0).round).to_a # Seems to be a bit slower than the method below\n arr1 = array[0..((array.length/2 - 1))]\n arr2 = array[(array.length/2)..(array.length-1)]\n return merge_arrays(merge_sort(arr1), merge_sort(arr2)) # Divide and conquer!\nend",
"def get_to_the_end two_d_array\n index1 = 0\n index2 = 0\n position = [0, 0]\n\n return nil if position == 1\n return nil if two_d_array.last.pop == 1\n \n # check right\n if two_d_array[index1][index2 + 1] == 0\n index2 += 1\n position = [index1, index2]\n # check down\n elsif two_d_array[index1 + 1][index2] == 0\n index1 += 1\n position = [index1, index2]\n end\n \nend",
"def right_mid\n\t\t[ cl[0], cl[1]+1 ] \n\tend",
"def merge_sort(array)\n return array if array.length <= 1\n\n mid_idx = (array.length/2)\n left_side = array[0...mid_idx]\n right_side = array[mid_idx..-1]\n\n sort_left = merge_sort(left_side)\n sort_right = merge_sort(right_side)\n\n merge_halves(sort_left, sort_right)\nend",
"def oddities(init_array)\n odd_bods = []\n init_array.each_with_index do |element, index|\n odd_bods << element if index.odd?\n end\n odd_bods\nend",
"def merge_sort(arr)\n return arr if arr.length == 1\n\n half_idx = arr.length / 2\n first_half = arr[0...half_idx]\n second_half = arr[half_idx..-1]\n\n merge(merge_sort(first_half), merge_sort(second_half))\nend"
] |
[
"0.6855742",
"0.6705341",
"0.66929805",
"0.6681913",
"0.66708577",
"0.65822643",
"0.65669787",
"0.6526818",
"0.6522265",
"0.6495019",
"0.649468",
"0.64913523",
"0.64705855",
"0.6461506",
"0.64570683",
"0.6455686",
"0.6454684",
"0.6453713",
"0.64503366",
"0.6422796",
"0.6394962",
"0.6353793",
"0.63481516",
"0.634629",
"0.633441",
"0.6325813",
"0.63246584",
"0.63117737",
"0.6291912",
"0.62829244",
"0.6270672",
"0.625953",
"0.62510836",
"0.6225259",
"0.6221525",
"0.62168396",
"0.6211483",
"0.6199692",
"0.6194456",
"0.61862373",
"0.61557734",
"0.6148345",
"0.6146874",
"0.6144021",
"0.6093292",
"0.608105",
"0.6076985",
"0.60740286",
"0.6065933",
"0.60523146",
"0.6033096",
"0.6031781",
"0.6022588",
"0.60125834",
"0.6003604",
"0.5993595",
"0.59896785",
"0.5977785",
"0.5956909",
"0.59356344",
"0.5922153",
"0.59219253",
"0.5919161",
"0.59031767",
"0.5895628",
"0.5886693",
"0.5869959",
"0.58426994",
"0.583311",
"0.5820652",
"0.58116287",
"0.5810234",
"0.5809627",
"0.5807888",
"0.57639855",
"0.57518965",
"0.5743157",
"0.57334256",
"0.5732407",
"0.57262313",
"0.5723608",
"0.57089204",
"0.57010907",
"0.5665954",
"0.5663578",
"0.56529206",
"0.56513906",
"0.5649158",
"0.5647996",
"0.56321657",
"0.5620575",
"0.56172943",
"0.56142205",
"0.5604634",
"0.5604566",
"0.5603652"
] |
0.64413697
|
23
|
Called after every ftp_test method runs. Can be used to tear down fixture information.
|
def teardown
@browser.close
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def after_teardown; end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n fakefs_original_teardown\n FakeFS.deactivate!\n end",
"def teardown\n end",
"def teardown\n FakeFS::FileSystem.clear # wipe file system for new test\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 FileUtils.rm_rf(@tmpdir) if File.exist?(@tmpdir)\n end",
"def teardown; end",
"def teardown; end",
"def teardown\r\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 end",
"def teardown\n # Empty\n end",
"def teardown\n # Empty\n end",
"def teardown\n FileUtils.rm_rf(data_path)\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 teardown\n\n end",
"def teardown\n # if necessary\n end",
"def teardown\n # No-op\n end",
"def before_teardown; end",
"def teardown\n FileUtils.remove_entry @tmpdir\n end",
"def tear_down; end",
"def teardown\n\tend",
"def teardown\n\tend",
"def teardown\n # empty\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n FileUtils.remove_dir(TEMP_SITE_PATH, true) if Dir.exists? TEMP_SITE_PATH\n Ruhoh::Manager.reset\nend",
"def teardown\n cleanup_tables\n cleanup_caches\n end",
"def teardown(&block)\n after(:each, &block)\n end",
"def teardown\n puts \"tear down\"\n end",
"def teardown\n\t\t\t\t# Do nothing\n\t\tend",
"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 teardown\n\t\t# Do nothing\n\tend",
"def teardown\n\t\t# Do nothing\n\tend",
"def teardown\n\t\t# Do nothing\n\tend",
"def teardown\n @bu = nil\n end",
"def teardown\n [\"file1\", \"file2\", \"file3\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/file*\"].each {|f| FileUtils.rm f}\n Dir[\"test/backup/*.tar.gz\"].each {|f| FileUtils.rm f}\n Dir.rmdir \"test/backup\" if File.exists? \"test/backup\"\n end",
"def teardown\n Dir.chdir '..'\n FileUtils.rm_rf @tempdirname\n end",
"def teardown\n reset_test_env\n end",
"def teardown\n reset_test_env\n end",
"def teardown\n super\n end",
"def recycle; teardown; setup; 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",
"def teardown\r\n # Do nothing\r\n end",
"def teardown\n # Do nothing\n end",
"def teardown\n FileUtils.rm_rf(File.join('/tmp', @uuid))\n end",
"def teardown\r\n\t\t@vendors = nil\r\n\t\t@vendor = nil\r\n\t\t@model = nil\r\n\t\t@deviceView = nil\r\n\t\t@devicewWhatHas = nil\r\n\t\t@fetchTrees = nil\r\n\t\t@fetchSpecs = nil\r\n\tend",
"def after_teardown\n super\n\n CarrierWave.clean_cached_files!(0)\n end",
"def teardown\n puts \"Teardown running...\"\n %x[rake db:reset]\n end",
"def teardown\n puts \"Teardown running...\"\n %x[rake db:reset]\n end",
"def teardown\n puts \"Teardown running...\"\n %x[rake db:reset]\n end",
"def teardown\n puts \"Teardown running...\"\n %x[rake db:reset]\n end",
"def teardown\n #implement in subclass;\n end",
"def after_test(_test); end",
"def after_test(_test); end",
"def after_test(_test); end"
] |
[
"0.7567953",
"0.7354274",
"0.7354274",
"0.7322123",
"0.7277413",
"0.72636205",
"0.72574455",
"0.72574455",
"0.72574455",
"0.72574455",
"0.72574455",
"0.72574455",
"0.72574455",
"0.72574455",
"0.72409624",
"0.7187585",
"0.7187585",
"0.71751785",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7147212",
"0.7112154",
"0.7112154",
"0.71039224",
"0.70914346",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70740336",
"0.70496213",
"0.7036589",
"0.70030254",
"0.69983864",
"0.69891346",
"0.69405",
"0.69405",
"0.6899283",
"0.68574786",
"0.68574786",
"0.6854754",
"0.6844952",
"0.68268496",
"0.6794747",
"0.6793877",
"0.67830354",
"0.67830354",
"0.6753418",
"0.6753418",
"0.6753418",
"0.67356735",
"0.67327464",
"0.67298216",
"0.67153037",
"0.67153037",
"0.6692063",
"0.66774046",
"0.6675452",
"0.6675452",
"0.6675452",
"0.6675452",
"0.6675452",
"0.6675452",
"0.6675452",
"0.6675452",
"0.6675452",
"0.6675452",
"0.6634007",
"0.6622755",
"0.6619552",
"0.66119987",
"0.66115546",
"0.66115546",
"0.66115546",
"0.66115546",
"0.6600329",
"0.6578916",
"0.6578916",
"0.6578916"
] |
0.0
|
-1
|
GET /serie_detalles GET /serie_detalles.json
|
def index
respond_to do |format|
format.html
format.json { render json: SerieDetallesDatatable.new(view_context) }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def findreg\n @detalles = Detalle.find(params[:id])\n render json: @detalles\n end",
"def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end",
"def set_serie_detalle\n @serie_detalle = SerieDetalle.find(params[:id])\n end",
"def index\n @detalles = Detalle.all\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def index\r\n @salles = Salle.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @salles }\r\n end\r\n end",
"def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end",
"def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def show\n @detalle = Detalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detalle }\n end\n end",
"def index\n @productos_detalles = ProductoDetalle.all\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def estaciones\n\n param_estacion = params[:estacion]\n param_fecha = params[:fecha].to_i\n @info_polens = InfoPolen.where({\"ESTACIONES\" => param_estacion, \"FECHA\" => param_fecha}).order_by(:TIPOS_POLINICOS.asc)\n\n respond_to do |format|\n format.html #{ redirect_to info_polens_url }\n format.json { render json: @info_polens }\n end\n end",
"def show\n @pedidodetalle = Pedidodetalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pedidodetalle }\n end\n end",
"def index\n @deportes = Deporte.all\n render json: @deportes, status: :ok \n @deportes = Deporte.paginate(:page => params[:page])\n end",
"def show\n @deporte= set_deporte\n render json: @deporte, status: :ok\n\n end",
"def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def index\n @mesasredondas = Mesasredonda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mesasredondas }\n end\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def index\n @sekilas_infos = SekilasInfo.all\n end",
"def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end",
"def sondagesParAdmin\n sondages = SondageService.instance.listeDesSondagesParAdmin(params[:id])\n render json: sondages, status: :ok\n end",
"def index\n @detalle_carritos = DetalleCarrito.all\n end",
"def index\n @detalhes = Detalhe.all\n end",
"def create\n @serie_detalle = SerieDetalle.new(serie_detalle_params)\n\n respond_to do |format|\n if @serie_detalle.save\n format.html { redirect_to @serie_detalle, notice: 'Serie detalle was successfully created.' }\n format.json { render :show, status: :created, location: @serie_detalle }\n else\n format.html { render :new }\n format.json { render json: @serie_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @detpedidos = Detpedido.all\n end",
"def index\n render json: @fiestas\n end",
"def androidreserva\n\n @reservas = Reservation.all\n \n \n\n render :json => {\n :reservas => @reservas\n \n\n }\n\n \n end",
"def index\n @datos_estudiantes = DatosEstudiante.all\n end",
"def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def show\n render json: @departamento\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def index\n @programa_de_interes = ProgramaDeIntere.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programa_de_interes }\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def index\n @sesions = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).all\n @suplente = Suplente.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sesions }\n end\n end",
"def index\n @ticket_detalles = TicketDetalle.all\n end",
"def index\n @semestres = Semestre.all\n end",
"def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end",
"def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end",
"def showdetails\r\n @salle = Salle.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @salle }\r\n end\r\n end",
"def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end",
"def index\n @reporte = Reporte.find(params[:reporte_id])\n @reporte_detalles = @reporte.reporte_detalles.all\n end",
"def new\r\n @salle = Salle.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @salle }\r\n end\r\n end",
"def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def index\r\n# @asistencias = Asistencia.all\r\n seccion = params[:seccion_id]\r\n if params[:seccion_id].nil?\r\n fecha = Date.current\r\n else\r\n fecha = params[:fecha].to_date\r\n end\r\n \r\n @asistencias = Asistencia.por_seccion_fecha(anio_escolar.id, seccion, fecha).salida\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @asistencias }\r\n end\r\n end",
"def destroy\n @serie_detalle.destroy\n respond_to do |format|\n format.html { redirect_to serie_detalles_url, notice: 'Serie detalle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end",
"def estudiantes\n\t\t@seccion = \"Estudiantes\"\n @titulo = \"Estudiantes\"\n\t\tif params[:orden]\n\t\t\t@orden = params[:orden]\n\t\telse\n\t\t\t@orden = \"Cédula\"\n\t\tend\n\n #Guardo todos los estudiantes\n if Estudiante.all().size > 0\n case @orden\n \twhen \"Cédula\"\n \t\t@usuarios = Usuario.order('cedula').where(:id => Estudiante.all)\n \twhen \"Nombre\"\n \t\t@usuarios = Usuario.order('nombre').where(:id => Estudiante.all)\n \twhen \"Apellido\"\n \t\t@usuarios = Usuario.order('apellido').where(:id => Estudiante.all)\n \twhen \"Correo\"\n \t\t@usuarios = Usuario.order('correo').where(:id => Estudiante.all)\n \tend\n end\n\n\t\t@categorias = ['Cédula', 'Nombre', 'Apellido', 'Correo'] #Este es el orden que se mostrará en el select de la vista\n\n\t\t@estudiante_datos = [] #En este arreglo se guardan los pares \"Cedula - Nombre Apellido\" de cada usuario para mostrar en el campo de busqueda\n\t\tUsuario.order('nombre').where(:id => Estudiante.all).each do |usuario|\n\t\t\t#En este foro se agregan uno a uno los valores de cada estudiante al arreglo de la manera indicada arriba\n\t\t\t@estudiante_datos << usuario.cedula.to_s + \" - \" + usuario.nombre_y_apellido.to_s\n\t\tend\n\tend",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def index\n @sensor = Sensor.find(params[:id])\n @values = @sensor.values\n # render json: @values\n\n s = []\n for v in @values \n s.push( { :id => v.id, :decibel => v.decibel } )\n end\n render json: s\n\n end",
"def series\n\n @series = Serie.all.where(nivel: params[:id] )\n respond_with(@series)\n end",
"def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def index\n all=Sale.where(active:true)\n ventas= resumen all \n\n render json:ventas\n end",
"def new\n @detalle = Detalle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @detalle }\n end\n end",
"def index\n @itineraires = Itineraire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @itineraires }\n end\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end",
"def index\n @desinfectantes = Desinfectante.all\n end",
"def show\n @compra_detalle = CompraDetalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compra_detalle }\n end\n end",
"def index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end",
"def index\n @detalle_facturas = DetalleFactura.all\n end",
"def index\n @diciplinas = Diciplina.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @diciplinas }\n end\n end",
"def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end",
"def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end",
"def index\n @relaciones_articulos_medida = RelacionArticuloMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @relaciones_articulos_medida }\n end\n end",
"def index\n @detalle_ot_presupuestos = DetalleOtPresupuesto.all\n end",
"def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end",
"def index\n @tipo_despesas = TipoDespesa.all\n end",
"def index\n @notadedebito = Notadedebito.find(params[:notadedebito_id])\n @renglon_nddndcs = @notadedebito.renglon_nddndcs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_nddndcs }\n end\n end",
"def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end",
"def show\n @consulta = Consulta.find(params[:id])\n\n render json: @consulta\n end",
"def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end",
"def index\n @listes = Liste.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listes }\n end\n end",
"def show\n @dossier = Dossier.find(params[:id])\n @registers = @dossier.registers.order(\"date_register DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dossier }\n end\n end",
"def index\n # @transacciones = Transaccione.all\n respond_to do |format|\n format.html\n format.json { render json: TransaccionesDatatable.new(view_context) }\n end\n end",
"def show\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def listar()\n @client.get(Route.new([ROTA_DID]))\n end",
"def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end",
"def index\n @demots = Demot.where(active: true).page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @demots }\n end\n end",
"def index\n @consulta_viajes = ConsultaViaje.all\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def lista\n @receitas = Receita.all\n\n respond_to do |format|\n format.html # lista.html.erb\n format.xml { render :xml => @receitas }\n end\n end",
"def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end",
"def new\n @pedidodetalle = Pedidodetalle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pedidodetalle }\n end\n end",
"def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def index\n @dia_eventos = DiaEvento.all\n render json: @dia_eventos\n end",
"def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end",
"def index\n @prueba_jsons = PruebaJson.all\n end",
"def new\n @seguidore = Seguidore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def infosSauvegardes\n\t\n return requete(\"SELECT nompartie, nomgrille, taillegrille, jokersRestants, grillejouee.datemaj FROM grillejouee INNER JOIN grilleediter ON grillejouee.idGrille=grilleediter.id WHERE joueur = #{@profil.getStats[\"id\"]}\")\n\tend",
"def show\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def index\n @dnas = Dna.all\n\n render json: @dnas\n end",
"def index\n @dinos = Dino.where(query_params)\n render json: @dinos\n end",
"def index\n @status_del_admitidos = StatusDelAdmitido.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_admitidos }\n end\n end",
"def index\n @mencions = Mencion.order(\"escuela_id\").paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mencions }\n end\n end"
] |
[
"0.7128526",
"0.7099706",
"0.6770504",
"0.6636597",
"0.65761757",
"0.6518643",
"0.64323765",
"0.63998795",
"0.6349028",
"0.63182974",
"0.63060415",
"0.6298451",
"0.628591",
"0.62137115",
"0.6195701",
"0.61908156",
"0.61678743",
"0.6145121",
"0.6142647",
"0.6125281",
"0.61240566",
"0.610707",
"0.6077267",
"0.6069063",
"0.60641706",
"0.6063615",
"0.60528874",
"0.604647",
"0.6021193",
"0.60056794",
"0.60017574",
"0.599524",
"0.599397",
"0.5985314",
"0.5983557",
"0.59656787",
"0.595056",
"0.59453017",
"0.5935937",
"0.5923735",
"0.5922681",
"0.59214014",
"0.59188163",
"0.59101087",
"0.590954",
"0.5906228",
"0.5905903",
"0.5893283",
"0.5892958",
"0.58906806",
"0.58899784",
"0.58864677",
"0.5877436",
"0.5873153",
"0.58730525",
"0.58679616",
"0.5866937",
"0.5866045",
"0.5864713",
"0.58635664",
"0.5861245",
"0.5860017",
"0.5857399",
"0.58531445",
"0.58521914",
"0.58512306",
"0.58457506",
"0.583416",
"0.5831523",
"0.58276796",
"0.58259535",
"0.58080685",
"0.5803999",
"0.5798407",
"0.5798361",
"0.57810694",
"0.5780865",
"0.57789475",
"0.577868",
"0.5773103",
"0.5772677",
"0.5761691",
"0.5760129",
"0.5755186",
"0.57551306",
"0.5752868",
"0.57528585",
"0.5749867",
"0.5744765",
"0.57441956",
"0.57434523",
"0.57421184",
"0.5741415",
"0.57370406",
"0.57319105",
"0.5724071",
"0.5719025",
"0.5718214",
"0.5713919",
"0.57081306"
] |
0.63816386
|
8
|
GET /serie_detalles/1 GET /serie_detalles/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def findreg\n @detalles = Detalle.find(params[:id])\n render json: @detalles\n end",
"def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end",
"def set_serie_detalle\n @serie_detalle = SerieDetalle.find(params[:id])\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def show\n @detalle = Detalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detalle }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: SerieDetallesDatatable.new(view_context) }\n end\n end",
"def index\r\n @salles = Salle.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @salles }\r\n end\r\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def show\n @deporte= set_deporte\n render json: @deporte, status: :ok\n\n end",
"def show\n @pedidodetalle = Pedidodetalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pedidodetalle }\n end\n end",
"def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end",
"def index\n @detalles = Detalle.all\n end",
"def show\n @estudiante = Estudiante.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def show\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def showdetails\r\n @salle = Salle.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @salle }\r\n end\r\n end",
"def show\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def show\n @compra_detalle = CompraDetalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @compra_detalle }\n end\n end",
"def show\n @consulta = Consulta.find(params[:id])\n\n render json: @consulta\n end",
"def display\n @reservas = Reserva.order(fecha_inicio_estadia: :desc)\n render json: @reservas, include: [:cliente, :habitacion]\n end",
"def show\n @ventas_seguimiento = Ventas::Seguimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ventas_seguimiento }\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def show\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def new\r\n @salle = Salle.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @salle }\r\n end\r\n end",
"def estaciones\n\n param_estacion = params[:estacion]\n param_fecha = params[:fecha].to_i\n @info_polens = InfoPolen.where({\"ESTACIONES\" => param_estacion, \"FECHA\" => param_fecha}).order_by(:TIPOS_POLINICOS.asc)\n\n respond_to do |format|\n format.html #{ redirect_to info_polens_url }\n format.json { render json: @info_polens }\n end\n end",
"def show\n render json: @departamento\n end",
"def show\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @solicitud_servicio }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end",
"def index\n @deportes = Deporte.all\n render json: @deportes, status: :ok \n @deportes = Deporte.paginate(:page => params[:page])\n end",
"def index\r\n# @asistencias = Asistencia.all\r\n seccion = params[:seccion_id]\r\n if params[:seccion_id].nil?\r\n fecha = Date.current\r\n else\r\n fecha = params[:fecha].to_date\r\n end\r\n \r\n @asistencias = Asistencia.por_seccion_fecha(anio_escolar.id, seccion, fecha).salida\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @asistencias }\r\n end\r\n end",
"def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end",
"def show\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def new\n @detalle = Detalle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @detalle }\n end\n end",
"def sondagesParAdmin\n sondages = SondageService.instance.listeDesSondagesParAdmin(params[:id])\n render json: sondages, status: :ok\n end",
"def index\n @antecedentes = Antecedente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @antecedentes }\n end\n end",
"def create\n @serie_detalle = SerieDetalle.new(serie_detalle_params)\n\n respond_to do |format|\n if @serie_detalle.save\n format.html { redirect_to @serie_detalle, notice: 'Serie detalle was successfully created.' }\n format.json { render :show, status: :created, location: @serie_detalle }\n else\n format.html { render :new }\n format.json { render json: @serie_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @sezione = Sezione.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sezione }\n end\n end",
"def index\n render json: @fiestas\n end",
"def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end",
"def new\n @seguidore = Seguidore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def show\n @dossier = Dossier.find(params[:id])\n @registers = @dossier.registers.order(\"date_register DESC\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dossier }\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end",
"def index\n @programa_de_interes = ProgramaDeIntere.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programa_de_interes }\n end\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end",
"def show\n @spieler = Spieler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spieler }\n end\n end",
"def index\n @mesasredondas = Mesasredonda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mesasredondas }\n end\n end",
"def series\n\n @series = Serie.all.where(nivel: params[:id] )\n respond_with(@series)\n end",
"def index\n @pedidos = Pedido.find(:all, :conditions => [\"cliente_id=?\", session[:usuario_id]])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pedidos }\n end\n end",
"def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @deuda = Deuda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deuda }\n end\n end",
"def androidreserva\n\n @reservas = Reservation.all\n \n \n\n render :json => {\n :reservas => @reservas\n \n\n }\n\n \n end",
"def index\n @palestrantes = Palestrante.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @palestrantes }\n end\n end",
"def show\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @diemtrentuyen }\n end\n end",
"def show\n @seguro = Seguro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seguro }\n end\n end",
"def show\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sugerencia }\n end\n end",
"def index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end",
"def index\n @sekilas_infos = SekilasInfo.all\n end",
"def index\n @itineraires = Itineraire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @itineraires }\n end\n end",
"def index\n @productos_detalles = ProductoDetalle.all\n end",
"def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end",
"def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\n end\n end",
"def show\n @etudiant = Etudiant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etudiant }\n end\n end",
"def show\n @spiel = Spiel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spiel }\n end\n end",
"def index\n @sesions = Sesion.where(entidad_paraestatal_id: @entidad_paraestatal.id).all\n @suplente = Suplente.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sesions }\n end\n end",
"def new\n @estudiante = Estudiante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def index\n @deporte_usuarios = DeporteUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deporte_usuarios }\n end\n end",
"def index\n @sensor = Sensor.find(params[:id])\n @values = @sensor.values\n # render json: @values\n\n s = []\n for v in @values \n s.push( { :id => v.id, :decibel => v.decibel } )\n end\n render json: s\n\n end",
"def show\n @descuento = Descuento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @descuento }\n end\n end",
"def index\n @ventas = Venta.order(\"fecha desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas }\n end\n end",
"def show\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @calificacion_servicio }\n end\n end",
"def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end",
"def new\n @serv_adicionale = ServAdicionale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def index\n @detalle_carritos = DetalleCarrito.all\n end",
"def index\n all=Sale.where(active:true)\n ventas= resumen all \n\n render json:ventas\n end",
"def index\n @archdioceses = Archdiocese.all\n\n render json: @archdioceses\n end",
"def new\n @safra_verdoso = SafraVerdoso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def show\n @statuspagamento = Statuspagamentoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @statuspagamento }\n end\n end",
"def index\n @datos_estudiantes = DatosEstudiante.all\n end",
"def index\n @vehicule_persos = VehiculePerso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @vehicule_persos }\n end\n end",
"def show\n @updaterete = Updaterete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @updaterete }\n end\n end",
"def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end",
"def show\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @respuesta }\n end\n end",
"def show\n @receipe = Receipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipe }\n end\n end",
"def show\n @core_termo_lacre = Core::TermoLacre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @core_termo_lacre }\n end\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end",
"def new\n @servicio = Servicio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @servicio }\n end\n end",
"def show\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fulcliente }\n end\n end",
"def index\n find_dependencias\n respond_to do |format|\n format.html\n format.json { render :json => @dependencias.to_json(:methods => :alias_or_fullname, :only => [:id, :codigo, :nombre])}\n\n end\n end",
"def show\n @humanidades2 = Humanidades2.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades2 }\n end\n end",
"def show\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @selecao }\n end\n end",
"def index\n @status_del_tramite_de_becas = StatusDelTramiteDeBeca.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_tramite_de_becas }\n end\n end",
"def show\n @combo_detalle = ComboDetalle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @combo_detalle }\n end\n end",
"def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end",
"def index\n #@users = User.all\n @respuesta = Consulta.new(300,params[0])\n\n respond_to do |format|\n format.json { render json: @respuesta }\n \n end\n end",
"def show\n @dependencia = Dependencia.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dependencia }\n end\n end",
"def index\n @frais_repas = FraisRepa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_repas }\n end\n end",
"def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end"
] |
[
"0.72496206",
"0.70748633",
"0.6994998",
"0.6764214",
"0.672888",
"0.6720816",
"0.6486747",
"0.64737076",
"0.64347637",
"0.64201534",
"0.64161104",
"0.6398771",
"0.63864684",
"0.63847935",
"0.63584846",
"0.6349591",
"0.63480693",
"0.6347247",
"0.6310564",
"0.6308767",
"0.6294042",
"0.6279964",
"0.6263538",
"0.6261716",
"0.62386805",
"0.62352765",
"0.62333506",
"0.6227858",
"0.6215088",
"0.6213986",
"0.6191825",
"0.61891586",
"0.6188702",
"0.61875385",
"0.61851394",
"0.61774975",
"0.6176107",
"0.6173848",
"0.6169102",
"0.61654305",
"0.61526245",
"0.6150558",
"0.61488795",
"0.61482483",
"0.6146084",
"0.61222583",
"0.6121929",
"0.6117226",
"0.6108704",
"0.6099316",
"0.60885876",
"0.6084699",
"0.60833687",
"0.6082078",
"0.60805535",
"0.60730445",
"0.6063996",
"0.60547805",
"0.60517997",
"0.6049683",
"0.6043047",
"0.6042851",
"0.60424286",
"0.6031685",
"0.6021451",
"0.6019917",
"0.6014589",
"0.6008486",
"0.6007454",
"0.60049313",
"0.5996101",
"0.5984892",
"0.59840536",
"0.5971845",
"0.59679735",
"0.59661055",
"0.5961508",
"0.5959774",
"0.59546113",
"0.594943",
"0.59478045",
"0.5947249",
"0.59470433",
"0.5946246",
"0.5944093",
"0.59373325",
"0.59370154",
"0.5936414",
"0.5934905",
"0.5933739",
"0.5929385",
"0.59276956",
"0.59269047",
"0.5925898",
"0.5921974",
"0.59216374",
"0.5917349",
"0.5915403",
"0.59131217",
"0.5900135",
"0.5899091"
] |
0.0
|
-1
|
POST /serie_detalles POST /serie_detalles.json
|
def create
@serie_detalle = SerieDetalle.new(serie_detalle_params)
respond_to do |format|
if @serie_detalle.save
format.html { redirect_to @serie_detalle, notice: 'Serie detalle was successfully created.' }
format.json { render :show, status: :created, location: @serie_detalle }
else
format.html { render :new }
format.json { render json: @serie_detalle.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def set_serie_detalle\n @serie_detalle = SerieDetalle.find(params[:id])\n end",
"def create\n @detalle = Detalle.new(params[:detalle])\n\n respond_to do |format|\n if @detalle.save\n format.html { redirect_to @detalle, notice: 'Detalle was successfully created.' }\n format.json { render json: @detalle, status: :created, location: @detalle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @detalle = Detalle.new(detalle_params)\n\n respond_to do |format|\n if @detalle.save\n format.html { redirect_to @detalle, notice: 'Detalle was successfully created.' }\n format.json { render :show, status: :created, location: @detalle }\n else\n format.html { render :new }\n format.json { render json: @detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def serie_detalle_params\n params.require(:serie_detalle).permit(:lugar, :marca, :pista, :atleta, :an, :club, :region, :pais)\n end",
"def findreg\n @detalles = Detalle.find(params[:id])\n render json: @detalles\n end",
"def new\n \n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n respond_to do |format|\n unless @selecciones.empty?\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n @orden = Orden.new(:direccion_entrega=>usuario_actual.direccion)\n t = Time.now\n fecha = t.strftime(\"%Y-%m-%d\")\n client = Savon::Client.new(\"http://192.168.1.121/DistribuidorFIF/webservices/servicio.php?wsdl\")\n preorden = \"<solicitud_pedido>\n <num_orden>001</num_orden>\n <nombre_comercio>Tukiosquito</nombre_comercio>\n <fecha_solicitud>\"+fecha.to_s+\"</fecha_solicitud>\n <nombre_cliente>\"+usuario_actual.nombre+\" \"+usuario_actual.apellido+\"</nombre_cliente>\n <direccion_comercio>\n <avenida>Sucre</avenida>\n <calle>-</calle>\n <edificio_casa>CC Millenium</edificio_casa>\n <local_apt>C1-15</local_apt>\n <parroquia>Leoncio Martinez</parroquia>\n <municipio>Sucre</municipio>\n <ciudad>Caracas</ciudad>\n <estado>Miranda</estado>\n <pais>Venezuela</pais>\n </direccion_comercio>\n <direccion_destino>\n <avenida>Santa Rosa</avenida>\n <calle>Tierras Rojas</calle>\n <edificio_casa>Villa Magica</edificio_casa>\n <local_apt>69</local_apt>\n <parroquia> </parroquia>\n <municipio>Zamora</municipio>\n <ciudad>Cua</ciudad>\n <estado>Miranda</estado>\n <pais>Venezuela</pais>\n </direccion_destino>\"\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n preorden = preorden+\"\n <articulo>\n <id>\"+p.id.to_s+\"</id>\n <descripcion>\"+p.descripcion+\"</descripcion>\n <peso>\"+p.peso.to_s+\"</peso>\n <cantidad>\"+seleccion.cantidad.to_s+\"</cantidad>\n <precio>\"+p.precio.to_s+\"</precio>\n </articulo>\"\n end\n preorden = preorden+\"</solicitud_pedido>\"\n response = client.request :ejemplo, body: { \"value\" => preorden } \n if response.success? \n respuesta = response.to_hash[:ejemplo_response][:return]\n datos = XmlSimple.xml_in(respuesta)\n end\n\n @precio_envio = datos[\"num_orden\"][0]\n #@arreglo = XmlSimple.xml_in('')\n #@xml = XmlSimple.xml_out(@arreglo, { 'RootName' => 'solicitud_pedido' })\n #url = 'http://192.168.1.101/Antonio/tukyosquito/proyecto/servicio/servicio.php'\n #cotizacion = SOAP::RPC::Driver.new(url)\n #cotizacion.add_method('obtener','asd')\n #tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n #@respuesta = cotizacion.obtener('123')\n format.html # new.html.erb\n else\n format.html { redirect_to carrito_path, notice: 'No tiene productos agregados al carro de compras para generar una orden.' }\n end\n end\n end",
"def index\n @detalles = Detalle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @detalles }\n end\n end",
"def create\n\n @pedidodetalle = Pedidodetalle.new(params[:pedidodetalle])\n\n @pedidodetalles = Pedidodetalle.all\n\n respond_to do |format|\n if @pedidodetalle.save\n format.html { redirect_to pedidodetalles_url, notice: 'Guardado!' }\n else\n render :action => 'index'\n end\n end\n end",
"def create\n @sesiune = Sesiune.new(sesiune_params)\n\n respond_to do |format|\n if @sesiune.save\n\n # duplic temele si domeniile din ultima sesiune si le adaug in baza de date cu sesiune_id asta pe care tocmai am creat-o\n @ultima_sesiune = Sesiune.where(este_deschisa: false).last\n Domeniu.where(sesiune_id: @ultima_sesiune.id).each do |dom|\n nou_dom = Domeniu.create(nume: dom.nume, descriere: dom.descriere, user_id: dom.user_id, sesiune_id: @sesiune.id)\n Tema.where(sesiune_id: @ultima_sesiune.id).where(domeniu_id: dom.id).each do |tema|\n Tema.create(nume: tema.nume, descriere: tema.descriere, domeniu_id: nou_dom.id, este_libera: true, user_id: tema.user_id, sesiune_id: @sesiune.id)\n # ce faci dc user_id-ul temei este un student care a terminat? si th i se desfiinteaza contul?\n end\n end\n\n format.html { redirect_to controlPanel_path, notice: 'Sesiune was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sesiune }\n else\n format.html { render action: 'new' }\n format.json { render json: controlPanel_path.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @estacionamiento = Estacionamiento.new(estacionamiento_params)\n @lista_departamentos = Ubigeo.find_by_sql(\"select distinct idDepartamento, Departamento from ubigeos\")\n @lista_provincias = Ubigeo.find_by_sql(\"select distinct idProvincia, Provincia from ubigeos\")\n @lista_distritos = Ubigeo.find_by_sql(\"select distinct idDistrito, Distrito from ubigeos\")\n @serv_adicinales = ServAdicinale.all\n\n respond_to do |format|\n if @estacionamiento.save\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully created.' }\n format.json { render :show, status: :created, location: @estacionamiento }\n else\n format.html { render :new }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @detalle = Detalle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @detalle }\n end\n end",
"def new\n @pedidodetalle = Pedidodetalle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pedidodetalle }\n end\n end",
"def destroy\n @serie_detalle.destroy\n respond_to do |format|\n format.html { redirect_to serie_detalles_url, notice: 'Serie detalle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @objeto = DetallePedido.new(detalle_pedido_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Detalle pedido was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @producto_detalle = ProductoDetalle.new(producto_detalle_params)\n\n respond_to do |format|\n if @producto_detalle.save\n format.html { redirect_to @producto_detalle, notice: 'Producto detalle was successfully created.' }\n format.json { render :show, status: :created, location: @producto_detalle }\n else\n format.html { render :new }\n format.json { render json: @producto_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @compra_detalle = CompraDetalle.new(params[:compra_detalle])\n\n respond_to do |format|\n if @compra_detalle.save\n format.html { redirect_to @compra_detalle, notice: 'Compra detalle was successfully created.' }\n format.json { render json: @compra_detalle, status: :created, location: @compra_detalle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @compra_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: SerieDetallesDatatable.new(view_context) }\n end\n end",
"def detalle_params\n params.require(:detalle).permit(:nofra, :codigoprd, :cantidad, :impuesto, :precio)\n end",
"def new\r\n @salle = Salle.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @salle }\r\n end\r\n end",
"def estaciones\n\n param_estacion = params[:estacion]\n param_fecha = params[:fecha].to_i\n @info_polens = InfoPolen.where({\"ESTACIONES\" => param_estacion, \"FECHA\" => param_fecha}).order_by(:TIPOS_POLINICOS.asc)\n\n respond_to do |format|\n format.html #{ redirect_to info_polens_url }\n format.json { render json: @info_polens }\n end\n end",
"def create\n @safra_verdoso = SafraVerdoso.new(params[:safra_verdoso])\n\n respond_to do |format|\n if @safra_verdoso.save\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { render json: @safra_verdoso, status: :created, location: @safra_verdoso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def detalle_params\n params.require(:detalle).permit(:jobName, :buildNumber, :output, :ejecutor, :fecha, :tiendas, :status, :pos)\n end",
"def index\n @detalles = Detalle.all\n end",
"def new\n @estudiante = Estudiante.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estudiante }\n end\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def create\n @detalle_carrito = DetalleCarrito.new(detalle_carrito_params)\n\n respond_to do |format|\n if @detalle_carrito.save\n format.html { redirect_to @detalle_carrito, notice: 'Detalle carrito was successfully created.' }\n format.json { render :show, status: :created, location: @detalle_carrito }\n else\n format.html { render :new }\n format.json { render json: @detalle_carrito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @compra_detalle = CompraDetalle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @compra_detalle }\n end\n end",
"def update\n respond_to do |format|\n if @serie_detalle.update(serie_detalle_params)\n format.html { redirect_to @serie_detalle, notice: 'Serie detalle was successfully updated.' }\n format.json { render :show, status: :ok, location: @serie_detalle }\n else\n format.html { render :edit }\n format.json { render json: @serie_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def create\n @reporte_detalle = ReporteDetalle.new(reporte_detalle_params)\n\n respond_to do |format|\n if @reporte_detalle.save\n format.html { redirect_to @reporte_detalle, notice: 'Reporte detalle was successfully created.' }\n format.json { render :show, status: :created, location: @reporte_detalle }\n else\n format.html { render :new }\n format.json { render json: @reporte_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @detalle_factura = DetalleFactura.new(detalle_factura_params)\n\n respond_to do |format|\n if @detalle_factura.save\n format.html { redirect_to @detalle_factura, notice: 'Detalle factura was successfully created.' }\n format.json { render :show, status: :created, location: @detalle_factura }\n else\n format.html { render :new }\n format.json { render json: @detalle_factura.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @estacionamiento = Estacionamiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estacionamiento }\n end\n end",
"def new\n @seguidore = Seguidore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seguidore }\n end\n end",
"def sondagesParAdmin\n sondages = SondageService.instance.listeDesSondagesParAdmin(params[:id])\n render json: sondages, status: :ok\n end",
"def create\n @datos_estudiante = DatosEstudiante.new(datos_estudiante_params)\n\n respond_to do |format|\n if @datos_estudiante.save\n format.html { redirect_to @datos_estudiante, notice: 'Datos estudiante was successfully created.' }\n format.json { render :show, status: :created, location: @datos_estudiante }\n else\n format.html { render :new }\n format.json { render json: @datos_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @salle = Salle.new(params[:salle])\r\n\r\n respond_to do |format|\r\n if @salle.save\r\n format.html { redirect_to @salle, notice: 'Salle was successfully created.' }\r\n format.json { render json: @salle, status: :created, location: @salle }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @salle.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def salvar\n i = 0\n if @data.present?\n @data.each do |detalle|\n @detalle = Detail.new(producto: detalle[\"nombre\"], cantidad: detalle[\"cantidad\"] , precio: detalle[\"costo\"], precioventa: detalle[\"precio\"], total: detalle[\"total\"] , descuento: detalle[\"descuento\"], descuentoproveedor: detalle[\"descuentodistribuidor\"], ventum_id: @ventum.id )\n @detalle.save\n i = i + 1\n end\n end\n if @tiempo_instalar.present?\n @detalle = Detail.new(producto: @activacion, cantidad: @tiempo_instalar , precio: @precioinstalar, precioventa: @precioinstalar, total: @costo_instalar, descuento:@descuentoinstalar , venta_id: @ventum.id )\n @detalle.save\n end\n end",
"def new\n @safra_verdoso = SafraVerdoso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safra_verdoso }\n end\n end",
"def create\n @detalles_basico = DetallesBasico.new(detalles_basico_params)\n\n respond_to do |format|\n if @detalles_basico.save\n format.html { redirect_to @detalles_basico, notice: 'Detalles basico was successfully created.' }\n format.json { render :show, status: :created, location: @detalles_basico }\n else\n format.html { render :new }\n format.json { render json: @detalles_basico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @productos_detalles = ProductoDetalle.all\n end",
"def create\n @organisme = Organisme.new(organisme_params)\n params[:departements] ||= []\n @organisme.departements.delete_all\n @dep_table = params[:departements]\n logger.debug \"Departements table sent : #@dep_table\"\n @dep_table.each do |depid|\n @organisme.departements << Departement.find(depid)\n end\n respond_to do |format|\n if @organisme.save\n format.html { redirect_to action: \"index\", notice: 'Organisme was successfully created.' }\n format.json { render :index, status: :created, location: @organisme }\n else\n format.html { render :new }\n format.json { render json: @organisme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @detalle_documento_de_compra = DetalleDocumentoDeCompra.new(detalle_documento_de_compra_params)\n\n respond_to do |format|\n if @detalle_documento_de_compra.save\n format.html { redirect_to @detalle_documento_de_compra, notice: 'Detalle documento de compra was successfully created.' }\n format.json { render :show, status: :created, location: @detalle_documento_de_compra }\n else\n format.html { render :new }\n format.json { render json: @detalle_documento_de_compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ordenes_consumos_detalle = OrdenesConsumosDetalle.new(ordenes_consumos_detalle_params)\n\n respond_to do |format|\n if @ordenes_consumos_detalle.save\n format.html { redirect_to @ordenes_consumos_detalle, notice: 'Ordenes consumos detalle was successfully created.' }\n format.json { render :show, status: :created, location: @ordenes_consumos_detalle }\n else\n format.html { render :new }\n format.json { render json: @ordenes_consumos_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @serv_adicionale = ServAdicionale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serv_adicionale }\n end\n end",
"def create\n @lista_desejo = ListaDesejo.new(lista_desejo_params)\n\n respond_to do |format|\n if @lista_desejo.save\n format.html { redirect_to back_uri, warning: 'Adicionado a lista de desejos.' }\n format.json { render :show, status: :created, location: @lista_desejo }\n else\n format.html { render :new }\n format.json { render json: @lista_desejo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def androidreserva\n\n @reservas = Reservation.all\n \n \n\n render :json => {\n :reservas => @reservas\n \n\n }\n\n \n end",
"def create\n @deporte = Deporte.new(deporte_params)\n\n if @deporte.save\n render :show, status: :created, location: @deporte\n else\n render json: @deporte.errors, status: :unprocessable_entity\n end\n end",
"def create\n item_exists = false\n item_id = params[:detalle_ot_presupuesto][:repuesto_servicio_id].to_i\n @orden_trabajo_presupuesto.detalle_ot_presupuestos.each do |detail|\n if detail.repuesto_servicio_id == item_id\n # Ya existe el item en la factura, agregar cantidad\n item_exists = true\n @detalle_ot_presupuesto = detail\n @saved_sale_detail = detail.id\n break\n end\n end\n if item_exists\n @detalle_ot_presupuesto.cantidad += params[:detalle_ot_presupuesto][:cantidad].to_i\n @detalle_ot_presupuesto.precio_venta= params[:detalle_ot_presupuesto][:precio_venta].to_f\n @detalle_ot_presupuesto.save!\n else\n detalle_ot_presupuesto = DetalleOtPresupuesto.new(detalle_ot_presupuesto_params)\n @orden_trabajo_presupuesto.detalle_ot_presupuestos << detalle_ot_presupuesto\n end\n\n respond_to do |format|\n \n if @orden_trabajo_presupuesto.save\n format.html {redirect_to @orden_trabajo_presupuesto, notice: 'El detalle se agregó correctamente.'}\n format.json {render :show, status: :created, location: @detalle_compra}\n else\n format.html {render :new}\n format.json {render json: @detalle_ot_presupuesto.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @detalhe = Detalhe.new(detalhe_params)\n\n respond_to do |format|\n if @detalhe.save\n format.html { redirect_to @detalhe, notice: 'Detalhe was successfully created.' }\n format.json { render action: 'show', status: :created, location: @detalhe }\n else\n format.html { render action: 'new' }\n format.json { render json: @detalhe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @serv = Serv.new\n @serv.conn=Conn.new\n @net_eles = NetEle.all\n if @net_eles.count > 0\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @serv }\n end\n else\n respond_to do |format|\n format.html { redirect_to servs_url, notice: t('servs.delete.error_mo') }\n format.json { render json: @servs.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end",
"def new\n\t@clidistrict_array = Clidistrict.find(:all).collect {|p| [ p.name, p.id ] }\n\t@documenttype_array = Documenttype.find(:all).collect {|p| [ p.name, p.id ] }\n @fulcliente = Fulcliente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fulcliente }\n end\n end",
"def create_ofertas\n\n\n\n arr_ofertas = []\n params.select { |par, val| par.starts_with?('oferta') && val.present? }.each do |puja|\n mid = puja.first.delete('oferta_')\n eliminar = params[\"delflag#{mid}\"] == '1'\n oferta = Oferta.new :mercado_id => mid, :seleccion_id => current_user.current_seleccion(session).id, :valor => puja.last.to_f, :estado => Oferta::PENDIENTE\n oferta.estado = Oferta::CANCELADA if eliminar\n\n oferta = oferta.save_if_valid\n arr_ofertas << I18n.t('mercado.oferta.oferta_creada', {:jugador => oferta.mercado.jugador.nombre, :valor => oferta.valor})\n end\n\n flash.now[:notice] = arr_ofertas.join '<br/>'\n\n # actualizamos los datos\n datos_ofertas\n\n respond_to do |format|\n format.js\n end\n\n end",
"def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end",
"def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end",
"def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end",
"def new\n @estatuto = Estatuto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def destroy\n @detalle.destroy\n respond_to do |format|\n format.html { redirect_to detalles_url, notice: 'Detalle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @matriz = Matriz.new(params[:matriz])\n @niveis = NiveisEnsino.order(:nome).collect{|n|[n.nome,n.id]}\n respond_to do |format|\n if @matriz.save\n @series = @matriz.series.all.uniq\n format.html { redirect_to(@matriz, :notice => 'Matriz cadastrado com sucesso.') }\n format.xml { render :xml => @matriz, :status => :created, :location => @matriz }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @matriz.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @depoevento = Depoevento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @depoevento }\n end\n end",
"def new\n @sugerencia = Sugerencia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sugerencia }\n end\n end",
"def detalle_params\n params.require(:detalle).permit(:producto_id, :cantidad, :consolidado_id)\n end",
"def new\n @deuda = Deuda.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deuda }\n end\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 new\n @peticion_servicio_ti = Peticion::ServicioTi.new\n load_data\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @peticion_servicio_ti }\n end\n end",
"def show\n @deporte= set_deporte\n render json: @deporte, status: :ok\n\n end",
"def create\n @compra = Compra.new(:usuario_id => session[:usuario][:id])\n \n # Adicion de items a compra\n session[:carrito].each do |c|\n @compra.compra_detalles << CompraDetalle.new(:producto_id => c.id, :cantidad => c.cantidad, :precio => c.precio)\n end\n\n respond_to do |format|\n if @compra.save\n flash[:notice] = 'Se realizo correctamente la compra.'\n format.html { redirect_to(@compra) }\n format.xml { render :xml => @compra, :status => :created, :location => @compra }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @compra.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_detalle\n @detalle = Detalle.find(params[:id])\n end",
"def set_detalle\n @detalle = Detalle.find(params[:id])\n end",
"def set_detalle\n @detalle = Detalle.find(params[:id])\n end",
"def tout\n #propriétaire\n \n # Block execution if there is no current user\n if(current_user.blank?)\n return render json:{\n errors: \"true\",\n message: \"User not connected\"\n }, status: 401\n end\n\n user = current_user\n logements = Logement.where(user_id: user)\n tarif = []\n #================ propriétaire =====================\n logements.each do |logement|\n tarif << {logement:logement,tarif:logement.calendrier,photo:\"#{logement.photos.first.photo}\",promotion:logement.promotions}\n end\n \n #================= cogestion ============\n logcngestions = Logement.all\n logcngestions.each do |logcogestion|\n if logcogestion.user != user && logcogestion.cogestion.present?\n if logcogestion.cogestion.include?(user.id)\n tarif << {logement:logcogestion,tarif:logcogestion.calendrier,photo:\"#{logcogestion.photos.first.photo}\",promotion:logcogestion.promotions}\n end\n end\n end\n \n render json:{\n tarif:tarif\n } \n end",
"def index\n #@users = User.all\n @respuesta = Consulta.new(300,params[0])\n\n respond_to do |format|\n format.json { render json: @respuesta }\n \n end\n end",
"def new\n @dossier = Dossier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dossier }\n end\n end",
"def estudiantes\n\t\t@seccion = \"Estudiantes\"\n @titulo = \"Estudiantes\"\n\t\tif params[:orden]\n\t\t\t@orden = params[:orden]\n\t\telse\n\t\t\t@orden = \"Cédula\"\n\t\tend\n\n #Guardo todos los estudiantes\n if Estudiante.all().size > 0\n case @orden\n \twhen \"Cédula\"\n \t\t@usuarios = Usuario.order('cedula').where(:id => Estudiante.all)\n \twhen \"Nombre\"\n \t\t@usuarios = Usuario.order('nombre').where(:id => Estudiante.all)\n \twhen \"Apellido\"\n \t\t@usuarios = Usuario.order('apellido').where(:id => Estudiante.all)\n \twhen \"Correo\"\n \t\t@usuarios = Usuario.order('correo').where(:id => Estudiante.all)\n \tend\n end\n\n\t\t@categorias = ['Cédula', 'Nombre', 'Apellido', 'Correo'] #Este es el orden que se mostrará en el select de la vista\n\n\t\t@estudiante_datos = [] #En este arreglo se guardan los pares \"Cedula - Nombre Apellido\" de cada usuario para mostrar en el campo de busqueda\n\t\tUsuario.order('nombre').where(:id => Estudiante.all).each do |usuario|\n\t\t\t#En este foro se agregan uno a uno los valores de cada estudiante al arreglo de la manera indicada arriba\n\t\t\t@estudiante_datos << usuario.cedula.to_s + \" - \" + usuario.nombre_y_apellido.to_s\n\t\tend\n\tend",
"def new\n @safra_produto = SafraProduto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @safra_produto }\n end\n end",
"def create\n @detalle_orden_trabajo = DetalleOrdenTrabajo.new(detalle_orden_trabajo_params)\n @detalle_orden_trabajo.orden_trabajo = @orden_trabajo\n\n respond_to do |format|\n if @detalle_orden_trabajo.save\n format.html { redirect_to @detalle_orden_trabajo.orden_trabajo, notice: 'Detalle fue creado con éxito.' }\n format.json { render :show, status: :created, location: @detalle_orden_trabajo }\n else\n format.html { render :new }\n format.json { render json: @detalle_orden_trabajo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @spieler = Spieler.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @spieler }\n end\n end",
"def new\n @realiza = Realiza.new\n @pessoas=Pessoa.select(\"clientes.id,pessoas.nome\").joins(:cliente)\n @funcionarios=Pessoa.select(\"usuarios.id,pessoas.nome\").joins(:usuario)\n #@pessoas=Pessoa.select(\"clientes.id,pessoas.nome\").joins(:clientes)\n #@funcionarios=Pessoa.where(\"id in (?)\",Usuario.select(\"pessoa_id as id\").map(&:id))\n @servicos=Servico.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @realiza and @pessoas and @funcionarios and @servicos}\n end\n end",
"def index\n @sensor = Sensor.find(params[:id])\n @values = @sensor.values\n # render json: @values\n\n s = []\n for v in @values \n s.push( { :id => v.id, :decibel => v.decibel } )\n end\n render json: s\n\n end",
"def create\n movimiento_caja = MovimientoCaja.find(params[:movimiento_caja_id])\n @movimiento_de_cajas_detalle = movimiento_caja.movimiento_de_cajas_detalles.create(params[:movimiento_caja])\n respond_to do |format|\n if @movimiento_de_cajas_detalle.save\n format.html { redirect_to [@movimiento_de_cajas_detalle.movimiento_caja, @movimiento_de_cajas_detalle] }\n format.json { render :show, status: :created, location: [@movimiento_de_cajas_detalle.movimiento_caja, @movimiento_de_cajas_detalle] }\n else\n format.html { render :new }\n format.json { render json: @movimiento_de_cajas_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_detalle\n @detalle = Detalle.find(params[:id])\n end",
"def set_detalle\n @detalle = Detalle.find(params[:id])\n end",
"def create\n #Parámetros permitidos.\n lectura_params\n\n #Asignación de variables.\n numero = params[:lectura][:numero].upcase\n actual = params[:lectura][:actual].to_i\n medidor = Medidor.find_by(numero: numero)\n periodo = Periodo.last\n consumominimo = Servicio.find_by(id: 1)\n\n #Cálculos.\n consumototal = actual - medidor.medicion\n consumototal = actual - medidor.medicion\n if consumototal > consumominimo.m3 then\n consumoexceso = consumototal - consumominimo.m3\n else\n consumoexceso = 0\n end\n\n #Editar lectura.\n @lectura = Lectura.new\n @lectura.cliente_id = medidor.cliente_id\n @lectura.periodo_id = periodo.id\n @lectura.fecha = Date.today\n @lectura.numero = numero\n @lectura.actual = actual\n @lectura.consumo = consumototal\n @lectura.exceso = consumoexceso\n\n #Guardar lectura.\n respond_to do |format|\n if @lectura.save\n medidor.medicion = actual\n medidor.save\n puts'Lectura guardada'\n format.json { render :show, status: :created, location: @lectura }\n #format.html { redirect_to @lectura, notice: 'La lectura fue creada.' }\n #format.js { }\n else\n puts'Lectura no guardada'\n format.json { render json: @lectura.errors, status: :unprocessable_entity }\n #format.html { render :new }\n end\n end\n end",
"def create\n @serie = Serie.new(params[:serie])\n\n respond_to do |format|\n if @serie.save\n format.html { redirect_to(niveis_ensino_serie_url(@nivel,@serie) , :notice => 'Serie cadastrado com sucesso.') }\n format.xml { render :xml => @serie, :status => :created, :location => @serie }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @diemtrentuyen = Diemtrentuyen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @diemtrentuyen }\n end\n end",
"def index\n @deportes = Deporte.all\n render json: @deportes, status: :ok \n @deportes = Deporte.paginate(:page => params[:page])\n end",
"def index\n @dossiers = Dossier.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dossiers }\n end\n end",
"def new\n @expediente = Expediente.new\n @municipios = Municipio.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expediente }\n end\n end",
"def create\n @consulta = Consulta.new(params[:consulta])\n\n if @consulta.save\n render json: @consulta, status: :created, location: @consulta\n else\n render json: @consulta.errors, status: :unprocessable_entity\n end\n end",
"def create\n @point_service = PointService.new(point_service_params)\n if (@point_service.adresse.present?)\n @point_service.adresse.point_service = @point_service\n @point_service.adresse.save\n end\n @organisme = Organisme.find(params[:organisme_id])\n params[:departements] ||= []\n @point_service.departements.delete_all\n @dep_table = params[:departements]\n logger.debug \"Departements table sent : #@dep_table\"\n @dep_table.each do |depid|\n @point_service.departements << Departement.find(depid)\n end\n @point_service.organisme = @organisme\n respond_to do |format|\n if @point_service.save\n format.html { redirect_to organisme_path(@organisme), notice: 'Point service was successfully created.' }\n format.json { render :index, status: :created, location: @organisme }\n else\n format.html { render :new }\n format.json { render json: @point_service.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n\n if params[:ventas_seguimiento]\n cliente_id = params[:ventas_seguimiento][:cliente_id]\n @ventas_seguimientos = Ventas::Seguimiento.where(\"cliente_id = ?\",cliente_id).order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new(:cliente_id => cliente_id)\n else\n @ventas_seguimientos = Ventas::Seguimiento.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n @seguimientos = Ventas::Seguimiento.new\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_seguimientos }\n end\n end",
"def create\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://localhost:3001/servicios/wsdl\")\n tdc = Tarjeta.where(\"id = ? AND cliente_id = ?\",params[:orden][:tarjeta_id],usuario_actual.id)\n total_pagar = params[:orden][:total]\n pago = '<Message>\n <Request>\n <numero_tdc>'+tdc.numero+'</numero_tdc>\n <nombre_tarjetahabiente>'+tdc.tarjetahabiente+'</nombre_tarjetahabiente>\n <fecha_vencimiento>'+tdc.mes_vencimiento+'/'+tdc.ano_vencimiento+'</fecha_vencimiento>\n <codigo_seguridad>'+tdc.codigo+'</codigo_seguridad>\n <tipo_tarjeta>'+tdc.tipo+'</tipo_tarjeta>\n <direccion_cobro>'+tdc.direccion+'</direccion_cobro>\n <total_pagar>'+total_pagar+'</total_pagar>\n <cuenta_receptora>'+cuenta_receptora+'</cuenta_receptora>\n </Request>\n </Message>'\n #response = client.request :verificar_pago, body: { \"value\" => pago } \n #if response.success?\n # data = response.to_hash[:verificar_pago_response][:value][:response].first\n # @respuesta = XmlSimple.xml_in(data)\n #end\n\n #NAMESPACE = 'pagotdc'\n #URL = 'http://localhost:8080/'\n #banco = SOAP::RPC::Driver.new(URL, NAMESPACE)\n #banco.add_method('verificar_pago', 'numero_tdc', 'nombre_tarjetahabiente', 'fecha_vencimiento', 'codigo_seguridad', 'tipo_tarjeta', 'direccion_cobro', 'total_pagar', 'cuenta_receptora')\n #\n \n #respuesta = banco.verificar_pago(tdc.numero, tdc.tarjetahabiente, tdc.mes_vencimiento.to_s+'/'+tdc.ano_vencimiento.to_s, tdc.codigo, tdc.tipo, params[:orden][:total], tdc.direccion)\n \n if true #respuesta.ack.eql?(0)\n params[:orden][:cliente_id] = usuario_actual.id\n params[:orden][:total] = Seleccion.precio_total(usuario_actual.id)\n params[:orden][:fecha_entrega] = \"0000-00-00\"\n @orden = Orden.new(params[:orden])\n \n if @orden.save\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @selecciones.each do |seleccion|\n p = Producto.find(seleccion.producto_id)\n @venta = Venta.new(:producto_id=>p.id, \n :orden_id=>@orden.id,\n :categoria_id=>p.categoria_id, \n :cantidad=>seleccion.cantidad,\n :costo=>p.precio)\n @venta.save\n end\n \n Seleccion.vaciar_carro(usuario_actual.id)\n respond_to do |format|\n format.html { redirect_to ver_ordenes_path, notice: 'Orden generada correctamente.' }\n end\n else\n respond_to do |format|\n format.html { render action: \"new\" }\n end\n end\n else\n respond_to do |format|\n format.html { render action: \"new\", notice: respuesta.mensaje }\n end\n end\n end",
"def create\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def comp\n @evento=Evento.where(:id_creator => params[:id_creator].to_i)\n @eventos_nous=Array.new\n @evento.each do |e|\n @eventos_nous << Evento.find_by_id(e.id).formatted_data.as_json()\n end\n render json: @eventos_nous\n end",
"def new\n @etudiant = Etudiant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @etudiant }\n end\n end",
"def new\n @coligacao_partido = ColigacaoPartido.new\n @partidos = Partido.find(:all, :order => \"nome\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coligacao_partido }\n end\n end",
"def new\n render :json => @fiestas.push(params[:fiesta])\n end",
"def create\n @serv_adicionale = ServAdicionale.new(params[:serv_adicionale])\n\n respond_to do |format|\n if @serv_adicionale.save\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully created.' }\n format.json { render json: @serv_adicionale, status: :created, location: @serv_adicionale }\n else\n format.html { render action: \"new\" }\n format.json { render json: @serv_adicionale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @reparacion = Reparacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reparacion }\n end\n end",
"def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.66736126",
"0.65056723",
"0.64361787",
"0.64031804",
"0.6363406",
"0.6248238",
"0.612041",
"0.6109776",
"0.6064104",
"0.6048287",
"0.60350007",
"0.60214967",
"0.6021142",
"0.6006228",
"0.5938662",
"0.5898981",
"0.5842851",
"0.5834577",
"0.5831961",
"0.58063686",
"0.577489",
"0.5741799",
"0.5735911",
"0.57079375",
"0.5703435",
"0.56767803",
"0.56632805",
"0.5639994",
"0.5636114",
"0.56311023",
"0.5629314",
"0.56244755",
"0.56215906",
"0.5606786",
"0.55977654",
"0.55927074",
"0.55831236",
"0.5578211",
"0.5573408",
"0.55696166",
"0.5567932",
"0.5567391",
"0.55584276",
"0.5558331",
"0.5539529",
"0.5538608",
"0.55380225",
"0.5527755",
"0.5520283",
"0.5516384",
"0.55154085",
"0.5512414",
"0.5512287",
"0.55027574",
"0.5493375",
"0.54888856",
"0.54886633",
"0.54871356",
"0.5484247",
"0.5474346",
"0.54711264",
"0.5467263",
"0.5463838",
"0.5463229",
"0.5460137",
"0.54548055",
"0.5451966",
"0.54510504",
"0.54510504",
"0.54510504",
"0.5434438",
"0.5431344",
"0.54274356",
"0.5415917",
"0.54150224",
"0.5409275",
"0.53859794",
"0.5385721",
"0.5385433",
"0.5380081",
"0.53785783",
"0.53785783",
"0.53762054",
"0.5375956",
"0.53729373",
"0.53691024",
"0.536799",
"0.53669906",
"0.5366105",
"0.5364679",
"0.5360851",
"0.5357524",
"0.5356715",
"0.53562915",
"0.5351555",
"0.53511184",
"0.5346568",
"0.5344385",
"0.5342594",
"0.53419733"
] |
0.72542274
|
0
|
PATCH/PUT /serie_detalles/1 PATCH/PUT /serie_detalles/1.json
|
def update
respond_to do |format|
if @serie_detalle.update(serie_detalle_params)
format.html { redirect_to @serie_detalle, notice: 'Serie detalle was successfully updated.' }
format.json { render :show, status: :ok, location: @serie_detalle }
else
format.html { render :edit }
format.json { render json: @serie_detalle.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @detalle = Detalle.find(params[:id])\n\n respond_to do |format|\n if @detalle.update_attributes(params[:detalle])\n format.html { redirect_to @detalle, notice: 'Detalle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n respond_to do |format|\n if @detalle.update(detalle_params)\n format.html { redirect_to @detalle, notice: 'Detalle was successfully updated.' }\n format.json { render :show, status: :ok, location: @detalle }\n else\n format.html { render :edit }\n format.json { render json: @detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(detalle_pedido_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Detalle pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @compra_detalle = CompraDetalle.find(params[:id])\n\n respond_to do |format|\n if @compra_detalle.update_attributes(params[:compra_detalle])\n format.html { redirect_to @compra_detalle, notice: 'Compra detalle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @compra_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @salle = Salle.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @salle.update_attributes(params[:salle])\r\n format.html { redirect_to @salle, notice: 'Salle was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @salle.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @salle.update(salle_params)\n format.html { redirect_to salles_url, notice: 'Salle was successfully updated.' }\n format.json { render :show, status: :ok, location: @salle }\n else\n format.html { render :edit }\n format.json { render json: @salle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n obtener_datos()\n @status = params[:statusproyect]\n @cliente = params[:cliente] + \" \" +params[:cliente_apellido]\n respond_to do |format|\n if @ventum.update(cliente: @cliente, clave:@clave, fecha:@fecha, iva:@iva,subtotal:@preciofinal ,total:@totalcosto, descuentogeneral: @descglobal , distribuidor: @distribuidor, status: @status)\n @detail.each do |x|\n x.destroy\n end\n salvar()\n format.html { redirect_to @ventum, notice: 'Venta actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @ventum }\n else\n format.html { render :edit }\n format.json { render json: @ventum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_serie_detalle\n @serie_detalle = SerieDetalle.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @sivic_discipulo.update(sivic_discipulo_params_netested)\n format.html { redirect_to @sivic_discipulo, notice: 'Registro alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sivic_discipulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update\n @dossier = Dossier.find(params[:id])\n \n respond_to do |format|\n if @dossier.update_attributes(params[:dossier])\n format.html { redirect_to(@dossier, :notice => 'Dossier was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :success => true, :message => \"Updated Dossier #{@dossier.id}\", :data => @dossier.attributes.merge(:institution_nom => @dossier.institution.nom, :type_etat_dossier_description => @dossier.type_etat_dossier.try(:description), :juge_mission_id => @dossier.juge_mission.try(:contact_id), :juge_controlleur_id => @dossier.juge_controlleur.try(:contact_id))}}\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @dossier.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @producto_detalle.update(producto_detalle_params)\n format.html { redirect_to @producto_detalle, notice: 'Producto detalle was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_detalle }\n else\n format.html { render :edit }\n format.json { render json: @producto_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:laboratorio][:activo]\n id = params[:id]\n Laboratorio.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n if @servicio.update_attributes(params[:servicio])\n format.html { redirect_to @servicio, :notice => 'Servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @servicio.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @detalle_carrito.update(detalle_carrito_params)\n format.html { redirect_to @detalle_carrito, notice: 'Detalle carrito was successfully updated.' }\n format.json { render :show, status: :ok, location: @detalle_carrito }\n else\n format.html { render :edit }\n format.json { render json: @detalle_carrito.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @detalle_documento_de_compra.update(detalle_documento_de_compra_params)\n format.html { redirect_to @detalle_documento_de_compra, notice: 'Detalle documento de compra was successfully updated.' }\n format.json { render :show, status: :ok, location: @detalle_documento_de_compra }\n else\n format.html { render :edit }\n format.json { render json: @detalle_documento_de_compra.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @consulta = Consulta.find(params[:id])\n\n if @consulta.update(params[:consulta])\n head :no_content\n else\n render json: @consulta.errors, status: :unprocessable_entity\n end\n end",
"def update\n @serv_adicionale = ServAdicionale.find(params[:id])\n\n respond_to do |format|\n if @serv_adicionale.update_attributes(params[:serv_adicionale])\n format.html { redirect_to @serv_adicionale, notice: 'Serv adicionale was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serv_adicionale.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @consulta_viaje.update(consulta_viaje_params)\n format.html { redirect_to @consulta_viaje, notice: 'Consulta viaje was successfully updated.' }\n format.json { render :show, status: :ok, location: @consulta_viaje }\n else\n format.html { render :edit }\n format.json { render json: @consulta_viaje.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n\n respond_to do |format|\n if @solicitud_servicio.update_attributes(params[:solicitud_servicio])\n format.html { redirect_to @solicitud_servicio, notice: 'Solicitud servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @solicitud_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ticket_detalle.update(ticket_detalle_params)\n format.html { redirect_to @ticket_detalle, notice: 'Ticket detalle was successfully updated.' }\n format.json { render :show, status: :ok, location: @ticket_detalle }\n else\n format.html { render :edit }\n format.json { render json: @ticket_detalle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sekilas_info.update(sekilas_info_params)\n format.html { redirect_to @sekilas_info, notice: 'Sekilas info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sekilas_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serie = Serie.find(params[:id])\n\n respond_to do |format|\n if @serie.update_attributes(serie_params)\n format.html { redirect_to(@serie, :notice => 'Serie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @servico.update(servico_params)\n format.html { redirect_to servicos_url, notice: 'Serviço atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @servico }\n else\n format.html { render :edit }\n format.json { render json: @servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @seguidore = Seguidore.find(params[:id])\n\n respond_to do |format|\n if @seguidore.update_attributes(params[:seguidore])\n format.html { redirect_to @seguidore, notice: 'Seguidore was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seguidore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @detalhe.update(detalhe_params)\n format.html { redirect_to @detalhe, notice: 'Detalhe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @detalhe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:elefe][:prix]\n params[:elefe][:info_ville] = params[:elefe][:info_ville].join(',') if params[:elefe][:info_ville] != nil\n params[:elefe][:prix] = @tarif[params[:elefe][:parentee].to_i] if params[:elefe][:parentee] != nil\n params[:elefe][:signature] = false\n cour = Cour.find_by(:id => params[:elefe][:ville_entrainement])\n cours = @elefe.cours\n if !cours.detect { |b| b.id == cour.id }\n @elefe.cours << cour\n end\n @elefe.commandes.first.update(montant: params[:elefe][:prix])\n @elefe.update_attributes(:updated_at => Time.now)\n end\n respond_to do |format|\n if @elefe.update(elefe_params)\n format.html { redirect_to @elefe, notice: 'La fiche élève a bien été modifiée.' }\n format.json { render :show, status: :ok, location: @elefe }\n else\n format.html { render :edit }\n format.json { render json: @elefe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_de_servicio.update(tipo_de_servicio_params)\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @serie = Serie.find(params[:id])\n\n respond_to do |format|\n if @serie.update_attributes(params[:serie])\n format.html { redirect_to(niveis_ensino_serie_url(@nivel,@serie), :notice => 'Serie atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @compra_venta_normal.update(compra_venta_normal_params)\n format.html { redirect_to @compra_venta_normal, notice: 'Compra venta normal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compra_venta_normal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @productos = Car.where(:pedidoID => params[:id])\n respond_to do |format| \n if @pedido.update(pedido_params)\n \n format.html { redirect_to \"/\", notice: 'Pedido was successfully updated.' }\n format.json { render :show, status: :ok, location: @pedido }\n RestClient.post \"https://api:key-e7d79c66e74391fdf48b657624f23ddc\"\\\n \"@api.mailgun.net/v3/sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org/messages\",\n :from => \"Sistema de Pedidos <mailgun@sandboxb9c2dadab0ea49f6b7130d1091646c59.mailgun.org>\",\n #:to => \"proteina@sinergroup.com.mx\",\n :to => \"proteina@sinergroup.com.mx\",\n :subject => \"Solicitud de Pedido\",\n :html => (render_to_string(template: \"../views/pedidos/email\")).to_str\n else\n format.html { render :edit }\n format.json { render json: @pedido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @semestre.update(semestre_params)\n format.html { redirect_to semestres_url, notice: 'Semestre was successfully updated.' }\n format.json { render :show, status: :ok, location: @semestre }\n else\n format.html { render :edit }\n format.json { render json: @semestre.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tb_servicio.update(tb_servicio_params)\n format.html { redirect_to @tb_servicio, notice: 'Tb servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tb_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sejour.update(sejour_params)\n format.html { redirect_to @sejour, notice: 'Sejour mis a jour.' }\n format.json { render :show, status: :ok, location: @sejour }\n else\n format.html { render :edit }\n format.json { render json: @sejour.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tarifas_servicio.update(tarifas_servicio_params)\n format.html { redirect_to tarifas_servicios_url, notice: 'Tarifas servicio Se ha actualizado correctamente..' }\n format.json { render :show, status: :ok, location: @tarifas_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tarifas_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n if @sitio_entrega.update_attributes(params[:sitio_entrega])\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(cliente_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @detalles_basico.update(detalles_basico_params)\n format.html { redirect_to @detalles_basico, notice: 'Detalles basico was successfully updated.' }\n format.json { render :show, status: :ok, location: @detalles_basico }\n else\n format.html { render :edit }\n format.json { render json: @detalles_basico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @registro_servicio.update(registro_servicio_params)\n format.html { redirect_to @registro_servicio, notice: 'Servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @registro_servicio }\n else\n format.html { render :edit }\n format.json { render json: @registro_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asiento_de_servicio.update(asiento_de_servicio_params)\n format.html { redirect_to @asiento_de_servicio, notice: 'Asiento de servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @asiento_de_servicio }\n else\n format.html { render :edit }\n format.json { render json: @asiento_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n if @estatuto.update_attributes(params[:estatuto])\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_serasa.update(socio_serasa_params)\n format.html { redirect_to @socio_serasa, notice: 'Socio serasa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_serasa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @soiree.update(soiree_params)\n format.html { redirect_to @soiree, notice: 'Votre évènement a bien été mis à jour.' }\n format.json { render :show, status: :ok, location: @soiree }\n else\n format.html { render :edit }\n format.json { render json: @soiree.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sugerencia = Sugerencia.find(params[:id])\n\n respond_to do |format|\n if @sugerencia.update_attributes(params[:sugerencia])\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @os_entregavel.update(os_entregavel_params)\n if @os_entregavel.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_entregavel.ordem_servico.id.to_s, notice: 'Os entregavel foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_entregavel, notice: 'Os entregavel foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_entregavel }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_entregavel.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n if @respuesta.update(params[:respuesta])\n head :no_content\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @datos_estudiante.update(datos_estudiante_params)\n format.html { redirect_to @datos_estudiante, notice: 'Datos estudiante was successfully updated.' }\n format.json { render :show, status: :ok, location: @datos_estudiante }\n else\n format.html { render :edit }\n format.json { render json: @datos_estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitud.update(solicitud_params)\n format.html { redirect_to @solicitud, notice: 'Solicitud was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitud.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @calificacion_servicio = CalificacionServicio.find(params[:id])\n\n respond_to do |format|\n if @calificacion_servicio.update_attributes(params[:calificacion_servicio])\n format.html { redirect_to @calificacion_servicio, notice: 'Calificacion servicio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificacion_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @repuesto_servicio.update(repuesto_servicio_params)\n format.html { redirect_to @repuesto_servicio, notice: 'Repuesto o servicio fue actualizado con éxito.' }\n format.json { render :show, status: :ok, location: @repuesto_servicio }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n puts \"HACE ALGOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO\"\n if !params[:reserva][:tipo_reserva].blank?\n @tipo_reserva = TipoReserva.find(params[:reserva][:tipo_reserva])\n @reserva.tipo_reserva = @tipo_reserva\n end\n\n if !params[:reserva][:habitacion].blank?\n @habitacion = Habitacion.find(params[:reserva][:habitacion])\n @reserva.habitacion = @habitacion\n end\n\n if !params[:reserva][:cliente].blank?\n @cliente = Cliente.find(params[:reserva][:cliente])\n @reserva.cliente = @cliente\n end\n if !params[:reserva][:confirmada].blank?\n @reserva.confirmada = params[:reserva][:confirmada]\n end\n if @reserva.update(reserva_params)\n format.html { redirect_to reservas_url, notice: 'Reserva modificada con exito.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reserva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # no se puede actualizar una venta por el momento\n respond_to do |format|\n\n previous_sale = @sale\n \n if @sale.update(sale_params)\n\n @sale.cliente.update(client_params)\n \n #verifica si cambió el estado de la venta y realiza las acciones que corresponda\n Sale.verificar_cambios(previous_sale, @sale, current_user)\n #Sale.verificarCambioDeEstado(estado_anterior, @sale, current_user) if estado_anterior != @sale.estado\n \n format.html { redirect_to @sale, notice: 'Venta actualizada con exito.' }\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 client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\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 update\n respond_to do |format|\n set_funcionario\n if @ordem_servico.update(ordem_servico_params)\n format.html { redirect_to @ordem_servico, notice: t('messages.cadastro_atualizado') }\n format.json { render :show, status: :ok, location: @ordem_servico }\n else\n format.html { render :edit }\n format.json { render json: @ordem_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n #--ADICIONADO\n \t @cliente.perfilclientes.destroy_all()\n if params[:cliente][:perfil_ids]\n \t\tparams[:cliente][:perfil_ids].each do |ss|\n \t\t\t@cliente.perfilclientes.create(:cliente_id => @cliente.id, :perfil_id => ss)\n \t\tend\n end\n #--ADICIONADO\n format.html { redirect_to clientes_url, notice: 'Cliente actualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @cliente, :status => :created, :location => @cliente }\n else\n format.html { render :json => ( (@cliente.errors.full_messages.join(\".<br />\").to_s + \".\").to_json ) } unless @cliente.errors.empty?\n end\n end\n end",
"def update\n respond_to do |format|\n if @sintoma.update(sintoma_params)\n format.html { redirect_to @sintoma, notice: 'Sintoma was successfully updated.' }\n format.json { render :show, status: :ok, location: @sintoma }\n else\n format.html { render :edit }\n format.json { render json: @sintoma.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_rede.update(sivic_rede_params)\r\n format.html { redirect_to @sivic_rede, notice: 'Rede foi alterada com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_rede.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @spieler = Spieler.find(params[:id])\n\n respond_to do |format|\n if @spieler.update_attributes(params[:spieler])\n format.html { redirect_to @spieler, notice: 'Spieler was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spieler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estacionamiento = Estacionamiento.find(params[:id])\n\n respond_to do |format|\n if @estacionamiento.update_attributes(params[:estacionamiento])\n format.html { redirect_to @estacionamiento, notice: 'Estacionamiento was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estacionamiento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n activo = params[:lab_far][:activo]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n LabFar.where(laboratorio_id: id, farmacium_id:farmacia_id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n @selecao = Selecao.find(params[:id])\n\n respond_to do |format|\n if @selecao.update_attributes(params[:selecao])\n format.html { redirect_to @selecao, notice: 'Selecao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @selecao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #parametros_autocomplete!(params[:estudiante][:persona])\n @estudiante = Estudiante.find(params[:id])\n \n begin\n @estudiante.persona_id = params[:persona][:id]\n rescue\n end\n\n respond_to do |format|\n if @estudiante.update_attributes(params[:estudiante])\n format.html { redirect_to @estudiante, notice: 'Estudiante actualizado' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estudiante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @updaterete = Updaterete.find(params[:id])\n\n respond_to do |format|\n if @updaterete.update_attributes(params[:updaterete])\n format.html { redirect_to @updaterete, notice: 'Updaterete was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @updaterete.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objet.update(objet_params)\n format.html { redirect_to @objet, notice: 'Objet was successfully updated.' }\n format.json { render :show, status: :ok, location: @objet }\n else\n format.html { render :edit }\n format.json { render json: @objet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gestacao.update(gestacao_params)\n format.html { redirect_to @gestacao, notice: 'Gestacao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @gestacao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pro_farm_update\n respond_to do |format|\n activo = params[:pro_far][:activo_produc]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n ProFar.where(producto_id: id, farmacium_id:farmacia_id).update_all(activo_produc: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(carpeta_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @objet = Objet.find(params[:id])\n\n respond_to do |format|\n if @objet.update_attributes(params[:objet])\n format.html { redirect_to @objet, notice: 'The found item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @objet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @telefone_cliente.update(telefone_cliente_params)\n format.html { redirect_to @telefone_cliente, notice: 'Telefone cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefone_cliente }\n else\n format.html { render :edit }\n format.json { render json: @telefone_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\n end\n end\n end",
"def update\n @peticion_servicio_ti = Peticion::ServicioTi.find(params[:id])\n\n respond_to do |format|\n if @peticion_servicio_ti.update_attributes(params[:peticion_servicio_ti])\n format.html { redirect_to edit_peticion_servicio_ti_path(@peticion_servicio_ti), notice: 'Actualizado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peticion_servicio_ti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_celula.update(sivic_celula_params)\r\n format.html { redirect_to @sivic_celula, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_celula.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @restora.update(restora_params)\n format.html { redirect_to @restora, notice: 'Restora was successfully updated.' }\n format.json { render :show, status: :ok, location: @restora }\n else\n format.html { render :edit }\n format.json { render json: @restora.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @solicitacoes_avaliacoes_servico.update(solicitacoes_avaliacoes_servico_params)\n format.html { redirect_to @solicitacoes_avaliacoes_servico, notice: 'Solicitacoes avaliacoes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @solicitacoes_avaliacoes_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @asos_datum.update(asos_datum_params)\n format.html { redirect_to @asos_datum, notice: 'Asos datum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @asos_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exercicio_serie.update(exercicio_serie_params)\n format.html { redirect_to @exercicio_serie, notice: 'O Exercício da Série foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @exercicio_serie }\n else\n format.html { render :edit }\n format.json { render json: @exercicio_serie.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redirect_to @resto, notice: 'Entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @resto }\n else\n format.html { render :edit }\n format.json { render json: @resto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fulcliente = Fulcliente.find(params[:id])\n\n respond_to do |format|\n if @fulcliente.update_attributes(params[:fulcliente])\n format.html { redirect_to @fulcliente, notice: 'Fulcliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fulcliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @empresa_servicio = EmpresaServicio.find(params[:id])\n respond_to do |format|\n if @empresa_servicio.update_attributes(params[:empresa_servicio])\n\n format.html { redirect_to empresa_empresa_servicios_path, notice: \"Los datos del servicio fueron actualizados para la empresa #{@empresa_servicio.empresa.nombre_empresa}\"}\n \n else\n format.html { render action: \"edit\" }\n format.json { render json: @empresa_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipo_consulta.update(tipo_consulta_params)\n format.html { redirect_to @tipo_consulta, notice: 'Tipo consulta was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_consulta }\n else\n format.html { render :edit }\n format.json { render json: @tipo_consulta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe.update(recipe_params)\n\n if params[:lista].present?\n params[:lista].each do |(c,ingrediente)|\n Ingredient.create(name: ingrediente, recipe_id:@recipe.id) if ingrediente != \"\"\n end\n end\n\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n format.js {flash.now[:notice] = 'La receta se ha actualizado de forma exitosa.'} \n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n format.js {flash.now[:alert] = 'Error al actuar la receta.'} \n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n respond_to do |format|\n if @tiposveiculo.update(tiposveiculo_params)\n format.html { redirect_to tiposveiculos_url, notice: 'Tipo de Veículo editado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tiposveiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sinh_vien = SinhVien.find(params[:id])\n\n respond_to do |format|\n if @sinh_vien.update_attributes(params[:sinh_vien]) \n format.json { head :no_content }\n else \n format.json { render json: @sinh_vien.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @quimicos_serigrafia_producto.update(quimicos_serigrafia_producto_params)\n format.html { redirect_to @quimicos_serigrafia_producto, notice: 'Quimicos serigrafia producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @quimicos_serigrafia_producto }\n else\n format.html { render :edit }\n format.json { render json: @quimicos_serigrafia_producto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n\n if @os_tarefa.update(os_tarefa_params)\n #se as situacao da tarefa nao for aceita, altera a ordem_servico_pagamento para null\n if(@os_tarefa.situacao!=OsTarefa.situacoes[0] && @os_tarefa.situacao!=OsTarefa.situacoes[1])\n\n @os_tarefa.ordem_servico_pagamento=nil\n @os_tarefa.save\n end\n\n if @os_tarefa.ordem_servico.id!=nil\n format.html { redirect_to \"/ordem_servicos/\"+@os_tarefa.ordem_servico.id.to_s, notice: 'A Tarefa foi atualizado(a)' }\n format.json { head :no_content }\n else\n format.html { redirect_to @os_tarefa, notice: 'A Tarefa foi atualizado(a)' }\n format.json { render :show, status: :ok, location: @os_tarefa }\n end\n else\n format.html { render :edit }\n format.json { render json: @os_tarefa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @respuesta = Respuesta.find(params[:id])\n\n respond_to do |format|\n if @respuesta.update_attributes(params[:respuesta])\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(etiqueta_params)\n format.html { redirect_to @objeto, notice: 'Etiqueta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sezione = Sezione.find(params[:id])\n\n respond_to do |format|\n if @sezione.update_attributes(params[:sezione])\n format.html { redirect_to elencosezioni_path, notice: 'Sezione was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sezione.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.64240843",
"0.64024067",
"0.63983446",
"0.6395097",
"0.632229",
"0.6239431",
"0.6237358",
"0.6223793",
"0.62021613",
"0.6168096",
"0.6162601",
"0.6157188",
"0.61179274",
"0.60848266",
"0.6072449",
"0.6063843",
"0.6060373",
"0.60560036",
"0.6037477",
"0.6009106",
"0.6006241",
"0.5994964",
"0.59948593",
"0.59943265",
"0.5993614",
"0.5991458",
"0.59905225",
"0.5986513",
"0.59802777",
"0.59741014",
"0.5965353",
"0.59645706",
"0.596385",
"0.59623283",
"0.59622365",
"0.5961548",
"0.5957765",
"0.5945156",
"0.5943477",
"0.59387267",
"0.59351647",
"0.5930205",
"0.5929616",
"0.59238726",
"0.59145254",
"0.5910963",
"0.5907624",
"0.5906362",
"0.59007263",
"0.5898101",
"0.58962435",
"0.5896007",
"0.589355",
"0.58927",
"0.5891528",
"0.5886636",
"0.58735627",
"0.5864214",
"0.58634424",
"0.5860572",
"0.5856765",
"0.58541286",
"0.58521867",
"0.58510566",
"0.5846729",
"0.5845417",
"0.58436286",
"0.58413905",
"0.5839089",
"0.5838091",
"0.5834857",
"0.5833446",
"0.58283067",
"0.5819597",
"0.5816026",
"0.581556",
"0.5814608",
"0.58072454",
"0.5806622",
"0.5803402",
"0.5802321",
"0.58013934",
"0.5799513",
"0.5798159",
"0.5795722",
"0.5795508",
"0.5793034",
"0.5792763",
"0.5787427",
"0.57850415",
"0.578457",
"0.5782725",
"0.5779392",
"0.5779389",
"0.5776067",
"0.57743776",
"0.57677394",
"0.5767727",
"0.57667",
"0.57654524"
] |
0.7083026
|
0
|
DELETE /serie_detalles/1 DELETE /serie_detalles/1.json
|
def destroy
@serie_detalle.destroy
respond_to do |format|
format.html { redirect_to serie_detalles_url, notice: 'Serie detalle was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @detalle = Detalle.find(params[:id])\n @detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to detalles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle.destroy\n respond_to do |format|\n format.html { redirect_to detalles_url, notice: 'Detalle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguidore = Seguidore.find(params[:id])\n @seguidore.destroy\n\n respond_to do |format|\n format.html { redirect_to seguidores_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @datosgenerale.destroy\n respond_to do |format|\n format.html { redirect_to datosgenerales_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @compra_detalle = CompraDetalle.find(params[:id])\n @compra_detalle.destroy\n\n respond_to do |format|\n format.html { redirect_to compra_detalles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_documento_de_compra.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Linea eliminada' }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def destroy\n @salle.destroy\n respond_to do |format|\n format.html { redirect_to salles_url, notice: 'Salle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sekilas_info.destroy\n respond_to do |format|\n format.html { redirect_to sekilas_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_estudiante.destroy\n respond_to do |format|\n format.html { redirect_to datos_estudiantes_url, notice: 'Datos estudiante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @datos_insumos_reactivo.destroy\n respond_to do |format|\n format.html { redirect_to datos_insumos_reactivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asos_datum.destroy\n respond_to do |format|\n format.html { redirect_to asos_data_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitio_entrega = SitioEntrega.find(params[:id])\n @sitio_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to sitio_entregas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sezione = Sezione.find(params[:id])\n @sezione.destroy\n\n respond_to do |format|\n format.html { redirect_to sezioni_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estacionamiento = Estacionamiento.find(params[:id])\n @estacionamiento.destroy\n\n respond_to do |format|\n format.html { redirect_to estacionamientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @detalles_basico.destroy\n respond_to do |format|\n format.html { redirect_to detalles_basicos_url, notice: 'Detalles basico was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_carrito.destroy\n respond_to do |format|\n format.html { redirect_to detalle_carritos_url, notice: 'Detalle carrito was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_pacote.destroy\n respond_to do |format|\n format.html { redirect_to servico_pacotes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @semestre.destroy\n respond_to do |format|\n format.html { redirect_to semestres_url, notice: 'Semestre was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @semestre.destroy\n respond_to do |format|\n format.html { redirect_to semestres_url, notice: 'Semestre was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @serv_adicionale = ServAdicionale.find(params[:id])\n @serv_adicionale.destroy\n\n respond_to do |format|\n format.html { redirect_to serv_adicionales_url }\n format.json { head :no_content }\n end\n end",
"def borrar \n\n fiesta.destroy\n render json: fiesta \n end",
"def destroy\n @dato = Dato.find(params[:id])\n @dato.destroy\n\n respond_to do |format|\n format.html { redirect_to datos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @updaterete = Updaterete.find(params[:id])\n @updaterete.destroy\n\n respond_to do |format|\n format.html { redirect_to updateretes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seguro = Seguro.find(params[:id])\n @seguro.destroy\n\n respond_to do |format|\n format.html { redirect_to seguros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estado_remate.destroy\n respond_to do |format|\n format.html { redirect_to estado_remates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gestacao.destroy\n respond_to do |format|\n format.html { redirect_to gestacaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sejour.destroy\n respond_to do |format|\n format.html { redirect_to sejours_url, notice: 'Sejour was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sugerencia = Sugerencia.find(params[:id])\n @sugerencia.destroy\n\n respond_to do |format|\n format.html { redirect_to sugerencias_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @detalhe.destroy\n respond_to do |format|\n format.html { redirect_to detalhes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sumne.destroy\n respond_to do |format|\n format.html { redirect_to sumnes_url, notice: 'Sumne was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @etiquetum.destroy\n respond_to do |format|\n format.html { redirect_to etiqueta_url, notice: 'Etiqueta borrada!' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_orden_trabajo.destroy\n respond_to do |format|\n format.html { redirect_to @orden_trabajo, notice: 'Detalle fue eliminado con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio_serasa.destroy\n respond_to do |format|\n format.html { redirect_to socio_serasas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @teste_anamnese.destroy\n respond_to do |format|\n format.html { redirect_to teste_anamneses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sla.destroy\n respond_to do |format|\n format.html { redirect_to slas_url, notice: 'Sla fue exitosamente destruido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donante.destroy\n respond_to do |format|\n format.html { redirect_to donantes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sotrudniki = Sotrudniki.find(params[:id])\n @sotrudniki.destroy\n\n respond_to do |format|\n format.html { redirect_to sotrudnikis_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servicio = Servicio.find(params[:id])\n @servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente.destroy\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @selecao = Selecao.find(params[:id])\n @selecao.destroy\n\n respond_to do |format|\n format.html { redirect_to selecaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @substancia.destroy\n respond_to do |format|\n format.html { redirect_to substancias_url, notice: 'Substancia was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_relatorioscelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_relatorioscelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @item_de_despesa.destroy\n addlog(\"Item de despesa apagado\")\n respond_to do |format|\n format.html { redirect_to itens_de_despesa_url, notice: 'Item de despesa apagado com sucesso.' }\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 @consulta_viaje.destroy\n respond_to do |format|\n format.html { redirect_to consulta_viajes_url, notice: 'Consulta viaje was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unidad.destroy\n respond_to do |format|\n format.html { redirect_to unidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @seo_datum = SeoDatum.find(params[:id])\n @seo_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to seo_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rescate.destroy\n respond_to do |format|\n format.html { redirect_to rescates_url, notice: 'Rescate fue eleminado' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @soiree.destroy\n respond_to do |format|\n format.html { redirect_to soirees_url, notice: 'Votre évènement a bien été supprimé.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trabajador_seccion.destroy\n respond_to do |format|\n format.html { redirect_to trabajador_seccions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end",
"def destroy\n @detalle_factura.destroy\n respond_to do |format|\n format.html { redirect_to detalle_facturas_url, notice: 'Detalle factura was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fulcliente = Fulcliente.find(params[:id])\n @fulcliente.destroy\n\n respond_to do |format|\n format.html { redirect_to fulclientes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @lista_desejo.destroy\n respond_to do |format|\n format.html { redirect_to back_uri, warning: 'Removido da lista de desejos.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lectura.destroy\n respond_to do |format|\n format.html { redirect_to lecturas_url, notice: 'La lectura fue eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lectura.destroy\n respond_to do |format|\n format.html { redirect_to lecturas_url, notice: 'La lectura fue eliminada.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estado_despacho.destroy\n respond_to do |format|\n format.html { redirect_to estado_despachos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_rede.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_redes_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @solicitud_servicio = SolicitudServicio.find(params[:id])\n @solicitud_servicio.destroy\n\n respond_to do |format|\n format.html { redirect_to solicitudes_servicios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @visitante.destroy\n respond_to do |format|\n format.html { redirect_to visitantes_url, notice: 'Visitante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: \"Solicitud was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicituds_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @smp_referenz.destroy\n respond_to do |format|\n format.html { redirect_to smp_referenzs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercicio_serie.destroy\n respond_to do |format|\n format.html { redirect_to exercicio_series_url, notice: 'O Exercício da Série foi destruído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tarifas_servicio.destroy\n respond_to do |format|\n format.html { redirect_to tarifas_servicios_url, notice: 'Tarifas servicio Fue destruido con éxito.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to dossiers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asiento = Asiento.find(params[:id])\n @asiento.destroy\n\n respond_to do |format|\n format.html { redirect_to asientos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @nota_tecnica.destroy\n respond_to do |format|\n format.html { redirect_to nota_tecnicas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_celula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_celulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @resa.destroy\n respond_to do |format|\n format.html { redirect_to resas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @adres_kontr.destroy\n respond_to do |format|\n format.html { redirect_to adres_kontr_index_url, notice: 'Adres kontr was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @escola = Escola.find(params[:id])\n @escola.destroy\n\n respond_to do |format|\n format.html { redirect_to escolas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @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\r\n @sivic_contcelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contcelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @especialidad.destroy\n respond_to do |format|\n format.html { redirect_to especialidads_url, notice: 'Servicio eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @pedidodetalle = Pedidodetalle.find(params[:id])\n @pedidodetalle.destroy\n\n respond_to do |format|\n format.html { redirect_to pedidodetalles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dynamique = Dynamique.find(params[:id])\n @dynamique.destroy\n\n respond_to do |format|\n format.html { redirect_to dynamiques_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @futbolada = Futbolada.find(params[:id])\n @futbolada.destroy\n\n respond_to do |format|\n format.html { redirect_to gestion_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @correntista.destroy\n respond_to do |format|\n format.html { redirect_to correntista_index_url, notice: 'Correntista was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sumario.destroy\n respond_to do |format|\n format.html { redirect_to sumarios_url, notice: 'Sumario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nominee.destroy\n respond_to do |format|\n format.html { redirect_to nominees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ficha = Ficha.find(params[:id])\n @ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to fichas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sindicato.destroy\n respond_to do |format|\n format.html { redirect_to sindicatos_url, notice: 'Sindicato fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n @diemtrentuyen.destroy\n\n respond_to do |format|\n format.html { redirect_to diemtrentuyens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reentrada.destroy\n respond_to do |format|\n format.html { redirect_to reentradas_url, notice: 'Reentrada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.73147297",
"0.718174",
"0.7150113",
"0.7145443",
"0.7134422",
"0.7033046",
"0.70142925",
"0.70011634",
"0.6989134",
"0.6988446",
"0.6988412",
"0.6986596",
"0.6984534",
"0.69602686",
"0.69504493",
"0.69421995",
"0.6934067",
"0.6932513",
"0.69140375",
"0.6913419",
"0.6912214",
"0.6906912",
"0.6905177",
"0.6904008",
"0.6899025",
"0.6899025",
"0.6890383",
"0.6886969",
"0.68838894",
"0.6883459",
"0.6881066",
"0.6874062",
"0.6863185",
"0.68609023",
"0.6859024",
"0.6857212",
"0.68501294",
"0.6846967",
"0.68428516",
"0.6836768",
"0.6831098",
"0.68305993",
"0.6828439",
"0.682326",
"0.6822064",
"0.6821849",
"0.68201405",
"0.6818616",
"0.6818413",
"0.68169546",
"0.6812334",
"0.6811492",
"0.68102926",
"0.6807593",
"0.68049777",
"0.6802939",
"0.6802586",
"0.68023115",
"0.6796151",
"0.6795547",
"0.67930454",
"0.6792384",
"0.6790524",
"0.67904985",
"0.67904985",
"0.67889994",
"0.67881817",
"0.6784991",
"0.6782682",
"0.67819333",
"0.6775926",
"0.6775499",
"0.6774624",
"0.67701167",
"0.6768709",
"0.67652863",
"0.6762385",
"0.67552453",
"0.67525136",
"0.675027",
"0.6748876",
"0.6746494",
"0.6746344",
"0.6745995",
"0.6745916",
"0.67406815",
"0.6735014",
"0.6733637",
"0.67293704",
"0.6727159",
"0.6727159",
"0.6727159",
"0.67261004",
"0.6724941",
"0.6723978",
"0.6723122",
"0.67211175",
"0.6719141",
"0.67184925",
"0.6718241"
] |
0.7530127
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.