query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
The class of the resource that the controller handles
def controller_resource ProjectEvaluation end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_class\n @resource_class ||= self.controller_name.singularize.classify.constantize\n end", "def resource_class\n @resource_class ||= self.class.to_s.split(\":\").last\n end", "def resource_klass\n resource_klass_name.constantize\n end", "def class_of_resource\n @class_of_resource ||= resource_name.classify.constantize\n end", "def resource_class\n class_name\n end", "def resource_class\n name = controller.controller_name\n return \"active\" if name == \"resources\"\n end", "def resource_class\n resource_specification.klass\n end", "def get_resource_class\n \tresource_name.classify.constantize\n end", "def resource_class\n @resource_class ||= resource_name.classify.constantize\n end", "def resource_class\n @resource_class ||= resource_name.classify.constantize\n end", "def resource_class\n @resource_class ||= resource_name.classify.constantize\n end", "def resource_class\n @resource_class ||= resource_name.classify.constantize\n end", "def resource_class\n\t\t\t\t@resource_class ||= resource_name.classify.constantize\n\t\t\tend", "def resource_class\n @options[:resource_class]\n end", "def resource_class\n @resource_class ||= resource_name.classify.constantize\n end", "def resource_class\n @resource_class ||= resource_name.classify.constantize\n end", "def resource_class\n @resource_class ||= resource_name.classify.constantize\n end", "def resource_class\n \t@resource_class ||= get_resource_class\n end", "def resource_class\n @resource_class ||= resource_class_name.constantize\n end", "def resource_klass\n @resource_klass ||= resource_name.classify.constantize\n end", "def resource_klass\n Valkyrie.config.resource_class_resolver.call(internal_resource)\n end", "def resource_klass\n Valkyrie.config.resource_class_resolver.call(internal_resource)\n end", "def resource_class\n resource_finder.is_a?(Class) ? resource_finder : resource_finder.name.classify.constantize\n end", "def resource_klass\n Valkyrie.config.resource_class_resolver.call(internal_resource)\n end", "def resource_class\n (self.class.name.split('::').last || '').downcase\n end", "def resource_class\n # TODO does this need to have draft?\n @resource_class ||= resource_name.classify.constantize\n end", "def model_type\n self.class.name[/(.*)Controller/,1].singularize.constantize\n end", "def model_type\n self.class.name[/(.*)Controller/,1].singularize.constantize\n end", "def resource_klass_name\n resource_name.classify\n end", "def resource_klass\n @resource_klass ||= JsonApi::Resources::Discovery\n .resource_for_name object,\n resource_class: @resource_class\n end", "def resource_class\n @resource_class ||= begin\n resource_parts = params[:namespaces] ? params[:namespaces].split('/') : []\n resource_parts << params[:resource_name]\n resource_parts.map(&:classify).join('::').constantize\n end\n end", "def resource_class\n\n ActiveSupport::Dependencies.constantize(resource_class_name)\n\n end", "def resource_class_name\n @resource_class_name ||= resource_name.classify.constantize\n end", "def resource_class\n raise NotImplementedError\n end", "def resource_type\n return @resource_type\n end", "def resource_type\n return @resource_type\n end", "def resource_type\n return @resource_type\n end", "def resource_type\n return @resource_type\n end", "def resource_type\n case model\n when \"Cinstance\"\n 'application'\n else\n model.singular\n end\n end", "def type_as_class(resource_name)\n\t resource_name.singularize.capitalize.constantize\n\tend", "def controller_class; end", "def controller_class; end", "def resource_model\n Object.const_get options[:resource].classify\n end", "def resource_class\n case class_name\n when false then\n name.to_sym\n when String then\n class_name.constantize\n else\n raise ArgumentError, \"unexpected class_name: #{class_name}\"\n end\n end", "def controller_name\n self.class.to_s\n end", "def class_for_controller_name\n controller_model\n end", "def resource\n self.class.to_s.split('::').last.downcase\n end", "def model_class\n resource_class = @options[:resource]\n if resource_class.nil?\n @name.to_s.camelize.constantize\n elsif resource_class.kind_of? String\n resource_class.constantize\n else\n resource_class # could be a symbol\n end\n end", "def resource_class\n case @options[:class]\n when false\n name.to_sym\n when nil\n namespaced_name.to_s.camelize.constantize\n when String\n @options[:class].constantize\n else\n @options[:class]\n end\n end", "def type\n controller_name.singularize\n end", "def get_resource_name\n \tself.controller_name.singularize\n end", "def getKlass #:doc:\n @Klass = self.controller_name.classify.constantize\n @Klass\n end", "def resource_query\n resource_class\n end", "def resource\n self.class.resource\n end", "def thing\n controller_name.classify.constantize\n end", "def resource_model\n \"::#{resource_name}\".constantize\n end", "def representer_klass\n resource_module::Representer::Resource\n end", "def model\n controller_name.classify.constantize\n end", "def resource_as_constant_name\n if klass_or_instance.is_a?(Class)\n klass_or_instance.name\n else\n klass_or_instance.class.name\n end\n end", "def parent_resource_class\n @parent_resource_class ||= parent_resource_name.classify.constantize\n end", "def model_class\n @controller.model_class\n end", "def resource_model\n resource = \"#{resource_param}\".constantize\n end", "def resource\n return Object unless resource_type\n return resource_type.constantize unless resource_id\n return _resource\n end", "def resource_type\n case\n when controller_name.starts_with?('search')\n params[:record_type]\n when is_variable_controller?\n 'variables'\n when is_services_controller?\n 'services'\n when is_tools_controller?\n 'tools'\n else\n # default\n 'collections'\n end\n end", "def controller_for(resource)\n return resource if resource.is_a?(Class) && resource.ancestors.include?(ActionController::Base)\n \"#{resource.to_s.underscore}_controller\".classify.constantize\n rescue NameError\n raise ResourceFull::ResourceNotFound, \"not found: #{resource}\"\n end", "def published_resource_class\n @published_resource_class ||= resource_name.classify.pluralize.constantize\n end", "def resource_class\n params.each do |name, _value|\n if /(.+)_id$/.match?(name)\n model = name.match(%r{([^\\/.]*)_id$})\n return model[1].classify.constantize, name\n end\n end\n nil\n end", "def getResourceType() \n @obj.getResourceType() \n end", "def resource_for(klass)\n resources[klass]\n end", "def resource_name\n controller_name.demodulize.singularize\n end", "def resource_name\n controller_name.demodulize.singularize\n end", "def resource_name\n controller_name.demodulize.singularize\n end", "def model\n\t\tObject.const_get(controller_name.classify)\n\tend", "def controller_class\n @controller_class ||= @controller&.class || self.class.class_for(@key)\n end", "def resource_param\n \"#{params[:resource]}\".classify\n end", "def resource\n @resource\n end", "def resource\n @resource\n end", "def resource_class\n if any?\n first.class\n else\n raise ArgumentError, 'Cannot determine resource class on empty collection'\n end\n end", "def model\n self.controller_name.classify.constantize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def model_class\n @model_class ||= controller_path.classify.constantize\n end", "def resource_name\n @@resource_name ||= self.class.to_s.split('::').last.gsub('Controller', '').singularize.underscore\n end", "def resource_singular() self.class.read_inheritable_attribute(:resource_singular) end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_type\n\t\t\t\t\t\traise \"Not implemented.\"\n\t\t\t\t\tend", "def klass\n self.class\n end", "def resource_name\n name.to_s.chomp('Controller').demodulize.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def resource_name\n @resource_name ||= self.controller_name.singularize\n end", "def controller_model_class\n c = controller_name.to_s.pluralize.singularize.camelize.constantize\n if c.respond_to? :new\n c # looks like we've got a real class\n else\n nil # TODO throw error?\n end\n end", "def type\n self.class\n end", "def resource\n self\n end", "def klass_from_controller(c = controller_name)\n c.singularize.camelize.constantize\n end", "def controller_name\n self.class.controller_name\n end", "def controller\n @controller ||= controller_name.constantize\n end", "def controlled_model_class\n controller_path.classify.constantize\n end", "def get_resource_type()\n return RedXmlResource::TYPE\n end" ]
[ "0.83064103", "0.80881983", "0.8082002", "0.8019689", "0.8018521", "0.8013433", "0.7973236", "0.7904059", "0.7852093", "0.78449255", "0.78449255", "0.78449255", "0.7835738", "0.78215885", "0.7792966", "0.7792966", "0.7792966", "0.7791172", "0.77491", "0.77283365", "0.7700869", "0.7700869", "0.76984656", "0.7683652", "0.7615774", "0.75777984", "0.74924976", "0.74924976", "0.7471694", "0.7450695", "0.7441143", "0.7414134", "0.73357916", "0.73312616", "0.7326573", "0.7326573", "0.7326573", "0.7326573", "0.7305419", "0.729912", "0.7277671", "0.7277671", "0.72484696", "0.7219343", "0.7191801", "0.71713954", "0.7164483", "0.71409124", "0.71379447", "0.71127325", "0.71097654", "0.70741266", "0.70663303", "0.70636797", "0.70570856", "0.70349807", "0.70156646", "0.70114803", "0.70027524", "0.69365335", "0.692709", "0.6873755", "0.68633544", "0.68470514", "0.68358546", "0.68343854", "0.68191874", "0.6807715", "0.6801953", "0.67983997", "0.67983997", "0.67983997", "0.6787068", "0.6785693", "0.6704987", "0.6694896", "0.6694896", "0.6692437", "0.66906565", "0.66900754", "0.66900754", "0.66900754", "0.6688038", "0.6678662", "0.6672555", "0.66599494", "0.66599494", "0.6658925", "0.6654442", "0.6651341", "0.6639196", "0.6639196", "0.6638112", "0.66317976", "0.66307354", "0.6624444", "0.6619321", "0.66184986", "0.66143024", "0.6601226", "0.6599307" ]
0.0
-1
GET /bookings GET /bookings.json
def index @bookings = Booking.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n respond_with(@bookings)\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n @bookings = Booking.all\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend", "def show\n\t\t@booking = Booking.find(params[:id])\n\t\trender json: @booking, status: 200\n\tend", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = @user.bookings\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n @bookings = Booking.order(updated_at: :desc).page(params[:page]).per(NUM_PER_PAGE)\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def index\n @bookings = current_user.bookings\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def show\n render json: { booking: @booking }, status: 200\n end", "def show\n @booking = Booking.find(params[:id])\n @rooms = @booking.rooms\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show\n render json: @booking\n end", "def show\n render json: @booking\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @bookings = Booking.where(user_id: current_user.id)\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @bookings = prep_bookings\n render json: @bookings, status: :ok\n end", "def index\n @bookings = @hairdresser.bookings\n end", "def index\n bookings = Room.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all rooms', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n @bookings = Booking.user(@user.id)\n end", "def index\n @bookings = Booking.where(\"user_id = #{current_user.id}\")\n end", "def index\n # @bookings = Booking.all\n begin\n @response = Booking.get_bookings\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n # binding.pry\n end", "def all_bookings\n Booking.none\n end", "def index\n if current_user\n @bookings = current_user.bookings.all\n end\n\n if current_host\n @job = Job.find_by(id: params[:job_id])\n @bookings = @job.bookings\n end\n end", "def index\n @bookings = Booking.includes(:services)\n end", "def show\n\n @user_id = current_user\n case params[:id]\n when \"approaching\"\n @bookings = Booking.paginate :conditions=>[ \"user_id = #{@user_id} and enddate >= now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"history\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id} and enddate < now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"all\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n else\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n end\n\n if @bookings.nil?\n @bookings = Array.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def show\n @booking = Booking.find_by(id: params[:id])\n if @booking\n render json: {success: true, status: 200, object: @booking}\n else\n render json: {success: false, status: 404, message: \"Not Found\"}\n end\n end", "def index \n session[:link_to_bookings] = params[:classroom][:links].last[:uri] if (params[:classroom]) \n @link = session[:link_to_bookings]\n @params= \"date=#{params[:date]}&limit=#{params[:limit]}&status=#{params[:status]}\"\n @bookings = ClientApi.bookings_list @link, @params\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "def index\n @user = User.find_by_id(params[:format])\n @bookings = Booking.where(user_id: params[:format])\n end", "def show\n\n render json: @bookkeeping\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule, methods: :bookings }\n end\n end", "def index\n @booking_infos = BookingInfo.all\n end", "def index\n @books = Book.all\n render json: @books\n end", "def find_user_id\n @listings = Listing.where(\"user_id = ?\",params[:user_id]).all\n if !@listings.empty?\n ret = []\n @listings.each do |listing|\n ret << listing.as_json(include: :book)\n end\n render :json => ret\n else\n render :json => \"user has no listings\".to_json\n end\n end", "def on_date\n @bookings = []\n @bookings = Booking.on_date(params[:booking_date]) if params[:booking_date]\n \n respond_to do |format|\n format.html {render \"index\"}\n format.json {render json: @bookings}\n end\n \n end", "def show\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booking }\n end\n end", "def index\n @bookings = Booking.all(:include => [:user, :suite])\n @current_bookings = Booking.current_bookings\n @archived_bookings = Booking.archived_bookings\n @cancelled_bookings = Booking.cancelled_bookings\n\n respond_to do |format|\n format.html { render :layout => \"admin_layout\"}\n format.xml { render :xml => @bookings }\n end\n end", "def index\n @room_bookings = RoomBooking.all\n end", "def index\n @fg_bookings = FgBooking.all\n end", "def index\n @ninety_ten_bookings = NinetyTenBooking.all\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n @online_bookings = OnlineBooking.all\n end", "def show\n @booking = Booking.find(params[:id])\n respond_with(@booking)\n end", "def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end", "def index\n @bookings = Booking.all\n if params[:search]\n @search_term = params[:search]\n @bookings = @bookings.search_by(@search_term)\n end\n end", "def show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\n end\n end", "def bookings(fields: nil, options: nil)\n opts_keys = %i[boundaryId boundaryStartsAt direction displayTimeZone jumpToDate profileIds search]\n params = build_option_params options, opts_keys, fields: fields\n res = @connection.get booking_path, params\n map_as_collection res, Booking\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index\n query = 'SELECT * FROM Booking'\n @bookings = Booking.find_by_sql(query)\n end", "def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end", "def bookings()\n sql = \"SELECT bookings.*\n FROM bookings\n WHERE bookings.schedule_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql,values)\n bookings = Booking.map_items(result)\n return bookings\n end", "def index\n @bookings = smart_listing_create(:bookings, Booking.includes(:seat, :user).where(user_id: current_user.id), partial: \"bookings/listing\")\n end", "def show\n @bookings = @customer.bookings\n end", "def index\n @bookings = current_user.bookings\n binding.pry\n #@bookingsegregator = Booking.segregator\n end", "def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def all_bookings\n Booking.includes(:user, :court).ordered.load\n end", "def index\n @bookings = Booking.where(:customer_id => session['customer_id'])\n end", "def show\n render json: @book\n end", "def index\n @booking_details = BookingDetail.all\n end", "def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def find_id\n if Listing.exists?(params[:id])\n @listing = Listing.find(params[:id])\n render :json => @listing.as_json(include: :book)\n else\n render :json => \"listing not found\".to_json\n end\n end", "def index\n @bookings = Booking.order(id: :desc)\n end", "def index\n @biddings = Bidding.all\n end", "def show\n render json: @service_booking\n end", "def show\n @booking = Booking.find(params[:id])\n end", "def show\n @bookings = Booking.all\n @rooms = Room.all\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end", "def index\n @booking_statuses = BookingStatus.all\n end", "def bookings()\n sql = \"SELECT * FROM bookings WHERE bookings.gymclass_id = $1;\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map {|booking| Booking.new(booking)}\n end" ]
[ "0.8231102", "0.80365145", "0.80220497", "0.80220497", "0.80220497", "0.7619097", "0.7607287", "0.7501954", "0.7437335", "0.74355394", "0.736671", "0.73389894", "0.73331183", "0.73266363", "0.73217666", "0.72310644", "0.7227939", "0.71933675", "0.71933675", "0.71933675", "0.71933675", "0.7145121", "0.71196496", "0.70844454", "0.7068138", "0.70634925", "0.6997092", "0.6988636", "0.6988636", "0.69486886", "0.6948613", "0.6942897", "0.69407207", "0.69219196", "0.68844646", "0.6873678", "0.68719894", "0.68486196", "0.6814593", "0.6804705", "0.6786011", "0.6759293", "0.6757766", "0.67523646", "0.67449206", "0.6740214", "0.6727567", "0.67193884", "0.6708978", "0.66504943", "0.66458344", "0.664233", "0.6594441", "0.65912014", "0.6579298", "0.65675294", "0.6562665", "0.65623444", "0.6541979", "0.6531522", "0.65299183", "0.64960617", "0.6492825", "0.64922136", "0.6476216", "0.64701396", "0.64521086", "0.6446309", "0.6438177", "0.643674", "0.64366347", "0.6424101", "0.6422121", "0.64186513", "0.6413106", "0.6401445", "0.6396427", "0.63874567", "0.63870436", "0.6386612", "0.63841397", "0.6383486", "0.6375648", "0.63753766", "0.63749844", "0.6365202", "0.6352541", "0.63498" ]
0.7473071
19
GET /bookings/1 GET /bookings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend", "def show\n\t\t@booking = Booking.find(params[:id])\n\t\trender json: @booking, status: 200\n\tend", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n respond_with(@bookings)\n end", "def show\n render json: { booking: @booking }, status: 200\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "def show\n @booking = Booking.find_by(id: params[:id])\n if @booking\n render json: {success: true, status: 200, object: @booking}\n else\n render json: {success: false, status: 404, message: \"Not Found\"}\n end\n end", "def index\n @bookings = Booking.order(updated_at: :desc).page(params[:page]).per(NUM_PER_PAGE)\n end", "def index\n @bookings = @user.bookings\n end", "def show\n @booking = Booking.find(params[:id])\n @rooms = @booking.rooms\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n render json: @booking\n end", "def show\n render json: @booking\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "def index\n @bookings = @hairdresser.bookings\n end", "def show\n @booking = Booking.find(params[:id])\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end", "def index\n # @bookings = Booking.all\n begin\n @response = Booking.get_bookings\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n # binding.pry\n end", "def index\n @bookings = Booking.user(@user.id)\n end", "def show\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booking }\n end\n end", "def show\n begin\n @response = Booking.get_booking(params[:id])\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n end", "def index\n @user = User.find_by_id(params[:format])\n @bookings = Booking.where(user_id: params[:format])\n end", "def index\n @bookings = current_user.bookings\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def find_id\n if Listing.exists?(params[:id])\n @listing = Listing.find(params[:id])\n render :json => @listing.as_json(include: :book)\n else\n render :json => \"listing not found\".to_json\n end\n end", "def show\n @booking = Booking.find(params[:id])\n respond_with(@booking)\n end", "def index\n @bookings = Booking.where(\"user_id = #{current_user.id}\")\n end", "def index\n @bookings = Booking.where(user_id: current_user.id)\n end", "def show\n\n render json: @bookkeeping\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def set_api_v1_booking\n @api_v1_booking = Booking.find(params[:id])\n end", "def show\n @book_shelf = BookShelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_shelf }\n end\n end", "def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end", "def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end", "def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def index \n session[:link_to_bookings] = params[:classroom][:links].last[:uri] if (params[:classroom]) \n @link = session[:link_to_bookings]\n @params= \"date=#{params[:date]}&limit=#{params[:limit]}&status=#{params[:status]}\"\n @bookings = ClientApi.bookings_list @link, @params\n end", "def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\n end\n end", "def show\n render json: @book\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end", "def index\n @booking_infos = BookingInfo.all\n end", "def show\n\n @user_id = current_user\n case params[:id]\n when \"approaching\"\n @bookings = Booking.paginate :conditions=>[ \"user_id = #{@user_id} and enddate >= now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"history\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id} and enddate < now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"all\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n else\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n end\n\n if @bookings.nil?\n @bookings = Array.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @books = Book.all\n render json: @books\n end", "def show\n \n @booking = Booking.find( params[ :id ] )\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @booking.to_xml }\n format.json { render :json => @booking.to_json }\n format.yaml { render :text => @booking.to_yaml }\n end\n \n end", "def index\n @bookings = Booking.includes(:services)\n end", "def show\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @businessbook }\n end\n end", "def index\n if current_user\n @bookings = current_user.bookings.all\n end\n\n if current_host\n @job = Job.find_by(id: params[:job_id])\n @bookings = @job.bookings\n end\n end", "def find_booking\n @booking = Booking.find(params[:id])\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def show\n render json: @api_book\n end", "def all_bookings\n Booking.none\n end", "def book\n fetch('harry_potter.books')\n end", "def show\n @booking = Booking.find(params[:id])\n \n respond_to do |format|\n format.html \n format.xml { render :xml => @booking }\n end\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @bookings = prep_bookings\n render json: @bookings, status: :ok\n end", "def index\n @booking_details = BookingDetail.all\n end", "def show\n query = \"SELECT * FROM Booking WHERE bookingId = #{params[:id]}\"\n @booking = Booking.find_by_sql(query).first\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def index\n query = 'SELECT * FROM Booking'\n @bookings = Booking.find_by_sql(query)\n end", "def show\n @guestbook = Guestbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guestbook }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule, methods: :bookings }\n end\n end" ]
[ "0.7793375", "0.76496434", "0.76496434", "0.76496434", "0.76409495", "0.76042414", "0.75729305", "0.73645985", "0.73645985", "0.73645985", "0.73645985", "0.7241474", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.71681803", "0.7167795", "0.71375686", "0.7092144", "0.70906866", "0.7078563", "0.70324767", "0.70096594", "0.6982768", "0.6961544", "0.6929472", "0.6929472", "0.691844", "0.68640864", "0.6857478", "0.6798837", "0.67862725", "0.6784219", "0.6764426", "0.6759001", "0.6747982", "0.67452234", "0.67312276", "0.671604", "0.67027277", "0.667152", "0.6664215", "0.66516304", "0.6618725", "0.66153413", "0.6609551", "0.6576383", "0.6576383", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.6569968", "0.6563967", "0.65533376", "0.65521395", "0.65521395", "0.65493727", "0.65296346", "0.65290064", "0.6524282", "0.6523396", "0.6519605", "0.6511332", "0.649401", "0.64908516", "0.6488969", "0.64885825", "0.6474606", "0.6473084", "0.6471577", "0.6456041", "0.6444625", "0.64368963", "0.642638", "0.64134103", "0.6409251", "0.6407762", "0.63998723", "0.63961875", "0.63933283", "0.6386636", "0.6371519", "0.63712287", "0.63675565", "0.6362155" ]
0.0
-1
POST /bookings POST /bookings.json
def create @booking = Booking.new(booking_params) @tour = Tour.find(booking_params[:tour_id]) @booking_waitlisted = Booking.new(booking_params) if (@tour.seats.to_i >= booking_params[:seats_booked].to_i) seats = @tour.seats.to_i - booking_params[:seats_booked].to_i @tour.seats = seats @tour.save @booking.status = 1 else if (booking_params[:preference] == "Book available seats" && @tour.seats.to_i > 0) @booking.seats_booked = @tour.seats seats = 0 @tour.seats = seats @tour.save @booking.status = 1 elsif (booking_params[:preference] == "Book Available seats and add remaining to waitlist") @booking.seats_booked = @tour.seats @tour.seats = 0 @tour.save @booking.status = 1 # to handle waitlist seats @booking_waitlisted.seats_booked = @booking_waitlisted.seats_booked - @booking.seats_booked @booking_waitlisted.status = 0 @booking_waitlisted.save elsif (booking_params[:preference] == "Book only if all seats are available") @booking.status = 0 end end respond_to do |format| if @booking.save format.html { redirect_to bookings_url, notice: 'Booking was successfully created.' } format.json { render :show, status: :created, location: @booking } else format.html { render :new } format.json { render json: @booking.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n booking = Booking.create(booking_params)\n render json: booking\n end", "def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking, status: 201\n\t end\n\tend", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def create\n @booking = Booking.new(params[:booking])\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render json: @booking, status: :created, location: @booking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(params[:booking])\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render json: @booking, status: :created, location: @booking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = @hairdresser.bookings.create(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to hairdresser_booking_path(@hairdresser,@booking), notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: \"Booking was successfully created.\" }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er nu oprettet.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n set_parent\n set_session\n if @session.bookings.where(user_id: @parent.id) != []\n render_booked\n else\n @booking = Booking.new(booking_params)\n @booking.parent = @parent\n @booking.session = @session\n if @booking.save\n render json: { booking: @booking, status: :success }\n else\n render_error\n end\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end", "def create\n @booking = @instrument.bookings.new(booking_params)\n @booking.user = current_user\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: t('.success') }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n invalid_booking = false\n duration = params[:booking][:duration].to_i\n quantity = params[:booking][:quantity].to_i\n bk_day = params[:booking][:booking_day]\n bk_day = Date.strptime(bk_day, '%Y-%m-%d')\n last_day = bk_day + duration.days\n room = params[:booking][:room_id]\n @bookings = []\n @availability_update = []\n\n #Check Availability for room on each day and given quantity.\n #If all available for all days, create bookings and save.\n #Reduce Availability quantity for each day.\n\n (bk_day..last_day).each {|day|\n available = Availability.where(available_day:day).where(room_id:room).where(\"quantity>?\",quantity).first\n\n if available\n #build on params and given date.\n #then add to array of bookings/\n @booking = current_user.bookings.build(booking_params)\n @booking.booking_day = day\n @bookings << @booking\n available.quantity = available.quantity - quantity\n @availability_update << available\n else\n invalid_booking = true\n break\n end\n }\n\n if !invalid_booking\n @bookings.each(&:save!)\n @availability_update.each(&:save!)\n render :json => current_user.bookings, status: :created\n else\n puts 'invalid booking'\n render :json => current_user.bookings, status: :unprocessable_entity\n end\n\n end", "def create\n # @user = User.find(params[:user_id])\n # parking = Parking.find(params[:parking_id])\n # @booking = @user.bookings.build(parking: parking, user: @user)\n @booking = @user.bookings.build(parking: @parking)\n @booking.update(booking_params)\n\n\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @current_user = User.find(session[:user_id])\n @booking = Booking.new(\n user_id: @current_user.id,\n department_id: params[:data]['department_id'],\n timeStamp: params[:data]['timeStamp'],\n doctorsBoard: params[:data]['doctorsBoard'],\n description: params[:data]['description']\n )\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n @booking.save\n redirect_to action: \"index\"\n end", "def create\n @booking = Booking.new(booking_params)\n begin\n @response = Booking.create_booking(booking_options)\n @booking.log = @response\n @booking.picap_id = @response[\"_id\"]\n notice = \"Booking was successfully created.\"\n rescue RestClient::Exception => exception\n @booking.log = exception.response\n alert = exception.response\n end\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to root_path, notice: notice, alert: alert }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n @booking.user_id = current_user.id\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def booking_params\n params.require(:booking).permit(:number_of_adults, :number_of_children, :price_id, :sale_id, :agent_id, :comment, :progress)\n end", "def create\n @booking = @room.bookings.build(params[:booking])\n\n respond_to do |format|\n if @booking.save\n flash[:notice] = 'Booking was successfully created.'\n format.html { redirect_to property_url(@room.property) }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bookkeeping = @group.bookkeepings.new()\n @bookkeeping.attributes = bookkeeping_params\n @bookkeeping.writer_id = current_user.id\n if @bookkeeping.save\n render json: @bookkeeping, status: :created, location: @bookkeeping\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end", "def create\n @ninety_ten_booking = NinetyTenBooking.new(ninety_ten_booking_params)\n\n respond_to do |format|\n if @ninety_ten_booking.save\n format.html { redirect_to @ninety_ten_booking, notice: 'Ninety ten booking was successfully created.' }\n format.json { render :show, status: :created, location: @ninety_ten_booking }\n else\n format.html { render :new }\n format.json { render json: @ninety_ten_booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # puts params\n @booking = Booking.new(booking_params)\n respond_to do |format|\n if Booking.validate(booking_params) and Booking.time_checking(@booking) and @booking.save\n # if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.'}\n format.json { render :index, status: :created, location: @booking }\n else\n # @listing_id = @booking.listing_id\n format.html { redirect_to bookings_new_path(:listing_id => @booking.listing_id)}\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n flash[:notice] = \"The date is invalid or is booked.\"\n end\n end\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n @bookings = Booking.all\n respond_with(@bookings)\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @bookings = prep_bookings\n render json: @bookings, status: :ok\n end", "def create \n bparams = booking_params\n bparams[:created_by] = User.find_by_name(session[:user])\n bparams[:date] = Date.strptime(session[:date], \"%d.%m.%Y\")\n \n bparams[:accounting_number] = Booking.where(account_id: bparams[:account_id]).map {|b| b.accounting_number}.compact.max.to_i+1\n \n @booking = Booking.new(bparams)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to :back, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking_status = BookingStatus.new(booking_status_params)\n\n respond_to do |format|\n if @booking_status.save\n format.html { redirect_to @booking_status, notice: 'Booking status was successfully created.' }\n format.json { render :show, status: :created, location: @booking_status }\n else\n format.html { render :new }\n format.json { render json: @booking_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.find_by_id(listing_id_from_params[:listing_id].to_i)\n @booking = @listing.bookings.build(booking_params)\n @booking.user_id = current_user.id\n @booking.price = @booking.calculate_total_price(@listing.price)\n\n respond_to do |format|\n if @booking.save\n BookingJob.perform_later(@booking, \"new\")\n format.html { redirect_to listing_path(@listing), notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bookings = smart_listing_create(:bookings, Booking.includes(:seat, :user).where(user_id: current_user.id), partial: \"bookings/listing\")\n end", "def create\n @booking = current_user.bookings.build(booking_params)\n @booking.user = current_user\n logger = MyLogger.instance\n logger.logInformation(\"A new booking made for: \" + @booking.cut)\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tablebooking = Tablebooking.new(tablebooking_params)\n\n respond_to do |format|\n if @tablebooking.save\n format.html { redirect_to @tablebooking, notice: 'Tablebooking was successfully created.' }\n format.json { render :show, status: :created, location: @tablebooking }\n else\n format.html { render :new }\n format.json { render json: @tablebooking.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.permit(:user_id, :job_id, :acceptance)\n end", "def booking_params\n params.require(:booking).permit(:start_day, :end_day, :hikers_nb, :user_id, :refuge_id, :status, :payment, :amount)\n end", "def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end", "def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\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 booking_params\n params.require(:booking).permit(:salon_id, :total_price, :service_ids)\n end", "def create\n\n @user = User.find(params[:user_id])\n @flight = Flight.find(params[:flight_id])\n @booking = @user.bookings.new(booking_params)\n respond_to do |format|\n if @booking.save\n format.html { redirect_to booking_path(current_user,@flight,@booking), notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking(data)\n payload = safe_access(data)\n\n params = {\n property_id: payload.get(\"inquiry.room.property_id\"),\n inquiry_id: payload.get(\"inquiry.id\"),\n unit_id: payload.get(\"inquiry.room.unit_id\"),\n check_in: payload.get(\"inquiry.check_in\"),\n check_out: payload.get(\"inquiry.check_out\"),\n guests: payload.get(\"inquiry.num_guests\"),\n subtotal: payload.get(\"inquiry.subtotal\"),\n currency_code: payload.get(\"inquiry.currency_code\"),\n customer: {\n first_name: payload.get(\"inquiry.user.first_name\"),\n last_name: payload.get(\"inquiry.user.last_name\"),\n email: payload.get(\"inquiry.user.email\"),\n phone: payload.get(\"inquiry.user.phone_number\")\n }\n }\n\n env[\"rack.input\"] = StringIO.new(json_encode(params))\n true\n end", "def index\n @bookings = Booking.all\n end", "def booking_params\n params.require(:booking).permit(:date_check_in, :date_check_out,\n :total_price, :status, :description)\n end", "def create\n @booking = @salon.bookings.new(booking_params)\n selected_days = params[:select_days]\n selected_time = params[:select_time]\n timeslot = Time.parse(\"#{selected_days} #{selected_time}\")\n @booking.bookings_services.build(service_id: params[:booking][:service_ids][0], timeslot: timeslot)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to [@salon, @booking], notice: \"Booking was successfully created.\" }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.find(book_request_params[:book_id])\n @account = Account.find(params[:account_id])\n @book_request = BookRequest.new(book: @book, reader: @account, holder: @book.account)\n respond_to do |format|\n if @book_request.save\n format.json {\n render json:\n {\n book_id: @book_request.book_id,\n book_request_state: @book_request.state_name\n }\n }\n else\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking_waitlist = BookingWaitlist.new(booking_waitlist_params)\n\n respond_to do |format|\n if @booking_waitlist.save\n format.html { redirect_to @booking_waitlist, notice: 'Booking waitlist was successfully created.' }\n format.json { render :show, status: :created, location: @booking_waitlist }\n else\n format.html { render :new }\n format.json { render json: @booking_waitlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bookalawn = Bookalawn.new(bookalawn_params)\n\n respond_to do |format|\n if @bookalawn.save\n format.html { redirect_to @bookalawn, notice: 'Booking was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bookalawn }\n else\n format.html { render action: 'new' }\n format.json { render json: @bookalawn.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.require(:booking).permit(:cut, :wash, :colour)\n end", "def booking_params\n params.fetch(:booking).permit(:checkin, :checkout, :occupancy)\n end", "def create\n \n @booking = Booking.new(params[:booking])\n params[:booking][:end_time] = @booking.end_time\n \n\n \n @booking = Booking.new(params[:booking])\n if @booking.weights == 1\n @booking.no_ergs = 0\n end\n \n respond_to do |format|\n if @booking.save\n flash[:notice] = 'Your booking was successfully created.'\n format.html { redirect_to bookings_path }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bidding = Bidding.new(params[:bidding])\n\n respond_to do |format|\n if @bidding.save\n format.html { redirect_to @bidding, notice: 'Bidding was successfully created.' }\n format.json { render json: @bidding, status: :created, location: @bidding }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def booking_params\n params.require(:booking).permit(:fan_id, :user_id, :start_date, :end_date, :status)\n end", "def booking_params\n params.require(:booking).permit(:bookingStartDate, :bnookigEndDate, :user_id, :book_id)\n end", "def create\n @booking = Booking.new(booking_params)\n respond_to do |format|\n if @booking.save(booking_params)\n format.html { redirect_to week_path, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: month_path }\n else\n format.html { redirect_to week_path, notice: 'Booking overlaps with current booking' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.require(:booking).permit( :check_in, :checkout, :service_id)\n end", "def create\n @reviewing = Reviewing.new(reviewing_params)\n @book = @reviewing.book\n @user = User.find(current_user.id)\n @user.reviewings << @reviewing\n @book.updateRate(@book.id)\n\n respond_to do |format|\n if @reviewing.save\n format.html { redirect_to book_reviewings_path(@reviewing.book.isbn), notice: 'Reviewing was successfully created.' }\n format.json { render :show, status: :created, location: @reviewing }\n else\n format.html { render :new }\n format.json { render json: @reviewing.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bookings = @user.bookings\n end", "def booking_params\n params.require(:booking).permit(:room_id, :room_type_id, :customer_id, :check_in_date, :check_out_date, :total_price, :num_of_adults, :num_of_children)\n end", "def booking_params\n params.require(:booking).permit(:user_id, :room_id, :book_date, :timespot_id)\n end", "def create\n @booking = @user.bookings.new(booking_params)\n @booking.movie = @movie\n @booking.tickets = @booking.build_tickets(ticket_types_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to seats_movie_booking_path(@movie,@booking) }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gbooking = Gbooking.new(gbooking_params)\n @gbooking.user = current_user if current_user\n if @gbooking.save\n params[:customizebookings].each_with_index do |customizebooking,index|\n customizebooking.permit!\n @customizebooking = Customizebooking.new(customizebooking.permit!)\n @customizebooking.number = index + 1\n @customizebooking.gbooking = @gbooking\n @customizebooking.save\n end\n\n respond_to do |format|\n format.html { redirect_to(@gbooking, :notice => 'Customizebooking was successfully created.') }\n format.xml { render :xml => @customizebooking, :status => :created, :location => @customizebooking }\n end\n end\n end", "def create\n @shipping_book = ShippingBook.new(shipping_book_params)\n\n respond_to do |format|\n if @shipping_book.save\n format.html { redirect_to @shipping_book, notice: 'Shipping address in Shipping book was successfully created.' }\n format.json { render :show, status: :created, location: @shipping_book }\n else\n format.html { render :new }\n format.json { render json: @shipping_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.require(:booking).permit(:book_name, :book_date, :tour_name, :book_price, :book_ticket_num,:book_amount,:package_id,:user_id,:status,:tax,:total_amount,:other)\n end", "def on_date\n @bookings = []\n @bookings = Booking.on_date(params[:booking_date]) if params[:booking_date]\n \n respond_to do |format|\n format.html {render \"index\"}\n format.json {render json: @bookings}\n end\n \n end", "def create\n @online_booking = OnlineBooking.new(online_booking_params)\n\n respond_to do |format|\n if @online_booking.save\n format.html { redirect_to @online_booking, notice: 'Online booking was successfully created.' }\n format.json { render :show, status: :created, location: @online_booking }\n else\n format.html { render :new }\n format.json { render json: @online_booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: { booking: @booking }, status: 200\n end", "def booking_params\n params.require(:booking).permit(:check_in, :check_out, :total_amount, :rental_amount, :service_fee)\n end", "def create\n @borrowed_book = BorrowedBook.new(borrowed_book_params)\n\n respond_to do |format|\n if @borrowed_book.save\n format.html { redirect_to @borrowed_book, notice: \"Borrowed book was successfully created.\" }\n format.json { render :show, status: :created, location: @borrowed_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @borrowed_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend", "def booking_params\n params.require(:booking).permit(:booking_reference, :institution, :ticket_type, :access_req, :catering, :certificate, :attended, :dietary_req, :conference_id, :user_id)\n end", "def booking_params\n params.require(:booking).permit(:reference)\n end", "def create\n\n checkIn = parse_datetime_params booking_params, \"check_in\", utc_or_local = \"AEST\"\n checkOut = parse_datetime_params booking_params, \"checkout\", utc_or_local = \"AEST\"\n @service_id = params[:booking][:service_id].to_i\n @consultant_id = Service.find(@service_id).user_id\n @consumer_id = current_user.id\n\n @booking = Booking.new({\n consultant_id: @consultant_id,\n consumer_id: @consumer_id,\n service_id: @service_id,\n status: \"Unconfirmed\",\n check_in: checkIn,\n checkout: checkOut\n })\n\n respond_to do |format|\n if @booking.save\n # ContactMailer.send_contact_email(message:\"Accepted\").deliver_now\n format.html { redirect_to @booking, notice: 'Booking was successfully created. This booking will not be confirmed until the consultant approves it.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_lawn\n book_lawn = Lawnbookings.where(booking_date: params[:booking_date], lawn_no: params[:lawn_no])\n \n if book_lawn.count == 0\n @book_lawn = Lawnbookings.new\n @book_lawn.lawn_no = params[:lawn_no]\n @book_lawn.booking_date = params[:booking_date]\n @book_lawn.save\n end\n if request.xhr?\n render :json => {booking_date: params[:booking_date], lawn_no: params[:lawn_no] } \n end\n end", "def create\n @room_booking = RoomBooking.new(room_booking_params)\n\n respond_to do |format|\n if @room_booking.save\n format.html { redirect_to @room_booking, notice: 'Room booking was successfully created.' }\n format.json { render :show, status: :created, location: @room_booking }\n else\n format.html { render :new }\n format.json { render json: @room_booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params.merge(user_id: current_user.id))\n respond_to do |format|\n if @booking.save\n format.html { redirect_to action: :index, notice: 'Booking was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def booking_params\n params.require(:booking).permit(:seller_id, :buyer_id, :room_id, :first_name, :last_name,\n :email, :phone, :duration, :guest, :subtotal, \n :service_fee, :total, :room_name, :room_title, :status, :paid,\n :check_in, :check_out, :start_date, :booking_code, :payment_method)\n end", "def create\n @booking = Booking.new\n @booking.ride = @ride\n @booking.user = current_user\n @booking.booking_status = 'pending'\n if @booking.save!\n redirect_to dashboard_path\n else\n render :new\n end\n end", "def create\n @booking_confirmation = BookingConfirmation.new(booking_confirmation_params)\n\n respond_to do |format|\n if @booking_confirmation.save\n format.html { redirect_to @booking_confirmation, notice: 'Booking confirmation was successfully created.' }\n format.json { render :show, status: :created, location: @booking_confirmation }\n else\n format.html { render :new }\n format.json { render json: @booking_confirmation.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.require(:booking).permit(:status, :seatsToBook, :username, :tourname, :user_id, :tour_id, :mode_of_booking)\n end", "def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"/books\", notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend" ]
[ "0.7352903", "0.72284335", "0.6861232", "0.6782861", "0.6782861", "0.67668116", "0.6642335", "0.66400397", "0.6624518", "0.65150934", "0.6509452", "0.6509452", "0.6509452", "0.64890003", "0.6432718", "0.63778627", "0.634703", "0.6325285", "0.6296925", "0.62891", "0.62781", "0.6277443", "0.62767607", "0.6247754", "0.62464654", "0.62223095", "0.6215823", "0.6198522", "0.61984634", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6195731", "0.6189869", "0.61832714", "0.61657804", "0.6154352", "0.6142793", "0.61381394", "0.61370474", "0.6127242", "0.6123788", "0.61121404", "0.6111874", "0.61089444", "0.61089444", "0.6104007", "0.6095511", "0.60944015", "0.60903037", "0.6079749", "0.60609657", "0.60606676", "0.6053615", "0.6049098", "0.60455245", "0.6040117", "0.6036512", "0.60346013", "0.603145", "0.6029787", "0.60239697", "0.60236365", "0.60167867", "0.6010606", "0.6003472", "0.6003308", "0.60023934", "0.59927744", "0.5987178", "0.59795856", "0.5974128", "0.595815", "0.59571755", "0.5952827", "0.5951134", "0.59454024", "0.5942887", "0.5939239", "0.593828", "0.5930827", "0.59304315", "0.5929975", "0.59287274", "0.59285533", "0.5927715", "0.59196234", "0.59182245", "0.59160197", "0.5913339", "0.59031016", "0.58981186" ]
0.0
-1
PATCH/PUT /bookings/1 PATCH/PUT /bookings/1.json
def update # if booking_params[:seats_booked].to_i < @booking.seats_booked.to_i tp = params.fetch(:booking).permit(:customer_id,:tour_id,:seats_booked,:preference) seats = @booking.seats_booked.to_i - booking_params[:seats_booked].to_i @tour = Tour.find(@booking.tour_id) @tour.seats = @tour.seats + booking_params[:seats_booked].to_i @tour.save tp[:seats_booked] = seats @tour = Tour.find(@booking.tour_id) # booking_db = Booking.order("created_at ASC").find(params[:tour_id]) booking_db = Booking.all.sort_by {|booking| booking.created_at } booking_db.each do |booking| if booking.seats_booked <= @tour.seats && booking.status == 0 @tour.seats = @tour.seats - booking.seats_booked booking.status = 1 booking.save @tour.save WaitListConfirmationMailer.notify_user(booking.customer).deliver_now end end # format.html { redirect_to @booking, notice: 'cannot delete more seats than booked' } # format.json { render :edit, status: :ok, location: @booking } # end respond_to do |format| if @booking.update(tp) format.html { redirect_to @booking, notice: 'Booking was successfully updated.' } format.json { render :show, status: :ok, location: @booking } else format.html { render :edit } format.json { render json: @booking.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end", "def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booking])\n respond_with(@booking)\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 @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n booking = Booking.find(params[:id])\n \n # Check if user is the owner of the booking\n if current_user[:id] == booking[:user_id]\n if booking.update_attributes(booking_params) \n render json: { status: 'SUCCESS', message: 'Updated booking', data: booking }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Booking not updated', data: booking.errors }, status: :unprocessable_entity\n end\n end\n end", "def update\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n flash[:notice] = 'Booking was successfully updated.'\n format.html { redirect_to property_room_bookings_url(@property, @room) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to bookings_path, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to bookings_url, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to profile_bookings_url(@profile), notice: 'Booking was successfully updated.' }\n format.json { render :index, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "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 = @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 respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er blevet opdateret.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @bookkeeping.update(bookkeeping_params)\n head :no_content\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bookable.update(bookable_params)\n format.html { redirect_to @bookable, notice: 'Bookable was successfully updated.' }\n format.json { render :show, status: :ok, location: @bookable }\n else\n format.html { render :edit }\n format.json { render json: @bookable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: \"Booking was successfully updated.\" }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: \"Booking was successfully updated.\" }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params_update)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\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 respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to show_booking_path, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to current_user, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.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 @booking.update(booking_params)\n format.html { redirect_back(fallback_location: salons_path) }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booking.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 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 @booking.update(booking_params)\n format.html { redirect_to hairdresser_booking_path(@hairdresser, @booking), notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.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 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 respond_to do |format|\n if @booking.update(booking_params.except(:mode_of_booking))\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.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\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 set_api_v1_booking\n @api_v1_booking = Booking.find(params[:id])\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 @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 @booking = Booking.find_by(id: params[:id])\n @booking.update(acceptance: true)\n UserMailer.confirm_email(@booking).deliver_now\n redirect_to job_bookings_path(params[:job_id]), notice: 'Application was successfully updated.' \n # respond_to do |format|\n # if @booking.update(booking_params)\n # format.html { redirect_to @booking, notice: 'Application was successfully updated.' }\n # format.json { render :show, status: :ok, location: @booking }\n # else\n # format.html { render :edit }\n # format.json { render json: @booking.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n flash[:notice] = 'Booking was successfully updated.'\n format.html { redirect_to(@booking) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @booking.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 respond_to do |format|\n if @book_request.update(book_request_params)\n format.html { redirect_to @book_request, notice: 'Book request was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_request }\n else\n format.html { render :edit }\n format.json { render json: @book_request.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 @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 @bookalawn.update(bookalawn_params)\n format.html { redirect_to @bookalawn, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bookalawn.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 @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 @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 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" ]
[ "0.7066941", "0.70359373", "0.69522876", "0.69305456", "0.69305456", "0.69305456", "0.69264215", "0.68737555", "0.6790091", "0.67386323", "0.67108357", "0.66946954", "0.66946954", "0.66946954", "0.6679139", "0.6656559", "0.66391355", "0.6634592", "0.6627814", "0.66257364", "0.6620122", "0.66104156", "0.66104156", "0.66104156", "0.66104156", "0.66104156", "0.66104156", "0.66104156", "0.66104156", "0.66104156", "0.66104156", "0.66104156", "0.66104156", "0.66093415", "0.65988135", "0.6596246", "0.65945613", "0.6594358", "0.65908206", "0.6585353", "0.6585034", "0.65621305", "0.65556425", "0.65323055", "0.6530302", "0.65237486", "0.65152025", "0.65152025", "0.65152025", "0.65152025", "0.65152025", "0.65152025", "0.65152025", "0.65152025", "0.65152025", "0.6508688", "0.6486319", "0.6479223", "0.6476933", "0.6455095", "0.64490485", "0.64348257", "0.6433693", "0.64319533", "0.643068", "0.6423189", "0.64141434", "0.64014035", "0.6400089", "0.6397202", "0.6397202", "0.6393683", "0.6390207", "0.6390207", "0.6390207", "0.6390207", "0.6385076", "0.63807", "0.6374296", "0.6373939", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302", "0.6373302" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_booking @booking = Booking.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 booking_params params.fetch(:booking).permit(:customer_id,:tour_id,:seats_booked,:preference) 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
Do a shelllike path lookup for prog_script and return the results. If we can't find anything return prog_script.
def whence_file(prog_script) if prog_script.index(File::SEPARATOR) # Don't search since this name has path separator components return prog_script end for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do prog_script_try = File.join(dirname, prog_script) return prog_script_try if File.exist?(prog_script_try) end # Failure return prog_script end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def whence_file(prog_script)\n if prog_script.index(File::SEPARATOR)\n # Don't search since this name has path separator components\n return prog_script\n end\n for dirname in ENV['PATH'].split(File::PATH_SEPARATOR) do\n prog_script_try = File.join(dirname, prog_script)\n return prog_script_try if File.readable?(prog_script_try)\n end\n # Failure\n return prog_script\n end", "def which(prog, path = ENV['PATH'])\n path.split(File::PATH_SEPARATOR).each do |dir|\n if File::ALT_SEPARATOR\n ext = Win32Exts.find do |ext|\n if prog.include?('.')\n f = File.join(dir, prog)\n else\n f = File.join(dir, prog+ext)\n end\n File.executable?(f) && !File.directory?(f)\n end\n if ext\n if prog.include?('.')\n f = File.join(dir, prog).gsub(/\\//,'\\\\')\n else\n f = File.join(dir, prog + ext).gsub(/\\//,'\\\\')\n end\n return f\n end\n else\n f = File.join(dir, prog)\n if File.executable?(f) && !File.directory?(f)\n return File::join(dir, prog)\n end\n end\n end\n\n nil\n end", "def find_shell_wrapper_or_executable prog\n @bindir.each do |dir|\n fname = File.join(dir, \"#{prog}.sh\")\n\n# $stderr.print \"Checking '#{fname}'\\n\"\n\n return fname if File.executable_real? fname\n end\n\n return find_executable(prog)\n end", "def check_script(path)\n binary=path.split(' ')[0]\n raise \"#{path} does not exist\" unless File.exist? binary\n raise \"#{path} is not executable\" unless File.executable? binary\n path\n end", "def default_script\n (Dir.entries(path.dirname).select{ |f| f =~ /\\.pbs$/i }.first || Dir.entries(path.dirname).select{ |f| f =~ /\\.sh$/i }.first) if path.dirname.directory?\n end", "def script path\r\n imported_script = source.export(path)\r\n if imported_script.nil?\r\n raise LoadError.new(\"cannot load script -- #{path}\")\r\n end\r\n if !@working_scripts.include?(imported_script) and !imported_scripts.include?(imported_script)\r\n @working_scripts.push imported_script\r\n # @hack Arguments need to be in different order if source returns proc\r\n if imported_script.read.kind_of?(Proc)\r\n stage &imported_script.read\r\n else\r\n stage imported_script.read, imported_script.absolute_path\r\n end\r\n @working_scripts.pop\r\n imported_scripts.push imported_script\r\n true\r\n else\r\n false\r\n end\r\n end", "def script_path\n @script_paths ||= Pathname.new(source_dir).join(data['script_path'] || './scripts').to_s\n end", "def find_executable( bin, *paths )\n paths = Launchy.path.split( File::PATH_SEPARATOR ) if paths.empty?\n paths.each do |path|\n file = File.join( path, bin )\n if File.executable?( file ) then\n Launchy.log \"#{self.name} : found executable #{file}\"\n return file\n end\n end\n Launchy.log \"#{self.name} : Unable to find `#{bin}' in #{paths.join(\", \")}\"\n return nil\n end", "def which program\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exe = File.join(path, program)\n return exe if File.file?(exe)\n end\n nil\n end", "def find_on_path( s )\n # for now, Windows-only; parameter s with or without path\n if ARCH != 'w32'\n return nil\n end\n ENV['PATH'].gsub( \"\\\\\", \"/\" ).split( /;/ ).each do |d|\n d = File.expand_path( d ) # this seems a syntactic operation\n s_full = d.sub( /\\/$/, '' ) + '/' + s\n if test( ?d, d ) and test( ?f, s_full )\n return s_full\n end\n ENV['PATHEXT'].split( /;/ ).each do |e|\n # components of PATHEXT should include leading dot\n s_full = d.sub( /\\/$/, '' ) + '/' + s + e\n if test( ?f, s_full )\n return s_full\n end\n end # do |e|\n end # do |d|\n return nil\nend", "def script\n @script ||= (Dir.glob(root+'/**/parts.js').first || Dir.glob(root+'/**/parts.js.coffee').first)\n end", "def find_program( *names )\n system_path = ENV.read( 'PATH', Array )\n [ names ].flatten!.find do | prog |\n system_path.find { | d | File.executable?( d / prog ) }\n end\n end", "def find_executable_in_path(command_name)\n ENV['PATH'].split(/;|:/).each do |dir|\n path = File.join(dir, command_name)\n return path if File.executable?(path)\n end\n return nil\n end", "def find_executable_in_path(command_name)\n ENV['PATH'].split(/;|:/).each do |dir|\n path = File.join(dir, command_name)\n return path if File.executable?(path)\n end\n return nil\n end", "def which(*bins)\n bins.flatten.each do |bin|\n ENV[\"PATH\"].split(\":\").each do |dir|\n full_path = File.join(dir, bin)\n return full_path if File.exist? full_path\n end\n end\n nil\nend", "def resolve_path(path)\n fail_script_unless_file_exists path\n return path\n end", "def resolve_path(path)\n fail_script_unless_file_exists path\n return path\n end", "def find_executable(bin,*paths)\n paths = ENV['PATH'].split(File::PATH_SEPARATOR) if paths.empty?\n paths.each do |path|\n file = File.join(path,bin)\n if File.executable?(file) then\n Launchy.log \"#{self.name} : found executable #{file}\"\n return file\n end\n end\n Launchy.log \"#{self.name} : Unable to find `#{bin}' in #{paths.join(', ')}\"\n return nil\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 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", "def script_alias_path(path)\n return @script_aliases[path]\n end", "def which0(cmd, &found_exe)\n # call expand_path(f, nil) == expand_path(f) for relative/abs path cmd\n find_executable(nil, cmd, &found_exe) if File.basename(cmd) != cmd\n\n search_paths.each do |path|\n find_executable(path, cmd, &found_exe)\n end\n end", "def active_path\n if script = script_object()\n if path = script.path\n return path.dup\n end\n end\n\n # If for some reason that didn't work, return the compile time filename.\n method.file.to_s\n end", "def get_path\n cmd_exec('echo $PATH').to_s\n rescue\n raise \"Unable to determine path\"\n end", "def executable_path=(_arg0); end", "def find_programs *directories\n directories.flatten.\n map {|d| Pathname.new(d).expand_path.children rescue [] }.flatten.\n map {|f| f.basename.to_s if f.file? and f.executable? }.compact.uniq.sort\n end", "def program_in_path?(program)\n # Scan path to find the executable\n # Do this to help the user get a better error message.\n envpath = ENV[\"PATH\"].split(\":\")\n return envpath.select { |p| File.executable?(File.join(p, program)) }.any?\n end", "def whereis(prog, path=ENV['PATH'])\n dirs = []\n path.split(File::PATH_SEPARATOR).each do |dir|\n if File::ALT_SEPARATOR\n if prog.include?('.')\n f = File.join(dir,prog)\n if File.executable?(f) && !File.directory?(f)\n if block_given?\n yield f.gsub(/\\//,'\\\\')\n else\n dirs << f.gsub(/\\//,'\\\\')\n end\n end\n else\n Win32Exts.find_all do |ext|\n f = File.join(dir,prog+ext)\n if File.executable?(f) && !File.directory?(f)\n if block_given?\n yield f.gsub(/\\//,'\\\\')\n else\n dirs << f.gsub(/\\//,'\\\\')\n end\n end\n end\n end\n else\n f = File.join(dir,prog)\n if File.executable?(f) && !File.directory?(f)\n if block_given?\n yield f\n else\n dirs << f\n end\n end\n end\n end\n dirs.empty? ? nil : dirs\n end", "def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each { |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable? exe\r\n }\r\n end\r\n return nil\r\nend", "def which(cmd)\n # Could actually rather check that this command with the .exe suffix\n # is somewhere, instead of allowing the suffix to change, but that\n # is probably fine\n if OS.windows? && (cmd.end_with? '.exe')\n # 5 is length of \".exe\"\n cmd = cmd[0..-5]\n end\n\n exts = pathExtsAsArray\n pathAsArray.each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def script_location\n File.dirname(script)\n end", "def which(cmd)\n # Could actually rather check that this command with the .exe suffix\n # is somewhere, instead of allowing the suffix to change, but that\n # is probably fine\n if OS.windows?\n if cmd.end_with? \".exe\"\n # 5 is length of \".exe\"\n cmd = cmd[0..-5]\n end\n end\n \n exts = pathExtsAsArray\n pathAsArray.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\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def find_executable_in_path(command_name)\n # must search all known (executable) path extensions unless the\n # explicit extension was given. this handles a case such as 'curl'\n # which can either be on the path as 'curl.exe' or as a command shell\n # shortcut called 'curl.cmd', etc.\n use_path_extensions = 0 == File.extname(command_name).length\n path_extensions = use_path_extensions ? ENV['PATHEXT'].split(/;/) : nil\n\n # must check the current working directory first just to be completely\n # sure what would happen if the command were executed. note that linux\n # ignores the CWD, so this is platform-specific behavior for windows.\n cwd = Dir.getwd\n path = ENV['PATH']\n path = (path.nil? || 0 == path.length) ? cwd : (cwd + ';' + path)\n path.split(/;/).each do |dir|\n if use_path_extensions\n path_extensions.each do |path_extension|\n path = File.join(dir, command_name + path_extension)\n return path if File.executable?(path)\n end\n else\n path = File.join(dir, command_name)\n return path if File.executable?(path)\n end\n end\n return nil\n end", "def executable\n val = executables and val.first\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n # return nil\n end", "def which(cmd)\n\t# Stolen from http://stackoverflow.com/questions/210872\n\texts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\tENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n\t\texts.each { |ext|\n\t\t\texe = File.join(path, \"#{cmd}#{ext}\")\n\t\t\treturn exe if File.executable? exe\n\t\t}\n\tend\n \treturn nil\nend", "def which(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\n }\n end\n\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end", "def which(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 which(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 which(cmd)\n\texts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\tENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n\t\texts.each do |ext|\n\t\t\texe = File.join(path, \"#{cmd}#{ext}\")\n\t\t\treturn exe if File.executable? exe\n\t\tend\n\tend\n\treturn nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir|\n exts.each do |ext|\n path = File.join(dir, \"#{cmd}#{ext}\")\n if File.executable?(path) && File.file?(path)\n return path\n end\n end\n end\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n\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\n }\n end\n\n return nil\nend", "def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each do |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable?(exe) && !File.directory?(exe)\r\n end\r\n end\r\n nil\r\nend", "def executable_path; end", "def shell_path\n value = shell_name.to_s\n\n if value.match(/^\\//)\n # Absolute path already provided (starts with \"/\")\n value.p\n else\n # Shell name provided, use \"which\" to find the executable\n which(value).p\n end\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\n end", "def which(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\nend", "def which(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\nend", "def which(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\nend", "def which(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\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n return nil\nend", "def which(cmd)\r\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\r\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\r\n exts.each do |ext|\r\n exe = File.join(path, \"#{cmd}#{ext}\")\r\n return exe if File.executable?(exe) && !File.directory?(exe)\r\n end\r\n end\r\n nil\r\n end", "def which(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 nil\nend", "def which(cmd)\n exts = ENV[\"PATHEXT\"] ? ENV[\"PATHEXT\"].split(\";\") : [\"\"]\n ENV[\"PATH\"].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\nreturn nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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\n }\n end\n return nil\nend", "def which(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 which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each { |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n }\n end\n return nil\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{cmd}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end", "def which(cmd)\n exts = ENV[\"PATHEXT\"] ? ENV[\"PATHEXT\"].split(\";\") : [\"\"]\n\n ENV[\"PATH\"].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n\n nil\n end", "def which(command)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = \"#{path}/#{command}#{ext}\"\n return exe if File.executable? exe\n end\n end\n return nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable?(exe) && !File.directory?(exe)\n end\n end\n nil\n end", "def find_executable(bin,*paths)\n Application.find_executable(bin,*paths)\n end", "def get_script_path(name)\n res = ENV['TEST_DIR'] + '/' + name\n\n if !File.exist?(res)\n res = ENV['APP_DIR'] + '/' + name\n end\n\n if !File.exist?(res)\n $stderr.puts \"ERROR: '#{name}' script doesn't exist neither in TEST_DIR or APP_DIR\"\n exit 7\n end\n \n return res\nend", "def which(cmd)\n exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']\n ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{cmd}#{ext}\")\n return exe if File.executable? exe\n end\n end\n nil\n end", "def load_script_from_index\n lines = File.readlines(index_filename)\n path = ENV['ALTERNATIVE_PATH'] || '.'\n lines.each do |filename|\n require(File.join(path, filename.chomp))\n end\n end", "def which(command)\n exts = ENV[\"PATHEXT\"] ? ENV[\"PATHEXT\"].split(\";\") : [\"\"]\n ENV[\"PATH\"].split(File::PATH_SEPARATOR).each do |path|\n exts.each do |ext|\n exe = File.join(path, \"#{command}#{ext}\")\n return exe if File.executable? exe\n end\n end\n nil\n end", "def which(executable)\n if File.file?(executable) && File.executable?(executable)\n executable\n elsif ENV[\"PATH\"]\n path = ENV[\"PATH\"].split(File::PATH_SEPARATOR).find do |p|\n File.executable?(File.join(p, executable))\n end\n path && File.expand_path(executable, path)\n end\n end", "def path_to_root\n path_to_script = Pathname.new(File.expand_path $PROGRAM_NAME)\n path_to_parent = path_to_script.parent\n\n if path_to_parent.basename.to_s == 'bin'\n path_to_parent = path_to_parent.parent\n end\n path_to_parent\n end", "def to(program)\n location = locations.find { |path| exists? File.join(path, program) }\n raise NotFound.new(program) unless location\n location\n end", "def get_file_executable(dir_run_programs, opts = {})\n BawWorkers::Validation.check_custom_hash(opts, BawWorkers::Jobs::Analysis::Payload::OPTS_FIELDS)\n\n file_executable_relative = opts[:file_executable]\n BawWorkers::Validation.normalise_path(file_executable_relative, dir_run_programs)\n end" ]
[ "0.7780434", "0.6989591", "0.69886225", "0.6239696", "0.61683714", "0.60768193", "0.6011705", "0.6010599", "0.60050213", "0.5948889", "0.59437", "0.59130657", "0.5908372", "0.5908372", "0.58705324", "0.5841371", "0.5841371", "0.5822527", "0.5817532", "0.58142436", "0.5806768", "0.57250786", "0.56717527", "0.5641476", "0.5638598", "0.56252575", "0.56244636", "0.5615325", "0.55875117", "0.557676", "0.5559803", "0.55513793", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.5549988", "0.55371577", "0.5533296", "0.55300605", "0.5521717", "0.5519664", "0.5518397", "0.55089915", "0.55089915", "0.5508064", "0.5507353", "0.55042833", "0.5489724", "0.54877585", "0.5482216", "0.54761404", "0.546524", "0.546524", "0.546524", "0.546524", "0.546485", "0.5461404", "0.5461404", "0.5461404", "0.5461404", "0.5461113", "0.5459404", "0.5458285", "0.5448636", "0.5441311", "0.54406106", "0.54406106", "0.54360193", "0.5432871", "0.5432871", "0.5432871", "0.5432871", "0.5432871", "0.5432871", "0.5432871", "0.5420189", "0.5420189", "0.5419178", "0.54153", "0.5415086", "0.5415086", "0.5411543", "0.5409038", "0.540827", "0.539803", "0.53974545", "0.53909105", "0.5365602", "0.5359137", "0.53554577" ]
0.7816255
0
We want to tightly control where users end up after signing in. If they hit a protected resource, devise has stored the location they were attempting If they volunteer to sign in, we've previously stored the location using after_filters in the devise cookie If they were on the front page, we want to redirect them to the dashboard instead If they have a remembered_group, then we want to inject the subdomain into any of the above We need to do all of that without messing up domains or ports ... and we need to make sure they go back to an http page, so that nonhttps maps can load.
def after_sign_in_path_for(resource_or_scope) s = stored_location_for(resource_or_scope) # nb returns and deletes if s && s[0] == '/' && s != '/' s.slice!(0) # remove the leading slash if current_user.remembered_group? # is there a cleaner way than using root_url? root_url(protocol: 'http', subdomain: current_user.remembered_group.short_name) + s else root_url(protocol: 'http') + s end else if current_user.remembered_group? dashboard_url(protocol: 'http', subdomain: current_user.remembered_group.short_name) else dashboard_url(protocol: 'http') end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_redirect\n redirect_to('https://carto.com/signin/') if CartoDB.extract_subdomain(request) == 'developers'\n end", "def after_sign_in_path_for(resource)\n if resource.class == 'Group'\n # root_url(:subdomain => current_user.subdomain)\n root_url\n else\n root_url\n end\n end", "def set_subdomain\n if user_signed_in? && current_university == nil\n redirect_to subdomain: current_user.current_university.codename\n end\n end", "def redirect_user_to_country_site(subdomain)\n redirect_to(\"http://#{subdomain}.#{Rails.application.config.main_domain}#{request.fullpath}\")\n return\n end", "def after_sign_in_path_for(resource)\n case resource\n when User then\n #store session user for gmail style login\n session[:user_id] = current_user.id\n #remember to use url for changing subdomain\n #stored_location_for(resource) will store the last location b4 login\n request.env['omniauth.origin'] || stored_location_for(resource) || root_url(subdomain: resource.current_education.university.codename)\n when Admin then\n rails_admin_path\n end\n end", "def login_required\n Rails.logger.info \">> login_subdomain => \" + request.subdomain\n Rails.logger.info \">> login_required => \" + request.fullpath\n\n if !is_main_subdomain? && current_company.nil?\n redirect_to ::AppConfig.main_web and return\n end\n\n Rails.logger.info \">> cookie found #{cookies[:auth_token]}\" if cookies[:auth_token]\n\n unless current_user\n if request.xhr? # handle ajax session timeout\n session[:return_to] = nil\n redirect_to :log_in, :status => :forbidden and return false\n else\n session[:return_to] = request.fullpath\n redirect_to :log_in and return\n end\n end\n\n Rails.logger.info \">> login_required_user_email => \" + current_user.email\n Rails.logger.info \">> login_required_subdomain => \" + request.subdomain\n Rails.logger.info \">> login_required_not_access \" if current_access.nil?\n\n # user cookie without access\n if current_access.nil?\n session[:return_to] = nil\n redirect_to :log_in\n end\n\n #if is_main_subdomain? || current_access.nil?\n # redirect_to :me\n #end\n end", "def after_sign_in_path_for(user)\n app_url(subdomain: current_company.subdomain)\n end", "def correct_user\n if request.subdomain.present? && request.subdomain != \"www\"\n if user_signed_in?\n if params[:controller] == 'static_pages' && params[:action] == 'home'\n elsif params[:controller] == 'pages' && params[:action] == 'show'\n elsif params[:controller] == 'static_pages' && params[:action] == 'leasing'\n elsif params[:controller] == 'availabilities' && params[:action] == 'show'\n else\n @subdomain = request.subdomain\n @site = Site.where(subdomain: request.subdomain).first\n @user = User.where(id: @site.user_id).first\n if @user.id != current_user.id\n redirect_to (root_url(:subdomain => false) + \"dashboard\")\n # sign_out(@user)\n end\n end\n end\n end\n end", "def store_location\n # after registration is another special case - do not redirect to \"current page\"\n session[:user_return_to] = request.url unless [\"devise/passwords\", \"devise/sessions\", \"devise/registrations\"].include?(params[:controller])\n end", "def authenticate_subdomain!\n redirect_to root_url, alert: \"The subdomain is not linked to a valid account\" if current_account.nil?\n end", "def authenticate_subdomain!\n redirect_to 'http://lvh.me:3000/', alert: \"The subdomain is not linked to a valid account\" if current_account.nil?\n\n end", "def after_sign_in_path_for(resource)\n cookies[:login_type] = {\n value: \"local\",\n secure: Rails.env.production?\n }\n if !resource.waived_welcome_page\n Rails.application.routes.url_helpers.welcome_page_index_path\n else\n Rails.application.routes.url_helpers.new_classify_concern_path\n end\n end", "def after_sign_in_path_for(resource)\n stored_location_for(resource) ||\n if resource.is_a?(Admin)\n admin_view_path\n else\n user_index_path\n end\nend", "def after_sign_in_path_for(resource)\n if Rails.env.production?\n request.env['omniauth.origin'] || stored_location_for(resource) || KISALLI_URL\n else\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end\n end", "def post_auth_redirect_url\n referer = params[:referer] || request.referer\n \n if referer && (referer =~ %r|^https?://#{request.host}#{root_path}| ||\n referer =~ %r|^https?://#{request.host}:#{request.port}#{root_path}|)\n #self-referencing absolute url, make it relative\n referer.sub!(%r|^https?://#{request.host}(:#{request.port})?|, '')\n elsif referer && referer =~ %r|^(\\w+:)?//|\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use third party url for post login redirect: #{referer}\")\n referer = nil\n end\n \n if referer && referer_blacklist.any? {|blacklisted| referer.starts_with?(blacklisted) }\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use a blacklisted url for post login redirect: #{referer}\")\n referer = nil\n elsif referer && referer[0,1] != '/'\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use partial path for post login redirect: #{referer}\")\n referer = nil\n end\n \n return referer || root_path \n end", "def after_sign_in_path_for(resource)\n if request.referer =~ /\\/users/\n super\n else\n stored_location_for(resource) || request.referer || root_path\n end\n end", "def set_sign_in_redirect\n if (hash = params[:x_return_to]).present?\n session[:user_return_to] =\n \"#{request.protocol}#{request.host_with_port}/##{hash}\"\n end\n end", "def set_sign_in_redirect\n if (hash = params[:x_return_to]).present?\n session[:user_return_to] =\n \"#{request.protocol}#{request.host_with_port}/##{hash}\"\n end\n end", "def after_sign_in_path_for(resource)\n return request.env['omniauth.origin'] || stored_location_for(resource) || dashboards_path\n end", "def default_redirect_url_after_sign_in\n admin_dashboard_url \n end", "def store_devise_redirect_location\n return if request.xhr?\n return if !request.get?\n\n not_store_for = {\n registrations: %w[ new ],\n confirmation: %w[ new ],\n sessions: %w[ new ],\n passwords: %w[ new edit ],\n omniauth_callbacks: %[ vkontakte facebook twitter google_oauth2 odnoklassniki failure ],\n\n users: %w[ profile ],\n carts: %w[ index ],\n orders: %w[ index ]\n }.with_indifferent_access\n\n return if not_store_for.try(:[], controller_name).try(:include?, action_name)\n\n cookies[:previous_location] = request.fullpath\n end", "def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope.is_a?(User) && resource_or_scope.banned?\n sign_out resource_or_scope\n banned_index_path\n elsif session[:pre_sign_in_path] && session[:pre_sign_in_path] != birthyear_path || session[:pre_sign_in_path] != new_user_session_path\n session[:user_return_to] || (session[:pre_sign_in_path] if session[:pre_sign_in_path] != birthyear_path ) || root_path\n elsif request.env['omniauth.origin'] && request.env['omniauth.origin'] != new_user_session_path || request.env['omniauth.origin'] != birthyear_path\n session[:user_return_to] || (session[:pre_sign_in_path] if session[:pre_sign_in_path] != birthyear_path ) || request.env['omniauth.origin'] || root_path\n else\n root_path\n end\n end", "def redirect_to_canonic_domain\n return unless request.get?\n locale_domain = locale_domain_for(current_locale)\n return if request.host_with_port == locale_domain\n redirect_to(locale_url_for(current_locale))\n end", "def after_sign_up_path_for(resource)\n if ResumisConfig.multi_tenant?\n manage_dashboard_url(subdomain: resource.subdomain)\n elsif ResumisConfig.canonical_host\n manage_dashboard_url(host: ResumisConfig.canonical_host)\n else\n manage_dashboard_url\n end\n end", "def after_sign_in_path_for(_resource)\n cookies[:login_type] = \"local\"\n return root_path unless parameter_set?\n dashboard_works_path\n end", "def after_sign_in_path_for(user)\n \"/map\"\n end", "def after_sign_in_path_for(resource)\n stored_location_for(:user) || super\n end", "def store_location\n if request.get? && request.format.html? && !request.xhr? && !devise_controller?\n session[:\"user_return_to\"] = request.fullpath\n end\n end", "def after_sign_in_path_for(resource_or_scope)\n sign_in_routing_path\n\n # @object = cookies[:object]\n #@song_album_or_event_slug = cookies[:song_album_or_event_slug]\n # assign_to_user (cookies[:object],cookies[:song_album_or_event_slug])\n end", "def after_sign_in_path_for(user)\n # Check to see that the user has a user_convention record after they have signed in\n subdomain = Apartment::Tenant.current\n unless user.user_conventions.where(subdomain: subdomain).any?\n flash[:notice] = I18n.t(\"application.subdomain.welcome\", subdomain: subdomain)\n # welcome: Welcome to %{subdomain}\n user.user_conventions.create!(subdomain: subdomain)\n end\n\n super\n end", "def after_devise_action_for(resource)\n stored_location_for(resource) || root_url\n end", "def ensure_the_url_has_a_subdomain\n if account_subdomain.blank?\n redirect_to public_home_page_url(true), :status => :moved_permanently\n end\n end", "def after_sign_in_path_for(resource)\n default_url = dashboard_path\n stored_path = request.env['omniauth.origin'] || stored_location_for(resource)\n case stored_path.try(:gsub, root_url, '/')\n when root_path\n # Don't return to homepage\n default_url\n when %r{\\A/users/}\n # Don't return to sign in/up page\n default_url\n else\n stored_path\n end || default_url\n end", "def store_location\n session[:user_return_to] = request.url unless params[:controller] == \"devise/sessions\"\n # If devise model is not User, then replace :user_return_to with :{your devise model}_return_to\n end", "def after_sign_in_path_for(user)\n if resource_params[:uv_login].present?\n # Redirect to UserVoice with sso token\n user_voice_url(user)\n else\n # ..just redirect to the app\n app_url(subdomain: current_company.subdomain)\n end\n end", "def after_sign_in_path_for(resource)\n if resource.email_verified?\n # super resource\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n else\n finish_signup_path(resource)\n end\n end", "def index\n if user_signed_in?\n redirect_to dashboard_path\n else\n render :index\n #redirect_to new_user_session_url(subdomain: ENV[\"SUBDOMAIN\"])\n end\n end", "def after_sign_in_path_for(resource)\n request.env['omniauth.origin'] || stored_location_for(resource) || home_path\n end", "def check_user_domain\n if @current_user and \n @current_user.default_site and \n @current_user.default_site != @current_site\n redirect_to url_for( :host => @current_user.default_site.fully_qualified_domain, :port => @current_user.default_site.port || request.port )\n end\n end", "def after_sign_in_path_for(resource_or_scope)\n case resource_or_scope.class.name\n when 'Venue'\n venue_root_url(:protocol => 'http')\n when 'Admin'\n admin_root_url(:protocol => 'http')\n else\n super\n end\n end", "def after_sign_in_path_for(resource)\n # resource.admin? ? rails_admin.dashboard_path : root_path\n root_path\n end", "def store_current_location\n # To redirect to the url user hit before signin.\n store_location_for(:user, request.url)\n # devise handles redirect after sign in using session[:user_return_to]\n # updating redirect url for api\n session[:user_return_to] = params[:redirect_url] if params['redirect_url'].present?\n end", "def after_sign_in_path_for(resource)\n sign_in_url = new_user_session_url\n if request.referer == sign_in_url\n super\n else\n stored_location_for(resource) || request.referrer || root_path\n end\n end", "def store_location\n session[:user_return_to] = request.url if request.get? and controller_name != \"sessions\" and controller_name != \"registrations\" and controller_name != \"omniauth_callbacks\"\n end", "def after_sign_in_path_for(user)\n user.is_admin? ? admin_dashboard_path : root_path\n end", "def after_sign_in_path_for(resource_or_scope)\n\t stored_location_for(resource_or_scope) || super\n\tend", "def after_sign_in_path_for(_resource)\n current_user.email? ? root_url : edit_user_registration_url\n end", "def after_successful_sign_in_url\n root_path\n end", "def signed_in_root\n path = case session[:user_type]\n when 'admin'\n users_path\n\n when 'provider'\n provider_home_path\n\n when 'patient'\n patient_home_path\n\n else\n root_path\n end\n\n path\n end", "def after_sign_in_path_for(user)\n home_locations_path\n end", "def after_sign_in_path_for(_resource_or_scope)\n backend_dashboard_path\n end", "def after_sign_in_path_for(resource)\n\t\trequest.env['omniauth.origin'] || stored_location_for(resource) || root_path\n\tend", "def after_sign_in_path_for(resource)\n stored_location_for(resource) || user_dashboard_path(resource.id)\n end", "def after_sign_in_path_for(resource)\n # stored_location_for(resource) || posts_path\n [\"sessions\",\"registrations\",\"passwords\"].include?(controller_name)\n posts_path\n end", "def after_sign_in_path_for(resource)\n if current_user.sign_in_count == 1 || current_user.username == \"demo\"\n new_site_path\n else\n dashboard_path\n end\n end", "def validate_subdomain\n if current_account || request.host == \"localhost\"\n elsif current_account.nil?\n redirect_to '/404.html'\n end\n end", "def after_sign_in_path_for(resource)\n stored = stored_location_for(resource) # this also delete the cookie\n if stored\n stored\n elsif Account.current && defined?(CmsPage) && (welcome_page = CmsPage.welcome_page)\n welcome_page.is_published? ? dm_cms.showpage_url(welcome_page.slug) : main_app.root_path\n elsif request.referer && request.referer != new_user_session_url && !request.referer.start_with?(edit_user_password_url)\n request.referer\n else\n main_app.root_path\n end\n end", "def index\n if current_user\n # I am logged in, visiting my subdomain -> my dashboard\n redirect_to CartoDB.url(self, 'dashboard', user: current_user)\n elsif CartoDB.extract_subdomain(request).present?\n # I am visiting another user subdomain -> other user public pages\n redirect_to CartoDB.url(self, 'public_user_feed_home')\n elsif current_viewer\n # I am logged in but did not specify a subdomain -> my dashboard\n redirect_to CartoDB.url(self, 'dashboard', user: current_viewer)\n else\n # I am not logged in and did not specify a subdomain -> login\n # Avoid using CartoDB.url helper, since we cannot get any user information from domain, path or session\n redirect_to login_url\n end\n end", "def after_sign_in_path_for(current_user)\n if admin_signed_in?\n \tadmins_root_path\n elsif user_signed_in?\n \troot_path\n end\t\t\n\tend", "def after_sign_in_path_for(resource)\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end", "def after_sign_in_path_for(resource)\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end", "def after_sign_in_path_for(resource)\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end", "def set_company\n # @company ||= Company.find_by_sub_domain request.subdomain\n # if request.subdomain.blank?\n # redirect_to root_url(subdomain: 'www')\n # elsif request.subdomain != \"www\" && @company.nil?\n # redirect_to root_url(subdomain: 'www')\n # end\n end", "def after_sign_in_path_for(resource)\n \tstored_location_for(resource) || dashboard_path\n end", "def login_url\n DOMAINS[username_domain] || DOMAINS['hotmail.com']\n end", "def record_signup_redirect_path\n return if current_user and !request.get? \n if (request.path != \"/account/login\" &&\n request.path != \"/account/register\" &&\n request.path != \"/account/password/new\" &&\n request.path != \"/account/logout\" &&\n !request.xhr?) # don't store ajax calls\n session[:user_return_to] = request.fullpath\n end\n end", "def after_sign_in_path_for(resource_or_scope)\n resource_or_scope.is_a?(User) ? dashboard_root_path : root_path\n end", "def authenticate_request\n session[:requested_url] = request.fullpath\n\n url = logged_in? ? shibbolite.access_denied_url : shibbolite.login_url\n\n # redirect to the selected url\n respond_to do |format|\n format.html { redirect_to url }\n format.js { render js: \"window.location.assign('#{url}');\"}\n end\n end", "def after_sign_in_path_for(resource)\n home_passthrough_path\n end", "def after_sign_in_path_for(resource)\n if resource.kind_of? ::AdminUser\n '/admin'\n else\n if session[:redirect_to_order] = 1\n new_order_path\n else\n request.env['omniauth.origin'] || stored_location_for(resource) || root_path\n end\n end\n end", "def sign_in_and_redirect2(resource_or_scope, *args)\n options = args.extract_options!\n scope = Devise::Mapping.find_scope!(resource_or_scope)\n resource = args.last || resource_or_scope\n sign_in(scope, resource, options)\n redirect_to stored_location_for(:user) || root_path # thanks_for_registration_path\n end", "def store_location\n session[:redirect_after_login] = request.request_uri\n end", "def after_sign_in_path_for(resource_or_scope)\n #Redirect to Dashboard Controller\n dashboard_index_path\n end", "def custom_user_sign_in\n if current_user.nil?\n session[:return_location] = request.referrer\n redirect_to new_user_session_path\n else\n redirect_to request.referrer || root_path\n end\n end", "def auth_after\n url = session[:auth_redirect] || root_path\n redirect_to url\n end", "def signed_in_user\n # Listing 9.18: Adding store_location to the signed-in user before filter.\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def after_sign_in_path_for(resource)\n return stored_location_for(resource) || dashboard_path\n end", "def redirect_place #returns the place to redirect to based on origin\n if safe_params[:origin] == \"individual\"\n return (tournament_path(@tournament) + '/registration/individual');\n elsif safe_params[:origin] == \"teams\"\n return (tournament_path(@tournament) + '/control/teams');\n else\n puts(\"Hack ###\");\n redirect_to root_path;\n return;\n end\n end", "def after_sign_in_path_for(resource)\n dashboard_path || super\n end", "def default_account_subdomain\n\t\t'www'\n\tend", "def store_location\n if logged_in_from_signup_page\n session[:forwarding_url] = root_path\n else\n session[:forwarding_url] = request.referer\n end\n end", "def after_sign_in_path_for(_resource)\n '/dashboard'\n end", "def after_sign_in_path_for(resource)\n # Here you can write logic based on roles to return different after sign in paths\n if current_user.superadmin_role?\n rails_admin_path\n elsif current_user.supervisor_role?\n rails_admin_path\n elsif current_user.client_role?\n dashboard_path\n else\n root_path\n end\n end", "def after_sign_in_path_for(resource_or_scope)\n 'https://www.recharles.xyz/'\n end", "def sanitize_redirect_url\n referer = params[:referer].blank? ? request.referer : params[:referer]\n\n if referer && (referer =~ %r|^https?://#{request.host}#{root_path}| ||\n referer =~ %r|^https?://#{request.host}:#{request.port}#{root_path}|)\n #self-referencing absolute url, make it relative\n referer.sub!(%r|^https?://#{request.host}(:#{request.port})?|, '')\n elsif referer && referer =~ %r|^(\\w+:)?//|\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use third party url for post login redirect: #{referer}\")\n referer = nil\n end\n\n if referer && referer_blacklist.any? {|blacklisted| referer.starts_with?(blacklisted) }\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use a blacklisted url for post login redirect: #{referer}\")\n referer = nil\n elsif referer && referer[0,1] != '/'\n Rails.logger.debug(\"#post_auth_redirect_url will NOT use partial path for post login redirect: #{referer}\")\n referer = nil\n end\n\n return referer || root_path\n end", "def after_sign_in_path_for(resource)\n stored_location_for(resource) || dashboard_path\n end", "def after_sign_in_path_for(resource_or_scope)\n return '/admin' if current_user.try(:admin?)\n store_url\n end", "def sign_in_and_redirect(resource_or_scope, *args); end", "def logged_in_personnel\n unless logged_in?\n store_location\n redirect_to login_url\n end\n end", "def after_sign_in_path_for(_resource)\n root_url\n end", "def after_sign_in_path_for(resource_or_scope)\n if (session[:my_previous_url].include?(new_user_session_path)|| \n session[:my_previous_url].include?(user_session_path) || \n session[:my_previous_url].include?(destroy_user_session_path) || \n session[:my_previous_url].include?(user_facebook_omniauth_authorize_path) || \n session[:my_previous_url].include?(user_facebook_omniauth_callback_path) || \n session[:my_previous_url].include?(user_google_oauth2_omniauth_authorize_path) || \n session[:my_previous_url].include?(user_google_oauth2_omniauth_callback_path) || \n session[:my_previous_url].include?(new_user_password_path) || \n session[:my_previous_url].include?(edit_user_password_path) || \n session[:my_previous_url].include?(user_password_path) || \n session[:my_previous_url].include?(cancel_user_registration_path) || \n session[:my_previous_url].include?(new_user_registration_path) || \n session[:my_previous_url].include?(edit_user_registration_path) || \n session[:my_previous_url].include?(user_registration_path) || \n session[:my_previous_url].include?(users_path) || \n session[:my_previous_url].include?(new_user_path) || \n session[:my_previous_url].include?(edit_user_path(current_user)) || \n session[:my_previous_url].include?(user_path(current_user)))\n \n session[:my_previous_url] = root_path\n end\n\n stored_location_for(resource_or_scope) || session[:my_previous_url]\n end", "def after_sign_in_path_for(resource)\n sign_in_url = new_user_session_url\n if request.referer == sign_in_url\n super\n else\n stored_location_for(resource) || request.referer || root_path\n end\n end", "def after_sign_in_path_for(resource_or_scope)\n flash[:notice] = \"\"\n authenticated_root_url\n end", "def redirect_place #returns the place to redirect to based on origin\n if safe_params[:origin] == \"individual\"\n return (tournament_path(@tournament) + '/registration/individual');\n elsif safe_params[:origin] == \"adjudicators\"\n return (tournament_path(params[:id]) + '/control/adjudicators');\n else\n puts(\"Hack ###\");\n redirect_to root_path;\n return;\n end\n end", "def after_sign_in_path_for(resource_or_scope)\n stored_location_for(resource) || online_root_path\n end", "def after_sign_in_path_for(resource_or_scope)\n if resource_or_scope == :user\n dash_user_path(:user)\n elsif resource_or_scope == :admin\n new_admin_session_path\n else\n root_path\n end\n end", "def after_sign_in_path_for(user)\n # CODE FOR CAS LOGIN --> NEW USER\n if ENV['CAS_AUTH'] && current_user && current_user.id.nil? &&\n current_user.username\n # store username in session since there's a request in between\n session[:new_username] = current_user.username\n new_user_path\n else\n super\n end\n end", "def redirect_domain!\n canonical_domain = EnvironmentVariable.value('CANONICAL_DOMAIN')\n return if canonical_domain == nil\n return if request.host == canonical_domain\n redirect_to \"#{request.protocol}#{canonical_domain}#{request.fullpath}\", :status => :moved_permanently\n end", "def after_sign_out_path_for(_)\n if session['saml_uid'] && session['saml_session_index'] && SAML_SETTINGS.idp_slo_service_url\n user_saml_omniauth_authorize_path(locale: nil) + '/spslo'\n else\n super\n end\n end", "def after_sign_in_path_for(resource)\n\n # This tests whether the resque workers are working properly\n # test_resque_workers\n\n # A case-switch statement that sets the appropriate session info and\n # returns the redirect path appropriate to the user role/type\n case current_user.roles.first.name\n when 'admin'\n session[:user_type] = \"admin\"\n users_path\n\n when 'provider'\n session[:user_type] = \"provider\"\n provider_home_path\n\n when 'patient'\n session[:user_type] = \"patient\"\n patient_home_path\n\n else\n super\n end\n end" ]
[ "0.7011853", "0.6853818", "0.6796222", "0.6787892", "0.67426574", "0.6688203", "0.64581573", "0.6443813", "0.642449", "0.63669264", "0.631931", "0.6283086", "0.6258228", "0.6254703", "0.6230609", "0.6215867", "0.6187013", "0.6187013", "0.61580753", "0.6154273", "0.6131496", "0.6116067", "0.61109334", "0.60976774", "0.6094134", "0.60610265", "0.60552806", "0.605513", "0.6026589", "0.60116184", "0.6005862", "0.60045636", "0.6002077", "0.5996664", "0.59851414", "0.5971672", "0.59639716", "0.5961767", "0.59572667", "0.5943623", "0.5939659", "0.59386134", "0.59371185", "0.5926664", "0.5915791", "0.59020233", "0.58959514", "0.58921325", "0.58921057", "0.58795226", "0.5879434", "0.5876295", "0.587435", "0.5870264", "0.5866764", "0.5860231", "0.5854834", "0.58526623", "0.585013", "0.5848307", "0.5848307", "0.5848307", "0.5845169", "0.5845042", "0.5842363", "0.58419937", "0.58343935", "0.5830688", "0.5818253", "0.58122444", "0.5809937", "0.5805679", "0.5800259", "0.5800195", "0.57965034", "0.57951", "0.5790105", "0.5788043", "0.5785539", "0.5773101", "0.577065", "0.57700056", "0.5764072", "0.5762288", "0.5756244", "0.57534057", "0.5752106", "0.5746708", "0.57396805", "0.5735759", "0.57288414", "0.57235855", "0.57217836", "0.57198215", "0.5718352", "0.57169986", "0.5715844", "0.5715759", "0.57151616", "0.5713626" ]
0.6517001
6
continuously store the location, for redirecting after login
def store_location if request.get? && request.format.html? && !request.xhr? && !devise_controller? session[:"user_return_to"] = request.fullpath end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_location\n session[:redirect_after_login] = request.request_uri\n end", "def store_location\n session[:redirect] = request.url\n end", "def store_location\n session[:redirect_path] = request.path\n end", "def store_location\n # store last url - this is needed for post-login redirect to whatever the user last visited.\n return unless request.get? \n if (!request.fullpath.match(\"/users\") &&\n !request.xhr?) # don't store ajax calls\n session[\"user_return_to\"] = request.fullpath\n end\n end", "def store_location!\n session[:\"#{scope}_return_to\"] = attempted_path if request.get? && !http_auth?\n end", "def store_location\n\t # store last url - this is needed for post-login redirect to whatever the user last visited.\n\t if !devise_controller? && !request.xhr? # don't store ajax calls\n\t session[:previous_url] = request.fullpath \n\t end\n\tend", "def store_location\n\t\t# store last url - this is needed for post-login redirect to whatever the user last visited.\n\t\tif (request.fullpath != \"/users/sign_in\" &&\n\t\t\t\trequest.fullpath != \"/users/sign_up\" &&\n\t\t\t\trequest.fullpath != \"/users/password\" &&\n\t\t\t\trequest.fullpath != \"/users/sign_out\" &&\n\t\t\t\trequest.fullpath !~ /\\/users\\/confirmation/i &&\n\t\t\t\t!request.xhr?) # don't store ajax calls\n\t\t\tsession[:previous_url] = request.fullpath\n\t\tend\n\tend", "def store_last_location\r\n session[:return_to] = request.referer unless URI(request.referer).path == \"/passwords\"\r\n end", "def store_location\n store_location_for(:user, params[:redirect_to]) if params[:redirect_to].present?\n\n # note: don't store the previous url on each call. this led to an issue where\n # missing asset might get run through this code, causing the user to be redirected\n # to the missing asset during a login\n # session[:previous_url] = request.url if request.url != new_user_session_url\n end", "def store_location\n\t\tsession[:return_to] = request.url\n\tend", "def store_location\n\t\t\tsession[:return_to] = request.fullpath\n\t end", "def store_location\n # store last url as long as it isn't a /users path\n\tsession[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/ or request.fullpath =~ /\\/json/ or request.fullpath =~ /\\/static/\n\t\n end", "def store_location\n\t\t\tsession[:return_to] = request.fullpath\n\t\tend", "def store_location!\n session[\"return_to\"] = request.env[\"warden.options\"][:attempted_path] if request.get?\n end", "def store_location\n # store last url - this is needed for post-login redirect to whatever the user last visited.\n if (request.path != \"/users/sign_in\" &&\n request.path != \"/users/sign_up\" &&\n request.path != \"/users/password/new\" &&\n request.path != \"/users/password/edit\" &&\n request.path != \"/users/confirmation\" &&\n request.path != \"/users/sign_out\" &&\n !request.fullpath.match(/\\/users\\/auth\\//) &&\n !request.xhr?) # don't store ajax calls\n session[:previous_url] = request.fullpath\n end\n end", "def store_location\n session[:redirect_stack] ||= []\n session[:redirect_stack] << request.fullpath\n end", "def store_location\n session[:return_to] = request.request_uri if not current_user\n end", "def store_location\n session[:redirect_url] = params[:redirect_url] if params[:redirect_url]\n session[:role] = params[:role] if params[:role]\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n # store last url as long as it isn't a /users path\n session[:previous_url] = request.fullpath unless request.fullpath =~ /\\/users/\n end", "def store_location\n\t\tsession[:return_to] = request.fullpath\n\tend", "def store_location\n\t\tsession[:return_to] = request.fullpath\n\tend", "def store_location\n unless controller_name == \"sessions\" || action_name == \"activate\"\n session[:return_to] =\n if request.get?\n request.request_uri\n else\n request.referer\n end\n end\n end", "def store_location\n\n\t\t# Stores the requested page in a session symbol return_to\n\t\tsession[:return_to] = request.url\n\tend", "def store_location\n session[:return_to] = request.uri\n end", "def store_location\n session[:user_return_to] = request.url if request.get? and controller_name != \"sessions\" and controller_name != \"registrations\" and controller_name != \"omniauth_callbacks\"\n end", "def store_location\n\t\t#Store target location (only if request=get). (For example, if user request a page but\n\t\t# it's not signed in. It remembers the request)\n\t\tsession[:return_to] = request.url if request.get?\n\tend", "def store_current_location\n # To redirect to the url user hit before signin.\n store_location_for(:user, request.url)\n # devise handles redirect after sign in using session[:user_return_to]\n # updating redirect url for api\n session[:user_return_to] = params[:redirect_url] if params['redirect_url'].present?\n end", "def store_location\n \n session[:return_to] = request.request_uri\n# Rails.logger.info 'Zomg: ' + session[:return_to]\n end", "def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend", "def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend", "def store_location\n\t\tsession[:return_to] = request.url if request.get?\n\tend", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.url\n end", "def store_location\n #stores location in Session\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n session['user_return_to'] = request.original_url\n end", "def store_location\n session[:return_to] = request.url\n end", "def store_location\n session[:return_to] = request.url\n end", "def store_location\n session[:return_to] = request.url\n end", "def store_location\n session[:return_to] = request.url\n end", "def store_location\n session[:return_to] = request.uri\n end", "def store_location\n session['return-to'] = request.path\n end", "def store_current_location\n Rails.logger.debug \"[AUTHN] CALLED store_current_location\"\n Rails.logger.debug \"[AUTHN] REQUEST URL IS: #{request.url}\"\n store_location_for(:user, request.url) unless ( request.fullpath == \"/login\" || request.fullpath == \"/login_info\" || request.fullpath == \"/go_back\" || request.fullpath == '/logout' || request.fullpath.end_with?('/toggle_highlight') )\n end", "def store_location\n\t\tsession[:forwarding_url]=request.original_url if request.get?\n\tend", "def store_location\n #session[:return_to] = request.request_uri\n session[:return_to] = request.fullpath\n end", "def store_location\n \tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[ :forwarding_url ] = request.original_url if request.get?\n\tend", "def store_location\n \t\tsession[:forwarding_url] = request.original_url if request.get?\n \tend", "def store_location\n if (request.fullpath != \"/users/sign_in\" &&\n request.fullpath != \"/users/sign_up\" &&\n request.fullpath != \"/users/password\" &&\n request.fullpath != \"/users/sign_out\" &&\n !request.xhr? && # don't store ajax calls\n (request.format == \"text/html\" || request.content_type == \"text/html\"))\n session[:return_to] = request.fullpath\n # session[:last_request_time] = Time.now.utc.to_i\n end\n end", "def store_location\n session[:return_to] = request.uri\n end", "def store_location\nsession[:return_to] = request.request_uri\nend", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n @session['return-to'] = @request.request_uri\n end", "def store_location\n session[:return_to] = request.fullpath \n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n if logged_in_from_signup_page\n session[:forwarding_url] = root_path\n else\n session[:forwarding_url] = request.referer\n end\n end", "def store_location\n session[:return_to] = request.original_url\n end", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n\t\tsession[:forwarding_url] = request.original_url if request.get?\n\tend", "def store_location\n session[:return_to] = request.fullpath if request.get? and controller_name != \"user_sessions\" and controller_name != \"sessions\"\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def store_location\n if request.get?\n session[:return_to] = request.url\n end\n end", "def save_last_location\n session[:last_location] = request.env[\"REQUEST_URI\"]\n true\n end", "def store_location\n session[\"return-to\"] = request.fullpath\n end", "def store_location\n session[:return_to] = request.request_uri unless request.request_uri == \"/logout\"\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.fullpath\n end", "def store_location\n session[:return_to] = request.request_uri\n end", "def store_location\n session[:return_to] = request.request_uri\n end", "def store_location\n session[:return_to] = request.request_uri\n end", "def store_location\n session[:return_to] = request.request_uri\n end", "def store_location\n session[:return_to] = request.request_uri\n end", "def store_location\n session[:return_to] = request.request_uri\n end", "def store_location\n session[:return_to] = request.request_uri\n end", "def store_location \n\t\tsession[:forwarding_url] = request.url if request.get?\n\tend", "def store_location\n if ((!request.fullpath.match(\"/users\") && !request.fullpath.match(\"/admin\") && !request.fullpath.match(\"/admin/login\")) &&\n !request.xhr?) # don't store ajax calls\n# puts \"----------------------------\"\n# puts \"--not store--\"\n session[:previous_url] = request.fullpath\n else\n# puts \"----------------------------\"\n# puts \"--store--\"\n end\n end", "def save_location\n session[:return_to] = request.request_uri\n end", "def save_location\n session[:return_to] = request.request_uri\n end", "def store_location\n # session[:forwarding_url] = request.url if request.get?\n user_session[:forwarding_url] = request.referer if request.get? && request.referer\n end", "def store_location # => a.k.a. store_location\n\t\tsession[:return_to] = request.url if request.get? #request is a special object that gets the URL of the requested page.\n\tend", "def store_location # => a.k.a. store_location\n\t\tsession[:return_to] = request.url if request.get? #request is a special object that gets the URL of the requested page.\n\tend", "def store_location\n session[:return_to] = request.request_uri\n end", "def store_location\n session[:return_to] = request.request_uri\n end" ]
[ "0.813832", "0.80018675", "0.7855478", "0.7767238", "0.7731841", "0.76595783", "0.76313734", "0.7618655", "0.7618125", "0.75935334", "0.75348276", "0.7532169", "0.7530031", "0.75239414", "0.7518145", "0.74875134", "0.7485756", "0.74762434", "0.7448181", "0.7448181", "0.7448181", "0.7448181", "0.7448181", "0.7448181", "0.7448087", "0.7448087", "0.74371237", "0.7435316", "0.74278116", "0.7416371", "0.74028254", "0.7395", "0.73877436", "0.7384576", "0.7384576", "0.7384576", "0.738242", "0.73611504", "0.7357647", "0.73402196", "0.73272645", "0.73272645", "0.73272645", "0.73272645", "0.73129153", "0.73008245", "0.7297531", "0.729161", "0.727669", "0.7275481", "0.7271421", "0.72705215", "0.72657675", "0.7259492", "0.7257716", "0.7253474", "0.7253474", "0.7253474", "0.7253474", "0.7241913", "0.72393686", "0.723873", "0.72310585", "0.722216", "0.72189283", "0.72189283", "0.72189283", "0.72189283", "0.721608", "0.7215207", "0.7215207", "0.7215207", "0.7215207", "0.72128093", "0.7209043", "0.72075564", "0.7207508", "0.7207508", "0.7207508", "0.7207508", "0.7207508", "0.7207508", "0.7207508", "0.7207508", "0.7207508", "0.7203714", "0.7203714", "0.7203714", "0.7203714", "0.7203714", "0.7203714", "0.7203714", "0.7192396", "0.71909773", "0.71905583", "0.71905583", "0.7182556", "0.71756715", "0.71756715", "0.717197", "0.717197" ]
0.0
-1
A method to convert an openlayersformat bbox string into an rgeo bbox object
def bbox_from_string(string, factory) return unless string minlon, minlat, maxlon, maxlat = string.split(',').collect { |i| i.to_f } bbox = RGeo::Cartesian::BoundingBox.new(factory) bbox.add(factory.point(minlon, minlat)).add(factory.point(maxlon, maxlat)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_bbox(left, bottom, right, top)\n raise TypeError.new('\"left\" value needs to be a number between -180 and 180') unless(left.kind_of?(Float) && left >= -180 && left <= 180)\n raise TypeError.new('\"bottom\" value needs to be a number between -90 and 90') unless(bottom.kind_of?(Float) && bottom >= -90 && bottom <= 90)\n raise TypeError.new('\"right\" value needs to be a number between -180 and 180') unless(right.kind_of?(Float) && right >= -180 && right <= 180)\n raise TypeError.new('\"top\" value needs to be a number between -90 and 90') unless(top.kind_of?(Float) && top >= -90 && top <= 90)\n response = get(\"map?bbox=#{left},#{bottom},#{right},#{top}\")\n check_response_codes(response)\n db = OSM::Database.new\n parser = OSM::StreamParser.new(:string => response.body, :db => db)\n parser.parse\n db\n end", "def bounding_box\n obj = factory.parse_wkt(geometry_as_wkt)\n\n # Get the minimum bounding box for the geometry as a Polygon\n bbox = obj.envelope\n\n # Return as wsen string\n minx = bbox.coordinates[0][0][0]\n miny = bbox.coordinates[0][0][1]\n maxx = bbox.coordinates[0][1][0]\n maxy = bbox.coordinates[0][2][1]\n \"#{minx}, #{miny}, #{maxx}, #{maxy}\"\n rescue RGeo::Error::ParseError\n Geoblacklight.logger.warn \"Error parsing geometry: #{geom}\"\n default_extent\n end", "def bbox_formatter(bbox, output_format)\n coords_array = bbox.split(' ').map(&:to_f)\n min_x = coords_array[0]\n min_y = coords_array[1]\n max_x = coords_array[2]\n max_y = coords_array[3]\n case output_format\n when 'wkt_array' # used for geojson bounding box\n if min_x > max_x\n min_x, max_x = bbox_dateline_fix(min_x, max_x)\n end\n coords_to_wkt_polygon(min_x, min_y, max_x, max_y)\n when 'wkt_envelope' # used for subject_bbox_geospatial field\n coords = normalize_bbox(min_x, min_y, max_x, max_y)\n \"ENVELOPE(#{coords[0]}, #{coords[2]}, #{coords[3]}, #{coords[1]})\"\n when 'wkt_polygon' # may need if we use Solr JTS for _geospatial field\n wkt_polygon = coords_to_wkt_polygon(min_x, min_y, max_x, max_y)\n wkt_order_strings = wkt_polygon.map { |coords| \"#{coords[0]} #{coords[1]}\" }\n \"POLYGON((#{wkt_order_strings.join(', ')}))\"\n else\n Rails.logger.error(\"UNSUPPORTED BBOX OUTPUT REQUESTED: '#{output_format}'\")\n end\n end", "def from_geometry(geometry)\n r_bb = RGeo::Cartesian::BoundingBox.create_from_geometry(geometry)\n \"bbox:#{r_bb.min_y},#{r_bb.min_x},#{r_bb.max_y},#{r_bb.max_x}\"\n end", "def simple_bbox\n\t\t\tutm = self.to_utm\n\t\t\tsize = 10**(5-@precision)\n\n\t\t\tminx = utm.easting\n\t\t\tminy = utm.northing\n\n\t\t\tmaxx = minx + size\n\t\t\tmaxy = miny + size\n\n\t\t\tsrid=26900 + @utm_zone\n\t\t\t# ex. POLYGON((654000 5191000,654000 5192000,655000 5192000,655000 5191000,654000 5191000))\n\t\t\t\"SRID=#{srid};POLYGON((#{minx} #{miny}, #{minx} #{maxy}, #{maxx} #{maxy}, #{maxx} #{miny}, #{minx} #{miny}))\"\n\t\tend", "def format_bbox(box)\n box.values.each_slice(2).to_a\n end", "def bbox\n @bbox ||= @attributes['fontbbox'].split(/\\s+/).map { |e| Integer(e) }\n end", "def bbox(args = {})\n name = args.delete(:name) || nil\n if args[:reload]\n @bbox = BBox.new(self, name)\n else\n @bbox ||= BBox.new(self, name)\n end\n end", "def bbox\n envelope = GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(extent).envelope #TODO: replace with rgeo\n [envelope.lower_corner.x, envelope.lower_corner.y, envelope.upper_corner.x, envelope.upper_corner.y]\n end", "def bbox\n minx = start_longitude_dec.present? ? start_longitude_dec.to_f : nil\n miny = start_latitude_dec.present? ? start_latitude_dec.to_f : nil\n maxx = end_longitude_dec.present? ? end_longitude_dec.to_f : minx\n maxy = end_latitude_dec.present? ? end_latitude_dec.to_f : miny\n lats = [miny, maxy].sort\n lngs = [minx, maxx].sort\n [lngs[0], lats[0], lngs[1], lats[1]]\n end", "def bbox\n BoundingBox.new(x, y, x, y)\n end", "def from_quad_tree_to_bbox(qt)\n bounds = from_quad_tree_to_lat_lng_bounds(qt)\n\n {\n :s => bounds[0],\n :w => bounds[1],\n :n => bounds[2],\n :e => bounds[3]\n }\n end", "def build_bounding_box(bounding_box)\n \"#{bounding_box[:sw_latitude]},#{bounding_box[:sw_longitude]}|#{bounding_box[:ne_latitude]},#{bounding_box[:ne_longitude]}\"\n end", "def bounding_box\n return @bounding_box if @bounding_box\n @bounding_box = format_bounding @declares[\"HiResBoundingBox\"] || @declares[\"BoundingBox\"]\n end", "def add_bbox(bbox)\n @north = [@north, bbox[\"north\"]].max\n @south = [@south, bbox[\"south\"]].min\n # we don't know whether to add the other_bbox \"to the left\"\n # or \"to the right\". So we do three and choose whichever has a\n # smaller result (by side length). The three are: as is, moved\n # right by 360 degrees and moved left by 360 degrees.\n other_east = bbox[\"east\"]\n other_west = bbox[\"west\"]\n if other_east < other_west\n other_east += 360\n end\n @east, @west = optimize_east_west_add(other_east, other_west)\n normalize\n end", "def replace_bbox(data)\n regex = /(id='word_\\d+')\\s(title=\"\\w{4}\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\")/\n data.gsub(regex) {\"#{$1} style='left: #{$3.to_i/5}px\\; top: #{$4.to_i/5}px\\;'\"}\n end", "def box2d_to_bbox(box2d)\n return [] if !box2d\n result = []\n box2d.scan(/BOX\\(([\\d\\.]+) ([\\d\\.]+),([\\d\\.]+) ([\\d\\.]+)\\)/).each do |m|\n result << m.map(&:to_f)\n end\n result.uniq\n end", "def box2d_to_bbox(box2d)\n return [] if !box2d\n result = []\n box2d.scan(/BOX\\(([\\d\\.]+) ([\\d\\.]+),([\\d\\.]+) ([\\d\\.]+)\\)/).each do |m|\n result << m.map(&:to_f)\n end\n result.uniq\n end", "def test_bbox_span_equator\n\n hIn = @@aIn[6]\n hTest = Marshal::load(Marshal.dump(hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n aInternal = @@NameSpace.unpack(hTest, hResponse)\n metadata = aInternal[:computedBbox]\n\n assert_equal 4, metadata.length\n assert_equal -179.0, metadata[:westLongitude]\n assert_equal -65.0, metadata[:southLatitude]\n assert_equal -48.0, metadata[:eastLongitude]\n assert_equal 62.45, metadata[:northLatitude]\n\n end", "def bounding_box_geojson\n return nil unless bounding_box\n {\n type: \"Polygon\",\n coordinates: [\n [\n [swlng.to_f, swlat.to_f],\n [swlng.to_f, nelat.to_f],\n [nelng.to_f, nelat.to_f],\n [nelng.to_f, swlat.to_f],\n [swlng.to_f, swlat.to_f]\n ]\n ]\n }\n end", "def test_bbox_more_west\n\n hIn = @@aIn[3]\n hTest = Marshal::load(Marshal.dump(hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n aInternal = @@NameSpace.unpack(hTest, hResponse)\n metadata = aInternal[:computedBbox]\n\n assert_equal 4, metadata.length\n assert_equal 178.0, metadata[:westLongitude]\n assert_equal 61.0, metadata[:southLatitude]\n assert_equal -150.0, metadata[:eastLongitude]\n assert_equal 65.0, metadata[:northLatitude]\n\n end", "def bounding_box\n north_east = @data['bounds']['northeast']\n south_west = @data['bounds']['southwest']\n \n [north_east['lat'], north_east['lng'], south_west['lat'], south_west['lng']]\n end", "def test_bbox_span_meridian\n\n hIn = @@aIn[4]\n hTest = Marshal::load(Marshal.dump(hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n aInternal = @@NameSpace.unpack(hTest, hResponse)\n metadata = aInternal[:computedBbox]\n\n assert_equal 4, metadata.length\n assert_equal -35.0, metadata[:westLongitude]\n assert_equal 61.0, metadata[:southLatitude]\n assert_equal 48.0, metadata[:eastLongitude]\n assert_equal 65.0, metadata[:northLatitude]\n\n end", "def parse_wkb(value)\n first_ring_offset = (2 * UINT32_BYTESIZE) + 1\n ring_count = to_uint32(value[first_ring_offset, UINT32_BYTESIZE])\n offset = (3 * UINT32_BYTESIZE) + 1\n\n rings = ring_count.times.map do\n start = offset + UINT32_BYTESIZE\n point_count = to_uint32(value[offset...start])\n offset = (2 * DOUBLE_BYTESIZE * point_count) + start\n\n points = value[start...offset].unpack(\"#{DOUBLE_PACKFLAG}*\")\n points.each_slice(2).with_object([]) do |(lon, lat), memo|\n memo << Spatial::Point.new(lat, lon)\n end\n end\n\n Spatial::Polygon.new(rings)\n end", "def deserialize(value)\n if value.respond_to?(:to_wkt)\n value\n elsif value\n MySQLPoint::Coordinate.from_wkb(value[4..-1])\n end\n end", "def test_whichways_toobig\n bbox = [-0.1, -0.1, 1.1, 1.1]\n check_bboxes_are_bad [bbox] do |map, _bbox|\n assert_boundary_error map, \" The server said: The maximum bbox size is 0.25, and your request was too large. Either request a smaller area, or use planet.osm\"\n end\n end", "def test_bbox_more_east\n\n hIn = @@aIn[2]\n hTest = Marshal::load(Marshal.dump(hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n aInternal = @@NameSpace.unpack(hTest, hResponse)\n metadata = aInternal[:computedBbox]\n\n assert_equal 4, metadata.length\n assert_equal 148.0, metadata[:westLongitude]\n assert_equal 61.0, metadata[:southLatitude]\n assert_equal -177.0, metadata[:eastLongitude]\n assert_equal 65.0, metadata[:northLatitude]\n\n end", "def parse(geojson, opts={})\n return nil if geojson.nil? || geojson.try(:empty?)\n geojson_hash = geojson.is_a?(Hash) ? geojson : JSON.parse(geojson)\n decoded_geojson = RGeo::GeoJSON.decode(geojson_hash)\n decoded_geojson = decoded_geojson.first if decoded_geojson.is_a? Enumerable\n opts.fetch(:to, :geometry) == :wkt ? decoded_geojson.try(:geometry).try(:as_text) : decoded_geojson.try(:geometry)\n end", "def parse_wkt(string)\n value, srid = string.split(\",\")\n @srid = srid if srid.present?\n # factory = factory_settings.get_column_factory(table_name, column, constraints)\n factory = @factory_generator || RGeo::ActiveRecord::RGeoFactorySettings.new\n wkt_parser(factory, value).parse(value)\n rescue RGeo::Error::ParseError\n nil\n end", "def parse(ewkb)\r\n @factory.reset\r\n @unpack_structure=UnpackStructure::new(ewkb)\r\n @with_z = false\r\n @with_m = false\r\n parse_geometry\r\n @unpack_structure.done\r\n @srid=nil\r\n end", "def bbox(key)\n position = pdf_field(key).getWidgets().get(0).getRectangle()\n bbox = BoundingBox.new(position.getAsNumber(0).getValue(),\n position.getAsNumber(1).getValue(),\n position.getAsNumber(2).getValue() - position.getAsNumber(0).getValue(),\n height = position.getAsNumber(3).getValue() - position.getAsNumber(1).getValue()\n )\n return bbox\n end", "def to_bounding_box\n [[west, south], [east, north]] if @envelope.present?\n end", "def bbox(index)\n list(tk_send_without_enc('bbox', _get_eval_enc_str(index)))\n end", "def test_bbox_west\n\n hIn = @@aIn[1]\n hTest = Marshal::load(Marshal.dump(hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n aInternal = @@NameSpace.unpack(hTest, hResponse)\n metadata = aInternal[:computedBbox]\n\n assert_equal 4, metadata.length\n assert_equal -179.0, metadata[:westLongitude]\n assert_equal 61.0, metadata[:southLatitude]\n assert_equal -48.0, metadata[:eastLongitude]\n assert_equal 65.0, metadata[:northLatitude]\n\n end", "def localize_entity_bounding_box(entity, target)\n return entity.bounding_box if target.position.zero? && target.orientation.zero?\n\n # \"tranform\" entity bounding box into target's space\n local = target.position # needs tweaking, works well enough for now\n box = entity.bounding_box.clone\n box.min -= local\n box.max -= local\n\n box\n end", "def convert_google_to_baidu(lng, lat)\n url = 'http://api.map.baidu.com/ag/coord/convert?from=2&to=4&x=' + lng.to_s + '&y=' + lat.to_s\n decoded = call_api(url)\n ret = {}\n\n if decoded['error'] == 0 then\n ret['lng'] = Base64.decode64(decoded['x'])\n ret['lat'] = Base64.decode64(decoded['y'])\n end\n\n return ret\nend", "def bounding_box\r\n unless with_z\r\n @rings[0].bounding_box\r\n else\r\n result = @rings[0].bounding_box #valid for x and y\r\n max_z, min_z = result[1].z, result[0].z\r\n 1.upto(size - 1) do |index|\r\n bbox = @rings[index].bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n max_z = ne.z if ne.z > max_z\r\n min_z = sw.z if sw.z < min_z \r\n end\r\n result[1].z, result[0].z = max_z, min_z\r\n result\r\n end\r\n end", "def bounding_rectangle(string, angle = 0.0)\n data = draw(nil, 0, 0, angle, string, 0)\n\n #if string.length == 1\n # # gd annoyingly fails to provide xshow data for strings of length 1\n # position = draw(nil, 0, 0, angle, string + ' ', 0)[:position]\n # data[:position] = position[0...-1]\n #end\n\n data\n end", "def marshal_load(s)\n# Unpack coords from unmarshaled string\n@coords = s.unpack(\"w*\") # and use them to initialize the object\nend", "def test_bbox_east\n\n hIn = @@aIn[0]\n hTest = Marshal::load(Marshal.dump(hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n aInternal = @@NameSpace.unpack(hTest, hResponse)\n metadata = aInternal[:computedBbox]\n\n assert_equal 4, metadata.length\n assert_equal 100.0, metadata[:westLongitude]\n assert_equal 0.0, metadata[:southLatitude]\n assert_equal 105.0, metadata[:eastLongitude]\n assert_equal 3.0, metadata[:northLatitude]\n\n end", "def bounding_box(lat, lon, radius_meters)\n radius_meters = radius_meters.to_f\n delta_lat = radius_meters / DEG_LAT_IN_METERS\n delta_lon = radius_meters / (DEG_LAT_IN_METERS * Math.cos(lat * DEG_TO_RAD))\n [\n lat - delta_lat,\n lon - delta_lon,\n lat + delta_lat,\n lon + delta_lon\n ]\n end", "def bounding_box\n unless @bbox\n p = @points[0]\n minX = p[0]\n maxX = p[0]\n minY = p[1]\n maxY = p[1]\n minZ = p[2]\n maxZ = p[2]\n @points.each{|p|\n minX = p[0] if p[0] < minX \n maxX = p[0] if p[0] > maxX \n minY = p[1] if p[1] < minY \n maxY = p[1] if p[1] > maxY \n minZ = p[2] if p[2] < minZ \n maxZ = p[2] if p[2] > maxZ \n }\n @max = Vector[maxX, maxY,maxZ]\n @min = Vector[minX, minY, minZ]\n @bbox = Volume.new([Plane.new(-1,0,0, minX, minY, minZ), \n Plane.new(0,-1,0, minX, minY, minZ),\n Plane.new(0,0,-1, minX, minY, minZ),\n Plane.new(1,0,0, maxX, maxY, maxZ),\n Plane.new(0,1,0, maxX, maxY, maxZ), \n Plane.new(0,0,1, maxX, maxY, maxZ)])\n end\n @bbox\n end", "def find_geolocation_by_box(object_params)\n n_lat, e_long, s_lat, w_long = coordinates_from(object_params)\n boxes = GeolocationBox\n .only_geo_bbox(params[:resource_id])\n .where(ne_latitude: n_lat, ne_longitude: e_long, sw_latitude: s_lat, sw_longitude: w_long)\n return nil if boxes.empty?\n\n boxes.first.geolocation\n end", "def decode(binary); ::BSON.deserialize(binary); end", "def bounding_box\n Cuboid.new @vbuffer.buffer.min(1).to_a, @vbuffer.buffer.max(1).to_a\n end", "def process(ogc_filter)\n cmr_query_hash = {}\n cmr_bounding_box_param = ISO_QUERYABLES_TO_CMR_QUERYABLES[\"BoundingBox\"][1]\n bounding_box = ogc_filter.xpath('//ogc:PropertyName[contains(text(), \"BoundingBox\")]', 'ogc' => 'http://www.opengis.net/ogc')\n if (bounding_box != nil && bounding_box[0] != nil)\n bounding_box_envelope_node = bounding_box[0].next_element\n if (bounding_box_envelope_node != nil)\n iso_bounding_box = IsoBoundingBox.new(bounding_box_envelope_node)\n if(iso_bounding_box.valid?)\n # the cmr bounding_box only supports a single value and not an array\n cmr_query_hash[\"#{@@CMR_BOUNDINGBOX_PARAM}\"] = iso_bounding_box.to_cmr\n else\n error_message = \"not in the supported ISO format. #{iso_bounding_box.errors.full_messages.to_s}\"\n Rails.logger.error(error_message)\n raise OwsException.new('BoundingBox', error_message)\n end\n end\n end\n cmr_query_hash\n end", "def bounding_box(country)\n\t\tcase country\n\t\twhen :haiti\n\t\t\treturn [[-74.5532226563,17.8794313865], [-71.7297363281,19.9888363024]]\n\t\twhen :philippines\n\t\t\treturn [120.0805664063,9.3840321096], [126.6064453125,13.9447299749]\n\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend", "def boundingBoxReal _args\n \"boundingBoxReal _args;\" \n end", "def bounding_box\r\n end", "def bounds\n @bounding_box\n end", "def bounding_box\n r = @radius\n bottom_left = Point[@centre.x - r, @centre.y - r]\n top_right = Point[@centre.x + r, @centre.y + r]\n [bottom_left, top_right]\n end", "def bounding_box\r\n max_x, min_x, max_y, min_y = -Float::MAX, Float::MAX, -Float::MAX, Float::MAX, -Float::MAX, Float::MAX \r\n if with_z\r\n max_z, min_z = -Float::MAX, Float::MAX\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n max_z = ne.z if ne.z > max_z\r\n min_z = sw.z if sw.z < min_z \r\n end\r\n [Point.from_x_y_z(min_x,min_y,min_z),Point.from_x_y_z(max_x,max_y,max_z)]\r\n else\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n end\r\n [Point.from_x_y(min_x,min_y),Point.from_x_y(max_x,max_y)]\r\n end\r\n end", "def bounding_box(distance, radius = R)\n\t\t\traise ArgumentError.new(\"Invalid distance or radius\") if distance < 0 or radius < 0\n\n\t\t\t# angular distance in radians on a great circle\n\t\t\tangular_distance = distance / radius\n\n\t\t\tmin_latitude = (self.latitude * D2R) - angular_distance\n\t\t\tmax_latitude = (self.latitude * D2R) + angular_distance\n\n\t\t\tif min_latitude > MIN_LATITUDE and max_latitude < MAX_LATITUDE\n\t\t\t\tlongitude_delta = Math::asin(Math::sin(angular_distance) / Math::cos(self.latitude * D2R))\n\t\t\t\t\n\t\t\t\tmin_longitude = (self.longitude * D2R) - longitude_delta\n\t\t\t\tmin_longitude += 2.0 * Math::PI if (min_longitude < MIN_LONGITUDE)\n\t\t\t\t\n\t\t\t\tmax_longitude = (self.longitude * D2R) + longitude_delta;\n\t\t\t\tmax_longitude -= 2.0 * Math::PI if (max_longitude > MAX_LONGITUDE)\n\t\t\telse\n\t\t\t\t# a pole is within the distance\n\t\t\t\tmin_latitude = [min_latitude, MIN_LATITUDE].max\n\t\t\t\tmax_latitude = [max_latitude, MAX_LATITUDE].min\n\t\t\t\t\n\t\t\t\tmin_longitude = MIN_LONGITUDE\n\t\t\t\tmax_longitude = MAX_LONGITUDE\n\t\t\tend\n\t\t\t\n\t\t\treturn {\n\t\t\t\t:latitude => Range.new(min_latitude * R2D, max_latitude * R2D),\n\t\t\t\t:longitude => Range.new(min_longitude * R2D, max_longitude * R2D),\n\t\t\t}\n\t\tend", "def normalize_bbox(min_x, min_y, max_x, max_y)\n min_x = (min_x + 360) if min_x < -180\n min_y = -90.0 if min_y < -90\n max_x = (max_x - 360) if max_x > 180\n max_y = 90.0 if max_y > 90\n [min_x, min_y, max_x, max_y]\n end", "def convert_br(el)\r\n end", "def _db_parse_jsonb(s)\n _wrap_jsonb(_parse_json(s))\n rescue Sequel::InvalidValue\n raise unless s.is_a?(String)\n _wrap_jsonb(_parse_json(\"[#{s}]\").first)\n end", "def geometry\n\t\tmongo_format[\"$box\"].flatten\n\tend", "def from_bencode\n BEncode.load(self)\n end", "def test_bbox_southern_hemisphere\n\n hIn = @@aIn[5]\n hTest = Marshal::load(Marshal.dump(hIn))\n hResponse = Marshal::load(Marshal.dump(@@responseObj))\n aInternal = @@NameSpace.unpack(hTest, hResponse)\n metadata = aInternal[:computedBbox]\n\n assert_equal 4, metadata.length\n assert_equal -179.0, metadata[:westLongitude]\n assert_equal -65.0, metadata[:southLatitude]\n assert_equal -48.0, metadata[:eastLongitude]\n assert_equal -61.0, metadata[:northLatitude]\n\n end", "def html_to_bbcode(string); end", "def as_wkb\r\n as_ewkb(false,false,false)\r\n end", "def set_BoundingBox(value)\n set_input(\"BoundingBox\", value)\n end", "def set_BoundingBox(value)\n set_input(\"BoundingBox\", value)\n end", "def decode_b(str)\n str.gsub!(/=\\?ISO-2022-JP\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/=\\?SHIFT_JIS\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/\\n/, ' ') \n str.gsub!(/\\0/, '')\n str\n end", "def bounding_box \r\n if @cached_bounding_box\r\n @cached_bounding_box.x = self.x + @_x_diff\r\n @cached_bounding_box.y = self.y + @_y_diff\r\n \r\n return @cached_bounding_box\r\n end\r\n \r\n width, height = self.size\r\n \r\n if scale = trait_options[:bounding_box][:scale]\r\n width_scale, height_scale = scale.is_a?(Array) ? [scale[0],scale[1]] : [scale,scale]\r\n width *= width_scale\r\n height *= height_scale\r\n end\r\n \r\n x = self.x - width * self.center_x\r\n y = self.y - height * self.center_y\r\n x += width * CENTER_TO_FACTOR[self.center_x] if self.factor_x < 0\r\n y += height * CENTER_TO_FACTOR[self.center_y] if self.factor_y < 0\r\n\r\n return Rect.new(x, y, width, height)\r\n end", "def search_within(bounding_box, query, offset = 0, limit = 5, language = 'english')\n if bounding_box[:sw][:latitude]\n many.search_within(query, language, limit, offset, bounding_box[:sw][:latitude], bounding_box[:sw][:longitude], bounding_box[:ne][:latitude], bounding_box[:ne][:longitude]).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n else\n many.search(query, language, limit, offset).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n end\n end", "def parse_box(key, box)\n if box.kind_of?(String)\n begin\n raw_box = box.split(\",\").map(&:to_f)\n box = [[raw_box[0], raw_box[1]], [raw_box[2], raw_box[3]]]\n rescue\n raise_error(type: \"box.format\", key: \"key\", value: box)\n end\n end\n return box\n end", "def bounding_box\n Rectangle[position, Point[@image.width, @image.height]]\n end", "def bgnstr() @records.get_data(GRT_BGNSTR); end", "def bbpFromSize(size)\n\n bbp(size.width, size.height)\n end", "def parse_wkt(string)\n wkt_parser(string).parse(string)\n rescue RGeo::Error::ParseError\n nil\n end", "def bounds=(bounding_box)\n @bounding_box = bounding_box\n end", "def get_cells_in_area(bbox, options = {})\n raise ArgumentError, 'options must be a Hash' unless options.is_a? Hash\n raise ArgumentError, 'bbox must be of type BBox' unless bbox.is_a? BBox\n params = {bbox: bbox.to_s, fmt: 'xml'}\n params.merge!(options.reject { |key| !GET_IN_AREA_ALLOWED_PARAMS.include? key})\n exec_req_and_parse_response '/cell/getInArea', params\n end", "def in_bounding_box?(point, box)\n if point.lon > box.west_lon and point.lon < box.east_lon and point.lat < box.north_lat and point.lat > box.south_lat\n return true\n else\n return false \n end\n end", "def bounds(shape)\n check_pre((\n (shape?(shape))\n ))\n\n if comp_shape?(shape)\n b1 = bounds(shape.left)\n b2 = bounds(shape.right)\n\n return bounding_range(b1, b2)\n elsif prim_shape?(shape)\n return shape\n else\n check_pre(false)\n end\nend", "def de_format_locations(string)\n # lat => '45.5192172',\n # long => '-122.6755683',\n # radius => 0.1,\n # look for locations\n loc.each do |k|\n sp = k.split('point_radius:')\n end\n string\n end", "def test_whichways_badlon\n bboxes = [[80, -0.1, 70, 0.1], [54.35, 0.24, 54.33, 0.25]]\n check_bboxes_are_bad bboxes do |map, bbox|\n assert_boundary_error map, \" The server said: The minimum longitude must be less than the maximum longitude, but it wasn't\", bbox.inspect\n end\n end", "def to_cpbb\n\t\treturn CP::BB.new(self.left, self.bottom, self.right, self.top)\n\tend", "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 cast(value)\n if value.respond_to?(:to_wkt)\n value\n elsif value\n MySQLPoint::Coordinate.from_wkt(value)\n end\n end", "def data(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all\n end", "def typecast_value_jsonb(value)\n case value\n when JSONBObject\n value\n when String\n if typecast_json_strings\n JSONBString.new(value)\n else\n _wrap_jsonb(_parse_json(value))\n end\n when *JSON_WRAP_CLASSES\n JSONDatabaseMethods.jsonb_primitive_wrapper(value).new(value)\n when JSONObject\n value = value.__getobj__\n JSONDatabaseMethods.jsonb_primitive_wrapper(value).new(value)\n else\n raise Sequel::InvalidValue, \"invalid value for jsonb: #{value.inspect}\"\n end\n end", "def locations_within_bounding_box(sw_latitude, sw_longitude, ne_latitude, ne_longitude)\n uri_params = { swLat: sw_latitude, swLon: sw_longitude, neLat: ne_latitude, neLon: ne_longitude }\n @client.get('/BikePoint', uri_params)\n end", "def bbox(index)\n execute(:bbox, index).to_a(&:to_i)\n end", "def str2bin(message)\n binary = message.unpack(\"B*\")[0]\n return binary\nend", "def decode_bitstring(bitstring, interval_bound)\n @coord = 0.0\n interval = (-interval_bound .. interval_bound)\n mean = interval.min + (((interval.max) - (interval.min)) / 2.0)\n mini = interval.min\n maxi = interval.max\n bitstring.each_char do |c|\n if c.to_f == 1\n interval = (mean .. maxi)\n mini = mean\n mean = interval.min + (((interval.max) - (interval.min)) / 2.0)\n maxi = interval.max\n else \n interval = (mini .. mean)\n maxi = mean\n mean = interval.min + (((interval.max) - (interval.min)) / 2.0)\n mini = interval.min\n end\n end\n @coord = mean\n return @coord\n end", "def getEntitySearchByboundingbox( latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/byboundingbox\",params)\n end", "def bb\n @bb ||= calculate_bb.to_s(16)\n end", "def decode_blob blob\n if not String === blob\n raise ArgumentError, 'Blob should be a string'\n end\n\n if blob[0, 4] != 'TFBB'\n raise ArgumentError, 'Blob doesn\\'t seem to be base64 encoded'\n end\n\n decode_base64 blob\n end", "def test_standard_to_rubygems_beta\n value_ = ::Versionomy.parse('1.2b3')\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 'b', 3, 0, 0, 0, 0], value2_.values_array)\n value_ = ::Versionomy.parse('1.2 beta 3.4')\n value2_ = value_.convert(:rubygems)\n assert_equal([1, 2, 'beta', 3, 4, 0, 0, 0], value2_.values_array)\n end", "def boundary\n @raw.split(\"boundary=\")[1].split(\"\\n\")[0]\n end", "def bbox_dateline_fix(min_x, max_x)\n if min_x > 0\n degrees_to_add = 180 - min_x\n min_x = -(180 + degrees_to_add)\n elsif min_x < 0 && max_x < 0\n degrees_to_add = 180 + max_x\n max_x = 180 + degrees_to_add\n else\n Rails.logger.error(\"This bbox format was not parsed correctly: '#{coords}'\")\n end\n [min_x, max_x]\n end", "def rectangle_zone(top_left_lat, top_left_lon,\n bottom_right_lat, bottom_right_lon,\n map_zoom, options = {})\n url = 'http://api.openweathermap.org/data/2.5/box/city'\n bbox = encode_array [top_left_lat, top_left_lon, bottom_right_lat,\n bottom_right_lon, map_zoom]\n new(options.merge(bbox: bbox)).retrieve url\n end", "def valid_geometry?(solr_geom)\n return false unless solr_geom.present?\n\n # :solr_geom => \"ENVELOPE(#{w}, #{e}, #{n}, #{s})\",\n # Solr docs say: \"minX, maxX, maxY, minY order\"\n # maximum boundary: (minX=-180.0,maxX=180.0,minY=-90.0,maxY=90.0)\n match = solr_geom.match(/ENVELOPE\\(([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)[\\ \\,]*([\\d\\.\\-]+)\\)/)\n\n # Not parsable ENVELOPE() syntax?\n return false unless match.present?\n\n minX, maxX, maxY, minY = match.captures\n return false if minX.to_f < -180 ||\n maxX.to_f > 180 ||\n maxY.to_f > 90 ||\n minY.to_f < -90\n\n return true\nend", "def parse_multipart_boundary(ctype)\n MultipartParser::Reader.extract_boundary_value(ctype)\n end", "def is_bgnstr?(); @type == GRT_BGNSTR; end", "def parse_geom(lat, lon)\n @lat, @lon = lat.to_f, lon.to_f\n\n if defined? GeoRuby\n @geom = GeoRuby::SimpleFeatures::Point.from_x_y(@lon, @lat)\n else\n { lat: @lat, lon: @lon }\n end\n end", "def decode_body(str)\n @serializer.decode(str)\n end", "def decode_body(str)\n @serializer.decode(str)\n end", "def parse_mailbox_list(str, opt={})\n mailbox_list(str, opt)\n end" ]
[ "0.60862356", "0.6003337", "0.58920217", "0.5798198", "0.5747368", "0.57424223", "0.57411665", "0.5593428", "0.55598086", "0.55468273", "0.5448083", "0.5251661", "0.5244827", "0.52320683", "0.51605576", "0.51529425", "0.5119328", "0.5119328", "0.5106917", "0.5088977", "0.5013665", "0.5013018", "0.4977642", "0.49568677", "0.49335265", "0.49157673", "0.49044484", "0.4890593", "0.4882808", "0.48611927", "0.4821313", "0.48116097", "0.47654077", "0.47206753", "0.47146297", "0.47018674", "0.4668304", "0.46206832", "0.46032208", "0.45991734", "0.45727307", "0.4571549", "0.451423", "0.4485919", "0.44839317", "0.44668955", "0.44535646", "0.44333497", "0.44216138", "0.4408344", "0.43926182", "0.43731278", "0.4372599", "0.43690252", "0.43669853", "0.43608773", "0.43583396", "0.43513072", "0.4342834", "0.4341276", "0.43348157", "0.43270338", "0.43270338", "0.43220875", "0.4318925", "0.42906097", "0.42856872", "0.4282454", "0.42704424", "0.42443186", "0.4242671", "0.421634", "0.41939935", "0.41932765", "0.41859266", "0.41778132", "0.41747516", "0.416422", "0.41617274", "0.41519418", "0.4151242", "0.41466877", "0.4145235", "0.41426137", "0.41409376", "0.4137749", "0.41291568", "0.41230452", "0.4108549", "0.40995315", "0.40984446", "0.40921763", "0.40882713", "0.4086768", "0.4078829", "0.4076982", "0.40767992", "0.40651557", "0.40651557", "0.40524843" ]
0.6811537
0
Formatting grabbed from ruby stdlib
def timestamp_with_usec time = Time.now time.strftime('%Y-%m-%dT%H:%M:%S.') + format('%06d ', time.usec) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formats; end", "def formats; end", "def format(text); end", "def formatters; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def formatting\n return \"\\e[0;32m%c/%C |%b>%i| %e\\e[0m\"\n end", "def formatter; end", "def formatter; end", "def formatter; end", "def format(fmt, *rest) end", "def format; :n3; end", "def format_source(source); end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def format=(_arg0); end", "def os_fmt\n '%s'\n end", "def printf(format)\n end", "def _process_format(format); end", "def _process_format(format); end", "def format(format, *arguments); end", "def format!; end", "def _prepare_format #:nodoc:\n fmstr = nil\n fmt = []\n each_column { |c, i|\n ## trying a zero for hidden columns\n ## worked but an extra space is added below and the sep\n w = c.width\n case c.align\n when :right\n #fmt << \"%.#{w}s \"\n fmt << \"%#{w}.#{w}s \"\n else\n fmt << \"%-#{w}.#{w}s \"\n end\n }\n ## the next line will put a separator after hidden columns also\n fmstr = fmt.join(@y)\n #puts \"format: #{fmstr} \" # 2011-12-09 23:09:57\n return fmstr\n end", "def formatForSTDOUT()\n output = \"Total Reads Produced = \" + @totalReadsProduced.to_s + \"\\r\\n\" +\n \"Duplicate Reads = \" + @numDuplicateReads.to_s + \" (\" + @perDuplicateReads.to_s + \")%\\r\\n\" +\n \"Total Reads Aligned = \" + @numAlignedReads.to_s + \" (\" + @perAlignedReads.to_s + \")%\\r\\n\" +\n \"Paired Reads = \" + @numReadsPaired.to_s + \"\\r\\n\" +\n \"Reads Paired with Mapped Mates = \" + @numReadAndMatePaired.to_s + \"\\r\\n\" +\n \"Buffer Aligned Reads = \" + @numBufferAlignedReads.to_s + \" (\" + @perBufferAlignedReads.to_s + \")%\\r\\n\" + \n \"Target Aligned Reads = \" + @numTargetAlignedReads.to_s + \" (\" + @perTargetAlignedReads.to_s + \")%\\r\\n\" +\n \"Average Coverage = \" + @avgCoverage.to_s + \"\\r\\n\" +\n \"Reads on Target or Buffer = \" + @numReadsTargetBuffer.to_s + \" (\" + @perReadsTargetBuffer.to_s + \")%\\r\\n\" +\n \"Total Aligned Reads (Expected) = \" + @totalExpAlignedReads.to_s + \"\\r\\n\" +\n \"Total Aligned Reads (Calculated) = \" + @totalCalcAlignedReads.to_s + \"\\r\\n\" +\n \"Targets Hit = \" + @numTargetsHit.to_s + \" (\" + @perTargetsHit.to_s + \")%\\r\\n\" +\n \"Target Buffers Hit = \" + @numTargetBuffersHit.to_s + \" (\" + @perTargetBuffersHit.to_s + \")%\\r\\n\" +\n \"Total Targets = \" + @numTotalTargets.to_s + \"\\r\\n\" +\n \"Non Target Hits = \" + @numNonTarget.to_s + \"\\r\\n\" +\n \"Bases on Target = \" + @numTargetedBases.to_s + \"\\r\\n\" +\n \"Buffer Bases = \" + @numBufferBases.to_s + \"\\r\\n\" + \n \"Bases with 1+ Coverage = \" + @numBases1Coverage.to_s + \" (\" + @perBases1Coverage.to_s + \")%\\r\\n\" +\n \"Bases with 4+ Coverage = \" + @numBases4Coverage.to_s + \" (\" + @perBases4Coverage.to_s + \")%\\r\\n\" +\n \"Bases with 10+ Coverage = \" + @numBases10Coverage.to_s + \" (\" + @perBases10Coverage.to_s + \")%\\r\\n\" +\n \"Bases with 20+ Coverage = \" + @numBases20Coverage.to_s + \" (\" + @perBases20Coverage.to_s + \")%\\r\\n\" +\n \"Bases with 40+ Coverage = \" + @numBases40Coverage.to_s + \" (\" + @perBases40Coverage.to_s + \")%\\r\\n\"\n return output\n end", "def ansi_formatting(cell, col, row); end", "def header_format; self.underline end", "def pretty(format = '%12.4e')\n str = String.new()\n to_a.each{|i| str += sprintf(format, i)} \n return str\n end", "def parse_str_fmt(fmt)\n # We parse the more complex formatting constructs first, and after each\n # parse, we remove the matched construct from fmt. At the end, any\n # remaining characters in fmt should be invalid.\n fmt_hash = {}\n if fmt =~ /c\\[(#{CLR_RE})(\\.(#{CLR_RE}))?\\]/\n fmt_hash[:color] = $1 unless $1.blank?\n fmt_hash[:bgcolor] = $3 unless $3.blank?\n validate_color(fmt_hash[:color])\n validate_color(fmt_hash[:bgcolor])\n fmt = fmt.sub($&, '')\n end\n # Nil formatting can apply to strings as well\n nil_hash, fmt = parse_nil_fmt(fmt)\n fmt_hash = fmt_hash.merge(nil_hash)\n if fmt =~ /u/\n fmt_hash[:case] = :lower\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /U/\n fmt_hash[:case] = :upper\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /t/\n fmt_hash[:case] = :title\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(~\\s*)?B/\n fmt_hash[:bold] = !$1\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(~\\s*)?I/\n fmt_hash[:italic] = !$1\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /R/\n fmt_hash[:alignment] = :right\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /C/\n fmt_hash[:alignment] = :center\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /L/\n fmt_hash[:alignment] = :left\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(~\\s*)?_/\n fmt_hash[:underline] = !$1\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(~\\s*)?\\*/\n fmt_hash[:blink] = !$1\n fmt = fmt.sub($&, '')\n end\n [fmt_hash, fmt]\n end", "def formatter(formatter = T.unsafe(nil)); end", "def fmt(cmd); \" %s %s\" % [cmd[:time].strftime(@options[:time_format]), cmd[:cmd]]; end", "def printf(fmt, *rest) end", "def printf(fmt, *rest) end", "def printf(fmt, *rest) end", "def printf(fmt, *rest) end", "def formatters=(formatters); end", "def format_symbol\n\t\t:format\n\tend", "def formatted_source_file(source_file); end", "def formatter fmt\n @formatter = fmt\n end", "def printf(format_string,*args,**opts)\n stdout = opts.fetch(:out, $stdout)\n\n # Sanitize rule symbols\n sanitized = format_string.dup\n @rules.keys.each { |k| sanitized.gsub!(\"#{@symbols.rule}#{k.to_s}\",\"#{255.chr}#{k.to_s}\") }\n sanitized.gsub!(@symbols.reset, 255.chr*2)\n\n t = sanitized % args\n # Reinstate rule symbols\n @rules.keys.each { |k| t.gsub!(\"#{255.chr}#{k.to_s}\",\"#{@symbols.rule}#{k.to_s}\") }\n t.gsub!(255.chr*2,@symbols.reset)\n\n stdout.print apply(t)\n end", "def prettify(str); end", "def cdr_to_fmt\n '%s'\n end", "def cdr_from_fmt\n '%s'\n end", "def ruby_format_print(rubies)\n real_ruby_noun = (rubies[0] > 1 ? 'rubies' : 'ruby')\n fake_ruby_noun = (rubies[1] > 1 ? 'fake rubies' : 'fake ruby')\n pri = ''\n if rubies[0] > 0 && rubies[1] > 0\n pri += \"\\tFound #{rubies[0]} #{real_ruby_noun} and #{rubies[1]} #{fake_ruby_noun} in #{@current_location.name}.\\n\"\n elsif rubies[1].zero?\n pri += \"\\tFound #{rubies[0]} #{real_ruby_noun} in #{@current_location.name}.\\n\"\n else\n pri += \"\\tFound #{rubies[1]} #{fake_ruby_noun} in #{@current_location.name}.\\n\"\n end\n puts pri\n pri\n end", "def formats\n format\n end", "def format ary\n alert \"deprecated, can be removed if not called\"\n #buff = Array.new\n buff = Array.new(ary.size)\n return buff if ary.nil? || ary.size == 0\n\n # determine width based on number of files to show\n # if less than sz then 1 col and full width\n #\n # ix refers to the index in the complete file list, wherease we only show 60 at a time\n ix=0\n ctr=0\n ary.each do |f|\n ## ctr refers to the index in the column\n ind = get_shortcut(ix)\n mark=SPACE\n cur=SPACE\n cur = CURMARK if ix + $sta == $cursor\n mark=GMARK if $selected_files.index(ary[ix])\n\n if $long_listing\n begin\n unless File.exist? f\n last = f[-1]\n if last == \" \" || last == \"@\" || last == '*'\n stat = File.stat(f.chop)\n end\n else\n stat = File.stat(f)\n end\n f = \"%10s %s %s\" % [readable_file_size(stat.size,1), date_format(stat.mtime), f]\n rescue Exception => e\n f = \"%10s %s %s\" % [\"?\", \"??????????\", f]\n end\n end\n\n s = \"#{ind}#{mark}#{cur}#{f}\"\n # I cannot color the current line since format does the chopping\n # so not only does the next lines alignment get skeweed, but also if the line is truncated\n # then the color overflows.\n #if ix + $sta == $cursor\n #s = \"#{RED}#{s}#{CLEAR}\"\n #end\n\n buff[ctr] = s\n\n ctr+=1\n ix+=1\n end\n return buff\nend", "def strf(fmt = \"%d %2m'%2.4s\\\"\")\n tokens = fmt.scan(/%[0-9.]*[%dmsDMNErW]|[^%]*/)\n have_dir = have_dms = false\n tokens.collect! do |t|\n if t[0, 1] == '%' # format\n had_dot = false\n decimals = -1\n width = -1\n format = nil\n t[1..-1].scan(/[0-9]+|\\.|[0-9]+|[%dmsDMNErW]/) do |t2|\n case t2\n when /[0-9]+/\n if had_dot\n decimals = t2.to_i\n else\n width = t2.to_i\n end\n when '%', /[Dr]/\n format = t2\n when /[dmsMwW]/\n have_dms = true\n format = t2\n when /[NE]/\n have_dir = true\n format = t2\n when '.'\n had_dot = true\n else\n raise \"unknown format character '#{t2}'\" # shouldn't be able to get here.\n end\n end\n [ :format, width, decimals, format ]\n else\n [ :filler, t ]\n end\n end\n\n deg, min, sec = to_dms if have_dms\n\n s = ''\n tokens.each do |t|\n if t[0] == :format\n case t[3]\n when '%'\n s += '%'\n when 'd'\n s += s_int(deg, t[1], have_dir)\n when 'D'\n s += s_float(@angle.to_deg, t[1], t[2], have_dir)\n when 'm'\n s += s_int(min, t[1], have_dir)\n when 'M'\n s += s_float(min + (sec / 60), t[1], t[2], have_dir)\n when 'W'\n s += s_only_places(sec / 60, t[1])\n when 's'\n s += s_float(sec, t[1], t[2], have_dir)\n when 'r'\n s += s_float(@angle, t[1], t[2], have_dir)\n when 'N'\n s += (@angle < 0 ? 'S' : 'N')\n when 'E'\n s += (@angle < 0 ? 'W' : 'E')\n end\n else\n s += t[1] # the fillers.\n end\n end\n\n return s\n end", "def print_formated(f,u,c,i)\n found = Hash.new\n found[\"u\"] = f.index(/(%[\\-\\.0-9]*u[0-9]*)/)\n found[\"c\"] = f.index(/(%[\\-\\.0-9]*c[0-9]*)/)\n found[\"i\"] = f.index(/(%[\\-\\.0-9]*i[0-9]*)/)\n\n username_output_format = /(%[\\-\\.0-9]*u[0-9]*)/.match(f)[1].gsub('u', 's') if !found[\"u\"].nil?\n cpu_usage_output_format = /(%[\\-\\.0-9]*c[0-9]*)/.match(f)[1].gsub('c', 's') if !found[\"c\"].nil?\n iowait_usage_output_format = /(%[\\-\\.0-9]*i[0-9]*)/.match(f)[1].gsub('i', 's') if !found[\"i\"].nil?\n\n libc_f = f\n\n libc_f = libc_f.sub(/%[\\-\\.0-9]*u[0-9]*/, username_output_format) if !found[\"u\"].nil?\n libc_f = libc_f.sub(/%[\\-\\.0-9]*c[0-9]*/, cpu_usage_output_format) if !found[\"c\"].nil?\n libc_f = libc_f.sub(/%[\\-\\.0-9]*i[0-9]*/, iowait_usage_output_format) if !found[\"i\"].nil?\n \n _print_formated(libc_f,create_ordered_output_from_format_string(f,u,c,i))\nend", "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_format(format_string)\n print \"Testing '#{format_string}': \"\n puts format(format_string,12.3456)\nend", "def format=(procedure); end", "def format(string)\n zwnj = \"\\u{0200c}\"\n ansi_to_irc_table = {\n \"\\033[30m\" => \"\\x031#{zwnj}\", # black\n \"\\033[31m\" => \"\\x034#{zwnj}\", # red\n \"\\033[32m\" => \"\\x033#{zwnj}\", # green\n \"\\033[33m\" => \"\\x037#{zwnj}\", # brown\n \"\\033[34m\" => \"\\x032#{zwnj}\", # blue\n \"\\033[35m\" => \"\\x0313#{zwnj}\", # magenta\n \"\\033[36m\" => \"\\x0311#{zwnj}\", # cyan\n \"\\033[37m\" => \"\\x031#{zwnj}\", # gray\n \"\\033[0m\" => \"\\x03#{zwnj}\", # color end\n \"\\033[1m\" => \"\\x02#{zwnj}\", # bold start\n \"\\033[22m\" => \"\\x02#{zwnj}\" # bold end\n }\n\n s = string.to_s\n ansi_to_irc_table.each { |ansi, irc| s.gsub!(ansi, irc) }\n s\n end", "def format_source(value); end", "def format_arguments; end", "def format\n @_format\n end", "def inspect(format=\"%12.4f\",indent=0)\n indt = \" \" * indent\n s = \"\"\n if @deps[0].kind_of? Table\n @inds.each_index do |i|\n s << indt << format % @inds[i]\n s << \"\\n\"\n s << @deps[i].inspect(format,indent+1)\n s << \"\\n\" if i!=(@inds.size-1)\n end\n else\n s << indt\n @inds.each_index do |i|\n s << format % @inds[i]\n end\n s << \"\\n\"\n s << indt\n @deps.each_index do |i|\n s << format % @deps[i]\n end\n end\n s\n end", "def date_formats\n now = Time.now\n [:to_date, :to_datetime, :to_time].each do |conv_meth|\n obj = now.send(conv_meth)\n puts obj.class.name\n puts \"=\" * obj.class.name.length\n name_and_fmts = obj.class::DATE_FORMATS.map { |k, v| [k, %Q('#{String === v ? v : '&proc'}')] }\n max_name_size = name_and_fmts.map { |k, _| k.to_s.length }.max + 2\n max_fmt_size = name_and_fmts.map { |_, v| v.length }.max + 1\n name_and_fmts.each do |format_name, format_str|\n puts sprintf(\"%#{max_name_size}s:%-#{max_fmt_size}s %s\", format_name, format_str, obj.to_s(format_name))\n end\n puts\n end\nend", "def format ary\n #buff = Array.new\n buff = Array.new(ary.size)\n return buff if ary.nil? || ary.size == 0\n\n # determine width based on number of files to show\n # if less than sz then 1 col and full width\n #\n # ix refers to the index in the complete file list, wherease we only show 60 at a time\n ix=0\n ctr=0\n pad = false\n pad = true if ary.size > 25\n ary.each do |f|\n ## ctr refers to the index in the column\n ind = get_shortcut(ix)\n ind = ind.ljust(2) if pad\n mark=SPACE\n cur=SPACE\n cur = CURMARK if ix + $sta == $cursor\n #mark=GMARK if $selected_files.index(ary[ix])\n # we are not doing selection here\n # but maybe today's articles can be starred\n age_in_hours = article_age_in_hours(f) \n mark=DOTMARK if age_in_hours < 24\n mark=GMARK if age_in_hours < 8\n\n if $long_listing\n begin\n f = get_long_list f\n rescue Exception => e\n #f = \"%10s %s %s\" % [\"?\", \"??????????\", f]\n end\n end\n\n s = \"#{ind}#{mark}#{cur}#{f}\"\n # I cannot color the current line since format does the chopping\n # so not only does the next lines alignment get skeweed, but also if the line is truncated\n # then the color overflows.\n #if ix + $sta == $cursor\n #s = \"#{RED}#{s}#{CLEAR}\"\n #end\n\n buff[ctr] = s\n\n ctr+=1\n ix+=1\n end\n return buff\nend", "def parse_printf_format(format, opts)\n return format, opts if $1.size % 2 == 1\n end", "def formatting(str)\n puts str * 80\nend", "def pretty_format(text)\n parser.parse(text)\n end", "def pretty\n cpf_numbers = numeric\n \"%s.%s.%s-%s\" % [cpf_numbers[0..2], cpf_numbers[3..5], cpf_numbers[6..8], cpf_numbers[9..10]]\n end", "def normalize_formatting_rules(rules); end", "def formatflag(engine=nil,format=nil)\n case getvariable('distribution')\n when 'standard' then prefix = \"--fmt\"\n when /web2c/io then prefix = web2cformatflag(engine)\n when /miktex/io then prefix = \"--undump\"\n else return \"\"\n end\n if format then\n \"#{prefix}=#{format.sub(/\\.\\S+$/,\"\")}\"\n else\n prefix\n end\n end", "def format_color(name, text)\n if Pry.color\n \"\\001#{Pry::Helpers::Text.send name, '{text}'}\\002\".sub '{text}', \"\\002#{text}\\001\"\n else\n text\n end\nend", "def format_file(file)\n out = ''\n\n file.magic_numbers.each do |num|\n if @color\n val = red(num.value)\n line = yellow(num.line)\n path = pink(file.path)\n else\n val = num.value\n line = num.line\n path = file.path\n end\n\n out << \"#{path}:#{line} detected magic number #{val}\\n\"\n end\n\n out\n end", "def html_to_ansi(string); end", "def parse_string_fmt(fmt, strict: true)\n # We parse the more complex formatting constructs first, and after each\n # parse, we remove the matched construct from fmt. At the end, any\n # remaining characters in fmt should be invalid.\n fmt_hash = {}\n if fmt =~ /c\\[(?<co>#{CLR_RE})(\\.(?<bg>#{CLR_RE}))?\\]/\n fmt_hash[:color] = Regexp.last_match[:co] unless Regexp.last_match[:co].blank?\n fmt_hash[:bgcolor] = Regexp.last_match[:bg] unless Regexp.last_match[:bg].blank?\n validate_color(fmt_hash[:color])\n validate_color(fmt_hash[:bgcolor])\n fmt = fmt.sub($&, '')\n end\n # Nil formatting can apply to strings as well\n nil_hash, fmt = parse_nilclass_fmt(fmt)\n fmt_hash = fmt_hash.merge(nil_hash)\n if fmt =~ /u/\n fmt_hash[:case] = :lower\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /U/\n fmt_hash[:case] = :upper\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /t/\n fmt_hash[:case] = :title\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(?<neg>~\\s*)?B/\n fmt_hash[:bold] = !Regexp.last_match[:neg]\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(?<neg>~\\s*)?I/\n fmt_hash[:italic] = !Regexp.last_match[:neg]\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /R/\n fmt_hash[:alignment] = :right\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /C/\n fmt_hash[:alignment] = :center\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /L/\n fmt_hash[:alignment] = :left\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(?<neg>~\\s*)?_/\n fmt_hash[:underline] = !Regexp.last_match[:neg]\n fmt = fmt.sub($&, '')\n end\n if fmt =~ /(?<neg>~\\s*)?\\*/\n fmt_hash[:blink] = !Regexp.last_match[:neg]\n fmt = fmt.sub($&, '')\n end\n [fmt_hash, fmt]\n end", "def formatter\n raise NotImplementedError\n end", "def format_trace(args)\n if args.size > 1 && args.first.is_a?(String)\n format(\"%s: %p\\n\", args.shift, args.size == 1 ? args.first : args)\n elsif args.size == 1 && args.first.is_a?(String)\n \"#{args.first}\\n\"\n else\n format(\"%p\\n\", args.size == 1 ? args.first : args)\n end\n end", "def to_s ; format ; end", "def display\n puts \" 0 1 2 3 4 5 6 7 \"\n puts \"#{format}\"\n end", "def log_formatter=(_arg0); end", "def log_formatter=(_arg0); end", "def rnformat\n\n\t# Get the state we need\n\tcheckTools();\n\t\n\ttheArgs = getArguments();\n\n\n\n\t# Reformat the files\n\treformatFiles(theArgs);\n\nend", "def pretty_format(text)\n begin\n textilize(text).html_safe\n rescue\n simple_format(text).html_safe\n end\n end", "def preformatting\n\n end", "def pretty_system(code)\n require 'shellwords'\n cmds = Shellwords.shellsplit(code)\n cmds << \"2>&1\"\n\n status =\n Tools.popen4(*cmds) do |pid, i, o, e|\n i.close\n\n last = nil\n clear_on_nl = false\n while c = o.getc\n # Because Ruby 1.8.x returns a number on #getc\n c = \"%c\" % [c] if c.is_a?(Fixnum)\n\n break if o.closed?\n if last == \"\\n\"\n if clear_on_nl\n clear_on_nl = false\n print \"\\033[0m\"\n end\n\n # Color the verbose echo commands\n if c == \"$\" && ((c += o.read(1)) == \"$ \")\n clear_on_nl = true\n print \" \"*7 + \"\\033[32m#{c}\\033[34m\"\n\n # (Don't) color the status messages\n elsif c == \"-\" && ((c += o.read(5)) == \"----->\")\n print c\n\n # Color errors\n elsif c == \"=\" && ((c += o.read(5)) == \"=====>\")\n print \"\\033[31m=====>\\033[0m\"\n\n else\n print \" \"*7 + c\n end\n else\n print c\n end\n\n last = c\n end\n end\n status.exitstatus\n end", "def formatter\n @formatter ||= ::Shell::Formatter::Console.new\n end", "def format\n output = @sum.to_s\n\n if @verbose\n @raw.each do |h|\n @display << \"#{h.keys[0]}:#{h.values[0]} \"\n end\n\n output << \" -- #{@display.strip}\"\n end\n\n output\n end", "def formatGlobal(theLines)\n\n\talignAssignments(theLines);\n\nend", "def peek_format\n\t\t\tpeek_data = [\"SNAP \"] # I is taken by IP\n\t\t\tpeek_data << \"%-5d\" % self.to_s.size\n\t\t\tpeek_data << \"%04x\" % self.snap_oui.to_i\n\t\t\ttype = case self.snap_type.to_i\n\t\t\t\t\t\t when 8192\n\t\t\t\t\t\t\t \"CDP\"\n\t\t\t\t\t\t else\n\t\t\t\t\t\t\t \"%04x\" % [self.snap_type]\n\t\t\t\t\t\t end\n\t\t\tpeek_data << \"%-21s\" % \"#{type}\"\n\t\t\tpeek_data.join\n\t\tend", "def sprintf(fmt, *rest) end", "def textLogFormat _args\n \"textLogFormat _args;\" \n end", "def strftime(p0) end", "def pretty\n \" Size: #{size} Blocks: #{blocks} IO Block: #{blksize} Type: #{rdev}\\n\"\\\n \"Device: #{dev} Inode: #{ino} Links: #{nlink}\\n\"\\\n \" Mode: #{prettymode}\\n\"\\\n \" Uid: #{uid} Gid: #{gid}\\n\"\\\n \"Access: #{atime}\\n\"\\\n \"Modify: #{mtime}\\n\"\\\n \"Change: #{ctime}\\n\"\n end", "def bbcode_to_ansi(string, usecolors = T.unsafe(nil)); end", "def ansi_to_html(string); end", "def format_source(source)\n source = source.chomp\n last = source.split(/\\r?\\n/).last\n indent = last ? last[/^([ \\t]*)/, 1].length : 0\n source.gsub(/^[ \\t]{#{indent}}/, '')\n end", "def format(args = {})\n to_s\n end", "def style_conversion; end", "def get_formatting_data\n format = @data[country][:format]\n prefix = @data[country][Core::NATIONAL_PREFIX]\n rule = (format[Core::NATIONAL_PREFIX_RULE] ||\n @data[country][Core::NATIONAL_PREFIX_RULE] || '$1')\n\n [format, prefix, rule]\n end" ]
[ "0.6762508", "0.6762508", "0.67479676", "0.65355206", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6524483", "0.6465209", "0.642774", "0.642774", "0.642774", "0.6353579", "0.6340045", "0.6304138", "0.62105876", "0.62105876", "0.62105876", "0.61393434", "0.61393434", "0.61393434", "0.61393434", "0.6135524", "0.60814536", "0.6079471", "0.6079471", "0.60501754", "0.6026627", "0.5940366", "0.5912396", "0.5888316", "0.5813874", "0.57907516", "0.5780754", "0.57095546", "0.569476", "0.56866825", "0.56866825", "0.56866825", "0.56866825", "0.56776845", "0.5673778", "0.56731", "0.5663215", "0.56627584", "0.5661172", "0.5660298", "0.5650612", "0.5631238", "0.56239843", "0.5621817", "0.56122535", "0.5601286", "0.5599357", "0.5584107", "0.5583655", "0.55836403", "0.55544704", "0.55437505", "0.55301005", "0.552542", "0.5523956", "0.55238825", "0.55223244", "0.55098367", "0.5498182", "0.5495628", "0.54946476", "0.54905266", "0.54890144", "0.54859394", "0.54831177", "0.5482774", "0.5473337", "0.5471379", "0.5468981", "0.5468942", "0.5463189", "0.5463189", "0.54365927", "0.5427685", "0.5427341", "0.5426274", "0.54170996", "0.5417095", "0.5415228", "0.5406246", "0.54061145", "0.5403589", "0.5401159", "0.53948087", "0.5383687", "0.5376782", "0.5376627", "0.53764164", "0.5369946", "0.53681475" ]
0.0
-1
Oh, rails, how I hate your shielding of Logger formatters from me
def debug_msg(msg) "[#{timestamp_with_usec}] #{msg}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_formatter; end", "def log_formatter; end", "def colorize_logging; end", "def log_formatter=(_arg0); end", "def log_formatter=(_arg0); end", "def formatter; end", "def formatter; end", "def formatter; end", "def formatters; end", "def colorize_logging=(_arg0); end", "def formatter \n original_formatter = Logger::Formatter.new\n Proc.new do |severity, datetime, progname, msg|\n original_formatter.call(severity, datetime, \n \"#{progname}##{caller_method}\",\n msg.dump)\n end\n end", "def logger_output; end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def yellow_log_formatter()\n orig_formatter = ::Logger::Formatter.new\n\n proc do |s,dt,pn,msg|\n \"#{CLEAR}#{YELLOW}#{orig_formatter.call(s,dt,pn,msg)}#{CLEAR}\"\n end\n end", "def formatter\n raise NotImplementedError\n end", "def formatters=(formatters); end", "def formats; end", "def formats; end", "def format!; end", "def datetime_format\n @logger.first.datetime_format\n end", "def set_loggers_format\n [@logger, @logger_stderr].each do |logger|\n logger.formatter = proc do |severity, _datetime, progname, msg|\n # If the message already has control characters, don't colorize it\n keep_original_color = msg.include? \"\\u001b\"\n message = \"[#{Time.now.utc.strftime('%F %T')} (PID #{$PROCESS_ID} / TID #{Thread.current.object_id})] #{severity.rjust(5)} - [ #{progname} ] - \"\n message << \"#{msg}\\n\" unless keep_original_color\n LEVELS_MODIFIERS[severity.downcase.to_sym].each do |modifier|\n message = message.send(modifier)\n end\n message << \"#{msg}\\n\" if keep_original_color\n message\n end\n end\n end", "def log_writer; end", "def configure_logging(logger)\n logger.level = LOG_LEVEL\n logger.datetime_format = '%Y-%m-%d %H:%M:%S'\n logger.formatter = proc do |severity, datetime, progname, msg|\n color = case severity\n when \"DEBUG\" then :light_white\n when \"INFO\" then :light_yellow\n when \"WARN\" then :light_red\n when \"ERROR\" then :blue\n when \"FATAL\" then :magenta\n when \"UNKNOWN\" then :cyan\n end\n \"#{datetime}: #{msg.colorize(color)}\\n\"\n end\n logger\nend", "def debug_exception_response_format=(_arg0); end", "def debug_exception_response_format=(_arg0); end", "def format!(logger)\n logger.formatter = proc { |severity, datetime, progname, msg| \"#{msg}\" }\n end", "def formatter fmt\n @formatter = fmt\n end", "def default_formatter\n SemanticLogger::Formatters::Raw.new\n end", "def formatter()\n @formatter\n end", "def log_format\n if configuration.log_format.nil? || configuration.log_format.empty?\n format = '%{KIND}: %{message} on line %{line}'\n format.prepend('%{path} - ') if configuration.with_filename\n format.concat(' (check: %{check})')\n configuration.log_format = format\n end\n\n configuration.log_format\n end", "def format_log(msg)\n msg = colorize_log(msg)\n msg = remove_prefix(msg)\n \"#{msg}\\n\"\n end", "def formatter\n @formatter.formatter\n end", "def log(s, type = :info)\n\t\tcolor = :gray\n\t\tcase type\n\t\twhen :error\n\t\t\tcolor = :red\n\t\twhen :warning\n\t\t\tcolor = :yellow\n\t\twhen :debug\n\t\t\tcolor = :purple\n\t\tend\n\t\tsuper _fmt(color, s), type\n\tend", "def to_log_format\n @log_format ||= begin\n attributes = []\n attributes << \"#{LOG_ATTR_ENV}=#{env}\" unless env.nil?\n attributes << \"#{LOG_ATTR_SERVICE}=#{service}\"\n attributes << \"#{LOG_ATTR_VERSION}=#{version}\" unless version.nil?\n attributes << \"#{LOG_ATTR_TRACE_ID}=#{trace_id}\"\n attributes << \"#{LOG_ATTR_SPAN_ID}=#{span_id}\"\n attributes << \"#{LOG_ATTR_SOURCE}=#{Core::Logging::Ext::DD_SOURCE}\"\n attributes.join(' ')\n end\n end", "def default_formatter\n SemanticLogger::Formatters::Default.new\n end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def logger; end", "def format_log(sev, _time, _prog, msg); end", "def logger_level; end", "def log_level; end", "def log_level; end", "def formatter(formatter = T.unsafe(nil)); end", "def settings_as_formatted_text\n log_without_formatting { info ::SexySettings::Base.instance.as_formatted_text }\n end", "def textLogFormat _args\n \"textLogFormat _args;\" \n end", "def inspect\n\t\treturn \"#<%p:%#016x formatter: %s, level: %s, output: %s, affecting %s log hosts>\" % [\n\t\t\tself.class,\n\t\t\tself.object_id * 2,\n\t\t\tself.settings[:formatter] || '-',\n\t\t\tself.settings[:level] || '-',\n\t\t\tself.settings[:logdev] ? self.settings[:logdev].class : '-',\n\t\t\tself.log_hosts ? self.log_hosts.length.to_s : \"all\",\n\t\t]\n\tend", "def format_log(raw)\n return \"...\" unless raw\n raw.split(\"\\n\").map do |l|\n # clean stuff we don't need\n l.gsub!(/I\\s+|\\(\\w*\\)|within bounds/, \"\") # gsub(/\\(\\w*\\)/, \"\"\")\n # if ok, span is green\n ok = l =~ /\\[ok\\]/\n if l =~ /\\[\\w*\\]/\n # get some data we want...\n l.gsub(/\\[\\S*\\s(\\S*)\\]\\W+INFO: (\\w*-?\\w*|.*)?\\s\\[(\\w*)?\\]/, \"<span class='gray'>\\\\1</span> | <span class='#{ok ? 'green' : 'red'}'>\\\\3</span> |\").\n # take only the integer from cpu\n gsub(/cpu/, \"cpu %\").gsub(/(\\d{1,3})\\.\\d*%/, \"\\\\1\").\n # show mem usage in mb\n gsub(/memory/, \"mem mb\").gsub(/(\\d*kb)/) { ($1.to_i / 1000).to_s }\n else\n l.gsub(/\\[\\S*\\s(\\S*)\\]\\W+INFO: \\w*\\s(\\w*)/, \"<span class='gray'>\\\\1</span> | <span class='act'>act</span> | \\\\2\")\n end\n\n end.reverse.join(\"</br>\")\n end", "def formatter\n @formatter ||= Formatters::Default.new\n end", "def formatter\n @loggers.each do |logger|\n return logger.formatter if logger.respond_to?(:formatter)\n end\n end", "def datetime_format\n @loggers.each do |logger|\n return logger.datetime_format if logger.respond_to?(:datetime_format)\n end\n end", "def formatter\n @formatter ||= HumanFormatter.new\n end", "def inspect\n\t\treturn \"#<%p:%#016x formatter: %s, level: %s, output: %s>\" % [\n\t\t\tself.class,\n\t\t\tself.object_id * 2,\n\t\t\tself.settings[:formatter] || '-',\n\t\t\tself.settings[:level] || '-',\n\t\t\tself.settings[:logdev] ? self.settings[:logdev].class : '-',\n\t\t]\n\tend", "def formatters\n @formatters ||= {}\n end", "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "def default_formatter\n SemanticLogger::Formatters::Json.new\n end", "def format(log_record)\n msg_txt = self.formatMessage(log_record)\n msg_txt = msg_proc.call(log_record, msg_txt) if msg_proc\n return unless msg_txt\n\n lvl = @level_labels[log_record.level]\n indent = @indent || 0\n spacer = ''\n wrap_width = @width - indent\n if log_record.level.intValue < JavaUtilLogger::Level::INFO.intValue\n spacer = ' '\n wrap_width -= 2\n end\n msg = wrap_width > 0 ? Console.wrap_text(msg_txt, wrap_width) : [msg_txt]\n sb = java.lang.StringBuilder.new()\n msg.each_with_index do |line, i|\n if i == 0\n fmt = java.lang.String.format(@format_string,\n log_record.millis,\n log_record.logger_name,\n log_record.logger_name,\n lvl,\n msg[i],\n log_record.thrown,\n spacer)\n else\n fmt = java.lang.String.format(@format_string,\n log_record.millis, '', '', '', msg[i], nil, spacer)\n end\n sb.append(fmt)\n sb.append(LINE_END) if @width < 0 || fmt.length < @width\n end\n sb.toString()\n end", "def default_formatter\n if protocol == :syslog\n # Format is text output without the time\n SemanticLogger::Formatters::Default.new(time_format: nil)\n else\n SemanticLogger::Formatters::Syslog.new(facility: facility, level_map: level_map, max_size: max_size)\n end\n end", "def default_format(f)\n @default_formatter = Log4r::PatternFormatter.new(:pattern => f)\n\n #\n # Set all current outputters\n #\n result.outputters.each do |o|\n o.formatter = @default_formatter if o.formatter.is_a?(Log4r::DefaultFormatter)\n end\n\n @default_formatter\n end", "def logger\n ::Logger.new($stdout).tap do |log|\n log.formatter = proc do |severity, _datetime, _progname, msg|\n prep = ' ' * (severity.size + 3)\n message = msg.lines.map.with_index do |str, i|\n next str if i.zero?\n\n str.strip.empty? ? str : prep + str\n end\n color = severity.downcase.to_sym\n msg = +\"[#{SeccompTools::Util.colorize(severity, t: color)}] #{message.join}\"\n msg << \"\\n\" unless msg.end_with?(\"\\n\")\n msg\n end\n end\n end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def log; end", "def logger; LOGGER; end", "def render_log(log)\n # Borrow private method from colorize gem.\n log.send(:scan_for_colors).map do |mode, color, background, text|\n if [mode, color, background].all?(&:nil?)\n text\n else\n style = []\n\n case mode.to_i\n when 1\n style << 'font-weight: bold;'\n when 4\n style << 'text-decoration: underline;'\n end\n\n if name = render_color(color.to_i - 30)\n style << \"color: #{name};\"\n end\n if name = render_color(background.to_i - 40)\n style << \"background-color: #{name};\"\n end\n\n content_tag(:span, text, style: style.join(' '))\n end\n end.join.gsub(\"\\n\", '<br>')\n end", "def format_log_entry(message, dump = nil)\n if Rails.application.config.colorize_logging\n if @@row_even\n @@row_even = false\n message_color, dump_color = \"4;36;1\", \"0;1\"\n else\n @@row_even = true\n message_color, dump_color = \"4;35;1\", \"0\"\n end\n\n log_entry = \" \\e[#{message_color}m#{message}\\e[0m \"\n log_entry << \"\\e[#{dump_color}m%#{String === dump ? 's' : 'p'}\\e[0m\" % dump if dump\n log_entry\n else\n \"%s %s\" % [message, dump]\n end\n end", "def logger; settings.logger; end", "def level; @logger.level; end", "def to_s\n \"<%s name=\\\"%s\\\">\" % [self.class.name.sub(%r/^Logging::/, ''), self.name]\n end", "def logging_prefs; end" ]
[ "0.8651695", "0.8651695", "0.77396566", "0.77388036", "0.77388036", "0.7530439", "0.7530439", "0.7530439", "0.7402015", "0.703038", "0.6957565", "0.6928898", "0.68877023", "0.68877023", "0.68877023", "0.6820997", "0.6820997", "0.6820997", "0.6820997", "0.6820997", "0.6820997", "0.6820997", "0.6820997", "0.6783905", "0.67418504", "0.67331", "0.6694307", "0.6694307", "0.6673541", "0.66395086", "0.66061217", "0.65963966", "0.6575479", "0.6561286", "0.6561286", "0.65548706", "0.65161645", "0.6470096", "0.6432757", "0.64206725", "0.6409802", "0.63767457", "0.6365208", "0.63617325", "0.6357482", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6315713", "0.6296356", "0.6276704", "0.6275759", "0.6275759", "0.6272398", "0.62344664", "0.6230028", "0.62179554", "0.6212885", "0.61874115", "0.6163453", "0.61435384", "0.61250496", "0.6109522", "0.61017543", "0.6091573", "0.6091573", "0.6091573", "0.6084016", "0.60703444", "0.6066915", "0.60596526", "0.6053485", "0.6053485", "0.6053485", "0.6053485", "0.6053485", "0.6053485", "0.6053485", "0.6053485", "0.6037956", "0.6023942", "0.6020918", "0.6009881", "0.5997814", "0.59977335", "0.597959" ]
0.0
-1
Method: walk_automation_objects Purpose: Recursively walk and record the automation object hierarchy from $evm.root downwards Arguments: service_object Returns: A completed Struct::ServiceObject data structure
def walk_automation_objects(service_object) automation_object = Struct::ServiceObject.new(service_object.to_s, "", Array.new) if service_object.to_s == $evm.root.to_s automation_object.position = 'root' elsif service_object.to_s == $evm.parent.to_s automation_object.position = 'parent' elsif service_object.to_s == $evm.object.to_s automation_object.position = 'object' end offspring = service_object.children unless offspring.nil? || (offspring.kind_of?(Array) and offspring.length.zero?) Array.wrap(offspring).each do |child| automation_object.children << walk_automation_objects(child) end end return automation_object end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.object)\")\n else\n print_line(indent_level, \"#{hierarchy.obj_name}\")\n end\n indent_level += 1\n hierarchy.children.each do |child|\n print_automation_objects(indent_level, child)\n end\nend", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def collect_pageobjects(service, device, driver)\n # Create module name\n module_service_name = service.split('_').map(&:capitalize).join\n Dir.glob(\"#{$bucky_home_dir}/services/#{service}/#{device}/pageobject/*.rb\").each do |file|\n require file\n\n page_name = file.split('/')[-1].sub('.rb', '')\n page_class_name = page_name.split('_').map(&:capitalize).join\n\n # Get instance of page class\n page_class = eval(format('Services::%<module_service_name>s::%<device>s::PageObject::%<page_class_name>s', module_service_name: module_service_name, device: device.capitalize, page_class_name: page_class_name))\n page_instance = page_class.new(service, device, page_name, driver)\n\n # Define method by page name\n self.class.class_eval do\n define_method(page_name) { page_instance }\n end\n end\n end", "def nested_traverse(octrl, after, &eachblock)\n return if octrl == current_vc.ui || octrl == (@last_nested && @last_nested.last)\n ctrl = octrl\n begin\n saved = (ctrl.parent.children.to_a.find_all{|i| i != ctrl})\n saved.each &eachblock\n after.call(ctrl)\n ctrl = ctrl.parent\n end while ctrl != current_vc.ui && ctrl != (@last_nested && @last_nested.last)\n end", "def walk_association(object_string, association, associated_objects)\n begin\n #\n # Assemble some fake code to make it look like we're iterating though associations (plural)\n #\n number_of_associated_objects = associated_objects.length\n if is_plural?(association)\n assignment_string = \"#{object_string}.#{association}.each do |#{association.singularize}|\"\n else\n assignment_string = \"#{association} = #{object_string}.#{association}\"\n end\n print_line($recursion_level, \"#{assignment_string}\")\n associated_objects.each do |associated_object|\n associated_object_class = \"#{associated_object.method_missing(:class)}\".demodulize\n associated_object_id = associated_object.id rescue associated_object.object_id\n print_line($recursion_level, \"(object type: #{associated_object_class}, object ID: #{associated_object_id})\")\n if is_plural?(association)\n walk_object(\"#{association.singularize}\", associated_object)\n if number_of_associated_objects > 1\n print_line($recursion_level,\n \"--- next #{association.singularize} ---\")\n number_of_associated_objects -= 1\n else\n print_line($recursion_level,\n \"--- end of #{object_string}.#{association}.each do |#{association.singularize}| ---\")\n end\n else\n walk_object(\"#{association}\", associated_object)\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_association) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n # $walk_associations_whitelist & $walk_associations_blacklist hashes\n #\n associations = []\n associated_objects = []\n duplicates = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n if associations.length.zero?\n print_line($recursion_level, \"--- no associations ---\")\n else\n print_line($recursion_level, \"--- associations follow ---\")\n duplicates = associations.select{|item| associations.count(item) > 1}\n if duplicates.length > 0\n print_line($recursion_level,\n \"*** De-duplicating the following associations: #{duplicates.inspect} ***\")\n end\n associations.uniq.sort.each do |association|\n begin\n associated_objects = Array.wrap(this_object.method_missing(:send, association))\n if associated_objects.length == 0\n print_line($recursion_level,\n \"#{object_string}.#{association} (type: Association (empty))\")\n else\n print_line($recursion_level, \"#{object_string}.#{association} (type: Association)\")\n #\n # See if we need to walk this association according to the walk_association_policy\n # variable, and the walk_association_{whitelist,blacklist} hashes\n #\n if $walk_association_policy == 'whitelist'\n if $walk_association_whitelist.has_key?(this_object_class) &&\n ($walk_association_whitelist[this_object_class].include?('ALL') ||\n $walk_association_whitelist[this_object_class].include?(association.to_s))\n walk_association(object_string, association, associated_objects)\n else\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' isn't in the walk_association_whitelist \" \\\n \"hash for #{this_object_class} ***\")\n end\n elsif $walk_association_policy == 'blacklist'\n if $walk_association_blacklist.has_key?(this_object_class) &&\n ($walk_association_blacklist[this_object_class].include?('ALL') ||\n $walk_association_blacklist[this_object_class].include?(association.to_s))\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' is in the walk_association_blacklist \" \\\n \"hash for #{this_object_class} ***\")\n else\n walk_association(object_string, association, associated_objects)\n end\n else\n print_line($recursion_level,\n \"*** Invalid $walk_association_policy: #{$walk_association_policy} ***\")\n exit MIQ_ABORT\n end\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} association: \\'#{association}\\', gives a \" \\\n \"NoMethodError when accessed (product bug?) ***\")\n next\n end\n end\n print_line($recursion_level, \"--- end of associations ---\")\n end\n else\n print_line($recursion_level, \"--- no associations ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_associations) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def enumerate_snapshots(vm)\n snapshot_info = vm.snapshot\n\n if snapshot_info.nil?\n snapshot_root = []\n else\n snapshot_root = snapshot_info.rootSnapshotList\n end\n\n recursor = lambda do |snapshot_list|\n Enumerator.new do |yielder|\n snapshot_list.each do |s|\n # Yield the current VirtualMachineSnapshotTree object\n yielder.yield s\n\n # Recurse into child VirtualMachineSnapshotTree objects\n children = recursor.call(s.childSnapshotList)\n loop do\n yielder.yield children.next\n end\n end\n end\n end\n\n recursor.call(snapshot_root)\n end", "def object_tree\n head, *rest = array_tree\n object_subtree(head,rest)\n end", "def services_walk\n\t\tprint_status('Enumerating Running Services.....')\n\t\tservices=[['Running Services']]\n\t\t@manager.walk('enterprises.77.1.2.3.1.1') { |x| services << [\"#{x.value}\"] }\n\t\tif services.empty?\n\t\t\tprint_error(\"No Values Found!\")\n\t\telse\n\t\t\ttable = services.to_table(:first_row_is_head => true)\n\t\t\tputs table.to_s\n\t\tend\n\tend", "def rootObject\n @otrunk.getRoot\n end", "def rootObject\n @otrunk.getRoot\n end", "def recurse_otml_dirs(&block)\n return unless self.has_otmls\n yield(self)\n self.children.each do |child|\n child.recurse_otml_dirs(&block)\n end\nend", "def walk(node)\n return unless componentizable?(node)\n @component_xpaths.push(node.path)\n node.children.each { |c| walk(c) }\n end", "def all_objects\n Registry.all(:root, :module, :class)\n end", "def traverse obj=self, &block\n case\n when obj.respond_to?(:parent?) && obj.respond_to?(:child?)\n block.call obj\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:parent?)\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:child?)\n block.call obj\n end\n end", "def dumpVM(vm)\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Attributes [vm.attributes]\")\n vm.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Attributes - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Attributes [vm.attributes]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Associations [vm.associations]\")\n vm.associations.sort.each { |assc| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Associations - #{assc}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Associations [vm.associations]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Hardware Attributes [vm.hardware]\")\n vm.hardware.attributes.each { |k,v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Hardware - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Hardware Attributes [vm.hardware]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Hardware Associations [vm.hardware.associations]\")\n vm.hardware.associations.sort.each { |assc| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> hardware Associations - #{assc}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End hardware Associations [vm.hardware.associations]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Neworks [vm.hardware.nics]\")\n vm.hardware.nics.each { |nic| nic.attributes.sort.each { |k,v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> VLAN:<#{nic.device_name}> - #{k}: #{v.inspect}\")}}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Networks [vm.hardware.nics]\")\n $evm.log(\"info\",\"\")\n\n unless vm.ext_management_system.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin EMS [vm.ext_management_system]\")\n vm.ext_management_system.attributes.sort.each { |ems_k, ems_v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> EMS:<#{vm.ext_management_system.name}> #{ems_k} - #{ems_v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End EMS [vm.ext_management_system]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.owner.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Owner [vm.owner]\")\n vm.owner.attributes.each { |k,v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Owner - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Owner [vm.owner]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.operating_system.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Operating System [vm.operating_system]\")\n vm.operating_system.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Operating System - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Operating System [vm.operating_system]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.guest_applications.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Guest Applications [vm.guest_applications]\")\n vm.guest_applications.each { |guest_app| guest_app.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Guest Application:<#{guest_app.name}> - #{k}: #{v.inspect}\")}} unless vm.guest_applications.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Guest Applications [vm.guest_applications]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.snapshots.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Snapshots [vm.snapshots]\")\n vm.snapshots.each { |ss| ss.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Snapshot:<#{ss.name}> - #{k}: #{v.inspect}\")}} unless vm.snapshots.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Snapshots [vm.snapshots]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.storage.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin VM Storage [vm.storage]\")\n vm.storage.attributes.sort.each { |stor_k, stor_v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Storage:<#{vm.storage.name}> #{stor_k} - #{stor_v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End VM Storage [vm.storage]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.tags.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Tags [vm.tags]\")\n vm.tags.sort.each { |tag_element| tag_text = tag_element.split('/'); $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Tags [vm.tags]\")\n $evm.log(\"info\",\"\")\n end\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Virtual Columns [vm.virtual_column_names]\")\n vm.virtual_column_names.sort.each { |vcn| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Virtual Columns - #{vcn}: #{vm.send(vcn).inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Virtual Columns [vm.virtual_column_names]\")\n $evm.log(\"info\",\"\")\n end", "def walkthrough_test( object)\r\n\t counter=4\r\n\t i,j =0\r\n\t \r\n\t # This Two Loops run the intire nested hash Array along\r\n\t # Ignores all fields which are empty\r\n\t # The loop goes for each position there an object through four Methods\r\n\t # The Methods returns a number of found objects in a same line\r\n\t while i < 8\r\n\t j=0\r\n\t while j < 8\r\n\t \r\n\t if @nha2[i][j] != nil\r\n\t if @nha2[i][j] == object\r\n\t\r\n\t ru1= walkhigh(i,j,object) \r\n\t if ru1==0\r\n\t # puts \"WINNER1\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru2 = walkright(i,j,object)\r\n\t if ru2==0\r\n\t # puts \"WINNER2\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru3 = walkleft_down(i,j,object)\r\n\t if ru3==0\r\n\t # puts \"WINNER3\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru4 = walkright_down(i,j,object)\r\n\t if ru4==0\r\n\t # puts \"WINNER4\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t end\r\n\t end \r\n\t j+=1\r\n\t end \r\n\t i+=1 \r\n\t end\r\n end", "def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend", "def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findOrCreateRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend", "def x_get_tree_roots\n objects = []\n objects << {:id => \"compliance\", :text => _(\"Compliance Policies\"), :icon => \"pficon pficon-history\", :tip => _(\"Compliance Policies\")}\n objects << {:id => \"control\", :text => _(\"Control Policies\"), :icon => \"fa fa-shield\", :tip => _(\"Control Policies\")}\n\n # Push folder node ids onto open_nodes array\n objects.each { |o| open_node(\"xx-#{o[:id]}\") }\n\n count_only_or_objects(false, objects)\n end", "def simulate_workflow(workflow, service)\n # Only need to consider the remaining workflow.\n queue = []\n visited = Set.new # Ensure each node is only enqueued once\n return visited unless workflow && service\n # Add current nodes children to queue.\n workflow.each do |tool, depends_set|\n queue << tool if depends_set.include? service\n end\n until queue.empty?\n current_service = queue.shift # shift is equivalent to dequeue.\n # Execute the block given at each node\n yield current_service if block_given?\n visited.add(current_service)\n workflow.each do |tool, depends_set|\n queue << tool if depends_set.include?(current_service) && !visited.include?(tool)\n end\n end\n visited.delete service\n end", "def path_of(objects_hierarchy)\n objects = @roots\n\n objects_hierarchy.inject([]) { |path, each_object|\n index = objects.index { |node| node.value == each_object }\n\n path << index\n\n objects = objects[index].children\n\n path\n }\n end", "def dumpEMS(ems)\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> Begin Attributes [ems.attributes]\")\n ems.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - EMS:<#{ems.name}> Attributes - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> End Attributes [ems.attributes]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> Begin Associations [ems.associations]\")\n ems.associations.sort.each { |assc| $evm.log(\"info\", \"#{@method} - EMS:<#{ems.name}> Associations - #{assc}\")}\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> End Associations [ems.associations]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> Begin EMS Folders [ems.ems_folders]\")\n ems.ems_folders.each { |ef| ef.attributes.sort.each { |k,v| $evm.log(\"info\", \"#{@method} - EMS:<#{ems.name}> EMS Folder:<#{ef.name}> #{k}: #{v.inspect}\")}}\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> End EMS Folders [ems.ems_folders]\")\n $evm.log(\"info\",\"\")\n\n unless ems.tags.nil?\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> Begin Tags [ems.tags]\")\n ems.tags.sort.each { |tag_element| tag_text = tag_element.split('/'); $evm.log(\"info\", \"#{@method} - EMS:<#{ems.name}> Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")}\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> End Tags [ems.tags]\")\n $evm.log(\"info\",\"\")\n end\n\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> Begin Virtual Columns [ems.virtual_column_names]\")\n ems.virtual_column_names.sort.each { |vcn| $evm.log(\"info\", \"#{@method} - EMS:<#{ems.name}> Virtual Columns - #{vcn}: #{ems.send(vcn)}\")}\n $evm.log(\"info\",\"#{@method} - EMS:<#{ems.name}> End Virtual Columns [ems.virtual_column_names]\")\n $evm.log(\"info\",\"\")\n end", "def inspect_metrics_dir_for_service_dirs\n metrics_dir_obj = Dir.open @metrics_dir\n metrics_dir_obj.each do |path|\n next if path =~ /^scripts$|^bin$|^\\.$|^\\.\\.$/\n\n absolute_path = \"#{metrics_dir_obj.path}/#{path}\"\n service = path\n next unless File.directory? absolute_path\n\n inspect_service_dir_for_metrics_files(absolute_path, service)\n end\n end", "def form_objects\n BaseForm.descendants.map(&:name).grep(/^Steps::/)\nend", "def traverse base, arcs\n objs = [base]\n arcs.each_with_index do |arc,i|\n objs.map! { |obj| traverse_one obj, arc, i==0 }\n objs.flatten!\n end\n objs\n end", "def recursive_parsing(object, tmp = [])\n case object\n when Array\n object.each.with_index(1).with_object({}) do |(element, i), result|\n result.merge! recursive_parsing(element, tmp + [i])\n end\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result.merge! recursive_parsing(value, tmp + [key])\n end\n else\n { tmp.join(' => ') => object }\n end\n end", "def registry\n Service.descendants\n end", "def recursiveTreeTraversal(element)\n begin\n requirementsTree = findRequirementsTree(element)\n unless requirementsTree == nil\n checkForDuplicateRoots(requirementsTree)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\n rescue SystemStackError\n $logger.log(\"Recursive Issue1: \" + element.getName())\n end\nend", "def get_childs(recursive, ret_obj)\n\n return self.class.get_childs(self.id, recursive, ret_obj)\n end", "def each_object_path (path=@basepath, &block)\n\n Find.find(path) do |p|\n\n next unless File.exist?(p)\n next if File.stat(p).directory?\n #next unless OpenWFE::ends_with(p, '.yaml')\n next if p[-5..-1] != '.yaml'\n\n #ldebug { \"each_object_path() considering #{p}\" }\n block.call(p)\n end\n end", "def objectLocationInActivity(object)\n indexes = []\n return indexes if object == nil\n # puts \"object: \" + object.java_class.name\n card_container_parent_paths = @otrunk.getIncomingReferences(object.getGlobalId(), OTCardContainer.java_class, true)\n card_container_parent_paths.sort{|a,b| b.size <=> a.size}.each do |path|\n containerId = path[path.size-1].getSource()\n cardId = path[path.size-1].getDest()\n index = _indexInCardContainer(containerId, cardId)\n indexes << index\n end\n return indexes.compact\n end", "def step_into_list(object, indent, start_indent)\n steps = [object.out_name].concat(object.all_resourcerefs\n .map(&:resource_ref)\n .map(&:out_name).reverse).uniq\n\n return indent(\"step_into: '#{steps[0]}',\", indent) if steps.length == 1\n\n format(\n [\n [\"step_into: %w[#{steps.join(' ')}],\"],\n [\"step_into: %w[#{steps.slice(0..-2).join(' ')}\",\n indent(\"#{steps.last(1).join(' ')}],\", 14)], # 14 = step_into: %w[\n [\"step_into: %w[#{steps.slice(0..-3).join(' ')}\",\n indent(\"#{steps.last(2).join(' ')}],\", 14)], # 14 = step_into: %w[\n [\n \"step_into: %w[#{steps[0]}\",\n indent(steps.slice(1..-2), 14), # 14 = step_into: %w[\n indent(\"#{steps.last(1).join}],\", 14)\n ]\n ], indent, start_indent\n )\n end", "def print_methods(object_string, this_object)\n begin\n #\n # Only dump the methods of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"Class of remote DRb::DRbObject is: #{this_object.method_missing(:class)}\") if $debug\n #\n # Get the instance methods of the class and convert to string\n #\n if this_object.method_missing(:class).respond_to?(:instance_methods)\n instance_methods = this_object.method_missing(:class).instance_methods.map { |x| x.to_s }\n #\n # Now we need to remove method names that we're not interested in...\n #\n # ...attribute names...\n #\n attributes = []\n if this_object.respond_to?(:attributes)\n if this_object.attributes.respond_to? :each\n this_object.attributes.each do |key, value|\n attributes << key\n end\n end\n end\n attributes << \"attributes\"\n $evm.log(\"info\", \"Removing attributes: #{instance_methods & attributes}\") if $debug\n instance_methods -= attributes\n #\n # ...association names...\n #\n associations = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n end\n associations << \"associations\"\n $evm.log(\"info\", \"Removing associations: #{instance_methods & associations}\") if $debug\n instance_methods -= associations\n #\n # ...virtual column names...\n #\n virtual_column_names = []\n virtual_column_names = this_object.method_missing(:virtual_column_names)\n virtual_column_names << \"virtual_column_names\"\n $evm.log(\"info\", \"Removing virtual_column_names: #{instance_methods & virtual_column_names}\") if $debug\n instance_methods -= virtual_column_names\n #\n # ... MiqAeServiceModelBase methods ...\n #\n $evm.log(\"info\", \"Removing MiqAeServiceModelBase methods: \" \\\n \"#{instance_methods & $service_mode_base_instance_methods}\") if $debug\n instance_methods -= $service_mode_base_instance_methods\n #\n # Add in the base methods as it's useful to show that they can be used with this object\n #\n instance_methods += ['inspect', 'inspect_all', 'reload', 'model_suffix']\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n else\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n #\n # and finally dump out the list\n #\n if instance_methods.length.zero?\n print_line($recursion_level, \"--- no methods ---\")\n else\n print_line($recursion_level, \"--- methods follow ---\")\n instance_methods.sort.each do |instance_method|\n print_line($recursion_level, \"#{object_string}.#{instance_method}\")\n end\n print_line($recursion_level, \"--- end of methods ---\")\n end\n else\n print_line($recursion_level, \"--- no methods ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_methods) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def take_root_ownership(service)\n return unless root?\n\n chown \"root\", \"admin\", service.dest\n plist_data = service.dest.read\n plist = begin\n Plist.parse_xml(plist_data)\n rescue\n nil\n end\n return unless plist\n\n root_paths = []\n\n program_location = plist[\"ProgramArguments\"]&.first\n key = \"first ProgramArguments value\"\n if program_location.blank?\n program_location = plist[\"Program\"]\n key = \"Program\"\n end\n\n if program_location.present?\n Dir.chdir(\"/\") do\n if File.exist?(program_location)\n program_location_path = Pathname(program_location).realpath\n root_paths += [\n program_location_path,\n program_location_path.parent.realpath,\n ]\n else\n opoo <<~EOS\n #{service.name}: the #{key} does not exist:\n #{program_location}\n EOS\n end\n end\n end\n if (formula = service.formula)\n root_paths += [\n formula.opt_prefix,\n formula.linked_keg,\n formula.bin,\n formula.sbin,\n ]\n end\n root_paths = root_paths.sort.uniq.select(&:exist?)\n\n opoo <<~EOS\n Taking root:admin ownership of some #{service.formula} paths:\n #{root_paths.join(\"\\n \")}\n This will require manual removal of these paths using `sudo rm` on\n brew upgrade/reinstall/uninstall.\n EOS\n chown \"root\", \"admin\", root_paths\n chmod \"+t\", root_paths\n end", "def vms(folder)\n children = []\n folder.childEntity.each do |x|\n name, junk = x.to_s.split('(')\n case name\n when \"Folder\"\n children.push(vms(x))\n when \"VirtualMachine\"\n children.push(x)\n end\n end\n\n children\nend", "def build_tree(target_object)\n\n tree = {class: get_test_class(target_object), id: target_object.object_id, composition: []}\n if (target_object.is_a? Array)\n tree[:composition] = deconstruct_array(target_object)\n elsif target_object.is_a? Hash\n tree[:composition] = deconstruct_hash(target_object)\n elsif target_object.is_a? Pretentious::RecordedProc\n tree[:composition] = deconstruct_proc(target_object)\n tree[:given_block] = target_object.given_block?\n tree[:recorded_proc] = target_object\n tree[:id] = target_object.target_proc.object_id\n tree[:block_params] = self.class.block_param_names(target_object)\n elsif target_object.methods.include? :_get_init_arguments\n args = target_object._get_init_arguments\n\n unless args.nil?\n\n args[:params].each { |p|\n tree[:composition] << build_tree(p)\n }\n\n tree[:block] = build_tree(args[:block]) unless args[:block].nil?\n else\n tree[:composition] = target_object\n end\n\n else\n tree[:composition] = target_object\n end\n tree\n end", "def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end", "def handle_recursively(event)\n handle_event event\n\n child_entities.each do |entity|\n entity.aggregate_root = @aggregate_root\n entity.handle_aggregate_event event\n end\n end", "def take_root_ownership(service)\n return unless System.root?\n\n root_paths = []\n\n if System.systemctl?\n group = \"root\"\n elsif System.launchctl?\n group = \"admin\"\n chown \"root\", group, service.dest\n plist_data = service.dest.read\n plist = begin\n Plist.parse_xml(plist_data)\n rescue\n nil\n end\n return unless plist\n\n program_location = plist[\"ProgramArguments\"]&.first\n key = \"first ProgramArguments value\"\n if program_location.blank?\n program_location = plist[\"Program\"]\n key = \"Program\"\n end\n\n if program_location.present?\n Dir.chdir(\"/\") do\n if File.exist?(program_location)\n program_location_path = Pathname(program_location).realpath\n root_paths += [\n program_location_path,\n program_location_path.parent.realpath,\n ]\n else\n opoo <<~EOS\n #{service.name}: the #{key} does not exist:\n #{program_location}\n EOS\n end\n end\n end\n end\n\n if (formula = service.formula)\n root_paths += [\n formula.opt_prefix,\n formula.linked_keg,\n formula.bin,\n formula.sbin,\n ]\n end\n root_paths = root_paths.sort.uniq.select(&:exist?)\n\n opoo <<~EOS\n Taking root:#{group} ownership of some #{service.formula} paths:\n #{root_paths.join(\"\\n \")}\n This will require manual removal of these paths using `sudo rm` on\n brew upgrade/reinstall/uninstall.\n EOS\n chown \"root\", group, root_paths\n chmod \"+t\", root_paths\n end", "def build_nested(object)\n this = self\n\n nested_object = Configuration.new\n children.each { |child| child.build(nested_object) }\n object.instance_exec { define_singleton_method(this.name) { nested_object } }\n\n object\n end", "def find_windows(container, found=[])\n if container['nodes']\n container['nodes'].each { |node| find_windows node, found }\n end\n\n if container['type'] == 'con' and container['name']\n found << [ container['id'], container['name'] ].join(' ')\n end\n\n found\nend", "def init_jaxb_json_hash(_o)\n @artifact = Org::Apache::Archiva::Maven2::Model::Artifact.from_json(_o['artifact']) unless _o['artifact'].nil?\n if !_o['childs'].nil?\n @childs = Array.new\n _oa = _o['childs']\n _oa.each { | _item | @childs.push Org::Apache::Archiva::Maven2::Model::TreeEntry.from_json(_item) }\n end\n end", "def parse object:, path: \"\"\n return if visited.has_key? object\n \n case object\n when Array\n object.each do |value|\n parse object: value, path: path\n end\n when Hash\n parse object: object.values, path: path\n when String\n current = objects[object]\n \n return if current.nil? || current[Keys::ISA].nil?\n \n path += '/' + current[Keys::ISA] + Helpers.resolve_attributes(object, objects)\n \n visited[object] = path\n \n parse object: current, path: path\n end\n end", "def list_tree_steps(flow_step = self, skips = [])\n steps_children = []\n flow_step.my_steps.reject{ |s| skips.include? s.id }.each do |step|\n steps_children << { step: step, flow: step.my_child_flow, steps: (step.step_type == 'flow' ? list_tree_steps(step.my_child_flow, skips) : []) }\n end if flow_step.present? && flow_step.my_steps.present?\n steps_children\n end", "def objects_hierarchy_at(path:)\n return [] if path.nil?\n\n nodes = @roots\n\n path.inject([]) { |hierarchy, index|\n node = nodes[index]\n\n hierarchy << node.value\n\n nodes = node.children\n\n hierarchy\n }\n end", "def getChildren\n begin\n elementObject = waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT)\n children = Squish::Object.children(elementObject)\n return children\n rescue Exception => e\n\t Log.TestFail(\"#{self.class.name}::#{__method__}(): Failed to get children for #{@name}: #{e.message}\")\n return nil\n end\n end", "def rip_all_objects\n rip_accounts()\n rip_folders()\n rip_notes()\n puts \"Updated AppleNoteStore object with #{@notes.length} AppleNotes in #{@folders.length} folders belonging to #{@accounts.length} accounts.\"\n end", "def rip_all_objects\n rip_accounts()\n rip_folders()\n rip_notes()\n puts \"Updated AppleNoteStore object with #{@notes.length} AppleNotes in #{@folders.length} folders belonging to #{@accounts.length} accounts.\"\n end", "def deep_each\n \n end", "def select_automation_node\n automation.agent_list.map { |id, value| [value[:display_name], id] }\n end", "def to_object_container\n driver = self.driver.nil? ? nil : self.driver.to_object_container\n route = RouteContainer.new(self.id, driver)\n self.travellers.each do |p|\n route.add_passenger(p.to_object_container)\n end\n return route\n end", "def traverse(trail = [], visited = {}, &block)\n trail.push(self)\n begin\n dependencies.each do |dep|\n next unless dep.runtime?\n dep.matching_specs(true).each do |dep_spec|\n next if visited.has_key?(dep_spec)\n visited[dep_spec] = true\n trail.push(dep_spec)\n begin\n result = block[self, dep, dep_spec, trail]\n ensure\n trail.pop\n end\n unless result == :next\n spec_name = dep_spec.name\n dep_spec.traverse(trail, visited, &block) unless\n trail.any? {|s| s.name == spec_name }\n end\n end\n end\n ensure\n trail.pop\n end\n end", "def all_steps\n\t#make calls to step here...\nend", "def digital_objects\n return enum_for(:digital_objects) { containers_via_manifest.size } unless block_given?\n\n containers_via_manifest.map.with_index do |container, i|\n stageable_items = discover_items_via_crawl(container)\n row = object_manifest_rows[i]\n yield DigitalObject.new(self,\n container:,\n stageable_items:,\n object_files: stageable_items.map { |item| PreAssembly::ObjectFile.new(item, { relative_path: Pathname.new(item).relative_path_from(container).to_s }) },\n label: row.fetch('label', ''),\n source_id: row['sourceid'],\n pid: row[:druid],\n stager:)\n end\n end", "def handle_recursively(event)\n handle_event event\n\n child_entities.each do |entity|\n entity.aggregate_root = self\n entity.handle_aggregate_event event\n end\n end", "def dumpRoot\n $evm.log(\"info\", \"#{@method} - Root:<$evm.root> Begin Attributes\")\n $evm.root.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - Root:<$evm.root> Attributes - #{k}: #{v}\")}\n $evm.log(\"info\", \"#{@method} - Root:<$evm.root> End Attributes\")\n $evm.log(\"info\", \"\")\n end", "def dumpRoot\n $evm.log(\"info\", \"#{@method} - Root:<$evm.root> Begin Attributes\")\n $evm.root.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - Root:<$evm.root> Attributes - #{k}: #{v}\")}\n $evm.log(\"info\", \"#{@method} - Root:<$evm.root> End Attributes\")\n $evm.log(\"info\", \"\")\n end", "def dumpRoot\n $evm.log(\"info\", \"#{@method} - Root:<$evm.root> Begin Attributes\")\n $evm.root.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - Root:<$evm.root> Attributes - #{k}: #{v}\")}\n $evm.log(\"info\", \"#{@method} - Root:<$evm.root> End Attributes\")\n $evm.log(\"info\", \"\")\n end", "def find_container_instances (record_json)\n \n current_uri = record_json['uri']\n \n Rails.logger.info(\"Aeon Fulfillment Plugin\") { \"Checking \\\"#{current_uri}\\\" for Top Container instances...\" }\n if log_record?\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \"#{record_json.to_json}\" }\n end\n\n instances = record_json['instances']\n .reject { |instance| instance['digital_object'] }\n\n if instances.any?\n Rails.logger.info(\"Aeon Fulfillment Plugin\") { \"Top Container instances found\" }\n return instances\n end\n\n # If we're in top container mode, we can skip this step, \n # since we only want to present containers associated with the current record.\n if (!self.repo_settings[:top_container_mode])\n parent_uri = ''\n\n if record_json['parent'].present?\n parent_uri = record_json['parent']['ref']\n parent_uri = record_json['parent'] unless parent_uri.present?\n elsif record_json['resource'].present?\n parent_uri = record_json['resource']['ref']\n parent_uri = record_json['resource'] unless parent_uri.present?\n end\n\n if parent_uri.present?\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \"No Top Container instances found. Checking parent. (#{parent_uri})\" }\n parent = archivesspace.get_record(parent_uri)\n parent_json = parent['json']\n return find_container_instances(parent_json)\n end\n end\n\n Rails.logger.debug(\"Aeon Fulfillment Plugin\") { \"No Top Container instances found.\" }\n\n []\n end", "def build_object(builder, property_name, object, child_ns)\n raise 'Objects must respond to each' unless object.respond_to?(:each)\n object_name = Zuora::Utils::Envelope.to_zuora_key property_name\n builder[:api].send(object_name) do\n build_nodes builder, object, child_ns\n end\n end", "def build_automate_tree(type)\n tree_name = \"#{type}_tree\".to_sym\n\n # build the ae tree to show the tree select box for entry point\n if x_active_tree == tree_name && @edit && @edit[:new][:fqname]\n nodes = @edit[:new][:fqname].split(\"/\")\n @open_nodes = []\n # if there are more than one nested namespaces\n nodes.each_with_index do |_node, i|\n if i == nodes.length - 1\n # check if @cls is there, to make sure the class/instance still exists in Automate db\n inst = @cls ? MiqAeInstance.find_by(:class_id => @cls.id, :name => nodes[i]) : nil\n # show this as selected/expanded node when tree loads\n if inst\n @open_nodes.push(\"aei-#{inst.id}\")\n @active_node = \"aei-#{inst.id}\"\n end\n elsif i == nodes.length - 2\n @cls = MiqAeClass.find_by(:namespace_id => @ns.id, :name => nodes[i])\n @open_nodes.push(\"aec-#{@cls.id}\") if @cls\n else\n @ns = MiqAeNamespace.find_by(:name => nodes[i])\n @open_nodes.push(\"aen-#{@ns.id}\") if @ns\n end\n end\n end\n\n klass = case type\n when :automate\n TreeBuilderAutomate\n when :automate_catalog\n TreeBuilderAutomateCatalog\n end\n\n @automate_tree = klass.new(tree_name, @sb)\n end", "def services\n related_objects_by_type(\"Service\")\n end", "def walk(oidorname)\n\t\tprint_status(\"Trying to Walk the '#{oidorname}' tree......\")\n\t\t@manager.walk(\"#{oidorname}\") { |x| print_good(\"#{x}\") }\n\tend", "def roots\n self.ontology_classes(force_reload=true).select{|c| c.isroot?}\n end", "def collect_all_active_occurences(entity)\n results = []\n queue = []\n entity_transformation = (entity.respond_to?(:transformation)) ? # Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image\n entity.transformation :\n IDENTITY\n queue.push([[entity], entity_transformation])\n until queue.empty?\n path, transformation = *queue.shift\n outer = path.first\n # If the outermost container is already the model, end the search.\n if outer.parent.is_a?(Sketchup::Model) || outer.parent.nil?\n # Check if this occurence of entity is below the active path,\n # that means whether the entity's path contains the active path.\n # Note: Sketchup::Model#active_path returns nil instead of empty array when in global context.\n if entity.model.active_path.nil? || (entity.model.active_path - path).empty?\n # Active path: entity's path is equal or deeper than active path\n results << transformation\n end\n # Otherwise look if it has siblings, ie. the parent has instances with the same entity.\n else\n instances = (outer.is_a?(Sketchup::ComponentDefinition)) ?\n outer.instances :\n (outer.respond_to?(:parent) && outer.parent.respond_to?(:instances)) ? # Sketchup::Drawingelement\n outer.parent.instances :\n [] # Sketchup::Model\n instances.each{ |instance|\n queue.push([[instance].concat(path), instance.transformation * transformation])\n }\n end\n end\n return results\n end", "def next_services_to_invoke(workflow)\n to_invoke = []\n # If, for some reason, workflow is nil, return empty\n return to_invoke unless workflow\n # If workflow is not nil but empty, it will still return empty\n workflow.each do |tool, depends_set|\n # Else, add all tools with empty dependency arrays\n to_invoke << tool if depends_set.empty?\n end\n to_invoke\n end", "def iterate_accessible_children\n # Allocate a pointer to LONG for the out param to give AccessibleChildren\n return_count = 0.chr * 4 \n # Allocate space for an array of VARIANTs. AccessibleChildren wilhttp://search.cpan.org/~pbwolf/Win32-ActAcc-1.1/http://search.cpan.org/~pbwolf/Win32-ActAcc-1.1/l\n # place one VARIANT (16 bytes) into each array element. Note that this\n # is a C array and not a Ruby array, so it will appear to be a single\n # binary string:\n child_variant_carray_buf = 0.chr * (16 * @childcount)\n #puts \"CHILDCOUNT IS '#{@childcount}' - allocated a 16*#{@childcount} byte Ruby string:\"\n #pp child_variant_carray_buf\n hr = AccessibleChildren.call(@iacc_ptr,\n 0,\n @childcount,\n child_variant_carray_buf,\n return_count) \n raise \"AccessibleChildren failed!\" if (hr != 0)\n\n #puts \"carray buffer before split:\"\n #pp child_variant_carray_buf\n\n return_count_unpacked = return_count.unpack('L').first\n #puts \"Return count was '#{return_count_unpacked}'\"\n\n # Split the packed buffer string into its individual VARIANTS, by using\n # map to get a Ruby array of 16-byte strings. If this is successful\n # then each string will be a single VARIANT.\n\n # Old Ruby 1.8.7 way of building the array of child variants: \n# child_variants = child_variant_carray_buf.scan(/.{16}/).map {|s| s}.flatten\n # NOTE: Interesting Ruby 1.9 fact - in 1.9, using scan with a regexp\n # on a string with packed binary data seems to always raise an exception.\n #\n # Instead split the packed string into an array of strings this way:\n child_variants = Array.new\n offset = 0\n return_count_unpacked.times do\n #puts \"at offset '#{offset}'\"\n child_variants << child_variant_carray_buf[offset, 16]\n offset += 16\n end\n\n #pp child_variants\n \n # Iterate over the children\n count = 1\n child_variants.each do |variant| \n #puts \"examining child variant #{count}\"\n count += 1\n # We could unpack the entire variant into an array like this:\n# vtchild = variant.unpack('SSSSLL')\n# vt = vtchild[0]\n # Or, we can just access the members one at a time like this:\n vt = variant[0,2].unpack('S').first\n\n # Skip if the variant's .vt is not VT_DISPATCH. This avoids trying to QI\n # any variants that do not contain an IDispatch/IAccessible object.\n if (vt != VT_DISPATCH)\n #puts(\"No IDispatch/IAccessible in this VARIANT...skipping it.\")\n next\n end\n # Get the IDispatch* value stored in the VARIANT's .pdispVal member.\n # This will be a Ruby Fixnum representing a memory address.\n pdispval_ptr = variant[8,4].unpack('L').first\n\n # We must get the QueryInterface function ptr of the IDispatch object,\n # so we can QI the IAccessible interface of the IDispatch. Perhaps\n # there's some more graceful way to handle this; maybe make it a method?\n #\n # IDispatch contains 7 functions, so we need 7 blocks of 4 bytes for\n # each function's address:\n child_vtbl_ptr = 0.chr * 4\n child_vtbl = 0.chr * (4 * 7)\n memcpy(child_vtbl_ptr, pdispval_ptr, 4)\n memcpy(child_vtbl, child_vtbl_ptr.unpack('L').first, 4 * 7)\n child_vtbl = child_vtbl.unpack('L*')\n queryInterface = Win32::API::Function.new(child_vtbl[0], 'PPP', 'L')\n # Get the IAccessible of the IDispatch\n child_iacc = 0.chr * 4\n hr = queryInterface.call(pdispval_ptr, IID_IAccessible, child_iacc)\n raise \"QueryInterface of child element failed!\" if (hr != S_OK)\n\n child = AccessibleObject.new(:iacc, child_iacc)\n\n #puts \"Child name is: '#{child.name}'\"\n\n if block_given?\n yield child\n end\n\n # FIXME - whether a match is found or not, we need to release/free all\n # unneeded child objects and BSTRs created during the search...\n end\n end", "def each_object(options={}, &block)\n options.to_options!\n options[:prefix] ||= prefix\n head = options.delete(:head)\n wants_service = options.delete(:service)\n service = {}\n hash = {}\n objects = []\n @interface.incrementally_list_bucket(@name, options.stringify_keys) do |hash|\n hash[:contents].each do |entry|\n owner = Owner.new(entry[:owner_id], entry[:owner_display_name])\n object = \n Object.new(\n :bucket => bucket,\n :key => key_for(entry[:key], :prefix => false),\n :last_modified => entry[:last_modified],\n :e_tag => entry[:e_tag],\n :size => entry[:size],\n :storage_class => entry[:storage_class],\n :owner => owner\n )\n object.head if head\n block ? block.call(object) : objects.push(object)\n end\n end\n if wants_service\n hash.each_key do |key|\n service[key] = hash[key] unless (key == :contents || key == :common_prefixes)\n end\n [objects, service]\n else\n block ? nil : objects\n end\n end", "def traverse(obj, &blk)\n case obj\n when Hash\n # Forget keys because I don't know what to do with them\n obj.each {|k,v| obj[k] = traverse(v, &blk) }\n when Array\n obj.collect! {|v| traverse(v, &blk) }\n else\n blk.call(obj)\n end\n end", "def service_payment_info_loop\n segments = []\n @clp_05_amount = 0\n eob.service_payment_eobs.each_with_index do |service, index|\n service_klass = Output835.class_for(\"Service\", facility)\n Output835.log.info \"Applying class #{service_klass}\" if index == 0\n service_obj = service_klass.new(service, facility, payer, index, @element_seperator) if service\n service_segments = service_obj.generate\n segments += service_segments[0]\n @clp_05_amount += service_segments[1]\n end\n segments\n end", "def run\n @xml.xpath(@object._nodes_xpath).each do |node|\n object = @object.new\n parse_text_properties(node,object)\n parse_attribute_properties(node,object)\n parse_embedded_properties(node,object)\n @nodes << object\n end\n @nodes\n end", "def x_get_tree_roots\n objects = [\n {:id => \"sis\", :text => _(\"Analysis Profiles\"), :icon => \"fa fa-search\", :tip => _(\"Analysis Profiles\")},\n {:id => \"z\", :text => _(\"Zones\"), :icon => \"pficon pficon-zone\", :tip => _(\"Zones\")}\n ]\n objects.push(:id => \"msc\", :text => _(\"Schedules\"), :icon => \"fa fa-clock-o\", :tip => _(\"Schedules\"))\n objects\n end", "def provided_services\n ancestors.find_all { |m| m.kind_of?(Models::TaskServiceModel) }\n end", "def dump_root()\n self.dump_info(@evm.root, \"$evm.root\")\n end", "def from_root\n items = parts\n items.shift if items.size > 1 && items.first == 'Object'\n items.join(SEPARATOR)\n end", "def navigate_manager\n visit @path_to_manager\n mock_and_clean\n end", "def recursive_serialization object\n if (object.is_a?(Array))\n # If it's an array, try to serialize each element\n return object.map{|o| recursive_serialization(o)}\n elsif (object.is_a?(Hash))\n # It's a hash, convert each key to sym and try to serialize each value\n return Hash[object.map{|k,v| [k.to_sym, recursive_serialization(v)]}]\n elsif (object.respond_to?(:serializable_hash))\n # If it can be seralized, serialize and try to recursively convert it's attributes\n return recursive_serialization(object.serializable_hash)\n else\n return object\n end\n end", "def print_structure(structure)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n # First go through all the files in the current structure\n # The current \"structure\" should reflect a dir/subdir\n structure[:files].each do | _file |\n debug_print \"Printing info for #{ _file }\\n\"\n print_entry(_file)\n end\n\n # Next go through all the subdirs and pass them to print_structure\n structure[:subdirs].each do | _subdir |\n debug_print \"Entering #{ _subdir } to print further\\n\"\n print_structure(_subdir)\n end\n end", "def objects\n return @objects unless @objects.nil?\n objs = []\n dict = @instance.getDictionary\n (0 ... dict.getChildCount).each do |i|\n obj = dict.getChildAt(i)\n objs << {\n :name => obj.getName,\n :qual => obj.getQualification.toString.downcase.to_sym,\n :type => obj.getType.toString.downcase.to_sym,\n :object => obj,\n }\n end\n @objects = objs\n end", "def traverse; end", "def explore\n while (target = search_unknown)\n # puts \"PATH: #{target.inspect}\"\n target.each do |dir|\n output = @vm.run(input: [dir]).first\n case output\n when 0 # droid hits wall\n @map.set(@droid.move(dir), Map::WALL)\n when 1 # droid moved into an empty space\n @droid = @droid.move(dir)\n @map.set(@droid, Map::NOTHING)\n when 2 # droid moved into a space containing oxygen\n @droid = @droid.move(dir)\n @map.set(@droid, Map::OXYGEN)\n end\n end\n end\n end", "def recurse(record)\n raise \"This gem only knows how to extract stuff w ActiveRecord\" unless record.kind_of? ActiveRecord::Base\n key = record.class.base_class.to_s # the base_class is key for correctly handling STI\n @output_hash[key] ||= Set.new # Set ensures no duplicates\n return if @output_hash[key].include?(record) # Prevent infinite loops as association cache on record with inverse_of will cause this method to stack overflow\n @output_hash[key].add(record)\n record.association_cache.each_pair do |assoc_name,association_def|\n Array(association_def.target).each do |a|\n self.recurse(a)\n end\n end\n end", "def iterate\n fill_first_task\n step until status.finished?\n save_tree if @printing\n end", "def process(from)\n @component_xpaths = []\n walk(from)\n @component_xpaths.reject! { |xpath| emptied?(xpath) }\n end", "def parse_tree(*klasses)\n result = []\n klasses.each do |klass|\n klassname = klass.name rescue '' # HACK klass.name should never be nil\n # Tempfile's DelegateClass(File) seems to\n # cause this\n klassname = \"UnnamedClass_#{klass.object_id}\" if klassname.empty?\n klassname = klassname.to_sym\n\n code = if Class === klass then\n sc = klass.superclass\n sc_name = ((sc.nil? or sc.name.empty?) ? \"nil\" : sc.name).intern\n [:class, klassname, [:const, sc_name]]\n else\n [:module, klassname]\n end\n\n method_names = []\n method_names += klass.instance_methods false\n method_names += klass.private_instance_methods false\n # protected methods are included in instance_methods, go figure!\n\n method_names.sort.each do |m|\n r = parse_tree_for_method(klass, m.to_sym)\n code << r\n end\n\n klass.modules.each do |mod| # TODO: add a test for this \n mod.instance_methods.each do |m|\n r = parse_tree_for_method(mod, m.to_sym)\n code << r\n end\n end\n\n klass.singleton_methods(false).sort.each do |m|\n code << parse_tree_for_method(klass, m.to_sym, true)\n end\n\n result << code\n end\n return result\n end", "def selenium_actions(*objs, &block)\n objects = objs.map do |obj|\n Prism::Node === obj ? obj.node.wd : obj\n end\n selenium_action_builder = page.node.driver.action\n selenium_action_builder.instance_exec(*objects, &block)\n selenium_action_builder.perform\n end", "def find_objects(*obj_strs)\n return [] if obj_strs.blank?\n return @applications.dup if obj_strs.size == 1 && (obj_strs[0].strip == 'all' || obj_strs[0].strip == '*')\n\n res = []\n obj_strs.map{|c| c.split(\",\")}.flatten.each do |mask|\n res += find_objects_by_mask(mask)\n end\n\n if res.size > 1\n # remove inherited targets\n\n final = []\n res.each do |obj|\n sub_object = res.any?{|a| a.sub_object?(obj) }\n final << obj unless sub_object\n end\n\n res = final\n end\n\n res.present? ? Eye::Utils::AliveArray.new(res) : []\n end", "def direct_vm_rels\n # Look for only the Vms at the second depth (default RP + 1)\n direct_vms\n end", "def find_object_method(goal)\n wrap_method(\"find_#{goal.s}\", [\"setup_enclosing_resources\", finder_string(goal, \"id\")] + goal.nested_resources.map { |k,v| new_object_string(v)})\n end", "def flatten(object, flattened = {}, prefix = \"\")\n handleValue = lambda do |value, newPrefix|\n if value.is_a?(Hash) || value.is_a?(Array)\n # recurse!\n flatten(value, flattened, newPrefix + @options[:nestedDelimiter])\n else\n flattened[newPrefix] = value\n end\n end\n\n if object.is_a? Hash\n object.each do |key, value|\n handleValue.call(value, prefix + key)\n end\n elsif object.is_a? Array\n object.each_with_index do |value, index|\n handleValue.call(value, prefix + index.to_s)\n end\n else\n return object\n end\n\n return flattened\n end", "def walk(obj, &function)\n if obj.is_a?(Array)\n obj.map { |value| walk(value, &function) }\n elsif obj.is_a?(Hash)\n obj.each_pair { |key, value| obj[key] = walk(value, &function) }\n else\n obj = yield(obj)\n end\n end", "def test_list_nested_items\n h, r = @elfinder.run(:cmd => 'open', :init => 'true', :target => '', :tree => true)\n assert_equal 1, r[:tree][:dirs].count\n end", "def x_get_tree_roots\n objects = []\n objects.push(:id => \"xx-system\",\n :text => _(\"Examples (read only)\"),\n :icon => \"pficon pficon-folder-close\",\n :tip => _(\"Examples (read only)\"))\n PxeImageType.all.sort.each do |item, _idx|\n objects.push(item)\n end\n objects\n end", "def root_object\n self\n end", "def all_in_tree\n accounts = Array.new\n accounts += ancestors\n accounts += sibling_accounts\n accounts += children\n accounts << self\n return accounts\n end", "def findChildren (parent, structure)\n #search for items in structure where item.manager = parent\n children = []\n \n #puts parent\n \n structure.each do |employee|\n \n #puts '> ' + employee.join(', ')\n \n if employee[2].eql? parent\n \n #puts 'got it!'\n \n children << employee\n end\n end\n \n return children\n\nend", "def each\n @lock.synchronize do\n @db.clear_marks\n # Start with the object 0 and the indexes of the root objects. Push them\n # onto the work stack.\n stack = [ 0 ] + @root_objects.values\n while !stack.empty?\n # Get an object index from the stack.\n id = stack.pop\n next if @db.is_marked?(id)\n\n unless (obj = object_by_id_internal(id))\n PEROBS.log.fatal \"Database is corrupted. Object with ID #{id} \" +\n \"not found.\"\n end\n # Mark the object so it will never be pushed to the stack again.\n @db.mark(id)\n yield(obj.myself) if block_given?\n # Push the IDs of all unmarked referenced objects onto the stack\n obj._referenced_object_ids.each do |r_id|\n stack << r_id unless @db.is_marked?(r_id)\n end\n end\n end\n end", "def getObjectChildren _obj, _args\n \"_obj getObjectChildren _args;\" \n end", "def flexmock_remember(mocking_object)\n @flexmock_created_mocks ||= []\n @flexmock_created_mocks << mocking_object\n mocking_object.push_flexmock_container(self)\n mocking_object\n end" ]
[ "0.6170826", "0.58349305", "0.52400583", "0.5162253", "0.49944493", "0.49401417", "0.49225986", "0.485547", "0.47778556", "0.47574612", "0.47574612", "0.4657206", "0.46291947", "0.45374662", "0.45239592", "0.451452", "0.44957012", "0.44923642", "0.44308883", "0.44273072", "0.4405388", "0.43837494", "0.43823305", "0.43515357", "0.43184352", "0.43176383", "0.42839143", "0.42771378", "0.42736667", "0.4269007", "0.4268566", "0.42608693", "0.41971594", "0.41713923", "0.41671434", "0.41641325", "0.41540346", "0.4150471", "0.41441455", "0.41390917", "0.41368246", "0.41297898", "0.41196156", "0.41143686", "0.41121757", "0.41081414", "0.41075325", "0.4106778", "0.4106778", "0.40914705", "0.4077938", "0.4056681", "0.40559733", "0.40546593", "0.40517017", "0.40490133", "0.40457866", "0.40457866", "0.40457866", "0.4039718", "0.403633", "0.40306497", "0.40300062", "0.40283635", "0.40269455", "0.40191132", "0.40003785", "0.39947936", "0.39885783", "0.39867854", "0.39826342", "0.39697146", "0.39576322", "0.3947608", "0.39463118", "0.39439893", "0.39325586", "0.3926146", "0.3924913", "0.3918903", "0.39128837", "0.39121357", "0.3910037", "0.3908281", "0.39053157", "0.39005125", "0.38832757", "0.38807008", "0.3880078", "0.38746244", "0.38732105", "0.3871878", "0.3871403", "0.3869608", "0.38692096", "0.38685712", "0.38637766", "0.38636655", "0.3863194", "0.38626215" ]
0.89353615
0
End of walk_object_hierarchy Method: print_automation_objects Purpose: recursively walk & dump the service object hierarchy discovered by walk_automation_objects Arguments: hierarchy: the service object hierarchy indent_level: the indentation string Returns: Nothing
def print_automation_objects(indent_level, hierarchy) case hierarchy.position when 'root' print_line(indent_level, "#{hierarchy.obj_name} ($evm.root)") when 'parent' print_line(indent_level, "#{hierarchy.obj_name} ($evm.parent)") when 'object' print_line(indent_level, "#{hierarchy.obj_name} ($evm.object)") else print_line(indent_level, "#{hierarchy.obj_name}") end indent_level += 1 hierarchy.children.each do |child| print_automation_objects(indent_level, child) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_hierarchy(output=$stdout)\n hierarchy.print_tree(output)\n end", "def walk_automation_objects(service_object)\n automation_object = Struct::ServiceObject.new(service_object.to_s, \"\", Array.new)\n if service_object.to_s == $evm.root.to_s\n automation_object.position = 'root'\n elsif service_object.to_s == $evm.parent.to_s\n automation_object.position = 'parent'\n elsif service_object.to_s == $evm.object.to_s\n automation_object.position = 'object'\n end\n offspring = service_object.children\n unless offspring.nil? || (offspring.kind_of?(Array) and offspring.length.zero?)\n Array.wrap(offspring).each do |child|\n automation_object.children << walk_automation_objects(child)\n end\n end\n return automation_object\nend", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def pretty_print(depth = 0)\n depth.times { STDERR.print ' *' }\n STDERR.print ' '\n STDERR.puts \"#{@name} (#{@id})\"\n @contents.each { |obj| obj.pretty_print(depth + 1) }\n end", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n # $walk_associations_whitelist & $walk_associations_blacklist hashes\n #\n associations = []\n associated_objects = []\n duplicates = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n if associations.length.zero?\n print_line($recursion_level, \"--- no associations ---\")\n else\n print_line($recursion_level, \"--- associations follow ---\")\n duplicates = associations.select{|item| associations.count(item) > 1}\n if duplicates.length > 0\n print_line($recursion_level,\n \"*** De-duplicating the following associations: #{duplicates.inspect} ***\")\n end\n associations.uniq.sort.each do |association|\n begin\n associated_objects = Array.wrap(this_object.method_missing(:send, association))\n if associated_objects.length == 0\n print_line($recursion_level,\n \"#{object_string}.#{association} (type: Association (empty))\")\n else\n print_line($recursion_level, \"#{object_string}.#{association} (type: Association)\")\n #\n # See if we need to walk this association according to the walk_association_policy\n # variable, and the walk_association_{whitelist,blacklist} hashes\n #\n if $walk_association_policy == 'whitelist'\n if $walk_association_whitelist.has_key?(this_object_class) &&\n ($walk_association_whitelist[this_object_class].include?('ALL') ||\n $walk_association_whitelist[this_object_class].include?(association.to_s))\n walk_association(object_string, association, associated_objects)\n else\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' isn't in the walk_association_whitelist \" \\\n \"hash for #{this_object_class} ***\")\n end\n elsif $walk_association_policy == 'blacklist'\n if $walk_association_blacklist.has_key?(this_object_class) &&\n ($walk_association_blacklist[this_object_class].include?('ALL') ||\n $walk_association_blacklist[this_object_class].include?(association.to_s))\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' is in the walk_association_blacklist \" \\\n \"hash for #{this_object_class} ***\")\n else\n walk_association(object_string, association, associated_objects)\n end\n else\n print_line($recursion_level,\n \"*** Invalid $walk_association_policy: #{$walk_association_policy} ***\")\n exit MIQ_ABORT\n end\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} association: \\'#{association}\\', gives a \" \\\n \"NoMethodError when accessed (product bug?) ***\")\n next\n end\n end\n print_line($recursion_level, \"--- end of associations ---\")\n end\n else\n print_line($recursion_level, \"--- no associations ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_associations) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_tree(out = $stdout)\n out.puts \"## Class: #{name}\"\n out.puts \" Visible Name: #{visible_name}\"\n out.puts \" Description : #{description}\"\n tables.each do |table|\n table.print_tree(out)\n end\n end", "def test_print_tree\n setup_test_tree\n #puts\n #@root.print_tree\n end", "def print_tree(indent = 0, lines = [])\n lines << (\" \" * indent) + self.to_s\n @nodes.keys.sort.each do |reference|\n node = @nodes[reference]\n if node.is_a? APISpec::Namespace\n node.print_tree(indent + 1, lines)\n else\n lines << (\" \" * (indent + 1)) + \"#{reference} => #{node.to_s}\"\n end\n end\n lines.join(\"\\n\")\n end", "def print_structure(structure)\n\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n # First go through all the files in the current structure\n # The current \"structure\" should reflect a dir/subdir\n structure[:files].each do | _file |\n debug_print \"Printing info for #{ _file }\\n\"\n print_entry(_file)\n end\n\n # Next go through all the subdirs and pass them to print_structure\n structure[:subdirs].each do | _subdir |\n debug_print \"Entering #{ _subdir } to print further\\n\"\n print_structure(_subdir)\n end\n end", "def print(x, objects, printed)\n\n\tif x.class == Page\n\t\tputs \"\\t\"*(x.depth.to_i) + x.to_s\n\t\tprinted.push(x.topic)\n\t\tx.children.each{ |child|\n\t\t\tprint(child, objects, printed)\n\t\t}\n\tend\n\n\tif x.class == Symbol\n\t\ttopic_regex = /title=\"(.*?)\"/\n\t\ttopic_regex.match(x.to_s.gsub!(\" \",\"_\"))\n\t\tthis_topic = $1\n\t\t\n\t\t if objects.include?(this_topic) && !printed.include?(this_topic)\n\t\t\ti = objects.index(this_topic)\n\t\t\tnewX = objects[i]\n\t\t\tprinted.push(newX)\n\t\t\tprint(newX, objects, printed)\n\t\telse\n\t\t\tprinted.push(this_topic)\n\t\t\tputs \"\\t\"*$distance.to_i + this_topic\n\t\tend\n\n\tend\nend", "def _deep_output(io, obj, depth: 0)\n if obj.is_a? Hash\n obj.each do |k, v|\n io.print ' ' * depth\n io.puts k.to_s\n _deep_output(io, v, depth: depth+1)\n end\n else\n obj.each do |array|\n key = array[0]\n title = _adjust(array[1])\n text = array[2]\n io.print ' ' * depth\n io.print ColorUtils.color(key, title)\n io.print ' '\n io.puts text\n end\n end\n end", "def print_tree\n ''\n end", "def print_tree(out = $stdout)\n out.puts \"Resource: #{id} (Key Field: #{key_field})\"\n rets_classes.each do |rets_class|\n rets_class.print_tree(out)\n end\n end", "def print(depth=0)\n if SYMLINK_TRACE\n if is_file?\n puts \"#{' '*(depth*2)} #{@name} => #{@target}\"\n elsif is_dir?\n puts \"#{' '*(depth*2)} [#{@name}] => #{@target}\"\n elsif @target\n puts \"#{' '*(depth*2)} [#{@name}] => #{@target} [missing?]\"\n else\n puts \"#{' '*(depth*2)} [#{@name}]\" if @target\n end\n end\n for node in children\n node.print depth+1\n end\n end", "def pp(obj)\n # If obj is a Delegator then use the object being delegated to for cycle\n # detection\n obj = obj.__getobj__ if defined?(::Delegator) and obj.is_a?(::Delegator)\n\n if check_inspect_key(obj)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(obj)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(obj) unless PP.sharing_detection\n end\n end", "def pretty_print_heirarchy(klass)\n begin\n print klass\n klass = klass.superclass\n print \" < \" if klass\n end while klass\nend", "def inspect_subtree\n output = self.inspect + \"\\n\"\n enum = Accessibility::Enumerators::DepthFirst.new self\n enum.each_with_level do |element, depth|\n output << \"\\t\"*depth + element.inspect + \"\\n\"\n end\n output\n end", "def print_class_and_superclasses(object)\n object.class.ancestors.each do |klass|\n puts klass\n end\nend", "def print_ancestors(obj)\n current_super_class = obj.class.superclass\n until current_super_class.nil?\n puts current_super_class\n current_super_class = current_super_class.superclass\n end\nend", "def printTree(root = @root, indentation = \"\\n\")\r\n #print root the first time running mehtod, the rest will be printed as children\r\n puts \"#{indentation}#{root.value}\" if root == @root\r\n root.children.each do | child |\r\n puts \"#{indentation}\\t#{child.value}\\n\"\r\n #if there are children, again\r\n printTree(child, indentation + \"\\t\") if child.children.any?\r\n end\r\n end", "def print_datastructure(object, threshold = ' ')\n out = ''\n if object.is_a?(Yarpler::Models::Relation)\n out << print_relation(object, threshold)\n else\n out << print_object(object, threshold)\n end\n out\n end", "def PrintOutlineTree (item)\n\twhile item.IsValid() do\n\t\tPrintIndent(item)\n\t\tif item.IsOpen()\n\t\t\tprint( \"- \" + item.GetTitle() + \" ACTION -> \")\n\t\telse\n\t\t\tprint(\"+ \" + item.GetTitle() + \" ACTION -> \")\n\t\tend\n\t\n\t\t# Print Action\n\t\taction = item.GetAction()\n\t\tif action.IsValid()\n\t\t\tif action.GetType() == Action::E_GoTo\n\t\t\t\tdest = action.GetDest()\n\t\t\t\tif dest.IsValid()\n\t\t\t\t\tpage = dest.GetPage()\n\t\t\t\t\tputs \"GoTo Page #\" + page.GetIndex().to_s()\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"Not a 'GoTo' action\"\n\t\t\tend\n\t\telse\n\t\t\tputs \"NIL\"\n\t\tend\n\t\n\t\t# Recursively print children sub-trees \n\t\tif item.HasChildren() \n\t\t\tPrintOutlineTree(item.GetFirstChild())\n\t\tend\n\t\titem = item.GetNext()\n\tend\nend", "def printout\n\t\t\n\t\tindex = 0\n\t\t\n\t\tdef small_loop (node, index)\n\t\t\t\n\t\t\tfor i in 0...index\n\t\t\t\tprint \" \"\n\t\t\tend\n\t\t\t\n\t\t\tputs node.name\n\t\t\tindex += 1\n\t\t\t\n\t\t\tif node.children.length > 0\n\t\t\t\tindex += 1\n\t\t\t\tnode.children.cycle(1) { |child| small_loop(child, index) }\n\t\t\tend\n\t\tend\n\t\t\n\t\tsmall_loop(@root, index)\n\tend", "def dump(depth = 0)\n print ' ' * depth * 2\n print \"// #{self.to_s}\\n\"\n end", "def inspect_tree(tree_hash=tree, indentation=\"\")\n parts = []\n tree_hash.each do |id, subtree|\n parts << indentation + nodes_by_id[id].to_s\n unless subtree.empty?\n parts << inspect_tree(subtree, indentation + \" \")\n end\n end\n\n unless parts.empty?\n parts.compact.join(\"\\n\")\n end\n end", "def recursive_print(array)\n\nend", "def kit_to_console(kit, indent_level=0)\n unless kit.is_a?(Kit)\n raise ArgumentError.new \"Passed a different object into a Kit presenter\"\n end\n\n # Print the first 3 fields before families.\n [:id, :name, :domains].each do |attr| \n indented_puts \"#{attr.to_s}: #{kit.send(attr)}\", indent_level \n end\n\n # Families have to be handled specially.\n indented_puts \"families:\", indent_level\n kit.families.each_with_index do |f, index|\n indented_puts \"family ##{index + 1}:\", indent_level + 1\n font_family_to_console(f, indent_level + 2)\n end\n\n # Print the remaining field.\n indented_puts \"optimize_performance: #{kit.optimize_performance}\", indent_level\n end", "def print_tree(out = $stdout)\n out.puts \"### LookupTable: #{name}\"\n out.puts \" Resource: #{resource_id}\"\n out.puts \" Required: #{table_fragment['Required']}\"\n out.puts \" Searchable: #{ table_fragment[\"Searchable\"] }\"\n out.puts \" Units: #{ table_fragment[\"Units\"] }\"\n out.puts \" ShortName: #{ table_fragment[\"ShortName\"] }\"\n out.puts \" LongName: #{ long_name }\"\n out.puts \" StandardName: #{ table_fragment[\"StandardName\"] }\"\n out.puts \"#### Types:\"\n\n lookup_types.each do |lookup_type|\n lookup_type.print_tree(out)\n end\n end", "def printTree(options = {})\n # Set defaults\n options[:name] ||= true\n options[:content] ||= false\n \n result = \"\"\n \n options[:output] = result \n # Traverse tree and modify result by tacking on child names.\n printTraversal(options)\n \n puts result\n end", "def print_tree\n if root.children\n puts \" - root : #{root.children.length} - \"\n root.children.each(&:print_node)\n puts ''\n end\n end", "def print_item(level:, current_item:)\n # Print the current item\n tabs = \"\\t\" * level\n puts tabs + '+ ' + current_item[:name]\n\n # Print the current item's children\n children = $children_of[current_item[:id]]\n if children && children.length > 0\n children.each do |child|\n print_item(\n level: level + 1, \n current_item: child\n )\n end\n end\nend", "def fprint(object, depth = 0)\n #puts \"%10s\" % [\"foo\"]\n puts \"%10s\" % [object.to_s]\nend", "def dump(depth = 0)\n attr = ''\n @attr.each do |a| ## self.attributes do |a|\n attr += a.to_s + \", \"\n end if @attr\n attr.chop!\n attr.chop!\n print ' ' * depth * 2\n print \"#{@name}(#{attr})\\n\"\n @children.each do |child|\n child.dump(depth + 1)\n end if @children\n end", "def hierarchy klass\n if klass.instance_of? Class\n begin\n print klass\n klass = klass.superclass\n print \" < \" if klass\n end while klass\n puts\n end\nend", "def print_tree(array , item, level)\n items = array[item]\n unless items == nil\n indent = level > 0 ? sprintf(\"%#{level * 2}s\", \" \") : \"\"\n items.each do |e|\n puts \"#{indent}-#{e[:title]}\"\n print_tree(e, level + 1)\n end\n end\nend", "def print_paths\n path, counter = [], 0\n puts '************************ Tree Paths ***********************************'\n puts\n print_tree_paths(self.root, path, counter)\n puts\n puts '***********************************************************************'\n end", "def pp(obj)\n id = obj.object_id\n\n if check_inspect_key(id)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(id)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(id) unless PP.sharing_detection\n end\n end", "def output_tree(element, indent = '')\n\t\t\t\tputs \"#{indent}#{element.class}: #{element.text_value}\"\n\t\t\t\t(element.elements || []).each do |e|\n\t\t\t\t\toutput_tree(e, \"#{indent} \")\n\t\t\t\tend\n\t\t\tend", "def print_tree(tree)\n\t\t\tif tree.is_leaf? and tree.depth > 0\n\t\t\t\tprint_line((\"|\\t\"*(tree.depth-1))+\"+------\"+tree.name)\n\t\t\telse\n\t\t\t\tprint_line((\"|\\t\"*tree.depth)+tree.name)\n\t\t\tend\n\t\t\ttree.children.each_pair do |name,child|\n\t\t\t\t\tprint_tree(child)\n\t\t\tend\n\t\tend", "def inspect(recursive: 1, calculated: false, args: true, properties: true, calculated_args: false)\n recurse = recursive == true || recursive.is_a?(Integer) && recursive.to_i > 0\n recursive = [recursive -= 1, 0].max if recursive.is_a?(Integer)\n args_string = \" args=#{@args.inspect}\" if args\n properties_string = \" properties=#{@properties.inspect}}\" if properties\n calculated_args_string = \" calculated_args=#{@calculated_args.inspect}\" if calculated_args\n calculated_string = \" absolute_x=#{absolute_x} absolute_y=#{absolute_y} calculated_width=#{calculated_width} calculated_height=#{calculated_height}\" if calculated\n recursive_string = \" shapes=#{@shapes.map {|s| s.inspect(recursive: recursive, calculated: calculated, args: args, properties: properties)}}\" if recurse\n \"#<#{self.class.name}:0x#{self.hash.to_s(16)}#{args_string}#{properties_string}#{calculated_args_string}#{calculated_string}#{recursive_string}>\"\n rescue => e\n Glimmer::Config.logger.error { e.full_message }\n \"#<#{self.class.name}:0x#{self.hash.to_s(16)}\"\n end", "def path_of(objects_hierarchy)\n objects = @roots\n\n objects_hierarchy.inject([]) { |path, each_object|\n index = objects.index { |node| node.value == each_object }\n\n path << index\n\n objects = objects[index].children\n\n path\n }\n end", "def print_depth(item)\n return if item.hidden?\n print_item item, 0\n list_recur_print item, 2\n end", "def print_tree(stream, indent=0)\n\t\t\tstream.puts summary(\"\\t\"*indent)\n\t\t\t@children.sort_by { |child_status|\n\t\t\t\tchild_status.get_rss_total\n\t\t\t}.each { |child_status|\n\t\t\t\t# recursively print trees for child statuses\n\t\t\t\tchild_status.print_tree(stream, indent+1)\n\t\t\t}\n\t\tend", "def tree_print(tree, folder)\n str = \"\";\n tree.each do |key, value|\n if not value.is_a?(Hash)\n # page\n if value.name != \"Home\"\n str += \"<li><a href=\\\"/#{@wiki.base_path}#{value.url_path}\\\">#{value.name}</a></li>\"\n end\n else\n # folder\n subfolder = folder + \"/\" + key\n str += \"<li><a href=\\\"#{@wiki.base_path}#{subfolder}/\\\">#{key}</a>\"\n str += \"<ul>\"\n str += tree_print(value, subfolder)\n str += \"</ul>\"\n str += \"</li>\"\n end\n end\n return str\n end", "def print(*obj)\n each_ios_and_stdout(*obj, &:print)\n nil\n end", "def class_tree(root, show_methods = true, colorize = true)\n # get children of root\n children = Hash.new()\n maxlength = root.to_s.length\n ObjectSpace.each_object(Class) do |aClass|\n if (root != aClass && aClass.ancestors.include?(root))\n children[aClass.superclass] = Array.new() if children[aClass.superclass] == nil\n children[aClass.superclass].push(aClass)\n maxlength = aClass.to_s.length if aClass.to_s.length > maxlength\n end\n end\n maxlength += 3\n\n # print nice ascii class inheritance tree\n indentation = \" \"*4\n c = Hash.new(\"\")\n if colorize\n c[:lines] = term_color :blue\n c[:dots] = term_color :red\n c[:classNames] = term_color :yellow\n c[:moduleNames] = term_color :green\n c[:methodNames] = term_color :default\n end\n\n recursePrint = proc do |current_root,prefixString|\n if show_methods # show methods (but don't show mixed in modules)\n puts(prefixString.tr('`','|'))\n methods = (current_root.instance_methods - (begin current_root.superclass.instance_methods; rescue NameError; []; end))\n strings = methods.sort.collect {|m|\n prefixString.tr('`',' ') +\n ( children[current_root] == nil ? \" \"*maxlength : c[:lines]+indentation+\"|\"+\" \"*(maxlength-indentation.length-1)) + \n c[:dots]+\":.. \" +\n c[:methodNames]+m.to_s\n }\n strings[0] = prefixString + c[:lines]+\"- \"+c[:classNames]+current_root.to_s\n strings[0] += \" \" + c[:dots]+\".\"*(maxlength-current_root.to_s.length) + \" \"+c[:methodNames]+methods[0].to_s if methods[0] != nil\n strings.each {|aString| puts(aString) }\n else\n string = \"#{prefixString}#{c[:lines]}-#{c[:classNames]}#{current_root.to_s}\"\n modules = current_root.included_modules - [Kernel]\n if modules.size > 0\n string += \" \"*(maxlength-current_root.to_s.length)+c[:lines]+\"[ \"+c[:moduleNames]+\n modules.join( c[:lines]+\", \"+c[:moduleNames]) +\n c[:lines]+\" ]\"\n end\n puts(string)\n end\n if children[current_root] != nil\n children[current_root].sort! {|a, b| a.to_s <=> b.to_s}\n children[current_root].each do |child|\n recursePrint.call(\n child,\n prefixString.tr('`',' ') + indentation + c[:lines]+(child == children[current_root].last ? \"`\":\"|\"))\n end\n end\n end\n\n recursePrint.call(root,\"\")\nend", "def object_tree\n head, *rest = array_tree\n object_subtree(head,rest)\n end", "def walkthrough\n curNode = @head\n while curNode != nil\n curNode.data.print()\n curNode = curNode.next\n end\n end", "def recursive_inspect(string, indent = 1)\n string << \"<#{inspect_name} #{full_path.inspect}\\n\"\n string << \"#{spacing(indent)}sql = #{to_sql}\\n\" unless to_sql.nil?\n string << \"#{spacing(indent)}parent = #{parent.nil? ? nil.inspect : parent.inspect_name}\"\n string << \"\\n\" unless children.length.zero?\n children.each do |key, child|\n string << \"#{spacing(indent)}#{key} =\\n\"\n string << spacing(indent + 1)\n child.recursive_inspect(string, indent + 2)\n end\n string << \"\\n\" if children.length.zero? && value?\n string << \"#{spacing(indent)}value = #{value.inspect}\" if value?\n\n string << if children.length.zero?\n \">\\n\"\n else\n \"#{spacing(indent - 1)}>\\n\"\n end\n end", "def _display_tree(max_length=20, tabs='')\n\t\tif(@type != '')\n\t\t\tprint(tabs + \"[\" + @type + ((@param != '')? '(' + @param.to_s + ')': '') + \"]\\n\")\n\t\telse\n\t\t\tprint(tabs + \"[TEMPLATE:\" + @template.template_file + \"]\\n\")\n\t\tend\n\n\t\tfor content in @contents\n\t\t\tif(content.is_a?(SifterElement))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telsif(content.is_a?(SifterTemplate))\n\t\t\t\tcontent._display_tree(max_length, tabs + \"\\t\")\n\t\t\telse\n\t\t\t\tcontent.gsub!(/[\\r\\n]/, ' ')\n\t\t\t\tprint(tabs + \"\\t[TEXT:\" + content[0, max_length] + \"]\\n\")\n\t\t\tend\n\t\tend\n\tend", "def print_tags(this_object, this_object_class)\n begin\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n tags = Array.wrap(this_object.tags)\n if tags.length.zero?\n print_line($recursion_level, \"--- no tags ---\")\n else\n print_line($recursion_level, \"--- tags follow ---\")\n tags.sort.each do |tag|\n print_line($recursion_level, \"#{tag}\")\n end\n print_line($recursion_level, \"--- end of tags ---\")\n end\n else\n print_line($recursion_level, \"--- object is not taggable ---\")\n end\n else\n print_line($recursion_level, \"--- no tags, or object is not taggable ---\")\n end\n \n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} gives a NoMethodError when the :tags method is accessed (product bug?) ***\")\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_tags) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def _dump(depth)\n inject(\"\") { |str, node| str << node.dump_node << self.class.node_sep }\n end", "def walk_association(object_string, association, associated_objects)\n begin\n #\n # Assemble some fake code to make it look like we're iterating though associations (plural)\n #\n number_of_associated_objects = associated_objects.length\n if is_plural?(association)\n assignment_string = \"#{object_string}.#{association}.each do |#{association.singularize}|\"\n else\n assignment_string = \"#{association} = #{object_string}.#{association}\"\n end\n print_line($recursion_level, \"#{assignment_string}\")\n associated_objects.each do |associated_object|\n associated_object_class = \"#{associated_object.method_missing(:class)}\".demodulize\n associated_object_id = associated_object.id rescue associated_object.object_id\n print_line($recursion_level, \"(object type: #{associated_object_class}, object ID: #{associated_object_id})\")\n if is_plural?(association)\n walk_object(\"#{association.singularize}\", associated_object)\n if number_of_associated_objects > 1\n print_line($recursion_level,\n \"--- next #{association.singularize} ---\")\n number_of_associated_objects -= 1\n else\n print_line($recursion_level,\n \"--- end of #{object_string}.#{association}.each do |#{association.singularize}| ---\")\n end\n else\n walk_object(\"#{association}\", associated_object)\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_association) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend", "def print_tree(level = 0)\n if is_root?\n print \"\\n*\"\n else\n print \"|\" unless parent.is_root?\n print(' ' * (level - 1) * 4)\n print(is_root? ? \"+\" : \"|\")\n print \"---\"\n print(has_children? ? \"+\" : \">\")\n end\n\n if content\n content_hash = content.split(\"[\").first\n else\n content_hash = nil\n end\n\n puts \" #{content}\" + \" <Type: \" + (@node_type || \"no_type\") + \">\"\n\n children { |child| child.print_tree(level + 1)}\n end", "def print_tree(tree)\n return \"-\" if tree.nil?\n puts \"#{tree.value}: \"\n print \"Left: \"\n puts \"#{print_tree(tree.children[0])}\"\n print \"Right: \"\n puts \"#{print_tree(tree.children[1])}\"\nend", "def inspect_ancestry_tree(output = '', _indent_level = 0, _options = {})\n # Walk up ancestry first\n if parent\n parent.inspect_ancestry_tree(output, _indent_level + 1, _options)\n end\n output << element_summary(_indent_level, _options)\n output << \"\\n\"\n output\n end", "def print_r prefix=\"\", daughters=false\n\t\tputs \"#{prefix}#{@e}\"\n\t\tif @children\n\t\t\t(daughters ? @daughters : @children).each do |child|\n\t\t\t\tchild.print_r \"#{prefix}\\t\", daughters\n\t\t\tend\n\t\tend\n\tend", "def walk(elements, max_depth, *args)\n output = ''\n\n # invalid parameter or nothing to walk\n return output if max_depth < -1 || elements.blank?\n\n parent_field = @db_fields[:parent]\n\n # flat display\n if -1 == max_depth\n empty_array = {}\n elements.each do |e|\n display_element(e, empty_array, 1, 0, args, output)\n end\n return output\n end\n\n # Need to display in hierarchical order.\n # Separate elements into two buckets: top level and children elements.\n # Children_elements is two dimensional array, eg.\n # Children_elements[10][] contains all sub-elements whose parent is 10.\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if e.send(parent_field).blank? || e.send(parent_field) == 0\n top_level_elements << e\n else\n children_elements[e.send(parent_field)] ||= []\n children_elements[e.send(parent_field)] << e\n end\n end\n\n # When none of the elements is top level.\n # Assume the first one must be root of the sub elements.\n if top_level_elements.blank?\n root = elements.first\n\n top_level_elements = []\n children_elements = {}\n elements.each do |e|\n if root.send(parent_field) == e.send(parent_field)\n top_level_elements << e\n else\n children_elements[e.send(parent_field).to_i] ||= []\n children_elements[e.send(parent_field).to_i] << e\n end\n end\n end\n\n top_level_elements.each do |e|\n display_element(e, children_elements, max_depth, 0, args, output)\n end\n\n # If we are displaying all levels, and remaining children_elements is not empty,\n # then we got orphans, which should be displayed regardless.\n if max_depth == 0 && !children_elements.empty?\n empty_array = {}\n children_elements.values.each do |orphans|\n orphans.each do |op|\n display_element(op, empty_array, 1, 0, args, output)\n end\n end\n end\n output\n end", "def print\n puts SEPARATOR\n puts @name\n puts SEPARATOR\n puts @desc\n if(@diagram)\n puts\n puts \"Diagram:\"\n puts\n puts @diagram\n end\n end", "def level_order_print(tree)\n unless tree\n return\n end\n\n nodes = [tree]\n current_line_count = 1\n next_line_count = 0\n\n while nodes.length != 0\n current_node = nodes.shift\n current_line_count -= 1\n print current_node.key.to_s + ' '\n if current_node.left_child\n nodes.push(current_node.left_child)\n next_line_count += 1\n end\n if current_node.right_child\n nodes.push(current_node.right_child)\n next_line_count += 1\n end\n if current_line_count == 0\n # finished printing current level\n puts ''\n current_line_count = next_line_count\n next_line_count = current_line_count\n end\n end\nend", "def checked_print object = ''\n print object\n @prev_printed = true\n end", "def dprint(obj)\n self.log_puts(Php4r.print_r(obj, true))\n end", "def full_hierarchy\n hierarchy = []\n current_location = self\n hierarchy << current_location.name\n while(1)\n if (current_location.location)\n location = current_location.location\n hierarchy << location.name\n current_location = location\n else\n break\n end\n end\n hierarchy.reverse.map {|h| h}.join(\", \")\n end", "def printTree()\n def pTree(node, i)\n puts node.toString i\n node.children.each do|child|\n pTree(child, i+1)\n end\n end\n pTree(@root, 0)\n end", "def output_hierarchy(table)\n output_string = \"%3d %-60s %4s %10s\" \n @stdout.puts\n @stdout.puts 'File Hierarchy'.bold\n @stdout.puts \"%3s %-60s %4s %10s\" % ['Lvl', 'File','Type','Size']\n @stdout.puts '-'*80\n sum_size = 0\n sum_not_existing = 0\n sum_xml_err = 0\n table.each do |t|\n output = output_string % [t[:level],\n format_name(t[:level],t[:path]),\n t[:type].to_s,\n format_size(t[:size])]\n sum_size += t[:size]\n if t[:status] == FileData::STATUS_NOT_FOUND\n @stdout.puts output.red\n sum_not_existing += 1\n elsif t[:status] == FileData::STATUS_ERR\n @stdout.puts output.red\n sum_xml_err += 1 \n else\n @stdout.puts output\n end\n end\n @stdout.puts '-'*80\n summary = \"#{table.length} file(s) with approx. #{format_size(sum_size)}.\"\n if sum_not_existing > 0\n summary += \" #{sum_not_existing} file(s) not found.\".red\n end\n if sum_xml_err > 0\n summary += \" #{sum_xml_err} file(s) with errors.\".red\n end\n @stdout.puts summary\n end", "def _debug_routing_tree\n\n puts self.path + \" - #{self.route_mode}\"\n @endpoints.each do |route|\n puts \"\\t#{route[:method].to_s.upcase} to ##{self.action_for route} (#{self.action_mode})\"\n end\n @subroutes.each do |k, subroute| subroute._debug_routing_tree end\n\n end", "def getObjectChildren _obj, _args\n \"_obj getObjectChildren _args;\" \n end", "def print_elements(elements)\n text = \"\"\n elements.each do |child|\n text << \"parent = \" + child[:parent] + \"<br>\" if !child[:parent].nil?\n text << \"tag = \" + child[:tag] + \"<br>\" if !child[:tag].nil?\n text << \"attribute = \" + child[:attribute] + \"<br>\" if !child[:attribute].nil?\n text << \"value = \" + child[:value] + \"<br>\" if !child[:value].nil?\n text << \"content = \" + child[:content] + \"<br>\" if !child[:content].nil?\n text << \"<hr>\"\n end\n text\n end", "def get_childs(recursive, ret_obj)\n\n return self.class.get_childs(self.id, recursive, ret_obj)\n end", "def printnodes(node, level)\r\n\theader(level)\r\n\tputs node\r\n\tif node.nodes?\r\n\t\ttemp = Array.new\r\n\t\tnode.nodes.each { |n|\r\n\t\t\tif n == nil\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs \":\"\r\n\t\t\telsif n == node.parent\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\telsif !temp.include?(n)\r\n\t\t\t\ttemp << n\r\n\t\t\telse\r\n\t\t\t\theader(level + 1)\r\n\t\t\t\tputs node\r\n\t\t\tend\r\n\t\t}\r\n\t\tif !temp.empty?\r\n\t\t\ttemp.each { |n|\r\n\t\t\t\tprintnodes(n, level + 1)\r\n\t\t\t}\r\n\t\tend\r\n\tend\r\nend", "def cmd_tree\n print_tree(Editor, 0)\n end", "def safe_dump_recurse(object, limit = @limit, objects = default_objects)\n\t\t\t\tif limit <= 0 || objects[object]\n\t\t\t\t\treturn replacement_for(object)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tcase object\n\t\t\t\twhen Hash\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\tobject.to_h do |key, value|\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tString(key).encode(@encoding, invalid: :replace, undef: :replace),\n\t\t\t\t\t\t\tsafe_dump_recurse(value, limit - 1, objects)\n\t\t\t\t\t\t]\n\t\t\t\t\tend\n\t\t\t\twhen Array\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\tobject.map do |value|\n\t\t\t\t\t\tsafe_dump_recurse(value, limit - 1, objects)\n\t\t\t\t\tend\n\t\t\t\twhen String\n\t\t\t\t\tobject.encode(@encoding, invalid: :replace, undef: :replace)\n\t\t\t\twhen Numeric, TrueClass, FalseClass, NilClass\n\t\t\t\t\tobject\n\t\t\t\telse\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\t# We could do something like this but the chance `as_json` will blow up.\n\t\t\t\t\t# We'd need to be extremely careful about it.\n\t\t\t\t\t# if object.respond_to?(:as_json)\n\t\t\t\t\t# \tsafe_dump_recurse(object.as_json, limit - 1, objects)\n\t\t\t\t\t# else\n\t\t\t\t\t\n\t\t\t\t\tsafe_dump_recurse(object.to_s, limit - 1, objects)\n\t\t\t\tend\n\t\t\tend", "def print_object(object, threshold = '')\n out = '{' + \"\\n\"\n out << threshold + '\"ressource_type\": \"' + object.class.to_s + '\"' + \"\\n\"\n out << threshold + ',\"instance_name\": \"' + object.instance_name + '\"' + \"\\n\"\n\n object.list_of_attributes.each do |a|\n out << print_attribute(a.to_s, object.get_value(a.to_s), threshold)\n end\n out << '}'\n end", "def pprint(object)\n PP.pp(object)\nend", "def recursiveTreeTraversal(element)\n if StereotypesHelper.hasStereotype(element, $veStereotype)\n findRefinedParameters(element)\n end\n for child in element.getOwnedElement()\n recursiveTreeTraversal(child)\n end\nend", "def print_methods(object_string, this_object)\n begin\n #\n # Only dump the methods of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"Class of remote DRb::DRbObject is: #{this_object.method_missing(:class)}\") if $debug\n #\n # Get the instance methods of the class and convert to string\n #\n if this_object.method_missing(:class).respond_to?(:instance_methods)\n instance_methods = this_object.method_missing(:class).instance_methods.map { |x| x.to_s }\n #\n # Now we need to remove method names that we're not interested in...\n #\n # ...attribute names...\n #\n attributes = []\n if this_object.respond_to?(:attributes)\n if this_object.attributes.respond_to? :each\n this_object.attributes.each do |key, value|\n attributes << key\n end\n end\n end\n attributes << \"attributes\"\n $evm.log(\"info\", \"Removing attributes: #{instance_methods & attributes}\") if $debug\n instance_methods -= attributes\n #\n # ...association names...\n #\n associations = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n end\n associations << \"associations\"\n $evm.log(\"info\", \"Removing associations: #{instance_methods & associations}\") if $debug\n instance_methods -= associations\n #\n # ...virtual column names...\n #\n virtual_column_names = []\n virtual_column_names = this_object.method_missing(:virtual_column_names)\n virtual_column_names << \"virtual_column_names\"\n $evm.log(\"info\", \"Removing virtual_column_names: #{instance_methods & virtual_column_names}\") if $debug\n instance_methods -= virtual_column_names\n #\n # ... MiqAeServiceModelBase methods ...\n #\n $evm.log(\"info\", \"Removing MiqAeServiceModelBase methods: \" \\\n \"#{instance_methods & $service_mode_base_instance_methods}\") if $debug\n instance_methods -= $service_mode_base_instance_methods\n #\n # Add in the base methods as it's useful to show that they can be used with this object\n #\n instance_methods += ['inspect', 'inspect_all', 'reload', 'model_suffix']\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n else\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n #\n # and finally dump out the list\n #\n if instance_methods.length.zero?\n print_line($recursion_level, \"--- no methods ---\")\n else\n print_line($recursion_level, \"--- methods follow ---\")\n instance_methods.sort.each do |instance_method|\n print_line($recursion_level, \"#{object_string}.#{instance_method}\")\n end\n print_line($recursion_level, \"--- end of methods ---\")\n end\n else\n print_line($recursion_level, \"--- no methods ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_methods) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def dump_tags(object)\n return if object.tags.nil?\n\n $evm.log(\"info\", \" Begin Tags [object.tags]\")\n object.tags.sort.each do |tag_element|\n tag_text = tag_element.split('/')\n $evm.log(\"info\", \" Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")\n end\n $evm.log(\"info\", \" End Tags [object.tags]\")\n $evm.log(\"info\", \"\")\nend", "def list_recur_print(item, desc = 0)\n item.children.each do |child|\n next if child.hidden?\n print_item child, desc\n list_recur_print(child, desc + 2)\n end\n end", "def print_all_children( window_handle, findTextOnly = false )\n\t\t\t@findTextOnly = findTextOnly\n\t\t\t\n\t\t\t# Process the parent window.\n\t\t\tif (@allChildren[window_handle] == nil)\n\t\t\t\tprintControlInfo( 0, window_handle )\n\t\t\t\t@allChildren[window_handle] = 1\n\t\t\tend\n\t\n\t\t\t# Enumerate the control's children.\n\t\t\tif (@childProcCalled[window_handle] == nil)\n\t\t\t\t# Enumeration has not been called on this control, so call it.\n\t\t\t\t@@EnumChildWindows.call(window_handle, @PrintChildInfoProc,\n\t\t\t\t\twindow_handle)\n\t\t\t\t@childProcCalled[window_handle] = 1\n\t\t\t\t\n\t\t\t\t# While the array of children to call is not empty, recurse\n\t\t\t\t# children.\n\t\t\t\twhile (@childrenToCall.first != nil)\n\t\t\t\t\thandle = @childrenToCall.shift\n\t\t\t\t\tprint_all_children( handle )\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def print_debug\n\t\tprint_divider\n\t\tputs \"Root Node: \\n\" + root.to_s\n\t\tprint_divider\n\t\t\n\t\tputs \"Current Node: \\n\" + @current_node.to_s\n\t\tprint_divider\n\t\t\n\t\tputs \"Attributes: \\n\" + attributes.to_s\n\t\tprint_divider\n\t\t\n\t\tputs \"Children: \\n\" + children.to_xml\n\t\tprint_divider\n\tend", "def show_ancestors(obj)\n klass = obj.is_a?(Class) ? obj : obj.class\n inc_mods = klass.included_modules\n klass.ancestors.each do |c|\n puts inc_mods.include?(c) ? \"-#{c}\" : \"#{c}\"\n end\n end", "def print()\n current_node = @root_node\n while current_node != nil\n current_node.print()\n current_node = current_node.get_next()\n end\n end", "def dumpVM(vm)\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Attributes [vm.attributes]\")\n vm.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Attributes - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Attributes [vm.attributes]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Associations [vm.associations]\")\n vm.associations.sort.each { |assc| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Associations - #{assc}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Associations [vm.associations]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Hardware Attributes [vm.hardware]\")\n vm.hardware.attributes.each { |k,v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Hardware - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Hardware Attributes [vm.hardware]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Hardware Associations [vm.hardware.associations]\")\n vm.hardware.associations.sort.each { |assc| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> hardware Associations - #{assc}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End hardware Associations [vm.hardware.associations]\")\n $evm.log(\"info\",\"\")\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Neworks [vm.hardware.nics]\")\n vm.hardware.nics.each { |nic| nic.attributes.sort.each { |k,v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> VLAN:<#{nic.device_name}> - #{k}: #{v.inspect}\")}}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Networks [vm.hardware.nics]\")\n $evm.log(\"info\",\"\")\n\n unless vm.ext_management_system.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin EMS [vm.ext_management_system]\")\n vm.ext_management_system.attributes.sort.each { |ems_k, ems_v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> EMS:<#{vm.ext_management_system.name}> #{ems_k} - #{ems_v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End EMS [vm.ext_management_system]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.owner.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Owner [vm.owner]\")\n vm.owner.attributes.each { |k,v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Owner - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Owner [vm.owner]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.operating_system.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Operating System [vm.operating_system]\")\n vm.operating_system.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Operating System - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Operating System [vm.operating_system]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.guest_applications.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Guest Applications [vm.guest_applications]\")\n vm.guest_applications.each { |guest_app| guest_app.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Guest Application:<#{guest_app.name}> - #{k}: #{v.inspect}\")}} unless vm.guest_applications.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Guest Applications [vm.guest_applications]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.snapshots.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Snapshots [vm.snapshots]\")\n vm.snapshots.each { |ss| ss.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Snapshot:<#{ss.name}> - #{k}: #{v.inspect}\")}} unless vm.snapshots.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Snapshots [vm.snapshots]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.storage.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin VM Storage [vm.storage]\")\n vm.storage.attributes.sort.each { |stor_k, stor_v| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Storage:<#{vm.storage.name}> #{stor_k} - #{stor_v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End VM Storage [vm.storage]\")\n $evm.log(\"info\",\"\")\n end\n\n unless vm.tags.nil?\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Tags [vm.tags]\")\n vm.tags.sort.each { |tag_element| tag_text = tag_element.split('/'); $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Tags [vm.tags]\")\n $evm.log(\"info\",\"\")\n end\n\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> Begin Virtual Columns [vm.virtual_column_names]\")\n vm.virtual_column_names.sort.each { |vcn| $evm.log(\"info\", \"#{@method} - VM:<#{vm.name}> Virtual Columns - #{vcn}: #{vm.send(vcn).inspect}\")}\n $evm.log(\"info\",\"#{@method} - VM:<#{vm.name}> End Virtual Columns [vm.virtual_column_names]\")\n $evm.log(\"info\",\"\")\n end", "def dump_associations(my_object, my_object_name)\n if my_object.respond_to?(\"associations\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.associations\")\n my_object.associations.sort.each { |a| self.log(:info, \"#{my_object_name} Association - #{a}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.associations\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No associations for #{my_object_name}\")\n end\n end", "def print(node = root)\n puts %( ) * node.level + \"#{node}\"\n node.children.each do |child|\n print(child)\n end\n true\n end", "def objectList(objects)\n log_debug(\"objectList\") {objects.inspect}\n return if objects.empty?\n\n log_depth do\n objects.each_with_index do |obj, i|\n if i > 0 && (formula?(obj, :object) || blankNodePropertyList?(obj, :object))\n @output.write \", \"\n elsif i > 0\n @output.write \",\\n#{indent(4)}\"\n end\n path(obj, :object)\n end\n end\n end", "def dump\n dump_text = ''\n regions.each do |child|\n dump_text << ' '*child.level << \"[Level: #{child.level}] \" << child.content.to_s << \"\\n\"\n end\n dump_text\n end", "def traverse obj=self, &block\n case\n when obj.respond_to?(:parent?) && obj.respond_to?(:child?)\n block.call obj\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:parent?)\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:child?)\n block.call obj\n end\n end", "def print_relation(object, threshold = '')\n out = ''\n if object.to.is_a?(Array)\n object.to.each do |o|\n out << print_datastructure(o, threshold)\n end\n else\n out << object.to.to_s\n end\n out\n end", "def _inspect(recur_list)\n return \"{}\" if self.size == 0\n return \"{...}\" if recur_list[self.object_id]\n recur_list[self.object_id] = true\n ary=[]\n keys=self.keys\n vals=self.values\n size=keys.size\n i=0\n while i<size\n ary<<(keys[i]._inspect(recur_list) + \"=>\" + vals[i]._inspect(recur_list))\n i+=1\n end\n \"{\"+ary.join(\", \")+\"}\"\n end", "def print_tree(d)\n \n print_tree(d['l']) if d.key?('l')\n print \"#{d['v']},\" if d.key?('v')\n print_tree(d['r']) if d.key?('r')\n \nend", "def p object\n TetCore.break_after_print\n TetCore.real_p(object)\nend", "def print_model(problem)\n problem.objects.each do |_k, v|\n puts ''\n puts ''\n puts print_datastructure(v)\n end\n end", "def print_undocumented_objects; end", "def display_result(obj)\n\t\tnode = obj\n\t\tarr = []\n\t\tn = node.count + 1\n\t\tputs \"From #{@start} to #{@final}\"\n\t\tputs \"Total movements: #{node.count}\"\n\t\tn.times do \n\t\t\tarr << node\n\t\t\tnode = node.parent\n\t\tend\n\n\t\tarr.reverse.each do |item|\n\t\t\tp item.value\n\t\tend\n\t\texit\n\n\tend", "def print(io)\n tree.each_with_index do |(command, event_called_handlerss), index|\n io.puts '+++++++++++++++++++++++++++++++++++' if index == 0\n io.puts \"Command: #{command.class} resulted in #{event_called_handlerss.length} events\"\n event_called_handlerss.each_with_index do |event_called_handlers, i|\n io.puts '' if i > 0\n io.puts \"-- Event #{event_called_handlers.event.class} was handled by:\"\n io.puts \"-- Projectors: [#{event_called_handlers.projectors.join(', ')}]\"\n io.puts \"-- Workflows: [#{event_called_handlers.workflows.join(', ')}]\"\n end\n\n io.puts '+++++++++++++++++++++++++++++++++++'\n end\n end", "def children_objects(type, opts = {})\n self.clone_copy_output.children_objects(level(type), type, opts)\n end", "def pp_object(obj)\n object_address_group(obj) {\n seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|\n breakable\n v = v.to_s if Symbol === v\n text v\n text '='\n group(1) {\n breakable ''\n pp(obj.instance_eval(v))\n }\n }\n }\n end", "def printf(children=nil)\n h = height(@root) + 1\n root = @root\n h.times do |i|\n self.print_level(root, i)\n end\n end" ]
[ "0.6505712", "0.64134264", "0.6296363", "0.59506553", "0.5782438", "0.56913894", "0.56465787", "0.56415635", "0.55538833", "0.5416576", "0.5406604", "0.5405907", "0.54033494", "0.53748494", "0.53709364", "0.53589237", "0.53528774", "0.5324307", "0.5299967", "0.52920884", "0.52693003", "0.5243063", "0.52394134", "0.5230251", "0.52263004", "0.5217961", "0.5203395", "0.5192794", "0.51755816", "0.517437", "0.51604486", "0.51484656", "0.5140508", "0.5111802", "0.5103649", "0.5100666", "0.50909525", "0.50774693", "0.5070578", "0.50615734", "0.50596815", "0.50404555", "0.5027096", "0.50015426", "0.49836153", "0.4981174", "0.49805164", "0.49759117", "0.49712282", "0.49566525", "0.49439615", "0.49399543", "0.49327037", "0.49324217", "0.49291235", "0.49251685", "0.49145344", "0.4905476", "0.48998052", "0.48934466", "0.4892051", "0.4891997", "0.48754242", "0.48736432", "0.48679087", "0.4864889", "0.48573822", "0.4854445", "0.4837559", "0.48230356", "0.4813488", "0.48112637", "0.48036918", "0.47868264", "0.4780642", "0.4776194", "0.47718474", "0.47560892", "0.4755341", "0.4754328", "0.47542617", "0.47533327", "0.4750465", "0.47460666", "0.4744423", "0.47422364", "0.47331032", "0.4732897", "0.47172087", "0.4700965", "0.46955594", "0.46946406", "0.46897963", "0.4688895", "0.46856207", "0.46851143", "0.46797138", "0.46791965", "0.4671975", "0.4669505" ]
0.8389056
0
End of walk_object_hierarchy Method: print_line Purpose: Wraps $evm.log(:info....) Arguments: indent_level: the indentation string string: the actual message to print Returns: Nothing
def print_line(indent_level, string) $evm.log("info", "#{$method}:[#{indent_level.to_s}] #{string}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.object)\")\n else\n print_line(indent_level, \"#{hierarchy.obj_name}\")\n end\n indent_level += 1\n hierarchy.children.each do |child|\n print_automation_objects(indent_level, child)\n end\nend", "def newline\n log\n end", "def log_line(line)\n return if @appium_logger.nil?\n @appium_logger.info(\"Appium:#{@pid}\") { line }\n end", "def entry(log_level = Gml::LOG_LEVEL_INFO, log_entry = \"\", caller_depth = 1)\n if ((log_level <= @options[:log_level]) && (@options[:console] || @options[:output]))\n at = caller_locations()[caller_depth]\n out = \"[#{Time.now.strftime(@options[:time_format])}] #{Gml::LOG_STRINGS[log_level]} \"\n out << \"[#{File.basename(at.absolute_path)}->#{at.label}: #{at.lineno}]\"\n out << \" - \" if log_entry.size > 0\n out << log_entry\n\n @options[:console].puts(out) if @options[:console]\n\n if (@options[:output])\n if (@options[:output].is_a?(IO))\n @options[:output].puts(out)\n\n else\n out << \"\\n\"\n File.write(@options[:output], out, (File.exist?(@options[:output]) ? File.size(@options[:output]) : 0))\n end\n\n end\n\n end\n end", "def print_line(msg='')\n end", "def info_msg(msg)\n @log.puts(msg)\n puts msg\nend", "def log\n each do |node|\n puts node.inspect\n end\n return nil\n end", "def log_line(line)\n if config.colorize_logging\n @@row_even, message_color = if @@row_even\n [false, '4;32;1']\n else\n [true, '4;33;1']\n end\n\n config.logger.info(\" [\\e[#{message_color}m%s\\e[0m] %s\" % [@name, line])\n else\n config.logger.info(\"[%s] %s\" % [@name, line])\n end\n end", "def log(line)\n puts line unless RUBYMOTION_ENV == \"test\"\n end", "def print_item(level:, current_item:)\n # Print the current item\n tabs = \"\\t\" * level\n puts tabs + '+ ' + current_item[:name]\n\n # Print the current item's children\n children = $children_of[current_item[:id]]\n if children && children.length > 0\n children.each do |child|\n print_item(\n level: level + 1, \n current_item: child\n )\n end\n end\nend", "def log_lines\n\n self.each do |line|\n clean_line = line.to_s.chomp.gsub(\"\\\\n\",\"\")\n log.info(x) { line } if clean_line.length > 0\n end\n\n end", "def pretty_print(depth = 0)\n depth.times { STDERR.print ' *' }\n STDERR.print ' '\n STDERR.puts \"#{@name} (#{@id})\"\n @contents.each { |obj| obj.pretty_print(depth + 1) }\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def log(level, msg)\n $evm.log(level,\"#{@org} Automation: #{msg}\")\nend", "def indent_for(line); end", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def output_me(level, print_and_log_me)\n\n print_and_log_me = \"52m_update_maps.rb:\" + print_and_log_me\n puts print_and_log_me\n\n if level == \"debug\"\n logger.debug(print_and_log_me)\n end\n if level == \"info\"\n logger.info(print_and_log_me)\n end\n if level == \"error\"\n logger.error(print_and_log_me)\n end\nend", "def output_me(level, print_and_log_me)\n\n print_and_log_me = \"52m_update_maps.rb:\" + print_and_log_me\n puts print_and_log_me\n\n if level == \"debug\"\n logger.debug(print_and_log_me)\n end\n if level == \"info\"\n logger.info(print_and_log_me)\n end\n if level == \"error\"\n logger.error(print_and_log_me)\n end\nend", "def debug(depth = 0)\n if debug?\n debug_info = yield\n debug_info = debug_info.inspect unless debug_info.is_a?(String)\n debug_info = debug_info.split(\"\\n\").map { |s| \":#{depth.to_s.rjust 4}: #{s}\" }\n output.puts debug_info\n end\n end", "def log(level, message)\n @evm.log(level, \"#{@method_name} - #{message}\")\n end", "def log_stdout(type: :info, message:)\n $stdout.puts log_entry(type, message)\n end", "def newline\n log('')\n end", "def newline\n log('')\n end", "def level_order_print(tree)\n unless tree\n return\n end\n\n nodes = [tree]\n current_line_count = 1\n next_line_count = 0\n\n while nodes.length != 0\n current_node = nodes.shift\n current_line_count -= 1\n print current_node.key.to_s + ' '\n if current_node.left_child\n nodes.push(current_node.left_child)\n next_line_count += 1\n end\n if current_node.right_child\n nodes.push(current_node.right_child)\n next_line_count += 1\n end\n if current_line_count == 0\n # finished printing current level\n puts ''\n current_line_count = next_line_count\n next_line_count = current_line_count\n end\n end\nend", "def better_log desc, &block\n # SET UP THE INDENT TO BE A BLANK SPACE MULTIPLIED BY THE GLOBAL LOGGER DEPTH VARIABLE\n prefix = ' '*$logger_depth\n # PUTS THE STARTING STRING, USING THE STRING PASSED TO THE METHOD\n puts prefix + 'Beginning \"' + desc + '\"...'\n\n # SET UP THE LOGGER DEPTH VARIABLE TO INCREASE THE INDENT BY ONE BLANK SPACE\n $logger_depth = $logger_depth + 1\n \n # CALL THE BLOCK THAT WAS PASSED AS THE SECOND ARGUMENT IN THE METHOD CALL\n result = block.call\n\n # SET UP THE LOGGER DEPTH VARIABLE TO DECREASE THE INDENT BY ONE BLANK SPACE\n $logger_depth = $logger_depth - 1\n\n # PUTS THE ENDING STRING, USING THE STRING PASSED TO THE METHOD, AND THE RESULT RETURNED FROM THE BLOCK\n puts prefix + '...\"' + desc + '\" finished, returning: ' + result.to_s\nend", "def log(msg)\n puts\n puts msg\nend", "def log_info(msg)\n # puts \"-I- #{msg}\"\n @msg_text.insert('end', \"-I- #{msg}\\n\")\n @msg_text.see('end')\n end", "def info(log)\n output.puts log if log_level <= INFO\n end", "def print(io)\n tree.each_with_index do |(command, event_called_handlerss), index|\n io.puts '+++++++++++++++++++++++++++++++++++' if index == 0\n io.puts \"Command: #{command.class} resulted in #{event_called_handlerss.length} events\"\n event_called_handlerss.each_with_index do |event_called_handlers, i|\n io.puts '' if i > 0\n io.puts \"-- Event #{event_called_handlers.event.class} was handled by:\"\n io.puts \"-- Projectors: [#{event_called_handlers.projectors.join(', ')}]\"\n io.puts \"-- Workflows: [#{event_called_handlers.workflows.join(', ')}]\"\n end\n\n io.puts '+++++++++++++++++++++++++++++++++++'\n end\n end", "def print_trail_info\n puts \"Rating: #{self.rating}\"\n puts \"Distance: #{self.distance} mi\"\n puts \"Surface Type(s): #{self.surface}\"\n puts \"Brief Description: #{self.info}\\n\"\n puts \"--------------------------------------------------------------------------------\\n\"\n end", "def logit(message=\"Hello world\", level=:info, depth=2)\n output = self.logmsg(message, depth)\n RAILS_DEFAULT_LOGGER.send(level, output)\n return output\n end", "def ReportLine(line)\n Builtins.y2milestone(\"%1\", line)\n UI.ChangeWidget(Id(:log_view), :LastLine, Ops.add(line, \"\\n\"))\n\n nil\n end", "def log(part, msg, verbose = false, &block)\n if !verbose || verbose && self.project.options[:verbose]\n self.project.shell.say \"\\033[37m#{part.class.to_s}\\033[0m\" + \" : \" + msg.to_s, nil, true\n end\n if block_given?\n begin\n self.project.shell.padding = self.project.shell.padding + 1\n yield\n ensure\n self.project.shell.padding = self.project.shell.padding - 1\n end\n end\n end", "def trail_printer(trail_instance)\n trail_instance.print_info\n 15.times {print \"*\"}\n print \"\\n\"\n end", "def log(message); logger.info(message); end", "def print(depth=0)\n if SYMLINK_TRACE\n if is_file?\n puts \"#{' '*(depth*2)} #{@name} => #{@target}\"\n elsif is_dir?\n puts \"#{' '*(depth*2)} [#{@name}] => #{@target}\"\n elsif @target\n puts \"#{' '*(depth*2)} [#{@name}] => #{@target} [missing?]\"\n else\n puts \"#{' '*(depth*2)} [#{@name}]\" if @target\n end\n end\n for node in children\n node.print depth+1\n end\n end", "def info message; write INFO, message, caller[0] unless level > @level end", "def output_line(line)\n output = line[:mode] + ' '\n output << line[:repl] + ' '\n output << line[:owner].ljust(@alignment[:owner]) + ' '\n output << line[:group].ljust(@alignment[:group]) + ' '\n output << line[:size].rjust(@alignment[:size]) + ' '\n output << line[:time] + ' '\n output << line[:name] + \"\\n\"\n puts output\n end", "def log(line)\n Log.info(\"#{@indexer_name} [#{Time.now}] #{line}\")\n end", "def log(msg)\n puts msg if @verbose\n end", "def log(msg)\n puts msg if @verbose\n end", "def print_tree(array , item, level)\n items = array[item]\n unless items == nil\n indent = level > 0 ? sprintf(\"%#{level * 2}s\", \" \") : \"\"\n items.each do |e|\n puts \"#{indent}-#{e[:title]}\"\n print_tree(e, level + 1)\n end\n end\nend", "def print_tree(indent = 0, lines = [])\n lines << (\" \" * indent) + self.to_s\n @nodes.keys.sort.each do |reference|\n node = @nodes[reference]\n if node.is_a? APISpec::Namespace\n node.print_tree(indent + 1, lines)\n else\n lines << (\" \" * (indent + 1)) + \"#{reference} => #{node.to_s}\"\n end\n end\n lines.join(\"\\n\")\n end", "def at_line(context, _file, _line)\n resume_pry(context)\n end", "def at_line\n resume_pry\n end", "def puts(msg, caller_depth = 0)\r\n SAF.info(message: msg, caller_depth: caller_depth)\r\n end", "def find_dump(file, timestamp=nil, tempfile=nil)\n found_timestamp = false\n dump_start = 0\n id = nil\n version = nil\n file.seek(0)\n file.each do |line|\n match = @object_walker_start_re.match(line)\n if match\n id = match[:id]\n version = match[:version]\n unless timestamp.nil?\n if timestamp == match[:timestamp]\n dump_start = file.pos - line.length\n found_timestamp = true\n break\n end\n end\n #\n # Default is to dump the last object_walker run\n #\n dump_start = file.pos - line.length\n end\n end\n unless timestamp.nil?\n unless found_timestamp\n raise \"Timestamp: #{timestamp} not found in log file\"\n end\n end\n #\n # Now rewind to the specified dump output and print the object_walker dump\n #\n file.seek(dump_start)\n indent_level = 0\n debug_output = false\n file.each do |line|\n #\n # A rails logger debug line might add many lines of output to automation.log\n # and we need to ignore this\n #\n debug_output = true if @debug_line_re.match(line)\n debug_output = false if @non_debug_line_re.match(line)\n \n match = @object_walker_start_re.match(line)\n if match\n if match[:id] == id\n if tempfile.nil?\n puts \"#{match[:output]}\"\n else\n tempfile.write(\"#{match[:output]}\\n\")\n end\n end\n next\n end\n match = @object_walker_body_re.match(line)\n if match\n if match[:continuation_line] && !debug_output\n unless line =~ /^\\/.*\\d+:in .*$/ # ignore stack trace lines\n if tempfile.nil?\n puts \"#{indent_level_to_string(indent_level)}#{line}\"\n else\n tempfile.write(\"#{indent_level_to_string(indent_level)}#{line}\\n\")\n end\n end\n elsif match[:id] == id\n if match[:indent_level]\n indent_level = match[:indent_level]\n end\n if tempfile.nil?\n puts \"#{indent_level_to_string(indent_level)}#{match[:output]}\"\n else\n tempfile.write(\"#{indent_level_to_string(indent_level)}#{match[:output]}\\n\")\n end\n end\n next\n end\n match = @object_walker_end_re.match(line)\n if match\n if match[:id] == id\n if tempfile.nil?\n puts \"#{match[:output]}\"\n else\n tempfile.write(\"#{match[:output]}\\n\")\n end\n break\n end\n end\n end\nend", "def log(header = \"no header\", obj = nil)\n msg = fmt_log(header, obj)\n PatentAgent.logger.info msg\n obj \n end", "def log(str, newline = true)\n @out.print(str)\n @out.print(\"\\n\") if newline\n end", "def log_or_trace_with_block_ call_depth, severity, argv, &block\n\n\t\tif :trace == severity\n\n\t\t\treturn ::Pantheios::Core.trace_v_impl self, 1 + call_depth, nil, severity, argv, &block\n\t\tend\n\n\t\t::Pantheios::Core.log_v_impl self, severity, argv, &block\n\tend", "def log(text)\n puts text\n end", "def info(msg) log(6, msg); end", "def output( line )\n puts( line ) \n end", "def log(msg)\n print \" \" if $trace && $verbose\n puts msg if $verbose\n end", "def tree_at(line, column); end", "def print_in_same_line(log_string)\n print log_string + \"\\r\"\n end", "def logbegin string, loglevel = 0, component = nil\n log string, loglevel, component\n @@indentation_level += 1\n LOGGERS.each {|logger|\n logger.change_indent(true)\n }\nend", "def info_ln(message)\n write_message message, 'info', true\n end", "def print_a_line(printer, string)\n printer.print_line string\nend", "def kit_to_console(kit, indent_level=0)\n unless kit.is_a?(Kit)\n raise ArgumentError.new \"Passed a different object into a Kit presenter\"\n end\n\n # Print the first 3 fields before families.\n [:id, :name, :domains].each do |attr| \n indented_puts \"#{attr.to_s}: #{kit.send(attr)}\", indent_level \n end\n\n # Families have to be handled specially.\n indented_puts \"families:\", indent_level\n kit.families.each_with_index do |f, index|\n indented_puts \"family ##{index + 1}:\", indent_level + 1\n font_family_to_console(f, indent_level + 2)\n end\n\n # Print the remaining field.\n indented_puts \"optimize_performance: #{kit.optimize_performance}\", indent_level\n end", "def nesting_at(line_number)\n Pry::Indent.nesting_at(raw, line_number)\n end", "def detail\n \"#{line}\\n#{' ' * line_offset}^\"\n end", "def log(msg)\n puts msg\n end", "def puts(line)\n events.stream_output(:profiler, line+\"\\n\")\n end", "def send_log(line, level = :DEBUG)\n log = FastlaneCI::Proto::Log.new(message: line, timestamp: Time.now.to_i, level: level)\n @yielder << FastlaneCI::Proto::InvocationResponse.new(log: log)\n end", "def debug(buffer=\"\", show_source=false, indent=0)\n types = semantic_types.join(', ')\n semvalue = semantic_value.inspect.gsub(/\\n/, '\\n')\n if key_in_parent.nil? \n buffer << \" \"*indent << \"Leaf(#{types})[#{semvalue}]\\n\"\n else\n buffer << \" \"*indent << \":#{key_in_parent} => Leaf(#{types})[#{semvalue}]\\n\"\n end\n buffer\n end", "def info(msg); @logger.info(msg); end", "def print(depth)\n spaces = \" \".freeze * depth\n \"#{left_stats} #{spaces} └── #{@node.name}\"\n end", "def log_line(line)\n puts \"cron_task:continuous:#{@process_name} : #{line}\"\n end", "def KLDALog(text)\n $logFile.puts(\"======[KLDA Log] \" + text.to_s + \"======\\n\")\n end", "def printGivenLevel(root , level, myLambda)\n if root == nil\n return\n end \n if level == 1\n myLambda.call(root)\n else\n if level > 1 \n printGivenLevel(root.getLeft() , level - 1, myLambda)\n printGivenLevel(root.getRight() , level - 1, myLambda)\n end\n end\n end", "def log_verbose(log_entry = \"\")\n entry(Gml::LOG_LEVEL_VERBOSE, log_entry, 1)\n end", "def level_order_traversal(node)\n h = height(node)\n (1..h).each do |n|\n print_given_level(node, n)\n end\nend", "def write(level, message)\n if Boxlet.debug?\n if message.is_a? String\n puts message\n else\n pp message\n end\n else\n if level == :info\n pp message\n end\n @log.call(level, message)\n end\n end", "def log(phrase)\n puts \"INFO: \" + phrase\nend", "def log(message)\n puts message\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def log(level, msg)\n $evm.log(level,\"#{@org} Customization: #{msg}\")\n end", "def receive_line(line)\n Invoker::Logger.puts \"#{@command_label.color(color)} : #{line}\"\n end", "def print(node = root)\n puts %( ) * node.level + \"#{node}\"\n node.children.each do |child|\n print(child)\n end\n true\n end", "def trace(msg)\n @self_logs.file.info(msg)\n @self_logs.stdout.info(msg) if @self_logs.stdout\n end", "def doing_print(activity, line_num, file_read)\n activity.shift\n print_expression(activity, line_num, file_read)\n end", "def print (client, line)\n if client != nil \n client.puts(line)\n end\n puts line\n end", "def log\n Proc.new { |target| puts target }\n end", "def indent_level(line)\n count_indent(line)/$default_indent\nend", "def gamelog(line)\r\nend", "def info(msg)\n puts \"\\n ==> #{msg}\"\nend", "def print_depth(item)\n return if item.hidden?\n print_item item, 0\n list_recur_print item, 2\n end", "def log(line)\n\t\tfile=File.open(@output_file,\"a+\")\n\t\tfile.puts(line)\n\t\tfile.close\n\tend", "def fprint(object, depth = 0)\n #puts \"%10s\" % [\"foo\"]\n puts \"%10s\" % [object.to_s]\nend" ]
[ "0.6409883", "0.58165276", "0.58151895", "0.5685281", "0.5683016", "0.5590414", "0.5551198", "0.55332106", "0.5520638", "0.55091083", "0.550132", "0.54611546", "0.54556197", "0.54556197", "0.54556197", "0.54556197", "0.54556197", "0.54556197", "0.54080385", "0.53998536", "0.5353951", "0.5353951", "0.5345407", "0.5335251", "0.5334852", "0.5322459", "0.5322459", "0.5320555", "0.52978694", "0.5257301", "0.52479786", "0.52390623", "0.5230571", "0.5226333", "0.5220521", "0.52193254", "0.5215973", "0.52151597", "0.52142054", "0.5212554", "0.52111995", "0.5208334", "0.5206348", "0.51963025", "0.51963025", "0.51785976", "0.517203", "0.5158858", "0.51567936", "0.5152933", "0.51517403", "0.51481", "0.5136852", "0.5136787", "0.5128411", "0.51263845", "0.51182854", "0.51180255", "0.511522", "0.51118153", "0.5110943", "0.5088911", "0.5088832", "0.5086512", "0.50826305", "0.5077962", "0.50630355", "0.50594723", "0.5058257", "0.50440824", "0.5022656", "0.5022503", "0.50167507", "0.50162", "0.5016161", "0.50099564", "0.4997899", "0.4990971", "0.4990725", "0.49872229", "0.4982507", "0.4982507", "0.4982507", "0.4982507", "0.4982507", "0.4982507", "0.4982507", "0.4982507", "0.49800828", "0.4976482", "0.4960678", "0.49482602", "0.49431312", "0.49346614", "0.4926985", "0.4922498", "0.49196848", "0.49179587", "0.4909015", "0.49060515" ]
0.7413576
0
End of print_linedumps Method: type Purpose: Returns a string containing the type of the object passed as an argument Arguments: object: object to be type tested Returns: string
def type(object) if object.is_a?(DRb::DRbObject) string = "(type: #{object.class}, URI: #{object.__drburi()})" else string = "(type: #{object.class})" end return string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def typeOf _args\n \"typeOf _args;\" \n end", "def inspect\n list = kwargs.empty? ? [*args] : [*args, **kwargs]\n list << codeblock.to_s if codeblock\n list = list.map(&:inspect).join ', '\n the_type = type ? type.inspect : ''\n \"#{the_type}[#{list}]\"\n end", "def whatami( obj )\n\tputs \"#{obj.to_s} is a #{obj.class}\"\nend", "def type _args\n \"type _args;\" \n end", "def to_s\n \"#{@type}#{@type ? ' ' : ''}#{to_ruby_arg}\"\n end", "def print_class(*) end", "def type() end", "def describe_type\n puts \"I am a #{type} of Bees Wax\"\n end", "def inspect\n \"#<#{self.class}:#{type_sym}:#{object_id.to_s(16)}>\"\n end", "def object_type object\n object.class.to_s.underscore\n end", "def test_print_singular_ruby\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby in Town.\\n\") {p.print_one_type([1,0],'Town')}\n\tend", "def describe_type\n puts \"I am a #{type} type of Bees Wax\"\nend", "def display_type\n \"I am a #{@type}\"\n end", "def to_s\n type\n end", "def any_to_s(obj)\n obj.to_s + \":#{obj.class}\"\n rescue\n sprintf(\"#<%s:0x%lx>\", obj.class, obj.__id__)\n end", "def explain_types; end", "def test_print_both_singular\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby and 1 fake ruby in Town.\\n\") {p.print_both_types([1,1],'Town')}\n\tend", "def typeprint( value, sep, oport )\n #oport.printf \"each: value: %s: \\\"%s\\\"\\n\", value.class, value\n if ( value.instance_of?( Array ) ) then\n oport.printf \"[ \" \n for i in 0...(value.length-1)\n typeprint( value[ i ], \", \", oport )\n end\n typeprint( value[ value.length-1 ], \" ]\", oport )\n oport.printf \"%s\", sep\n elsif ( value.instance_of?( Fixnum ) ) then\n oport.printf \"%d%s\", value, sep\n elsif ( value.instance_of?( Float ) ) then\n oport.printf \"%22.15e%s\", value, sep\n elsif ( value.instance_of?( String ) ) then\n oport.printf \"\\\"%s\\\"%s\", value, sep\n elsif ( value.instance_of?( NZ_eris ) ) then\n oport.printf \"%8svalue = NZ_eris.new( %8d,%8d,%8d,%8d,%22.15e )\\n\",\n \"\", value.get_i, value.get_j, value.get_k, value.get_l, value.get_value\n else\n STDERR.printf \"EMOL FUTIL: Error: class = %s is not supported.\\n\", value\n exit\n end\n end", "def type\n object.class.name\n end", "def type\n object.class.name\n end", "def type\n object.class.name\n end", "def print_datastructure(object, threshold = ' ')\n out = ''\n if object.is_a?(Yarpler::Models::Relation)\n out << print_relation(object, threshold)\n else\n out << print_object(object, threshold)\n end\n out\n end", "def inspect\n \"#{self.class}(#{to_s.inspect})\"\n end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def type_name; end", "def p object\n TetCore.break_after_print\n TetCore.real_p(object)\nend", "def type(*args); end", "def _type\n self.class.to_s\n end", "def __object_type \n @object_type \n end", "def __object_type \n @object_type \n end", "def format(object, type = nil)\n core_class = cast(object, type)\n awesome = if core_class != :self\n send(:\"awesome_#{core_class}\", object) # Core formatters.\n else\n awesome_self(object, type) # Catch all that falls back to object.inspect.\n end\n @options[:html] ? \"<pre>#{awesome}</pre>\" : awesome\n end", "def result_to_string(object)\n if object.is_a?(String) then\n return object\n else\n if defined?(awesome_inspect)\n return object.awesome_inspect({:plain=>true, :index=>false})\n elsif defined?(pretty_inspect)\n return object.pretty_inspect.chomp # Remove new line that PrettyInspect adds at the end https://www.ruby-forum.com/topic/113429\n else\n return object.inspect\n end\n end\n end", "def type_str\n Types.type_str(type)\n end", "def inspect\n \"#<#{self.class} #{to_s}>\"\n end", "def to_s\n \"I am a #{@type} cat.\"\n end", "def get_type\n \"line\"\n end", "def type(type); end", "def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend", "def short_description(object)\n if object.is_a?Class\n \"Class #{object.to_s}\"\n elsif object.is_a?Module\n \"Module #{object.to_s}\"\n elsif object.is_a?(Proc) || object.is_a?(Method) || object.is_a?(UnboundMethod)\n \"#{object.class} #{object.to_s}(#{args_from_arity(object.arity)})\"\n elsif object.is_a?Object \n \"#{object.class.to_s}\"\n end\n end", "def object_type\n first(FIELD_OBJECT_TYPE)\n end", "def type\n self.class.name.split(/#{NSEP}/).last.gsub(/Object$/, '').downcase.to_sym\n end", "def fact_type_dump(fact_type, name)\n @fact_types_dumped[fact_type] = true\n return objectified_fact_type_dump(fact_type.entity_type) if fact_type.entity_type\n\n puts fact_type.scala_definition\n\n @metamodel << fact_type.scala_metamodel\n end", "def print_argument(argument)\n first_class = argument.class\n puts argument\n puts \"argument: #{argument}\"\n puts \"class: #{first_class}\"\n end", "def test_print_singular_fake_ruby\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 fake ruby in Town.\\n\") {p.print_one_type([0,1],'Town')}\n\tend", "def pl(*args)\n str0 = \"=== \" + caller.first + \"\\n\"\n\n str_out = args.inject(str0){|strs, obj| strs + obj.pretty_inspect.to_s}\n\n puts str_out\n str_out\nend", "def inspect\n\t\treturn \"#<%s:0x%07x '%s/%s' q=%0.3f %p>\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id * 2,\n\t\t\tself.type || '*',\n\t\t\tself.subtype || '*',\n\t\t\tself.qvalue,\n\t\t\tself.extensions,\n\t\t]\n\tend", "def type\n @type.to_s\n end", "def check_type(obj)\n if obj.kind_of? Integer\n return 'int'\n elsif obj.kind_of? Float\n return 'float'\n elsif obj.instance_of? String\n return 'string'\n elsif obj.instance_of? TrueClass\n return 'bool'\n elsif obj.instance_of? FalseClass\n return 'bool'\n elsif obj.instance_of? Array\n return 'array'\n else\n raise TypeError, \"check_type: Error - type of object does not exist\"\n end\nend", "def inspect\n \"#{@type} #{@version}\"\n end", "def print_object(object, threshold = '')\n out = '{' + \"\\n\"\n out << threshold + '\"ressource_type\": \"' + object.class.to_s + '\"' + \"\\n\"\n out << threshold + ',\"instance_name\": \"' + object.instance_name + '\"' + \"\\n\"\n\n object.list_of_attributes.each do |a|\n out << print_attribute(a.to_s, object.get_value(a.to_s), threshold)\n end\n out << '}'\n end", "def inspect(*) end", "def inspect(*) end", "def inspect(*) end", "def inspect(*) end", "def inspect(*) end", "def checked_print object = ''\n print object\n @prev_printed = true\n end", "def value_type_chain_dump(o)\n return if o.ordered_dumped\n value_type_chain_dump(o.supertype) if (o.supertype && !o.supertype.ordered_dumped)\n value_type_fork(o)\n o.ordered_dumped!\n end", "def obj_type(ref)\n obj = object(ref)\n obj.class.to_s.to_sym\n end", "def to_s\n return \"[#{@text}:#{@type}]\"\n end", "def fprint(object, depth = 0)\n #puts \"%10s\" % [\"foo\"]\n puts \"%10s\" % [object.to_s]\nend", "def inspect\n result = \"#{self.class}[\"\n each_with_index { |obj, i| result << ', ' if i > 0; result << obj.inspect }\n result << \"]\"\n end", "def test_print_one_singular_one_plural\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby and 2 fake rubies in Town.\\n\") {p.print_both_types([1,2],'Town')}\n\tend", "def display_object type\n\t\t\thorizontal_border = \"+-------+-#{'-'*@name_width}-+-#{'-'*@elapsed_time_width}-+\"\n\t\t\tcase type\n\t\t\twhen :top\n\t\t\t\tputs horizontal_border\n\t\t\t\tif TrackingConfig[:show_header]\n\t\t\t\t\tputs \"| start | #{pad('task', @name_width, :center)} | #{pad('elapsed', @elapsed_time_width, :center)} |\"\n\t\t\t\t\tputs horizontal_border\n\t\t\t\tend\n\t\t\twhen :bottom\n\t\t\t\tputs horizontal_border\n\t\t\twhen :intro\n\t\t\t\tintro_text = <<-EOF\nYou haven't started any tasks yet! :(\n\nRun this to begin your first task:\n tracking starting some work\n\t\t\t\tEOF\n\t\t\t\tintro_text.each_line do |line|\n\t\t\t\t\tputs \"| | #{pad(line.chomp, @name_width)} | #{pad(nil, @elapsed_time_width)} |\"\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def to_s; \"#{@type}#{length_spec}\" end", "def test_print_some_both_types\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby and 2 fake rubies in Town.\\n\") {p.print_day([1,2],'Town')}\n\tend", "def to_s\n self.test_type\n end", "def countType _obj, _args\n \"_obj countType _args;\" \n end", "def type\n _type\n end", "def test_print_one_type\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 1 ruby in Town.\\n\") {p.print_day([1,0],'Town')}\n\tend", "def display_type\n return '' unless @research_output.is_a?(ResearchOutput)\n\n @research_output.research_output_type.humanize.capitalize\n end", "def type2(l)\n\tp \"And my last name is #{l}\"\nend", "def to_s\n TYPES[type.to_sym]\n end", "def print_class_and_superclasses(object)\n object.class.ancestors.each do |klass|\n puts klass\n end\nend", "def dump(value)\n dumped = typecast(value)\n dumped.name if dumped.is_a?(::Class)\n end", "def types; end", "def types; end", "def types; end", "def types; end", "def types; end", "def inspect; to_s; end", "def inspect; to_s; end", "def inspect; to_s; end", "def inspect; to_s; end", "def inspect; to_s; end", "def render(obj)\n # We can't use a case statement here becuase \"when Hash\" doesn't work for\n # ActiveSupport::OrderedHash - respond_to?(:values) is a more reliable\n # indicator of hash-like behavior.\n if NilClass === obj\n print(\"null\")\n \n elsif TrueClass === obj\n print(\"true\")\n \n elsif FalseClass === obj\n print(\"false\")\n \n elsif String === obj\n print(escape_json_string(obj))\n \n elsif Symbol === obj\n print(\"\\\"#{obj}\\\"\")\n \n elsif Numeric === obj\n print(obj.to_s)\n \n elsif Time === obj\n print(obj.to_s)\n \n elsif obj.respond_to?(:keys)\n print(\"{\")\n indent_out\n last_key = obj.keys.last\n obj.each do |(key, val)|\n render(key)\n case val\n when Hash, Array\n indent_out\n print(\":\\n#{indent}\")\n render(val)\n indent_in\n else\n print(\": \")\n render(val)\n end\n print(\",\\n#{indent}\") unless key == last_key\n end\n indent_in\n print(\"}\")\n \n elsif Array === obj\n print(\"[\")\n indent_out\n last_index = obj.size - 1\n obj.each_with_index do |elem, index|\n render(elem)\n print(\",\\n#{indent}\") unless index == last_index\n end\n indent_in\n print(\"]\")\n \n else\n raise \"unrenderable object: #{obj.inspect}\"\n end\n end", "def object_type\n @struct.type\n end", "def inspect() end" ]
[ "0.6857546", "0.68416905", "0.6573879", "0.65488", "0.64716697", "0.6441205", "0.6404657", "0.63842934", "0.6382238", "0.6338627", "0.62704116", "0.6268481", "0.6240276", "0.62342095", "0.6226654", "0.61991847", "0.6177927", "0.6137269", "0.61289823", "0.61289823", "0.61286026", "0.61078066", "0.6100257", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60556483", "0.60424984", "0.60239565", "0.6020683", "0.6020373", "0.6020373", "0.60153604", "0.60141754", "0.5983936", "0.59715664", "0.59581125", "0.59412235", "0.5938717", "0.59112126", "0.58852607", "0.588063", "0.5873769", "0.5858662", "0.5847514", "0.58434194", "0.58387786", "0.581393", "0.5805292", "0.5803776", "0.5799423", "0.5798314", "0.5790355", "0.5790355", "0.5790355", "0.5790355", "0.5790355", "0.5788579", "0.5785695", "0.5784668", "0.5780747", "0.5764887", "0.5759129", "0.575819", "0.5747937", "0.5741533", "0.57309806", "0.57270443", "0.5715342", "0.57090443", "0.5708567", "0.5700719", "0.569693", "0.56940883", "0.5692233", "0.5684577", "0.5683843", "0.5683843", "0.5683843", "0.5683843", "0.5683843", "0.56829107", "0.56829107", "0.56829107", "0.56829107", "0.56829107", "0.56801623", "0.56610835", "0.5641284" ]
0.6753028
2
End of ping_attr Method: str_or_sym Purpose: format a string containing the argument correctly depending on whether the value is a symbol or string Arguments: value: the thing to be stringformatted Returns: string containing either ":value" or "'value'"
def str_or_sym(value) value_as_string = "" if value.is_a?(Symbol) value_as_string = ":#{value}" else value_as_string = "\'#{value}\'" end return value_as_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_str(arg)\n if arg.is_a?(Symbol)\n \":\" + arg.to_s\n elsif arg.nil?\n \"nil\"\n elsif arg.is_a?(String)\n \"'#{arg}'\"\n else\n arg.to_s\n end\n end", "def to_str(arg)\n if arg.is_a?(Symbol)\n \":\" + arg.to_s\n elsif arg.nil?\n \"nil\"\n elsif arg.is_a?(String)\n \"'#{arg}'\"\n else\n arg.to_s\n end\n end", "def _attr_value(value)\n case value\n when ::BuilderSymbol\n value.to_s\n else\n _escape_attribute(value.to_s)\n end\n end", "def stringify_value(value, **args)\n case value\n when String\n (value =~ /'/).present? ? %{\"#{value}\"} : \"'#{value}'\"\n when BigDecimal\n \"#{value}.to_d\"\n when Hash\n PrettifyHash.call(value, indent: current_indent + 1, preceding_chars: args[:preceding_chars])\n when Array\n PrettifyArray.call(value, indent: current_indent + 1, preceding_chars: args[:preceding_chars])\n when nil\n 'nil'\n else\n value.to_s\n end\n end", "def quote_if_needed(value)\n if string_value?(value)\n quote(value)\n else\n value.to_s\n end\n end", "def format_string(record, attribute, val)\n val\n end", "def quote_symbol(value)\n quote_string(value.to_s)\n end", "def value_string(value)\n to_symbol = %w[undef true false]\n if to_symbol.include? value\n return \"`#{value}`\"\n else\n return value\n end\n end", "def format_str(value)\n value ||= '<none>'\n fmt ? (fmt % [value]) : value\n end", "def attr h_or_name\n h_or_name = h_or_name.map { |k,v| \"#{k}=\\\"#{v}\\\"\" }.join \" \" if\n Hash === h_or_name\n\n \"{:#{h_or_name}}\"\n end", "def get_string(attr); end", "def to_sym?(value); end", "def format_value(prop,value)\n case prop\n when :plan_id\n case value\n when 'free' then 'Free'\n when 'silver' then 'Silver'\n else value && value.capitalize || nil\n end\n when :visible_to_ssh?\n value || nil\n when :creation_time, :created_at\n date(value)\n when :scales_from,:scales_to\n (value == -1 ? \"available\" : value)\n when :gear_info\n format_gear_info(value)\n when :base_gear_storage,:additional_gear_storage\n ((value.nil? or value == 0) ? \"None\" : \"#{value}GB\")\n when :aliases\n value.kind_of?(Array) ? value.join(', ') : value\n when :expires_in_seconds\n distance_of_time_in_words(value)\n when :activations\n value.collect{|item| date(item.created_at.to_s)}.join(\"\\n\")\n when :auto_deploy\n value ? 'auto (on git push)' : \"manual (use 'rhc deploy')\"\n else\n case value\n when Array then value.empty? ? '<none>' : value.join(', ')\n else value\n end\n end\n end", "def prepare_format(value)\n return value.name if value.is_a? Symbol\n IMPLICIT_CONVERSION.inject(value) do |value, (method, type)|\n next value unless value.respond_to? method\n type === value ? value : value.public_send(method)\n end\n end", "def create_escape_value(value)\n if value.is_a?(String) || value.is_a?(Symbol)\n \"#{sanitize_escape_sequences(value.to_s)}\"\n else\n value\n end\n end", "def prepare_value(value)\n return value if value.nil? || value.is_a?(String)\n\n value.to_s\n end", "def to_s\n (value.zero?) ? '' : \"#{value}#{symbol}\"\n end", "def attribute(value, default_value=nil)\n str = value.to_s\n not(str.empty?) ? str : default_value\n end", "def should_to_s(value)\n value.inspect\n end", "def should_to_s(value)\n value.inspect\n end", "def should_to_s(value)\n value.inspect\n end", "def should_to_s(value)\n value.inspect\n end", "def should_to_s(value)\n value.inspect\n end", "def should_to_s(value)\n value.inspect\n end", "def to_s\n value.zero? ? '' : \"#{value}#{symbol}\"\n end", "def coerce_string(ctx, value:, **)\n value.to_s\n end", "def write_symbolized_attribute (attr_name, value)\n write_attribute(attr_name, (value.to_sym && value.to_sym.to_s rescue nil))\n end", "def string(value = '')\n return '' unless present?(value)\n\n send(value)\n rescue NoMethodError\n ''\n end", "def attribute_description(key, value)\n case value\n when true\n \"#{key}=anything\"\n when false\n key.to_s\n when Regexp\n \"#{key}=~#{value.inspect}\"\n else\n \"#{key}=#{value.inspect}\"\n end\n end", "def s value\n if value.is_a? String\n return \"\\\"#{value}\\\"\"\n elsif value.is_a? Fixnum\n return \"#{value}\"\n elsif value.is_a? TrueClass or value.is_a? FalseClass\n return \"#{value}\"\n elsif value.is_a? Symbol \n return \".#{value}\"\n elsif value.is_a? Tuple\n res = \"(\"\n\n if value.data.is_a? Array\n res += value.data.map { |item|\n s item\n }.join(\", \")\n else\n res += value.data.map { |k, v|\n \"#{k}: #{s v}\"\n }.join(\", \")\n end\n\n res += \")\"\n\n return res\n elsif value.is_a? Array \n res = \"[\"\n\n value.each_with_index do |item, index| \n res += s item\n if index + 1 < value.count\n res += \", \"\n end\n end\n\n res += \"]\"\n\n return res\n elsif value.is_a? Hash\n res = \"[\"\n\n index = 0\n limit = value.count\n\n value.each do |k, v|\n res += s k\n res += \" : \"\n res += s v\n\n index += 1\n\n if index != limit \n res += \", \"\n end\n end\n \n res += \"]\"\n\n return res\n end\n\n return value.inspect\nend", "def shellify_opt(value)\n value.to_s.gsub('_', '-')\n end", "def to_s\n\t\t\"(#{@type} : '#{@value}')\"\n\tend", "def quote(value)\n case value\n when NilClass then\n \"NULL\"\n when TrueClass then\n \"TRUE\"\n when FalseClass then\n \"FALSE\"\n when Float, Fixnum, Bignum then\n value.to_s\n # BigDecimals need to be output in a non-normalized form and quoted.\n when BigDecimal then\n value.to_s('F')\n else\n value.inspect\n end\n end", "def quote(value) # :doc:\n if value.respond_to? :each_pair\n return value.map do |k, v|\n \"#{k}: #{quote(v)}\"\n end.join(\", \")\n end\n return value.inspect unless value.is_a? String\n\n if value.include?(\"'\")\n value.inspect\n else\n \"'#{value}'\"\n end\n end", "def string_value(value)\r\n value\r\n end", "def to_sym\n return super unless @to_s_sym\n value = self.to_s\n return value.nil? ? value : value.to_sym\n\t\tend", "def quote(value)\n return value.inspect unless value.is_a? String\n\n if value.include?(\"'\")\n value.inspect\n else\n \"'#{value}'\"\n end\n end", "def [](symbol_or_string)\n attributes[symbol_or_string.to_s]\n end", "def def_string sym, name=nil, &block\n def_transform(sym) {|v| \n next nil if v == nil\n v.to_s \n }\n def_checker(sym) { |v|\n # v will be converted to a string, then checked against the optional\n # block... if the block returns false, raise a validation error\n next true if v == nil\n next block.call(v.to_s) if block_given?\n true\n }\n def_alias sym, name if name\n end", "def def_string sym, name=nil, &block\n def_transform(sym) {|v| \n next nil if v == nil\n v.to_s \n }\n def_checker(sym) { |v|\n # v will be converted to a string, then checked against the optional\n # block... if the block returns false, raise a validation error\n next true if v == nil\n next block.call(v.to_s) if block_given?\n true\n }\n def_alias sym, name if name\n end", "def maybe(value)\n append \"(?:#{sanitize value})?\"\n end", "def turn_symbol_into_string(symbol)\n\tn = :foobar\n\tn.to_s\nend", "def quote(value)\n return \"'#{value}'\" if value.is_a?(String)\n\n value.to_s\n end", "def format_ttl_value(value)\n f =\n if value.is_a?(Array)\n value.map { |v0| format_ttl_value v0 }.join(', ')\n elsif value.is_a? Numeric\n value.to_s\n elsif value.match?(%r{\\Ahttp://.*})\n \"<#{value}>\"\n elsif value.match?(/\\A[[:word:]]+:.*/)\n value.to_s\n elsif value['@id']\n \"<#{value['@id']}>\"\n elsif value['@value'] && value['@type']\n \"\\\"#{value['@value']}\\\"^^#{format_ttl_value(value['@type'])}\"\n elsif value['@value']\n \"\\\"#{value['@value']}\\\"\"\n elsif value.is_a? String\n \"\\\"#{value}\\\"\"\n else\n \"\\\"#{value}\\\"^^<#{value.class.name}> # warning: default formatting rule\"\n end\n\n f.html_safe\n end", "def should_to_s(newvalue)\n newvalue.inspect\n end", "def should_to_s(newvalue)\n newvalue.inspect\n end", "def should_to_s(newvalue)\n newvalue.inspect\n end", "def safe_str\n name_component = metric_name.to_s\n name_component << \"-#{default_attribute.gsub(%r{[^\\w]}, '')}\" if default_attribute?\n (namespace << name_component).join('.')\n end", "def create_value(val)\n val ? \"\\\"#{val}\\\"\" : \"\"\n end", "def quote(value)\n case value\n when true then \"'t'\"\n when false then \"'f'\"\n else\n __getobj__.quote(value)\n end\n end", "def format_value v\n case v\n when String\n v.inspect\n when TrueClass\n 'true'\n when FalseClass\n 'false'\n else\n v.to_s\n end\n end", "def format_symbol\n\t\t:format\n\tend", "def to_s\n case @type\n when :name\n \"\\e[36m#{@value}\\e[0m\"\n when :EQ, :EQ_ALT\n @value\n when :prose\n \"\\e[90m<#{@value}>\\e[0m\"\n when :sstring\n \"%s\\e[32m\\\"#{@value}\\\"\\e[0m\"\n when :istring\n \"\\e[32m\\\"#{@value}\\\"\\e[0m\"\n when :terminal\n '%x' + @value.map{|x| \"\\e[33m%02X\\e[0m\" % x }.join('.')\n when :range\n '%x' + @value.map{|x| \"\\e[33m%02X\\e[0m\" % x }.join('-')\n else\n \"\\e[90m<#{@type}>\\e[0m#{@value}\"\n end\n end", "def to_s\n str = \"\"\n\n str << \":#{@prefix} \" unless @prefix.empty?\n str << @command\n\n if @params\n f = false\n @params.each do |param|\n f = !f && (param.empty? || param[0] == ?: || param.include?(\" \"))\n str << \" \"\n str << \":\" if f\n str << param\n end\n end\n\n str << \"\\x0D\\x0A\"\n\n str\n end", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def c_str(name, value=nil, options={})\n\t\tfield(name, Str, value, {:action=>action(NullTerminate)}.merge(options))\n\tend", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def turn_symbol_into_string(symbol)\n symbol.to_s\nend", "def try_to_s(value, key_name)\n raise Siba::CheckError, \"'#{key_name}' option should be string\" if [Array, Hash].any?{|a| value.is_a?(a)}\n value = value.to_s.strip\n raise Siba::CheckError, \"'#{key_name}' option should not be empty\" if value.empty?\n value\n end", "def typecast_value_string(value)\n value.to_s\n end", "def sanitise_string(value, snake_case_keys=false)\n # *disabled* return lower camel case formatted strings\n # return value.to_sym if value =~ /^[a-z]+[A-Z0-9][a-z0-9]+[A-Za-z0-9]*$/\n # remove '$' as prefixes, etc, e.g., $schema and $ref\n str = value.gsub(/[^a-zA-Z0-9_-]/, '')\n # convert to snake case where required\n str = str.underscore if snake_case_keys\n # convert to symbol\n str.to_sym\n end", "def encode_init_value(value)\n if value.is_a?(String)\n \"\\\"#{value}\\\"\"\n elsif [true, false].include?(value)\n value.to_s\n end\n end", "def to_s\n if @value2.nil?\n format('(%s)', @value1.to_s)\n elsif @value2.is_a? Pair\n var = @value2.to_s\n var[0] = ''\n var[var.length - 1] = '' if var[var.length - 1] == ')'\n format('(%s %s)', @value1.to_s, var)\n else\n format('(%s . %s)', @value1.to_s, @value2.to_s)\n end\n end", "def to_symbol(str)\n case str\n when /'/\n \":'\" + str.to_s.gsub(\"'\"){ \"\\\\'\" } + \"'\"\n else\n ':' + str.to_s\n end\n end", "def to_sym() end", "def to_sym() end", "def to_sym() end", "def to_s\n \"#{symbol}\"\n end", "def humanize(symbol)\n human_attr = symbol.to_s.split('_').map(&:capitalize).join(' ')\n end", "def format_value(value)\n case value\n when Numeric\n value.to_s.color(:cyan)\n when String\n value\n when TrueClass\n value.to_s.color(:green)\n when FalseClass\n value.to_s.color(:red)\n when NilClass\n 'nil'.color(:blue)\n else\n value\n end\n end", "def assign_text_param_if_used(attr_name, value)\n\t\tsend \"#{attr_name}=\", value.strip.presence if value\n\tend", "def add_quotes_if_string(value)\n if value.is_a? String\n value = add_quotes_to_string(value)\n end\n value\n end", "def to_s\n b = @b\n b = \"c\" if b == \"\"\n \"#{@a}#{@op}#{maybe_quote(b)}\"\n end", "def t(key, *args)\n key.nil? || (key.is_a?(String) && key.to_s.ends_with?(\".\")) ? \"\" : super\n end", "def is_to_s(currentvalue)\n provider.id2name(currentvalue) || currentvalue\n end", "def to_s(symbols = {})\n if @value.is_a?(Generate::Variable) || @value.is_a?(Color)\n value = @value.to_s(symbols)\n else\n value = @value.to_s\n end\n \n sprintf(self.class.format, @property_name.to_s, value)\n end", "def is_to_s x\n \"(#{@resource[:type]}) #{x}\"\n end", "def bp (name, value)\n if name != \"\" \n return \"\\n$bp-#{name} : #{value};\"\n else\n return \"\"\n end\nend", "def format_str(value)\n value ||= '<none>'\n value = fmt ? (fmt % [value]) : value\n if max_length && (value.is_a? String) && value.length > max_length\n value = value[0..(max_length - 4)]\n value += ('.' * (max_length - value.length))\n end\n value\n end", "def label_for(method, opts_or_val)\n if opts_or_val.is_a?(String)\n return @template.label @object_name, method, opts_or_val\n elsif opts_or_val.is_a?(Hash)\n val = opts_or_val[:val]\n opts_or_val.delete :val\n return @template.label @object_name, method, val, opts_or_val\n end\n end", "def mk_attr_str **attr_map\n attr_map.map{|k,v|\" #{k}='#{v}'\"}.join\n end", "def to_sym\n @name&.to_sym\n end", "def to_sym\n if failure?\n :failure\n else\n :error\n end\n end", "def to_s\n \"#{@type}#{@type ? ' ' : ''}#{to_ruby_arg}\"\n end", "def rdn_from_pair_and_hash( attribute, value, additional_attributes={} )\n\t\tadditional_attributes.merge!( attribute => value )\n\t\treturn additional_attributes.sort_by {|k,v| k.to_s }.\n\t\t\tcollect {|pair| pair.join('=') }.\n\t\t\tjoin('+')\n\tend", "def print_var(str, name, val)\n return if val.nil?\n return if val.class == String && val.empty?\n\n str << \"#{name}=\\\"#{val}\\\"\\n\"\n end", "def format_with_quotes(key, value)\n value = remove_open_quotes(value)\n # Remove leading and trailing single quotes so we don't quote twice\n # if this key is flagged to be wrapped or it contains a special character\n # and it's not a full text field, such as About You\n if !value.nil? && !KEYS_TO_EXCLUDE_FROM_QUOTES.include?(key) && (KEYS_TO_WRAP_IN_QUOTES.include?(key) || /(\\[|\\]|\\(|\\)|: )/ === value)\n return \"'#{value.chomp(\"'\").reverse.chomp(\"'\").reverse}'\"\n else\n return value\n end\n end", "def to_s\n if @sig == nil && @ant == nil\n \"#{@value} \" \n else \n \"#{@value} <-> \" \n end\n end", "def to_s\n unknown? ? 'x' : @value.to_s\n end", "def to_sym; end", "def string(value = '')\n return '' if value.to_sym.empty?\n\n sequences.fetch(value.to_sym, proc { '' }).call\n end", "def dhcp_option_value_str(data, value)\r\n data << value.length.chr\r\n data << value\r\n end", "def to_s\n \"\\\"#{@key}\\\": #{@value}\"\n end", "def show_val(value,\n str_if_empty='____',\n value_style='form_data',\n prefix='',\n suffix='',\n prefix_style='field_label')\n value_style = 'form_data' if value_style.blank?\n isblank = value.blank?\n if isblank && str_if_empty=='suppress'\n return ''\n end\n value = str_if_empty if isblank\n s = ''\n s << \"<span class='#{prefix_style}'>\" + prefix + \"</span>\" unless prefix.blank?\n s << \"<span class='#{value_style}'>#{value}</span>\"\n if (!isblank) && (!suffix.blank?) && (suffix != value.to_s[-1,1])\n s << suffix\t#\tAppend suffix if it not already the last character in the string (e.g., avoids double periods)\n end\n return s.html_safe\n end", "def format(label, value)\n \" - #{label}: #{value}\"\n end", "def to_str; value; end", "def custom_label(key, value)\n return if value == false\n return Allure::ResultUtils.tag_label(value.to_s) if value.is_a?(String) || value.is_a?(Symbol)\n\n Allure::ResultUtils.tag_label(key.to_s)\n end", "def quote(value); end", "def parse_symbol_in_arg\n tk = get_tk\n if :on_symbol == tk[:kind] then\n tk[:text].sub(/^:/, '')\n elsif :on_tstring == tk[:kind] then\n tk[:text][1..-2]\n elsif :on_dstring == tk[:kind] or :on_ident == tk[:kind] then\n nil # ignore\n else\n warn(\"Expected symbol or string, got #{tk.inspect}\") if $DEBUG_RDOC\n nil\n end\n end" ]
[ "0.6580558", "0.6580558", "0.64290214", "0.6374447", "0.6177938", "0.6117355", "0.59964705", "0.5992098", "0.5968117", "0.59486246", "0.58951235", "0.5872423", "0.5849036", "0.58371663", "0.5740083", "0.5713309", "0.5711262", "0.56904596", "0.5686483", "0.5686483", "0.5686483", "0.5686483", "0.5686483", "0.5686483", "0.5673511", "0.5621347", "0.5593007", "0.5586308", "0.55806345", "0.5579201", "0.5577568", "0.5573804", "0.55367374", "0.5526681", "0.5524448", "0.55147487", "0.55112803", "0.5507334", "0.55050427", "0.55050427", "0.549646", "0.5460113", "0.5454023", "0.5442218", "0.5439273", "0.5439273", "0.5439273", "0.5430462", "0.54258084", "0.5405686", "0.5403122", "0.5383163", "0.5376252", "0.5367689", "0.53665733", "0.5364179", "0.53618413", "0.53618413", "0.53618413", "0.53586906", "0.534199", "0.53415436", "0.53325105", "0.5332092", "0.532329", "0.53047866", "0.53047866", "0.53047866", "0.52758473", "0.5273995", "0.52701813", "0.52507627", "0.5248074", "0.5240423", "0.5238044", "0.52338517", "0.52233636", "0.5220861", "0.5216875", "0.51998615", "0.51986325", "0.5195924", "0.51898485", "0.51801795", "0.5169942", "0.5167596", "0.51646215", "0.5159212", "0.51588154", "0.51567304", "0.5156507", "0.5156064", "0.5150696", "0.51380736", "0.5136224", "0.51256436", "0.51228625", "0.5108834", "0.50940645", "0.50912154" ]
0.7422172
0
End of str_or_sym Method: print_attributes Purpose: Print the attributes of an object Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose virtual_column_names are to be dumped Returns: None
def print_attributes(object_string, this_object) begin # # Print the attributes of this object # if this_object.respond_to?(:attributes) print_line($recursion_level, "Debug: this_object.inspected = #{this_object.inspect}") if $debug if this_object.attributes.respond_to?(:keys) if this_object.attributes.keys.length > 0 print_line($recursion_level, "--- attributes follow ---") this_object.attributes.keys.sort.each do |attribute_name| attribute_value = this_object.attributes[attribute_name] if attribute_name != "options" if attribute_value.is_a?(DRb::DRbObject) if attribute_value.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ print_line($recursion_level, "#{object_string}[\'#{attribute_name}\'] => #{attribute_value} #{type(attribute_value)}") walk_object("#{object_string}[\'#{attribute_name}\']", attribute_value) else print_line($recursion_level, "Debug: not dumping, attribute_value.method_missing(:class) = " \ "#{attribute_value.method_missing(:class)}") if $debug end else begin attr_info = ping_attr(this_object, attribute_name) if attr_info[:value].nil? print_line($recursion_level, "#{object_string}#{attr_info[:format_string]} = nil") if $print_nil_values else print_line($recursion_level, "#{object_string}#{attr_info[:format_string]} = #{attr_info[:value]} #{type(attr_info[:value])}") end rescue ArgumentError if attribute_value.nil? print_line($recursion_level, "#{object_string}.#{attribute_name} = nil") if $print_nil_values else print_line($recursion_level, "#{object_string}.#{attribute_name} = #{attribute_value} #{type(attribute_value)}") end end end else # # Option key names can be mixed symbols and strings which confuses .sort # Create an option_map hash that maps option_name.to_s => option_name # option_map = {} options = attribute_value.keys options.each do |option_name| option_map[option_name.to_s] = option_name end option_map.keys.sort.each do |option| if attribute_value[option_map[option]].nil? print_line($recursion_level, "#{object_string}.options[#{str_or_sym(option_map[option])}] = nil") if $print_nil_values else print_line($recursion_level, "#{object_string}.options[#{str_or_sym(option_map[option])}] = " \ "#{attribute_value[option_map[option]]} #{type(attribute_value[option_map[option]])}") end end end end print_line($recursion_level, "--- end of attributes ---") else print_line($recursion_level, "--- no attributes ---") end else print_line($recursion_level, "*** attributes is not a hash ***") end else print_line($recursion_level, "--- no attributes ---") end rescue => err $evm.log("error", "#{$method} (print_attributes) - [#{err}]\n#{err.backtrace.join("\n")}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n print_line($recursion_level, \"--- custom attributes follow ---\")\n custom_attribute_keys.sort.each do |custom_attribute_key|\n custom_attribute_value = this_object.custom_get(custom_attribute_key)\n print_line($recursion_level, \"#{object_string}.custom_get(\\'#{custom_attribute_key}\\') = \\'#{custom_attribute_value}\\'\")\n end\n print_line($recursion_level, \"--- end of custom attributes ---\")\n end\n else\n print_line($recursion_level, \"--- object does not support custom attributes ---\")\n end \n rescue => err\n $evm.log(\"error\", \"#{$method} (print_custom_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def dump_attributes(my_object, my_object_name)\n if my_object.respond_to?(\"attributes\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.attributes\")\n my_object.attributes.sort.each { |k, v| self.log(:info, \"#{my_object_name} Attribute - #{k}: #{v}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.attributes\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No attributes for #{my_object_name}\")\n end\n end", "def print_attributes(object, keys)\n keys.each do |key|\n puts \"#{key}: #{object[key]}\"\n end\n puts \"\\n\"\nend", "def print_object(object, threshold = '')\n out = '{' + \"\\n\"\n out << threshold + '\"ressource_type\": \"' + object.class.to_s + '\"' + \"\\n\"\n out << threshold + ',\"instance_name\": \"' + object.instance_name + '\"' + \"\\n\"\n\n object.list_of_attributes.each do |a|\n out << print_attribute(a.to_s, object.get_value(a.to_s), threshold)\n end\n out << '}'\n end", "def inspect\n att_info = []\n inspect_attributes.each do |att|\n next unless respond_to? att\n\n att_info << \"#{att}=#{send(att).inspect}\"\n end\n att_info << '..'\n \"\\#<#{self.class}:#{object_id} #{att_info.join(', ')}>\"\n end", "def inspect() \n print @obj_name\n print \" which is \"\n print @obj_attr\n print \" & \"\n puts @obj_secondattr\n end", "def print_attribute(*) end", "def dump_info(my_object, my_object_name)\n self.dump_attributes(my_object, my_object_name)\n self.dump_associations(my_object, my_object_name)\n self.dump_virtual_columns(my_object, my_object_name)\n end", "def print_virtual_columns(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the virtual columns of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the virtual columns of this object \n #\n virtual_column_names = []\n if this_object.respond_to?(:virtual_column_names)\n virtual_column_names = Array.wrap(this_object.virtual_column_names)\n if virtual_column_names.length.zero?\n print_line($recursion_level, \"--- no virtual columns ---\")\n else\n print_line($recursion_level, \"--- virtual columns follow ---\")\n virtual_column_names.sort.each do |virtual_column_name|\n begin\n virtual_column_value = this_object.method_missing(:send, virtual_column_name)\n if virtual_column_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = \" \\\n \"#{virtual_column_value} #{type(virtual_column_value)}\")\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} virtual column: \\'#{virtual_column_name}\\' \" \\\n \"gives a NoMethodError when accessed (product bug?) ***\")\n end\n end\n print_line($recursion_level, \"--- end of virtual columns ---\")\n end\n else\n print_line($recursion_level, \"--- no virtual columns ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_virtual_columns) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def inspect\n # We check defined?(@attributes) not to issue warnings if the object is\n # allocated but not initialized.\n inspection = if defined?(@attributes) && @attributes\n self.class.column_names.map do |name|\n if has_attribute?(name)\n \"#{name}: #{attribute_for_inspect(name)}\"\n end\n end.compact.join(', ')\n else\n 'not initialized'\n end\n \"#<#{self.class} #{inspection}>\"\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def print_datastructure(object, threshold = ' ')\n out = ''\n if object.is_a?(Yarpler::Models::Relation)\n out << print_relation(object, threshold)\n else\n out << print_object(object, threshold)\n end\n out\n end", "def inspect\n attributes = [\n \"feature_name=#{feature_name.inspect}\",\n \"gate_key=#{gate_key.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def show(obj)\n y(obj.send(\"column_names\"))\nend", "def show(obj)\n y(obj.send(\"column_names\"))\nend", "def inspect\n attributes = [\n \"feature=#{feature.name.inspect}\",\n \"description=#{description.inspect}\",\n \"adapter=#{adapter.name.inspect}\",\n \"adapter_key=#{adapter_key.inspect}\",\n \"toggle_class=#{toggle_class.inspect}\",\n \"toggle_value=#{toggle.value.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def display_attributes\n puts\n puts @str.tr(NULL, \"!\")\n bit = 1\n 16.times do |bno|\n line = \"\"\n @str.length.times do |i|\n if (@attrs[i] & bit) == 0\n line << \" \"\n else\n if bno.zero?\n line << \"S\"\n else\n line << (\"%d\" % (bno+1))\n end\n end\n end\n puts(line) unless line =~ /^ *$/\n bit <<= 1\n end\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"state=#{state.inspect}\",\n \"description=#{description.inspect}\",\n \"adapter=#{adapter.name.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def pp_object(obj)\n object_address_group(obj) {\n seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|\n breakable\n v = v.to_s if Symbol === v\n text v\n text '='\n group(1) {\n breakable ''\n pp(obj.instance_eval(v))\n }\n }\n }\n end", "def inspect\n\t\treturn \"#<%s:0x%0x %s(%s) %p -> %p >\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.name,\n\t\t\tself.oid,\n\t\t\tself.desc,\n\t\t\tself.attr_oids,\n\t\t]\n\tend", "def print_hash(header_string, object_hash)\n puts header_string\n puts \"=\" * header_string.length\n object_hash.each_pair do |key, values|\n next if values.empty?\n puts \"- #{key}\"\n values.each { |value| puts \" - #{value}\" }\n end\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"use_local_cache=#{@use_local_cache.inspect}\"\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def inspect\n attributes_as_nice_string = self.class.column_names.collect { |name|\n if has_attribute?(name) || new_record?\n \"#{name}: #{attribute_for_inspect(name)}\"\n end\n }.compact.join(\", \")\n \"#<#{self.class} #{attributes_as_nice_string}>\"\n end", "def inspect\n attributes_as_nice_string = self.class.column_names.collect do |name|\n if ( has_attribute?(name) || new_record? )\n value = self.class.serialized_attributes.key?(name) ? \"[#{self.class.serialized_attributes[name]}]\" : attribute_for_inspect(name)\n \"#{name}: #{value}\"\n end\n end.compact.join(\", \")\n \"#<#{self.class} #{attributes_as_nice_string}>\"\n end", "def inspect\n inspected_attributes = attribute_names.sort\n attributes_list = \"(#{inspected_attributes.join(\", \")})\" unless inspected_attributes.empty?\n \"#{name}#{attributes_list}\"\n end", "def print_methods(object_string, this_object)\n begin\n #\n # Only dump the methods of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"Class of remote DRb::DRbObject is: #{this_object.method_missing(:class)}\") if $debug\n #\n # Get the instance methods of the class and convert to string\n #\n if this_object.method_missing(:class).respond_to?(:instance_methods)\n instance_methods = this_object.method_missing(:class).instance_methods.map { |x| x.to_s }\n #\n # Now we need to remove method names that we're not interested in...\n #\n # ...attribute names...\n #\n attributes = []\n if this_object.respond_to?(:attributes)\n if this_object.attributes.respond_to? :each\n this_object.attributes.each do |key, value|\n attributes << key\n end\n end\n end\n attributes << \"attributes\"\n $evm.log(\"info\", \"Removing attributes: #{instance_methods & attributes}\") if $debug\n instance_methods -= attributes\n #\n # ...association names...\n #\n associations = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n end\n associations << \"associations\"\n $evm.log(\"info\", \"Removing associations: #{instance_methods & associations}\") if $debug\n instance_methods -= associations\n #\n # ...virtual column names...\n #\n virtual_column_names = []\n virtual_column_names = this_object.method_missing(:virtual_column_names)\n virtual_column_names << \"virtual_column_names\"\n $evm.log(\"info\", \"Removing virtual_column_names: #{instance_methods & virtual_column_names}\") if $debug\n instance_methods -= virtual_column_names\n #\n # ... MiqAeServiceModelBase methods ...\n #\n $evm.log(\"info\", \"Removing MiqAeServiceModelBase methods: \" \\\n \"#{instance_methods & $service_mode_base_instance_methods}\") if $debug\n instance_methods -= $service_mode_base_instance_methods\n #\n # Add in the base methods as it's useful to show that they can be used with this object\n #\n instance_methods += ['inspect', 'inspect_all', 'reload', 'model_suffix']\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n else\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n #\n # and finally dump out the list\n #\n if instance_methods.length.zero?\n print_line($recursion_level, \"--- no methods ---\")\n else\n print_line($recursion_level, \"--- methods follow ---\")\n instance_methods.sort.each do |instance_method|\n print_line($recursion_level, \"#{object_string}.#{instance_method}\")\n end\n print_line($recursion_level, \"--- end of methods ---\")\n end\n else\n print_line($recursion_level, \"--- no methods ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_methods) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def inspect\n str = Inspect.dashed_line(self.class, 1)\n self.class.class_eval { @attributes }.each do |attr|\n str << Inspect.inspect_asn1_attribute(attr, self[attr], 1)\n end\n str\n end", "def dump(obj, io)\n io.puts obj.send(inspect_method)\n end", "def result_to_string(object)\n if object.is_a?(String) then\n return object\n else\n if defined?(awesome_inspect)\n return object.awesome_inspect({:plain=>true, :index=>false})\n elsif defined?(pretty_inspect)\n return object.pretty_inspect.chomp # Remove new line that PrettyInspect adds at the end https://www.ruby-forum.com/topic/113429\n else\n return object.inspect\n end\n end\n end", "def pry_show_model(object)\n if object.class == Class\n y object.column_names.sort\n else\n y object.class.column_names.sort\n end\n end", "def prettify(obj)\n # Most look best with pretty_inspect\n str = obj.pretty_inspect\n # Mashes need to be first converted to Hashes then pretty_inspect\n if obj.kind_of? Mash\n str = obj.to_hash.pretty_inspect\n end\n # For Arrays, pretty_inspect displays one value per line which\n # uses up too much real estate\n if obj.kind_of? Array\n str = obj.inspect\n end\n # Manually format Hashes so keys and values each display in columns\n if obj.kind_of? Hash\n key_length = 0\n obj.keys.each do |key|\n key_length = key.length if key.length > key_length\n end\n buf = []\n obj.each do |key,value|\n buf << sprintf(\"%-#{key_length}.#{key_length}s => %s\", key, value)\n end\n str = buf.join(\"\\n\")\n end\n str\n end", "def inspect\n pairs = []\n # Use the table's column list to order our columns\n @table.columns.each { |name| pairs << \"#{name}: #{@attributes[name].inspect}\"}\n inspection = pairs.compact.join(', ')\n \"#<#{self.class} #{inspection}>\"\n end", "def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end", "def print_primary_attributes\n \"Strenght(STR):#{str}, Dexterity(DEX):#{dex}, Inteligence(INT):#{int}, Constitution(CON):#{con}, Appearence(APP):#{app}, Power(POW):#{pow}, Size:#{siz}, Education:#{edu}\"\n end", "def inspect\n attribute_string = self.class.attributes.map do |key|\n \"#{key}: #{read_attribute(key).inspect}\"\n end.join(', ')\n \"#<#{self.class} #{attribute_string}>\"\n end", "def printallattrs(msg)\n msg.reply \"Listing available attributes:\"\n Physattr.each { |p| msg.reply p unless p.is_hidden? }\n msg.reply \"Done!\"\n end", "def object_attributes(object, action = nil)\n MyAdmin.get_object_attributes(object, action)\n end", "def inspect\n inspection = self.info.keys.map { |name|\n \"#{name}: #{attribute_for_inspect(name)}\"\n }.compact.join(\", \")\n \"#<#{self.class}:0x#{self.object_id.to_s(16)} #{inspection}>\"\n end", "def inspect\n sprintf(\"#<%s:%#0x(%s)>\", self.class.name, object_id, to_s)\n end", "def inspect\n \"#<#{self.class} @attributes=#{@attributes.inspect}>\"\n end", "def inspect\n\t\t\tmodel_inspect = super\n\t\t\ta = dynamic_attributes_fields.keys.map { |attr| \"#{attr}: #{self[attr].inspect || 'nil'}\" }\n\t\t\tdynamic_inspect = a.join(', ')\n\t\t\t\"#{model_inspect[0..-2]} || #{dynamic_inspect}>\"\n\t\tend", "def dump_virtual_columns(my_object, my_object_name)\n if my_object.respond_to?(\"virtual_column_names\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.virtual_columns\")\n my_object.virtual_column_names.sort.each { |vcn| self.log(:info, \"#{my_object_name} Virtual Column - #{vcn}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.virtual_columns\")\n self.log(@dump_log_level, \"\")\n else\n log(@dump_log_level, \"No virtual_columns for #{my_object_name}\")\n end\n end", "def recordable_object\n if @record.class.paper_trail.version_class.object_col_is_json?\n object_attrs_for_paper_trail\n else\n PaperTrail.serializer.dump(object_attrs_for_paper_trail)\n end\n end", "def attributes\n @object\n end", "def display_string(options, object, length = nil)\n \":#{object}\"\n end", "def inspect\n attributes_as_nice_string = ([\"id\"] + self.class.attributes).collect { |name|\n \"#{name}: #{send(name).inspect}\"\n }.compact.join(\", \")\n \"#<#{self.class} #{attributes_as_nice_string}>\"\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n str = +\"#<#{self.class.name}:0x#{object_id}\"\n str << \" id=\\\"#{@id}\\\"\" if @id\n str << '>'\n end", "def inspect\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def dprint(obj)\n self.log_puts(Php4r.print_r(obj, true))\n end", "def print_properties\n orientdb.print_class_properties self\n end", "def inspect\n attributes_for_inspect = self.attributes.collect do |attr|\n \"#{attr}: \" + self.instance_variable_get(\"@#{attr}\").to_s\n end.join(\", \")\n return \"#<#{self.class} #{attributes_for_inspect}>\"\n end", "def object_attrs_for_draft_record(object = nil)\n object ||= self\n\n attrs = object.attributes.except(*self.class.draftsman_options[:skip]).tap do |attributes|\n self.class.serialize_attributes_for_draftsman(attributes)\n end\n\n if self.class.draft_class.object_col_is_json?\n attrs\n else\n Draftsman.serializer.dump(attrs)\n end\n end", "def inspect\n \"#<#{self.class}(layout: #{self.class.layout}) record_id: #{__record_id.inspect} #{inspect_attributes}>\"\n end", "def println obj\n echo(obj.to_s + \"\\n\")\n end", "def inspect\n attribute_string = attributes.map { |name, value| \"#{name}: #{value.nil? ? 'nil' : value}\" }\n .join(\", \")\n \"#<#{self.class.name} #{attribute_string}>\"\n end", "def inspect\n attribute_string = attributes.map { |name, value| \"#{name}: #{value.nil? ? 'nil' : value}\" }\n .join(\", \")\n \"#<#{self.class.name} #{attribute_string}>\"\n end", "def inspect\n attribute_string = attributes.map { |name, value| \"#{name}: #{value.nil? ? 'nil' : value}\" }\n .join(\", \")\n \"#<#{self.class.name} #{attribute_string}>\"\n end", "def show(*args)\n r=map { |record| \n args.map { |attr| \n # If the attribute has a . in it, we split it and go down it recursively, so we can \n # print items in associated models\n as = attr.to_s.split('.')\n r = record.send(as.shift.to_sym)\n as.each { |a| \n r = r.send(a.to_sym)\n }\n if Array === r \n r = r*','\n elsif Hash ===r\n r = r.inspect\n else\n r.to_s \n end\n } \n }\n # Find the max width for each column\n max = (0...args.length).map { |i| \n column = r.map { |row| row[i] }\n column.map{ |s| s.length}.max \n }\n format = max.map{ |l| \"%#{l}s\"}.join(\" : \") + \"\\n\" \n r.each { |row|\n printf format,*row\n }\n nil\n end", "def attributes(object)\n attributes = {}\n @mapping.each do |key, method|\n attributes[key.to_sym] = chain_methods(object, method, {method_separator: @method_separator, force_method_calls: @force_method_calls}) # unless key.to_sym == :uid\n end\n attributes\n end", "def pretty(object)\n PP.pp(object, out)\n end", "def attribute_for_inspect(attr_name)\n value = read_attribute(attr_name)\n if value.is_a?(String) && value.length > 50\n \"#{value[0..50]}...\".inspect\n elsif value.is_a?(Date) || value.is_a?(Time)\n %(\"#{value.to_s(:db)}\")\n else\n value.inspect\n end\n end", "def short_inspect\n attrs = []\n attrs << [\"id\", id || \"new_record\"]\n\n string_attr = proc { |value| '\"' + TextHelpers.truncate(value, :length => 10) + '\"' }\n\n if respond_to?(:name) && name.present?\n attrs << [\"name\", string_attr[name]]\n elsif respond_to?(:title) && title.present?\n attrs << [\"title\", string_attr[title]]\n end\n\n \"#<#{ self.class } #{ attrs.map { |name, value| \"#{ name }: #{ value }\" }.join(\", \") }>\"\n end", "def attribute_for_inspect(attr_name)\n value = attribute(attr_name)\n\n if value.is_a?(String) && value.length > 50\n \"#{value[0, 50]}...\".inspect\n elsif value.is_a?(Date) || value.is_a?(Time)\n %(\"#{value.to_s(:db)}\")\n else\n value.inspect\n end\n end", "def inspect\n @_inspect ||= begin\n \"#<\" <<\n self.class.inspect <<\n (\":0x%014x\" % object_id) <<\n \">\"\n end\n end", "def attribute_for_inspect(attr_name)\n value = read_attribute(attr_name)\n\n if value.is_a?(String) && value.length > 50\n \"#{value[0..50]}...\".inspect\n elsif value.is_a?(Date) || value.is_a?(Time)\n %(\"#{value.to_s(:db)}\")\n else\n value.inspect\n end\n end", "def to_text\n \"#{__getobj__.to_text} (OPTIONAL)\"\n end", "def awesome_active_resource_instance(object)\n \"#{object} \" << awesome_hash(object.attributes)\n end", "def inspect\n id_text = __id__.to_s(16).rjust(14, ?0)\n addr_text = self.address.to_s(16).rjust(14, ?0)\n\n member_text = if ! null? && ::Snow::CStruct.long_inspect\n # Get member text\n all_members_text = (self.class::MEMBERS.map do |member|\n name = member.name\n type = member.type\n align = member.alignment\n length = member.length\n length_decl = length > 1 ? \"[#{length}]\" : ''\n\n values_text = if length > 1\n single_member_text = (0 ... length).map { |index|\n \"[#{ index }]=#{ self.__send__(member.name, index).inspect }\"\n }.join(', ')\n\n \"{ #{ single_member_text } }\"\n else\n self.__send__(member.name).inspect\n end\n\n \"#{ name }:#{ type }#{ length_decl }:#{ align }=#{ values_text }\"\n\n end).join('; ')\n\n \" #{all_members_text}\"\n else # member_text = if ...\n # Skip members\n ''\n end # member_text = if ...\n\n \"<#{ self.class }:0x#{ id_text } *0x#{ addr_text }:#{ self.bytesize }:#{ self.alignment }#{member_text}>\"\n end", "def print_attribute(name, value, threshold)\n out = ''\n if value.is_a?(Yarpler::Models::Relation)\n out << threshold + ',\"' + name + '\": \"' + print_datastructure(value, threshold + ' ') + '\"' + \"\\n\"\n else\n out << threshold + ',\"' + name + '\": \"' + value.to_s + '\"' + \"\\n\"\n end\n end", "def inspect\n \"(#{self.class.name}:#{'0x%08x' % (object_id * 2)})\"\n end", "def debug(object)\n puts \"<pre>\"\n puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')\n puts \"</pre>\"\nend", "def inspect\n object_identifier\n end", "def display_value(obj)\n case\n when obj && observed_name\n \"#{obj.name} (#{observed_name})\"\n when obj\n \"#{obj.name}\"\n when observed_name\n \"#{observed_name}\"\n else\n \"\"\n end\n end", "def inspect\n \"#{ self.class }:0x#{ '%x' % (object_id << 1) }: #{ name }\"\n end", "def inspect\n\t\t\treturn %Q{#<%s:0x%0x \"%s\">} % [\n\t\t\t\tself.class.name,\n\t\t\t\tself.object_id * 2,\n\t\t\t\tself.to_s,\n\t\t\t]\n\t\tend", "def inspect\n if self == Base\n super\n else\n attr_list = columns.map { |c| \"#{c.name}: #{c.type}\" } * ', '\n \"#{super}(#{attr_list})\"\n end\n end", "def inspect\n str = \"#<#{self.class}\"\n\n ids = (Thread.current[InspectKey] ||= [])\n if ids.include?(object_id)\n return str << ' ...>'\n end\n\n ids << object_id\n begin\n first = true\n for k,v in @table\n str << \",\" unless first\n first = false\n str << \" #{k}=#{v.inspect}\"\n end\n return str << '>'\n ensure\n ids.pop\n end\n end", "def inspect\n vals = ATTRS.map { |field| \"#{field}: #{public_send(field).inspect}\" }\n \"#<#{self.class.name} #{vals.join(', ')}>\"\n end", "def versioned_attributes_from_object(object)\n self.class.versioned_columns.inject({}){|attrs, col| attrs[col] = object.send(col); attrs }\n end", "def attributes(class_id, obj_ref, *attributes_hashes)\n attributes = class_id\n\n attributes_hashes.each do |hash|\n attributes.update hash\n end\n\n result = attributes.collect do |attr, value|\n if value == true\n next \" #{attr}\"\n elsif value == false\n next\n else\n \" #{attr}='#{value}'\"\n end\n end\n\n result.join\n end", "def display_attributes\n self.class.display_attribute_names.map do |name|\n [name.to_s, self.send(name)]\n end.to_h\n end", "def inspect\n \"#<#{self.class.name}:0x#{object_id}\\n @base_url=\\\"#{@base_url}\\\"\\n @most_recent_page=#{@most_recent_page}>\"\n end", "def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend", "def inspect\n inspectables = self.class.inspectables\n if inspectables\n \"#<#{self.class}:0x#{object_id.to_s(16)} \" + inspectables.map {|i| \"@#{i}=\\\"#{send(i) rescue nil}\\\"\"}.join(' ') + \">\"\n else\n super\n end\n end", "def inspect\n inspectables = self.class.inspectables\n if inspectables\n \"#<#{self.class}:0x#{object_id.to_s(16)} \" + inspectables.map {|i| \"@#{i}=\\\"#{send(i) rescue nil}\\\"\"}.join(' ') + \">\"\n else\n super\n end\n end", "def inspect\n result = +\"#<#{self.class.name}:#{object_id}\"\n result << \" @name=\\\"#{name}\\\"\"\n result << \" @lhs=#{lhs.name}\"\n result << \" @rhs=#{rhs.inspect}\"\n result << \" @generative=#{@generative}>\"\n result\n end", "def inspect\n\t\t\"#<%s:0x%0x base_dn='%s', filter=%s, scope=%s, select=%s, limit=%d, timeout=%0.3f>\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id * 2,\n\t\t\tself.base_dn,\n\t\t\tself.filter_string,\n\t\t\tself.scope,\n\t\t\tself.select.empty? ? '*' : self.select.join(','),\n\t\t\tself.limit,\n\t\t\tself.timeout,\n\t\t]\n\tend", "def inspect\n \"(#{self.class.name}:#{hexy_object_id}#{inspect_details})\"\n end", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n # $walk_associations_whitelist & $walk_associations_blacklist hashes\n #\n associations = []\n associated_objects = []\n duplicates = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n if associations.length.zero?\n print_line($recursion_level, \"--- no associations ---\")\n else\n print_line($recursion_level, \"--- associations follow ---\")\n duplicates = associations.select{|item| associations.count(item) > 1}\n if duplicates.length > 0\n print_line($recursion_level,\n \"*** De-duplicating the following associations: #{duplicates.inspect} ***\")\n end\n associations.uniq.sort.each do |association|\n begin\n associated_objects = Array.wrap(this_object.method_missing(:send, association))\n if associated_objects.length == 0\n print_line($recursion_level,\n \"#{object_string}.#{association} (type: Association (empty))\")\n else\n print_line($recursion_level, \"#{object_string}.#{association} (type: Association)\")\n #\n # See if we need to walk this association according to the walk_association_policy\n # variable, and the walk_association_{whitelist,blacklist} hashes\n #\n if $walk_association_policy == 'whitelist'\n if $walk_association_whitelist.has_key?(this_object_class) &&\n ($walk_association_whitelist[this_object_class].include?('ALL') ||\n $walk_association_whitelist[this_object_class].include?(association.to_s))\n walk_association(object_string, association, associated_objects)\n else\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' isn't in the walk_association_whitelist \" \\\n \"hash for #{this_object_class} ***\")\n end\n elsif $walk_association_policy == 'blacklist'\n if $walk_association_blacklist.has_key?(this_object_class) &&\n ($walk_association_blacklist[this_object_class].include?('ALL') ||\n $walk_association_blacklist[this_object_class].include?(association.to_s))\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' is in the walk_association_blacklist \" \\\n \"hash for #{this_object_class} ***\")\n else\n walk_association(object_string, association, associated_objects)\n end\n else\n print_line($recursion_level,\n \"*** Invalid $walk_association_policy: #{$walk_association_policy} ***\")\n exit MIQ_ABORT\n end\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} association: \\'#{association}\\', gives a \" \\\n \"NoMethodError when accessed (product bug?) ***\")\n next\n end\n end\n print_line($recursion_level, \"--- end of associations ---\")\n end\n else\n print_line($recursion_level, \"--- no associations ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_associations) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def inspect\n \"#<#{self.class}:#{type_sym}:#{object_id.to_s(16)}>\"\n end", "def print_details(inst)\n print \"ID: \".bold, inst[:id], \" Name: \".bold, inst[:name], \" State: \".bold, inst[:state]\n if inst[:state] == 'running'\n print \", launched at #{inst[:launched]}\"\n elsif inst[:reason]\n print \" via #{inst[:reason]}\"\n end\n puts\n\n if inst[:vpc]\n print \"VPC: \".bold, inst[:vpc], \" Subnet: \".bold, inst[:subnet]\n else\n print \"EC2 Classic\".bold\n end\n print \" Private IP: \".bold, echo_ip( inst[:private_ip] )\n if inst[:vpc] and not inst[:private_ip]\n print \" Public IP is not allocated\".bold\n else\n print \" Public IP: \".bold, echo_ip( inst[:public_ip] )\n end\n puts\n\n print \"EC2 Class: \".bold, inst[:ec2_class], \" [#{inst[:virtualization_type]}]\", \" Arch: \".bold, inst[:arch]\n print \" [Spot]\".bold if inst[:spot]\n print \" [Monitoring]\".bold if inst[:monitoring]\n if inst[:windows]\n print \" [Windows]\".bold\n else\n print \" Keypair: \".bold, inst[:key_pair]\n end\n puts\n\n print \"AMI: \".bold, inst[:ami], \" (#{inst[:ami_desc]})\"\n puts\n\n print \"Security Groups: \".bold, inst[:sec_groups]\n puts\nend", "def attribute_for_inspect(attr_name)\n value = read_attribute(attr_name)\n\n if value.is_a?(String) && value.length > 50\n \"#{value[0..50]}...\".inspect\n elsif value.is_a?(Date) || value.is_a?(Time)\n %(\"#{value.to_s(:db)}\")\n else\n value.inspect\n end\n end", "def display_attrtype_details( attrtype )\n\t\tocs = self.directory.schema.object_classes.values.find_all do |oc|\n\t\t\t( oc.must_oids | oc.may_oids ).include?( attrtype.name.to_sym )\n\t\tend\n\n\t\tif ocs.empty?\n\t\t\tself.prompt.say \"No objectClasses with the '%s' attribute are in the current schema.\" %\n\t\t\t\t[ attrtype.name ]\n\t\telse\n\t\t\tocnames = ocs.uniq.map( &:name ).map( &:to_s ).sort\n\n\t\t\tself.prompt.say \"objectClasses with the '%s' attribute in the current schema:\" %\n\t\t\t\t[ attrtype.name ]\n\t\t\tself.prompt.say( self.prompt.list(ocnames, :columns_across) )\n\t\tend\n\tend", "def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{fullName}>\"\n end", "def inspect\n \"<#{self.class}:0x#{object_id.to_s(16)}>\"\n end" ]
[ "0.7548576", "0.7003994", "0.6802647", "0.6730234", "0.6509097", "0.6490177", "0.646289", "0.63599765", "0.62217087", "0.61246246", "0.5999873", "0.59849334", "0.59399784", "0.59260106", "0.59260106", "0.5909143", "0.58688456", "0.58434194", "0.57736546", "0.5770615", "0.5770534", "0.57562125", "0.57330364", "0.57232773", "0.5681945", "0.5631518", "0.5577169", "0.55429494", "0.55352294", "0.55083376", "0.5494019", "0.54578274", "0.54434055", "0.54371303", "0.5428207", "0.5423584", "0.5417245", "0.541139", "0.54091644", "0.54068726", "0.5395861", "0.53747696", "0.5355697", "0.5350546", "0.5334522", "0.53198534", "0.5319303", "0.5319303", "0.5319303", "0.5319303", "0.5317705", "0.5308701", "0.52991223", "0.5292246", "0.52917314", "0.5290529", "0.52869594", "0.5286858", "0.5273607", "0.5256985", "0.5256985", "0.5256985", "0.52341735", "0.5214875", "0.51887953", "0.5185186", "0.51831526", "0.5169241", "0.51688445", "0.5168312", "0.51571345", "0.51543784", "0.5152434", "0.5151641", "0.5148081", "0.51347816", "0.51340955", "0.51330036", "0.5131107", "0.5128548", "0.5123876", "0.5123491", "0.5119699", "0.5111006", "0.5105992", "0.5089504", "0.50892985", "0.5084552", "0.5083342", "0.5083342", "0.50823975", "0.5073608", "0.50724214", "0.50652236", "0.50646615", "0.50626236", "0.5062601", "0.506211", "0.5059612", "0.50557387" ]
0.8148297
0
End of print_attributes Method: print_virtual_columns Purpose: Prints the virtual_columns_names of the object passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose virtual_column_names are to be dumped this_object_class : the class of the object whose associations are to be dumped Returns: None
def print_virtual_columns(object_string, this_object, this_object_class) begin # # Only dump the virtual columns of an MiqAeMethodService::* class # if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ # # Print the virtual columns of this object # virtual_column_names = [] if this_object.respond_to?(:virtual_column_names) virtual_column_names = Array.wrap(this_object.virtual_column_names) if virtual_column_names.length.zero? print_line($recursion_level, "--- no virtual columns ---") else print_line($recursion_level, "--- virtual columns follow ---") virtual_column_names.sort.each do |virtual_column_name| begin virtual_column_value = this_object.method_missing(:send, virtual_column_name) if virtual_column_value.nil? print_line($recursion_level, "#{object_string}.#{virtual_column_name} = nil") if $print_nil_values else print_line($recursion_level, "#{object_string}.#{virtual_column_name} = " \ "#{virtual_column_value} #{type(virtual_column_value)}") end rescue NoMethodError print_line($recursion_level, "*** #{this_object_class} virtual column: \'#{virtual_column_name}\' " \ "gives a NoMethodError when accessed (product bug?) ***") end end print_line($recursion_level, "--- end of virtual columns ---") end else print_line($recursion_level, "--- no virtual columns ---") end end rescue => err $evm.log("error", "#{$method} (print_virtual_columns) - [#{err}]\n#{err.backtrace.join("\n")}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_virtual_columns(my_object, my_object_name)\n if my_object.respond_to?(\"virtual_column_names\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.virtual_columns\")\n my_object.virtual_column_names.sort.each { |vcn| self.log(:info, \"#{my_object_name} Virtual Column - #{vcn}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.virtual_columns\")\n self.log(@dump_log_level, \"\")\n else\n log(@dump_log_level, \"No virtual_columns for #{my_object_name}\")\n end\n end", "def show(obj)\n y(obj.send(\"column_names\"))\nend", "def show(obj)\n y(obj.send(\"column_names\"))\nend", "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n print_line($recursion_level, \"--- custom attributes follow ---\")\n custom_attribute_keys.sort.each do |custom_attribute_key|\n custom_attribute_value = this_object.custom_get(custom_attribute_key)\n print_line($recursion_level, \"#{object_string}.custom_get(\\'#{custom_attribute_key}\\') = \\'#{custom_attribute_value}\\'\")\n end\n print_line($recursion_level, \"--- end of custom attributes ---\")\n end\n else\n print_line($recursion_level, \"--- object does not support custom attributes ---\")\n end \n rescue => err\n $evm.log(\"error\", \"#{$method} (print_custom_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def pry_show_model(object)\n if object.class == Class\n y object.column_names.sort\n else\n y object.class.column_names.sort\n end\n end", "def dump_info(my_object, my_object_name)\n self.dump_attributes(my_object, my_object_name)\n self.dump_associations(my_object, my_object_name)\n self.dump_virtual_columns(my_object, my_object_name)\n end", "def print_attributes(object_string, this_object)\n begin\n #\n # Print the attributes of this object\n #\n if this_object.respond_to?(:attributes)\n print_line($recursion_level, \"Debug: this_object.inspected = #{this_object.inspect}\") if $debug\n if this_object.attributes.respond_to?(:keys)\n if this_object.attributes.keys.length > 0\n print_line($recursion_level, \"--- attributes follow ---\")\n this_object.attributes.keys.sort.each do |attribute_name|\n attribute_value = this_object.attributes[attribute_name]\n if attribute_name != \"options\"\n if attribute_value.is_a?(DRb::DRbObject)\n if attribute_value.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"#{object_string}[\\'#{attribute_name}\\'] => #{attribute_value} #{type(attribute_value)}\")\n walk_object(\"#{object_string}[\\'#{attribute_name}\\']\", attribute_value)\n else\n print_line($recursion_level,\n \"Debug: not dumping, attribute_value.method_missing(:class) = \" \\\n \"#{attribute_value.method_missing(:class)}\") if $debug\n end\n else\n begin\n attr_info = ping_attr(this_object, attribute_name)\n if attr_info[:value].nil?\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = #{attr_info[:value]} #{type(attr_info[:value])}\")\n end\n rescue ArgumentError\n if attribute_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = #{attribute_value} #{type(attribute_value)}\")\n end\n end\n end\n else\n #\n # Option key names can be mixed symbols and strings which confuses .sort\n # Create an option_map hash that maps option_name.to_s => option_name\n #\n option_map = {}\n options = attribute_value.keys\n options.each do |option_name|\n option_map[option_name.to_s] = option_name\n end\n option_map.keys.sort.each do |option|\n if attribute_value[option_map[option]].nil?\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = \" \\\n \"#{attribute_value[option_map[option]]} #{type(attribute_value[option_map[option]])}\")\n end\n end\n end\n end\n print_line($recursion_level, \"--- end of attributes ---\")\n else \n print_line($recursion_level, \"--- no attributes ---\")\n end\n else\n print_line($recursion_level, \"*** attributes is not a hash ***\")\n end\n else\n print_line($recursion_level, \"--- no attributes ---\")\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_methods(object_string, this_object)\n begin\n #\n # Only dump the methods of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"Class of remote DRb::DRbObject is: #{this_object.method_missing(:class)}\") if $debug\n #\n # Get the instance methods of the class and convert to string\n #\n if this_object.method_missing(:class).respond_to?(:instance_methods)\n instance_methods = this_object.method_missing(:class).instance_methods.map { |x| x.to_s }\n #\n # Now we need to remove method names that we're not interested in...\n #\n # ...attribute names...\n #\n attributes = []\n if this_object.respond_to?(:attributes)\n if this_object.attributes.respond_to? :each\n this_object.attributes.each do |key, value|\n attributes << key\n end\n end\n end\n attributes << \"attributes\"\n $evm.log(\"info\", \"Removing attributes: #{instance_methods & attributes}\") if $debug\n instance_methods -= attributes\n #\n # ...association names...\n #\n associations = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n end\n associations << \"associations\"\n $evm.log(\"info\", \"Removing associations: #{instance_methods & associations}\") if $debug\n instance_methods -= associations\n #\n # ...virtual column names...\n #\n virtual_column_names = []\n virtual_column_names = this_object.method_missing(:virtual_column_names)\n virtual_column_names << \"virtual_column_names\"\n $evm.log(\"info\", \"Removing virtual_column_names: #{instance_methods & virtual_column_names}\") if $debug\n instance_methods -= virtual_column_names\n #\n # ... MiqAeServiceModelBase methods ...\n #\n $evm.log(\"info\", \"Removing MiqAeServiceModelBase methods: \" \\\n \"#{instance_methods & $service_mode_base_instance_methods}\") if $debug\n instance_methods -= $service_mode_base_instance_methods\n #\n # Add in the base methods as it's useful to show that they can be used with this object\n #\n instance_methods += ['inspect', 'inspect_all', 'reload', 'model_suffix']\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n else\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n #\n # and finally dump out the list\n #\n if instance_methods.length.zero?\n print_line($recursion_level, \"--- no methods ---\")\n else\n print_line($recursion_level, \"--- methods follow ---\")\n instance_methods.sort.each do |instance_method|\n print_line($recursion_level, \"#{object_string}.#{instance_method}\")\n end\n print_line($recursion_level, \"--- end of methods ---\")\n end\n else\n print_line($recursion_level, \"--- no methods ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_methods) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_properties\n orientdb.print_class_properties self\n end", "def versioned_attributes_from_object(object)\n self.class.versioned_columns.inject({}){|attrs, col| attrs[col] = object.send(col); attrs }\n end", "def schema(obj)\n y(obj.send(\"column_names\"))\nend", "def dump_attributes(my_object, my_object_name)\n if my_object.respond_to?(\"attributes\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.attributes\")\n my_object.attributes.sort.each { |k, v| self.log(:info, \"#{my_object_name} Attribute - #{k}: #{v}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.attributes\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No attributes for #{my_object_name}\")\n end\n end", "def get_virtual_attributes(attribute_names, cols, field_to_match = :display_name)\n sp_hash = {\n model_name: :attribute,\n filter: [:oneof, field_to_match, attribute_names],\n cols: Aux.array_add?(cols, field_to_match)\n }\n get_children_from_sp_hash(:attribute, sp_hash)\n end", "def inspect\n # We check defined?(@attributes) not to issue warnings if the object is\n # allocated but not initialized.\n inspection = if defined?(@attributes) && @attributes\n self.class.column_names.map do |name|\n if has_attribute?(name)\n \"#{name}: #{attribute_for_inspect(name)}\"\n end\n end.compact.join(', ')\n else\n 'not initialized'\n end\n \"#<#{self.class} #{inspection}>\"\n end", "def print_datastructure(object, threshold = ' ')\n out = ''\n if object.is_a?(Yarpler::Models::Relation)\n out << print_relation(object, threshold)\n else\n out << print_object(object, threshold)\n end\n out\n end", "def inspect\n attributes_as_nice_string = self.class.column_names.collect do |name|\n if ( has_attribute?(name) || new_record? )\n value = self.class.serialized_attributes.key?(name) ? \"[#{self.class.serialized_attributes[name]}]\" : attribute_for_inspect(name)\n \"#{name}: #{value}\"\n end\n end.compact.join(\", \")\n \"#<#{self.class} #{attributes_as_nice_string}>\"\n end", "def inspect\n attributes_as_nice_string = self.class.column_names.collect { |name|\n if has_attribute?(name) || new_record?\n \"#{name}: #{attribute_for_inspect(name)}\"\n end\n }.compact.join(\", \")\n \"#<#{self.class} #{attributes_as_nice_string}>\"\n end", "def print_object(object, threshold = '')\n out = '{' + \"\\n\"\n out << threshold + '\"ressource_type\": \"' + object.class.to_s + '\"' + \"\\n\"\n out << threshold + ',\"instance_name\": \"' + object.instance_name + '\"' + \"\\n\"\n\n object.list_of_attributes.each do |a|\n out << print_attribute(a.to_s, object.get_value(a.to_s), threshold)\n end\n out << '}'\n end", "def all\n __getobj__.column_names\n end", "def print_attributes(object, keys)\n keys.each do |key|\n puts \"#{key}: #{object[key]}\"\n end\n puts \"\\n\"\nend", "def grouped_column_names_for(object)\n object.column_names.map { |column| \"#{object.table_name}.#{column}\" }.join(', ')\n end", "def inspect\n if self == Base\n super\n else\n attr_list = columns.map { |c| \"#{c.name}: #{c.type}\" } * ', '\n \"#{super}(#{attr_list})\"\n end\n end", "def print_table_t(objects, *method_names)\n terminal_width = `tput cols`.to_i\n cols = objects.count + 1 # Label column\n col_width = (terminal_width / cols) - 1 # Column spacing\n\n Array(method_names).map do |method_name|\n cells = objects.map { |o| o.send(method_name).inspect }\n cells.unshift(method_name)\n\n puts cells.map { |cell| cell.to_s.ljust(col_width) }.join \" \"\n end\n nil\nend", "def probe\n name_pad = columns.map { |c| c.name.length }.max + 1\n type_pad = columns.map { |c| c.type.length }.max + 2\n sql_type_pad = columns.map { |c| c.sql_type.length }.max + 1\n\n columns.sort { |a, b| a.name <=> b.name }.map do |column|\n name = column.name\n name = \"* #{name}\" if primary_key_column?(column)\n print yellow(name.to_s.rjust(name_pad))\n print \" \"\n print blue(column.type.to_s.ljust(type_pad, \".\"))\n print magenta(column.sql_type.to_s.ljust(sql_type_pad))\n column.null ? print(red(\"NULL\")) : print(\" \")\n print \" [#{column.default}]\" if column.default\n print \" #{gray column.comment}\" if column.comment\n puts\n end\n nil\n end", "def generateColumnDef()\n res=@conn.exec(\"select tablename from pg_tables where schemaname='public'\")\n classObj = \"\"\n for i in res\n classObj = classObj + \"\\n\\n\\n== \"+ i[0].to_s + \"\\n\"\n classObj = classObj + genrateTabledesc(i[0].to_s)\n classObj = classObj + \"\\n\"\n classObj = classObj + \".Properties\\n\"\n classObj = classObj + \"[frame=\\\"none\\\",options=\\\"header\\\"]\\n\"\n classObj = classObj + \"|======================================================================================\\n\"\n classObj = classObj + \"| | Data Type | Description \\n\"\n classObj = classObj + self.singleTableColDef(i.to_s)\n classObj = classObj + \"|======================================================================================\\n\"\n classObj = classObj + \"=== Links\\n\"\n classObj = classObj + self.generateForeignKeyDef(i.to_s)\n classObj = classObj + \"=== Methods\\n\"\n classObj = classObj + self.generateStoredProcDef(i.to_s)\n end\n puts classObj\n return classObj\n end", "def grouped_column_names_for(object)\n self.class.grouped_column_names_for(object)\n end", "def inspect\n pairs = []\n # Use the table's column list to order our columns\n @table.columns.each { |name| pairs << \"#{name}: #{@attributes[name].inspect}\"}\n inspection = pairs.compact.join(', ')\n \"#<#{self.class} #{inspection}>\"\n end", "def print_model\n puts \"class #{name} < #{superclass.name}\"\n puts \" # extends ...................................................................\"\n puts \" # includes ..................................................................\"\n puts if relation_columns.size > 0\n puts \" # relationships .............................................................\"\n relation_columns.sort_by(&:name).each do |column|\n next if primary_key_column?(column)\n puts \" belongs_to :#{column.name.sub(/_id\\z/, \"\")}\" if column.name =~ /_id\\z/\n end\n puts if relation_columns.size > 0 || validation_columns.size > 0\n puts \" # validations ...............................................................\"\n validation_columns.sort_by(&:name).each do |column|\n next if primary_key_column?(column)\n puts \" validates :#{column.name}, presence: true\" unless column.null\n if %i(text string).include?(column.type) && column.limit.to_i > 0\n puts \" validates :#{column.name}, length: { maximum: #{column.limit} }\"\n end\n end\n puts if validation_columns.size > 0\n puts \" # callbacks .................................................................\"\n puts \" # scopes ....................................................................\"\n puts \" # additional config (i.e. accepts_nested_attribute_for etc...) ..............\"\n puts\n puts \" # class methods .............................................................\"\n puts \" class << self\"\n puts \" end\"\n puts\n puts \" # public instance methods ...................................................\"\n puts\n puts \" # protected instance methods ................................................\"\n puts \" protected\"\n puts\n puts \" # private instance methods ..................................................\"\n puts \" private\"\n puts \"end\"\n nil\n end", "def column_names\n klass.attributes\n end", "def inspect\n\t\t\tmodel_inspect = super\n\t\t\ta = dynamic_attributes_fields.keys.map { |attr| \"#{attr}: #{self[attr].inspect || 'nil'}\" }\n\t\t\tdynamic_inspect = a.join(', ')\n\t\t\t\"#{model_inspect[0..-2]} || #{dynamic_inspect}>\"\n\t\tend", "def inspect\n att_info = []\n inspect_attributes.each do |att|\n next unless respond_to? att\n\n att_info << \"#{att}=#{send(att).inspect}\"\n end\n att_info << '..'\n \"\\#<#{self.class}:#{object_id} #{att_info.join(', ')}>\"\n end", "def print_searchable_fields\n puts\n puts 'Searchable fields'\n puts '-----------------'\n @searchable_fields[@object].each { |field| puts field }\n puts '-----------------'\n end", "def field_names(mainclass)\n fields_xml = ''\n xm = Builder::XmlMarkup.new(:target => fields_xml, :indent => 2)\n xm.instruct!\n xm.field_names{\n # Insert all of our local column names\n mainclass.content_columns.each { |column| xm.field_name(\"#{column.name}\") }\n\n # Then insert all of the column names from our associations\n mainclass.reflect_on_all_associations.each do |assoc|\n # Don't expose implementation details that aren't meaningful\n # to the user\n next if assoc.name == :audits\n # from rails_authorization_plugin should not be searched\n next if assoc.name == :users\n next if assoc.name == :utilization_metrics\n next if assoc.options.has_key?(:polymorphic)\n next if assoc.name.to_s =~ /_assignments?$/\n\n # Not sure yet if I want to handle second-level associations in a special way\n # It doesn't matter to the user for searching, but does potentionally matter\n # if they request an include.\n #if assoc.options.has_key?(:through) && assoc.options[:through].to_s !~ /_assignments$/\n #end\n \n assoc.klass.content_columns.each do |column|\n # If it's the column that we let the user shortcut by just\n # specifying the association (leaving off the column name)\n # then indicate that to the user by including the shortcut.\n # I could be convinced to do this in a more XMLish fashion\n # (i.e. a <field_name_shortcut> element or something) if\n # someone wanted to programatically do something with these.\n # Currently the client just dumps these out to the user so this\n # is sufficient.\n if (assoc.klass.respond_to?('default_search_attribute') &&\n column.name == assoc.klass.default_search_attribute)\n xm.field_name(\"#{assoc.name}[#{column.name}] (#{assoc.name})\")\n else\n xm.field_name(\"#{assoc.name}[#{column.name}]\")\n end\n end\n end\n }\n\n respond_to do |format|\n format.xml { render :xml => fields_xml }\n end\n end", "def supports_virtual_columns?\n false\n end", "def supports_virtual_columns?\n false\n end", "def inspect\n str = \"<#{self.class}\"\n for k,v in (@__table__ ||= {})\n str << \" #{k}=#{v.inspect}\"\n end\n str << \">\"\n end", "def to_s\n columns.each{|c| \"#{c}: #{self.send(c)}\\n\"}\n end", "def print_column_names(table_name)\r\n if table_exists?(table_name)\r\n puts \"Your table \\\"#{table_name}\\\" has columns named:\"\r\n columns = get_column_names(table_name)\r\n columns.each_with_index do |name, i|\r\n print \"\\\"#{name}\\\" \"\r\n print \"& \" unless i == (columns.size - 1)\r\n end\r\n puts \"\"\r\n end\r\n end", "def print_relation(object, threshold = '')\n out = ''\n if object.to.is_a?(Array)\n object.to.each do |o|\n out << print_datastructure(o, threshold)\n end\n else\n out << object.to.to_s\n end\n out\n end", "def dump\n output = ''\n @objects_table.keys.sort.each do |key|\n object_entry = @objects_table[key]\n name = object_entry.__name__\n type = object_entry.__type__\n #\n # use the inspect to make ruby 1.8.7 and 1.9.3 compatible\n #\n object = lookup(type, name).to_hash.inspect\n output << \"#{type}(#{name}) = #{object}\\n\"\n end\n output\n end", "def inspect\n\t\treturn \"#<%s:0x%0x %s(%s) %p -> %p >\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.name,\n\t\t\tself.oid,\n\t\t\tself.desc,\n\t\t\tself.attr_oids,\n\t\t]\n\tend", "def get_list_columns(object)\n MyAdmin.get_list_columns(object)\n end", "def column_names\n klass.properties.keys\n end", "def vertical_row(obj, depth)\n row = []\n variables = obj.class::FIELDS_FULL\n variables.each do |var|\n val = obj.instance_variable_get(\"@#{var}\")\n row << [var, val]\n end\n if depth == :deep\n row << ['Deep', deep_data(obj)]\n end\n row\n end", "def inspect() \n print @obj_name\n print \" which is \"\n print @obj_attr\n print \" & \"\n puts @obj_secondattr\n end", "def to_tsv(columns, delim = \"\\t\")\n str = \"\"\n columns.each do |col|\n str << col.name.to_s.titleize + delim\n end\n str << \"\\n\"\n self.each do |object|\n columns.each do |col|\n str << object.send(col.name.to_s).to_s + delim if\n object.respond_to?(col.name.to_s)\n end\n str << \"\\n\"\n end\n str\n end", "def show(*args)\n r=map { |record| \n args.map { |attr| \n # If the attribute has a . in it, we split it and go down it recursively, so we can \n # print items in associated models\n as = attr.to_s.split('.')\n r = record.send(as.shift.to_sym)\n as.each { |a| \n r = r.send(a.to_sym)\n }\n if Array === r \n r = r*','\n elsif Hash ===r\n r = r.inspect\n else\n r.to_s \n end\n } \n }\n # Find the max width for each column\n max = (0...args.length).map { |i| \n column = r.map { |row| row[i] }\n column.map{ |s| s.length}.max \n }\n format = max.map{ |l| \"%#{l}s\"}.join(\" : \") + \"\\n\" \n r.each { |row|\n printf format,*row\n }\n nil\n end", "def print_attribute(*) end", "def association_columns(*by_associations) #:nodoc:\n if @object.present?\n @object.class.reflections.collect do |name, _|\n if by_associations.present?\n name if by_associations.include?(_.macro)\n else\n name\n end\n end.compact\n else\n []\n end\n end", "def column_names\n klass.new.attributes.keys\n end", "def mu_pp(obj)\n if obj.is_a?(ActiveRecord::Base)\n obj.to_s\n else\n super\n end\n end", "def inspect\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end", "def all_columns\n datasource_columns.merge(virtual_columns)\n end", "def polymorphic_column_name(reflection, column_name)\n # self.polymorphic_namespace_name.to_s + '.' + (reflection.options[:as] ? reflection.options[:as].to_s.classify : reflection.class_name.to_s) + '#' + column_name.to_s\n self.polymorphic_namespace_name.to_s + '#' + column_name.to_s\n end", "def print_hash(header_string, object_hash)\n puts header_string\n puts \"=\" * header_string.length\n object_hash.each_pair do |key, values|\n next if values.empty?\n puts \"- #{key}\"\n values.each { |value| puts \" - #{value}\" }\n end\n end", "def t(column)\n object.class.human_attribute_name(column.to_sym)\n end", "def inspect\n str = \"#<#{self.class}\"\n\n ids = (Thread.current[InspectKey] ||= [])\n if ids.include?(object_id)\n return str << ' ...>'\n end\n\n ids << object_id\n begin\n first = true\n for k,v in @table\n str << \",\" unless first\n first = false\n str << \" #{k}=#{v.inspect}\"\n end\n return str << '>'\n ensure\n ids.pop\n end\n end", "def table_columns\n klass.column_names\n end", "def dumpUser\n user = $evm.root['user']\n unless user.nil?\n $evm.log(\"info\",\"#{@method} - User:<#{user.name}> Begin Attributes [user.attributes]\")\n user.attributes.sort.each { |k, v| $evm.log(\"info\", \"#{@method} - User:<#{user.name}> Attributes - #{k}: #{v.inspect}\")}\n $evm.log(\"info\",\"#{@method} - User:<#{user.name}> End Attributes [user.attributes]\")\n $evm.log(\"info\", \"\")\n\n $evm.log(\"info\",\"#{@method} - User:<#{user.name}> Begin Associations [user.associations]\")\n user.associations.sort.each { |assc| $evm.log(\"info\", \"#{@method} - User:<#{user.name}> Associations - #{assc}\")}\n $evm.log(\"info\",\"#{@method} - User:<#{user.name}> End Associations [user.associations]\")\n $evm.log(\"info\",\"\")\n\n unless user.tags.nil?\n $evm.log(\"info\",\"#{@method} - User:<#{user.name}> Begin Tags [user.tags]\")\n user.tags.sort.each { |tag_element| tag_text = tag_element.split('/'); $evm.log(\"info\", \"#{@method} - User:<#{user.name}> Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")}\n $evm.log(\"info\",\"#{@method} - User:<#{user.name}> End Tags [user.tags]\")\n $evm.log(\"info\",\"\")\n end\n\n #$evm.log(\"info\",\"#{@method} - User:<#{user.name}> Begin Virtual Columns [user.virtual_column_names]\")\n #user.virtual_column_names.sort.each { |vcn| $evm.log(\"info\", \"#{@method} - User:<#{user.name}> Virtual Columns - #{vcn}: #{user.send(vcn).inspect}\")}\n #$evm.log(\"info\",\"#{@method} - User:<#{user.name}> End Virtual Columns [user.virtual_column_names]\")\n #$evm.log(\"info\",\"\")\n end\n end", "def custom_inspect(object, *ivars_to_skip)\n variables = (object.instance_variables - ivars_to_skip).\n map { |var| \"#{var}=#{object.instance_variable_get(var).inspect}\" }.\n join(', ')\n \"<#{object.class}: #{variables}>\"\n end", "def inspect\n result = +\"#<#{self.class.name}:#{object_id}\"\n result << ' @vertices=['\n list = vertices.map { |v| \"#<#{v.selfie}>\" }\n result << list.join(', ')\n result << '] '\n edges = []\n vertices.each do |v|\n edges << v.edges do |e|\n result << \"#{v.object_id} #{e.inspect}\"\n end\n end\n result << \"edges=[#{edges.join(\",\\n \")}]>\"\n result\n end", "def print_objects\n @header_object.each_pair do |key,val|\n puts \"#{key}: #{val[0]} #{val[1]} #{val[2]}\"\n end\n end", "def column_names\n @column_names || owner.column_names\n end", "def association_columns(*by_associations) #:nodoc:\n if @object.present? && @object.class.respond_to?(:reflections)\n @object.class.reflections.collect do |name, association_reflection|\n if by_associations.present?\n name if by_associations.include?(association_reflection.macro)\n else\n name\n end\n end.compact\n else\n []\n end\n end", "def display_fields\n database_field_names\n end", "def autoreport_association_name_columns(reflection)\n %w(name email title)\n end", "def pp_object(obj)\n object_address_group(obj) {\n seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|\n breakable\n v = v.to_s if Symbol === v\n text v\n text '='\n group(1) {\n breakable ''\n pp(obj.instance_eval(v))\n }\n }\n }\n end", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n # $walk_associations_whitelist & $walk_associations_blacklist hashes\n #\n associations = []\n associated_objects = []\n duplicates = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n if associations.length.zero?\n print_line($recursion_level, \"--- no associations ---\")\n else\n print_line($recursion_level, \"--- associations follow ---\")\n duplicates = associations.select{|item| associations.count(item) > 1}\n if duplicates.length > 0\n print_line($recursion_level,\n \"*** De-duplicating the following associations: #{duplicates.inspect} ***\")\n end\n associations.uniq.sort.each do |association|\n begin\n associated_objects = Array.wrap(this_object.method_missing(:send, association))\n if associated_objects.length == 0\n print_line($recursion_level,\n \"#{object_string}.#{association} (type: Association (empty))\")\n else\n print_line($recursion_level, \"#{object_string}.#{association} (type: Association)\")\n #\n # See if we need to walk this association according to the walk_association_policy\n # variable, and the walk_association_{whitelist,blacklist} hashes\n #\n if $walk_association_policy == 'whitelist'\n if $walk_association_whitelist.has_key?(this_object_class) &&\n ($walk_association_whitelist[this_object_class].include?('ALL') ||\n $walk_association_whitelist[this_object_class].include?(association.to_s))\n walk_association(object_string, association, associated_objects)\n else\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' isn't in the walk_association_whitelist \" \\\n \"hash for #{this_object_class} ***\")\n end\n elsif $walk_association_policy == 'blacklist'\n if $walk_association_blacklist.has_key?(this_object_class) &&\n ($walk_association_blacklist[this_object_class].include?('ALL') ||\n $walk_association_blacklist[this_object_class].include?(association.to_s))\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' is in the walk_association_blacklist \" \\\n \"hash for #{this_object_class} ***\")\n else\n walk_association(object_string, association, associated_objects)\n end\n else\n print_line($recursion_level,\n \"*** Invalid $walk_association_policy: #{$walk_association_policy} ***\")\n exit MIQ_ABORT\n end\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} association: \\'#{association}\\', gives a \" \\\n \"NoMethodError when accessed (product bug?) ***\")\n next\n end\n end\n print_line($recursion_level, \"--- end of associations ---\")\n end\n else\n print_line($recursion_level, \"--- no associations ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_associations) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def showable_columns\n showable_attributes.keys\n end", "def sql_columns\n \"(#{attributes.keys.join(\", \")})\"\n end", "def columns\n # we want to delay initializing to the @core.columns set for as long as possible. Too soon and .search_sql will not be available to .searchable?\n unless defined? @columns\n self.columns = @core.columns.collect { |c| c.name if @core.columns._inheritable.include?(c.name) && c.searchable? && c.association.nil? && c.text? }.compact\n end\n @columns\n end", "def columns; self.class.columns; end", "def inspect\n\t\treturn %{#<%s:0x%0x %s>} % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.ivar_descriptions.join( ', ' ),\n\t\t]\n\tend", "def set_default_virtual(c)\n if c[:virtual].nil? # sometimes at maybe handy to mark a column as non-virtual forcefully\n assoc, assoc_method = assoc_and_assoc_method_for_attr(c)\n if assoc\n c[:virtual] = true if !assoc.klass.column_names.map(&:to_sym).include?(assoc_method.to_sym)\n else\n c[:virtual] = true if !data_class.column_names.map(&:to_sym).include?(c[:name].to_sym)\n end\n end\n end", "def get_object_display_message(object)\n values = []\n object.display_fields.each do |field|\n values << object.send(field)\n end\n values\n end", "def inspect\n id_text = __id__.to_s(16).rjust(14, ?0)\n addr_text = self.address.to_s(16).rjust(14, ?0)\n\n member_text = if ! null? && ::Snow::CStruct.long_inspect\n # Get member text\n all_members_text = (self.class::MEMBERS.map do |member|\n name = member.name\n type = member.type\n align = member.alignment\n length = member.length\n length_decl = length > 1 ? \"[#{length}]\" : ''\n\n values_text = if length > 1\n single_member_text = (0 ... length).map { |index|\n \"[#{ index }]=#{ self.__send__(member.name, index).inspect }\"\n }.join(', ')\n\n \"{ #{ single_member_text } }\"\n else\n self.__send__(member.name).inspect\n end\n\n \"#{ name }:#{ type }#{ length_decl }:#{ align }=#{ values_text }\"\n\n end).join('; ')\n\n \" #{all_members_text}\"\n else # member_text = if ...\n # Skip members\n ''\n end # member_text = if ...\n\n \"<#{ self.class }:0x#{ id_text } *0x#{ addr_text }:#{ self.bytesize }:#{ self.alignment }#{member_text}>\"\n end", "def attr_columns\n @attr_columns\n end", "def columns\n @columns = @clazz.columns_hash.map do |name, column|\n [name, @columns[name] || Column.new(column, @dump)]\n end.to_h.with_indifferent_access\n end", "def inspect\n instance_variables.each_with_object([\n \"\\n#<#{self.class}:0x#{object_id.to_s(16)}>\",\n \"\\tInstance variables:\"\n ]) do |item, result|\n result << \"\\t\\t#{item} = #{instance_variable_get(item)}\"\n result\n end.join(\"\\n\")\n end", "def inspect\n sprintf(\"#<%s:%#0x(%s)>\", self.class.name, object_id, to_s)\n end", "def printable_with_mongoid(object)\n \n printable = printable_without_mongoid(object)\n if printable == :self\n if object.respond_to?(:fields)\n printable = :mongoid_instance\n end\n elsif printable == :class and !object.respond_to?(:to_model)\n printable = :mongoid_class\n end\n printable\n end", "def column_names\n @entity_columns.map(&:name).map(&:to_s)\n end", "def virtual_row_columns(columns, block)\n if block\n v = Sequel.virtual_row(&block)\n if v.is_a?(Array)\n columns.concat(v)\n else\n columns << v\n end\n end\n end", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def revert_columns(object)\n self.class.column_names.each do |col|\n next unless self.class.clone_column?(col)\n value = self.send(\"#{col}_changed?\") ? self.send(\"#{col}_was\") : self.send(col)\n object.send(\"#{col}=\", value)\n end\n end", "def column_virtual? c\n raise NotImplementedError\n end", "def fetch_columns\n raise \"Model name can't be blank\" if @model_name.nil?\n\n @model_name.attribute_names\n end", "def m_tabla_fields(objeto)\n\t\tobjeto.class::TABLA_FIELDS\n\tend", "def to_dot\n return unless gv_object\n gv_object.to_s\n end", "def dump( out )\n out << \"foreign_key #{out_columns}, #{out_table_name}#{out_opts}\"\n end", "def columns\n @model.columns.map{|c| c.name}\n end", "def inspect\n result = +\"#<#{self.class.name}:#{object_id}\"\n symbol_names = members.map(&:name)\n result << \" @members=#{symbol_names}>\"\n result\n end", "def inspect\n to_table.render :ascii\n end", "def reflection_or_attribute_name; end", "def display_attrtype_details( attrtype )\n\t\tocs = self.directory.schema.object_classes.values.find_all do |oc|\n\t\t\t( oc.must_oids | oc.may_oids ).include?( attrtype.name.to_sym )\n\t\tend\n\n\t\tif ocs.empty?\n\t\t\tself.prompt.say \"No objectClasses with the '%s' attribute are in the current schema.\" %\n\t\t\t\t[ attrtype.name ]\n\t\telse\n\t\t\tocnames = ocs.uniq.map( &:name ).map( &:to_s ).sort\n\n\t\t\tself.prompt.say \"objectClasses with the '%s' attribute in the current schema:\" %\n\t\t\t\t[ attrtype.name ]\n\t\t\tself.prompt.say( self.prompt.list(ocnames, :columns_across) )\n\t\tend\n\tend", "def columns_for_search\n self.entity_columns.select(\"name, ref_type, ref_name, col_type\")\n end", "def set_default_virtual(c)\n if c[:virtual].nil? # sometimes at maybe handy to mark a column as non-virtual forcefully\n assoc, assoc_method = assoc_and_assoc_method_for_column(c)\n if assoc\n c[:virtual] = true if !assoc.klass.column_names.map(&:to_sym).include?(assoc_method.to_sym)\n else\n c[:virtual] = true if !data_class.column_names.map(&:to_sym).include?(c[:name].to_sym)\n end\n end\n end", "def get_schema_info(klass, options)\n info = []\n klass.columns.each do |col|\n attrs = []\n attrs << \"default(#{quote(col.default)})\" unless col.default.nil?\n attrs << \"not null\" unless col.null\n attrs << \"primary key\" if col.name == klass.primary_key\n\n col_type = col.type.to_s\n if col_type == \"decimal\"\n col_type << \"(#{col.precision}, #{col.scale})\"\n else\n col_type << \"(#{col.limit})\" if col.limit\n end\n\n # Check out if we got a geometric column\n # and print the type and SRID\n if col.respond_to?(:geometry_type)\n attrs << \"#{col.geometry_type}, #{col.srid}\"\n end\n\n # Check if the column has indices and print \"indexed\" if true\n # If the indice include another colum, print it too.\n if options[:simple_indexes] # Check out if this column is indexed\n indices = klass.connection.indexes(klass.table_name)\n if indices = indices.select { |ind| ind.columns.include? col.name }\n indices.each do |ind|\n ind = ind.columns.reject! { |i| i == col.name }\n attrs << (ind.length == 0 ? \"indexed\" : \"indexed => [#{ind.join(\", \")}]\")\n end\n end\n end\n info << { :name => col.name, :type => col_type, :attrs => attrs.join(\", \"), :human_name => klass.respond_to?(:human_attribute_name) ? klass.human_attribute_name(col.name) : col.name }\n end\n info\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def essential_columns(model_class)\n model_class.reflect_on_all_associations.inject([@primary_key]) do |arr, assoc|\n if assoc.options[:dependent] && assoc.macro == :belongs_to\n arr << assoc.association_foreign_key\n end\n arr\n end\n end" ]
[ "0.8149296", "0.6227594", "0.6227594", "0.6129865", "0.60626733", "0.5890227", "0.5839619", "0.56068194", "0.5594218", "0.5587403", "0.5437805", "0.5437374", "0.5411703", "0.5389679", "0.5375347", "0.5261109", "0.5257295", "0.5251589", "0.5241231", "0.5229373", "0.52264297", "0.5209367", "0.5148022", "0.5106266", "0.5097334", "0.5093346", "0.5064144", "0.5052629", "0.5027317", "0.5024707", "0.49946257", "0.497447", "0.49423814", "0.49386182", "0.49386182", "0.49363545", "0.49047586", "0.490286", "0.48688558", "0.485798", "0.48499322", "0.48493844", "0.48410776", "0.4830979", "0.48289382", "0.47897434", "0.47688544", "0.47662234", "0.47409138", "0.47373086", "0.47265577", "0.4725822", "0.47131312", "0.47117242", "0.47019696", "0.469835", "0.46976072", "0.46881005", "0.46778795", "0.46740746", "0.4668777", "0.46662682", "0.46631607", "0.4662102", "0.466101", "0.46594763", "0.46470916", "0.46389824", "0.46331117", "0.4631815", "0.46095103", "0.45880592", "0.45860615", "0.4586058", "0.45763567", "0.4569802", "0.45672506", "0.45641336", "0.4562453", "0.45608598", "0.45551446", "0.4546947", "0.4541006", "0.4537462", "0.4535042", "0.4532839", "0.45280367", "0.45249116", "0.4512656", "0.45092314", "0.45064843", "0.4501025", "0.44976893", "0.44945586", "0.44913855", "0.44846743", "0.44775656", "0.44653443", "0.4465212", "0.4464526" ]
0.8270801
0
End of print_virtual_columns Method: is_plural? Purpose: Test whether a string is plural (as opposed to singular) Arguments: astring: text string to be tested Returns: Boolean
def is_plural?(astring) astring.singularize != astring end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_plural(word)\n\treturn word[-1] === 's' ? true : false\nend", "def plural?\n self == self.pluralize\n end", "def is_plural?(value)\n\t(value > 1) || (value < 1)\nend", "def plural?(is_plural,term)\n singular_plural = term.split('/')\n if singular_plural.size == 1\n singular_plural << \"#{singular_plural[0]}s\"\n end\n singular_plural[is_plural ? 1 : 0]\n end", "def plural?\n self.class.pluralized || false\n end", "def plural?\n self.plural_head\n end", "def plural?(word)\n word[-1] == 'S' && word[-2] != 'S'\n end", "def plural?(word)\n word = require_string!(word)\n\n word == pluralize(word)\n end", "def plural?\n !@msgid_plural.nil?\n end", "def plural?\n @msgid_plural != nil\n end", "def test_plural_ruby\n\t\tp = Print.new\n\t\tassert_equal('rubies',p.singular_or_plural(0,'rubies'))\n\tend", "def test_plural_int\n assert_equal @p.plural?(1), 'ruby'\n end", "def test_plural_int2\n assert_equal @p.plural?(2), 'rubies'\n end", "def test_plural_fake_ruby\n\t\tp = Print.new\n\t\tassert_equal('fake rubies',p.singular_or_plural(0,'fake'))\n\tend", "def test_plural_string\n assert_raises(StandardError) {@p.plural?('1')}\n end", "def is_plural?(model_name)\n model_hash = content_types.select{|x| x[:name] == model_name}.first\n return model_hash[:plural]\n end", "def test_pluralize_one\n assert_equal \"book\", @d.pluralize(\"book\", 1)\n end", "def singular?(plural)\n if plural =~ /s$/\n if plural =~ /ies$/\n plural.gsub(/ies$/, 'y')\n else\n plural.gsub(/s$/, '')\n end\n else\n plural #input not plural\n end\n end", "def plural?(num)\n return 'ruby' if num == 1\n return 'rubies' if num > 1\n end", "def uncountable?\n singular_table_name == plural_table_name\n end", "def pluralize\n p = self[ :plural ]\n p = ! scalar? if p.nil?\n p = 's' if p == false\n p = 'p' if p == true\n p.to_s\n end", "def plural?(method)\n str = method.to_s\n plr = str.to_sym\n sgl = str.sub(/e?s$/, '').to_sym\n\n /s$/ === str && Watirsome.watir_methods.include?(plr) && Watirsome.watir_methods.include?(sgl)\n end", "def assertPlural( singular, plural, altplural, comment )\n\t\trval, pl_noun, pl_verb, pl, pl_val, altpl_val = [nil] * 6\n\n\t\tisNv = false\n\t\tcase comment\n\t\twhen /verb/i\n\t\t\tisNv = 'verb'\n\t\twhen /noun/i\n\t\t\tisNv = 'noun'\n\t\tend\n\n\t\top = \"Pluralizing '#{singular}': \"\n\t\tassert_nothing_raised( op + \"plural verb\" ) {\n\t\t\tpl_verb = singular.en.plural_verb\n\t\t}\n\t\tassert_nothing_raised( op + \"plural noun\" ) {\n\t\t\tpl_noun = singular.en.plural_noun\n\t\t}\n\t\tassert_nothing_raised( op + \"plural\" ) {\n\t\t\tpl = singular.en.plural\n\t\t}\n\n\t\tif !altplural.nil? && !altplural.empty?\n\t\t\tbegin\n\t\t\t\tassert_nothing_raised( op + \"classical\" ) {\n\t\t\t\t\tLinguistics::classical = true\n\t\t\t\t\taltpl_val = singular.en.plural\n\t\t\t\t}\n\t\t\tensure\n\t\t\t\tLinguistics::classical = false\n\t\t\tend\n\t\tend\n\n\t\tpl_val = isNv ? (isNv == \"noun\" ? pl_noun : pl_verb) : pl\n\n\t\tassert_equal plural, pl_val, \"Plural of '#{singular}'\"\n\t\tassert_equal altplural, altpl_val,\n\t\t\t\"Classical plural of '#{singular}'\" unless\n\t\t\taltplural.nil? or altplural.empty?\n\tend", "def is_string?\n columns.all? { |col| col.is_string? }\n end", "def plural?(method)\n str = method.to_s\n plr = str.to_sym\n sgl = str.sub(/e?s$/, '').to_sym\n\n !str.match(/s$/).nil? &&\n Watirsome.watir_methods.include?(plr) &&\n Watirsome.watir_methods.include?(sgl)\n end", "def test_plural_zero\n assert_nil @p.plural?(0) # pass\n end", "def plural?(word, term: :noun)\n case term.to_sym\n when :noun, :n\n Noun[word].plural?\n when :verb, :v\n Verb[word].plural?\n else\n raise Error, \"Unknown option '#{term}' as a term\"\n end\n end", "def plural(n)\n n != 1\nend", "def pluralize(string)\n if string[-1] == 'y'\n \"#{string[0..(string.length - 2)]}ies\"\n else\n \"#{string}s\"\n end\n end", "def plural\n return word if word.to_s.empty?\n\n find_match(Inflection.configuration.plurals[:noun]) ||\n (uncountable? && word) || find_match(Nouns.plurals) || word\n end", "def pluralize(word); end", "def simple_pluralize count, singular, plural=nil\n ((count == 1 || count =~ /^1(\\.0+)?$/) ? singular : (plural || singular.pluralize))\n end", "def singular?\n self == self.singularize\n end", "def pluralize(singularStr, num)\n if num == 1\n return singularStr\n else\n if singularStr[-1] == \"s\" # singularStr[-1] returns last character of string\n return \"#{singularStr}es\"\n else\n return \"#{singularStr}s\"\n end\n end\n end", "def pluralize(word)\n return word + \"s\" if pluralize?\n word\nend", "def pluralize_word(singular)\n singular.respond_to?(:pluralize) ? singular.pluralize : singular + 's'\n end", "def plural(input)\n input>1 ? 's' : ''\n end", "def test_singular_fake_ruby\n\t\tp = Print.new\n\t\tassert_equal('fake ruby',p.singular_or_plural(1,'fake'))\n\tend", "def simple?\n\t\tself.class.name.demodulize.tableize.singularize == \"simple\"\n\tend", "def test_print_plural_ruby\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 2 rubies in Town.\\n\") {p.print_one_type([2,0],'Town')}\n\tend", "def pluralize(l_string) #count, singular, plural = nil)\n # map the arguments like in the original pluralize method\n count, singular, plural = l_string.split(',').map{ |arg| arg.strip}\n\n \"#{count} \" + if count == 1 || count == '1'\n singular\n elsif plural\n plural\n elsif Object.const_defined?(\"Inflector\")\n Inflector.pluralize(singular)\n else\n singular + \"s\"\n end\n end", "def name_plural() name_singular + 's' end", "def pluralize_word(count, singular, plural = nil)\n ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end", "def has_a_minimum_one_string_type?\n self.index_table_fields.map(&:field_name).each do |field_name|\n self.table_name.constantize.columns.each {|elt| return true if (elt.name == field_name && (elt.type == :string || elt.type == :text))} \n end\n return false\n end", "def pluralizer string, n\n if n == 1 \n puts \"#{n} #{string}\"\n elsif n > 1 || n==0\n puts \"#{n} #{string}s\"\n end\nend", "def pluralize(word, nb)\n if (nb > 1)\n return \"#{word}s\"\n else\n return \"#{word}\"\n end\nend", "def string?\n @kind == :double_string_lit || @kind == :single_string_lit\n end", "def make_plural\n\t\tsentence_array=Array.new\n\t\tnew_sentence_array=Array.new\n\t\tsentence_array= to_str.split(/ /)\n\t\t\t(0..sentence_array.size-1).each do |cnt|\n\t\t\t\tnew_sentence_array << sentence_array[cnt].strip.downcase.pluralize\n\t\t\tend\n\t\treturn new_sentence_array.join(\" \")\n\tend", "def pluralize(count, singular, plural = nil)\n \"#{count} \" + if count == 1\n singular\n elsif plural\n plural\n elsif Object.const_defined?(\"Inflector\")\n Inflector.pluralize(singular)\n else\n singular + \"s\"\n end\n end", "def friendly_name_pluralized\n @friendly_name_pluralized ||= self.name.humanize.pluralize\n end", "def pluralizer string, number\n if n == 1 \n puts \"#{number} #{string}\"\n elsif string == \"person\"\n puts \"#{number} people\"\n elsif string == \"child\"\n puts \"#{number} children\"\n elsif string == \"goose\"\n puts \"#{number} geese\"\n elsif n > 1 \n puts \"#{number} #{string}s\"\n end\nend", "def pluralize_collection collection, noun \n if collection.size == 1 \n \"1 #{noun}\"\n else \n \"#{collection.size} #{noun.pluralize}\"\n end\n end", "def test_singular_ruby\n\t\tp = Print.new\n\t\tassert_equal('ruby',p.singular_or_plural(1,'rubies'))\n\tend", "def singular?\n not regular?\n end", "def pluralize(count, word)\n \"#{word}#{'s' unless count.to_f == 1}\"\n end", "def pluralize(count, word)\n \"#{word}#{'s' unless count.to_i == 1}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def plural(int, str)\n return \"#{int} #{str.pluralize}\" unless int == 1\n \"#{int} #{str.singularize}\"\n end", "def test_plural_float\n assert_raises(StandardError) {@p.plural?(nil)}\n end", "def test_pluralization\r\n GLoc.add_localized_strings :en, :_gloc_rule_default => %[|n| case n; when 0 then '_none'; when 1 then '_single'; else '_many'; end], :a_single => '%d man', :a_many => '%d men', :a_none => 'No men'\r\n GLoc.add_localized_strings :en, :_gloc_rule_asd => %[|n| n<10 ? '_few' : '_heaps'], :a_few => 'a few men (%d)', :a_heaps=> 'soo many men'\r\n set_language :en\r\n\r\n assert_equal 'No men', lwr(:a, 0)\r\n assert_equal '1 man', lwr(:a, 1)\r\n assert_equal '3 men', lwr(:a, 3)\r\n assert_equal '20 men', lwr(:a, 20)\r\n\r\n assert_equal 'a few men (0)', lwr_(:asd, :a, 0)\r\n assert_equal 'a few men (1)', lwr_(:asd, :a, 1)\r\n assert_equal 'a few men (3)', lwr_(:asd, :a, 3)\r\n assert_equal 'soo many men', lwr_(:asd, :a, 12)\r\n assert_equal 'soo many men', lwr_(:asd, :a, 20)\r\n \r\n end", "def cached_plural_find(singular, plural)\n FastGettext.cached_plural_find(singular, plural)\n rescue Errno::ENOENT => error\n Yast.y2warning(\"File not found when translating '#{singular}/#{plural}' \"\\\n \"on textdomain #{@my_textdomain}'. Error: #{error}. Backtrace: #{error.backtrace}\")\n false\n end", "def pluralize\n self[-1] == 's' ? \"#{self}es\" : \"#{self}s\"\n end", "def singular?(word)\n word = require_string!(word)\n\n word == singularize(word)\n end", "def test_print_plural_fake_ruby\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound 2 fake rubies in Town.\\n\") {p.print_one_type([0,2],'Town')}\n\tend", "def default_pluralizer(count)\n count == 1 ? :one : :other\n end", "def pluralize(word)\n result = word.to_s.dup\n\n if word.empty? || inflections.uncountables.include?(result.downcase)\n result\n else\n inflections.plurals.each do |(rule, replacement)| \n break if result.gsub!(rule, replacement)\n end\n result\n end\n end", "def cplural(word, n, pad = false)\n sing = word\n plur = word.pluralize\n word = n == 1 ? sing : plur\n pad = [sing, plur].map(&:length).max\n \"%-#{pad}s\" % word\nend", "def pluralize(text)\n \"#{text.to_s}s\"\n end", "def can_create_pluralized_model_for?(klass)\n !klass.to_s.match(/^\\#/)\n end", "def plural(*args)\n TextHelper.pluralize(*args)\n end", "def pluralize\n @name.pluralize\n end", "def test_get_ounce_string_plural\n ret_string = @game.get_ounces_string(2)\n assert_equal(' ounces', ret_string)\n end", "def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end", "def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + ((count == 1 || count == '1') ? singular : (plural || singular.pluralize))\n end", "def pluralize(count, singular, plural)\n word = count == 1 ? singular : plural\n \"#{count || 0} #{word}\"\n end", "def plural_target\n @plural_target ||= target.presence && target.to_s.underscore.pluralize\n end", "def pluralize(count = nil)\n if count == 1\n self\n else\n MotionSupport::Inflector.pluralize(self)\n end\n end", "def all_words_capitalized?(arr)\n\tarr.all? do |word|\n\t\tword == word.capitalize\n\tend\nend", "def pluralize( name )\n warn_nyi( \"support for pluralization guides in pluralize()\" )\n return name.pluralize\n end", "def plural_verb( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word,\n\t\t\tpluralize_special_verb(word, count) ||\n\t\t\tpluralize_general_verb(word, count) )\n\n\t\treturn pre + plural + post\n\tend", "def in_all_strings?(long_strings, short_string)\nend", "def pluralize(number_of_bottles)\n if number_of_bottles > 1\n \"#{number_of_bottles} bottles\"\n elsif number_of_bottles == 1\n \"1 bottle\"\n else\n \"No more bottles\"\n end\nend", "def test_print_books_plural\n\t\tassert_output(\"Driver 1 obtained 3 books!\\n\") { print_books(3,1) }\n\tend", "def plural_without_count(count, word)\n count == 1 ? word : word.pluralize\n end", "def generic_meta_description?\n [truncate(document.title, length: 30, omission: nil.to_s), meta_description].map{|d| d.downcase.split}.reduce(&:&).size > 0\n end", "def _plural_name\n @plural_name || begin\n @plural_name = Origen::Componentable.componentable_names(self)[:plural]\n @singleton_name = Origen::Componentable.componentable_names(self)[:singleton]\n end\n end", "def pluralize(count, singular, plural)\n word = count == 1 ? singular : plural\n \"#{count || 0} #{word}\"\nend", "def pluralize(count, singular, plural_arg = nil, plural: plural_arg, locale: I18n.locale)\n word = if count == 1 || count.to_s.match?(/^1(\\.0+)?$/)\n singular\n else\n plural || singular.pluralize(locale)\n end\n\n \"#{count || 0} #{word}\"\n end", "def plural_adjective( count=2 )\n\t\tphrase = self.to_s\n\t\tmd = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase )\n\t\tpre, word, post = md.captures\n\n\t\treturn phrase if word.nil? or word.empty?\n\n\t\tplural = postprocess( word, pluralize_special_adjective(word, count) || word )\n\n\t\treturn pre + plural + post\n\tend", "def inflect(word,count)\n if count>1\n word.pluralize\n else\n word\n end\n end", "def pluralise(number, word)\n return (number > 1)? \"#{number} #{word}s\" : \"#{number} #{word}\"\nend", "def plural(int, str)\r\n return \"#{int} #{str}s\" unless int == 1\r\n \"#{int} #{str}\"\r\n end", "def pluralize(count, singular, plural = nil)\n \"#{count || 0} \" + (count == 1 ? singular : (plural || singular.pluralize))\n end", "def string?(description)\n description.type == :str\n end", "def plural( count=2 )\n\t\tphrase = if self.respond_to?( :to_int )\n\t\t\t\tself.numwords\n\t\t\telse\n\t\t\t\tself.to_s\n\t\t\tend\n\n\t\tself.log.debug \"Pluralizing %p\" % [ phrase ]\n\t\tpre = text = post = nil\n\n\t\t# If the string has whitespace, only pluralize the middle bit, but\n\t\t# preserve the whitespace to add back to the result.\n\t\tif md = /\\A(\\s*)(.+?)(\\s*)\\Z/.match( phrase.to_s )\n\t\t\tpre, text, post = md.captures\n\t\telse\n\t\t\treturn phrase\n\t\tend\n\n\t\tplural = postprocess( text,\n\t\t\tpluralize_special_adjective(text, count) ||\n\t\t\tpluralize_special_verb(text, count) ||\n\t\t\tpluralize_noun(text, count) )\n\n\t\treturn pre + plural + post\n\tend", "def pluralize(bottles, text)\n return text + 's' if bottles != 1\n text\nend", "def pluralize amount, singular\n \"#{amount} #{singular}#{amount == 1 ? '' : 's'}\"\n end", "def plural(num,str)\n\n num_str = number_format(num)\n if num == 1\n return num_str + ' ' + str\n else\n return num_str + ' ' + str.pluralize\n end \n \n end" ]
[ "0.73216754", "0.73002934", "0.72870815", "0.70495206", "0.69248646", "0.69102776", "0.69025254", "0.6902409", "0.6580795", "0.6542817", "0.6453487", "0.62955916", "0.6260426", "0.6239439", "0.6238155", "0.6212102", "0.62064564", "0.61395943", "0.6068515", "0.6041791", "0.5980264", "0.5939167", "0.5792762", "0.57827234", "0.5780304", "0.5687068", "0.56544834", "0.5637959", "0.56180894", "0.5571396", "0.55562955", "0.552544", "0.5524107", "0.54258555", "0.54257774", "0.5402292", "0.5401426", "0.5356593", "0.53403014", "0.5324463", "0.5320401", "0.5319748", "0.52796227", "0.5260589", "0.5235831", "0.52274346", "0.52135664", "0.52095765", "0.52056634", "0.5190466", "0.51876456", "0.51785177", "0.51766086", "0.5175873", "0.5157713", "0.5153821", "0.51493067", "0.51493067", "0.51493067", "0.5148274", "0.514315", "0.5139778", "0.51383495", "0.5131964", "0.5125637", "0.5123878", "0.512341", "0.50806403", "0.5076888", "0.5070268", "0.5069452", "0.5062565", "0.5061752", "0.5058008", "0.5035744", "0.5035744", "0.50251657", "0.5018247", "0.5017987", "0.5015545", "0.49945006", "0.49877733", "0.4984179", "0.49731764", "0.49719274", "0.49711388", "0.4970513", "0.49658048", "0.49649855", "0.49629733", "0.49544445", "0.49418572", "0.493252", "0.49224404", "0.4920904", "0.49167374", "0.48924598", "0.4882979", "0.48810288", "0.48747984" ]
0.807028
0
End of is_plural? Method: walk_association Purpose: Walks the association into the object passed to it Arguments: object_string : friendly text string name for the object association : friendly text string name for the association associated_objects : the list of objects in the association Returns: None
def walk_association(object_string, association, associated_objects) begin # # Assemble some fake code to make it look like we're iterating though associations (plural) # number_of_associated_objects = associated_objects.length if is_plural?(association) assignment_string = "#{object_string}.#{association}.each do |#{association.singularize}|" else assignment_string = "#{association} = #{object_string}.#{association}" end print_line($recursion_level, "#{assignment_string}") associated_objects.each do |associated_object| associated_object_class = "#{associated_object.method_missing(:class)}".demodulize associated_object_id = associated_object.id rescue associated_object.object_id print_line($recursion_level, "(object type: #{associated_object_class}, object ID: #{associated_object_id})") if is_plural?(association) walk_object("#{association.singularize}", associated_object) if number_of_associated_objects > 1 print_line($recursion_level, "--- next #{association.singularize} ---") number_of_associated_objects -= 1 else print_line($recursion_level, "--- end of #{object_string}.#{association}.each do |#{association.singularize}| ---") end else walk_object("#{association}", associated_object) end end rescue => err $evm.log("error", "#{$method} (walk_association) - [#{err}]\n#{err.backtrace.join("\n")}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_association(object, associations); end", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n # $walk_associations_whitelist & $walk_associations_blacklist hashes\n #\n associations = []\n associated_objects = []\n duplicates = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n if associations.length.zero?\n print_line($recursion_level, \"--- no associations ---\")\n else\n print_line($recursion_level, \"--- associations follow ---\")\n duplicates = associations.select{|item| associations.count(item) > 1}\n if duplicates.length > 0\n print_line($recursion_level,\n \"*** De-duplicating the following associations: #{duplicates.inspect} ***\")\n end\n associations.uniq.sort.each do |association|\n begin\n associated_objects = Array.wrap(this_object.method_missing(:send, association))\n if associated_objects.length == 0\n print_line($recursion_level,\n \"#{object_string}.#{association} (type: Association (empty))\")\n else\n print_line($recursion_level, \"#{object_string}.#{association} (type: Association)\")\n #\n # See if we need to walk this association according to the walk_association_policy\n # variable, and the walk_association_{whitelist,blacklist} hashes\n #\n if $walk_association_policy == 'whitelist'\n if $walk_association_whitelist.has_key?(this_object_class) &&\n ($walk_association_whitelist[this_object_class].include?('ALL') ||\n $walk_association_whitelist[this_object_class].include?(association.to_s))\n walk_association(object_string, association, associated_objects)\n else\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' isn't in the walk_association_whitelist \" \\\n \"hash for #{this_object_class} ***\")\n end\n elsif $walk_association_policy == 'blacklist'\n if $walk_association_blacklist.has_key?(this_object_class) &&\n ($walk_association_blacklist[this_object_class].include?('ALL') ||\n $walk_association_blacklist[this_object_class].include?(association.to_s))\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' is in the walk_association_blacklist \" \\\n \"hash for #{this_object_class} ***\")\n else\n walk_association(object_string, association, associated_objects)\n end\n else\n print_line($recursion_level,\n \"*** Invalid $walk_association_policy: #{$walk_association_policy} ***\")\n exit MIQ_ABORT\n end\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} association: \\'#{association}\\', gives a \" \\\n \"NoMethodError when accessed (product bug?) ***\")\n next\n end\n end\n print_line($recursion_level, \"--- end of associations ---\")\n end\n else\n print_line($recursion_level, \"--- no associations ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_associations) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def process_association(class_name, assoc)\n\n STDERR.print \"\\t\\tProcessing model association #{assoc.name.to_s}\\n\" if @options.verbose\n\n # Skip \"belongs_to\" associations\n return if assoc.macro.to_s == 'belongs_to'\n\n # Only non standard association names needs a label\n \n # from patch #12384\n # if assoc.class_name == assoc.name.to_s.singularize.camelize\n \n assoc_class_name = (assoc.class_name.respond_to? 'underscore') ? assoc.class_name.pluralize.singularize.camelize : assoc.class_name \n if assoc_class_name == assoc.name.to_s.singularize.camelize\n assoc_name = ''\n else\n assoc_name = assoc.name.to_s\n end \n\n if assoc.macro.to_s == 'has_one' \n assoc_type = 'one-one'\n elsif assoc.macro.to_s == 'has_many' && (! assoc.options[:through])\n assoc_type = 'one-many'\n else # habtm or has_many, :through\n return if @habtm.include? [assoc.class_name, class_name, assoc_name]\n assoc_type = 'many-many'\n @habtm << [class_name, assoc.class_name, assoc_name]\n end \n # from patch #12384 \n # @graph.add_edge [assoc_type, class_name, assoc.class_name, assoc_name]\n @graph.add_edge [assoc_type, class_name, assoc_class_name, assoc_name] \n end", "def scaffold_associated_objects(association, object, options)\n object.send(association)\n end", "def prepare_to_change_association(object)\n name = association_name(object)\n send(\"#{name}_will_change!\")\n end", "def association(association_name); end", "def fetch_related_objects(subject,association_name,*indices)\n check_subject_and_association(subject,association_name)\n __send__(plural_association_method(subject.type,association_name),subject.rod_id,*indices)\n end", "def sanitize_has_many(association_name)\n association_name = association_name.to_s\n singular_name = association_name.singularize\n nested_name = \"#{association_name}_attributes\"\n klass = association_name.singularize.camelize.constantize\n remap singular_name => nested_name\n remap association_name => nested_name\n ensure_array nested_name\n sanitize_nested_attributes nested_name => klass\n end", "def presents_many(association)\n define_method association do\n present_many(__getobj__.__send__(association))\n end\n\n association\n end", "def sub_object\n splits= @field.split('.')\n object_name = splits.first\n field_names = splits[1..-1] # all but the first\n return unless object_name && obj.respond_to?(object_name)\n object = obj.send(object_name)\n # Its a collection => invoice.items and access is done by ary index:\n # first item => [items.1.name]\n if object.nil?\n # empty relation\n @result.gsub!(@placeholder, '')\n elsif object.is_a?(Array) && ary_index = field_names.first[/\\A\\d*\\z/]\n field_names.delete_at(0) # remove entry from field_names ary\n # replace with empty string if the index does not exist or obj is empty\n @result.gsub!(@placeholder, '') unless object = object[ary_index.to_i-1]\n end\n\n # Recurse and let the referenced object do the expanding\n if object.respond_to?(:expand_placeholders)\n value = object.expand_placeholders(\"[#{field_names.join('.')}]\")\n @result.gsub!(@placeholder, value)\n end\n end", "def scaffold_add_associated_object(association, object, associated_object)\n ap = object.send(association)\n ap << associated_object unless ap.include?(associated_object)\n object.save\n end", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def dump_associations(my_object, my_object_name)\n if my_object.respond_to?(\"associations\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.associations\")\n my_object.associations.sort.each { |a| self.log(:info, \"#{my_object_name} Association - #{a}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.associations\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No associations for #{my_object_name}\")\n end\n end", "def association?(object, associations); end", "def scaffold_remove_associated_objects(association, object, options, *associated_object_ids)\n unless associated_object_ids.empty?\n scaffold_transaction do\n associated_objects = associated_object_ids.collect do |associated_object_id|\n associated_object = scaffold_association_find_object(association, associated_object_id.to_i, :session=>options[:session])\n scaffold_remove_associated_object(association, object, associated_object)\n associated_object\n end\n associated_object_ids.length == 1 ? associated_objects.first : associated_objects\n end\n end\n end", "def association_links(obj)\n if model.lazy_load_association_links?(type, request) && normalized_type != :association_links && request.params['associations'] != 'show'\n \"<div id='lazy_load_association_links' data-object='#{model.primary_key_value(obj)}' data-type='#{type}'><a href=\\\"#{url_for(\"#{type}/#{model.primary_key_value(obj)}?associations=show\")}\\\">Show Associations</a></div>\"\n elsif type == :show\n association_link_list(obj).to_s\n else\n \"#{inline_mtm_edit_forms(obj)}#{association_link_list(obj)}\"\n end\n end", "def has_many(association_name, metadata={})\n\n add_association association_name, :has_many, metadata\n\n association_class_name = metadata.try(:fetch, :class_name, [name.split('::')[0..-2].join('::'), association_name.to_s.classify].reject(&:blank?).join('::'))\n\n # foos\n define_method(association_name) do |*query|\n association_class = association_class_name.constantize\n\n # TODO: Support a more generic version of lazy-loading\n if query.empty? # Ex: Books.all, so we want to cache it.\n ivar = \"@#{association_name}\"\n if instance_variable_defined?(ivar)\n instance_variable_get(ivar)\n elsif self.class.autoload_associations? && association_class.respond_to?(:all)\n instance_variable_set(ivar, Array(association_class.all(\"#{self.class.name.underscore}_id\" => id)))\n else\n []\n end\n else # Ex: Book.all(:name => \"The...\"), so we do not want to cache it\n if self.class.autoload_associations? && association_class.respond_to?(:all)\n Array(association_class.all({\"#{self.class.name.demodulize.underscore}_id\" => id}.merge(query.first)))\n end\n end\n end\n\n # foos=\n define_method(\"#{association_name}=\") do |arg|\n association_class = association_class_name.constantize\n\n attr_name = self.class.name.demodulize.underscore\n objs = (arg.is_a?(Hash) ? arg.values : Array(arg)).map do |obj|\n o = association_class.cast(obj)\n\n if o.respond_to?(\"#{attr_name}=\")\n o.send(\"#{attr_name}=\", self)\n end\n\n if o.respond_to?(\"#{attr_name}_id=\") && respond_to?(:id)\n o.send(\"#{attr_name}_id=\", id)\n end\n\n o\n end\n instance_variable_set(\"@#{association_name}\", objs)\n end\n end", "def scaffold_associated_objects(association, object, options)\n object.send(association,:order => get_ordering_options(scaffold_select_order_association(association)))\n end", "def has_many(association_name)\n add_association(:has_many, association_name.to_s.classify, association_name)\n end", "def reverse_reflection(association_name)\n refl = reflections[association_name]\n return nil if refl.options[:conditions]\n \n reverse_macro = if refl.macro == :has_many\n :belongs_to\n elsif refl.macro == :belongs_to\n :has_many\n end\n refl.klass.reflections.values.find do |r|\n r.macro == reverse_macro and\n r.klass == self and \n !r.options[:conditions] and\n r.primary_key_name == refl.primary_key_name\n end\n end", "def scaffold_add_associated_objects(association, object, options, *associated_object_ids)\n unless associated_object_ids.empty?\n scaffold_transaction do\n associated_objects = associated_object_ids.collect do |associated_object_id|\n associated_object = scaffold_association_find_object(association, associated_object_id.to_i, :session=>options[:session])\n scaffold_add_associated_object(association, object, associated_object)\n associated_object\n end\n associated_object_ids.length == 1 ? associated_objects.first : associated_objects\n end\n end\n end", "def presents_many(association)\n define_method association do\n self.class.present_many(\n object.__send__(association), view_context: view_context)\n end\n\n true\n end", "def association_instance_get(cypher_string, association_obj)\n return if association_cache.nil? || association_cache.empty?\n lookup_obj = cypher_hash(cypher_string)\n reflection = association_reflection(association_obj)\n return if reflection.nil?\n association_cache[reflection.name] ? association_cache[reflection.name][lookup_obj] : nil\n end", "def assert_active_fedora_has_many(subject, association_name, objects)\n association = subject.send(association_name)\n assert_equal objects.count, association.count\n objects.each do |object|\n assert association.include?(object)\n end\n end", "def controller_for_search(object_name, association_name)\n options_for_association(object_name, association_name) do |options|\n Inflector.demodulize(options[:class_name] || association_name).downcase\n end\n end", "def plural_object_name\n singular_object_name.pluralize\n end", "def scaffold_unassociated_objects(association, object, options)\n scaffold_associated_class(association).scaffold_get_objects(:conditions=>[scaffold_unassociated_condition(association, object), scaffold_associated_class(association).scaffold_session_conditions(options[:session])], :order=>scaffold_select_order_association(association), :include=>scaffold_include_association(association))\n end", "def parentize(object, association_name)\n self.parent = object\n self.association_name = association_name\n add_observer(object)\n end", "def scaffold_association_find_object(association, id, options)\n scaffold_associated_class(association).scaffold_find_object(:associated, id, options)\n end", "def association_link_list(obj)\n assocs = model.association_links_for(type, request) \n return if assocs.empty?\n read_only = type == :show\n t = String.new\n t << '<h3 class=\"associated_records_header\">Associated Records</h3>'\n t << \"<ul class='association_links'>\\n\"\n assocs.each do |assoc|\n mc = model.associated_model_class(assoc)\n t << \"<li>\"\n t << association_class_link(mc, assoc)\n t << \"\\n \"\n\n case model.association_type(assoc)\n when :one\n if assoc_obj = obj.send(assoc)\n t << \" - \"\n t << association_link(mc, assoc_obj)\n end\n assoc_objs = []\n when :edit\n if !read_only && model.supported_mtm_edit?(assoc.to_s, request)\n t << \"(<a href=\\\"#{url_for(\"mtm_edit/#{model.primary_key_value(obj)}?association=#{assoc}\")}\\\">associate</a>)\"\n end\n assoc_objs = obj.send(assoc)\n when :new\n if !read_only && mc && mc.supported_action?(:new, request)\n params = model.associated_new_column_values(obj, assoc).map do |col, value|\n \"#{mc.link}%5b#{col}%5d=#{value}\"\n end\n t << \"(<a href=\\\"#{base_url_for(\"#{mc.link}/new?#{params.join('&amp;')}\")}\\\">create</a>)\"\n end\n assoc_objs = obj.send(assoc)\n else\n assoc_objs = []\n end\n\n unless assoc_objs.empty?\n t << \"<ul>\\n\"\n assoc_objs.each do |assoc_obj1|\n t << \"<li>\"\n t << association_link(mc, assoc_obj1)\n t << \"</li>\"\n end\n t << \"</ul>\"\n end\n\n t << \"</li>\"\n end\n t << \"</ul>\"\n end", "def each_association( objectpath )\n begin\n @client.associators(objectpath).each do |assoc|\n yield assoc\n end\n rescue Sfcc::Cim::ErrorInvalidClass, Sfcc::Cim::ErrorInvalidNamespace\n end\n end", "def handle_association_links\n @type = @normalized_type = @subtype\n obj = model.with_pk(@type, request, request.id)\n association_links(obj)\n end", "def perform(string_to_search, category_id, item_id)\n Item.check_desc_for_associations!(string_to_search, category_id, item_id)\n end", "def define_association(assoc, options = {:view => {}, :summary => {}})\n return {:summary => :none} if options[:summary] == :none\n case assoc.macro\n when :has_one, :belongs_to\n if assoc.options[:polymorphic]\n [:polymorphic_select, :name]\n else\n [:select, :name]\n end\n when :has_many, :has_and_belongs_to_many\n if assoc.options[:polymorphic]\n [:polymorphic_membership, :count]\n else\n [:membership, :count]\n end \n end\n end", "def association_link(mc, assoc_obj)\n if mc\n t = h(mc.object_display_name(:association, request, assoc_obj))\n if mc.supported_action?(type, request)\n t = \"<a href=\\\"#{base_url_for(\"#{mc.link}/#{type}/#{mc.primary_key_value(assoc_obj)}\")}\\\">#{t}</a>\"\n end\n t\n else\n h(model.default_object_display_name(assoc_obj))\n end\n end", "def scaffold_remove_associated_object(association, object, associated_object)\n object.send(association).delete(associated_object)\n object.save\n end", "def creating_object_association_for?(object, association)\n object_associations[object.bullet_key].present? &&\n object_associations[object.bullet_key].include?(association)\n end", "def association\n a = element.dataset[:association]\n # send is spoopy, make sure the message you're sending is actually an association\n return unless safe?(session[:model], a)\n\n session[:model].send(a)\n end", "def handle_belongs_to(model, associated)\n __method = __method__\n # trace __FILE__, __LINE__, self, __method__, \" : model.class=#{model.class} associated=#{associated.class} has?=#{has?}\"\n associated = [associated] unless associated.is_a?(Array)\n # trace __FILE__, __LINE__, self, __method__, \" : associated.size=#{associated.size}\"\n if has?\n associated.each do |associate|\n # trace __FILE__, __LINE__, self, __method, \" : model.class=#{model.class} associate=#{associate.class}\"\n inverse = associate.class.belongs_to_association(collection)\n # trace __FILE__, __LINE__, self, __method, \" : model.class=#{model.class} associate=#{associate.class}\"\n if inverse\n # trace __FILE__, __LINE__, self, __method, \" : setting inverse associate.class##{inverse.local_attr} to #{model.class}\"\n associate.send(:\"#{inverse.local_attr}=\", model)\n # trace __FILE__, __LINE__, self, __method\n end\n end\n end\n end", "def has_custom_object association_name, options = {}, &block \n if block_given?\n class_name = \"#{self.name}#{association_name.to_s.singularize.camelcase}\"\n create_class(class_name, CustomObject, &block) #unless defined?(class_name.classify.constantize)\n \n has_many association_name, :class_name=>class_name, :as => :customizable, :dependent => :destroy\n else\n raise \"no block given, which defines a CustomObject subclass\"\n end\n end", "def initialize_association_cache(objects)\n name = self[:name]\n if assign_singular?\n objects.each{|object| object.associations[name] = nil}\n else\n objects.each{|object| object.associations[name] = []}\n end\n end", "def scaffold_association_find_objects(association, options)\n klass = scaffold_associated_class(association)\n klass.scaffold_get_objects(:order=>scaffold_select_order_association(association), :include=>scaffold_include_association(association), :conditions=>klass.scaffold_session_conditions(options[:session]))\n end", "def reflect_on_association(name)\n association_by_name[name.to_sym]\n end", "def association\n @association ||= model.reflect_on_association(@name)\n end", "def reflect_on_association(association)\n reflections[association.to_s]\n end", "def reflect_on_association(association)\n reflections[association.to_s]\n end", "def association\n matches = form.object_name.scan(/\\[([^\\]]+)\\]\\[[^\\]]+\\]\\z/).flatten\n return matches.first.delete_suffix('_attributes') if matches.size.positive?\n\n form.object.class.to_s.tableize\n end", "def add_solr_eager_loaded_association association_name\n name = association_name.to_s\n unless self.solr_eager_loaded_associations.include?(name)\n self.solr_eager_loaded_associations << name\n end\n end", "def resolve_associations(objs, options = {})\n objs\n end", "def automatic_inverse_of\n return super unless connected_through_array?\n\n if can_find_inverse_of_automatically?(self)\n inverse_name = options[:as] || active_record.name.demodulize\n inverse_name = ActiveSupport::Inflector.underscore(inverse_name)\n inverse_name = ActiveSupport::Inflector.pluralize(inverse_name)\n inverse_name = inverse_name.to_sym\n\n begin\n reflection = klass._reflect_on_association(inverse_name)\n rescue NameError\n # Give up: we couldn't compute the klass type so we won't be able\n # to find any associations either.\n reflection = false\n end\n\n return inverse_name if valid_inverse_reflection?(reflection)\n end\n end", "def fetch_related_object(subject,association_name,index)\n check_subject_and_association(subject,association_name)\n __send__(association_method(subject.type,association_name),subject.rod_id,index)\n end", "def represent_association_as(association, mode)\n # get association type to differentiate if its singular or plural\n type = self.class.association_reflection(association)[:type]\n singular = (type == :many_to_one || type == :one_to_one)\n\n if associations.key?(association)\n # if association data are already loaded (cached)\n return unless (data = send(association))\n singular ? data.represent_as(mode) : data.map { |d| d.represent_as(mode) }\n else\n # if not, load its dataset and represent it\n repre = send(\"#{association}_dataset\").represent_as(mode)\n singular ? repre[0] : repre\n end\n end", "def resolve_relationship(object)\n id_attribute = \"#{klass.name.split(\"::\").last.underscore}_id\"\n associated_class.find(:one, :params => object.prefix_options.merge(id_attribute => object.id))\n end", "def resource_plural_name\n @association_name ||= self.class.resource_class.name.tableize\n end", "def related_objects_by_type(related_str)\n rels = Relationship.all(:conditions => [\"subject_type = ? and object_type = ? and object_id =? \",\n related_str, self.class.name, self.id] )\n \n related_str.constantize.find(rels.collect{ |r| r.subject_id})\n end", "def scrooge_seen_association!( association )\n if @owner.scrooged? && !@loaded\n @owner.class.scrooge_callsite(callsite_signature).association!(association, @owner.id)\n end\n end", "def mongoize(object)\n if type.resizable? || object_id_field?\n type.__mongoize_fk__(association, object)\n else\n related_id_field.mongoize(object)\n end\n end", "def relation(associated_resource)\n if associated_resource && associated_resource.object\n name = associated_resource.as || plural_name\n associated_resource.klass.reflect_on_association(name) ? \n associated_resource.object.send(name) : associated_resource.object.send(klass.to_s.demodulize.underscore.pluralize)\n else\n klass\n end\n end", "def plural_association_name(foreign_key)\n pluralize singular_association_name(foreign_key)\n end", "def find_relation_by association\n @relations.find{|r| r.association == association || r.association == association.singularize}\n end", "def associations; end", "def load_associated_objects(opts, dynamic_opts=nil, &block)\n dynamic_opts = load_association_objects_options(dynamic_opts, &block)\n name = opts[:name]\n if associations.include?(name) && !dynamic_opts[:callback] && !dynamic_opts[:reload]\n associations[name]\n else\n objs = _load_associated_objects(opts, dynamic_opts)\n if opts.set_reciprocal_to_self?\n if opts.returns_array?\n objs.each{|o| add_reciprocal_object(opts, o)}\n elsif objs\n add_reciprocal_object(opts, objs)\n end\n end\n\n # If the current object is frozen, you can't update the associations\n # cache. This can cause issues for after_load procs that expect\n # the objects to be already cached in the associations, but\n # unfortunately that case cannot be handled.\n associations[name] = objs unless frozen?\n run_association_callbacks(opts, :after_load, objs)\n frozen? ? objs : associations[name]\n end\n end", "def operate_switch_language_on_associations(code)\n self.class.reflect_on_all_associations.each do |ref|\n association = instance_variable_get(\"@#{ref.name}\".to_sym)\n if not association.nil?\n if association.kind_of? ref.klass\n send(ref.name).switch_language(code)\n else\n send(ref.name).each {|r| r.switch_language(code)}\n end\n end\n end\n end", "def association(name)\n association = super\n reflection = self.class.reflect_on_association(name)\n case reflection.try(:macro)\n when :belongs_to\n association.extend(HasAggregatedExtension) if reflection.options[:aggregated]\n when :has_one\n association.extend(HasCurrentExtension) if reflection.options[:is_current]\n else # do nothing\n end\n association\n end", "def extract_associations(associations)\n puts \">>>> Called with #{associations}\"\n associations.each do |association|\n extract_table(association)\n end\n end", "def run_association_callbacks(reflection, callback_type, object)\n # The reason we automatically set raise_error for singular associations is that\n # assignment in ruby always returns the argument instead of the result of the\n # method, so we can't return nil to signal that the association callback prevented\n # the modification\n raise_error = raise_on_save_failure || !reflection.returns_array?\n stop_on_false = [:before_add, :before_remove, :before_set].include?(callback_type)\n reflection[callback_type].each do |cb|\n res = case cb\n when Symbol\n send(cb, object)\n when Proc\n cb.call(self, object)\n else\n raise Error, \"callbacks should either be Procs or Symbols\"\n end\n\n if res == false and stop_on_false\n Sequel::Deprecation.deprecate(\"Having #{callback_type} association callback return false to cancel modification\", \"Instead, call Model#cancel_action inside the association callback\")\n raise(HookFailed, \"Unable to modify association for #{inspect}: one of the #{callback_type} hooks returned false\")\n end\n end\n rescue HookFailed\n return false unless raise_error\n raise\n end", "def scaffold_association(association)\n relationships[association]\n end", "def reflect_on_association(name)\n self.class.reflect_on_association(name)\n end", "def link_has_many(reflection)\n \"#{reflection.name.to_s.singularize}_ids\".to_sym\n end", "def scaffold_associated_human_name(association)\n association.to_s.humanize\n end", "def model_to_association_method(model_or_name, include_scope = false)\n requested_association =\n case model_or_name\n when /^(.+)[(](.+)[)]$/ #handle model(with associations), i.e. Image(for scene A)\n association = $1\n scope = $2\n include_scope ? \"#{association}.#{scope}\" : association\n when String\n model_or_name\n else\n model_or_name.name\n end\n requested_association.underscore\nend", "def model_association_name\n full_implementation_class_name.pluralize.ns_underscore.to_sym\n end", "def setup_associations; end", "def has_many(name, options = {})\n # get klass:Class from classname:String\n classname = name.to_s.chop.capitalize\n\n klass = options[:klass] || classname.to_class(Base)\n xpath = options[:xpath] || \"#{name.to_s.chop.upcase}\"\n sort = options[:sort] || plugin_name\n enumerator = options[:enumerator] || Base::Enumerator\n debug \"Create Has_Many #{name} use enumerator #{enumerator} sort #{sort}\"\n\n safe_define_method name do |options = {}|\n options[:xpath] = xpath\n enumerator.new klass, sort, @data, options\n end\n end", "def _load_associated_objects(opts, dynamic_opts={})\n if opts.can_have_associated_objects?(self) && opts[:type] == :many_to_one && opts.associated_class.respond_to?(:cache_get_pk)\n _load_associated_object(opts, dynamic_opts)\n else\n super\n end\n end", "def mediaobject=(mo)\n # Removes existing association\n if self.mediaobject.present?\n self.mediaobject.parts_with_order_remove self\n self.mediaobject.parts -= [self]\n end\n\n self._mediaobject=(mo)\n unless self.mediaobject.nil?\n self.mediaobject.parts_with_order += [self]\n self.mediaobject.parts += [self]\n end\n end", "def parse object:, path: \"\"\n return if visited.has_key? object\n \n case object\n when Array\n object.each do |value|\n parse object: value, path: path\n end\n when Hash\n parse object: object.values, path: path\n when String\n current = objects[object]\n \n return if current.nil? || current[Keys::ISA].nil?\n \n path += '/' + current[Keys::ISA] + Helpers.resolve_attributes(object, objects)\n \n visited[object] = path\n \n parse object: current, path: path\n end\n end", "def def_association_method(opts)\n association_module_def(opts.association_method, opts) do |*dynamic_opts, &block|\n Sequel::Deprecation.deprecate(\"Passing multiple arguments to ##{opts.association_method}\", \"Additional arguments are currently ignored\") if dynamic_opts.length > 1\n load_associated_objects(opts, dynamic_opts.length == 0 ? OPTS : dynamic_opts[0], &block)\n end\n end", "def add_collections(klazz, string)\n klazz.collections.each do |c|\n orderby_str = ''\n if not c.orderbies.empty?\n orderby_str = \" :order => #{c.orderbies.map {|o| o.name.to_sym}.inspect},\\n\"\n end\n string << \" one_to_many #{c.name.to_sym.inspect},\\n\" +\n \" :class => #{c.rb_klazz.to_sym.inspect},\\n\" +\n orderby_str +\n \" :key => #{c.inverse_foreignkeys.map {|ifk| ifk.field.to_sym}.inspect}\\n\"\n end\n string\n end", "def associations; self.class.class_eval(\"@@associations\") end", "def find_association_class_name(association_name)\n (name.split('::')[0..-2] + [association_name.to_s.singularize.camelize]).join('::')\n end", "def run_association_callbacks(reflection, callback_type, object)\n raise_error = raise_on_save_failure || !reflection.returns_array?\n stop_on_false = [:before_add, :before_remove].include?(callback_type)\n reflection[callback_type].each do |cb|\n res = case cb\n when Symbol\n send(cb, object)\n when Proc\n cb.call(self, object)\n else\n raise Error, \"callbacks should either be Procs or Symbols\"\n end\n if res == false and stop_on_false\n save_failure(\"modify association for\", raise_error)\n return false\n end\n end\n end", "def sanitize_association(assoc, sanitizer_info)\n current_data = self.metadata[assoc]\n return unless current_data.is_a?(Array)\n self.metadata[assoc] = current_data.map do |item|\n sanitize_item(item, sanitizer_info)\n end\n end", "def reflect_on_association(name)\n ActiveRecordAssociationAdapter.for_association(associations[name]) if associations[name]\n end", "def associations_after_save\n # # WARNING: the associations here are not using active_record, so they are not auto saved with user intake\n # # we are saving the associations manually here\n # collapse_associations # make obsolete ones = nil\n #\n # TODO: conflicting with 1.6.0 pre-quality. removed to check compatiblity or related errors\n # for remaining, fill login, password details only when login is empty\n # This is a 3 step process\n # \n # Thu Nov 11 00:14:24 IST 2010, ramonrails\n # Link per user, once only. compact.uniq ensures that\n [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each do |_what|\n # \n # Sat Nov 20 02:03:52 IST 2010, ramonrails\n # * this logic is required when uset simply toggles the flag and saves\n _user = self.send( _what) # fetch the associated user\n unless _user.blank? || _user.nothing_assigned?\n # * default properties\n _user.autofill_login # create login and password if not already\n _user.lazy_associations[:user_intake] = self\n _user.skip_validation = true # TODO: patch for 1.6.0 release. fix later with business logic, if required\n\n case _what\n when 'senior'\n # _user.save\n # _user.is_halouser_of( group) unless _user.blank? || group.blank? # role\n _user.lazy_roles[:halouser] = group unless _user.blank? || group.blank? # role\n _user.save\n \n when 'subscriber'\n if subscribed_for_self? # senior is same as subscriber\n if was_subscribed_for_self?\n # * user and subscriber are same. not changed\n else\n # * subscriber was different. now same as senior\n self.subscriber_is_user = false # create old condition\n subscriber.is_not_subscriber_of( senior) unless subscriber.blank? || senior.blank? # remove old role first\n # subscriber.delete # remove this extra user\n self.subscriber_is_user = true # back to current situation\n end\n # _user.save\n # _user.is_subscriber_of( senior) unless _user.blank? || senior.blank? # role\n _user.lazy_roles[:subscriber] = senior unless _user.blank? || senior.blank? # role\n _user.save\n\n else # senior different from subscriber\n if was_subscribed_for_self?\n _user = senior.clone_with_profile if senior.equal?( subscriber) # same IDs, clone first\n senior.is_not_subscriber_of( senior) unless senior.blank? # senior was subscriber, not now\n else\n # all good. nothing changed\n end\n # _user.save\n # _user.is_subscriber_of( senior) unless _user.blank? || senior.blank? # role\n _user.lazy_roles[:subscriber] = senior unless _user.blank? || senior.blank? # role\n _user.save\n end\n \n when 'caregiver1'\n if caregiving_subscriber? # subscriber is caregiver\n if was_caregiving_subscriber?\n # all good. nothing changed\n else\n # was separate\n self.subscriber_is_caregiver = false # make old condition\n caregiver1.is_not_caregiver_of( senior) unless caregiver1.blank? || senior.blank?\n # caregiver1.delete # remove extra\n self.subscriber_is_caregiver = true # current condition again\n end\n \n else # subscriber different from caregiver1\n if was_caregiving_subscriber?\n _user = subscriber.clone_with_profile if subscriber.equal?( caregiver1) # same ID? clone first\n subscriber.is_not_caregiver_of( senior) unless subscriber.blank? || senior.blank? # remove caregiving role for subscriber\n else\n # all good. nothing changed\n end\n end\n if caregiving_subscriber? || (caregiver1_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior))\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver1_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver1_options\n _user.save\n # else\n # self.no_caregiver_1 = true\n # self.send(:update_without_callbacks)\n end\n \n when 'caregiver2'\n if caregiver2_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior)\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver2_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver2_options\n _user.save\n else\n self.no_caregiver_2 = true\n self.send(:update_without_callbacks)\n end\n\n when 'caregiver3'\n if caregiver3_required? && _user.something_assigned? && !senior.blank? && !_user.equal?( senior)\n # _user.save\n # _user.is_caregiver_of( senior) unless _user.blank? || senior.blank? || _user.equal?( senior)\n # _user.options_for_senior( senior, mem_caregiver3_options)\n _user.lazy_roles[:caregiver] = senior\n _user.lazy_options[ senior] = mem_caregiver3_options\n _user.save\n else\n self.no_caregiver_3 = true\n self.send(:update_without_callbacks)\n end\n end # case\n end # blank?\n end # _what\n \n # \n # Thu Jan 13 02:38:38 IST 2011, ramonrails\n # * Not required anymore\n # * lazy_associations attaches each user to this user intake\n # #\n # # * replace earlier associations. keep fresh ones\n # # * do not create duplicate associations\n # # QUESTION: what happens to orphaned users here?\n # # * reject new_record? anything not saved does not get assigned\n # # * only associate one copy of each\n # self.users = [senior, subscriber, caregiver1, caregiver2, caregiver3].reject(&:new_record?).compact.uniq\n # # # \n # # # Thu Jan 13 02:34:27 IST 2011, ramonrails\n # # # * pre_quality.feature had error dispatching emails\n # # # * This might dispatch the email more than once\n # # self.users.each(&:dispatch_emails)\n\n\n # [\"senior\", \"subscriber\", \"caregiver1\", \"caregiver2\", \"caregiver3\"].each do |_what|\n # \n # # \n # # Fri Nov 19 03:17:32 IST 2010, ramonrails\n # # * skip saving the object if already saved\n # # * happens when object is shared. subscriber == user, or, subscriber == caregiver\n # # * saving also dispatches emails. A few more triggers/callbacks. Please check model code\n # _skip = ((_what == 'subscriber') && subscribed_for_self?)\n # _skip = (_skip || (_what == 'caregiver1' && caregiving_subscriber?))\n # # \n # # Thu Nov 11 00:32:18 IST 2010, ramonrails\n # # Do not save any non-assigned data, or blank ones\n # unless _user.blank? || _user.nothing_assigned? || _skip\n # _user.skip_validation = true # TODO: patch for 1.6.0 release. fix later with business logic, if required\n # \n # # _user.autofill_login # Step 1: make them valid\n # if _user.save # Step 2: save them to database\n # # \n # # Thu Nov 11 00:13:31 IST 2010, ramonrails\n # # https://redmine.corp.halomonitor.com/issues/3696\n # # caused a bug that created multiple links to the same user\n # self.users << _user unless users.include?( _user) # Step 3: link them to user intake\n # end\n # end\n # end\n # #\n # # * add roles and options\n # # * roles are already handled by user model\n # # * this will not double write the roles\n # # senior\n # senior.is_halouser_of( group) unless senior.blank?\n # # subscriber\n # unless senior.blank? || subscriber.blank?\n # subscriber.is_subscriber_of( senior)\n # subscriber.is_caregiver_of( senior) if caregiving_subscriber?\n # end\n # # Wed Oct 27 23:55:22 IST 2010\n # # * no need to check subscriber_is_caregiver here. that is done in caregiver1 method\n # # * just call for each caregiver and assign position and other options\n # (1..3).each do |index|\n # _caregiver = self.send(\"caregiver#{index}\".to_sym)\n # _required = self.send(\"caregiver#{index}_required?\")\n # unless (_caregiver.blank? || !_required || _caregiver.nothing_assigned?)\n # _caregiver.is_caregiver_of( senior) unless _caregiver.is_caregiver_of?( senior)\n # # \n # # Thu Nov 4 05:57:16 IST 2010, ramonrails\n # # user values were stored with apply_attributes_from_hash\n # # now we persist them into database\n # _options = self.send(\"mem_caregiver#{index}_options\")\n # # \n # # Thu Nov 18 20:58:29 IST 2010, ramonrails\n # # * Do not use any other method here, cyclic dependency can occur\n # _caregiver.options_for_senior( senior, _options)\n # end\n # end\n\n end", "def property_work(object_name, options={})\n options = {:blank => '---'}.merge(options).symbolize_keys\n object = if object_name.is_a?(String) || object_name.is_a?(Symbol)\n instance_variable_get(\"@#{object_name}\")\n else\n object_name\n end\n components = []\n \n # personal status\n components << link_to(object.personal_status.name, \n tag_url([Person], Tag.new(:name => object.personal_status.name))) if object.personal_status\n\n # professional title \n components << object.profession_taggings.map {|t| link_to(t.name ? t.name : t.tag.name, \n tag_url([Person], t.tag))}.to_sentence.strip_period\n \n if !object.professional_title.blank? && !object.organizations.empty?\n components << \"working as %{title} at %{name}\".t % {\n :title => object.professional_title_taggings.map {|t| link_to(t.name ? t.name : t.tag.name, tag_url([Person], t.tag))}.to_sentence.strip_period,\n :name => object.organizations.map {|o| link_to(o.name, tier_root_url(o))}.to_sentence.strip_period\n }\n elsif !object.professional_title.blank? && object.organizations.empty?\n components << \"working as %{title}\".t % {\n :title => object.professional_title_taggings.map {|t| link_to(t.name ? t.name : t.tag.name, tag_url([Person], t.tag))}.to_sentence.strip_period\n }\n elsif object.professional_title.blank? && !object.organizations.empty?\n components << \"working at %{name}\".t % {\n :name => object.organizations.map {|o| link_to(o.name, tier_root_url(o))}.to_sentence.strip_period\n }\n end\n components << \"in the field of %{industry}\" % {\n :industry => object.industry_taggings.map {|t| link_to(t.name ? t.name : t.tag.name, tag_url([Person], t.tag))}.to_sentence.strip_period\n } unless object.industry.blank?\n components.reject! {|c| c.blank?}\n components.empty? ? options[:blank] : components.join(' ')\n end", "def creating_object_association_for?(object, association)\n object_associations[object].present? && object_associations[object].include?(association)\n end", "def finalize_associations\n @association_reflections.each_value(&:finalize)\n end", "def reflect_on_association(name)\n if orm_association = klass.reflect_on_association(name)\n self.class.const_get(:Association).new(orm_association,self)\n end\n end", "def associated?(namespace, name, stringified_predicate) # :nodoc:\n predicate_objects(namespace, name).include?(stringified_predicate)\n end", "def describe_objects\r\n sorted_contents.each { |obj|\r\n article = 'aeiou'.include?(obj[0..0].downcase) ? 'an' : 'a'\r\n puts \"There is #{article} #{obj} on the ground.\"\r\n }\r\n end", "def cache_has_many(association, options = {})\n options[:embed] ||= false\n options[:inverse_name] ||= self.name.underscore.to_sym\n raise InverseAssociationError unless self.reflect_on_association(association)\n self.cached_has_manys[association] = options\n\n if options[:embed]\n build_denormalized_association_cache(association, options)\n else\n build_normalized_has_many_cache(association, options)\n end\n end", "def add_association(model_name, association_name, association_meta, association_class=nil)\n @associations[model_name] ||= {}\n @associations[model_name][association_name] = {\"meta\" => association_meta, \"class_name\" => association_class || association_name.classify}\n end", "def dump_association_replicants(dumper, association)\n if reflection = self.class.reflect_on_association(association)\n objects = __send__(reflection.name)\n dumper.dump(objects)\n if reflection.macro == :has_and_belongs_to_many\n dump_has_and_belongs_to_many_replicant(dumper, reflection)\n end\n # clear to allow GC\n __send__(reflection.name).reset if __send__(reflection.name).respond_to?(:reset)\n else\n warn \"error: #{self.class}##{association} is invalid\"\n end\n end", "def object(options = {})\n kase = @subject == @object ? Grammar::Case::REFLEXIVE : Grammar::Case::DIRECT_OBJECT\n options = { :case => kase }.merge(options)\n pronoun_or_noun(@object, @audience, options)\n end", "def pluralize_collection collection, noun \n if collection.size == 1 \n \"1 #{noun}\"\n else \n \"#{collection.size} #{noun.pluralize}\"\n end\n end", "def property_education(object_name, options={})\n options = {:blank => '---'}.merge(options).symbolize_keys\n object = if object_name.is_a?(String) || object_name.is_a?(Symbol)\n instance_variable_get(\"@#{object_name}\")\n else\n object_name\n end\n degrees = object.academic_degree_taggings\n universities = object.university_taggings\n\n result = []\n if degrees.size >= universities.size\n degrees.each_with_index do |degree, i|\n if universities[i]\n result << \"%{degree} from %{university}\".t % {\n :degree => link_to(degrees[i].name ? degrees[i].name : degrees[i].tag.name, tag_url([Person], degrees[i].tag)),\n :university => link_to(universities[i].name ? universities[i].name : universities[i].tag.name, tag_url([Person], universities[i].tag))\n }\n else\n result << link_to(degrees[i].name ? degrees[i].name : degrees[i].tag.name, tag_url([Person], degrees[i].tag))\n end\n end\n else\n universities.each_with_index do |university, i|\n if degrees[i]\n result << \"%{degree} from %{university}\".t % {\n :degree => link_to(degrees[i].name ? degrees[i].name : degrees[i].tag.name, tag_url([Person], degrees[i].tag)),\n :university => link_to(universities[i].name ? universities[i].name : universities[i].tag.name, tag_url([Person], universities[i].tag))\n }\n else\n result << link_to(universities[i].name ? universities[i].name : universities[i].tag.name, tag_url([Person], universities[i].tag))\n end\n end\n end\n result.empty? ? options[:blank] : result.to_sentence.strip_period\n end", "def association(name, *options); end", "def add_references(klazz, string)\n klazz.references.each do |r|\n string << \" many_to_one #{r.name.to_sym.inspect}, :class => #{r.rb_klazz.to_sym.inspect}, :key => #{r.foreignkeys.map {|fk| fk.field.to_sym}.inspect}\\n\"\n end\n string << (klazz.references.empty? ? '' : \"\\n\")\n end", "def association_for(reflection)\n inverse = inverse_association_name(reflection)\n Registry[reflection.klass].detect do |mapping|\n association = mapping.associations.detect { |a| a.name == inverse }\n break association if association\n end\n end" ]
[ "0.64756316", "0.62145936", "0.595618", "0.5784524", "0.57229745", "0.57071847", "0.5684734", "0.56623", "0.5527177", "0.5404729", "0.53927237", "0.53807807", "0.52848095", "0.5259393", "0.5220017", "0.519091", "0.51880175", "0.51679283", "0.5161598", "0.5147637", "0.5104444", "0.50928676", "0.508574", "0.5076168", "0.5072248", "0.50677294", "0.50439215", "0.5012688", "0.50062877", "0.49882153", "0.49473473", "0.49028644", "0.4883692", "0.48830435", "0.4881465", "0.48593384", "0.48527244", "0.481392", "0.4794461", "0.47871408", "0.47792143", "0.47694618", "0.475171", "0.474436", "0.47418594", "0.47418594", "0.47157806", "0.46865547", "0.4683353", "0.4678799", "0.4663746", "0.46546", "0.46506357", "0.4649832", "0.46291527", "0.4617236", "0.46150458", "0.46080676", "0.45990437", "0.45764714", "0.45715994", "0.45633015", "0.45584777", "0.4554552", "0.45515415", "0.4549047", "0.45484355", "0.45466956", "0.45461825", "0.45457602", "0.45444217", "0.4541534", "0.45348868", "0.45282733", "0.4525553", "0.45248738", "0.4522891", "0.4512967", "0.4503841", "0.4491891", "0.44890454", "0.44859746", "0.44698718", "0.44689417", "0.4462494", "0.44558966", "0.44543839", "0.44537973", "0.44519722", "0.44515896", "0.4451176", "0.44443837", "0.44426492", "0.44365576", "0.4428048", "0.442718", "0.4420901", "0.44134924", "0.4409959", "0.44089267" ]
0.8364309
0
End of walk_association Method: print_associations Purpose: Prints the associations (if any) of the object passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose associations are to be dumped this_object_class : the class of the object whose associations are to be dumped Returns: None
def print_associations(object_string, this_object, this_object_class) begin # # Only dump the associations of an MiqAeMethodService::* class # if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ # # Print the associations of this object according to the # $walk_associations_whitelist & $walk_associations_blacklist hashes # associations = [] associated_objects = [] duplicates = [] if this_object.respond_to?(:associations) associations = Array.wrap(this_object.associations) if associations.length.zero? print_line($recursion_level, "--- no associations ---") else print_line($recursion_level, "--- associations follow ---") duplicates = associations.select{|item| associations.count(item) > 1} if duplicates.length > 0 print_line($recursion_level, "*** De-duplicating the following associations: #{duplicates.inspect} ***") end associations.uniq.sort.each do |association| begin associated_objects = Array.wrap(this_object.method_missing(:send, association)) if associated_objects.length == 0 print_line($recursion_level, "#{object_string}.#{association} (type: Association (empty))") else print_line($recursion_level, "#{object_string}.#{association} (type: Association)") # # See if we need to walk this association according to the walk_association_policy # variable, and the walk_association_{whitelist,blacklist} hashes # if $walk_association_policy == 'whitelist' if $walk_association_whitelist.has_key?(this_object_class) && ($walk_association_whitelist[this_object_class].include?('ALL') || $walk_association_whitelist[this_object_class].include?(association.to_s)) walk_association(object_string, association, associated_objects) else print_line($recursion_level, "*** not walking: \'#{association}\' isn't in the walk_association_whitelist " \ "hash for #{this_object_class} ***") end elsif $walk_association_policy == 'blacklist' if $walk_association_blacklist.has_key?(this_object_class) && ($walk_association_blacklist[this_object_class].include?('ALL') || $walk_association_blacklist[this_object_class].include?(association.to_s)) print_line($recursion_level, "*** not walking: \'#{association}\' is in the walk_association_blacklist " \ "hash for #{this_object_class} ***") else walk_association(object_string, association, associated_objects) end else print_line($recursion_level, "*** Invalid $walk_association_policy: #{$walk_association_policy} ***") exit MIQ_ABORT end end rescue NoMethodError print_line($recursion_level, "*** #{this_object_class} association: \'#{association}\', gives a " \ "NoMethodError when accessed (product bug?) ***") next end end print_line($recursion_level, "--- end of associations ---") end else print_line($recursion_level, "--- no associations ---") end end rescue => err $evm.log("error", "#{$method} (print_associations) - [#{err}]\n#{err.backtrace.join("\n")}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walk_association(object_string, association, associated_objects)\n begin\n #\n # Assemble some fake code to make it look like we're iterating though associations (plural)\n #\n number_of_associated_objects = associated_objects.length\n if is_plural?(association)\n assignment_string = \"#{object_string}.#{association}.each do |#{association.singularize}|\"\n else\n assignment_string = \"#{association} = #{object_string}.#{association}\"\n end\n print_line($recursion_level, \"#{assignment_string}\")\n associated_objects.each do |associated_object|\n associated_object_class = \"#{associated_object.method_missing(:class)}\".demodulize\n associated_object_id = associated_object.id rescue associated_object.object_id\n print_line($recursion_level, \"(object type: #{associated_object_class}, object ID: #{associated_object_id})\")\n if is_plural?(association)\n walk_object(\"#{association.singularize}\", associated_object)\n if number_of_associated_objects > 1\n print_line($recursion_level,\n \"--- next #{association.singularize} ---\")\n number_of_associated_objects -= 1\n else\n print_line($recursion_level,\n \"--- end of #{object_string}.#{association}.each do |#{association.singularize}| ---\")\n end\n else\n walk_object(\"#{association}\", associated_object)\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_association) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def dump_associations(my_object, my_object_name)\n if my_object.respond_to?(\"associations\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.associations\")\n my_object.associations.sort.each { |a| self.log(:info, \"#{my_object_name} Association - #{a}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.associations\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No associations for #{my_object_name}\")\n end\n end", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def print_relation(object, threshold = '')\n out = ''\n if object.to.is_a?(Array)\n object.to.each do |o|\n out << print_datastructure(o, threshold)\n end\n else\n out << object.to.to_s\n end\n out\n end", "def print_datastructure(object, threshold = ' ')\n out = ''\n if object.is_a?(Yarpler::Models::Relation)\n out << print_relation(object, threshold)\n else\n out << print_object(object, threshold)\n end\n out\n end", "def print_attributes(object_string, this_object)\n begin\n #\n # Print the attributes of this object\n #\n if this_object.respond_to?(:attributes)\n print_line($recursion_level, \"Debug: this_object.inspected = #{this_object.inspect}\") if $debug\n if this_object.attributes.respond_to?(:keys)\n if this_object.attributes.keys.length > 0\n print_line($recursion_level, \"--- attributes follow ---\")\n this_object.attributes.keys.sort.each do |attribute_name|\n attribute_value = this_object.attributes[attribute_name]\n if attribute_name != \"options\"\n if attribute_value.is_a?(DRb::DRbObject)\n if attribute_value.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"#{object_string}[\\'#{attribute_name}\\'] => #{attribute_value} #{type(attribute_value)}\")\n walk_object(\"#{object_string}[\\'#{attribute_name}\\']\", attribute_value)\n else\n print_line($recursion_level,\n \"Debug: not dumping, attribute_value.method_missing(:class) = \" \\\n \"#{attribute_value.method_missing(:class)}\") if $debug\n end\n else\n begin\n attr_info = ping_attr(this_object, attribute_name)\n if attr_info[:value].nil?\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = #{attr_info[:value]} #{type(attr_info[:value])}\")\n end\n rescue ArgumentError\n if attribute_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = #{attribute_value} #{type(attribute_value)}\")\n end\n end\n end\n else\n #\n # Option key names can be mixed symbols and strings which confuses .sort\n # Create an option_map hash that maps option_name.to_s => option_name\n #\n option_map = {}\n options = attribute_value.keys\n options.each do |option_name|\n option_map[option_name.to_s] = option_name\n end\n option_map.keys.sort.each do |option|\n if attribute_value[option_map[option]].nil?\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = \" \\\n \"#{attribute_value[option_map[option]]} #{type(attribute_value[option_map[option]])}\")\n end\n end\n end\n end\n print_line($recursion_level, \"--- end of attributes ---\")\n else \n print_line($recursion_level, \"--- no attributes ---\")\n end\n else\n print_line($recursion_level, \"*** attributes is not a hash ***\")\n end\n else\n print_line($recursion_level, \"--- no attributes ---\")\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print(x, objects, printed)\n\n\tif x.class == Page\n\t\tputs \"\\t\"*(x.depth.to_i) + x.to_s\n\t\tprinted.push(x.topic)\n\t\tx.children.each{ |child|\n\t\t\tprint(child, objects, printed)\n\t\t}\n\tend\n\n\tif x.class == Symbol\n\t\ttopic_regex = /title=\"(.*?)\"/\n\t\ttopic_regex.match(x.to_s.gsub!(\" \",\"_\"))\n\t\tthis_topic = $1\n\t\t\n\t\t if objects.include?(this_topic) && !printed.include?(this_topic)\n\t\t\ti = objects.index(this_topic)\n\t\t\tnewX = objects[i]\n\t\t\tprinted.push(newX)\n\t\t\tprint(newX, objects, printed)\n\t\telse\n\t\t\tprinted.push(this_topic)\n\t\t\tputs \"\\t\"*$distance.to_i + this_topic\n\t\tend\n\n\tend\nend", "def dump_association_replicants(dumper, association)\n if reflection = self.class.reflect_on_association(association)\n objects = __send__(reflection.name)\n dumper.dump(objects)\n if reflection.macro == :has_and_belongs_to_many\n dump_has_and_belongs_to_many_replicant(dumper, reflection)\n end\n # clear to allow GC\n __send__(reflection.name).reset if __send__(reflection.name).respond_to?(:reset)\n else\n warn \"error: #{self.class}##{association} is invalid\"\n end\n end", "def scaffold_associated_objects(association, object, options)\n object.send(association)\n end", "def print_association\n operation = OperationType.find(operation_type.id)\n feedback_array = operation.get(:feedback)\n if feedback_array\n show do\n title \"This is printing because debug is on\"\n note \"#{feedback_array}\"\n end\n end\n end", "def print_object(object, threshold = '')\n out = '{' + \"\\n\"\n out << threshold + '\"ressource_type\": \"' + object.class.to_s + '\"' + \"\\n\"\n out << threshold + ',\"instance_name\": \"' + object.instance_name + '\"' + \"\\n\"\n\n object.list_of_attributes.each do |a|\n out << print_attribute(a.to_s, object.get_value(a.to_s), threshold)\n end\n out << '}'\n end", "def print_relationships\n result = []\n self.relationships.each do |elt|\n result << elt.name\n end\n result.sort.join(', ')\n end", "def printable_with_mongoid(object)\n \n printable = printable_without_mongoid(object)\n if printable == :self\n if object.respond_to?(:fields)\n printable = :mongoid_instance\n end\n elsif printable == :class and !object.respond_to?(:to_model)\n printable = :mongoid_class\n end\n printable\n end", "def pp(obj)\n # If obj is a Delegator then use the object being delegated to for cycle\n # detection\n obj = obj.__getobj__ if defined?(::Delegator) and obj.is_a?(::Delegator)\n\n if check_inspect_key(obj)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(obj)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(obj) unless PP.sharing_detection\n end\n end", "def call_association(object, associations); end", "def print\n puts SEPARATOR\n puts @name\n puts SEPARATOR\n puts @desc\n if(@diagram)\n puts\n puts \"Diagram:\"\n puts\n puts @diagram\n end\n end", "def pp_object(obj)\n object_address_group(obj) {\n seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|\n breakable\n v = v.to_s if Symbol === v\n text v\n text '='\n group(1) {\n breakable ''\n pp(obj.instance_eval(v))\n }\n }\n }\n end", "def process_association(class_name, assoc)\n\n STDERR.print \"\\t\\tProcessing model association #{assoc.name.to_s}\\n\" if @options.verbose\n\n # Skip \"belongs_to\" associations\n return if assoc.macro.to_s == 'belongs_to'\n\n # Only non standard association names needs a label\n \n # from patch #12384\n # if assoc.class_name == assoc.name.to_s.singularize.camelize\n \n assoc_class_name = (assoc.class_name.respond_to? 'underscore') ? assoc.class_name.pluralize.singularize.camelize : assoc.class_name \n if assoc_class_name == assoc.name.to_s.singularize.camelize\n assoc_name = ''\n else\n assoc_name = assoc.name.to_s\n end \n\n if assoc.macro.to_s == 'has_one' \n assoc_type = 'one-one'\n elsif assoc.macro.to_s == 'has_many' && (! assoc.options[:through])\n assoc_type = 'one-many'\n else # habtm or has_many, :through\n return if @habtm.include? [assoc.class_name, class_name, assoc_name]\n assoc_type = 'many-many'\n @habtm << [class_name, assoc.class_name, assoc_name]\n end \n # from patch #12384 \n # @graph.add_edge [assoc_type, class_name, assoc.class_name, assoc_name]\n @graph.add_edge [assoc_type, class_name, assoc_class_name, assoc_name] \n end", "def pp(obj)\n id = obj.object_id\n\n if check_inspect_key(id)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(id)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(id) unless PP.sharing_detection\n end\n end", "def association_links(obj)\n if model.lazy_load_association_links?(type, request) && normalized_type != :association_links && request.params['associations'] != 'show'\n \"<div id='lazy_load_association_links' data-object='#{model.primary_key_value(obj)}' data-type='#{type}'><a href=\\\"#{url_for(\"#{type}/#{model.primary_key_value(obj)}?associations=show\")}\\\">Show Associations</a></div>\"\n elsif type == :show\n association_link_list(obj).to_s\n else\n \"#{inline_mtm_edit_forms(obj)}#{association_link_list(obj)}\"\n end\n end", "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n print_line($recursion_level, \"--- custom attributes follow ---\")\n custom_attribute_keys.sort.each do |custom_attribute_key|\n custom_attribute_value = this_object.custom_get(custom_attribute_key)\n print_line($recursion_level, \"#{object_string}.custom_get(\\'#{custom_attribute_key}\\') = \\'#{custom_attribute_value}\\'\")\n end\n print_line($recursion_level, \"--- end of custom attributes ---\")\n end\n else\n print_line($recursion_level, \"--- object does not support custom attributes ---\")\n end \n rescue => err\n $evm.log(\"error\", \"#{$method} (print_custom_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def checked_print object = ''\n print object\n @prev_printed = true\n end", "def scaffold_associated_objects(association, object, options)\n object.send(association,:order => get_ordering_options(scaffold_select_order_association(association)))\n end", "def pprint(object)\n PP.pp(object)\nend", "def println obj\n echo(obj.to_s + \"\\n\")\n end", "def dump_info(my_object, my_object_name)\n self.dump_attributes(my_object, my_object_name)\n self.dump_associations(my_object, my_object_name)\n self.dump_virtual_columns(my_object, my_object_name)\n end", "def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend", "def scaffold_unassociated_objects(association, object, options)\n scaffold_associated_class(association).scaffold_get_objects(:conditions=>[scaffold_unassociated_condition(association, object), scaffold_associated_class(association).scaffold_session_conditions(options[:session])], :order=>scaffold_select_order_association(association), :include=>scaffold_include_association(association))\n end", "def scaffold_association_find_object(association, id, options)\n scaffold_associated_class(association).scaffold_find_object(:associated, id, options)\n end", "def dump_all_association_replicants(dumper, association_type)\n self.class.reflect_on_all_associations(association_type).each do |reflection|\n next if omitted_attributes.include?(reflection.name)\n\n # bail when this object has already been dumped\n next if (info = replicate_reflection_info(reflection)) &&\n (replicant_id = info[:replicant_id]) &&\n dumper.dumped?(replicant_id)\n\n next if (dependent = __send__(reflection.name)).nil?\n\n case dependent\n when ActiveRecord::Base, Array\n dumper.dump(dependent)\n\n # clear reference to allow GC\n if respond_to?(:association)\n association(reflection.name).reset\n elsif respond_to?(:association_instance_set, true)\n association_instance_set(reflection.name, nil)\n end\n else\n warn \"warn: #{self.class}##{reflection.name} #{association_type} association \" \\\n \"unexpectedly returned a #{dependent.class}. skipping.\"\n end\n end\n end", "def pretty(object)\n PP.pp(object, out)\n end", "def print_tags(this_object, this_object_class)\n begin\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n tags = Array.wrap(this_object.tags)\n if tags.length.zero?\n print_line($recursion_level, \"--- no tags ---\")\n else\n print_line($recursion_level, \"--- tags follow ---\")\n tags.sort.each do |tag|\n print_line($recursion_level, \"#{tag}\")\n end\n print_line($recursion_level, \"--- end of tags ---\")\n end\n else\n print_line($recursion_level, \"--- object is not taggable ---\")\n end\n else\n print_line($recursion_level, \"--- no tags, or object is not taggable ---\")\n end\n \n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} gives a NoMethodError when the :tags method is accessed (product bug?) ***\")\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_tags) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print(*obj)\n each_ios_and_stdout(*obj, &:print)\n nil\n end", "def print_methods(object_string, this_object)\n begin\n #\n # Only dump the methods of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"Class of remote DRb::DRbObject is: #{this_object.method_missing(:class)}\") if $debug\n #\n # Get the instance methods of the class and convert to string\n #\n if this_object.method_missing(:class).respond_to?(:instance_methods)\n instance_methods = this_object.method_missing(:class).instance_methods.map { |x| x.to_s }\n #\n # Now we need to remove method names that we're not interested in...\n #\n # ...attribute names...\n #\n attributes = []\n if this_object.respond_to?(:attributes)\n if this_object.attributes.respond_to? :each\n this_object.attributes.each do |key, value|\n attributes << key\n end\n end\n end\n attributes << \"attributes\"\n $evm.log(\"info\", \"Removing attributes: #{instance_methods & attributes}\") if $debug\n instance_methods -= attributes\n #\n # ...association names...\n #\n associations = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n end\n associations << \"associations\"\n $evm.log(\"info\", \"Removing associations: #{instance_methods & associations}\") if $debug\n instance_methods -= associations\n #\n # ...virtual column names...\n #\n virtual_column_names = []\n virtual_column_names = this_object.method_missing(:virtual_column_names)\n virtual_column_names << \"virtual_column_names\"\n $evm.log(\"info\", \"Removing virtual_column_names: #{instance_methods & virtual_column_names}\") if $debug\n instance_methods -= virtual_column_names\n #\n # ... MiqAeServiceModelBase methods ...\n #\n $evm.log(\"info\", \"Removing MiqAeServiceModelBase methods: \" \\\n \"#{instance_methods & $service_mode_base_instance_methods}\") if $debug\n instance_methods -= $service_mode_base_instance_methods\n #\n # Add in the base methods as it's useful to show that they can be used with this object\n #\n instance_methods += ['inspect', 'inspect_all', 'reload', 'model_suffix']\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n else\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n #\n # and finally dump out the list\n #\n if instance_methods.length.zero?\n print_line($recursion_level, \"--- no methods ---\")\n else\n print_line($recursion_level, \"--- methods follow ---\")\n instance_methods.sort.each do |instance_method|\n print_line($recursion_level, \"#{object_string}.#{instance_method}\")\n end\n print_line($recursion_level, \"--- end of methods ---\")\n end\n else\n print_line($recursion_level, \"--- no methods ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_methods) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def describe_objects\r\n sorted_contents.each { |obj|\r\n article = 'aeiou'.include?(obj[0..0].downcase) ? 'an' : 'a'\r\n puts \"There is #{article} #{obj} on the ground.\"\r\n }\r\n end", "def output object\n STDOUT.puts \"#{object}\"\n end", "def printout_relations\n @relations.each do |shape, relations|\n relations.each do |relation|\n relation.each do |key, value|\n puts \"\\\"#{shape}\\\" #{value} \\\"#{key}\\\"\"\n end\n end\n end\n end", "def extract_associations(associations)\n puts \">>>> Called with #{associations}\"\n associations.each do |association|\n extract_table(association)\n end\n end", "def dump(obj, io)\n io.puts obj.send(inspect_method)\n end", "def print_class_and_superclasses(object)\n object.class.ancestors.each do |klass|\n puts klass\n end\nend", "def puts (obj)\n #STDOUT.puts @output_redirect_lambda.inspect\n if @output_redirect_lambda.nil?\n STDOUT.print obj.to_s + \"\\n\"\n else\n @output_redirect_lambda.call obj unless @output_redirect_lambda.nil?\n end\n end", "def association_link_list(obj)\n assocs = model.association_links_for(type, request) \n return if assocs.empty?\n read_only = type == :show\n t = String.new\n t << '<h3 class=\"associated_records_header\">Associated Records</h3>'\n t << \"<ul class='association_links'>\\n\"\n assocs.each do |assoc|\n mc = model.associated_model_class(assoc)\n t << \"<li>\"\n t << association_class_link(mc, assoc)\n t << \"\\n \"\n\n case model.association_type(assoc)\n when :one\n if assoc_obj = obj.send(assoc)\n t << \" - \"\n t << association_link(mc, assoc_obj)\n end\n assoc_objs = []\n when :edit\n if !read_only && model.supported_mtm_edit?(assoc.to_s, request)\n t << \"(<a href=\\\"#{url_for(\"mtm_edit/#{model.primary_key_value(obj)}?association=#{assoc}\")}\\\">associate</a>)\"\n end\n assoc_objs = obj.send(assoc)\n when :new\n if !read_only && mc && mc.supported_action?(:new, request)\n params = model.associated_new_column_values(obj, assoc).map do |col, value|\n \"#{mc.link}%5b#{col}%5d=#{value}\"\n end\n t << \"(<a href=\\\"#{base_url_for(\"#{mc.link}/new?#{params.join('&amp;')}\")}\\\">create</a>)\"\n end\n assoc_objs = obj.send(assoc)\n else\n assoc_objs = []\n end\n\n unless assoc_objs.empty?\n t << \"<ul>\\n\"\n assoc_objs.each do |assoc_obj1|\n t << \"<li>\"\n t << association_link(mc, assoc_obj1)\n t << \"</li>\"\n end\n t << \"</ul>\"\n end\n\n t << \"</li>\"\n end\n t << \"</ul>\"\n end", "def print_model(problem)\n problem.objects.each do |_k, v|\n puts ''\n puts ''\n puts print_datastructure(v)\n end\n end", "def print(*args)\n args.each do |obj|\n self.write obj.to_s\n end\n\n write $OUTPUT_RECORD_SEPARATOR\n flush\n end", "def walkthrough\n curNode = @head\n while curNode != nil\n curNode.data.print()\n curNode = curNode.next\n end\n end", "def print_text\n\t\tputs self # First object\n\t\tputs \"this is instance method to print some text\"\n\tend", "def fprint(object, depth = 0)\n #puts \"%10s\" % [\"foo\"]\n puts \"%10s\" % [object.to_s]\nend", "def dprint(obj)\n self.log_puts(Php4r.print_r(obj, true))\n end", "def ap(object)\n puts object\n end", "def dump(object)\n if droby_id = context_objects[object]\n droby_id\n elsif object.respond_to?(:droby_dump)\n if sibling = object_manager.registered_sibling_on(object, peer_id)\n RemoteDRobyID.new(peer_id, sibling)\n else\n object.droby_dump(self)\n end\n else\n object\n end\n end", "def kit_to_console(kit, indent_level=0)\n unless kit.is_a?(Kit)\n raise ArgumentError.new \"Passed a different object into a Kit presenter\"\n end\n\n # Print the first 3 fields before families.\n [:id, :name, :domains].each do |attr| \n indented_puts \"#{attr.to_s}: #{kit.send(attr)}\", indent_level \n end\n\n # Families have to be handled specially.\n indented_puts \"families:\", indent_level\n kit.families.each_with_index do |f, index|\n indented_puts \"family ##{index + 1}:\", indent_level + 1\n font_family_to_console(f, indent_level + 2)\n end\n\n # Print the remaining field.\n indented_puts \"optimize_performance: #{kit.optimize_performance}\", indent_level\n end", "def printable_with_mongo_mapper(object)\n printable = printable_without_mongo_mapper(object)\n return printable if !defined?(MongoMapper::Document)\n\n if printable == :self\n if object.is_a?(MongoMapper::Document) || object.is_a?(MongoMapper::EmbeddedDocument)\n printable = :mongo_mapper_instance\n end\n elsif printable == :class && (object.ancestors & [MongoMapper::Document, MongoMapper::EmbeddedDocument]).size > 0\n printable = :mongo_mapper_class\n end\n printable\n end", "def association_link(mc, assoc_obj)\n if mc\n t = h(mc.object_display_name(:association, request, assoc_obj))\n if mc.supported_action?(type, request)\n t = \"<a href=\\\"#{base_url_for(\"#{mc.link}/#{type}/#{mc.primary_key_value(assoc_obj)}\")}\\\">#{t}</a>\"\n end\n t\n else\n h(model.default_object_display_name(assoc_obj))\n end\n end", "def scaffold_association_find_objects(association, options)\n klass = scaffold_associated_class(association)\n klass.scaffold_get_objects(:order=>scaffold_select_order_association(association), :include=>scaffold_include_association(association), :conditions=>klass.scaffold_session_conditions(options[:session]))\n end", "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.object)\")\n else\n print_line(indent_level, \"#{hierarchy.obj_name}\")\n end\n indent_level += 1\n hierarchy.children.each do |child|\n print_automation_objects(indent_level, child)\n end\nend", "def print_attributes(object, keys)\n keys.each do |key|\n puts \"#{key}: #{object[key]}\"\n end\n puts \"\\n\"\nend", "def dump(object)\n adapter_dump(object)\n end", "def print_hash(header_string, object_hash)\n puts header_string\n puts \"=\" * header_string.length\n object_hash.each_pair do |key, values|\n next if values.empty?\n puts \"- #{key}\"\n values.each { |value| puts \" - #{value}\" }\n end\n end", "def result_to_string(object)\n if object.is_a?(String) then\n return object\n else\n if defined?(awesome_inspect)\n return object.awesome_inspect({:plain=>true, :index=>false})\n elsif defined?(pretty_inspect)\n return object.pretty_inspect.chomp # Remove new line that PrettyInspect adds at the end https://www.ruby-forum.com/topic/113429\n else\n return object.inspect\n end\n end\n end", "def association(association_name); end", "def dump_has_and_belongs_to_many_replicant(dumper, reflection)\n dumper.dump Habtm.new(self, reflection)\n end", "def print_tree(out = $stdout)\n out.puts \"## Class: #{name}\"\n out.puts \" Visible Name: #{visible_name}\"\n out.puts \" Description : #{description}\"\n tables.each do |table|\n table.print_tree(out)\n end\n end", "def recursive_inspect(string, indent = 1)\n string << \"<#{inspect_name} #{full_path.inspect}\\n\"\n string << \"#{spacing(indent)}sql = #{to_sql}\\n\" unless to_sql.nil?\n string << \"#{spacing(indent)}parent = #{parent.nil? ? nil.inspect : parent.inspect_name}\"\n string << \"\\n\" unless children.length.zero?\n children.each do |key, child|\n string << \"#{spacing(indent)}#{key} =\\n\"\n string << spacing(indent + 1)\n child.recursive_inspect(string, indent + 2)\n end\n string << \"\\n\" if children.length.zero? && value?\n string << \"#{spacing(indent)}value = #{value.inspect}\" if value?\n\n string << if children.length.zero?\n \">\\n\"\n else\n \"#{spacing(indent - 1)}>\\n\"\n end\n end", "def pretty_print_heirarchy(klass)\n begin\n print klass\n klass = klass.superclass\n print \" < \" if klass\n end while klass\nend", "def scaffold_remove_associated_objects(association, object, options, *associated_object_ids)\n unless associated_object_ids.empty?\n scaffold_transaction do\n associated_objects = associated_object_ids.collect do |associated_object_id|\n associated_object = scaffold_association_find_object(association, associated_object_id.to_i, :session=>options[:session])\n scaffold_remove_associated_object(association, object, associated_object)\n associated_object\n end\n associated_object_ids.length == 1 ? associated_objects.first : associated_objects\n end\n end\n end", "def print_virtual_columns(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the virtual columns of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the virtual columns of this object \n #\n virtual_column_names = []\n if this_object.respond_to?(:virtual_column_names)\n virtual_column_names = Array.wrap(this_object.virtual_column_names)\n if virtual_column_names.length.zero?\n print_line($recursion_level, \"--- no virtual columns ---\")\n else\n print_line($recursion_level, \"--- virtual columns follow ---\")\n virtual_column_names.sort.each do |virtual_column_name|\n begin\n virtual_column_value = this_object.method_missing(:send, virtual_column_name)\n if virtual_column_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = \" \\\n \"#{virtual_column_value} #{type(virtual_column_value)}\")\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} virtual column: \\'#{virtual_column_name}\\' \" \\\n \"gives a NoMethodError when accessed (product bug?) ***\")\n end\n end\n print_line($recursion_level, \"--- end of virtual columns ---\")\n end\n else\n print_line($recursion_level, \"--- no virtual columns ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_virtual_columns) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def p object\n TetCore.break_after_print\n TetCore.real_p(object)\nend", "def each_association( objectpath )\n begin\n @client.associators(objectpath).each do |assoc|\n yield assoc\n end\n rescue Sfcc::Cim::ErrorInvalidClass, Sfcc::Cim::ErrorInvalidNamespace\n end\n end", "def dump(object)\n dumper(object).dump\n end", "def printTree(options = {})\n # Set defaults\n options[:name] ||= true\n options[:content] ||= false\n \n result = \"\"\n \n options[:output] = result \n # Traverse tree and modify result by tacking on child names.\n printTraversal(options)\n \n puts result\n end", "def dump\n output = ''\n @objects_table.keys.sort.each do |key|\n object_entry = @objects_table[key]\n name = object_entry.__name__\n type = object_entry.__type__\n #\n # use the inspect to make ruby 1.8.7 and 1.9.3 compatible\n #\n object = lookup(type, name).to_hash.inspect\n output << \"#{type}(#{name}) = #{object}\\n\"\n end\n output\n end", "def associated_callbacks_log(obj, callback)\n\t\tif obj.associated_object\n\t\t\tmodel_obj = obj.associated_object\n\t\t\tcalling_obj = obj\n\t\tend\n\t\tlog_this(model_obj, callback, calling_obj, true)\n\tend", "def add_association( sclass, associator, target)\n\t\t# find the 'end' of the sclass definition\n\t\t# substitute for it \"\\tassociator target \\nend\"\n\t\trsclass = sclass.chomp\n\t\tl = rsclass.length\n \t\trsclass[0..(l-4)] + \"\\n\\t\" + associator + \" \" + target + \"\\nend\"\n\tend", "def print_ancestors(obj)\n current_super_class = obj.class.superclass\n until current_super_class.nil?\n puts current_super_class\n current_super_class = current_super_class.superclass\n end\nend", "def inspect() \n print @obj_name\n print \" which is \"\n print @obj_attr\n print \" & \"\n puts @obj_secondattr\n end", "def show_object(args)\n class_name = args[0]\n next_method_to_call = args[1]\n puts class_name.all\n call_method(next_method_to_call)\n end", "def ap(object, **options)\n AwesomePrint\n Kernel.ap(object, options)\n end", "def _deep_output(io, obj, depth: 0)\n if obj.is_a? Hash\n obj.each do |k, v|\n io.print ' ' * depth\n io.puts k.to_s\n _deep_output(io, v, depth: depth+1)\n end\n else\n obj.each do |array|\n key = array[0]\n title = _adjust(array[1])\n text = array[2]\n io.print ' ' * depth\n io.print ColorUtils.color(key, title)\n io.print ' '\n io.puts text\n end\n end\n end", "def pseud_associations(pseuds)\n puts \" collecting pseud associations\"\n x = []\n pseuds.each do |p|\n print \".\"; STDOUT.flush\n x << p\n x << p.user\n x << p.user.preference\n end\n x\nend", "def print_tree(out = $stdout)\n out.puts \"### LookupTable: #{name}\"\n out.puts \" Resource: #{resource_id}\"\n out.puts \" Required: #{table_fragment['Required']}\"\n out.puts \" Searchable: #{ table_fragment[\"Searchable\"] }\"\n out.puts \" Units: #{ table_fragment[\"Units\"] }\"\n out.puts \" ShortName: #{ table_fragment[\"ShortName\"] }\"\n out.puts \" LongName: #{ long_name }\"\n out.puts \" StandardName: #{ table_fragment[\"StandardName\"] }\"\n out.puts \"#### Types:\"\n\n lookup_types.each do |lookup_type|\n lookup_type.print_tree(out)\n end\n end", "def print_model\n puts \"class #{name} < #{superclass.name}\"\n puts \" # extends ...................................................................\"\n puts \" # includes ..................................................................\"\n puts if relation_columns.size > 0\n puts \" # relationships .............................................................\"\n relation_columns.sort_by(&:name).each do |column|\n next if primary_key_column?(column)\n puts \" belongs_to :#{column.name.sub(/_id\\z/, \"\")}\" if column.name =~ /_id\\z/\n end\n puts if relation_columns.size > 0 || validation_columns.size > 0\n puts \" # validations ...............................................................\"\n validation_columns.sort_by(&:name).each do |column|\n next if primary_key_column?(column)\n puts \" validates :#{column.name}, presence: true\" unless column.null\n if %i(text string).include?(column.type) && column.limit.to_i > 0\n puts \" validates :#{column.name}, length: { maximum: #{column.limit} }\"\n end\n end\n puts if validation_columns.size > 0\n puts \" # callbacks .................................................................\"\n puts \" # scopes ....................................................................\"\n puts \" # additional config (i.e. accepts_nested_attribute_for etc...) ..............\"\n puts\n puts \" # class methods .............................................................\"\n puts \" class << self\"\n puts \" end\"\n puts\n puts \" # public instance methods ...................................................\"\n puts\n puts \" # protected instance methods ................................................\"\n puts \" protected\"\n puts\n puts \" # private instance methods ..................................................\"\n puts \" private\"\n puts \"end\"\n nil\n end", "def display_string(options, object, length = nil)\n \":#{object}\"\n end", "def scaffold_add_associated_object(association, object, associated_object)\n ap = object.send(association)\n ap << associated_object unless ap.include?(associated_object)\n object.save\n end", "def scaffold_add_associated_objects(association, object, options, *associated_object_ids)\n unless associated_object_ids.empty?\n scaffold_transaction do\n associated_objects = associated_object_ids.collect do |associated_object_id|\n associated_object = scaffold_association_find_object(association, associated_object_id.to_i, :session=>options[:session])\n scaffold_add_associated_object(association, object, associated_object)\n associated_object\n end\n associated_object_ids.length == 1 ? associated_objects.first : associated_objects\n end\n end\n end", "def display\n puts\n puts \"* Class: #{self.class_name} *\"\n puts\n puts \"Description: #{self.description}\"\n puts\n puts \"Spellcasting: #{spellcasting}\"\n puts\n puts \"-----------------------------\"\n end", "def pnl(list_of_actors)\n puts\n list_of_actors.each {|i| puts i.last_name}\n\n# \t\t\ti.movies.each {|m| \n#\t\t\t\tprint \"==\",m.name,' : '\n#\t\t\t\t }\n# }\n puts\nend", "def pretty_print(depth = 0)\n depth.times { STDERR.print ' *' }\n STDERR.print ' '\n STDERR.puts \"#{@name} (#{@id})\"\n @contents.each { |obj| obj.pretty_print(depth + 1) }\n end", "def print(teacher_with_comments)\n teacher_with_comments.each do |teacher|\n print_teacher(teacher[:name])\n teacher[:comments].each { |comment| print_comment(comment) }\n end\n end", "def awesome(object)\n if Thread.current[AD].include?(object.object_id)\n nested(object)\n else\n begin\n Thread.current[AD] << object.object_id\n return eval(%<@formatter.#{declassify(object)}(object)>)\n ensure\n Thread.current[AD].pop\n end\n end\n end", "def pp(*objs)\n puts(*objs.collect{|obj| obj.inspect})\n end", "def roles_dump(o)\n o.all_role.\n select{|role|\n role.fact_type.all_role.size <= 2 &&\n !role.fact_type.is_a?(ActiveFacts::Metamodel::LinkFactType)\n }.\n sort_by{|role|\n other_role = role.fact_type.all_role.select{|r2| r2 != role}[0] || role\n other_role.preferred_role_name(o) + ':' + role.preferred_role_name(other_role.object_type)\n }.each{|role| \n role_dump(role)\n }\n end", "def print_tree(out = $stdout)\n out.puts \"Resource: #{id} (Key Field: #{key_field})\"\n rets_classes.each do |rets_class|\n rets_class.print_tree(out)\n end\n end", "def deep_stringify(object)\n case object\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result[key.to_s] = deep_stringify(value)\n end\n when Array\n object.map { |e| deep_stringify(e) }\n when Symbol\n object.to_s\n else\n object\n end\n end", "def render_concept_association(hash, concept, association_class, further_options = {})\n html = if association_class.respond_to?(:hidden?) && association_class.hidden?(concept)\n ''\n else\n render(association_class.partial_name(concept), further_options.merge(concept: concept, klass: association_class))\n end\n # Convert the already safely buffered string back to a regular one\n # in order to be able to modify it with squish\n if String.new(html).squish.present?\n ((hash[association_class.view_section(concept)] ||= {})[association_class.view_section_sort_key(concept)] ||= '') << html.html_safe\n end\n end", "def association?(object, associations); end", "def print\n str = \"\"\n current = self.head\n while current != nil do\n str = \"#{str}#{current.data}\"\n current = current.next\n if current != nil\n str += \"\\n\"\n end\n end\n puts str\n end", "def parse object:, path: \"\"\n return if visited.has_key? object\n \n case object\n when Array\n object.each do |value|\n parse object: value, path: path\n end\n when Hash\n parse object: object.values, path: path\n when String\n current = objects[object]\n \n return if current.nil? || current[Keys::ISA].nil?\n \n path += '/' + current[Keys::ISA] + Helpers.resolve_attributes(object, objects)\n \n visited[object] = path\n \n parse object: current, path: path\n end\n end", "def dump_tags(object)\n return if object.tags.nil?\n\n $evm.log(\"info\", \" Begin Tags [object.tags]\")\n object.tags.sort.each do |tag_element|\n tag_text = tag_element.split('/')\n $evm.log(\"info\", \" Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")\n end\n $evm.log(\"info\", \" End Tags [object.tags]\")\n $evm.log(\"info\", \"\")\nend", "def safe_dump_recurse(object, limit = @limit, objects = default_objects)\n\t\t\t\tif limit <= 0 || objects[object]\n\t\t\t\t\treturn replacement_for(object)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tcase object\n\t\t\t\twhen Hash\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\tobject.to_h do |key, value|\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tString(key).encode(@encoding, invalid: :replace, undef: :replace),\n\t\t\t\t\t\t\tsafe_dump_recurse(value, limit - 1, objects)\n\t\t\t\t\t\t]\n\t\t\t\t\tend\n\t\t\t\twhen Array\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\tobject.map do |value|\n\t\t\t\t\t\tsafe_dump_recurse(value, limit - 1, objects)\n\t\t\t\t\tend\n\t\t\t\twhen String\n\t\t\t\t\tobject.encode(@encoding, invalid: :replace, undef: :replace)\n\t\t\t\twhen Numeric, TrueClass, FalseClass, NilClass\n\t\t\t\t\tobject\n\t\t\t\telse\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\t# We could do something like this but the chance `as_json` will blow up.\n\t\t\t\t\t# We'd need to be extremely careful about it.\n\t\t\t\t\t# if object.respond_to?(:as_json)\n\t\t\t\t\t# \tsafe_dump_recurse(object.as_json, limit - 1, objects)\n\t\t\t\t\t# else\n\t\t\t\t\t\n\t\t\t\t\tsafe_dump_recurse(object.to_s, limit - 1, objects)\n\t\t\t\tend\n\t\t\tend", "def gen_relationships\n @parser.relationships.each do |rel|\n through_str = ''\n lines = []\n if rel[:has_relationship]\n has_relationship = rel[:has_relationship].gsub(':', '..')\n case has_relationship\n when '1'\n rel_str = 'belongs_to'\n when 'n'\n rel_str = \"has n,\"\n else\n rel_str = \"has #{has_relationship},\"\n if rel[:through]\n through_str = \", :through => :#{rel[:through]}\"\n else\n through_str = \", :through => Resource\"\n end\n end\n \n if rel[:through]\n lines << \" has n, :#{rel[:through]}\"\n end\n line = \" #{rel_str} :#{rel[:variable]}#{through_str}\"\n line += \" # #{rel[:comment]}\" unless rel[:comment].empty?\n lines << line\n elsif rel[:relationship]\n lines << ' ' + rel[:relationship]\n end\n editor = ModelEditor.new(rel[:filename].snake_case)\n editor.insert(AFTER_PROPERTIES, lines)\n end\n end" ]
[ "0.73037016", "0.72469294", "0.6449096", "0.62647194", "0.6179434", "0.60254383", "0.5854516", "0.58438015", "0.5754523", "0.565204", "0.5524142", "0.55054826", "0.54988396", "0.5494011", "0.54886574", "0.54662234", "0.5437204", "0.53831834", "0.5371586", "0.53678095", "0.5342149", "0.5308936", "0.5276114", "0.5261365", "0.52592707", "0.5258319", "0.52433825", "0.5241408", "0.5209582", "0.51931304", "0.51863647", "0.51673764", "0.51500714", "0.51465994", "0.50638616", "0.50493777", "0.5022968", "0.4994602", "0.49565062", "0.49360326", "0.4930479", "0.49266574", "0.492482", "0.4922002", "0.49088475", "0.4896129", "0.489584", "0.48958337", "0.48907825", "0.4884876", "0.48837018", "0.48629385", "0.48486915", "0.48287076", "0.48229557", "0.48045194", "0.48000675", "0.47992605", "0.47829857", "0.47773176", "0.47516245", "0.47501898", "0.4737933", "0.4731342", "0.47301298", "0.47016734", "0.46949112", "0.46926478", "0.46834153", "0.46830735", "0.4675718", "0.4670508", "0.46647072", "0.46605945", "0.465929", "0.46584988", "0.46572584", "0.46570647", "0.4654185", "0.4649831", "0.46453458", "0.4643285", "0.46410182", "0.4639259", "0.4633358", "0.46324056", "0.46301717", "0.462994", "0.46288803", "0.4625612", "0.46179447", "0.4610851", "0.4593469", "0.4589241", "0.45872992", "0.45746928", "0.45738295", "0.45714945", "0.4569568", "0.45585057" ]
0.81122863
0
End of print_associations Method: print_methods Purpose: Prints the methods (if any) of the object class passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose methods are to be dumped Returns: None
def print_methods(object_string, this_object) begin # # Only dump the methods of an MiqAeMethodService::* class # if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/ print_line($recursion_level, "Class of remote DRb::DRbObject is: #{this_object.method_missing(:class)}") if $debug # # Get the instance methods of the class and convert to string # if this_object.method_missing(:class).respond_to?(:instance_methods) instance_methods = this_object.method_missing(:class).instance_methods.map { |x| x.to_s } # # Now we need to remove method names that we're not interested in... # # ...attribute names... # attributes = [] if this_object.respond_to?(:attributes) if this_object.attributes.respond_to? :each this_object.attributes.each do |key, value| attributes << key end end end attributes << "attributes" $evm.log("info", "Removing attributes: #{instance_methods & attributes}") if $debug instance_methods -= attributes # # ...association names... # associations = [] if this_object.respond_to?(:associations) associations = Array.wrap(this_object.associations) end associations << "associations" $evm.log("info", "Removing associations: #{instance_methods & associations}") if $debug instance_methods -= associations # # ...virtual column names... # virtual_column_names = [] virtual_column_names = this_object.method_missing(:virtual_column_names) virtual_column_names << "virtual_column_names" $evm.log("info", "Removing virtual_column_names: #{instance_methods & virtual_column_names}") if $debug instance_methods -= virtual_column_names # # ... MiqAeServiceModelBase methods ... # $evm.log("info", "Removing MiqAeServiceModelBase methods: " \ "#{instance_methods & $service_mode_base_instance_methods}") if $debug instance_methods -= $service_mode_base_instance_methods # # Add in the base methods as it's useful to show that they can be used with this object # instance_methods += ['inspect', 'inspect_all', 'reload', 'model_suffix'] if this_object.respond_to?(:taggable?) if this_object.taggable? instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?'] end else instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?'] end # # and finally dump out the list # if instance_methods.length.zero? print_line($recursion_level, "--- no methods ---") else print_line($recursion_level, "--- methods follow ---") instance_methods.sort.each do |instance_method| print_line($recursion_level, "#{object_string}.#{instance_method}") end print_line($recursion_level, "--- end of methods ---") end else print_line($recursion_level, "--- no methods ---") end end rescue => err $evm.log("error", "#{$method} (print_methods) - [#{err}]\n#{err.backtrace.join("\n")}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n # $walk_associations_whitelist & $walk_associations_blacklist hashes\n #\n associations = []\n associated_objects = []\n duplicates = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n if associations.length.zero?\n print_line($recursion_level, \"--- no associations ---\")\n else\n print_line($recursion_level, \"--- associations follow ---\")\n duplicates = associations.select{|item| associations.count(item) > 1}\n if duplicates.length > 0\n print_line($recursion_level,\n \"*** De-duplicating the following associations: #{duplicates.inspect} ***\")\n end\n associations.uniq.sort.each do |association|\n begin\n associated_objects = Array.wrap(this_object.method_missing(:send, association))\n if associated_objects.length == 0\n print_line($recursion_level,\n \"#{object_string}.#{association} (type: Association (empty))\")\n else\n print_line($recursion_level, \"#{object_string}.#{association} (type: Association)\")\n #\n # See if we need to walk this association according to the walk_association_policy\n # variable, and the walk_association_{whitelist,blacklist} hashes\n #\n if $walk_association_policy == 'whitelist'\n if $walk_association_whitelist.has_key?(this_object_class) &&\n ($walk_association_whitelist[this_object_class].include?('ALL') ||\n $walk_association_whitelist[this_object_class].include?(association.to_s))\n walk_association(object_string, association, associated_objects)\n else\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' isn't in the walk_association_whitelist \" \\\n \"hash for #{this_object_class} ***\")\n end\n elsif $walk_association_policy == 'blacklist'\n if $walk_association_blacklist.has_key?(this_object_class) &&\n ($walk_association_blacklist[this_object_class].include?('ALL') ||\n $walk_association_blacklist[this_object_class].include?(association.to_s))\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' is in the walk_association_blacklist \" \\\n \"hash for #{this_object_class} ***\")\n else\n walk_association(object_string, association, associated_objects)\n end\n else\n print_line($recursion_level,\n \"*** Invalid $walk_association_policy: #{$walk_association_policy} ***\")\n exit MIQ_ABORT\n end\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} association: \\'#{association}\\', gives a \" \\\n \"NoMethodError when accessed (product bug?) ***\")\n next\n end\n end\n print_line($recursion_level, \"--- end of associations ---\")\n end\n else\n print_line($recursion_level, \"--- no associations ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_associations) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_attributes(object_string, this_object)\n begin\n #\n # Print the attributes of this object\n #\n if this_object.respond_to?(:attributes)\n print_line($recursion_level, \"Debug: this_object.inspected = #{this_object.inspect}\") if $debug\n if this_object.attributes.respond_to?(:keys)\n if this_object.attributes.keys.length > 0\n print_line($recursion_level, \"--- attributes follow ---\")\n this_object.attributes.keys.sort.each do |attribute_name|\n attribute_value = this_object.attributes[attribute_name]\n if attribute_name != \"options\"\n if attribute_value.is_a?(DRb::DRbObject)\n if attribute_value.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"#{object_string}[\\'#{attribute_name}\\'] => #{attribute_value} #{type(attribute_value)}\")\n walk_object(\"#{object_string}[\\'#{attribute_name}\\']\", attribute_value)\n else\n print_line($recursion_level,\n \"Debug: not dumping, attribute_value.method_missing(:class) = \" \\\n \"#{attribute_value.method_missing(:class)}\") if $debug\n end\n else\n begin\n attr_info = ping_attr(this_object, attribute_name)\n if attr_info[:value].nil?\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = #{attr_info[:value]} #{type(attr_info[:value])}\")\n end\n rescue ArgumentError\n if attribute_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = #{attribute_value} #{type(attribute_value)}\")\n end\n end\n end\n else\n #\n # Option key names can be mixed symbols and strings which confuses .sort\n # Create an option_map hash that maps option_name.to_s => option_name\n #\n option_map = {}\n options = attribute_value.keys\n options.each do |option_name|\n option_map[option_name.to_s] = option_name\n end\n option_map.keys.sort.each do |option|\n if attribute_value[option_map[option]].nil?\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = \" \\\n \"#{attribute_value[option_map[option]]} #{type(attribute_value[option_map[option]])}\")\n end\n end\n end\n end\n print_line($recursion_level, \"--- end of attributes ---\")\n else \n print_line($recursion_level, \"--- no attributes ---\")\n end\n else\n print_line($recursion_level, \"*** attributes is not a hash ***\")\n end\n else\n print_line($recursion_level, \"--- no attributes ---\")\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def print_text\n\t\tputs self # First object\n\t\tputs \"this is instance method to print some text\"\n\tend", "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n print_line($recursion_level, \"--- custom attributes follow ---\")\n custom_attribute_keys.sort.each do |custom_attribute_key|\n custom_attribute_value = this_object.custom_get(custom_attribute_key)\n print_line($recursion_level, \"#{object_string}.custom_get(\\'#{custom_attribute_key}\\') = \\'#{custom_attribute_value}\\'\")\n end\n print_line($recursion_level, \"--- end of custom attributes ---\")\n end\n else\n print_line($recursion_level, \"--- object does not support custom attributes ---\")\n end \n rescue => err\n $evm.log(\"error\", \"#{$method} (print_custom_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_virtual_columns(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the virtual columns of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the virtual columns of this object \n #\n virtual_column_names = []\n if this_object.respond_to?(:virtual_column_names)\n virtual_column_names = Array.wrap(this_object.virtual_column_names)\n if virtual_column_names.length.zero?\n print_line($recursion_level, \"--- no virtual columns ---\")\n else\n print_line($recursion_level, \"--- virtual columns follow ---\")\n virtual_column_names.sort.each do |virtual_column_name|\n begin\n virtual_column_value = this_object.method_missing(:send, virtual_column_name)\n if virtual_column_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = \" \\\n \"#{virtual_column_value} #{type(virtual_column_value)}\")\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} virtual column: \\'#{virtual_column_name}\\' \" \\\n \"gives a NoMethodError when accessed (product bug?) ***\")\n end\n end\n print_line($recursion_level, \"--- end of virtual columns ---\")\n end\n else\n print_line($recursion_level, \"--- no virtual columns ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_virtual_columns) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def dump_method_list(objectOrClass)\n puts \"[Debug] method list (#{objectOrClass.class}) #{objectOrClass.inspect} = #{(objectOrClass.methods - Object.methods - Class.methods).sort.to_s}\"\nend", "def print(*obj)\n each_ios_and_stdout(*obj, &:print)\n nil\n end", "def printable_with_mongoid(object)\n \n printable = printable_without_mongoid(object)\n if printable == :self\n if object.respond_to?(:fields)\n printable = :mongoid_instance\n end\n elsif printable == :class and !object.respond_to?(:to_model)\n printable = :mongoid_class\n end\n printable\n end", "def print_method(*) end", "def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend", "def p object\n TetCore.break_after_print\n TetCore.real_p(object)\nend", "def print_tags(this_object, this_object_class)\n begin\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n tags = Array.wrap(this_object.tags)\n if tags.length.zero?\n print_line($recursion_level, \"--- no tags ---\")\n else\n print_line($recursion_level, \"--- tags follow ---\")\n tags.sort.each do |tag|\n print_line($recursion_level, \"#{tag}\")\n end\n print_line($recursion_level, \"--- end of tags ---\")\n end\n else\n print_line($recursion_level, \"--- object is not taggable ---\")\n end\n else\n print_line($recursion_level, \"--- no tags, or object is not taggable ---\")\n end\n \n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} gives a NoMethodError when the :tags method is accessed (product bug?) ***\")\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_tags) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def println obj\n echo(obj.to_s + \"\\n\")\n end", "def dump(obj, io)\n io.puts obj.send(inspect_method)\n end", "def print_object(object, threshold = '')\n out = '{' + \"\\n\"\n out << threshold + '\"ressource_type\": \"' + object.class.to_s + '\"' + \"\\n\"\n out << threshold + ',\"instance_name\": \"' + object.instance_name + '\"' + \"\\n\"\n\n object.list_of_attributes.each do |a|\n out << print_attribute(a.to_s, object.get_value(a.to_s), threshold)\n end\n out << '}'\n end", "def print_datastructure(object, threshold = ' ')\n out = ''\n if object.is_a?(Yarpler::Models::Relation)\n out << print_relation(object, threshold)\n else\n out << print_object(object, threshold)\n end\n out\n end", "def dump_associations(my_object, my_object_name)\n if my_object.respond_to?(\"associations\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.associations\")\n my_object.associations.sort.each { |a| self.log(:info, \"#{my_object_name} Association - #{a}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.associations\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No associations for #{my_object_name}\")\n end\n end", "def show_object(args)\n class_name = args[0]\n next_method_to_call = args[1]\n puts class_name.all\n call_method(next_method_to_call)\n end", "def pp(obj)\n # If obj is a Delegator then use the object being delegated to for cycle\n # detection\n obj = obj.__getobj__ if defined?(::Delegator) and obj.is_a?(::Delegator)\n\n if check_inspect_key(obj)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(obj)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(obj) unless PP.sharing_detection\n end\n end", "def dprint(obj)\n self.log_puts(Php4r.print_r(obj, true))\n end", "def print(x, objects, printed)\n\n\tif x.class == Page\n\t\tputs \"\\t\"*(x.depth.to_i) + x.to_s\n\t\tprinted.push(x.topic)\n\t\tx.children.each{ |child|\n\t\t\tprint(child, objects, printed)\n\t\t}\n\tend\n\n\tif x.class == Symbol\n\t\ttopic_regex = /title=\"(.*?)\"/\n\t\ttopic_regex.match(x.to_s.gsub!(\" \",\"_\"))\n\t\tthis_topic = $1\n\t\t\n\t\t if objects.include?(this_topic) && !printed.include?(this_topic)\n\t\t\ti = objects.index(this_topic)\n\t\t\tnewX = objects[i]\n\t\t\tprinted.push(newX)\n\t\t\tprint(newX, objects, printed)\n\t\telse\n\t\t\tprinted.push(this_topic)\n\t\t\tputs \"\\t\"*$distance.to_i + this_topic\n\t\tend\n\n\tend\nend", "def print_table_t(objects, *method_names)\n terminal_width = `tput cols`.to_i\n cols = objects.count + 1 # Label column\n col_width = (terminal_width / cols) - 1 # Column spacing\n\n Array(method_names).map do |method_name|\n cells = objects.map { |o| o.send(method_name).inspect }\n cells.unshift(method_name)\n\n puts cells.map { |cell| cell.to_s.ljust(col_width) }.join \" \"\n end\n nil\nend", "def pp_object(obj)\n object_address_group(obj) {\n seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|\n breakable\n v = v.to_s if Symbol === v\n text v\n text '='\n group(1) {\n breakable ''\n pp(obj.instance_eval(v))\n }\n }\n }\n end", "def print\n puts string\n end", "def dump_info(my_object, my_object_name)\n self.dump_attributes(my_object, my_object_name)\n self.dump_associations(my_object, my_object_name)\n self.dump_virtual_columns(my_object, my_object_name)\n end", "def dump(object)\n raise NotImplementedError, \"#{self.class}#dump is not implemented\"\n end", "def print\n puts SEPARATOR\n puts @name\n puts SEPARATOR\n puts @desc\n if(@diagram)\n puts\n puts \"Diagram:\"\n puts\n puts @diagram\n end\n end", "def short_description(object)\n if object.is_a?Class\n \"Class #{object.to_s}\"\n elsif object.is_a?Module\n \"Module #{object.to_s}\"\n elsif object.is_a?(Proc) || object.is_a?(Method) || object.is_a?(UnboundMethod)\n \"#{object.class} #{object.to_s}(#{args_from_arity(object.arity)})\"\n elsif object.is_a?Object \n \"#{object.class.to_s}\"\n end\n end", "def print\n\t\tputs name + ' ' + className + \" just \" + move + \" and said \" + call\n\tend", "def print\r\n puts name + \" \" + className + \" says \" + \"\\\"\" + call + \"\\\"\"\r\n end", "def print\n end", "def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend", "def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend", "def whatami( obj )\n\tputs \"#{obj.to_s} is a #{obj.class}\"\nend", "def checked_print object = ''\n print object\n @prev_printed = true\n end", "def dump(object)\n raise NotImplementedError, \"#{self.class} must implement #dump\"\n end", "def inspect() \n print @obj_name\n print \" which is \"\n print @obj_attr\n print \" & \"\n puts @obj_secondattr\n end", "def pp(obj)\n id = obj.object_id\n\n if check_inspect_key(id)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(id)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(id) unless PP.sharing_detection\n end\n end", "def print\n end", "def print\n end", "def print\n end", "def print(*args)\n args.each do |obj|\n self.write obj.to_s\n end\n\n write $OUTPUT_RECORD_SEPARATOR\n flush\n end", "def print_class(*) end", "def print\n\n end", "def output object\n STDOUT.puts \"#{object}\"\n end", "def print_self\n puts self\nend", "def print_undocumented_objects; end", "def print_class_and_superclasses(object)\n object.class.ancestors.each do |klass|\n puts klass\n end\nend", "def ap(object, **options)\n AwesomePrint\n Kernel.ap(object, options)\n end", "def pprint(object)\n PP.pp(object)\nend", "def print\n Kernel.print(self)\n end", "def print_matches_for_class(klass, grouped)\n output.puts text.bold(klass.name)\n grouped[klass].each do |method|\n header = method.name_with_owner\n output.puts header + additional_info(header, method)\n end\n end", "def print_stuff\n puts \"#{private_method_hello} annnnnd buh-#{private_method_bye}\"\n end", "def print_model\n puts \"class #{name} < #{superclass.name}\"\n puts \" # extends ...................................................................\"\n puts \" # includes ..................................................................\"\n puts if relation_columns.size > 0\n puts \" # relationships .............................................................\"\n relation_columns.sort_by(&:name).each do |column|\n next if primary_key_column?(column)\n puts \" belongs_to :#{column.name.sub(/_id\\z/, \"\")}\" if column.name =~ /_id\\z/\n end\n puts if relation_columns.size > 0 || validation_columns.size > 0\n puts \" # validations ...............................................................\"\n validation_columns.sort_by(&:name).each do |column|\n next if primary_key_column?(column)\n puts \" validates :#{column.name}, presence: true\" unless column.null\n if %i(text string).include?(column.type) && column.limit.to_i > 0\n puts \" validates :#{column.name}, length: { maximum: #{column.limit} }\"\n end\n end\n puts if validation_columns.size > 0\n puts \" # callbacks .................................................................\"\n puts \" # scopes ....................................................................\"\n puts \" # additional config (i.e. accepts_nested_attribute_for etc...) ..............\"\n puts\n puts \" # class methods .............................................................\"\n puts \" class << self\"\n puts \" end\"\n puts\n puts \" # public instance methods ...................................................\"\n puts\n puts \" # protected instance methods ................................................\"\n puts \" protected\"\n puts\n puts \" # private instance methods ..................................................\"\n puts \" private\"\n puts \"end\"\n nil\n end", "def print(*args)\n @interface.print(*args)\n end", "def print(*args)\n @interface.print(*args)\n end", "def print_attributes(object, keys)\n keys.each do |key|\n puts \"#{key}: #{object[key]}\"\n end\n puts \"\\n\"\nend", "def print\n puts to_s\n end", "def print\n puts \"#{name} #{class_name} just #{movement} and said, \\\"#{call}\\\"\"\n end", "def puts(*obj)\n each_ios_and_stdout(*obj, &:puts)\n nil\n end", "def ap(object)\n puts object\n end", "def print_method(context)\n m = method(eval(\"__method__\", context)) \n params = m.parameters.map { |param| param[1] }\n param_list = params.map { |param| \"#{param} = #{eval(param.to_s, context)}\" }.join(', ')\n puts \"#{m.name.to_s}(#{param_list})\"\nend", "def print_relation(object, threshold = '')\n out = ''\n if object.to.is_a?(Array)\n object.to.each do |o|\n out << print_datastructure(o, threshold)\n end\n else\n out << object.to.to_s\n end\n out\n end", "def show_methods(klass)\n \t\tputs Object.const_get(klass).methods.inspect\n\tend", "def display\n puts\n puts \"* Class: #{self.class_name} *\"\n puts\n puts \"Description: #{self.description}\"\n puts\n puts \"Spellcasting: #{spellcasting}\"\n puts\n puts \"-----------------------------\"\n end", "def print\n puts @text\n end", "def walk_association(object_string, association, associated_objects)\n begin\n #\n # Assemble some fake code to make it look like we're iterating though associations (plural)\n #\n number_of_associated_objects = associated_objects.length\n if is_plural?(association)\n assignment_string = \"#{object_string}.#{association}.each do |#{association.singularize}|\"\n else\n assignment_string = \"#{association} = #{object_string}.#{association}\"\n end\n print_line($recursion_level, \"#{assignment_string}\")\n associated_objects.each do |associated_object|\n associated_object_class = \"#{associated_object.method_missing(:class)}\".demodulize\n associated_object_id = associated_object.id rescue associated_object.object_id\n print_line($recursion_level, \"(object type: #{associated_object_class}, object ID: #{associated_object_id})\")\n if is_plural?(association)\n walk_object(\"#{association.singularize}\", associated_object)\n if number_of_associated_objects > 1\n print_line($recursion_level,\n \"--- next #{association.singularize} ---\")\n number_of_associated_objects -= 1\n else\n print_line($recursion_level,\n \"--- end of #{object_string}.#{association}.each do |#{association.singularize}| ---\")\n end\n else\n walk_object(\"#{association}\", associated_object)\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_association) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def puts( *objects )\n\t\t\tself.payload.puts( *objects )\n\t\tend", "def result_to_string(object)\n if object.is_a?(String) then\n return object\n else\n if defined?(awesome_inspect)\n return object.awesome_inspect({:plain=>true, :index=>false})\n elsif defined?(pretty_inspect)\n return object.pretty_inspect.chomp # Remove new line that PrettyInspect adds at the end https://www.ruby-forum.com/topic/113429\n else\n return object.inspect\n end\n end\n end", "def text_method_for(obj)\n if obj.respond_to?(:name)\n :name\n else\n :to_s\n end\n end", "def debug_inheritance\n obj = (new rescue nil) or raise('could not create instance')\n ary = obj.is_a?(Array)\n cls = ary ? Array : object_class\n typ = ary ? 'ARRAY' : 'MODEL'\n ldr = \"#{typ} METHOD for #{self} #{cls}\"\n cls.instance_methods(true).sort.each do |m|\n loc = obj.instance_eval { method(m).source_location rescue [] }\n #next if loc.blank?\n #next unless loc&.first&.include?('/decor')\n __output \"#{ldr}.#{m} ->\\t#{loc&.join(':')}\"\n end\n rescue => err\n # noinspection RubyScope\n __output \"#{typ} METHOD SKIPPING #{self} - #{err}\"\n end", "def dump_attributes(my_object, my_object_name)\n if my_object.respond_to?(\"attributes\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.attributes\")\n my_object.attributes.sort.each { |k, v| self.log(:info, \"#{my_object_name} Attribute - #{k}: #{v}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.attributes\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No attributes for #{my_object_name}\")\n end\n end", "def grep_methods(obj, pattern=nil)\n klass = obj.is_a?(Class) ? obj : obj.class\n ancs = klass.ancestors\n mtds = pattern ? obj.methods.grep(Regexp.new(pattern.to_s)) : obj.methods\n mtds.sort.each do |e|\n ent = ancs.find {|c| c.instance_methods(false).include?(e) } || \"self\"\n puts \"#{e} in #{ent}\"\n end\n end", "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.object)\")\n else\n print_line(indent_level, \"#{hierarchy.obj_name}\")\n end\n indent_level += 1\n hierarchy.children.each do |child|\n print_automation_objects(indent_level, child)\n end\nend", "def inspect\n @_inspect ||= begin\n \"#<\" <<\n self.class.inspect <<\n (\":0x%014x\" % object_id) <<\n \">\"\n end\n end", "def inspect(options={})\n \"(TODO: def #{self.class}#inspect(options={}))\"\n end", "def dump(object)\n adapter_dump(object)\n end", "def inspect\n att_info = []\n inspect_attributes.each do |att|\n next unless respond_to? att\n\n att_info << \"#{att}=#{send(att).inspect}\"\n end\n att_info << '..'\n \"\\#<#{self.class}:#{object_id} #{att_info.join(', ')}>\"\n end", "def object_iseq(object_string)\n iseqs = find_iseqs(ISEQS__, object_string)\n # FIXME: do something if there is more than one.\n if iseqs.size == 1\n iseqs[-1]\n elsif debug_eval_no_errmsg(\"#{object_string}.respond_to?('iseq')\")\n debug_eval_no_errmsg(\"#{object_string}.iseq\")\n else\n parts = object_string.split(/[.]/)\n string = \n if parts.size < 2 \n \"method(\\\"#{object_string}\\\").iseq\"\n else\n parts[0..-2].join('.')+\".method(\\\"#{parts[-1]}\\\").iseq\"\n end\n debug_eval_no_errmsg(string)\n end\n rescue\n nil\n end", "def fprint(object, depth = 0)\n #puts \"%10s\" % [\"foo\"]\n puts \"%10s\" % [object.to_s]\nend", "def printDazzle\n puts \"self\"\nend", "def dump\n output = ''\n @objects_table.keys.sort.each do |key|\n object_entry = @objects_table[key]\n name = object_entry.__name__\n type = object_entry.__type__\n #\n # use the inspect to make ruby 1.8.7 and 1.9.3 compatible\n #\n object = lookup(type, name).to_hash.inspect\n output << \"#{type}(#{name}) = #{object}\\n\"\n end\n output\n end", "def print()\n puts ( fullName() )\n fullName()\n end", "def echo obj\n str = obj.to_s\n write str\n end", "def display_string(options, object, length = nil)\n \":#{object}\"\n end", "def printable_with_mongo_mapper(object)\n printable = printable_without_mongo_mapper(object)\n return printable if !defined?(MongoMapper::Document)\n\n if printable == :self\n if object.is_a?(MongoMapper::Document) || object.is_a?(MongoMapper::EmbeddedDocument)\n printable = :mongo_mapper_instance\n end\n elsif printable == :class && (object.ancestors & [MongoMapper::Document, MongoMapper::EmbeddedDocument]).size > 0\n printable = :mongo_mapper_class\n end\n printable\n end", "def printCommands\r\n puts 's: Display the superclass information.'\r\n puts 'u: (n) n-th subclass'\r\n puts 'v: list of instance variables'\r\n puts 'c: (string) Class name input'\r\n puts 'b: return to the previous class'\r\n puts 'f: return forward, after b is used'\r\n puts 'z: repeat information'\r\n puts 'q: quit'\r\n end", "def print\n raise NotImplementedError, \"Subclasses must implement a call method.\"\n end", "def obj_fun\n puts \"It is an object function. Object of class can access it\"\n end", "def inspect() \"~#{@obj.inspect}~\" ; end", "def p(obj)\n @contents << obj.inspect << \"\\n\"\n end", "def to_s\n self.methods.each { |m| puts self.m }\n end", "def pretty(object)\n PP.pp(object, out)\n end", "def toggle_object_complete\n if @object_complete\n Bond.recomplete(:object=>'Object', :place=>:last)\n Bond.recomplete(:object=>'Object', :on=>/([^.\\s]+)\\.([^.\\s]*)$/, :place=>:last)\n else\n non_inherited_methods = proc {|e|\n e.object.is_a?(Module) ? e.object.methods(false) : e.object.class.instance_methods(false)\n }\n Bond.recomplete(:object=>'Object', :place=>:last, &non_inherited_methods)\n Bond.recomplete(:object=>'Object', :on=>/([^.\\s]+)\\.([^.\\s]*)$/, :place=>:last, &non_inherited_methods)\n end\n @object_complete = !@object_complete\n end", "def print\n puts @subject\n puts @text\n end", "def describe_objects\r\n sorted_contents.each { |obj|\r\n article = 'aeiou'.include?(obj[0..0].downcase) ? 'an' : 'a'\r\n puts \"There is #{article} #{obj} on the ground.\"\r\n }\r\n end", "def property_summary(object_name, method_name, options={})\n object = if object_name.is_a?(String) || object_name.is_a?(Symbol)\n instance_variable_get(\"@#{object_name}\")\n else\n object_name\n end\n result = object.send(\"#{method_name}\")\n unless result.blank?\n markdown(result)\n else\n '---'\n end\n end", "def print\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n\n begin\n # at line 680:4: 'print' '(' expression ')' ';'\n match( T__47, TOKENS_FOLLOWING_T__47_IN_print_998 )\n match( T__28, TOKENS_FOLLOWING_T__28_IN_print_1000 )\n @state.following.push( TOKENS_FOLLOWING_expression_IN_print_1002 )\n expression\n @state.following.pop\n # --> action\n\n \t pr = @stack_operands.pop\n pr_t = @stack_types.pop\n generate('prt', nil, nil ,pr )\n free_avail(pr)\n free_avail_const(pr)\n \t \n # <-- action\n match( T__29, TOKENS_FOLLOWING_T__29_IN_print_1015 )\n match( T__31, TOKENS_FOLLOWING_T__31_IN_print_1017 )\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__, 21 )\n\n end\n \n return \n end", "def log_inspect(object, grep_string = '')\n prefix = grep_string.empty? ? \"\" : \"[#{grep_string}] \"\n self.debug { \"#{prefix} Class=[#{object.class}], Inspect=[#{object.inspect}]\" }\n end" ]
[ "0.7377751", "0.6756606", "0.6730689", "0.62736297", "0.6253588", "0.6224839", "0.6133456", "0.6084404", "0.59996593", "0.5978311", "0.5966865", "0.5933512", "0.58986175", "0.58985925", "0.58644646", "0.58452266", "0.5844996", "0.5842908", "0.58336425", "0.5799953", "0.5793592", "0.57369167", "0.572104", "0.5702452", "0.5698206", "0.5657129", "0.5630335", "0.5625265", "0.56157655", "0.56094974", "0.5583767", "0.5583712", "0.55774885", "0.55756634", "0.55755043", "0.55737895", "0.5566565", "0.5557587", "0.5530624", "0.5527162", "0.5527162", "0.5527162", "0.5526012", "0.5519513", "0.5513133", "0.5492309", "0.5485295", "0.546254", "0.54607075", "0.544479", "0.5435215", "0.5347055", "0.53306097", "0.5305309", "0.52979183", "0.5297578", "0.5297578", "0.52943736", "0.52899754", "0.5284694", "0.52795374", "0.5270122", "0.52700114", "0.5253973", "0.52527773", "0.52522093", "0.52414465", "0.5235641", "0.5231858", "0.5177449", "0.5174403", "0.5171124", "0.51689297", "0.51670957", "0.5162598", "0.51571107", "0.5157049", "0.5155098", "0.5138945", "0.5134094", "0.5128082", "0.512566", "0.5124929", "0.51237845", "0.51158696", "0.5115564", "0.51144475", "0.51028806", "0.50990134", "0.50932986", "0.5087749", "0.5077206", "0.5068778", "0.5066464", "0.50635785", "0.50598675", "0.50532544", "0.5044885", "0.50443864", "0.5043733" ]
0.7420266
0
End of print_methods Method: print_tags Purpose: Prints the tags (if any) of the object class passed to it Arguments: this_object : the Ruby object whose tags are to be printed this_object_class : the class of the object whose associations are to be dumped Returns: None
def print_tags(this_object, this_object_class) begin if this_object.respond_to?(:taggable?) if this_object.taggable? tags = Array.wrap(this_object.tags) if tags.length.zero? print_line($recursion_level, "--- no tags ---") else print_line($recursion_level, "--- tags follow ---") tags.sort.each do |tag| print_line($recursion_level, "#{tag}") end print_line($recursion_level, "--- end of tags ---") end else print_line($recursion_level, "--- object is not taggable ---") end else print_line($recursion_level, "--- no tags, or object is not taggable ---") end rescue NoMethodError print_line($recursion_level, "*** #{this_object_class} gives a NoMethodError when the :tags method is accessed (product bug?) ***") rescue => err $evm.log("error", "#{$method} (print_tags) - [#{err}]\n#{err.backtrace.join("\n")}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_tags(object)\n return if object.tags.nil?\n\n $evm.log(\"info\", \" Begin Tags [object.tags]\")\n object.tags.sort.each do |tag_element|\n tag_text = tag_element.split('/')\n $evm.log(\"info\", \" Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")\n end\n $evm.log(\"info\", \" End Tags [object.tags]\")\n $evm.log(\"info\", \"\")\nend", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n # $walk_associations_whitelist & $walk_associations_blacklist hashes\n #\n associations = []\n associated_objects = []\n duplicates = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n if associations.length.zero?\n print_line($recursion_level, \"--- no associations ---\")\n else\n print_line($recursion_level, \"--- associations follow ---\")\n duplicates = associations.select{|item| associations.count(item) > 1}\n if duplicates.length > 0\n print_line($recursion_level,\n \"*** De-duplicating the following associations: #{duplicates.inspect} ***\")\n end\n associations.uniq.sort.each do |association|\n begin\n associated_objects = Array.wrap(this_object.method_missing(:send, association))\n if associated_objects.length == 0\n print_line($recursion_level,\n \"#{object_string}.#{association} (type: Association (empty))\")\n else\n print_line($recursion_level, \"#{object_string}.#{association} (type: Association)\")\n #\n # See if we need to walk this association according to the walk_association_policy\n # variable, and the walk_association_{whitelist,blacklist} hashes\n #\n if $walk_association_policy == 'whitelist'\n if $walk_association_whitelist.has_key?(this_object_class) &&\n ($walk_association_whitelist[this_object_class].include?('ALL') ||\n $walk_association_whitelist[this_object_class].include?(association.to_s))\n walk_association(object_string, association, associated_objects)\n else\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' isn't in the walk_association_whitelist \" \\\n \"hash for #{this_object_class} ***\")\n end\n elsif $walk_association_policy == 'blacklist'\n if $walk_association_blacklist.has_key?(this_object_class) &&\n ($walk_association_blacklist[this_object_class].include?('ALL') ||\n $walk_association_blacklist[this_object_class].include?(association.to_s))\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' is in the walk_association_blacklist \" \\\n \"hash for #{this_object_class} ***\")\n else\n walk_association(object_string, association, associated_objects)\n end\n else\n print_line($recursion_level,\n \"*** Invalid $walk_association_policy: #{$walk_association_policy} ***\")\n exit MIQ_ABORT\n end\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} association: \\'#{association}\\', gives a \" \\\n \"NoMethodError when accessed (product bug?) ***\")\n next\n end\n end\n print_line($recursion_level, \"--- end of associations ---\")\n end\n else\n print_line($recursion_level, \"--- no associations ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_associations) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print\r\n tags.each do |tag|\r\n puts \"#{@@tag_titles[tag]} -> #{value(tag)}\"\r\n end\r\n end", "def print_object(object, threshold = '')\n out = '{' + \"\\n\"\n out << threshold + '\"ressource_type\": \"' + object.class.to_s + '\"' + \"\\n\"\n out << threshold + ',\"instance_name\": \"' + object.instance_name + '\"' + \"\\n\"\n\n object.list_of_attributes.each do |a|\n out << print_attribute(a.to_s, object.get_value(a.to_s), threshold)\n end\n out << '}'\n end", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def print(x, objects, printed)\n\n\tif x.class == Page\n\t\tputs \"\\t\"*(x.depth.to_i) + x.to_s\n\t\tprinted.push(x.topic)\n\t\tx.children.each{ |child|\n\t\t\tprint(child, objects, printed)\n\t\t}\n\tend\n\n\tif x.class == Symbol\n\t\ttopic_regex = /title=\"(.*?)\"/\n\t\ttopic_regex.match(x.to_s.gsub!(\" \",\"_\"))\n\t\tthis_topic = $1\n\t\t\n\t\t if objects.include?(this_topic) && !printed.include?(this_topic)\n\t\t\ti = objects.index(this_topic)\n\t\t\tnewX = objects[i]\n\t\t\tprinted.push(newX)\n\t\t\tprint(newX, objects, printed)\n\t\telse\n\t\t\tprinted.push(this_topic)\n\t\t\tputs \"\\t\"*$distance.to_i + this_topic\n\t\tend\n\n\tend\nend", "def print_datastructure(object, threshold = ' ')\n out = ''\n if object.is_a?(Yarpler::Models::Relation)\n out << print_relation(object, threshold)\n else\n out << print_object(object, threshold)\n end\n out\n end", "def p object\n TetCore.break_after_print\n TetCore.real_p(object)\nend", "def print_text\n\t\tputs self # First object\n\t\tputs \"this is instance method to print some text\"\n\tend", "def print_attributes(object_string, this_object)\n begin\n #\n # Print the attributes of this object\n #\n if this_object.respond_to?(:attributes)\n print_line($recursion_level, \"Debug: this_object.inspected = #{this_object.inspect}\") if $debug\n if this_object.attributes.respond_to?(:keys)\n if this_object.attributes.keys.length > 0\n print_line($recursion_level, \"--- attributes follow ---\")\n this_object.attributes.keys.sort.each do |attribute_name|\n attribute_value = this_object.attributes[attribute_name]\n if attribute_name != \"options\"\n if attribute_value.is_a?(DRb::DRbObject)\n if attribute_value.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"#{object_string}[\\'#{attribute_name}\\'] => #{attribute_value} #{type(attribute_value)}\")\n walk_object(\"#{object_string}[\\'#{attribute_name}\\']\", attribute_value)\n else\n print_line($recursion_level,\n \"Debug: not dumping, attribute_value.method_missing(:class) = \" \\\n \"#{attribute_value.method_missing(:class)}\") if $debug\n end\n else\n begin\n attr_info = ping_attr(this_object, attribute_name)\n if attr_info[:value].nil?\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = #{attr_info[:value]} #{type(attr_info[:value])}\")\n end\n rescue ArgumentError\n if attribute_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = #{attribute_value} #{type(attribute_value)}\")\n end\n end\n end\n else\n #\n # Option key names can be mixed symbols and strings which confuses .sort\n # Create an option_map hash that maps option_name.to_s => option_name\n #\n option_map = {}\n options = attribute_value.keys\n options.each do |option_name|\n option_map[option_name.to_s] = option_name\n end\n option_map.keys.sort.each do |option|\n if attribute_value[option_map[option]].nil?\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = \" \\\n \"#{attribute_value[option_map[option]]} #{type(attribute_value[option_map[option]])}\")\n end\n end\n end\n end\n print_line($recursion_level, \"--- end of attributes ---\")\n else \n print_line($recursion_level, \"--- no attributes ---\")\n end\n else\n print_line($recursion_level, \"*** attributes is not a hash ***\")\n end\n else\n print_line($recursion_level, \"--- no attributes ---\")\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_class_and_superclasses(object)\n object.class.ancestors.each do |klass|\n puts klass\n end\nend", "def print(*obj)\n each_ios_and_stdout(*obj, &:print)\n nil\n end", "def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend", "def print_self\n puts self\nend", "def print\n Kernel.print(self)\n end", "def print_methods(object_string, this_object)\n begin\n #\n # Only dump the methods of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"Class of remote DRb::DRbObject is: #{this_object.method_missing(:class)}\") if $debug\n #\n # Get the instance methods of the class and convert to string\n #\n if this_object.method_missing(:class).respond_to?(:instance_methods)\n instance_methods = this_object.method_missing(:class).instance_methods.map { |x| x.to_s }\n #\n # Now we need to remove method names that we're not interested in...\n #\n # ...attribute names...\n #\n attributes = []\n if this_object.respond_to?(:attributes)\n if this_object.attributes.respond_to? :each\n this_object.attributes.each do |key, value|\n attributes << key\n end\n end\n end\n attributes << \"attributes\"\n $evm.log(\"info\", \"Removing attributes: #{instance_methods & attributes}\") if $debug\n instance_methods -= attributes\n #\n # ...association names...\n #\n associations = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n end\n associations << \"associations\"\n $evm.log(\"info\", \"Removing associations: #{instance_methods & associations}\") if $debug\n instance_methods -= associations\n #\n # ...virtual column names...\n #\n virtual_column_names = []\n virtual_column_names = this_object.method_missing(:virtual_column_names)\n virtual_column_names << \"virtual_column_names\"\n $evm.log(\"info\", \"Removing virtual_column_names: #{instance_methods & virtual_column_names}\") if $debug\n instance_methods -= virtual_column_names\n #\n # ... MiqAeServiceModelBase methods ...\n #\n $evm.log(\"info\", \"Removing MiqAeServiceModelBase methods: \" \\\n \"#{instance_methods & $service_mode_base_instance_methods}\") if $debug\n instance_methods -= $service_mode_base_instance_methods\n #\n # Add in the base methods as it's useful to show that they can be used with this object\n #\n instance_methods += ['inspect', 'inspect_all', 'reload', 'model_suffix']\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n else\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n #\n # and finally dump out the list\n #\n if instance_methods.length.zero?\n print_line($recursion_level, \"--- no methods ---\")\n else\n print_line($recursion_level, \"--- methods follow ---\")\n instance_methods.sort.each do |instance_method|\n print_line($recursion_level, \"#{object_string}.#{instance_method}\")\n end\n print_line($recursion_level, \"--- end of methods ---\")\n end\n else\n print_line($recursion_level, \"--- no methods ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_methods) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_class(*) end", "def debug(object)\n puts \"<pre>\"\n puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')\n puts \"</pre>\"\nend", "def checked_print object = ''\n print object\n @prev_printed = true\n end", "def pretty_print_heirarchy(klass)\n begin\n print klass\n klass = klass.superclass\n print \" < \" if klass\n end while klass\nend", "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n print_line($recursion_level, \"--- custom attributes follow ---\")\n custom_attribute_keys.sort.each do |custom_attribute_key|\n custom_attribute_value = this_object.custom_get(custom_attribute_key)\n print_line($recursion_level, \"#{object_string}.custom_get(\\'#{custom_attribute_key}\\') = \\'#{custom_attribute_value}\\'\")\n end\n print_line($recursion_level, \"--- end of custom attributes ---\")\n end\n else\n print_line($recursion_level, \"--- object does not support custom attributes ---\")\n end \n rescue => err\n $evm.log(\"error\", \"#{$method} (print_custom_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def pp_object(obj)\n object_address_group(obj) {\n seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|\n breakable\n v = v.to_s if Symbol === v\n text v\n text '='\n group(1) {\n breakable ''\n pp(obj.instance_eval(v))\n }\n }\n }\n end", "def show_tags\n tag_list = \"\"\n self.tags.each do |t|\n tag_list << \"#{t.name} \"\n end\n tag_list\n end", "def dump(obj, io)\n io.puts obj.send(inspect_method)\n end", "def dump_info(my_object, my_object_name)\n self.dump_attributes(my_object, my_object_name)\n self.dump_associations(my_object, my_object_name)\n self.dump_virtual_columns(my_object, my_object_name)\n end", "def pp(obj)\n id = obj.object_id\n\n if check_inspect_key(id)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(id)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(id) unless PP.sharing_detection\n end\n end", "def println obj\n echo(obj.to_s + \"\\n\")\n end", "def inspect\n\t\tparts = []\n\t\tparts += self.tags.map {|t| \"##{t}\" }\n\t\tparts += self.bookmarks.map {|b| \"@#{b}\" }\n\n\t\treturn \"#<%p:#%x %s {%s} %p%s>\" % [\n\t\t\tself.class,\n\t\t\tself.object_id * 2,\n\t\t\tself.changeset,\n\t\t\tself.date,\n\t\t\tself.summary,\n\t\t\tparts.empty? ? '' : \" \" + parts.join(' ')\n\t\t]\n\tend", "def show\n # For each of the possible contexts get the tags...\n @className = params[:class]\n @personId = params[:id]\n \n # taggings.tagger_id IS NULl .... need to deal with owner ????\n \n if isok(@className)\n obj = eval(@className).find(@personId)\n # 1. Get the set of contexts\n # contexts = TagContext.all\n contexts1 = getContexts(@className).sort_by{|name| name.downcase }\n contexts2 = TagContext.all.collect{|v| v.name}\n contexts = contexts1.concat(contexts2).collect{|a| a.downcase }.uniq.sort_by{|name| name.downcase }.collect{|n| n.capitalize}\n \n # 2. For each context get the tags for thie person and add them to the results\n @allTags = Hash.new\n contexts.each do |context|\n if getTagOwner\n tags = obj.owner_tag_list_on(getTagOwner, context)\n else \n tags = obj.tag_list_on( context )\n end\n \n if tags != nil\n @allTags[context] = tags\n end\n end\n end\n rescue => ex\n render status: :bad_request, text: ex.message\n end", "def print_tree(out = $stdout)\n out.puts \"Resource: #{id} (Key Field: #{key_field})\"\n rets_classes.each do |rets_class|\n rets_class.print_tree(out)\n end\n end", "def to_s\n object_identifier = \"#<#{self.class.to_s}:0x#{'%x' % (self.object_id << 1)}\\n\"\n close_object = \">\\n\"\n \n case self\n when RubyBBCode::BBTree\n object_identifier + \"Children: #{count_child_nodes}\\n\" + self.to_v + close_object\n when RubyBBCode::TagNode # when inspecting TagNodes, it's better not to show the tree display\n if self[:is_tag]\n object_identifier + \"Tag: #{self[:tag].to_s}, Children: #{count_child_nodes}\\n\" + close_object\n else\n object_identifier + '\"' + self[:text].to_s + \"\\\"\\n\" + close_object\n end\n end\n end", "def pprint\n stream = \"#{@info.pprint} #{mime[0]}\"\n tags = tags.pretty_inspect\n stream + tags\n end", "def dump_associations(my_object, my_object_name)\n if my_object.respond_to?(\"associations\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.associations\")\n my_object.associations.sort.each { |a| self.log(:info, \"#{my_object_name} Association - #{a}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.associations\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No associations for #{my_object_name}\")\n end\n end", "def displayable_self\n Tag.new(self.displayable_attributes)\n end", "def render(obj)\n # We can't use a case statement here becuase \"when Hash\" doesn't work for\n # ActiveSupport::OrderedHash - respond_to?(:values) is a more reliable\n # indicator of hash-like behavior.\n if NilClass === obj\n print(\"null\")\n \n elsif TrueClass === obj\n print(\"true\")\n \n elsif FalseClass === obj\n print(\"false\")\n \n elsif String === obj\n print(escape_json_string(obj))\n \n elsif Symbol === obj\n print(\"\\\"#{obj}\\\"\")\n \n elsif Numeric === obj\n print(obj.to_s)\n \n elsif Time === obj\n print(obj.to_s)\n \n elsif obj.respond_to?(:keys)\n print(\"{\")\n indent_out\n last_key = obj.keys.last\n obj.each do |(key, val)|\n render(key)\n case val\n when Hash, Array\n indent_out\n print(\":\\n#{indent}\")\n render(val)\n indent_in\n else\n print(\": \")\n render(val)\n end\n print(\",\\n#{indent}\") unless key == last_key\n end\n indent_in\n print(\"}\")\n \n elsif Array === obj\n print(\"[\")\n indent_out\n last_index = obj.size - 1\n obj.each_with_index do |elem, index|\n render(elem)\n print(\",\\n#{indent}\") unless index == last_index\n end\n indent_in\n print(\"]\")\n \n else\n raise \"unrenderable object: #{obj.inspect}\"\n end\n end", "def printable_with_mongoid(object)\n \n printable = printable_without_mongoid(object)\n if printable == :self\n if object.respond_to?(:fields)\n printable = :mongoid_instance\n end\n elsif printable == :class and !object.respond_to?(:to_model)\n printable = :mongoid_class\n end\n printable\n end", "def awesome_self(object, type)\n if @options[:raw] && object.instance_variables.any?\n awesome_object(object)\n else\n colorize(object.inspect.to_s, type)\n end\n end", "def inspect\n inspectables = self.class.inspectables\n if inspectables\n \"#<#{self.class}:0x#{object_id.to_s(16)} \" + inspectables.map {|i| \"@#{i}=\\\"#{send(i) rescue nil}\\\"\"}.join(' ') + \">\"\n else\n super\n end\n end", "def inspect\n inspectables = self.class.inspectables\n if inspectables\n \"#<#{self.class}:0x#{object_id.to_s(16)} \" + inspectables.map {|i| \"@#{i}=\\\"#{send(i) rescue nil}\\\"\"}.join(' ') + \">\"\n else\n super\n end\n end", "def output object\n STDOUT.puts \"#{object}\"\n end", "def dump(object)\n raise NotImplementedError, \"#{self.class}#dump is not implemented\"\n end", "def pretty(object)\n PP.pp(object, out)\n end", "def inspect() \n print @obj_name\n print \" which is \"\n print @obj_attr\n print \" & \"\n puts @obj_secondattr\n end", "def pp(obj)\n # If obj is a Delegator then use the object being delegated to for cycle\n # detection\n obj = obj.__getobj__ if defined?(::Delegator) and obj.is_a?(::Delegator)\n\n if check_inspect_key(obj)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(obj)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(obj) unless PP.sharing_detection\n end\n end", "def inspect\n @_inspect ||= begin\n \"#<\" <<\n self.class.inspect <<\n (\":0x%014x\" % object_id) <<\n \">\"\n end\n end", "def whatami( obj )\n\tputs \"#{obj.to_s} is a #{obj.class}\"\nend", "def tag_list(obj)\n str = \"\"\n\n obj.tag_list.each do |tag|\n str += \"<span class='label label-info'>#{tag}</span> &nbsp;\"\n end\n\n str.html_safe\n end", "def inspect\n \"#<#{self}:#{object_id} #{@ordered_elements.inspect}>\"\n end", "def print_tree(out = $stdout)\n out.puts \"## Class: #{name}\"\n out.puts \" Visible Name: #{visible_name}\"\n out.puts \" Description : #{description}\"\n tables.each do |table|\n table.print_tree(out)\n end\n end", "def show_object(args)\n class_name = args[0]\n next_method_to_call = args[1]\n puts class_name.all\n call_method(next_method_to_call)\n end", "def print_ancestors(obj)\n current_super_class = obj.class.superclass\n until current_super_class.nil?\n puts current_super_class\n current_super_class = current_super_class.superclass\n end\nend", "def make_html_for_object( object )\n\t\t\treturn object.html_inspect if \n\t\t\t\tobject.respond_to?( :html_inspect ) && ! object.is_a?( HtmlInspectableObject )\n\t\t\tobject_html = []\n\n\t\t\tcase object\n\t\t\twhen Hash\n\t\t\t\tobject_html << \"\\n<!-- Hash -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '{}'\n\t\t\t\telse\n\t\t\t\t\tobject_html << HASH_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|k,v|\n\t\t\t\t\t\t\tpairclass = v.instance_variables.empty? ? \n\t\t\t\t\t\t\t\t\"simple-hash-pair\" :\n\t\t\t\t\t\t\t\t\"complex-hash-pair\"\n\t\t\t\t\t\t\tHASH_PAIR_HTML % [\n\t\t\t\t\t\t\t\tpairclass,\n\t\t\t\t\t\t\t\tmake_html_for_object(k),\n\t\t\t\t\t\t\t\tmake_html_for_object(v),\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\twhen Array\n\t\t\t\tobject_html << \"\\n<!-- Array -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '[]'\n\t\t\t\telse\n\t\t\t\t\tobject_html << ARRAY_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|o| make_html_for_object(o) }.join('</li><li>')\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tif object.instance_variables.empty?\n\t\t\t\t\treturn IMMEDIATE_OBJECT_HTML_CONTAINER % \n\t\t\t\t\t\t[ HTMLUtilities.escape_html(object.inspect) ]\n\t\t\t\telse\n\t\t\t\t\tobject_html << make_object_html_wrapper( object )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn object_html.join(\"\\n\")\n\t\tend", "def dump(object)\n raise NotImplementedError, \"#{self.class} must implement #dump\"\n end", "def make_html_for_object( object )\n\t\t\treturn object.html_inspect if \n\t\t\t\tobject.respond_to?( :html_inspect ) && ! object.is_a?( HtmlInspectableObject )\n\t\t\tobject_html = []\n\n\t\t\tcase object\n\t\t\twhen Hash\n\t\t\t\tobject_html << \"\\n<!-- Hash -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '{}'\n\t\t\t\telse\n\t\t\t\t\tobject_html << HASH_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|k,v|\n\t\t\t\t\t\t\tpairclass = v.instance_variables.empty? ? \n\t\t\t\t\t\t\t\t\"simple-hash-pair\" :\n\t\t\t\t\t\t\t\t\"complex-hash-pair\"\n\t\t\t\t\t\t\tHASH_PAIR_HTML % [\n\t\t\t\t\t\t\t\tpairclass,\n\t\t\t\t\t\t\t\tmake_html_for_object(k),\n\t\t\t\t\t\t\t\tmake_html_for_object(v),\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\twhen Array\n\t\t\t\tobject_html << \"\\n<!-- Array -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '[]'\n\t\t\t\telse\n\t\t\t\t\tobject_html << ARRAY_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|o| make_html_for_object(o) }.join('</li><li>')\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tif object.instance_variables.empty?\n\t\t\t\t\treturn IMMEDIATE_OBJECT_HTML_CONTAINER %\n\t\t\t\t\t\t[ HTMLUtilities.escape_html(object.inspect) ]\n\t\t\t\telse\n\t\t\t\t\tobject_html << make_object_html_wrapper( object )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn object_html.join(\"\\n\")\n\t\tend", "def print(*args)\n args.each do |obj|\n self.write obj.to_s\n end\n\n write $OUTPUT_RECORD_SEPARATOR\n flush\n end", "def inspect\n sprintf(\"#<%s:%#0x(%s)>\", self.class.name, object_id, to_s)\n end", "def collection_object_tag(collection_object)\n return nil if collection_object.nil?\n a = [\n collection_object_loan_tag(collection_object),\n collection_object_deaccession_tag(collection_object),\n collection_object_identifier_tag(collection_object),\n taxon_determination_tag(collection_object.taxon_determinations.order(:position).first)\n ].compact\n\n if a.empty?\n a << [\n collection_object.buffered_collecting_event,\n collection_object.buffered_determinations,\n collection_object.buffered_other_labels\n ].compact\n end\n\n a << \"[#{collection_object.type[(0..2)].capitalize}]\"\n\n a.join('&nbsp;').html_safe\n end", "def property_tags(object_name, method_name, options={})\n object_name = if object_name.is_a?(String) || object_name.is_a?(Symbol)\n instance_variable_get(\"@#{object_name}\")\n else\n object_name\n end\n method_name = if method_name.is_a?(String) || method_name.is_a?(Symbol)\n object_name.send(method_name.to_s.pluralize)\n else\n method_name\n end\n result = method_name.map do |t|\n if t.is_a?(Tagging)\n span_tag(link_to(h(t.name ? t.name : t.tag.name), tag_url([Person], t.tag)))\n else\n span_tag(link_to(h(t.to_s), tag_url([Person], t)))\n end\n end\n result.empty? ? '---' : result.to_sentence.strip_period\n end", "def html_inspect\n\t\t\tif self.instance_variables.empty?\n\t\t\t\treturn make_html_for_object( self )\n\t\t\telse\n\t\t\t\treturn make_object_html_wrapper( self )\n\t\t\tend\n\t\tend", "def html_inspect\n\t\t\tif self.instance_variables.empty?\n\t\t\t\treturn make_html_for_object( self )\n\t\t\telse\n\t\t\t\treturn make_object_html_wrapper( self )\n\t\t\tend\n\t\tend", "def inspect(indent=\"\")\n result = \"\"\n result << indent\n result << self.class.to_s.sub(/.*:/,'')\n result << \" #{to_s} \" unless self.is_a?(Language::Tree) || self.is_a?(Language::Loop)\n \n unless elements.empty?\n result << \":\"\n elements.each do |e|\n result << \"\\n#{e.inspect(indent+\" \")}\" rescue \"\\n#{indent} #{e.inspect}\"\n end\n end\n \n result\n end", "def print_undocumented_objects; end", "def dprint(obj)\n self.log_puts(Php4r.print_r(obj, true))\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def tags_html_id(obj)\n \"tags_html_#{obj.class}_#{obj.id}\".underscore.downcase.html_safe\n end", "def inspect\n att_info = []\n inspect_attributes.each do |att|\n next unless respond_to? att\n\n att_info << \"#{att}=#{send(att).inspect}\"\n end\n att_info << '..'\n \"\\#<#{self.class}:#{object_id} #{att_info.join(', ')}>\"\n end", "def print_relation(object, threshold = '')\n out = ''\n if object.to.is_a?(Array)\n object.to.each do |o|\n out << print_datastructure(o, threshold)\n end\n else\n out << object.to.to_s\n end\n out\n end", "def print_matches_for_class(klass, grouped)\n output.puts text.bold(klass.name)\n grouped[klass].each do |method|\n header = method.name_with_owner\n output.puts header + additional_info(header, method)\n end\n end", "def dump_attributes(my_object, my_object_name)\n if my_object.respond_to?(\"attributes\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.attributes\")\n my_object.attributes.sort.each { |k, v| self.log(:info, \"#{my_object_name} Attribute - #{k}: #{v}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.attributes\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No attributes for #{my_object_name}\")\n end\n end", "def pprint(object)\n PP.pp(object)\nend", "def print_virtual_columns(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the virtual columns of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the virtual columns of this object \n #\n virtual_column_names = []\n if this_object.respond_to?(:virtual_column_names)\n virtual_column_names = Array.wrap(this_object.virtual_column_names)\n if virtual_column_names.length.zero?\n print_line($recursion_level, \"--- no virtual columns ---\")\n else\n print_line($recursion_level, \"--- virtual columns follow ---\")\n virtual_column_names.sort.each do |virtual_column_name|\n begin\n virtual_column_value = this_object.method_missing(:send, virtual_column_name)\n if virtual_column_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = \" \\\n \"#{virtual_column_value} #{type(virtual_column_value)}\")\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} virtual column: \\'#{virtual_column_name}\\' \" \\\n \"gives a NoMethodError when accessed (product bug?) ***\")\n end\n end\n print_line($recursion_level, \"--- end of virtual columns ---\")\n end\n else\n print_line($recursion_level, \"--- no virtual columns ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_virtual_columns) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def inspect\n \"#<#{self.class}:#{type_sym}:#{object_id.to_s(16)}>\"\n end", "def tags\n object.tags.each do |tag|\n tag.name\n end\n end", "def print_car (the_car)\n \n puts \"This is a car:\"\n puts \" color: #{self.color}\" #self- an *instance* code from ruby to pul attributes in class blueprint of the behaviour\n puts \" make: #{self.make}\"\n puts \" model: #{self.model}\"\n puts \" year: #{self.year}\"\n puts \" top_speed: #{self.top_speed}\"\n end", "def prints_as_self?(node); end", "def print\n\t\tputs name + \" \" + className + \" says \" + call\n\tend", "def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{@obj.getName}>\"\n end", "def print\r\n\t\tputs name + \" \" + className + \" says \" + call\r\n\tend", "def pretty_print_me\n sio = PP.pp(self, \"\")\n\n # aber bitte ohne die ids und ohne @\n sio.gsub(/0x[^\\s]*/,'').gsub(/@/,'')\n end", "def inspect\n \"<#{@java_object._classname}>\"\n end", "def print_model(problem)\n problem.objects.each do |_k, v|\n puts ''\n puts ''\n puts print_datastructure(v)\n end\n end", "def print\n end", "def printIt(boomd)\n\tprint(boomd)\nend", "def kit_to_console(kit, indent_level=0)\n unless kit.is_a?(Kit)\n raise ArgumentError.new \"Passed a different object into a Kit presenter\"\n end\n\n # Print the first 3 fields before families.\n [:id, :name, :domains].each do |attr| \n indented_puts \"#{attr.to_s}: #{kit.send(attr)}\", indent_level \n end\n\n # Families have to be handled specially.\n indented_puts \"families:\", indent_level\n kit.families.each_with_index do |f, index|\n indented_puts \"family ##{index + 1}:\", indent_level + 1\n font_family_to_console(f, indent_level + 2)\n end\n\n # Print the remaining field.\n indented_puts \"optimize_performance: #{kit.optimize_performance}\", indent_level\n end", "def inspect\n str = +\"#<#{self.class.name}:0x#{object_id}\"\n str << \" id=\\\"#{@id}\\\"\" if @id\n str << '>'\n end", "def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{fullName}>\"\n end", "def print\r\n puts name + \" \" + className + \" says \" + \"\\\"\" + call + \"\\\"\"\r\n end", "def display\n puts\n puts \"* Class: #{self.class_name} *\"\n puts\n puts \"Description: #{self.description}\"\n puts\n puts \"Spellcasting: #{spellcasting}\"\n puts\n puts \"-----------------------------\"\n end", "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.object)\")\n else\n print_line(indent_level, \"#{hierarchy.obj_name}\")\n end\n indent_level += 1\n hierarchy.children.each do |child|\n print_automation_objects(indent_level, child)\n end\nend", "def inspect\n +\"#<#{self.class}:#{object_id.to_s(16)}>\"\n end", "def to_tag\n self.class.to_s\n end", "def inspect\n result = \"#{self.class}[\"\n each_with_index { |obj, i| result << ', ' if i > 0; result << obj.inspect }\n result << \"]\"\n end", "def custom_inspect(object, *ivars_to_skip)\n variables = (object.instance_variables - ivars_to_skip).\n map { |var| \"#{var}=#{object.instance_variable_get(var).inspect}\" }.\n join(', ')\n \"<#{object.class}: #{variables}>\"\n end", "def print_class\n\n puts \"* #{name.capitalize} *\".colorize(:light_green).bold.indent(10)\n puts\n puts short_description.to_s.colorize(:green).indent(10)\n puts\n stats.each_pair do |name, value|\n print \"| \".colorize(:green).indent(10)\n print \" #{name.capitalize} :\".colorize(:light_green)\n print \" #{value}\"\n print \" |\".colorize(:green)\n end\n puts\n puts\n\n end", "def print_objects\n @header_object.each_pair do |key,val|\n puts \"#{key}: #{val[0]} #{val[1]} #{val[2]}\"\n end\n end", "def display\n puts self\n end", "def inspect\n str = \"#<#{self.class}\"\n\n ids = (Thread.current[InspectKey] ||= [])\n if ids.include?(object_id)\n return str << ' ...>'\n end\n\n ids << object_id\n begin\n first = true\n for k,v in @table\n str << \",\" unless first\n first = false\n str << \" #{k}=#{v.inspect}\"\n end\n return str << '>'\n ensure\n ids.pop\n end\n end" ]
[ "0.67090267", "0.62940216", "0.6273373", "0.6164496", "0.586712", "0.5850494", "0.5811628", "0.58027494", "0.5792961", "0.57860476", "0.5784236", "0.5771969", "0.57497245", "0.57469445", "0.57342416", "0.57162094", "0.5714655", "0.56722635", "0.5669556", "0.5601797", "0.55572826", "0.548671", "0.54852736", "0.54762346", "0.5462684", "0.5430428", "0.5411707", "0.5407564", "0.53862494", "0.5378152", "0.5364846", "0.53585774", "0.53459233", "0.53351283", "0.533322", "0.53329885", "0.53323793", "0.53248215", "0.53248215", "0.5323511", "0.53178287", "0.53087527", "0.5299993", "0.5296066", "0.5290126", "0.52829915", "0.5280342", "0.5278117", "0.5276578", "0.5276137", "0.5273234", "0.5247993", "0.5246086", "0.52365786", "0.5233527", "0.5211757", "0.5204435", "0.520002", "0.51940835", "0.51940835", "0.51875585", "0.5182426", "0.5180752", "0.5179666", "0.5179666", "0.5179666", "0.5179666", "0.5157439", "0.51564705", "0.514884", "0.51422215", "0.5140993", "0.51396704", "0.51183283", "0.5113091", "0.5106511", "0.5103867", "0.5101951", "0.50962347", "0.5094182", "0.50815594", "0.5064627", "0.50641495", "0.50628954", "0.5062559", "0.5062296", "0.50608236", "0.5057272", "0.50536376", "0.50499207", "0.50498146", "0.50352716", "0.5027402", "0.50251424", "0.50030714", "0.5002602", "0.49991065", "0.49960127", "0.49960047", "0.49884978" ]
0.8307177
0
End of print_tags Method: print_custom_attributes Purpose: Prints the custom attributes (if any) of the object class passed to it Arguments: object_string : friendly text string name for the object this_object : the Ruby object whose tags are to be printed Returns: None
def print_custom_attributes(object_string, this_object) begin if this_object.respond_to?(:custom_keys) custom_attribute_keys = Array.wrap(this_object.custom_keys) if custom_attribute_keys.length.zero? print_line($recursion_level, "--- no custom attributes ---") else print_line($recursion_level, "--- custom attributes follow ---") custom_attribute_keys.sort.each do |custom_attribute_key| custom_attribute_value = this_object.custom_get(custom_attribute_key) print_line($recursion_level, "#{object_string}.custom_get(\'#{custom_attribute_key}\') = \'#{custom_attribute_value}\'") end print_line($recursion_level, "--- end of custom attributes ---") end else print_line($recursion_level, "--- object does not support custom attributes ---") end rescue => err $evm.log("error", "#{$method} (print_custom_attributes) - [#{err}]\n#{err.backtrace.join("\n")}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_attributes(object_string, this_object)\n begin\n #\n # Print the attributes of this object\n #\n if this_object.respond_to?(:attributes)\n print_line($recursion_level, \"Debug: this_object.inspected = #{this_object.inspect}\") if $debug\n if this_object.attributes.respond_to?(:keys)\n if this_object.attributes.keys.length > 0\n print_line($recursion_level, \"--- attributes follow ---\")\n this_object.attributes.keys.sort.each do |attribute_name|\n attribute_value = this_object.attributes[attribute_name]\n if attribute_name != \"options\"\n if attribute_value.is_a?(DRb::DRbObject)\n if attribute_value.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"#{object_string}[\\'#{attribute_name}\\'] => #{attribute_value} #{type(attribute_value)}\")\n walk_object(\"#{object_string}[\\'#{attribute_name}\\']\", attribute_value)\n else\n print_line($recursion_level,\n \"Debug: not dumping, attribute_value.method_missing(:class) = \" \\\n \"#{attribute_value.method_missing(:class)}\") if $debug\n end\n else\n begin\n attr_info = ping_attr(this_object, attribute_name)\n if attr_info[:value].nil?\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = #{attr_info[:value]} #{type(attr_info[:value])}\")\n end\n rescue ArgumentError\n if attribute_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = #{attribute_value} #{type(attribute_value)}\")\n end\n end\n end\n else\n #\n # Option key names can be mixed symbols and strings which confuses .sort\n # Create an option_map hash that maps option_name.to_s => option_name\n #\n option_map = {}\n options = attribute_value.keys\n options.each do |option_name|\n option_map[option_name.to_s] = option_name\n end\n option_map.keys.sort.each do |option|\n if attribute_value[option_map[option]].nil?\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = \" \\\n \"#{attribute_value[option_map[option]]} #{type(attribute_value[option_map[option]])}\")\n end\n end\n end\n end\n print_line($recursion_level, \"--- end of attributes ---\")\n else \n print_line($recursion_level, \"--- no attributes ---\")\n end\n else\n print_line($recursion_level, \"*** attributes is not a hash ***\")\n end\n else\n print_line($recursion_level, \"--- no attributes ---\")\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_object(object, threshold = '')\n out = '{' + \"\\n\"\n out << threshold + '\"ressource_type\": \"' + object.class.to_s + '\"' + \"\\n\"\n out << threshold + ',\"instance_name\": \"' + object.instance_name + '\"' + \"\\n\"\n\n object.list_of_attributes.each do |a|\n out << print_attribute(a.to_s, object.get_value(a.to_s), threshold)\n end\n out << '}'\n end", "def dump_attributes(my_object, my_object_name)\n if my_object.respond_to?(\"attributes\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.attributes\")\n my_object.attributes.sort.each { |k, v| self.log(:info, \"#{my_object_name} Attribute - #{k}: #{v}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.attributes\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No attributes for #{my_object_name}\")\n end\n end", "def print_attributes(object, keys)\n keys.each do |key|\n puts \"#{key}: #{object[key]}\"\n end\n puts \"\\n\"\nend", "def print_attribute(*) end", "def inspect\n att_info = []\n inspect_attributes.each do |att|\n next unless respond_to? att\n\n att_info << \"#{att}=#{send(att).inspect}\"\n end\n att_info << '..'\n \"\\#<#{self.class}:#{object_id} #{att_info.join(', ')}>\"\n end", "def dump_info(my_object, my_object_name)\n self.dump_attributes(my_object, my_object_name)\n self.dump_associations(my_object, my_object_name)\n self.dump_virtual_columns(my_object, my_object_name)\n end", "def inspect() \n print @obj_name\n print \" which is \"\n print @obj_attr\n print \" & \"\n puts @obj_secondattr\n end", "def inspect\n attributes = [\n \"feature_name=#{feature_name.inspect}\",\n \"gate_key=#{gate_key.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def inspect\n attributes = [\n \"feature=#{feature.name.inspect}\",\n \"description=#{description.inspect}\",\n \"adapter=#{adapter.name.inspect}\",\n \"adapter_key=#{adapter_key.inspect}\",\n \"toggle_class=#{toggle_class.inspect}\",\n \"toggle_value=#{toggle.value.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def print_tags(this_object, this_object_class)\n begin\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n tags = Array.wrap(this_object.tags)\n if tags.length.zero?\n print_line($recursion_level, \"--- no tags ---\")\n else\n print_line($recursion_level, \"--- tags follow ---\")\n tags.sort.each do |tag|\n print_line($recursion_level, \"#{tag}\")\n end\n print_line($recursion_level, \"--- end of tags ---\")\n end\n else\n print_line($recursion_level, \"--- object is not taggable ---\")\n end\n else\n print_line($recursion_level, \"--- no tags, or object is not taggable ---\")\n end\n \n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} gives a NoMethodError when the :tags method is accessed (product bug?) ***\")\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_tags) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def custom_inspect(object, *ivars_to_skip)\n variables = (object.instance_variables - ivars_to_skip).\n map { |var| \"#{var}=#{object.instance_variable_get(var).inspect}\" }.\n join(', ')\n \"<#{object.class}: #{variables}>\"\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"key=#{key.inspect}\",\n \"data_type=#{data_type.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def print_datastructure(object, threshold = ' ')\n out = ''\n if object.is_a?(Yarpler::Models::Relation)\n out << print_relation(object, threshold)\n else\n out << print_object(object, threshold)\n end\n out\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"use_local_cache=#{@use_local_cache.inspect}\"\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def pp_object(obj)\n object_address_group(obj) {\n seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|\n breakable\n v = v.to_s if Symbol === v\n text v\n text '='\n group(1) {\n breakable ''\n pp(obj.instance_eval(v))\n }\n }\n }\n end", "def debug(object)\n puts \"<pre>\"\n puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')\n puts \"</pre>\"\nend", "def inspect\n inspectables = self.class.inspectables\n if inspectables\n \"#<#{self.class}:0x#{object_id.to_s(16)} \" + inspectables.map {|i| \"@#{i}=\\\"#{send(i) rescue nil}\\\"\"}.join(' ') + \">\"\n else\n super\n end\n end", "def inspect\n inspectables = self.class.inspectables\n if inspectables\n \"#<#{self.class}:0x#{object_id.to_s(16)} \" + inspectables.map {|i| \"@#{i}=\\\"#{send(i) rescue nil}\\\"\"}.join(' ') + \">\"\n else\n super\n end\n end", "def print_virtual_columns(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the virtual columns of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the virtual columns of this object \n #\n virtual_column_names = []\n if this_object.respond_to?(:virtual_column_names)\n virtual_column_names = Array.wrap(this_object.virtual_column_names)\n if virtual_column_names.length.zero?\n print_line($recursion_level, \"--- no virtual columns ---\")\n else\n print_line($recursion_level, \"--- virtual columns follow ---\")\n virtual_column_names.sort.each do |virtual_column_name|\n begin\n virtual_column_value = this_object.method_missing(:send, virtual_column_name)\n if virtual_column_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = \" \\\n \"#{virtual_column_value} #{type(virtual_column_value)}\")\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} virtual column: \\'#{virtual_column_name}\\' \" \\\n \"gives a NoMethodError when accessed (product bug?) ***\")\n end\n end\n print_line($recursion_level, \"--- end of virtual columns ---\")\n end\n else\n print_line($recursion_level, \"--- no virtual columns ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_virtual_columns) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def walk_object(object_string, this_object)\n begin\n #\n # Make sure that we don't exceed our maximum recursion level\n #\n $recursion_level += 1\n if $recursion_level > $max_recursion_level\n print_line($recursion_level, \"*** exceeded maximum recursion level ***\")\n $recursion_level -= 1\n return\n end\n #\n # Make sure we haven't dumped this object already (some data structure links are cyclical)\n #\n this_object_id = this_object.id.to_s rescue this_object.object_id.to_s\n print_line($recursion_level,\n \"Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}\") if $debug\n this_object_class = \"#{this_object.method_missing(:class)}\".demodulize\n print_line($recursion_level, \"Debug: this_object_class = #{this_object_class}\") if $debug\n if $object_recorder.key?(this_object_class)\n if $object_recorder[this_object_class].include?(this_object_id)\n print_line($recursion_level,\n \"Object #{this_object_class} with ID #{this_object_id} has already been printed...\")\n $recursion_level -= 1\n return\n else\n $object_recorder[this_object_class] << this_object_id\n end\n else\n $object_recorder[this_object_class] = []\n $object_recorder[this_object_class] << this_object_id\n end\n #\n # Dump out the things of interest\n #\n print_attributes(object_string, this_object)\n print_virtual_columns(object_string, this_object, this_object_class)\n print_associations(object_string, this_object, this_object_class)\n print_methods(object_string, this_object) if $print_methods\n print_tags(this_object, this_object_class) if $service_model_base_supports_taggable\n print_custom_attributes(object_string, this_object)\n \n $recursion_level -= 1\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_object) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n $recursion_level -= 1\n end\nend", "def print_methods(object_string, this_object)\n begin\n #\n # Only dump the methods of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"Class of remote DRb::DRbObject is: #{this_object.method_missing(:class)}\") if $debug\n #\n # Get the instance methods of the class and convert to string\n #\n if this_object.method_missing(:class).respond_to?(:instance_methods)\n instance_methods = this_object.method_missing(:class).instance_methods.map { |x| x.to_s }\n #\n # Now we need to remove method names that we're not interested in...\n #\n # ...attribute names...\n #\n attributes = []\n if this_object.respond_to?(:attributes)\n if this_object.attributes.respond_to? :each\n this_object.attributes.each do |key, value|\n attributes << key\n end\n end\n end\n attributes << \"attributes\"\n $evm.log(\"info\", \"Removing attributes: #{instance_methods & attributes}\") if $debug\n instance_methods -= attributes\n #\n # ...association names...\n #\n associations = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n end\n associations << \"associations\"\n $evm.log(\"info\", \"Removing associations: #{instance_methods & associations}\") if $debug\n instance_methods -= associations\n #\n # ...virtual column names...\n #\n virtual_column_names = []\n virtual_column_names = this_object.method_missing(:virtual_column_names)\n virtual_column_names << \"virtual_column_names\"\n $evm.log(\"info\", \"Removing virtual_column_names: #{instance_methods & virtual_column_names}\") if $debug\n instance_methods -= virtual_column_names\n #\n # ... MiqAeServiceModelBase methods ...\n #\n $evm.log(\"info\", \"Removing MiqAeServiceModelBase methods: \" \\\n \"#{instance_methods & $service_mode_base_instance_methods}\") if $debug\n instance_methods -= $service_mode_base_instance_methods\n #\n # Add in the base methods as it's useful to show that they can be used with this object\n #\n instance_methods += ['inspect', 'inspect_all', 'reload', 'model_suffix']\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n else\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n #\n # and finally dump out the list\n #\n if instance_methods.length.zero?\n print_line($recursion_level, \"--- no methods ---\")\n else\n print_line($recursion_level, \"--- methods follow ---\")\n instance_methods.sort.each do |instance_method|\n print_line($recursion_level, \"#{object_string}.#{instance_method}\")\n end\n print_line($recursion_level, \"--- end of methods ---\")\n end\n else\n print_line($recursion_level, \"--- no methods ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_methods) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def inspect\n fields = serializable_hash.map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} #{fields.join(' ')}>\"\n end", "def dump_tags(object)\n return if object.tags.nil?\n\n $evm.log(\"info\", \" Begin Tags [object.tags]\")\n object.tags.sort.each do |tag_element|\n tag_text = tag_element.split('/')\n $evm.log(\"info\", \" Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")\n end\n $evm.log(\"info\", \" End Tags [object.tags]\")\n $evm.log(\"info\", \"\")\nend", "def inspect\n vars = options.map { |k, v| \"@#{k}=#{v}\" }.join(\", \")\n \"#<#{self.class}:#{format('0x%014x', object_id)} #{vars}>\"\n end", "def display_attributes\n puts\n puts @str.tr(NULL, \"!\")\n bit = 1\n 16.times do |bno|\n line = \"\"\n @str.length.times do |i|\n if (@attrs[i] & bit) == 0\n line << \" \"\n else\n if bno.zero?\n line << \"S\"\n else\n line << (\"%d\" % (bno+1))\n end\n end\n end\n puts(line) unless line =~ /^ *$/\n bit <<= 1\n end\n end", "def inspect\n attributes = [\n \"name=#{name.inspect}\",\n \"state=#{state.inspect}\",\n \"description=#{description.inspect}\",\n \"adapter=#{adapter.name.inspect}\",\n ]\n \"#<#{self.class.name}:#{object_id} #{attributes.join(', ')}>\"\n end", "def inspect\n output = \"#<#{self.class}:#{(object_id << 1).to_s(16)}\"\n\n %i[username token idle_timeout duration].each do |attribute|\n value = instance_variable_get \"@#{attribute}\".to_sym\n output += \" @#{attribute}=#{value}\" unless value.nil?\n end\n\n output += '>'\n output\n end", "def inspect\n\t\treturn \"#<%s:0x%0x %s(%s) %p -> %p >\" % [\n\t\t\tself.class.name,\n\t\t\tself.object_id / 2,\n\t\t\tself.name,\n\t\t\tself.oid,\n\t\t\tself.desc,\n\t\t\tself.attr_oids,\n\t\t]\n\tend", "def inspect\n \"#<#{self.class.name}:0x#{object_id}\\n @base_url=\\\"#{@base_url}\\\"\\n @most_recent_page=#{@most_recent_page}>\"\n end", "def inspect\n str = +\"#<#{self.class.name}:0x#{object_id}\"\n str << \" id=\\\"#{@id}\\\"\" if @id\n str << '>'\n end", "def display_string(options, object, length = nil)\n \":#{object}\"\n end", "def awesome_active_resource_instance(object)\n \"#{object} \" << awesome_hash(object.attributes)\n end", "def awesome_self(object, type)\n if @options[:raw] && object.instance_variables.any?\n awesome_object(object)\n else\n colorize(object.inspect.to_s, type)\n end\n end", "def generate_object(object, title, kind, seed, extra)\n props = select_properties(object.all_user_properties, kind, extra)\n\n extra = {\n project: \"'test project\\##{seed} data'\",\n credential: \"'cred#{seed}'\"\n }.merge(extra)\n\n # Puppet does not like when virtual resources have an ensure property\n extra.delete(:ensure) if object.virtual\n\n [\n \"#{object.out_name} { '#{title}':\",\n @provider.indent_list(\n emit_manifest_block(props, seed, extra, {}), 2, true\n ),\n '}'\n ]\n end", "def pretty(object)\n PP.pp(object, out)\n end", "def inspect\n\t\t\tmodel_inspect = super\n\t\t\ta = dynamic_attributes_fields.keys.map { |attr| \"#{attr}: #{self[attr].inspect || 'nil'}\" }\n\t\t\tdynamic_inspect = a.join(', ')\n\t\t\t\"#{model_inspect[0..-2]} || #{dynamic_inspect}>\"\n\t\tend", "def dump(obj, io)\n io.puts obj.send(inspect_method)\n end", "def printable_with_mongoid(object)\n \n printable = printable_without_mongoid(object)\n if printable == :self\n if object.respond_to?(:fields)\n printable = :mongoid_instance\n end\n elsif printable == :class and !object.respond_to?(:to_model)\n printable = :mongoid_class\n end\n printable\n end", "def print_hash(header_string, object_hash)\n puts header_string\n puts \"=\" * header_string.length\n object_hash.each_pair do |key, values|\n next if values.empty?\n puts \"- #{key}\"\n values.each { |value| puts \" - #{value}\" }\n end\n end", "def inspect\n attributes_for_inspect = self.attributes.collect do |attr|\n \"#{attr}: \" + self.instance_variable_get(\"@#{attr}\").to_s\n end.join(\", \")\n return \"#<#{self.class} #{attributes_for_inspect}>\"\n end", "def inspect\n sprintf(\"#<%s:%#0x(%s)>\", self.class.name, object_id, to_s)\n end", "def inspect\n @_inspect ||= begin\n \"#<\" <<\n self.class.inspect <<\n (\":0x%014x\" % object_id) <<\n \">\"\n end\n end", "def inspect\n inspection = self.info.keys.map { |name|\n \"#{name}: #{attribute_for_inspect(name)}\"\n }.compact.join(\", \")\n \"#<#{self.class}:0x#{self.object_id.to_s(16)} #{inspection}>\"\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def inspect\n String.new('#<').concat(\n self.class.name, ':',\n object_id.to_s, ' ', to_s, '>'\n )\n end", "def make_html_for_object( object )\n\t\t\treturn object.html_inspect if \n\t\t\t\tobject.respond_to?( :html_inspect ) && ! object.is_a?( HtmlInspectableObject )\n\t\t\tobject_html = []\n\n\t\t\tcase object\n\t\t\twhen Hash\n\t\t\t\tobject_html << \"\\n<!-- Hash -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '{}'\n\t\t\t\telse\n\t\t\t\t\tobject_html << HASH_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|k,v|\n\t\t\t\t\t\t\tpairclass = v.instance_variables.empty? ? \n\t\t\t\t\t\t\t\t\"simple-hash-pair\" :\n\t\t\t\t\t\t\t\t\"complex-hash-pair\"\n\t\t\t\t\t\t\tHASH_PAIR_HTML % [\n\t\t\t\t\t\t\t\tpairclass,\n\t\t\t\t\t\t\t\tmake_html_for_object(k),\n\t\t\t\t\t\t\t\tmake_html_for_object(v),\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\twhen Array\n\t\t\t\tobject_html << \"\\n<!-- Array -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '[]'\n\t\t\t\telse\n\t\t\t\t\tobject_html << ARRAY_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|o| make_html_for_object(o) }.join('</li><li>')\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tif object.instance_variables.empty?\n\t\t\t\t\treturn IMMEDIATE_OBJECT_HTML_CONTAINER % \n\t\t\t\t\t\t[ HTMLUtilities.escape_html(object.inspect) ]\n\t\t\t\telse\n\t\t\t\t\tobject_html << make_object_html_wrapper( object )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn object_html.join(\"\\n\")\n\t\tend", "def inspect\n \"#<#{self.class} @attributes=#{@attributes.inspect}>\"\n end", "def make_html_for_object( object )\n\t\t\treturn object.html_inspect if \n\t\t\t\tobject.respond_to?( :html_inspect ) && ! object.is_a?( HtmlInspectableObject )\n\t\t\tobject_html = []\n\n\t\t\tcase object\n\t\t\twhen Hash\n\t\t\t\tobject_html << \"\\n<!-- Hash -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '{}'\n\t\t\t\telse\n\t\t\t\t\tobject_html << HASH_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|k,v|\n\t\t\t\t\t\t\tpairclass = v.instance_variables.empty? ? \n\t\t\t\t\t\t\t\t\"simple-hash-pair\" :\n\t\t\t\t\t\t\t\t\"complex-hash-pair\"\n\t\t\t\t\t\t\tHASH_PAIR_HTML % [\n\t\t\t\t\t\t\t\tpairclass,\n\t\t\t\t\t\t\t\tmake_html_for_object(k),\n\t\t\t\t\t\t\t\tmake_html_for_object(v),\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\twhen Array\n\t\t\t\tobject_html << \"\\n<!-- Array -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '[]'\n\t\t\t\telse\n\t\t\t\t\tobject_html << ARRAY_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|o| make_html_for_object(o) }.join('</li><li>')\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tif object.instance_variables.empty?\n\t\t\t\t\treturn IMMEDIATE_OBJECT_HTML_CONTAINER %\n\t\t\t\t\t\t[ HTMLUtilities.escape_html(object.inspect) ]\n\t\t\t\telse\n\t\t\t\t\tobject_html << make_object_html_wrapper( object )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn object_html.join(\"\\n\")\n\t\tend", "def inspect\n attribute_string = self.class.attributes.map do |key|\n \"#{key}: #{read_attribute(key).inspect}\"\n end.join(', ')\n \"#<#{self.class} #{attribute_string}>\"\n end", "def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{fullName}>\"\n end", "def ru_debug(object)\n begin\n \"<pre class='debug_dump'>#{object.to_yaml}</pre> <p><em>Raw dump</em></p>\".html_safe\n rescue Exception => e # errors from Marshal or YAML\n # Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback\n \"<code class='debug_dump'>#{object.inspect}</code>\".html_safe\n end\n end", "def attribute_user_tag; object_type.tag rescue \"\"; end", "def inspect\n \"#<#{classname} :#{attribute}>\"\n end", "def object_attributes(object, action = nil)\n MyAdmin.get_object_attributes(object, action)\n end", "def inspect\n \"#<#{self.class.name}:#{object_id}> @names=#{names}>\"\n end", "def inspect\n\t\t\treturn %Q{#<%s:0x%0x \"%s\">} % [\n\t\t\t\tself.class.name,\n\t\t\t\tself.object_id * 2,\n\t\t\t\tself.to_s,\n\t\t\t]\n\t\tend", "def inspect\n attributes_as_nice_string = ([\"id\"] + self.class.attributes).collect { |name|\n \"#{name}: #{send(name).inspect}\"\n }.compact.join(\", \")\n \"#<#{self.class} #{attributes_as_nice_string}>\"\n end", "def serialized_attributes(str = +'', additional_attributes = {})\n super(str, additional_attributes, false)\n end", "def custom_attributes(product_id)\n response, status = BeyondApi::Request.get(@session, \"/products/#{product_id}/attributes\")\n\n handle_response(response, status)\n end", "def dump(object)\n raise NotImplementedError, \"#{self.class}#dump is not implemented\"\n end", "def dump_virtual_columns(my_object, my_object_name)\n if my_object.respond_to?(\"virtual_column_names\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.virtual_columns\")\n my_object.virtual_column_names.sort.each { |vcn| self.log(:info, \"#{my_object_name} Virtual Column - #{vcn}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.virtual_columns\")\n self.log(@dump_log_level, \"\")\n else\n log(@dump_log_level, \"No virtual_columns for #{my_object_name}\")\n end\n end", "def printallattrs(msg)\n msg.reply \"Listing available attributes:\"\n Physattr.each { |p| msg.reply p unless p.is_hidden? }\n msg.reply \"Done!\"\n end", "def inspect\n inspected_attributes = attribute_names.sort\n attributes_list = \"(#{inspected_attributes.join(\", \")})\" unless inspected_attributes.empty?\n \"#{name}#{attributes_list}\"\n end", "def checked_print object = ''\n print object\n @prev_printed = true\n end", "def inspect\n obj_id = \"%x\" % (object_id << 1)\n \"#<#{self.class}:0x#{obj_id} @muc_jid=\\\"#{muc_jid}\\\" @jid=\\\"#{jid}\\\" @nick=#{@nick.inspect} @affiliation=#{affiliation.inspect} @role=#{@role.inspect}>\"\n end", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n # $walk_associations_whitelist & $walk_associations_blacklist hashes\n #\n associations = []\n associated_objects = []\n duplicates = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n if associations.length.zero?\n print_line($recursion_level, \"--- no associations ---\")\n else\n print_line($recursion_level, \"--- associations follow ---\")\n duplicates = associations.select{|item| associations.count(item) > 1}\n if duplicates.length > 0\n print_line($recursion_level,\n \"*** De-duplicating the following associations: #{duplicates.inspect} ***\")\n end\n associations.uniq.sort.each do |association|\n begin\n associated_objects = Array.wrap(this_object.method_missing(:send, association))\n if associated_objects.length == 0\n print_line($recursion_level,\n \"#{object_string}.#{association} (type: Association (empty))\")\n else\n print_line($recursion_level, \"#{object_string}.#{association} (type: Association)\")\n #\n # See if we need to walk this association according to the walk_association_policy\n # variable, and the walk_association_{whitelist,blacklist} hashes\n #\n if $walk_association_policy == 'whitelist'\n if $walk_association_whitelist.has_key?(this_object_class) &&\n ($walk_association_whitelist[this_object_class].include?('ALL') ||\n $walk_association_whitelist[this_object_class].include?(association.to_s))\n walk_association(object_string, association, associated_objects)\n else\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' isn't in the walk_association_whitelist \" \\\n \"hash for #{this_object_class} ***\")\n end\n elsif $walk_association_policy == 'blacklist'\n if $walk_association_blacklist.has_key?(this_object_class) &&\n ($walk_association_blacklist[this_object_class].include?('ALL') ||\n $walk_association_blacklist[this_object_class].include?(association.to_s))\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' is in the walk_association_blacklist \" \\\n \"hash for #{this_object_class} ***\")\n else\n walk_association(object_string, association, associated_objects)\n end\n else\n print_line($recursion_level,\n \"*** Invalid $walk_association_policy: #{$walk_association_policy} ***\")\n exit MIQ_ABORT\n end\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} association: \\'#{association}\\', gives a \" \\\n \"NoMethodError when accessed (product bug?) ***\")\n next\n end\n end\n print_line($recursion_level, \"--- end of associations ---\")\n end\n else\n print_line($recursion_level, \"--- no associations ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_associations) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def inspect\n vals = ATTRS.map { |field| \"#{field}: #{public_send(field).inspect}\" }\n \"#<#{self.class.name} #{vals.join(', ')}>\"\n end", "def custom_attributes=(custom_attributes = {})\n @attributes[:custom] = ChartMogul::Utils::JSONParser.typecast_custom_attributes(custom_attributes)\n end", "def inspect\n attribute_string = attributes.map { |name, value| \"#{name}: #{value.nil? ? 'nil' : value}\" }\n .join(\", \")\n \"#<#{self.class.name} #{attribute_string}>\"\n end", "def inspect\n attribute_string = attributes.map { |name, value| \"#{name}: #{value.nil? ? 'nil' : value}\" }\n .join(\", \")\n \"#<#{self.class.name} #{attribute_string}>\"\n end", "def inspect\n attribute_string = attributes.map { |name, value| \"#{name}: #{value.nil? ? 'nil' : value}\" }\n .join(\", \")\n \"#<#{self.class.name} #{attribute_string}>\"\n end", "def print_primary_attributes\n \"Strenght(STR):#{str}, Dexterity(DEX):#{dex}, Inteligence(INT):#{int}, Constitution(CON):#{con}, Appearence(APP):#{app}, Power(POW):#{pow}, Size:#{siz}, Education:#{edu}\"\n end", "def print(*obj)\n each_ios_and_stdout(*obj, &:print)\n nil\n end", "def tag(tagname, attributes={})\n# Output the tag name\n@out << \"<#{tagname}\"\n# Get the allowed attributes for this tag.\nallowed = self.class.allowed_attributes[tagname]\n# First, make sure that each of the attributes is allowed.\n# Assuming they are allowed, output all of the specified ones.\nattributes.each_pair do |key,value|\nraise \"unknown attribute: #{key}\" unless allowed.include?(key)\n@out << \" #{key}='#{value}'\"\nend\nend", "def inspect #:nodoc:\n s = \"#<#{self.class}:0x#{(self.object_id*2).to_s(16)} \"\n @metadata_blocks.each do |blk|\n s += \"(#{blk[0].upcase} size=#{blk[4]} offset=#{blk[3]}) \"\n end\n s += \"\\b>\"\n end", "def inspect(max: 256)\n items = Array.wrap(object).map(&:class)\n items = items.tally.map { |cls, cnt| \"#{cnt} #{cls}\" }.presence\n items = items&.join(' / ') || 'empty'\n vars =\n instance_variables.excluding(:@object).map { |var|\n [var, instance_variable_get(var).inspect.truncate(max)]\n }.to_h\n vars = vars.merge!('@object': \"(#{items})\").map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} %s>\" % vars.join(' ')\n end", "def html_inspect\n\t\t\tif self.instance_variables.empty?\n\t\t\t\treturn make_html_for_object( self )\n\t\t\telse\n\t\t\t\treturn make_object_html_wrapper( self )\n\t\t\tend\n\t\tend", "def html_inspect\n\t\t\tif self.instance_variables.empty?\n\t\t\t\treturn make_html_for_object( self )\n\t\t\telse\n\t\t\t\treturn make_object_html_wrapper( self )\n\t\t\tend\n\t\tend", "def dump(object)\n raise NotImplementedError, \"#{self.class} must implement #dump\"\n end", "def inspect\n \"#{ self.class }:0x#{ '%x' % (object_id << 1) }: #{ name }\"\n end", "def generate_object_label\n \t\tlabel = \"\"\n label_names = \" - \"\n\t\tbegin\n\t\t\tnames = self.get_values_from_datastream(\"descMetadata\", [:name, :namePart], {})\n\t\t\troles = self.get_values_from_datastream(\"descMetadata\", [:name, :role, :text], {}) \n\t\t\t#'zip' name into role array\n\t\t\trole_name = roles.zip(names)\n\t role_name.each do |person|\n\t\t\t role = person[0].to_s.downcase\n\t\t\t \tif role == 'creator' || role == 'author'\n\t\t\t\t\tlabel_names = label_names + person[1] + '; '\n\t\t\t\tend\t\t\n\t end\n\t\trescue OM::XML::Terminology::BadPointerError => e\n\t\t\t#Assume that its an object without author (Set or alike)\n\t\t\tlabel_names = \"\"\n\t\tend\n\t\ttitle = self.get_values_from_datastream(\"descMetadata\", [:title], {}).to_s\n\n\t\t#truncate the title if its too long (over 100 chars)\n\t\ttitle = title.length > 100 ? title[0..100] <<'...': title unless title.nil?\n\t\tlabel = title + label_names\n \n #255 character limit for labels, we'll limit to 200 to be on the safe-side...\n label = label.length > 200 ? label[0..197] << '...' : label\t\n\n #When the label has any leading/trailing spaces strip them off...\n label = label.strip!.nil? ? label : label.strip\n\t\treturn label\n\n end", "def log_inspect(object, grep_string = '')\n prefix = grep_string.empty? ? \"\" : \"[#{grep_string}] \"\n self.debug { \"#{prefix} Class=[#{object.class}], Inspect=[#{object.inspect}]\" }\n end", "def fetch_custom_attributes\n endpoint = \"/api/#{@version}/custom-attributes/\"\n make_get_request(endpoint)\n end", "def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend", "def add_attribute attribute\n @display.print_attribute attribute\n end", "def create_text_object(obj)\n return content_tag(:div, content_tag(:p, obj.textobject), :class => Pageobject::COLOR[obj.color], :style => \"position:absolute; \n top: #{obj.y}px; left: #{obj.x}px;\")\n end", "def awesome_data_mapper_instance(object)\n return object.inspect if !defined?(::ActiveSupport::OrderedHash)\n return awesome_object(object) if @options[:raw]\n\n data = object.class.properties.map(&:name).inject(::ActiveSupport::OrderedHash.new) do |hash, name|\n value = object.respond_to?(name) ? object.send(name) : object.read_attribute(name)\n hash[name.to_sym] = value\n hash\n end\n \"#{object} \" << awesome_hash(data)\n end", "def aws_obj_tags_default(obj)\n log \"AWS: creating default tags for #{obj.class.to_s.split(\"::\").last} '#{obj.id}'\"\n aws_call('aws_obj_tag', obj: obj, tag: \"Name\", value: \"#{Rails.configuration.x.aws['iam_user_name']}-#{self.scenario.user.name}-#{self.scenario.name}-#{self.scenario.id.to_s}\")\n aws_call('aws_obj_tag', obj: obj, tag: 'host', value: Rails.configuration.x.aws['iam_user_name'])\n aws_call('aws_obj_tag', obj: obj, tag: 'instructor', value: self.scenario.user.name)\n aws_call('aws_obj_tag', obj: obj, tag: 'scenario_id', value: self.scenario.id)\n end", "def inspect\n # We check defined?(@attributes) not to issue warnings if the object is\n # allocated but not initialized.\n inspection = if defined?(@attributes) && @attributes\n self.class.column_names.map do |name|\n if has_attribute?(name)\n \"#{name}: #{attribute_for_inspect(name)}\"\n end\n end.compact.join(', ')\n else\n 'not initialized'\n end\n \"#<#{self.class} #{inspection}>\"\n end", "def println obj\n echo(obj.to_s + \"\\n\")\n end", "def print\r\n tags.each do |tag|\r\n puts \"#{@@tag_titles[tag]} -> #{value(tag)}\"\r\n end\r\n end", "def p object\n TetCore.break_after_print\n TetCore.real_p(object)\nend", "def output object\n STDOUT.puts \"#{object}\"\n end", "def inspect\n \"(#{self.class.name}:#{'0x%08x' % (object_id * 2)})\"\n end", "def print_secondary_attributes\n \"Sanity:#{san}, Health:#{health}, Luck:, Know: Magic:, \"\n end", "def render(obj)\n # We can't use a case statement here becuase \"when Hash\" doesn't work for\n # ActiveSupport::OrderedHash - respond_to?(:values) is a more reliable\n # indicator of hash-like behavior.\n if NilClass === obj\n print(\"null\")\n \n elsif TrueClass === obj\n print(\"true\")\n \n elsif FalseClass === obj\n print(\"false\")\n \n elsif String === obj\n print(escape_json_string(obj))\n \n elsif Symbol === obj\n print(\"\\\"#{obj}\\\"\")\n \n elsif Numeric === obj\n print(obj.to_s)\n \n elsif Time === obj\n print(obj.to_s)\n \n elsif obj.respond_to?(:keys)\n print(\"{\")\n indent_out\n last_key = obj.keys.last\n obj.each do |(key, val)|\n render(key)\n case val\n when Hash, Array\n indent_out\n print(\":\\n#{indent}\")\n render(val)\n indent_in\n else\n print(\": \")\n render(val)\n end\n print(\",\\n#{indent}\") unless key == last_key\n end\n indent_in\n print(\"}\")\n \n elsif Array === obj\n print(\"[\")\n indent_out\n last_index = obj.size - 1\n obj.each_with_index do |elem, index|\n render(elem)\n print(\",\\n#{indent}\") unless index == last_index\n end\n indent_in\n print(\"]\")\n \n else\n raise \"unrenderable object: #{obj.inspect}\"\n end\n end", "def inspect\n str = Inspect.dashed_line(self.class, 1)\n self.class.class_eval { @attributes }.each do |attr|\n str << Inspect.inspect_asn1_attribute(attr, self[attr], 1)\n end\n str\n end" ]
[ "0.74974066", "0.7122771", "0.69482476", "0.6200635", "0.6074842", "0.5990056", "0.5946502", "0.5888241", "0.5779293", "0.56118345", "0.5611337", "0.55958146", "0.54379874", "0.5406638", "0.5398406", "0.5379504", "0.5338478", "0.5294797", "0.5294797", "0.5271711", "0.52399147", "0.52370137", "0.5228506", "0.520458", "0.5178016", "0.5169358", "0.5159982", "0.5144794", "0.5144771", "0.51299846", "0.5127697", "0.51222193", "0.5120194", "0.51069427", "0.5092938", "0.50685656", "0.504656", "0.50453264", "0.504497", "0.50432414", "0.50322396", "0.50259864", "0.50114703", "0.49730527", "0.49724337", "0.49724337", "0.49724337", "0.49724337", "0.49657676", "0.49607432", "0.4957695", "0.49370027", "0.49358907", "0.49291897", "0.4926314", "0.49232182", "0.49188238", "0.4908942", "0.48983502", "0.48983276", "0.48938453", "0.48895994", "0.48851487", "0.48844615", "0.488436", "0.4874382", "0.48731673", "0.4868267", "0.48670933", "0.48629588", "0.48619264", "0.48565164", "0.48565164", "0.48565164", "0.48246464", "0.48240513", "0.48209545", "0.4818973", "0.4811891", "0.48027754", "0.48027754", "0.48005745", "0.4796355", "0.4792416", "0.47897795", "0.47879213", "0.47872597", "0.4786165", "0.47806218", "0.47805235", "0.4774981", "0.47665015", "0.47619185", "0.47591776", "0.4756947", "0.47526", "0.47438806", "0.47420678", "0.47413385", "0.47404763" ]
0.8780458
0
End of print_custom_attributes Method: walk_object Purpose: Prints the details of the object passed to it Arguments: indent_level : the numeric value to use to indicate output indent (represents recursion depth) object_string : friendly text string name for the object this_object : the Ruby object to be dumped Returns: None
def walk_object(object_string, this_object) begin # # Make sure that we don't exceed our maximum recursion level # $recursion_level += 1 if $recursion_level > $max_recursion_level print_line($recursion_level, "*** exceeded maximum recursion level ***") $recursion_level -= 1 return end # # Make sure we haven't dumped this object already (some data structure links are cyclical) # this_object_id = this_object.id.to_s rescue this_object.object_id.to_s print_line($recursion_level, "Debug: this_object.method_missing(:class) = #{this_object.method_missing(:class)}") if $debug this_object_class = "#{this_object.method_missing(:class)}".demodulize print_line($recursion_level, "Debug: this_object_class = #{this_object_class}") if $debug if $object_recorder.key?(this_object_class) if $object_recorder[this_object_class].include?(this_object_id) print_line($recursion_level, "Object #{this_object_class} with ID #{this_object_id} has already been printed...") $recursion_level -= 1 return else $object_recorder[this_object_class] << this_object_id end else $object_recorder[this_object_class] = [] $object_recorder[this_object_class] << this_object_id end # # Dump out the things of interest # print_attributes(object_string, this_object) print_virtual_columns(object_string, this_object, this_object_class) print_associations(object_string, this_object, this_object_class) print_methods(object_string, this_object) if $print_methods print_tags(this_object, this_object_class) if $service_model_base_supports_taggable print_custom_attributes(object_string, this_object) $recursion_level -= 1 rescue => err $evm.log("error", "#{$method} (walk_object) - [#{err}]\n#{err.backtrace.join("\n")}") $recursion_level -= 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_custom_attributes(object_string, this_object)\n begin\n if this_object.respond_to?(:custom_keys)\n custom_attribute_keys = Array.wrap(this_object.custom_keys)\n if custom_attribute_keys.length.zero?\n print_line($recursion_level, \"--- no custom attributes ---\")\n else\n print_line($recursion_level, \"--- custom attributes follow ---\")\n custom_attribute_keys.sort.each do |custom_attribute_key|\n custom_attribute_value = this_object.custom_get(custom_attribute_key)\n print_line($recursion_level, \"#{object_string}.custom_get(\\'#{custom_attribute_key}\\') = \\'#{custom_attribute_value}\\'\")\n end\n print_line($recursion_level, \"--- end of custom attributes ---\")\n end\n else\n print_line($recursion_level, \"--- object does not support custom attributes ---\")\n end \n rescue => err\n $evm.log(\"error\", \"#{$method} (print_custom_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_attributes(object_string, this_object)\n begin\n #\n # Print the attributes of this object\n #\n if this_object.respond_to?(:attributes)\n print_line($recursion_level, \"Debug: this_object.inspected = #{this_object.inspect}\") if $debug\n if this_object.attributes.respond_to?(:keys)\n if this_object.attributes.keys.length > 0\n print_line($recursion_level, \"--- attributes follow ---\")\n this_object.attributes.keys.sort.each do |attribute_name|\n attribute_value = this_object.attributes[attribute_name]\n if attribute_name != \"options\"\n if attribute_value.is_a?(DRb::DRbObject)\n if attribute_value.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"#{object_string}[\\'#{attribute_name}\\'] => #{attribute_value} #{type(attribute_value)}\")\n walk_object(\"#{object_string}[\\'#{attribute_name}\\']\", attribute_value)\n else\n print_line($recursion_level,\n \"Debug: not dumping, attribute_value.method_missing(:class) = \" \\\n \"#{attribute_value.method_missing(:class)}\") if $debug\n end\n else\n begin\n attr_info = ping_attr(this_object, attribute_name)\n if attr_info[:value].nil?\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}#{attr_info[:format_string]} = #{attr_info[:value]} #{type(attr_info[:value])}\")\n end\n rescue ArgumentError\n if attribute_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{attribute_name} = #{attribute_value} #{type(attribute_value)}\")\n end\n end\n end\n else\n #\n # Option key names can be mixed symbols and strings which confuses .sort\n # Create an option_map hash that maps option_name.to_s => option_name\n #\n option_map = {}\n options = attribute_value.keys\n options.each do |option_name|\n option_map[option_name.to_s] = option_name\n end\n option_map.keys.sort.each do |option|\n if attribute_value[option_map[option]].nil?\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.options[#{str_or_sym(option_map[option])}] = \" \\\n \"#{attribute_value[option_map[option]]} #{type(attribute_value[option_map[option]])}\")\n end\n end\n end\n end\n print_line($recursion_level, \"--- end of attributes ---\")\n else \n print_line($recursion_level, \"--- no attributes ---\")\n end\n else\n print_line($recursion_level, \"*** attributes is not a hash ***\")\n end\n else\n print_line($recursion_level, \"--- no attributes ---\")\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_attributes) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def print_object(object, threshold = '')\n out = '{' + \"\\n\"\n out << threshold + '\"ressource_type\": \"' + object.class.to_s + '\"' + \"\\n\"\n out << threshold + ',\"instance_name\": \"' + object.instance_name + '\"' + \"\\n\"\n\n object.list_of_attributes.each do |a|\n out << print_attribute(a.to_s, object.get_value(a.to_s), threshold)\n end\n out << '}'\n end", "def print_datastructure(object, threshold = ' ')\n out = ''\n if object.is_a?(Yarpler::Models::Relation)\n out << print_relation(object, threshold)\n else\n out << print_object(object, threshold)\n end\n out\n end", "def dump_attributes(my_object, my_object_name)\n if my_object.respond_to?(\"attributes\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.attributes\")\n my_object.attributes.sort.each { |k, v| self.log(:info, \"#{my_object_name} Attribute - #{k}: #{v}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.attributes\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No attributes for #{my_object_name}\")\n end\n end", "def dump_info(my_object, my_object_name)\n self.dump_attributes(my_object, my_object_name)\n self.dump_associations(my_object, my_object_name)\n self.dump_virtual_columns(my_object, my_object_name)\n end", "def pretty(object)\n PP.pp(object, out)\n end", "def print_automation_objects(indent_level, hierarchy)\n case hierarchy.position\n when 'root'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.root)\")\n when 'parent'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.parent)\")\n when 'object'\n print_line(indent_level, \"#{hierarchy.obj_name} ($evm.object)\")\n else\n print_line(indent_level, \"#{hierarchy.obj_name}\")\n end\n indent_level += 1\n hierarchy.children.each do |child|\n print_automation_objects(indent_level, child)\n end\nend", "def pp_object(obj)\n object_address_group(obj) {\n seplist(obj.pretty_print_instance_variables, lambda { text ',' }) {|v|\n breakable\n v = v.to_s if Symbol === v\n text v\n text '='\n group(1) {\n breakable ''\n pp(obj.instance_eval(v))\n }\n }\n }\n end", "def recursive_inspect(string, indent = 1)\n string << \"<#{inspect_name} #{full_path.inspect}\\n\"\n string << \"#{spacing(indent)}sql = #{to_sql}\\n\" unless to_sql.nil?\n string << \"#{spacing(indent)}parent = #{parent.nil? ? nil.inspect : parent.inspect_name}\"\n string << \"\\n\" unless children.length.zero?\n children.each do |key, child|\n string << \"#{spacing(indent)}#{key} =\\n\"\n string << spacing(indent + 1)\n child.recursive_inspect(string, indent + 2)\n end\n string << \"\\n\" if children.length.zero? && value?\n string << \"#{spacing(indent)}value = #{value.inspect}\" if value?\n\n string << if children.length.zero?\n \">\\n\"\n else\n \"#{spacing(indent - 1)}>\\n\"\n end\n end", "def pretty_print(depth = 0)\n depth.times { STDERR.print ' *' }\n STDERR.print ' '\n STDERR.puts \"#{@name} (#{@id})\"\n @contents.each { |obj| obj.pretty_print(depth + 1) }\n end", "def pp(obj)\n id = obj.object_id\n\n if check_inspect_key(id)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(id)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(id) unless PP.sharing_detection\n end\n end", "def fprint(object, depth = 0)\n #puts \"%10s\" % [\"foo\"]\n puts \"%10s\" % [object.to_s]\nend", "def inspect() \n print @obj_name\n print \" which is \"\n print @obj_attr\n print \" & \"\n puts @obj_secondattr\n end", "def dump(obj, io)\n io.puts obj.send(inspect_method)\n end", "def inspect_in_object(obj, opts)\n val = obj.send(name)\n str =\n begin\n val.inspect_with_options(opts)\n rescue NoMethodError\n val.inspect\n end\n (f=@format) ? (f % str) : str\n end", "def print_tags(this_object, this_object_class)\n begin\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n tags = Array.wrap(this_object.tags)\n if tags.length.zero?\n print_line($recursion_level, \"--- no tags ---\")\n else\n print_line($recursion_level, \"--- tags follow ---\")\n tags.sort.each do |tag|\n print_line($recursion_level, \"#{tag}\")\n end\n print_line($recursion_level, \"--- end of tags ---\")\n end\n else\n print_line($recursion_level, \"--- object is not taggable ---\")\n end\n else\n print_line($recursion_level, \"--- no tags, or object is not taggable ---\")\n end\n \n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} gives a NoMethodError when the :tags method is accessed (product bug?) ***\")\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_tags) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def debug(object)\n puts \"<pre>\"\n puts object.pretty_inspect.gsub('<', '&lt;').gsub('>', '&gt;')\n puts \"</pre>\"\nend", "def print_associations(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the associations of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the associations of this object according to the\n # $walk_associations_whitelist & $walk_associations_blacklist hashes\n #\n associations = []\n associated_objects = []\n duplicates = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n if associations.length.zero?\n print_line($recursion_level, \"--- no associations ---\")\n else\n print_line($recursion_level, \"--- associations follow ---\")\n duplicates = associations.select{|item| associations.count(item) > 1}\n if duplicates.length > 0\n print_line($recursion_level,\n \"*** De-duplicating the following associations: #{duplicates.inspect} ***\")\n end\n associations.uniq.sort.each do |association|\n begin\n associated_objects = Array.wrap(this_object.method_missing(:send, association))\n if associated_objects.length == 0\n print_line($recursion_level,\n \"#{object_string}.#{association} (type: Association (empty))\")\n else\n print_line($recursion_level, \"#{object_string}.#{association} (type: Association)\")\n #\n # See if we need to walk this association according to the walk_association_policy\n # variable, and the walk_association_{whitelist,blacklist} hashes\n #\n if $walk_association_policy == 'whitelist'\n if $walk_association_whitelist.has_key?(this_object_class) &&\n ($walk_association_whitelist[this_object_class].include?('ALL') ||\n $walk_association_whitelist[this_object_class].include?(association.to_s))\n walk_association(object_string, association, associated_objects)\n else\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' isn't in the walk_association_whitelist \" \\\n \"hash for #{this_object_class} ***\")\n end\n elsif $walk_association_policy == 'blacklist'\n if $walk_association_blacklist.has_key?(this_object_class) &&\n ($walk_association_blacklist[this_object_class].include?('ALL') ||\n $walk_association_blacklist[this_object_class].include?(association.to_s))\n print_line($recursion_level,\n \"*** not walking: \\'#{association}\\' is in the walk_association_blacklist \" \\\n \"hash for #{this_object_class} ***\")\n else\n walk_association(object_string, association, associated_objects)\n end\n else\n print_line($recursion_level,\n \"*** Invalid $walk_association_policy: #{$walk_association_policy} ***\")\n exit MIQ_ABORT\n end\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} association: \\'#{association}\\', gives a \" \\\n \"NoMethodError when accessed (product bug?) ***\")\n next\n end\n end\n print_line($recursion_level, \"--- end of associations ---\")\n end\n else\n print_line($recursion_level, \"--- no associations ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_associations) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def pprint(object)\n PP.pp(object)\nend", "def pp(obj)\n # If obj is a Delegator then use the object being delegated to for cycle\n # detection\n obj = obj.__getobj__ if defined?(::Delegator) and obj.is_a?(::Delegator)\n\n if check_inspect_key(obj)\n group {obj.pretty_print_cycle self}\n return\n end\n\n begin\n push_inspect_key(obj)\n group {obj.pretty_print self}\n ensure\n pop_inspect_key(obj) unless PP.sharing_detection\n end\n end", "def prettify_found(an_object, found, *args)\n args = args.map { |a| a.inspect }.join(\", \")\n pretty_object = truncate_inspect(an_object, to: 40)\n\n found.map do |key, value|\n pretty_key = if @@infixes.include?(key)\n \"#{pretty_object} #{key} #{args}\"\n elsif @@prefixes.include?(key)\n \"#{key.to_s.sub /\\@$/, \"\"}#{pretty_object}\"\n elsif key == :[]\n \"#{pretty_object}[#{args}]\"\n elsif args != \"\"\n \"#{pretty_object}.#{key}(#{args})\"\n else\n \"#{pretty_object}.#{key}\"\n end\n\n pretty_value = truncate_inspect(value, to: 120)\n\n [pretty_key, pretty_value]\n end\n end", "def log_inspect(object, grep_string = '')\n prefix = grep_string.empty? ? \"\" : \"[#{grep_string}] \"\n self.debug { \"#{prefix} Class=[#{object.class}], Inspect=[#{object.inspect}]\" }\n end", "def dprint(obj)\n self.log_puts(Php4r.print_r(obj, true))\n end", "def puts object = ''\n TetCore.break_after_print\n TetCore.real_puts(object)\nend", "def custom_inspect(object, *ivars_to_skip)\n variables = (object.instance_variables - ivars_to_skip).\n map { |var| \"#{var}=#{object.instance_variable_get(var).inspect}\" }.\n join(', ')\n \"<#{object.class}: #{variables}>\"\n end", "def awesome(object)\n if Thread.current[AD].include?(object.object_id)\n nested(object)\n else\n begin\n Thread.current[AD] << object.object_id\n return eval(%<@formatter.#{declassify(object)}(object)>)\n ensure\n Thread.current[AD].pop\n end\n end\n end", "def print_attributes(object, keys)\n keys.each do |key|\n puts \"#{key}: #{object[key]}\"\n end\n puts \"\\n\"\nend", "def result_to_string(object)\n if object.is_a?(String) then\n return object\n else\n if defined?(awesome_inspect)\n return object.awesome_inspect({:plain=>true, :index=>false})\n elsif defined?(pretty_inspect)\n return object.pretty_inspect.chomp # Remove new line that PrettyInspect adds at the end https://www.ruby-forum.com/topic/113429\n else\n return object.inspect\n end\n end\n end", "def dump(object)\n dumper(object).dump\n end", "def format_object(obj)\n if obj.kind_of? Exception\n return \"Caught #{obj.class}: #{obj.message}\\n\\t\" +\n (obj.backtrace.nil? ? [] : obj.backtrace[0...@depth]).join(\"\\n\\t\")\n elsif obj.kind_of? String\n return obj\n else # inspect the object\n return \"#{obj.class}: #{obj.inspect}\"\n end\n end", "def print(x, objects, printed)\n\n\tif x.class == Page\n\t\tputs \"\\t\"*(x.depth.to_i) + x.to_s\n\t\tprinted.push(x.topic)\n\t\tx.children.each{ |child|\n\t\t\tprint(child, objects, printed)\n\t\t}\n\tend\n\n\tif x.class == Symbol\n\t\ttopic_regex = /title=\"(.*?)\"/\n\t\ttopic_regex.match(x.to_s.gsub!(\" \",\"_\"))\n\t\tthis_topic = $1\n\t\t\n\t\t if objects.include?(this_topic) && !printed.include?(this_topic)\n\t\t\ti = objects.index(this_topic)\n\t\t\tnewX = objects[i]\n\t\t\tprinted.push(newX)\n\t\t\tprint(newX, objects, printed)\n\t\telse\n\t\t\tprinted.push(this_topic)\n\t\t\tputs \"\\t\"*$distance.to_i + this_topic\n\t\tend\n\n\tend\nend", "def pretty_generate(object, opts = {})\n ::JSON.pretty_generate(object, opts)\n end", "def _deep_output(io, obj, depth: 0)\n if obj.is_a? Hash\n obj.each do |k, v|\n io.print ' ' * depth\n io.puts k.to_s\n _deep_output(io, v, depth: depth+1)\n end\n else\n obj.each do |array|\n key = array[0]\n title = _adjust(array[1])\n text = array[2]\n io.print ' ' * depth\n io.print ColorUtils.color(key, title)\n io.print ' '\n io.puts text\n end\n end\n end", "def p object\n TetCore.break_after_print\n TetCore.real_p(object)\nend", "def println obj\n echo(obj.to_s + \"\\n\")\n end", "def checked_print object = ''\n print object\n @prev_printed = true\n end", "def dump(object)\n adapter_dump(object)\n end", "def prettify(obj)\n # Most look best with pretty_inspect\n str = obj.pretty_inspect\n # Mashes need to be first converted to Hashes then pretty_inspect\n if obj.kind_of? Mash\n str = obj.to_hash.pretty_inspect\n end\n # For Arrays, pretty_inspect displays one value per line which\n # uses up too much real estate\n if obj.kind_of? Array\n str = obj.inspect\n end\n # Manually format Hashes so keys and values each display in columns\n if obj.kind_of? Hash\n key_length = 0\n obj.keys.each do |key|\n key_length = key.length if key.length > key_length\n end\n buf = []\n obj.each do |key,value|\n buf << sprintf(\"%-#{key_length}.#{key_length}s => %s\", key, value)\n end\n str = buf.join(\"\\n\")\n end\n str\n end", "def print(*obj)\n each_ios_and_stdout(*obj, &:print)\n nil\n end", "def walk_association(object_string, association, associated_objects)\n begin\n #\n # Assemble some fake code to make it look like we're iterating though associations (plural)\n #\n number_of_associated_objects = associated_objects.length\n if is_plural?(association)\n assignment_string = \"#{object_string}.#{association}.each do |#{association.singularize}|\"\n else\n assignment_string = \"#{association} = #{object_string}.#{association}\"\n end\n print_line($recursion_level, \"#{assignment_string}\")\n associated_objects.each do |associated_object|\n associated_object_class = \"#{associated_object.method_missing(:class)}\".demodulize\n associated_object_id = associated_object.id rescue associated_object.object_id\n print_line($recursion_level, \"(object type: #{associated_object_class}, object ID: #{associated_object_id})\")\n if is_plural?(association)\n walk_object(\"#{association.singularize}\", associated_object)\n if number_of_associated_objects > 1\n print_line($recursion_level,\n \"--- next #{association.singularize} ---\")\n number_of_associated_objects -= 1\n else\n print_line($recursion_level,\n \"--- end of #{object_string}.#{association}.each do |#{association.singularize}| ---\")\n end\n else\n walk_object(\"#{association}\", associated_object)\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (walk_association) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def generate_object(object, title, kind, seed, extra)\n props = select_properties(object.all_user_properties, kind, extra)\n\n extra = {\n project: \"'test project\\##{seed} data'\",\n credential: \"'cred#{seed}'\"\n }.merge(extra)\n\n # Puppet does not like when virtual resources have an ensure property\n extra.delete(:ensure) if object.virtual\n\n [\n \"#{object.out_name} { '#{title}':\",\n @provider.indent_list(\n emit_manifest_block(props, seed, extra, {}), 2, true\n ),\n '}'\n ]\n end", "def make_html_for_object( object )\n\t\t\treturn object.html_inspect if \n\t\t\t\tobject.respond_to?( :html_inspect ) && ! object.is_a?( HtmlInspectableObject )\n\t\t\tobject_html = []\n\n\t\t\tcase object\n\t\t\twhen Hash\n\t\t\t\tobject_html << \"\\n<!-- Hash -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '{}'\n\t\t\t\telse\n\t\t\t\t\tobject_html << HASH_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|k,v|\n\t\t\t\t\t\t\tpairclass = v.instance_variables.empty? ? \n\t\t\t\t\t\t\t\t\"simple-hash-pair\" :\n\t\t\t\t\t\t\t\t\"complex-hash-pair\"\n\t\t\t\t\t\t\tHASH_PAIR_HTML % [\n\t\t\t\t\t\t\t\tpairclass,\n\t\t\t\t\t\t\t\tmake_html_for_object(k),\n\t\t\t\t\t\t\t\tmake_html_for_object(v),\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\twhen Array\n\t\t\t\tobject_html << \"\\n<!-- Array -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '[]'\n\t\t\t\telse\n\t\t\t\t\tobject_html << ARRAY_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|o| make_html_for_object(o) }.join('</li><li>')\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tif object.instance_variables.empty?\n\t\t\t\t\treturn IMMEDIATE_OBJECT_HTML_CONTAINER % \n\t\t\t\t\t\t[ HTMLUtilities.escape_html(object.inspect) ]\n\t\t\t\telse\n\t\t\t\t\tobject_html << make_object_html_wrapper( object )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn object_html.join(\"\\n\")\n\t\tend", "def inspect\n att_info = []\n inspect_attributes.each do |att|\n next unless respond_to? att\n\n att_info << \"#{att}=#{send(att).inspect}\"\n end\n att_info << '..'\n \"\\#<#{self.class}:#{object_id} #{att_info.join(', ')}>\"\n end", "def make_html_for_object( object )\n\t\t\treturn object.html_inspect if \n\t\t\t\tobject.respond_to?( :html_inspect ) && ! object.is_a?( HtmlInspectableObject )\n\t\t\tobject_html = []\n\n\t\t\tcase object\n\t\t\twhen Hash\n\t\t\t\tobject_html << \"\\n<!-- Hash -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '{}'\n\t\t\t\telse\n\t\t\t\t\tobject_html << HASH_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|k,v|\n\t\t\t\t\t\t\tpairclass = v.instance_variables.empty? ? \n\t\t\t\t\t\t\t\t\"simple-hash-pair\" :\n\t\t\t\t\t\t\t\t\"complex-hash-pair\"\n\t\t\t\t\t\t\tHASH_PAIR_HTML % [\n\t\t\t\t\t\t\t\tpairclass,\n\t\t\t\t\t\t\t\tmake_html_for_object(k),\n\t\t\t\t\t\t\t\tmake_html_for_object(v),\n\t\t\t\t\t\t\t ]\n\t\t\t\t\t\t}\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\twhen Array\n\t\t\t\tobject_html << \"\\n<!-- Array -->\\n\"\n\t\t\t\tif object.empty?\n\t\t\t\t\tobject_html << '[]'\n\t\t\t\telse\n\t\t\t\t\tobject_html << ARRAY_HTML_CONTAINER % [\n\t\t\t\t\t\tobject.collect {|o| make_html_for_object(o) }.join('</li><li>')\n\t\t\t\t\t]\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tif object.instance_variables.empty?\n\t\t\t\t\treturn IMMEDIATE_OBJECT_HTML_CONTAINER %\n\t\t\t\t\t\t[ HTMLUtilities.escape_html(object.inspect) ]\n\t\t\t\telse\n\t\t\t\t\tobject_html << make_object_html_wrapper( object )\n\t\t\t\tend\n\t\t\tend\n\n\t\t\treturn object_html.join(\"\\n\")\n\t\tend", "def _dump level\n object_id.to_s\n end", "def dump(object)\n raise NotImplementedError, \"#{self.class}#dump is not implemented\"\n end", "def render(obj)\n # We can't use a case statement here becuase \"when Hash\" doesn't work for\n # ActiveSupport::OrderedHash - respond_to?(:values) is a more reliable\n # indicator of hash-like behavior.\n if NilClass === obj\n print(\"null\")\n \n elsif TrueClass === obj\n print(\"true\")\n \n elsif FalseClass === obj\n print(\"false\")\n \n elsif String === obj\n print(escape_json_string(obj))\n \n elsif Symbol === obj\n print(\"\\\"#{obj}\\\"\")\n \n elsif Numeric === obj\n print(obj.to_s)\n \n elsif Time === obj\n print(obj.to_s)\n \n elsif obj.respond_to?(:keys)\n print(\"{\")\n indent_out\n last_key = obj.keys.last\n obj.each do |(key, val)|\n render(key)\n case val\n when Hash, Array\n indent_out\n print(\":\\n#{indent}\")\n render(val)\n indent_in\n else\n print(\": \")\n render(val)\n end\n print(\",\\n#{indent}\") unless key == last_key\n end\n indent_in\n print(\"}\")\n \n elsif Array === obj\n print(\"[\")\n indent_out\n last_index = obj.size - 1\n obj.each_with_index do |elem, index|\n render(elem)\n print(\",\\n#{indent}\") unless index == last_index\n end\n indent_in\n print(\"]\")\n \n else\n raise \"unrenderable object: #{obj.inspect}\"\n end\n end", "def print_relation(object, threshold = '')\n out = ''\n if object.to.is_a?(Array)\n object.to.each do |o|\n out << print_datastructure(o, threshold)\n end\n else\n out << object.to.to_s\n end\n out\n end", "def print_virtual_columns(object_string, this_object, this_object_class)\n begin\n #\n # Only dump the virtual columns of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n #\n # Print the virtual columns of this object \n #\n virtual_column_names = []\n if this_object.respond_to?(:virtual_column_names)\n virtual_column_names = Array.wrap(this_object.virtual_column_names)\n if virtual_column_names.length.zero?\n print_line($recursion_level, \"--- no virtual columns ---\")\n else\n print_line($recursion_level, \"--- virtual columns follow ---\")\n virtual_column_names.sort.each do |virtual_column_name|\n begin\n virtual_column_value = this_object.method_missing(:send, virtual_column_name)\n if virtual_column_value.nil?\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = nil\") if $print_nil_values\n else\n print_line($recursion_level,\n \"#{object_string}.#{virtual_column_name} = \" \\\n \"#{virtual_column_value} #{type(virtual_column_value)}\")\n end\n rescue NoMethodError\n print_line($recursion_level,\n \"*** #{this_object_class} virtual column: \\'#{virtual_column_name}\\' \" \\\n \"gives a NoMethodError when accessed (product bug?) ***\")\n end\n end\n print_line($recursion_level, \"--- end of virtual columns ---\")\n end\n else\n print_line($recursion_level, \"--- no virtual columns ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_virtual_columns) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def ru_debug(object)\n begin\n \"<pre class='debug_dump'>#{object.to_yaml}</pre> <p><em>Raw dump</em></p>\".html_safe\n rescue Exception => e # errors from Marshal or YAML\n # Object couldn't be dumped, perhaps because of singleton methods -- this is the fallback\n \"<code class='debug_dump'>#{object.inspect}</code>\".html_safe\n end\n end", "def print_methods(object_string, this_object)\n begin\n #\n # Only dump the methods of an MiqAeMethodService::* class\n #\n if this_object.method_missing(:class).to_s =~ /^MiqAeMethodService.*/\n print_line($recursion_level,\n \"Class of remote DRb::DRbObject is: #{this_object.method_missing(:class)}\") if $debug\n #\n # Get the instance methods of the class and convert to string\n #\n if this_object.method_missing(:class).respond_to?(:instance_methods)\n instance_methods = this_object.method_missing(:class).instance_methods.map { |x| x.to_s }\n #\n # Now we need to remove method names that we're not interested in...\n #\n # ...attribute names...\n #\n attributes = []\n if this_object.respond_to?(:attributes)\n if this_object.attributes.respond_to? :each\n this_object.attributes.each do |key, value|\n attributes << key\n end\n end\n end\n attributes << \"attributes\"\n $evm.log(\"info\", \"Removing attributes: #{instance_methods & attributes}\") if $debug\n instance_methods -= attributes\n #\n # ...association names...\n #\n associations = []\n if this_object.respond_to?(:associations)\n associations = Array.wrap(this_object.associations)\n end\n associations << \"associations\"\n $evm.log(\"info\", \"Removing associations: #{instance_methods & associations}\") if $debug\n instance_methods -= associations\n #\n # ...virtual column names...\n #\n virtual_column_names = []\n virtual_column_names = this_object.method_missing(:virtual_column_names)\n virtual_column_names << \"virtual_column_names\"\n $evm.log(\"info\", \"Removing virtual_column_names: #{instance_methods & virtual_column_names}\") if $debug\n instance_methods -= virtual_column_names\n #\n # ... MiqAeServiceModelBase methods ...\n #\n $evm.log(\"info\", \"Removing MiqAeServiceModelBase methods: \" \\\n \"#{instance_methods & $service_mode_base_instance_methods}\") if $debug\n instance_methods -= $service_mode_base_instance_methods\n #\n # Add in the base methods as it's useful to show that they can be used with this object\n #\n instance_methods += ['inspect', 'inspect_all', 'reload', 'model_suffix']\n if this_object.respond_to?(:taggable?)\n if this_object.taggable?\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n else\n instance_methods += ['tags', 'tag_assign', 'tag_unassign', 'tagged_with?']\n end\n #\n # and finally dump out the list\n #\n if instance_methods.length.zero?\n print_line($recursion_level, \"--- no methods ---\")\n else\n print_line($recursion_level, \"--- methods follow ---\")\n instance_methods.sort.each do |instance_method|\n print_line($recursion_level, \"#{object_string}.#{instance_method}\")\n end\n print_line($recursion_level, \"--- end of methods ---\")\n end\n else\n print_line($recursion_level, \"--- no methods ---\")\n end\n end\n rescue => err\n $evm.log(\"error\", \"#{$method} (print_methods) - [#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n end\nend", "def p(obj)\n @contents << obj.inspect << \"\\n\"\n end", "def output object\n STDOUT.puts \"#{object}\"\n end", "def dump_tags(object)\n return if object.tags.nil?\n\n $evm.log(\"info\", \" Begin Tags [object.tags]\")\n object.tags.sort.each do |tag_element|\n tag_text = tag_element.split('/')\n $evm.log(\"info\", \" Category:<#{tag_text.first.inspect}> Tag:<#{tag_text.last.inspect}>\")\n end\n $evm.log(\"info\", \" End Tags [object.tags]\")\n $evm.log(\"info\", \"\")\nend", "def dumper(object)\n Dumper.new(object)\n end", "def safe_dump_recurse(object, limit = @limit, objects = default_objects)\n\t\t\t\tif limit <= 0 || objects[object]\n\t\t\t\t\treturn replacement_for(object)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tcase object\n\t\t\t\twhen Hash\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\tobject.to_h do |key, value|\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\tString(key).encode(@encoding, invalid: :replace, undef: :replace),\n\t\t\t\t\t\t\tsafe_dump_recurse(value, limit - 1, objects)\n\t\t\t\t\t\t]\n\t\t\t\t\tend\n\t\t\t\twhen Array\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\tobject.map do |value|\n\t\t\t\t\t\tsafe_dump_recurse(value, limit - 1, objects)\n\t\t\t\t\tend\n\t\t\t\twhen String\n\t\t\t\t\tobject.encode(@encoding, invalid: :replace, undef: :replace)\n\t\t\t\twhen Numeric, TrueClass, FalseClass, NilClass\n\t\t\t\t\tobject\n\t\t\t\telse\n\t\t\t\t\tobjects[object] = true\n\t\t\t\t\t\n\t\t\t\t\t# We could do something like this but the chance `as_json` will blow up.\n\t\t\t\t\t# We'd need to be extremely careful about it.\n\t\t\t\t\t# if object.respond_to?(:as_json)\n\t\t\t\t\t# \tsafe_dump_recurse(object.as_json, limit - 1, objects)\n\t\t\t\t\t# else\n\t\t\t\t\t\n\t\t\t\t\tsafe_dump_recurse(object.to_s, limit - 1, objects)\n\t\t\t\tend\n\t\t\tend", "def display_string(options, object, length = nil)\n \":#{object}\"\n end", "def dump(object)\n raise NotImplementedError, \"#{self.class} must implement #dump\"\n end", "def insp(obj)\n if block_given? then\n yield obj\n else\n p obj\n end\n obj\n end", "def insp(obj)\n if block_given? then\n yield obj\n else\n p obj\n end\n obj\n end", "def dump(object)\n if droby_id = context_objects[object]\n droby_id\n elsif object.respond_to?(:droby_dump)\n if sibling = object_manager.registered_sibling_on(object, peer_id)\n RemoteDRobyID.new(peer_id, sibling)\n else\n object.droby_dump(self)\n end\n else\n object\n end\n end", "def tree(object, locals = {})\n locals = {\n depth: [],\n }.merge(locals)\n\n if locals[:depth].size > @options[:drop]\n if object == object.parent.children.last\n prefix_char = @options[:edge_char]\n else\n prefix_char = @options[:connect_char]\n end\n else\n prefix_char = \"\"\n end\n\n indents = locals[:depth].each.with_index.collect {|e, i|\n if i > @options[:drop]\n tab = e ? @options[:tab_visible_char] : \"\"\n tab.toeuc.ljust(@options[:tab_space]).toutf8\n end\n }.join\n\n if @block\n label = @block.call(object, locals)\n else\n if locals[:depth].empty? && @options[:root_label] # Change if there is root and alternative label\n label = @options[:root_label]\n else\n label = TreeSupport.node_name(object)\n end\n end\n\n buffer = \"\"\n branch_char = nil\n\n if locals[:depth].size > @options[:drop]\n branch_char = @options[:branch_char]\n end\n if locals[:depth].size < @options[:take]\n if locals[:depth].size >= @options[:drop]\n buffer = \"#{indents}#{prefix_char}#{branch_char}#{label}#{@options[:debug] ? locals[:depth].inspect : \"\"}\\n\"\n end\n end\n\n flag = false\n if object.parent\n flag = (object != object.parent.children.last)\n end\n\n locals[:depth].push(flag)\n if locals[:depth].size < @options[:take]\n buffer << object.children.collect {|node| tree(node, locals)}.join\n end\n locals[:depth].pop\n\n buffer\n end", "def kit_to_console(kit, indent_level=0)\n unless kit.is_a?(Kit)\n raise ArgumentError.new \"Passed a different object into a Kit presenter\"\n end\n\n # Print the first 3 fields before families.\n [:id, :name, :domains].each do |attr| \n indented_puts \"#{attr.to_s}: #{kit.send(attr)}\", indent_level \n end\n\n # Families have to be handled specially.\n indented_puts \"families:\", indent_level\n kit.families.each_with_index do |f, index|\n indented_puts \"family ##{index + 1}:\", indent_level + 1\n font_family_to_console(f, indent_level + 2)\n end\n\n # Print the remaining field.\n indented_puts \"optimize_performance: #{kit.optimize_performance}\", indent_level\n end", "def inspect() \"~#{@obj.inspect}~\" ; end", "def print_json_obj\n \n end", "def dump(object)\n internal = ::Riak::Serializers.serialize(content_type, object)\n encrypt(internal)\n end", "def dump(depth = 0)\n attr = ''\n @attr.each do |a| ## self.attributes do |a|\n attr += a.to_s + \", \"\n end if @attr\n attr.chop!\n attr.chop!\n print ' ' * depth * 2\n print \"#{@name}(#{attr})\\n\"\n @children.each do |child|\n child.dump(depth + 1)\n end if @children\n end", "def print_item(level:, current_item:)\n # Print the current item\n tabs = \"\\t\" * level\n puts tabs + '+ ' + current_item[:name]\n\n # Print the current item's children\n children = $children_of[current_item[:id]]\n if children && children.length > 0\n children.each do |child|\n print_item(\n level: level + 1, \n current_item: child\n )\n end\n end\nend", "def awesome_self(object, type)\n if @options[:raw] && object.instance_variables.any?\n awesome_object(object)\n else\n colorize(object.inspect.to_s, type)\n end\n end", "def inspect(indent=\"\")\n result = \"\"\n result << indent\n result << self.class.to_s.sub(/.*:/,'')\n result << \" #{to_s} \" unless self.is_a?(Language::Tree) || self.is_a?(Language::Loop)\n \n unless elements.empty?\n result << \":\"\n elements.each do |e|\n result << \"\\n#{e.inspect(indent+\" \")}\" rescue \"\\n#{indent} #{e.inspect}\"\n end\n end\n \n result\n end", "def printable_with_mongoid(object)\n \n printable = printable_without_mongoid(object)\n if printable == :self\n if object.respond_to?(:fields)\n printable = :mongoid_instance\n end\n elsif printable == :class and !object.respond_to?(:to_model)\n printable = :mongoid_class\n end\n printable\n end", "def deep_stringify(object)\n case object\n when Hash\n object.each_with_object({}) do |(key, value), result|\n result[key.to_s] = deep_stringify(value)\n end\n when Array\n object.map { |e| deep_stringify(e) }\n when Symbol\n object.to_s\n else\n object\n end\n end", "def parse object:, path: \"\"\n return if visited.has_key? object\n \n case object\n when Array\n object.each do |value|\n parse object: value, path: path\n end\n when Hash\n parse object: object.values, path: path\n when String\n current = objects[object]\n \n return if current.nil? || current[Keys::ISA].nil?\n \n path += '/' + current[Keys::ISA] + Helpers.resolve_attributes(object, objects)\n \n visited[object] = path\n \n parse object: current, path: path\n end\n end", "def dumper(object)\n dumper_class.new(self, object)\n end", "def to_json(object, context = CoderContext.new)\n context = CoderContext.new(context) if context.is_a?(Hash)\n Dumper.to_json(object, context)\n end", "def inspect(indent=\"\")\n em = extension_modules\n interesting_methods = self.interesting_methods\n im = interesting_methods.size > 0 ? \" (#{interesting_methods.join(\",\")})\" : \"\"\n tv = text_value\n tv = \"...#{tv[-20..-1]}\" if tv.size > 20\n\n indent +\n self.class.to_s.sub(/.*:/,'') +\n em.map{|m| \"+\"+m.to_s.sub(/.*:/,'')}*\"\" +\n \" offset=#{interval.first}\" +\n \", #{tv.inspect}\" +\n im + \" [#{terminal?}]\" +\n (elements && elements.size > 0 ?\n \":\" +\n (@elements||[]).map{|e|\n begin\n \"\\n\"+e.inspect(indent+\" \")\n rescue # Defend against inspect not taking a parameter\n \"\\n\"+indent+\" \"+e.inspect\n end\n }.join(\"\") :\n \"\"\n )\n end", "def print_hash(header_string, object_hash)\n puts header_string\n puts \"=\" * header_string.length\n object_hash.each_pair do |key, values|\n next if values.empty?\n puts \"- #{key}\"\n values.each { |value| puts \" - #{value}\" }\n end\n end", "def inspect\n return 'nil' if @obj.nil?\n\n \"#<#{self.class.name}:#{fullName}>\"\n end", "def puts (obj)\n #STDOUT.puts @output_redirect_lambda.inspect\n if @output_redirect_lambda.nil?\n STDOUT.print obj.to_s + \"\\n\"\n else\n @output_redirect_lambda.call obj unless @output_redirect_lambda.nil?\n end\n end", "def inspect\n @_inspect ||= begin\n \"#<\" <<\n self.class.inspect <<\n (\":0x%014x\" % object_id) <<\n \">\"\n end\n end", "def pretty_inspect\n self.inspect\n end", "def find_dump(file, timestamp=nil, tempfile=nil)\n found_timestamp = false\n dump_start = 0\n id = nil\n version = nil\n file.seek(0)\n file.each do |line|\n match = @object_walker_start_re.match(line)\n if match\n id = match[:id]\n version = match[:version]\n unless timestamp.nil?\n if timestamp == match[:timestamp]\n dump_start = file.pos - line.length\n found_timestamp = true\n break\n end\n end\n #\n # Default is to dump the last object_walker run\n #\n dump_start = file.pos - line.length\n end\n end\n unless timestamp.nil?\n unless found_timestamp\n raise \"Timestamp: #{timestamp} not found in log file\"\n end\n end\n #\n # Now rewind to the specified dump output and print the object_walker dump\n #\n file.seek(dump_start)\n indent_level = 0\n debug_output = false\n file.each do |line|\n #\n # A rails logger debug line might add many lines of output to automation.log\n # and we need to ignore this\n #\n debug_output = true if @debug_line_re.match(line)\n debug_output = false if @non_debug_line_re.match(line)\n \n match = @object_walker_start_re.match(line)\n if match\n if match[:id] == id\n if tempfile.nil?\n puts \"#{match[:output]}\"\n else\n tempfile.write(\"#{match[:output]}\\n\")\n end\n end\n next\n end\n match = @object_walker_body_re.match(line)\n if match\n if match[:continuation_line] && !debug_output\n unless line =~ /^\\/.*\\d+:in .*$/ # ignore stack trace lines\n if tempfile.nil?\n puts \"#{indent_level_to_string(indent_level)}#{line}\"\n else\n tempfile.write(\"#{indent_level_to_string(indent_level)}#{line}\\n\")\n end\n end\n elsif match[:id] == id\n if match[:indent_level]\n indent_level = match[:indent_level]\n end\n if tempfile.nil?\n puts \"#{indent_level_to_string(indent_level)}#{match[:output]}\"\n else\n tempfile.write(\"#{indent_level_to_string(indent_level)}#{match[:output]}\\n\")\n end\n end\n next\n end\n match = @object_walker_end_re.match(line)\n if match\n if match[:id] == id\n if tempfile.nil?\n puts \"#{match[:output]}\"\n else\n tempfile.write(\"#{match[:output]}\\n\")\n end\n break\n end\n end\n end\nend", "def traverse obj=self, &block\n case\n when obj.respond_to?(:parent?) && obj.respond_to?(:child?)\n block.call obj\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:parent?)\n obj.children.each { |c| traverse(c, &block) }\n when obj.respond_to?(:child?)\n block.call obj\n end\n end", "def indented_puts(string, indent_level)\n puts \"#{INDENT * indent_level}#{string}\"\n end", "def write_object object\n\t\t\t\t@output.puts object.to_json\n\t\t\t\t@output.flush\n\t\t\tend", "def dump(depth = 0)\n print ' ' * depth * 2\n print \"// #{self.to_s}\\n\"\n end", "def dump_associations(my_object, my_object_name)\n if my_object.respond_to?(\"associations\")\n self.log(@dump_log_level, \"Begin #{my_object_name}.associations\")\n my_object.associations.sort.each { |a| self.log(:info, \"#{my_object_name} Association - #{a}\")}\n self.log(@dump_log_level, \"End #{my_object_name}.associations\")\n self.log(@dump_log_level, \"\")\n else\n self.log(@dump_log_level, \"No associations for #{my_object_name}\")\n end\n end", "def ap(object, **options)\n AwesomePrint\n Kernel.ap(object, options)\n end", "def dump(object, options={})\n ::Oj.dump(object, options)\n end", "def dump(object, options={})\n ::Oj.dump(object, options)\n end", "def dump(object)\n JsonDocument.new(@config, object).encrypt\n end", "def generate_print (node)\n\tchild = node.children[0]\n\n\t# string symbol\n\tif child.symbol != nil and child.symbol.type == \"string\"\n\t\t\tputs \"Generating a nice print with a string symbol...\"\n\n\t\tldx(\"02\")\n\t\tldy($static_table.get(child.symbol).address)\n\t\tsys\n\t# normal string\n\telsif child.token != nil and child.token.type == \"T_STRING\" and child.symbol == nil\n\t\t\tputs \"Generating a nice print with a string...\"\n\n\t\taddress = $code.add_string(child.name)\n\t\tlda(hex_converter(address, 2))\n\t\tsta\n\t\tldx(\"02\")\n\t\tldy\n\t\tsys\n\telse\n\t\tputs \"Generating a nice print with a non-string...\"\n\n\t\tgenerate(child)\n\t\tldx(\"01\")\n\t\tsta\n\t\tldy\n\t\tsys\n\t\t\n\tend\n\nend", "def print_attribute(*) end", "def walkthrough_test( object)\r\n\t counter=4\r\n\t i,j =0\r\n\t \r\n\t # This Two Loops run the intire nested hash Array along\r\n\t # Ignores all fields which are empty\r\n\t # The loop goes for each position there an object through four Methods\r\n\t # The Methods returns a number of found objects in a same line\r\n\t while i < 8\r\n\t j=0\r\n\t while j < 8\r\n\t \r\n\t if @nha2[i][j] != nil\r\n\t if @nha2[i][j] == object\r\n\t\r\n\t ru1= walkhigh(i,j,object) \r\n\t if ru1==0\r\n\t # puts \"WINNER1\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru2 = walkright(i,j,object)\r\n\t if ru2==0\r\n\t # puts \"WINNER2\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru3 = walkleft_down(i,j,object)\r\n\t if ru3==0\r\n\t # puts \"WINNER3\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t \r\n\t ru4 = walkright_down(i,j,object)\r\n\t if ru4==0\r\n\t # puts \"WINNER4\"\r\n\t return true\r\n\t break\r\n\t end\r\n\t end\r\n\t end \r\n\t j+=1\r\n\t end \r\n\t i+=1 \r\n\t end\r\n end", "def inspect(max: 256)\n items = Array.wrap(object).map(&:class)\n items = items.tally.map { |cls, cnt| \"#{cnt} #{cls}\" }.presence\n items = items&.join(' / ') || 'empty'\n vars =\n instance_variables.excluding(:@object).map { |var|\n [var, instance_variable_get(var).inspect.truncate(max)]\n }.to_h\n vars = vars.merge!('@object': \"(#{items})\").map { |k, v| \"#{k}=#{v}\" }\n \"#<#{self.class.name}:#{object_id} %s>\" % vars.join(' ')\n end", "def inspect\n \"#<#{self.class.name}:0x#{object_id}\\n @base_url=\\\"#{@base_url}\\\"\\n @most_recent_page=#{@most_recent_page}>\"\n end", "def property_work(object_name, options={})\n options = {:blank => '---'}.merge(options).symbolize_keys\n object = if object_name.is_a?(String) || object_name.is_a?(Symbol)\n instance_variable_get(\"@#{object_name}\")\n else\n object_name\n end\n components = []\n \n # personal status\n components << link_to(object.personal_status.name, \n tag_url([Person], Tag.new(:name => object.personal_status.name))) if object.personal_status\n\n # professional title \n components << object.profession_taggings.map {|t| link_to(t.name ? t.name : t.tag.name, \n tag_url([Person], t.tag))}.to_sentence.strip_period\n \n if !object.professional_title.blank? && !object.organizations.empty?\n components << \"working as %{title} at %{name}\".t % {\n :title => object.professional_title_taggings.map {|t| link_to(t.name ? t.name : t.tag.name, tag_url([Person], t.tag))}.to_sentence.strip_period,\n :name => object.organizations.map {|o| link_to(o.name, tier_root_url(o))}.to_sentence.strip_period\n }\n elsif !object.professional_title.blank? && object.organizations.empty?\n components << \"working as %{title}\".t % {\n :title => object.professional_title_taggings.map {|t| link_to(t.name ? t.name : t.tag.name, tag_url([Person], t.tag))}.to_sentence.strip_period\n }\n elsif object.professional_title.blank? && !object.organizations.empty?\n components << \"working at %{name}\".t % {\n :name => object.organizations.map {|o| link_to(o.name, tier_root_url(o))}.to_sentence.strip_period\n }\n end\n components << \"in the field of %{industry}\" % {\n :industry => object.industry_taggings.map {|t| link_to(t.name ? t.name : t.tag.name, tag_url([Person], t.tag))}.to_sentence.strip_period\n } unless object.industry.blank?\n components.reject! {|c| c.blank?}\n components.empty? ? options[:blank] : components.join(' ')\n end", "def format(printer, object)\n buffer = new_buffer\n printer.run(Output.new(tty, buffer), object)\n buffer.rewind\n buffer.read\n end", "def object_attrs_for_draft_record(object = nil)\n object ||= self\n\n attrs = object.attributes.except(*self.class.draftsman_options[:skip]).tap do |attributes|\n self.class.serialize_attributes_for_draftsman(attributes)\n end\n\n if self.class.draft_class.object_col_is_json?\n attrs\n else\n Draftsman.serializer.dump(attrs)\n end\n end" ]
[ "0.7560727", "0.7017619", "0.6732748", "0.6185369", "0.609328", "0.6090988", "0.58785987", "0.584458", "0.57857746", "0.57305235", "0.5726411", "0.5608725", "0.5607093", "0.55077946", "0.5441575", "0.5428698", "0.54253703", "0.5412108", "0.5394367", "0.53773934", "0.53701174", "0.5368648", "0.53560454", "0.5337946", "0.53062654", "0.5304787", "0.5275993", "0.5270671", "0.52701557", "0.52456045", "0.5242842", "0.52396363", "0.52325076", "0.52114964", "0.519755", "0.5184074", "0.5173917", "0.51528645", "0.51497453", "0.51488453", "0.5146499", "0.51445067", "0.51308405", "0.5127514", "0.5126291", "0.5112733", "0.51099175", "0.5088325", "0.50718516", "0.5049397", "0.5038866", "0.5038036", "0.5031101", "0.50231713", "0.50197625", "0.50006914", "0.4985053", "0.49829686", "0.49795604", "0.4972645", "0.4972645", "0.4925617", "0.49058872", "0.4874904", "0.48619607", "0.4860894", "0.48588777", "0.48533303", "0.48499835", "0.4841189", "0.4827765", "0.4812445", "0.478268", "0.4776754", "0.47627074", "0.47605184", "0.4758098", "0.47377694", "0.47363204", "0.47351444", "0.4732891", "0.4731335", "0.47137347", "0.4704464", "0.47040433", "0.46879038", "0.46696642", "0.46688634", "0.46621627", "0.46605155", "0.46605155", "0.46539122", "0.46521026", "0.46480662", "0.4644814", "0.46392804", "0.46387622", "0.46321332", "0.46304306", "0.46300015" ]
0.7258275
1
http_basic_authenticate_with name: ENV["USERNAME"], password: ENV["PASSWORD"], except: [:index, :show, :update_score, :custom, :add_to_custom]
def index @game = Game.new(0,0) @users = User.all session[:republican_default] ||= User.find_by(name: "Donald J. Trump").name session[:democrat_default] ||= User.find_by(name: "Hillary Clinton").name session[:jerseyshore_default] ||= User.find_by(name: "DJ Pauly D").name render 'home/index' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_with_http_basic\n nil\n end", "def http_basic_authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"mustang\" && password == 'mustang' #\"must@ngs0undm3l0n\"\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic(\"Fun!\") do |username, password|\n username == ENV[\"FUN_ADMIN_USER\"] && password == ENV[\"FUN_ADMIN_PASS\"]\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == ENV['USERNAMEV'] && password == ENV['PASSWORDV'] \n end \n end", "def require_http_basic_auth\n if APP_CONFIG['perform_authentication']\n authenticate_or_request_with_http_basic do |login, password|\n login==APP_CONFIG['username'] and password == APP_CONFIG['password']\n end\n end\n end", "def login_using_basic_auth\n @request.env['HTTP_AUTHENTICATION'] = ActionController::HttpAuthentication::Basic.encode_credntials(\"\", \"\")\nend", "def authenticate_with_basic_auth\n name, token = ActionController::HttpAuthentication::Basic.user_name_and_password(request)\n @api_client = ApiClient.find_by(name: name)\n\n render(json: { errors: [{ detail: \"Access Denied\" }] }, status: 401) unless valid_key(token)\n end", "def basic_auth\n authenticate_or_request_with_http_basic do |username, password|\n username == Rails.application.credentials.basic[:username] && \n password == Rails.application.credentials.basic[:password]\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end", "def login_from_basic_auth\nauthenticate_with_http_basic do |username, password|\nself.current_user = User.authenticate(username, password)\nend\nend", "def authenticate\n authenticate_or_request_with_http_basic do |user_name, password|\n # Change these to username and password required\n user_name == \"shitlister\" && password == \"letmein\"\n end\n end", "def authenticate_user_with_basic_auth!\n @username, @password = ActionController::HttpAuthentication::Basic::user_name_and_password(request)\n\n request_http_basic_authentication(ENV[\"REALM\"], \"An Authentication object was not found in the SecurityContext\") if @username.blank? || @password.blank?\n end", "def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\" && password == \"we8vds\"\n end\nend", "def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def http_basic_authorize!(realm, username, password)\n auth = Rack::Auth::Basic::Request.new(request.env)\n unless auth.provided? && auth.basic? && auth.credentials &&\n auth.credentials == [username, password]\n response['WWW-Authenticate'] = %(Basic realm=\"#{realm}\")\n request.halt(401)\n end\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"admin\" && password == \"123\"\n end\n end", "def http_basic_authorize!(realm, username, password)\n auth = Rack::Auth::Basic::Request.new(request.env)\n unless auth.provided? && auth.basic? && auth.credentials &&\n auth.credentials == [username, password]\n response['WWW-Authenticate'] = %(Basic realm=\"#{realm}\")\n throw(:halt, 401)\n end\n end", "def basic_auth(*args, &block); end", "def basic_auth(opts); end", "def basic_auth(username, password)\n @basic_auth = {:username => username, :password => password}\n end", "def basic_auth!(user = :username, pass = :password)\n @authenticates = :basic_auth\n @credentials = [user, pass]\n end", "def require_basic_auth_maybe\n if Rails.env.staging?\n authenticate_or_request_with_http_basic do |user, password|\n user == \"mamajamas\" && (password == \"mamab1rd\" || password == \"welcome\")\n end\n end\n end", "def authenticate\n\t\t \tauthenticate_basic_auth || render_unauthorized\n\t\t \tend", "def http_login(username, password)\n @request.env['HTTP_AUTHORIZATION'] = \"Basic #{Base64.encode64(username << ':' << password)}\"\n end", "def admin_auth\n authenticate_or_request_with_http_basic do |username, password|\n username == \"ga\" && password == \"ga\"\n end\n end", "def basic_auth(username, password)\n @basic_auth = [username, password]\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n (user = User.find_by_name(username)) != nil \\\n && user.password == Digest::SHA1.hexdigest(password)\n end\n end", "def authenticate!(request)\n if @username and @password \n request.basic_auth @username, @password\n end\n end", "def require_http_auth\n if `hostname` =~ /soykaf|lanpartei/i \n if auth = APP_CONFIG['http_auth']\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == auth['name'] && password == auth['password']\n end \n end\n end\n end", "def authenticate_on_production\n return if Rails.env.development? || Rails.env.test?\n authenticate_or_request_with_http_basic do |username, password|\n username == \"crowdscore\" && password == \"denver\"\n end\n end", "def authenticate_user\n if Rails.env.production?\n authenticate_or_request_with_http_basic do |username, password|\n username == \"admin\" && password == Wordpressed.password\n end\n end\n #warden.custom_failure! if performed?\n end", "def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end", "def basic_auth(username:, password:, realm: 'Instrumentation')\n authenticate_or_request_with_http_basic(realm) \\\n do |given_name, given_password|\n ActiveSupport::SecurityUtils.secure_compare(given_name, username) &\n ActiveSupport::SecurityUtils.secure_compare(\n given_password, password\n )\n end\n end", "def basicauth_enabled?\n true\n end", "def authenticate\n authenticate_or_request_with_http_basic do |name, password|\n name == \"blogmaster\" && password == \"senha\"\n end\n end", "def authenticate\n if defined?(APPWALL_USERNAME)\n authenticate_or_request_with_http_basic do |username, password|\n !(APPWALL_USERNAME.blank?) && username == APPWALL_USERNAME && \n Digest::MD5.hexdigest(password) == APPWALL_PASSWORD_HASH\n end\n end\n end", "def authenticate\n if defined?(APPWALL_USERNAME)\n authenticate_or_request_with_http_basic do |username, password|\n !(APPWALL_USERNAME.blank?) && username == APPWALL_USERNAME && \n Digest::MD5.hexdigest(password) == APPWALL_PASSWORD_HASH\n end\n end\n end", "def restrict_basic_auth\n request.env['HTTP_AUTHORIZATION'] = '' unless request.format.symbol.eql?(:json) || request.format.symbol.eql?(:xml)\n end", "def authenticate_user(request)\n @log.info(\"Authentication user #{@username}\")\n request.basic_auth(@username, @password)\nend", "def authorize_api!\n http_basic_authorize!('API', api_username, api_password)\n end", "def authorize_api!\n http_basic_authorize!('API', api_username, api_password)\n end", "def auth\n {:basic_auth => {:username => id, :password => password}}\n end", "def login_from_basic_auth\n authenticate_with_http_basic do |login, password|\n self.current_user = User.authenticate(login, password)\n end\n end", "def login_from_basic_auth\n authenticate_with_http_basic do |login, password|\n self.current_user = User.authenticate(login, password)\n end\n end", "def check_basic_auth_request\n tracker.find_call(:target => nil, :method => :authenticate_or_request_with_http_basic).each do |result|\n if include_password_literal? result\n warn :result => result,\n :code => @include_password,\n :warning_type => \"Basic Auth\",\n :warning_code => :basic_auth_password,\n :message => \"Basic authentication password stored in source code\",\n :confidence => :high\n end\n end\n end", "def http_authenticate\n if Rails.env.staging?\n authenticate_or_request_with_http_basic do |username, password|\n (username == Brevidy::Application::HTTP_AUTH_USERNAME && password == Brevidy::Application::HTTP_AUTH_PASSWORD) ||\n (username == Brevidy::Application::HTTP_AUTH_ZEN_USERNAME && password == Brevidy::Application::HTTP_AUTH_ZEN_PASSWORD)\n end\n end\n end", "def bounce_to_http_basic()\n unless current_user\n request_http_basic_authentication\n return\n end\n\n respond_to do |format|\n format.html do\n render 'session/forbidden', layout: false, status: :forbidden\n end\n format.json do\n render json: { error: \"You're not allowed to access that\" }\n end\n end\n end", "def basic_auth\n {\n username: @username,\n password: @password\n }\n end", "def authenticate\n env = Figaro.env\n\n head :unauthorized unless auth_configured?(env)\n\n authenticate_or_request_with_http_basic do |username, password|\n # This comparison uses & so that it doesn't short circuit and\n # uses `secure_compare` so that length information\n # isn't leaked.\n ActiveSupport::SecurityUtils.secure_compare(\n username, env.twilio_http_basic_auth_username\n ) & ActiveSupport::SecurityUtils.secure_compare(\n password, env.twilio_http_basic_auth_password\n )\n end\n end", "def authenticate\n case request.format\n when Mime::XML, Mime::JSON\n unless logged_in? && admin?\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == USER_NAME && password == PASSWORD\n end\n end\n else\n render_404 and return unless logged_in? && admin?\n end\n end", "def authenticate_using_http_basic\n return if current_user\n authenticate_with_http_basic do |email, password|\n signin = Session.new email: email, password: password\n auth = User.authenticate_signin signin\n self.current_user = auth unless auth.kind_of? Symbol\n end\n end", "def none_authenticate\n authenticate_or_request_with_http_basic \"Raptor\" do |user_name, password|\n logger.debug(\"none_authenticate as #{user_name}\")\n common_authenticate(user_name)\n return true\n end\n return false\n end", "def authorize_basic!(*roles)\n\treturn if @user and @user.authorize(roles)\n\n\tauth ||= Rack::Auth::Basic::Request.new(request.env)\n\tif auth.provided? and auth.basic? and auth.credentials\n\t\tif @user = User.first(:username => auth.username)\n\t\t\tif @user.password == auth.credentials[1] and @user.authorize(roles)\n\t\t\t\treturn\n\t\t\tend\n\t\tend\n\tend\n\n\thalt 403\nend", "def basic_authentication usr, pwd\n\t\t#str = Base64.encode64(\"#{usr}:#{pwd}\")\n\t\t#str = \"Basic #{str}\"\n \n\t\t#@request_headers[\"Authorization\"]= str\n @request_headers[\"Authorization\"]= 'Basic ' + [\"#{usr}:#{pwd}\"].pack('m').delete(\"\\r\\n\")\n\tend", "def authenticate\n authenticate_or_request_with_http_basic do |name, password|\n if m=Member.find_by_name(name) \n if (m.authenticate(password) && m.role == \"administrator\")\n\t\t true\n\t\telse\n\t\t false\n\t\tend\n else\n false\n end\n end\n\tname=\"\"\n\tpassword=\"\"\n end", "def authenticate_if_needed\n # Disable this extra authentication in test mode\n return true if Rails.env.test?\n if (is_hidden || is_staging) && !is_api_or_pdf\n authenticate_or_request_with_http_basic do |username, password|\n username == \"samvera\" && password == \"hyku\"\n end\n end\n end", "def login_from_basic_auth\n authenticate_with_http_basic do |username, password|\n self.current_user = User.authenticate(username, password)\n end\n end", "def login_from_basic_auth\n authenticate_with_http_basic do |login, password|\n self.current_user = User.authenticate(login, password)\n end\n end", "def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end", "def basic_auth(login, pass)\n set_authorization_header(:basic_auth, login, pass)\n end", "def basic_auth(user=nil, password=nil)\n return @basic_auth unless user && password\n @basic_auth = [user, password]\n end", "def basic_auth(user=nil, password=nil)\n return @basic_auth unless user && password\n @basic_auth = [user, password]\n end", "def set_basic_auth(config, options)\n if (login = options['login']) && (password = options['password'])\n \"#{login}:#{password}\"\n elsif (login = config.fetch('user.login') && (password = config.fetch('user.password')))\n \"#{login}:#{password}\"\n else\n nil\n end\n end", "def basic_auth(user=nil, password=nil)\n user and password and @basic_auth = [user, password] or @basic_auth\n end", "def access_denied\nrespond_to do |format|\nformat.html do\nstore_location\nredirect_to new_session_path\nend\nformat.any do\nrequest_http_basic_authentication 'Web Password'\nend\nend\nend", "def authenticate_user\n if I18nEditor.configuration.authentication_user.present? and I18nEditor.configuration.authentication_password.present?\n authenticate_or_request_with_http_basic do |username, password|\n username == I18nEditor.configuration.authentication_user && password == I18nEditor.configuration.authentication_password\n end\n end\n end", "def require_login\n @response.add_header('WWW-Authenticate', \"Basic realm=\\\"#{@realm}\\\"\")\n @response.status = 401\n end", "def protected!\n return if from_bitbooks?\n headers['WWW-Authenticate'] = 'Basic realm=\"Restricted Area\"'\n halt 401, \"Not authorized\\n\"\nend", "def login\n #localhost:3000/api/login -u 'admin:password'\n authenticate_or_request_with_http_basic do |username, password|\n if username.include? '%40'\n email = username.gsub('%40','@');\n @user = User.find_by_email(email.downcase)\n else\n @user = User.find_by_username(username.downcase)\n end\n\n if @user && @user.authenticate(password)\n remember_token = RememberToken.create(token: User.encrypt(User.new_remember_token), user_id: @user.id, accessed_at: Time.now)\n respond_to do |format|\n format.json { render :json => remember_token }\n end\n end\n end\n end", "def basic_auth(u, p)\n @auth = {:username => u, :password => p}\n end", "def basic_authenticate(req, url, param_string = \"\")\n params = parse_quoted_wwwauth(param_string)\n\n user, pass = username_and_password_for_realm(url, params[:realm])\n\n req.basic_auth user, pass\n end", "def authenticate_admin\n check_logout_param and authenticate_with_http_basic &auth_proc\n end", "def not_authorised\n headers['WWW-Authenticate'] = 'Basic realm=\"Restricted Area\"'\n error(401, 'Not authorised.')\n end", "def test_basic_auth_with_password\n assert_warning :type => :controller,\n :warning_type => \"Basic Auth\",\n :line => 4,\n :message => /^Basic authentication password stored in source code/,\n :confidence => 0,\n :file => /users_controller\\.rb/\n end", "def basic_auth(user, password, domain = T.unsafe(nil)); end", "def basic_authorization(user, pass)\n @request.env[\"HTTP_AUTHORIZATION\"] = format(\"Basic %{auth}\", :auth => Base64.encode64(\"#{user}:#{pass}\"))\n end", "def authenticate(username, password)\n end", "def basic_authorize(username, password)\n encoded_login = [\"#{username}:#{password}\"].pack('m0')\n header('Authorization', \"Basic #{encoded_login}\")\n end", "def header_basic_auth(username=@username, password=@password)\n { \"Authorization\" => \"Basic #{Base64.encode64(username.to_s + \":\" + password.to_s).gsub(\"\\n\", \"\")}\" }\n end", "def dispatch_with_basic_authentication_to(controller_klass, action, username, password, params = {}, env = {}, &blk)\n env[\"X_HTTP_AUTHORIZATION\"] = \"Basic #{Base64.encode64(\"#{username}:#{password}\")}\"\n \n params = merge_controller_and_action(controller_klass, action, params) \n dispatch_request(build_request(params, env), controller_klass, action.to_s, &blk)\n end", "def authenticate\n authenticate_or_request_with_http_basic do |user, password|\n user == ChargebeeRails.configuration.webhook_authentication[:user] &&\n password == ChargebeeRails.configuration.webhook_authentication[:secret]\n end\n end", "def auth_bypass\r\n username = datastore['HttpUsername'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n password = datastore['HttpPassword'] || Rex::Text.rand_text_alpha_lower(4..12)\r\n @auth = basic_auth(username, password)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_users/org.couchdb.user:#{username}\"),\r\n 'method' => 'PUT',\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"type\": \"user\",\"name\": \"#{username}\",\"roles\": [\"_admin\"],\"roles\": [],\"password\": \"#{password}\"})\r\n )\r\n\r\n if res && (res.code == 200 || res.code == 201) && res.get_json_document['ok']\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def authenticate\n authed = true\n if(resource.respond_to?(:authenticate, true))\n authed = false\n uname = nil\n password = nil\n if(request.env['HTTP_AUTHORIZATION'])\n auth = Rack::Auth::Basic::Request.new(request.env)\n if(auth.basic? && auth.credentials)\n uname = auth.credentials[0]\n password = auth.credentials[1]\n end\n end\n authed = resource.send(:authenticate, uname, password)\n end\n raise Unauthorized unless authed\n end", "def login(action, username, password, header = 'HTTP_AUTHORIZATION')\n @request.env[header] = \"Basic #{Base64.encode64(username << ':' << password)}\"\n get action\n end", "def prepare_basic_auth(request)\n user = @options[:user] || nil\n pass = @options[:pass] || nil\n\n request.basic_auth user, pass\n request\n end", "def http_authorization_to_creds\n @auth ||= Rack::Auth::Basic::Request.new request.env\n return unless @auth.provided? && @auth.basic?\n\n @auth.credentials\n end", "def basic_auth\n \"#{username}:#{access_token}\"\n end", "def protected!(auth_method,request,session)\n unless ( signed_in? or authorized?(auth_method,request,session) )\n headers['WWW-Authenticate'] = 'Basic realm=\"Restricted Area\"'\n halt 401, \"Not authorized\\n\"\n end\n end", "def authorize \n unless User.find_by_id(session[:user_id])\n redirect_to login_url, :notice => \"Please log in\"\n end\n else\n authenticate_or_request_with_http_basic do |username, password|\n user = User.find_by_name(username)\n user && user.authenticate(password)\n end\n end", "def basic_auth(*args_or_proc)\n return @basic_auth unless args_or_proc\n @basic_auth = args_or_proc\n end", "def authenticate\n deny_access unless loged_in?\n end", "def authenticate\n authenticate_or_request_with_http_basic(\"myTaskboard Login\") do |email, password|\n user = User.where(email: email, password: password).first rescue nil\n redirect_to controller: :login, action: :index, status: 403 and return if user.nil?\n\n session[:current_user_id] = user.id #rescue nil\n end\n end", "def authenticate_member_with_basic_auth!\n if member = authenticate_with_http_basic { |u,p| Membership.find_by_user_name(u).authenticate(p) }\n session[:member_id] = member.id\n else\n authenticate_api_member!\n end\n end", "def basic_auth(account, password)\n @header.merge!({ 'Authorization' => \"Basic #{[\"#{account}:#{password}\"].pack('m').delete(\"\\r\\n\")}\" })\n end", "def authenticate\n # puts _process_action_callbacks.map(&:filter)\n # if current_user\n # session['user_id'] = current_user.id\n # true\n # else\n # session[:return_to] = request.original_url\n # respond_to do |format|\n # format.html { redirect_to login_url }\n # format.any(:xml,:json) { request_http_basic_authentication }\n # end\n # false\n # end\n true\n end", "def adminlogin_from_basic_auth\n authenticate_with_http_basic do |login, password|\n self.current_administrator = Administrator.authenticate(login, password)\n end\n end", "def authenticate!\n token = Configuration.authentication_token\n secret = Configuration.authentication_secret\n creds = {token => params[token], secret => params[secret]}\n\n response = HTTPClient.get(Configuration.authentication_endpoint, creds)\n\n unless response.ok?\n halt(403, \"Authentication failed: #{response.body}\")\n end\n end", "def login_from_basic_auth\n authenticate_with_http_basic do |login, password|\n @current_user_session = Usersession.create(:email=>login, :password=>password, :remember_me => true)\n if !(@current_user_session.save)\n print @current_user_session.errors.full_messages\n request_http_basic_authentication\n end\n end\n @current_user_session\n end", "def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end", "def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end" ]
[ "0.83460575", "0.8159651", "0.8076092", "0.80427486", "0.803855", "0.7972355", "0.7964747", "0.79357034", "0.7866257", "0.78562534", "0.7806435", "0.7803062", "0.7776832", "0.7726358", "0.76879585", "0.7628929", "0.7611913", "0.75904727", "0.74858415", "0.74801254", "0.7471892", "0.7471794", "0.7465684", "0.74403125", "0.7437381", "0.7431257", "0.7415685", "0.7384774", "0.7374823", "0.7363075", "0.73382765", "0.733634", "0.72966427", "0.7283671", "0.72675824", "0.72514695", "0.7247981", "0.7247981", "0.7239398", "0.7221645", "0.7214704", "0.7214704", "0.7195603", "0.71637446", "0.71637446", "0.7154397", "0.7111016", "0.71091366", "0.7095325", "0.7045471", "0.7039613", "0.70314246", "0.7020425", "0.70073885", "0.6998772", "0.6997089", "0.6992005", "0.6973169", "0.6905917", "0.68962836", "0.68849826", "0.68817043", "0.68817043", "0.6880388", "0.68581593", "0.6821458", "0.67774916", "0.6776603", "0.6757141", "0.6753185", "0.6749816", "0.6748619", "0.6742508", "0.673811", "0.6737291", "0.67326933", "0.6729995", "0.672776", "0.67075634", "0.6700901", "0.6700005", "0.6693581", "0.6657327", "0.6656914", "0.6655758", "0.66522604", "0.6647705", "0.66466206", "0.66244614", "0.6607889", "0.65993565", "0.6590076", "0.6581855", "0.65758055", "0.65701336", "0.65670377", "0.6558479", "0.6557764", "0.655407", "0.6535702", "0.65344906" ]
0.0
-1
draw_tiles(num) returns num number of random tiles, removes the tiles from the default set
def draw_tiles(num) # puts "Length of default_tiles: " + @tile_bag.length.to_s # print @tile_bag # # puts if num > 7 raise ArgumentError end letters_picked = @tile_bag.sample(num) letters_picked.each do |tile| @tile_bag.delete_at(@tile_bag.index(tile)) end # print "Letters picked: " + letters_picked.to_s + "\n" # # puts "NEW Length of default_tiles: " + @tile_bag.length.to_s # print @tile_bag # # puts return letters_picked end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_tiles (num)\n tiles_drawn = @bag_of_tiles.sample(num)\n tiles_drawn.each do | tile |\n @bag_of_tiles.slice!(@bag_of_tiles.index(tile))\n end\n return tiles_drawn\n end", "def draw_tiles(num)\n random_tiles = @tiles.sample(num)\n random_tiles.each do |letter|\n @tiles.slice!(@tiles.index(letter))\n end\n return random_tiles\n end", "def draw_tiles(num)\n if num <= tiles_remaining\n our_tiles = display_all_tiles.sample(num)\n tile_removal(our_tiles)\n return our_tiles\n else\n print \"Sorry, there are only #{tiles_remaining} left.\"\n our_tiles = display_all_tiles.sample(tiles_remaining)\n tile_removal(our_tiles)\n return our_tiles\n end\n end", "def draw_tiles(num)\n player_hand = []\n # array will return tiles to player. Needs much refactoring.\n return nil if num > tiles_remaining\n #to account for test, returns nil if more tiles are drawn than tiles remain.\n while player_hand.length != num\n new_tile = rand(@default_set.size)\n starting_hand = 0\n\n @default_set.each do |letter, letter_quantity|\n #Need to continue working on, this is becoming harder to read. TODO: REFACTOR!\n # if the amount of tiles drawn(starting at 0) is the same as the amount of new tiles drawn,\n if starting_hand == new_tile && letter_quantity != 0\n #if the condition above, and the total tiles isnt 0, add the new tile (letter), to all of the tiles (player_hand array)\n # if letter_quantity != 0\n player_hand << letter\n #Then subtract the letter from the tilebag, reducing the total amount of tiles by 1, and reducing the letter by one specifically from the letters.\n @default_set[letter] = letter_quantity - 1\n else\n new_tile = rand(@default_set.size)\n \n end\n #increases the amount of tiles had by player plus one, each time a tile is drawn\n starting_hand += 1\n end\n end\n #returns array of all tiles to player\n return player_hand\n end", "def draw_tiles(num)\n raise ArgumentError.new \"Specify only numbers\" if num.class != Integer\n player_hand = []\n\n num.times do |letter|\n player_hand << @collection.shuffle!.pop\n end\n\n return player_hand\n end", "def draw_tile\n\t@tile_bag.delete_at(rand (@tile_bag.length))\n\n end", "def draw_tiles(tile_bag)\n until tiles.length == 7\n tiles.concat(tile_bag.draw_tiles(1)) #because draw_tiles returns an array\n\n end\n end", "def test_has_proper_number_of_tiles\n\t98.times { @pd.draw_tile } \t\n \n\tassert_equal true, @pd.empty?\n end", "def draw_tiles(tile_bag)\n tile_bag = Scrabble::TileBag.new\n @tiles = tile_bag.draw_tiles(7)\n end", "def generate_tile()\n @i = do_generate_tile(@i)\n end", "def draw_tiles(tile_bag)\n tiles = []\n tiles << Scrabble::TileBag.draw_tiles(7)\n end", "def draw_board\n\t\tfor i in 0..9\n\t\t\t@tile_Array[i].draw\n\t\tend\n\tend", "def create_tiles\n # Screen fits exactly 15x10 tiles (for 480x320), but it has a buffer around it\n # so the game has time to refresh without showing a black border during movement.\n tiles = []\n (TOTALSIZE).times { tiles << TileSprite.new($visuals.viewport) }\n @array = tiles\n startx = $visuals.map.real_x / -32 - 1\n starty = $visuals.map.real_y / -32 - 1\n for y in 0...YSIZE\n for x in 0...XSIZE\n mapx = startx + x\n mapy = starty + y\n idx = x + y * XSIZE\n @array[idx].real_x = $visuals.map.real_x + mapx * 32\n @array[idx].real_y = $visuals.map.real_y + mapy * 32\n draw_tile(@array[idx], mapx, mapy)\n end\n end\n $temp_bitmaps = nil\n # Don't dispose the bitmaps hash because tiles reference these instances; they're not clones.\n end", "def tile_number_generator(board)\n count_hash = {\n 0 => 0,\n 1 => 0,\n 2 => 0,\n 3 => 0,\n 4 => 0,\n 5 => 0,\n 6 => 0,\n 7 => 0,\n 8 => 0,\n 9 => 1\n }\n \n y_pos = 1\n self.height.times do\n x_pos = 0\n \n column1 = count_hash[board[y_pos-1][x_pos-1]] + count_hash[board[y_pos][x_pos-1]] + count_hash[board[y_pos+1][x_pos-1]]\n column2 = count_hash[board[y_pos-1][x_pos]] + count_hash[board[y_pos][x_pos]] + count_hash[board[y_pos+1][x_pos]]\n column3 = count_hash[board[y_pos-1][x_pos+1]] + count_hash[board[y_pos][x_pos+1]] + count_hash[board[y_pos+1][x_pos+1]]\n \n self.width.times do\n x_pos += 1\n \n column1 = column2\n column2 = column3\n column3 = count_hash[board[y_pos-1][x_pos+1]] + count_hash[board[y_pos][x_pos+1]] + count_hash[board[y_pos+1][x_pos+1]]\n if board[y_pos][x_pos] != 9\n board[y_pos][x_pos] = column1 + column2 + column3\n end\n end\n y_pos += 1\n end\n \n return board\n end", "def initialize_tiles\n return if @ready\n\n cur_y, cur_x = @progress.divmod @map.logical_width\n puts \"Game#initialize_tiles: #{@progress}/#{@finished_at} = #{(initialization_percent * 100).floor}%\"\n\n start_t = Time.now\n\n cur_y.upto(@map.logical_height - 1) do |y|\n cur_x.upto(@map.logical_width - 1) do |x|\n cur_tile = @tileset.sprite_for(@tileset.random_floor)\n\n # Let's give them a little color\n cur_tile.merge!(\n {\n r: rand(35) + 220 * (x / @map.logical_width),\n g: rand(35) + 220 * (y / @map.logical_height),\n b: rand(35) + 220 * (x / @map.logical_width) * (y / @map.logical_height)\n }\n )\n\n @map.add_tile(x, y, cur_tile)\n @progress += 1\n\n # Allow this to execute for 8ms (half a tick at 60fps).\n return if (Time.now - start_t) >= 0.008 # rubocop:disable Lint/NonLocalExitFromIterator\n end\n cur_x = 0\n end\n finish_initialization\n end", "def build_grid size\n self.tiles.clear\n size.to_i.times do |row|\n size.to_i.times do |column|\n self.tiles.build({\n x: column,\n y: row\n })\n end\n end\n end", "def draw_tiles(tile_bag)\n if @players_plaque.length < MAX_NUM_OF_TILES_ALLOWED\n add_tiles = MAX_NUM_OF_TILES_ALLOWED - @players_plaque.length\n @players_plaque.concat(tile_bag.draw_tiles(add_tiles))\n end\n end", "def init_tiles\n # Determine how many frames of animation this autotile has\n for i in 0..6\n bm = @autotiles[i]\n if bm.nil?\n @total_frames = 1\n elsif bm.height > 32\n @total_frames[i] = bm.width / 256\n else\n @total_frames[i] = bm.width / 32\n end\n @current_frame[i] = 0\n end\n # Turn on flag that the tilemap sprites have been initialized\n @tilemap_drawn = true\n \n @animating_tiles.clear\n # Create a sprite and viewport to use for each priority level.\n (0...((SCREEN[0]/32+2) * (SCREEN[1]/32+2))*3).each{|i|\n @tile_sprites[i/3] = [] if @tile_sprites[i/3].nil?\n @tile_sprites[i/3][i%3] = Sprite.new(@viewport) unless @tile_sprites[i/3][i%3].is_a?(Sprite)\n # Rename to something shorter and easier to work with for below\n tile = @tile_sprites[i/3][i%3]\n # Assign tile's respective ID value\n tile.tile_sprite_id = i\n # Draw sprite at index location (ex. ID 0 should always be the top-left sprite)\n tile.x = (i % ((SCREEN[0]/32+2)*3) / 3 * 32) - 32 + (@ox % 32)\n tile.y = (i / ((SCREEN[0]/32+2)*3) * 32) - 32 + (@oy % 32)\n\n map_x, map_y = (tile.x+@ox)/32, (tile.y+@oy)/32\n @corner_tile_loc = [map_x, map_y] if i == 0\n # If the tile happens to be drawn along the outside borders of the map\n if map_x < 0 || map_x >= $game_map.width || map_y < 0 || map_y >= $game_map.height\n tile.z = 0\n tile.bitmap = RPG::Cache.picture('')\n tile.src_rect.set(0,0,0,0)\n else # Tile is actually on the map\n tile_id = @map_data[map_x,map_y,i%3]\n if @priorities[tile_id] == 0\n tile.z = 0\n else\n tile.z = tile.y + @priorities[tile_id] * 32 + 32\n end\n # No tile exists here\n if tile_id == 0\n tile.bitmap = RPG::Cache.picture('')#@tileset\n tile.src_rect.set(0,0,0,0)\n elsif tile_id >= 384 # non-autotile\n tile.bitmap = @tileset\n tile.src_rect.set(((tile_id - 384) % 8)*32,((tile_id - 384) / 8)*32, 32, 32)\n else # autotile\n tile.bitmap = @autotiles[tile_id/48-1]\n tile.src_rect.set(((tile_id % 48) % 8)*32,((tile_id % 48) / 8)*32, 32, 32)\n @animating_tiles[i] = tile if tile.bitmap.width > 256\n end\n end\n }\n # Sprite ID located at top left corner (ranges from 0..map_width * map_height\n @corner_index = 0\n end", "def generate\n @map.each_index do |x|\n @map[x].each_index do |y|\n rand(4) > 0 ? @map[x][y] = :empty : @map[x][y] = :full\n end\n end\n end", "def split_tile_set_into_tiles\n number_of_tiles = @tile_set[0].columns/32\n\n number_of_tiles.times do |i|\n image = @tile_set[0].crop((i*32), 0, 32, 32)\n image.write(\"media/tmp/tile#{i}.png\")\n end\n end", "def display\n system 'clear'\n print \"\\n\"\n i = 0\n @size.times do |y|\n @size.times do |x|\n print \"#{tile_to_s(i)} \"\n i += 1\n end\n print \"\\n\"\n end\n print \"\\n\"\n end", "def generate\n (0..@horizontal_size-1).each do |column|\n (0..@vertical_size-1).each do |row|\n val = Settings.get_random.rand(0..10)\n @map[column][row] = val > 3 ? 1 : 2\n end\n end\n end", "def populate_map(map, n)\n ret = Array.new\n\n n.times do\n begin\n x, y = [rand(map.width), rand(map.height)]\n end while(not empty?(x,y,map)) \n \n creat = CreatureGenerator.create_random(self, x, y)\n ret << creat\n end\n \n return ret\n end", "def tile_removal(array_of_tiles)\n array_of_tiles.each do |letter|\n if @default_tiles.keys.include?(letter)\n @default_tiles[letter] -= 1\n end\n @default_tiles.delete_if {|key, value| value == 0 }\n end\n end", "def test_has_proper_tile_distribution\r\n dist = {:A => 0,\r\n :B => 0,\r\n :C => 0,\r\n :D => 0,\r\n :E => 0,\r\n :F => 0,\r\n :G => 0,\r\n :H => 0,\r\n :I => 0,\r\n :J => 0,\r\n :K => 0,\r\n :L => 0,\r\n :M => 0,\r\n :N => 0,\r\n :O => 0,\r\n :P => 0,\r\n :Q => 0,\r\n :R => 0,\r\n :S => 0,\r\n :T => 0,\r\n :U => 0,\r\n :V => 0,\r\n :W => 0,\r\n :X => 0,\r\n :Y => 0,\r\n :Z => 0}\r\n\r\n bag = TileBag.new\r\n 98.times {\r\n tile = bag.draw_tile\r\n dist[tile] += 1\r\n }\r\n\r\n assert_equal 9, dist[:A]\r\n assert_equal 2, dist[:B]\r\n assert_equal 2, dist[:C]\r\n assert_equal 4, dist[:D]\r\n assert_equal 12, dist[:E]\r\n assert_equal 2, dist[:F]\r\n assert_equal 3, dist[:G]\r\n assert_equal 2, dist[:H]\r\n assert_equal 9, dist[:I]\r\n assert_equal 1, dist[:J]\r\n assert_equal 1, dist[:K]\r\n assert_equal 4, dist[:L]\r\n assert_equal 2, dist[:M]\r\n assert_equal 6, dist[:N]\r\n assert_equal 8, dist[:O]\r\n assert_equal 2, dist[:P]\r\n assert_equal 1, dist[:Q]\r\n assert_equal 6, dist[:R]\r\n assert_equal 4, dist[:S]\r\n assert_equal 6, dist[:T]\r\n assert_equal 4, dist[:U]\r\n assert_equal 2, dist[:V]\r\n assert_equal 2, dist[:W]\r\n assert_equal 1, dist[:X]\r\n assert_equal 2, dist[:Y]\r\n assert_equal 1, dist[:Z]\r\n\r\n end", "def generate_tile_heights(map_size)\n # USE SUPER SIMPLIFIED VERSION FOR NOW\n return Array.new(map_size, 1)\n\n # STUFF BELOW FOR MORE COMPLEX IMPLEMENTATION IN THE FUTURE\n # I RAN OUT OF TIME :(\n tiles = [\n Array.new((map_size*0.5).floor, 1), \n Array.new((map_size*0.4).floor, 2), \n Array.new((map_size*0.1).floor, 3) \n ].flatten\n\n # Compensate for imperfect percentage rounding \n (map_size - tiles.size).times do |i|\n tiles.push([1, 2, 3].sample)\n end\n\n # Shuffle the tiles to randomly assign them\n tiles = tiles.shuffle\n\n return tiles\n end", "def tile_board\n @board_array.each_with_index do |row_array, row|\n 10.times{|column| row_array << Tile.new(row,column)}\n end\n end", "def randomize\n (@grid_height * @grid_width / 5).times do\n @grid[rand(@grid_height)][rand(@grid_width)] = 1\n end\n end", "def show\n @about = About.find(params[:id])\n @tiles = About.all.sample(3)\n end", "def load_tiles(zombie_setting)\n tiles = Gosu::Image.load_tiles(zombie_setting[\"image_tile_dir\"], 32, 32)\n tile_no = zombie_setting[\"tile_loc\"]\n \n start = (tile_no - 1) * 3\n\n @image_tiles = Array.new\n for x in 0..3 do\n for y in 0..2 do\n @image_tiles << tiles[start + y]\n end\n start +=12\n end \n end", "def generate_list\n n = @screen_dim[:cols] / (4 + Canvas::MARGIN)\n (1..n).to_a.shuffle\n end", "def generateMap difficulty\r\n width = 12\r\n height = 100\r\n map = Array.new(height)\r\n i = 0\r\n previousCutterYPos = 0\r\n noCuttterForFirst10Block = 0\r\n while i < height-1\r\n map[i] = Array.new(width)\r\n if(i%3==0) #if the coloumn consist plank then draws the wooden plank on the random position and fills the left space with 0\r\n posX = rand(1..6) #6 randomply decides the position where to draw the wooden plank\r\n plankWithBomb = rand(30)\r\n width.times do |x| \r\n if(x < posX || (posX+4) < x) # fills the coordinate with space i.e 0\r\n map[i][x] = 0\r\n else # fills the coordinate with wooden plank i.e 1 \r\n if(plankWithBomb % (5-difficulty)==0) \r\n map[i][x] = 3\r\n else\r\n map[i][x] = 1 \r\n end\r\n end\r\n end\r\n else #else then just draw the space i.e 0 or cutters \r\n posX = -1\r\n if(previousCutterYPos!=(i-1) && rand(15) % (10-difficulty)==0 && i < 90) # i > 10 denotes that there are no cutter for first 10 blocks or jumps\r\n posX = [0,11].sample \r\n previousCutterYPos = i\r\n end\r\n \r\n 12.times do |x|\r\n if(posX==x)\r\n map[i][posX] = 2\r\n else\r\n map[i][x] = 0\r\n end\r\n end\r\n end\r\n i+=1\r\n end\r\n\r\n # map[height-1] = Array.new()\r\n map[height-1] = [1,1,1,1,1,1,1,1,1,1,1,1] # just making the last block as platform for player to move around\r\n\r\n map # return the map to the calling function\r\nend", "def draw_map game_map\r\n tiles = game_map.tiles # 2d array of the tiles set!\r\n wooden_plank_image = game_map.wooden_plank # image of the wooden plank \r\n i = 0\r\n j = 0\r\n unit_width = 20\r\n unit_height = 20\r\n\r\n # drawing the background image of the game map\r\n #game_map.background.draw(0,0,0) # 0: for x position, 0: for y position, 0: for ZOrder\r\n\r\n height = tiles.length\r\n width = tiles[0].length\r\n\r\n while i < height\r\n j = 0\r\n while j < width\r\n if(tiles[i][j]==1 || tiles[i][j]==3)\r\n x = j * unit_width\r\n y = i * unit_height\r\n draw_plank(x, y, wooden_plank_image)\r\n j+=4 # increment the value of the j by 4 to skip the next 4 blocks\r\n end\r\n j+=1\r\n end\r\n i+=1\r\n end\r\n\r\nend", "def initialize\n @tiles = []\n 1.upto(15) { |i| @tiles[i] = Array.new }\n end", "def refresh_tiles\n return if empty?\n xdiff = @array[0].real_x.round / -32 - 1\n ydiff = @array[0].real_y.round / -32 - 1\n if ydiff > 0\n ydiff.times do\n move_up do |sprite|\n sprite.mapy += YSIZE\n sprite.real_y += 32 * YSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n $temp_bitmaps = nil\n elsif ydiff < 0\n ydiff.abs.times do\n move_down do |sprite|\n sprite.mapy -= YSIZE\n sprite.real_y -= 32 * YSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n $temp_bitmaps = nil\n end\n if xdiff > 0\n xdiff.times do\n move_left do |sprite|\n sprite.mapx += XSIZE\n sprite.real_x += 32 * XSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n $temp_bitmaps = nil\n elsif xdiff < 0\n xdiff.abs.times do\n move_right do |sprite|\n sprite.mapx -= XSIZE\n sprite.real_x -= 32 * XSIZE\n draw_tile(sprite, sprite.mapx, sprite.mapy)\n end\n end\n temp_bitmaps = nil\n end\n end", "def image_board\n\t\t(0...@width).map do |i|\n\t\t\t(0...@height).map do |j|\n\t\t\t\t# ([1]*3+[0]*7)[rand 10]\n\t\t\t\trand 2\n\n\n\t\t\t\t# rand 2\n\t\t\tend\n\t\tend\n\tend", "def draw(number_of_elements = 1)\n return [] if empty?\n (1..number_of_elements).to_a.map { random_element }\n end", "def generateOres\r\n #For each tier populate the grid with that tier's ore.\r\n (0..@tiers-1).each do |tier|\r\n #Number of ores for the tier.\r\n oreCount = (@baseChance * (@nextTierChance**tier) * @rows * @columns).to_i #Calculates the number of ores for the tier based on the base chance and next tier chance.\r\n @oreTotal[tier] = oreCount\r\n @oreRemaining[tier] = oreCount\r\n @oreRemainingPara[tier].clear { para(@ore[tier].to_s + \" \" + @oreName[tier].to_s + \" \", strong(\"x\" + @oreRemaining[tier].to_s), @style_orecount) } #Displays the remaining number of ores for the tier.\r\n @tierExp[tier] = oreCount * (2**tier) #Calculates the total experience aquired by mining all of the tier's ore.\r\n\r\n count = 0 #Number of ores added so far.\r\n #Randomly selects a cell on the grid to populate the ore with.\r\n while count < oreCount\r\n x = rand(@rows) #Selects a random row.\r\n y = rand(@columns) #Selects a random column.\r\n if (@tile[y][x].tier == 0) #Checks if the tile is empty.\r\n @tile[y][x].tier = tier + 1 #Applies the tier to the tile.\r\n count+=1 #New ore has been added.\r\n end\r\n end\r\n end\r\nend", "def pick_tiles\n if button_down? Gosu::KbEscape then\n close\n end\n \tif @phase == 0 \n \t\tif button_down? Gosu::MsLeft then\n \t\t\t# TILE 1\n \t\t\tif (mouse_x >= 0 and mouse_x <= 250) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(0)) then\n \t\t\t\t@game_board.flip_tile(0, true)\n \t\t\t\t@picked = 0\n \t\t\t\t@phase = 1\n \t\t\t# TILE 2\n \t\t\telsif (mouse_x > 250 and mouse_x <= 500) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(1)) then\n \t\t\t\t@game_board.flip_tile(1, true)\n \t\t\t\t@picked = 1\n \t\t\t\t@phase = 1\n \t\t\t# TILE 3\n \t\t\telsif (mouse_x > 500 and mouse_x <= 750) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(2)) then\n \t\t\t\t@game_board.flip_tile(2, true)\n \t\t\t\t@picked = 2\n \t\t\t\t@phase = 1\n \t\t\t# TILE 4\n \t\t\telsif (mouse_x > 750 and mouse_x <= 1000) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(3))then\n \t\t\t\t@game_board.flip_tile(3, true)\n \t\t\t\t@picked = 3\n \t\t\t\t@phase = 1\n \t\t\t# TILE 5\n \t\t\telsif (mouse_x > 1000 and mouse_x <= 1250) and (mouse_y >= 0 and mouse_y <= 250) and (!@game_board.is_matched(4)) then\n \t\t\t\t@game_board.flip_tile(4, true)\n \t\t\t\t@picked = 4\n \t\t\t\t@phase = 1\n \t\t\t# TILE 6\n \t\t\telsif (mouse_x >= 0 and mouse_x <= 250) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(5)) then\n \t\t\t\t@game_board.flip_tile(5, true)\n \t\t\t\t@picked = 5\n \t\t\t\t@phase = 1\n \t\t\t# TILE 7\n \t\t\telsif (mouse_x > 250 and mouse_x <= 500) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(6)) then\n \t\t\t\t@game_board.flip_tile(6, true)\n \t\t\t\t@picked = 6\n \t\t\t\t@phase = 1\n \t\t\t# TILE 8\n \t\t\telsif (mouse_x > 500 and mouse_x <= 750) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(7)) then\n \t\t\t\t@game_board.flip_tile(7, true)\n \t\t\t\t@picked = 7\n \t\t\t\t@phase = 1\n \t\t\t# TILE 9\n \t\t\telsif (mouse_x > 750 and mouse_x <= 1000) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(8)) then\n \t\t\t\t@game_board.flip_tile(8, true)\n \t\t\t\t@picked = 8\n \t\t\t\t@phase = 1\n \t\t\t# TILE 10\n \t\t\telsif (mouse_x > 1000 and mouse_x <= 1250) and (mouse_y > 500 and mouse_y <= 750) and (!@game_board.is_matched(9)) then\n \t\t\t\t@game_board.flip_tile(9, true)\n \t\t\t\t@picked = 9\n \t\t\t\t@phase = 1\n \t\t\tend\n \t\t\tsleep(0.2) # needs delay because gosu's mouse click event seems to be hyper sensitive and picks up multiple clicks instead of 1\n \t\tend\n \telse @phase == 1\n \t\tif button_down? Gosu::MsLeft then\n \t\t# TILE 1\n \t\t\tif (mouse_x >= 0 and mouse_x <= 250) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 0) and (!@game_board.is_matched(0)) then\n \t\t\t\t@game_board.flip_tile(0, true)\n \t\t\t\t@picked2 = 0\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 2\n \t\t\telsif (mouse_x > 250 and mouse_x <= 500) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 1) and (!@game_board.is_matched(1)) then\n \t\t\t\t@game_board.flip_tile(1, true)\n \t\t\t\t@picked2 = 1\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 3\n \t\t\telsif (mouse_x > 500 and mouse_x <= 750) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 2) and (!@game_board.is_matched(2)) then\n \t\t\t\t@game_board.flip_tile(2, true)\n \t\t\t\t@picked2 = 2\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 4\n \t\t\telsif (mouse_x > 750 and mouse_x <= 1000) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 3) and (!@game_board.is_matched(3)) then\n \t\t\t\t@game_board.flip_tile(3, true)\n \t\t\t\t@picked2 = 3\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 5\n \t\t\telsif (mouse_x > 1000 and mouse_x <= 1250) and (mouse_y >= 0 and mouse_y <= 250) and (@picked != 4) and (!@game_board.is_matched(4)) then\n \t\t\t\t@game_board.flip_tile(4, true)\n \t\t\t\t@picked2 = 4\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 6\n \t\t\telsif (mouse_x >= 0 and mouse_x <= 250) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 5) and (!@game_board.is_matched(5)) then\n \t\t\t\t@game_board.flip_tile(5, true)\n \t\t\t\t@picked2 = 5\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 7\n \t\t\telsif (mouse_x > 250 and mouse_x <= 500) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 6) and (!@game_board.is_matched(6)) then\n \t\t\t\t@game_board.flip_tile(6, true)\n \t\t\t\t@picked2 = 6\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 8\n \t\t\telsif (mouse_x > 500 and mouse_x <= 750) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 7) and (!@game_board.is_matched(7)) then\n \t\t\t\t@game_board.flip_tile(7, true)\n \t\t\t\t@picked2 = 7\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 9\n \t\t\telsif (mouse_x > 750 and mouse_x <= 1000) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 8) and (!@game_board.is_matched(8)) then\n \t\t\t\t@game_board.flip_tile(8, true)\n \t\t\t\t@picked2 = 8\n \t\t\t\t@pickedSecond = true\n \t\t\t# TILE 10\n \t\t\telsif (mouse_x > 1000 and mouse_x <= 1250) and (mouse_y > 500 and mouse_y <= 750) and (@picked != 9) and (!@game_board.is_matched(9)) then\n \t\t\t\t@game_board.flip_tile(9, true)\n \t\t\t\t@picked2 = 9\n \t\t\t\t@pickedSecond = true\n \t\t\tend\n\t\t\tsleep(0.2) # needs delay because gosu's mouse click event seems to be hyper sensitive and picks up multiple clicks instead of 1\n \t\tend\n \tend\n end", "def draw\n stack.sample(7)\nend", "def randomize_terrain\n valid_terrains = @@data[:terrain].values.map { |i| i[:symbol] }\n\n (0...@width).each do |x|\n (0...@height).each do |y|\n @terrain_map[x][y] = valid_terrains[rand valid_terrains.length]\n end\n end\n end", "def deal_tiles\n Tile.all.each do |tile|\n cell = tile.column.to_s + tile.row\n GameTile.create(tile_id: tile.id, game_id: self.id, hotel: 'none', cell: cell, placed: false, available: true)\n end\n self.game_players.each do |player|\n 6.times do\n available_tiles = self.game_tiles.where(available: true)\n random_tile = available_tiles[rand(available_tiles.length)]\n random_tile.available = false\n random_tile.save\n GamePlayerTile.create(game_player_id: player.id, tile_id: random_tile.tile_id)\n end\n end\n end", "def display_tile_image\n generate_tile unless @i.nil?\n display_image = @i.scale(8.0)\n display_image.display\n end", "def draw\n letters.delete_at(rand(letters.size))\n end", "def draw size, x_offset=0, y_offset=0\n x_offset -= 320 * size / 2\n y_offset -= 250 * size / 2\n x_offset += 6 * size\n y_offset += 15 * size\n # draw background first\n 0.upto(WIDTH - 1) do |x|\n (HEIGHT - 1).downto(0) do |y|\n if @tiles[x + WIDTH * y] == :background\n # choose background terrain\n image = @terrain[1]\n # actual top left coordinates\n px = x * TILE_WIDTH * size\n py = y * TILE_HEIGHT * size - TILE_HEIGHT * size\n # draw to the screen scaled to size\n image.draw(px - x_offset, py - y_offset, 0, size, size)\n elsif @tiles[x + WIDTH * y] == :background2\n # choose background terrain\n image = @terrain[3]\n # actual top left coordinates\n px = x * TILE_WIDTH * size\n py = y * TILE_HEIGHT * size - TILE_HEIGHT * size\n # draw to the screen scaled to size\n image.draw(px - x_offset, py - y_offset, 0, size, size)\n end\n end\n end\n\n # draw platforms on top of the background\n 0.upto(WIDTH - 1) do |x|\n (HEIGHT - 1).downto(0) do |y|\n if @tiles[x + WIDTH * y] == :platform\n # choose platform terrain\n image = @terrain[0]\n # actual top left coordinates\n px = x * TILE_WIDTH * size\n py = y * TILE_HEIGHT * size - TILE_HEIGHT * size\n # draw to the screen scaled to size\n image.draw(px - x_offset, py - y_offset, 0, size, size)\n end\n end\n end\n\n for enemy in @enemies\n enemy.draw size, x_offset, y_offset\n end\n\n for candy in @candies\n candy.draw size, x_offset, y_offset\n end\n\n @door.draw size, x_offset, y_offset\n end", "def generate_possible_areas_for_all_numbered_tiles\n t = Time.now\n puts 'Start: Generate possible areas for all numbered tiles'\n all_possible_areas = {}\n\n # @b_nl.each_with_value do |value, i, j|\n # if value != 0 then\n # restricted_board = create_restricted_board [i,j]\n # t_area = Time.now\n # next if [i,j] == [7,1]\n # puts \"Summoning for [#{i},#{j}]\"\n # a = summon_areas([i,j], value, restricted_board)\n\n # puts \"Summoned area for [#{i},#{j}], time: \" + (Time.now - t_area).to_i.to_s + 's size ' + a.count.to_s\n # all_possible_areas[\"#{i}-#{j}\"] = a\n # end\n (0..@row_count-1).to_a.each do |i|\n (0..@col_count-1).to_a.each do |j|\n # Summon for each numbered tile(non zero)\n if @b_nl[i,j] != 0 then\n restricted_board = create_restricted_board [i,j]\n t_area = Time.now\n next if [i,j] == [7,1]\n puts \"Summoning for [#{i},#{j}]\"\n a = summon_areas([i,j],@b_nl[i,j], restricted_board)\n\n puts \"Summoned area for [#{i},#{j}], time: \" + (Time.now - t_area).to_i.to_s + 's size ' + a.count.to_s\n all_possible_areas[\"#{i}-#{j}\"] = a\n end\n end\n end\n puts 'Finish: Generate possible areas for all numbered tiles, time: ' + (Time.now - t).to_i.to_s + 'seconds'\n all_possible_areas[\"7-1\"] = [[[]]]\n all_possible_areas\n end", "def draw_map_cells(x, y)\n for i in (0..x-1)\n for j in (0..y-1)\n MapCellEmpty.create(:x => $node_size*5 * i + $node_size *5/2.0, :y => $node_size * 5 * j + $node_size * 5/2.0)\n end\n end\n end", "def generate_tectonic_plates\n max_radius = (width / 10) * 2.0\n\n hill_resources = [ :coal, :iron, :uranium ]\n mountain_resources = [ :coal, :iron, :uranium ]\n\n (width/4).times do\n candidates = { }\n\n radius = (width / 10) * (1.0 + Kernel::rand)\n pos = [ Kernel::rand(@maxx), Kernel::rand(@maxy) ]\n cx,cy = pos\n\n tiles = { }\n\n 1.upto(radius) do |r|\n (cx-r).upto(cx+r) do |x|\n (cy-r).upto(cy+r) do |y|\n pos = [x,y]\n next if tiles[pos]\n next unless in_range?(pos)\n\n if Kernel::rand >= r.to_f/max_radius\n tiles[pos] = true\n tile = self[pos]\n if tile[:terrain] == :grass then\n tile[:terrain] = :hills\n tile[:resource] = nil\n tile[:resource] = hill_resources[Kernel::rand(hill_resources.length - 1)] if Kernel::rand < 0.20\n tile[:resource] = :arable if tile[:resource].nil? && Kernel::rand < 0.40\n elsif tile[:terrain] == :hills then\n tile[:terrain] = :mountains\n tile[:resource] = nil\n tile[:resource] = mountain_resources[Kernel::rand(mountain_resources.length - 1)] if Kernel::rand < 0.40\n else\n tile[:terrain] = :grass\n tile[:resource] = nil\n tile[:resource] = :arable if Kernel::rand < 0.10\n tile[:resource] = :oil if Kernel::rand < 0.03\n tile[:resource] = hill_resources[Kernel::rand(hill_resources.length - 1)] if tile[:resource].nil? && Kernel::rand < 0.05\n end\n end\n end\n end\n end\n end\n end", "def tiles(include_palette=false)\n result = @draggables.dup\n if include_palette\n result += @palette\n end\n result.keep_if {|draggable| draggable.kind_of?(Tile)}\n end", "def draw_random\n @cards.delete_at(Random.new().rand(0...@cards.count))\n end", "def draw_pieces\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n @pieces[x][y].remove unless @pieces[x][y].nil?\n @pieces[x][y] = draw_piece(x,y,@board.state[x][y]) unless @board.state[x][y].nil?\n end\n end\nend", "def init_canvas(spawn_factor)\n $canvas = Array.new($height) { Array.new($width) { Random.new.rand(1...100) < spawn_factor ? 1 : 0 } }\nend", "def populate_random(n)\n n.times do\n set(rand(0...@x_size), rand(0...@y_size), :alive)\n end\n end", "def test_board_should_have_9_tiles\n assert_equal(9, @board.number_of_tiles)\n end", "def del\r\n @@tiles.delete_at(@tileno)\r\n @x1,@y1,@x2,@y2,@inclusive,@id,@tileno=nil\r\n end", "def draw_grid\n case view\n when :south_east\n size_y.times do |y|\n size_x.times do |x|\n draw_tile(x, y, x, y)\n end\n end\n when :south_west\n size_x.times do |y|\n size_y.times do |x|\n draw_tile(x, y, size_x - 1 - y, x)\n end\n end\n when :north_west\n size_y.times do |y|\n size_x.times do |x|\n draw_tile(x, y, size_x - 1 - x, size_y - 1- y)\n end\n end\n when :north_east\n size_x.times do |y|\n size_y.times do |x|\n draw_tile(x, y, y, size_y - 1 - x)\n end\n end\n else\n throw Exception.new(\"view was out of bounds!\")\n end\n\n end", "def insert_mines\n @random_spots = []\n @num_of_mine.times do\n\n while @random_spots.length < @num_of_mine\n rand_num = Random.rand(@num_of_tiles**2)\n\n if !@random_spots.include?(rand_num)\n @random_spots << rand_num\n end\n\n end\n end\nend", "def spawn_panes(num)\n main.number_of_panes = num\n @current_row = @current_page = 0\n end", "def draw_tile(sprite, mapx, mapy)\n $temp_bitmaps ||= {}\n # Reset the sprite to a blank tilesprite\n sprite.clear\n sprite.mapx = mapx\n sprite.mapy = mapy\n # Reconfigure if it's a valid and visible tile\n if mapx >= 0 && mapx < $game.map.width && mapy >= 0 && mapy < $game.map.height\n id = $game.map.id\n elsif $game.map.connection\n id, mapx, mapy = $game.get_map_from_connection($game.map, mapx, mapy)\n end\n if id\n for layer in 0...$game.maps[id].data.tiles.size\n tile_type, tile_id = $game.maps[id].data.tiles[layer][mapx + $game.maps[id].width * mapy]\n next if tile_type.nil?\n tileset_id = $game.maps[id].data.tilesets[tile_type]\n tileset = MKD::Tileset.fetch(tileset_id)\n # Temporary bitmap cache\n if $temp_bitmaps[tileset.graphic_name]\n bmp = $temp_bitmaps[tileset.graphic_name]\n else\n bmp = $temp_bitmaps[tileset.graphic_name] = Bitmap.new(\"gfx/tilesets/\" + tileset.graphic_name)\n end\n priority = tileset.priorities[tile_id] || 0\n sprite.set(layer, bmp, tile_id, priority)\n end\n end\n end", "def drawBoard() \n #1. prepare the default board\n @height.times do |y|\n @width.times do |x|\n print EMPTY_MARKER\n end\n puts\n end\t\n @squares = []\n @width.times do |x|\n column = []\n @height.times do |y|\n column << EMPTY_MARKER\n end\n @squares << column\n end\t\n # 2. fill the mine marker\n @mines.each do |mine|\n x,y = mine\n @squares[x][y] = MINE_MARKER\n end\t\t\n #puts @squares;\n\n end", "def draw\n # draw background first\n 0.upto(LEVEL_WIDTH - 1) do |x|\n (LEVEL_HEIGHT - 1).downto(0) do |y|\n if @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :background\n # choose background terrain\n image = @terrain[1]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n elsif @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :background2\n # choose background terrain\n image = @terrain[3]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n elsif @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :none\n image = @terrain[2]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n end\n end\n end\n\n # draw platforms on top of the background\n 0.upto(LEVEL_WIDTH - 1) do |x|\n (LEVEL_HEIGHT - 1).downto(0) do |y|\n if @tiles[x + @x_offset + LEVEL_WIDTH * (y + @y_offset)] == :platform\n # choose platform terrain\n image = @terrain[0]\n # actual top left coordinates\n px = x * 32 * SCALE\n py = y * 25 * SCALE - 25 * SCALE\n # draw to the screen scaled to size\n image.draw(px, py, 0, SCALE, SCALE)\n end\n end\n end\n\n for enemy in @enemies do\n enemy.draw SCALE, @x_offset * 32 * SCALE, @y_offset * 25 * SCALE\n end\n\n for candy in @candies do\n candy.draw SCALE, @x_offset * 32 * SCALE, @y_offset * 25 * SCALE\n end\n\n Gosu::Image.from_text(self, @current_selection.to_s, \"Times New Roman\", 24).draw(5, 5, 0, 1, 1, 0xffffffff)\n\n @player_image[0].draw(@player[0] * SCALE - @x_offset * 32 * SCALE, @player[1] * SCALE - @y_offset * 25 * SCALE, 1, SCALE, SCALE) unless @player.nil?\n @door_image[0].draw(@door[0] * SCALE - @x_offset * 32 * SCALE, @door[1] * SCALE - @y_offset * 25 * SCALE, 1, SCALE, SCALE) unless @door.nil?\n\n @target[0].draw(mouse_x, mouse_y, 2, SCALE, SCALE) if @current_type == :candies\n end", "def clear_tr_sprites\n @spriteset.dispose_tile_sprites\n clear_r_sprites\n end", "def randomize_cells!\n @life.height.times do |y|\n @life.width.times do |x|\n @life.set_cell_alive! x, y if rand > 0.5\n end\n end\n end", "def generate_initial_map\n for _ in 0...@height\n temp = []\n for _ in 0...@width\n temp.push(@WALL)\n end\n @map.push(temp)\n end\n end", "def place_random_ships\n ship_count = size / 4\n while ship_count.positive?\n row = rand(@grid.size)\n col = rand(@grid.size)\n if self[[row, col]] == :N\n self[[row, col]] = :S\n ship_count -= 1\n end\n end\n end", "def _minimap_autotile\n b = Bitmap.new(24, 32)\n c1 = Color.new(191, 191, 191)\n c2 = Color.new(255, 255, 255)\n b.fill_rect(2, 0, 4, 1, c2)\n b.set_pixel(1, 1, c2)\n b.fill_rect(2, 1, 4, 6, c1)\n b.set_pixel(6, 1, c2)\n b.fill_rect(0, 2, 1, 4, c2)\n b.fill_rect(1, 2, 1, 4, c1)\n b.fill_rect(6, 2, 1, 4, c1)\n b.fill_rect(7, 2, 1, 4, c2)\n b.set_pixel(1, 6, c2)\n b.set_pixel(6, 6, c2)\n b.fill_rect(2, 7, 4, 1, c2)\n b.fill_rect(7, 8, 10, 1, c2)\n b.set_pixel(6, 9, c2)\n b.fill_rect(7, 9, 10, 22, c1)\n b.set_pixel(17, 9, c2)\n b.set_pixel(5, 10, c2)\n b.fill_rect(6, 10, 1, 20, c1)\n b.fill_rect(17, 10, 1, 20, c1)\n b.set_pixel(18, 10, c2)\n b.set_pixel(4, 11, c2)\n b.fill_rect(5, 11, 1, 18, c1)\n b.fill_rect(18, 11, 1, 18, c1)\n b.set_pixel(19, 11, c2)\n b.set_pixel(3, 12, c2)\n b.fill_rect(4, 12, 1, 16, c1)\n b.fill_rect(19, 12, 1, 16, c1)\n b.set_pixel(20, 12, c2)\n b.set_pixel(2, 13, c2)\n b.fill_rect(3, 13, 1, 14, c1)\n b.fill_rect(20, 13, 1, 14, c1)\n b.set_pixel(21, 13, c2)\n b.set_pixel(1, 14, c2)\n b.fill_rect(2, 14, 1, 12, c1)\n b.fill_rect(21, 14, 1, 12, c1)\n b.set_pixel(22, 14, c2)\n b.fill_rect(0, 15, 1, 10, c2)\n b.fill_rect(1, 15, 1, 10, c1)\n b.fill_rect(22, 15, 1, 10, c1)\n b.fill_rect(23, 15, 1, 10, c2)\n b.set_pixel(1, 25, c2)\n b.set_pixel(22, 25, c2)\n b.set_pixel(2, 26, c2)\n b.set_pixel(21, 26, c2)\n b.set_pixel(3, 27, c2)\n b.set_pixel(20, 27, c2)\n b.set_pixel(4, 28, c2)\n b.set_pixel(19, 28, c2)\n b.set_pixel(5, 29, c2)\n b.set_pixel(18, 29, c2)\n b.set_pixel(6, 30, c2)\n b.set_pixel(17, 30, c2)\n b.fill_rect(7, 31, 10, 1, c2)\n return b\n end", "def puzzle_4\n puts 10.times.map{ 55 + Random.rand(46) }\nend", "def generate_grid\n (0...10).map { ('A'..'Z').to_a[rand(26)] }\n end", "def layered_tiles(x, y)\n newTilePoint = map_tile_adjust_xy(x, y)\n [2, 1, 0].collect {|z| tile_id(newTilePoint.x, newTilePoint.y, z) }\n end", "def draw # draw one card at random\n build_deck if cards.empty?\n ndx = (0...cards.size).to_a.sample\n cards.delete_at(ndx)\n end", "def refill\n @letters.concat (count..7-1).map { Tile::new }\n self\n end", "def visible_tiles\n frame_x = (((@width - Config::TileWidth) / Config::TileWidth) ).to_i\n frame_y = (((@height - Config::TileHeight) / Config::TileHeight) ).to_i\n \n \n start_x = player.location.x - (frame_x / 2).to_i\n start_y = player.location.y - (frame_y / 2).to_i\n \n if start_x < 0\n start_x = 0\n end\n if start_y < 0\n start_y = 0\n end\n \n tiles = Array.new\n \n frame_x.times do |i|\n frame_y.times do |j|\n if (start_x + i < game.map.width ) && (start_y + j < game.map.height )\n # puts(\"start_x is #{start_x} and start_y is #{start_y} and i is #{i} and j is #{j}\")\n tiles << game.map.locations[start_x + i, start_y + j]\n end\n end\n end\n \n tiles\n \n end", "def create_board\n (1..(@width * @width).to_i).each do |i|\n values = i <= @amount_mines ? @bomb : @empty\n @board.push({\n value: values,\n revealed?: false\n })\n end\n @board.shuffle!\n @board\n end", "def drawAllItems()\n @item_max = item_max()\n puts(\"ITEMS MAX:\" + @item_max.to_s )\n if @item_max > 0\n # self.contents = Bitmap.new(width, 24 * 24)\n for i in 0...@item_max\n #puts($game_variables[$chestIndex].at(i))\n #puts(\"Item: \" + i.to_s)\n draw_item(i)\n end\n end\n end", "def draw(viewport)\n viewport.map! { |p| p / @tile_size }\n x0, x1, y0, y1 = viewport.map(&:to_i)\n\n # restrict to prevent re-rendering\n x0 = 0 if x0.negative?\n x1 = @width - 1 if x1 >= @width\n y0 = 0 if y0.negative?\n y1 = @height - 1 if y1 >= @height\n\n (x0..x1).each do |x|\n (y0..y1).each do |y|\n @layers[:tile_layers].each do |_, tiles|\n next unless tiles[y][x]\n\n tiles[y][x].draw(x * @tile_size, y * @tile_size) if tiles[y][x].id != 0\n # tiles[y][x].x = x\n # tiles[y][x].y = y\n end\n end\n end\n end", "def shuffle_terrains()\n terrains = ([FOREST]*4 + [PLAINS]*4 + [PASTURE]*4 +\n [HILLS]*3 + [MOUNTAIN]*3 + [DESERT])\n terrains.shuffle.zip(tiles).each {|terrain, tile| tile.terrain = terrain}\n end", "def print_tile_selection ( array_of_tiles)\n print \"|\" \n array_of_tiles.each do |tile|\n print \" #{tile.print_tile_display_value} | \"\n end\n print \"\\n\" \n end", "def set_tiles\n if @game_state_model::game_type == :classic\n @tiles = @tilesClassic\n elsif @game_state_model::game_type == :otto\n @tiles = @tilesOtto\n end\n end", "def very_easy_level_maker(game)\n level = Level.find_or_create_by(difficulty: \"very easy\")\n game.level = level\n level.games << game\n game.save! \n level.tiles.delete_all\n # binding.pry\n 4.times do |i|\n level.tiles << Tile.new(game_id: game.id)\n end \n \n end", "def defaults\n state.tile_size = 64\n state.gravity = -0.2\n state.player_width = 60\n state.player_height = 64\n state.collision_tolerance = 0.0\n state.previous_tile_size ||= state.tile_size\n state.x ||= 0\n state.y ||= 800\n state.dy ||= 0\n state.dx ||= 0\n attempt_load_world_from_file\n state.world_lookup ||= { }\n state.world_collision_rects ||= []\n state.mode ||= :creating # alternates between :creating and :selecting for sprite selection\n state.select_menu ||= [0, 720, 1280, 720]\n #=======================================IMPORTANT=======================================#\n # When adding sprites, please label them \"image1.png\", \"image2.png\", image3\".png\", etc.\n # Once you have done that, adjust \"state.sprite_quantity\" to how many sprites you have.\n #=======================================================================================#\n state.sprite_quantity ||= 20 # IMPORTANT TO ALTER IF SPRITES ADDED IF YOU ADD MORE SPRITES\n state.sprite_coords ||= []\n state.banner_coords ||= [640, 680 + 720]\n state.sprite_selected ||= 1\n state.map_saved_at ||= 0\n\n # Sets all the cordinate values for the sprite selection screen into a grid\n # Displayed when 's' is pressed by player to access sprites\n if state.sprite_coords == [] # if sprite_coords is an empty array\n count = 1\n temp_x = 165 # sets a starting x and y position for display\n temp_y = 500 + 720\n state.sprite_quantity.times do # for the number of sprites you have\n state.sprite_coords += [[temp_x, temp_y, count]] # add element to sprite_coords array\n temp_x += 100 # increment temp_x\n count += 1 # increment count\n if temp_x > 1280 - (165 + 50) # if exceeding specific horizontal width on screen\n temp_x = 165 # a new row of sprites starts\n temp_y -= 75 # new row of sprites starts 75 units lower than the previous row\n end\n end\n end\n end", "def generate_starting_live_cells\n\t\tcells = []\n\t\tcell_count.times do\n\t\t\tstart_x = rand(size) # [0..4]\n\t\t\tstart_y = rand(size) # [0..4]\n\t\t\tcell = Cell.new(start_x, start_y)\n\n\t\t\tcells << cell\n\t\t\tupdate_board(cell)\n\t\tend\n\t\tcells\n\tend", "def setup_grid(skip_render, skip_set_pieces)\n @grid = Array.new(8) { Array.new(8) { EmptySquare.new } }\n unless skip_set_pieces\n set_major_minor\n set_pawns\n end\n\n render unless skip_render\n end", "def test_that_full_tile_rack_doesnt_need_any_tiles\n 7.times{|num| @newTileRack.append(:A)}\n assert_equal(0,@newTileRack.number_of_tiles_needed)\n end", "def puzzle(sudoku)\n sudoku.map {|x| rand < 0.75 ? 0 : x } \nend", "def generateBoard(row, col, num_mines)\n# Step 1 create board\n board = Array.new(row) { Array.new(col) {-1}}\n# Step 2 place random mines on board\n until num_mines < 1\n temp_x = rand(row)\n temp_y = rand(col)\n \n if board[temp_x][temp_y] != \"*\"\n board[temp_x][temp_y] = \"*\" \n num_mines -= 1 \n end\n end\n \n# Step 3 Iterate each tile skipping mines\n board.each_index do |x|\n board.each_index do |y|\n next if board[x][y] == \"*\"\n count = 0\n \n # Step 3a\n # check within bounds and count mines\n min_x = x - 1\n max_x = x + 1\n min_y = y - 1\n max_y = y + 1\n \n (min_x..max_x).each do |x|\n (min_y..max_y).each do |y|\n if (x >= 0 && x < row) && (y >= 0 && y < col)\n count += 1 if board[x][y] == \"*\"\n end\n end\n end\n \n board[x][y] = count\n end\n end\n \n # return board\n board\nend", "def random_figures(x=0)\n x + Kernel.rand\n end", "def make_random_map\n entire_map = []\n 20.times do\n single_row = []\n 20.times do \n if rand(2) == 1\n single_row << :room\n else\n single_row << :wall \n end \n end \n entire_map << single_row\n end\n entire_map\nend", "def init_tile_image\n list = Magick::ImageList.new(\"/Users/pmenke/git/eq2_tiler/resources/tiler/overlay-base.png\")\n @i = list.first\n @i\n end", "def render_board\n\n\t\t# So, we'll rebuild the render target from scratch\n\t\t(0...@height).each do |row|\n\t\t\t(0...@width).each do |col|\n\n\t\t\t\t# Save myself some typing, and some math cycles...\n\t\t\t\tcell_idx = (row*@width)+col\n\n\t\t\t\t# Check to see if this cell is covered\n\t\t\t\tif @cell_status[cell_idx] == :status_covered\n\t\t\t\t\tcell = @cover_png\n\t\t\t\telsif @cell_status[cell_idx] == :status_gold\n\t\t\t\t\tcell = @gold_png\n\t\t\t\telse\n\t\t\t\t\tif @dragons[cell_idx] == DRAGON\n\t\t\t\t\t\tcell = @dragon_png\n\t\t\t\t\telse\n\t\t\t\t\t\tcell = @cell_png[@dragons[cell_idx]]\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t# We know what to draw, so draw it\n\t\t\t\t$gtk.args.render_target( :board ).width = @board_w\n\t\t\t\t$gtk.args.render_target( :board ).height = @board_h\n\t\t\t\t$gtk.args.render_target( :board ).sprites << {\n\t\t\t\t\tx: (col*@cell_size), y: (row*@cell_size),\n\t\t\t\t\tw: @cell_size, h: @cell_size, path: cell,\n\t\t\t\t}\n\n\t\t\tend\n\n\t\tend\n\n\tend", "def draw_ranges(positions, type)\n t = Time.now\n positions.flatten.compact.each_index{|id| tile = positions.flatten.compact[id]\n $spriteset.r_tilemap.map_data[tile[0], tile[1], 0] = $spriteset.tilemap.map_data[tile[0], tile[1], 0]\n $spriteset.r_tilemap.map_data[tile[0], tile[1]-1, 1] = $spriteset.tilemap.map_data[tile[0], tile[1]-1, 1] if tile[1] > 0\n }\n puts Time.now - t\n @ranges = [Sprite.new]\n $spriteset.show_ranges(true)\n \n \n=begin\n positions.flatten.compact.each_index{|id| tile = positions.flatten.compact[id]\n if valid?(tile[0], tile[1])\n if type <= 2\n $move_ranges[id].reinit(type, tile.x, tile.y )\n @ranges.push($move_ranges[id] )\n else\n $target_ranges[id].reinit(type, tile.x, tile.y )\n @locations.push($target_ranges[id] )\n end\n end\n }\n # Seems to help display the tiles better?\n # Graphics.frame_reset\n=end\n\n end", "def puzzle(sudoku, difficulty=5)\n sudoku.map do\n |number|\n rand(difficulty) == 1 ? 0 : number\n end\nend", "def no_of_blocks\n @highlighted_blocks = \"\"\n blocks = Random.rand(5) + 1\n blocks.times {|count|\n row = Random.rand(5)\n column = Random.rand(5)\n @highlighted_blocks << \"#button_#{row}_#{column} \"\n }\n end", "def clearAll\n for y in 0...10\n for x in 0...8\n if( @gridBoard[[x,y]] != nil )\n @gridBoard[[x,y]].clear_icon()\n end\n end\n end\n end", "def draw(number)\n @letter_bag = @letter_bag.shuffle\n letters = @letter_bag.pop(number)\n return letters\n end", "def draw_fixed_grid(rect, cols, rows, shade=active_shade, state=active_state)\n rect = Convert.Rect(rect)\n w = rect.width\n h = rect.height\n rows.times do |y|\n cols.times do |x|\n draw_shade_rect(r.step(6, x).step(2, y), shade, state)\n end\n end\n end", "def draw_tile_a_other(x, y, id)\n autotile = adjust_autotile_id((id - 2048) / 48)\n index = (id - 2048) % 48\n a1 = autotile < 32\n settings = settings_for_autotile(autotile)\n local = AUTOTILE_LOCAL[autotile]\n bmp = bitmap_for_autotile(autotile)\n tx = settings[local, KEY_X]\n ty = settings[local, KEY_Y]\n rule = settings[local, KEY_DRAWING_RULE]\n dx, dy = x * TILESIZE, y * TILESIZE\n @animated_layers.each_with_index do |l, i|\n sx = tx\n sy = ty\n case rule\n when DRAWING_RULE_WATERFALL\n @debug.puts \"Drawing Waterfall: autotile=#{autotile} frame=#{i} from=#{[sx, sy]}\"\n sy += i * TILESIZE\n draw_waterfall_tile(index, l, dx, dy, bmp, sx, sy)\n when DRAWING_RULE_2x2\n @debug.puts \"Drawing 2x2: autotile=#{autotile} from=#{[sx, sy]}\"\n draw_2x2_autotile(index, l, dx, dy, bmp, sx, sy)\n when DRAWING_RULE_2x3\n @debug.puts \"Drawing 2x3: autotile=#{autotile} frame=#{i} from=#{[sx, sy]}\"\n sx += i * TILESIZE2 if a1\n draw_2x3_autotile(index, l, dx, dy, bmp, sx, sy)\n else\n fail \"Invalid DRAWING_RULE #{rule}\"\n end\n end\n end", "def generate_grid(grid_size)\n Array.new(grid_size) { ('A'..'Z').to_a.sample } # random grid of letter\n end", "def tiles_remaining\n @default_tiles.values.inject(0, :+)\n end", "def render_all_cuts gcode\n gcode.preamble :feed => @config[:cut_feed]\n @config[:repeat][1].times do |ytile|\n @config[:repeat][0].times do |xtile|\n render_cut gcode, x_inches(xtile, 0), y_inches(ytile, 0)\n end\n end\n gcode.epilogue\n end", "def render_all_cuts gcode\n gcode.preamble :feed => @config[:cut_feed]\n @config[:repeat][1].times do |ytile|\n @config[:repeat][0].times do |xtile|\n render_cut gcode, x_inches(xtile, 0), y_inches(ytile, 0)\n end\n end\n gcode.epilogue\n end" ]
[ "0.86820465", "0.86295307", "0.8612073", "0.7949857", "0.7522328", "0.7329977", "0.6906661", "0.65693945", "0.6539872", "0.65116554", "0.64489454", "0.6424747", "0.6195311", "0.60963607", "0.6067721", "0.6057823", "0.60171074", "0.60163486", "0.59250975", "0.5908385", "0.5901998", "0.5894113", "0.58881193", "0.58228713", "0.58189917", "0.5758677", "0.57260096", "0.56963587", "0.56824195", "0.56736463", "0.5671869", "0.56442904", "0.5636325", "0.56221557", "0.5609038", "0.56063944", "0.55975705", "0.55863863", "0.5578279", "0.55678976", "0.5560811", "0.55521256", "0.5536933", "0.5493339", "0.5487734", "0.5478374", "0.5470814", "0.5433007", "0.5426102", "0.5425275", "0.53996426", "0.53964466", "0.53952575", "0.53951746", "0.53848016", "0.53804326", "0.53520685", "0.53471166", "0.5337745", "0.53325343", "0.5327641", "0.53179157", "0.53148586", "0.5310924", "0.5309351", "0.53038365", "0.52980614", "0.5293886", "0.52937216", "0.5279105", "0.5274012", "0.52709496", "0.5261464", "0.5258997", "0.52576715", "0.5249233", "0.52411765", "0.5241097", "0.52409726", "0.5231624", "0.5226377", "0.5219013", "0.5216173", "0.52048045", "0.51994383", "0.5174232", "0.5173793", "0.516691", "0.51637954", "0.5160547", "0.5148201", "0.51396054", "0.5136302", "0.5115854", "0.510598", "0.5102373", "0.50910354", "0.50850314", "0.50731164", "0.50731164" ]
0.8365043
3
def category_attributes=(categories_attributes) category_attributes.values.each do |category_attribute| category = Category.find_or_create_by(category_attribute) self.post_categories.build(category: category) end end
def comments_count self.comments.count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories_attributes=(categories)\n \tcategories.each do |index, category_hash|\n \t\tif category_hash[:name].present?\n\t\t\tcategory = Category.find_or_create_by(name: category_hash[:name])\n\t\t\tif !self.categories.include?(category)\n\t\t\t self.post_categories.build(:category => category) \n\t\t\tend\n end\n \tend\n end", "def categories_attributes=(category_attributes)\t\n category_attributes.values.each do |category_attribute|\t\n category = Category.find_or_create_by(category_attribute)\t\n self.categories << category\t\n end\t\n end", "def categories_attributes=(categories_hashes)\n categories_hashes.each do |i, category_attributes|\n if category_attributes[:name].present?\n category = Category.find_or_create_by(name: category_attributes[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def category_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end", "def categories_attributes=(categories_hashes)\n categories_hashes.each do |index, categories_attributes|\n if categories_attributes[:name].present?\n category = Category.find_or_create_by(name: categories_attributes[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def categories_attributes=(categories_hashes)\n # raise categories_hashes.inspect\n # {\"0\"=>{\"name\"=>\"new cat 1\"}, \"1\"=>{\"name\"=>new cat 2\"}}\n categories_hashes.each do |index, category_attributes|\n #need to create a category that is alrady assoicated with this post and make sure that this cateogry doesn't already exist\n\n #DO NOT CREATE A CATEGOERY if it doesn't have a name\n if category_attributes[:name].present?\n # also don't add a category if it already has it\n\n category = Category.find_or_create_by(name: category_attributes[:name])\n if !self.categories.include?(category)\n # post_categories\n # self.categories<< category\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def categories_attributes=(category_hashes)\n #hash looks like this {\"0\"={name:\"New Category\"}, \"1\"={name:\"Other New Category\"}}\n #for every value in the categoery_attributes hash...\n category_hashes.value.each do |i,category_attr|\n #each will be this: {name:\"New Category\"} - a hash that can be used to create a new cateogry\n #find or create a category by that attribute (will pass key and value in?)\n category=Category.find_or_create_by(name: category_attr[:name])\n\n #make a new post_category instance using the category\n #will make a new post_category with post_id of self.id and category_id of category.id\n self.post_categories.build(category:category)\n end\n end", "def categories_attributes=(categories_hash)\n # {\"0\"=>{\"name\"=>\"Romance\"}, \"1\"=>{\"name\"=>\"\"}}\n # raise categories_attributes.inspect\n categories_hash.each do |index, category_attribute|\n # find or create if post doesn't have this category BAD\n # self.category.find_or_create_by(name: category_attribute[:name])\n # find or create if this post doesn't exist yet GOOD\n if category_attribute[:name].present?\n category = Category.find_or_create_by(name: category_attribute[:name])\n if !self.categories.include?(category)\n self.post_categories.build(:category => category)\n end\n end\n end\n end", "def categories_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n if !category_attribute[:name].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end \n \n end", "def categories_attributes=(category_attributes)\n # byebug\n category_attributes.values.each do |category_attribute|\n unless category_attribute['name'].empty?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category \n end \n end\n end", "def categories_attributes=(category_hashes)\n # needed so post new form can be used to create categories_attributes\n category_hashes.each do | index, category_attributes |\n if category_attributes[:name].present?\n category = Category.find_or_create_by(name: category_attributes[:name])\n # if category already exists for post, don't add it\n if !self.categories.include?(category)\n self.categories << category # inefficient!\n self.save\n end\n end\n end\n end", "def categories_attributes=(category_attributes)\n category_attributes.values.each do |category_attribute|\n if category_attribute[\"name\"].present?\n category = Category.find_or_create_by(category_attribute)\n self.categories << category\n end\n end\n end", "def category_attributes=(category_attributes) # setter\n # raise category_attributes.inspect\n category_attributes.keys.each do |key|\n categories.new(category_attributes[key])\n end\n end", "def categories_attributes=(categories_attributes)\n categories_attributes.values.each do |category_attributes|\n if category_attributes[:id].nil? and category_attributes[:name].present?\n category = Category.find_by_name(category_attributes[:name])\n if category.present?\n category_attributes[:id] = category.id\n ## FIXME? check if we are adding twice?\n self.categories << category\n end\n end\n end\n assign_nested_attributes_for_collection_association(:categories, categories_attributes.values, mass_assignment_options)\n end", "def category_attributes=(category_attributes) # arg. will be key value pair to search for/create\n self.category = Category.find_or_create_by(category_attributes)\n end", "def categories_attributes=(categories_hashes) #writer\n #{\"0\"=>{\"name\"=>\"new catogory 1\"}, \"1\"=>{\"name\"=>\"new catogory 2\"}}\n #raise category_hashes.inspect\n #How would I create a catogory for each of the hashes inside categories_hashes\n categories_hashes.values.each do |category_attributes|\n\n #DO NOT CREATE A CATEGORY IF IT DOESN'T HAVE NAME\n #if category_attributes[:name].present?\n\n #create a new catogory if this post doesn't already have this catogory\n #find or create the catogory regardless of whether this post has it.\n category = Category.find_or_create_by(category_attributes)\n #ALSO DON'T DUPLICATE POST IF IT ALREADY HAVE IT.\n #How do i check if this post has this category already?\n if !self.categories.include?(category)\n #this is ineffecient because it will pull all catogories\n #self.categories << category 47:55\n self.post_categories.build(:category => category)\n\n #I need to create a catogory that is already associated with this post\n # and i need to make sure that this category already doesn't exist by name.\n end\n #end\n end\n\n end", "def categories_attributes=(attributes)\n attributes.each do |index, attribute|\n unless attribute[:title].blank? || self.categories.map(&:title).include?(attribute[:title])\n existing_category = self.categories[index.to_i]\n if existing_category == nil\n new_category = Category.create(title: attribute[:title])\n self.categories << new_category\n else\n existing_category.update(title: attribute[:title])\n end\n end\n end\n end", "def category_attributes=(attributes)\n if !attributes[:name].blank?\n self.category = Category.find_or_create_by(attributes)\n end\n end", "def set_categories(ids)\n self.categories = Category.find(ids)\n self.save\n end", "def create\n @post = Post.new(post_params)\n if @post.save\n @post.category_ids = params[\"post\"][:category_ids]\n @post.tag_ids = params[\"post\"][:tag_ids]\n redirect_to [:admin, @post], notice: 'Post has been successfully created.'\n else\n flash.now[:alert] = 'Post creation failed.'\n render :new\n end\n end", "def set_categories_post\n @categories_post = CategoriesPost.find(params[:id])\n end", "def exercise_category_attributes=(category)\n self.exercise_category = ExerciseCategory.find_by_id(category[:category])\n unless self.exercise_category\n self.exercise_category = ExerciseCategory.find_or_initialize_by_category(category)\n end\n end", "def assign_category(categories_id)\n categories_id = [categories_id] if categories_id.is_a?(Integer)\n rescue_extra_data\n categories_id.each do |key|\n term_relationships.where(:term_taxonomy_id => key).first_or_create!\n end\n update_counters(\"categories\")\n end", "def categories=(categories)\n end", "def update_product_category\n return true if self.category.blank?\n categories = self.category.ancestors.collect{|x| x.id}.reverse.push(self.category.id)\n category_names = self.category.ancestors.collect{|x| x.name.downcase}.reverse.push(self.category.name.downcase).join(\" | \")\n product_cat = ProductCat.find_or_create_by_product_id(self.id)\n product_cat.fourth_category_id = categories[3] unless categories[3].blank?\n product_cat.third_category_id = categories[2] unless categories[2].blank?\n product_cat.second_category_id = categories[1] unless categories[1].blank?\n product_cat.first_category_id = categories[0] unless categories[0].blank?\n product_cat.categories_delimited = category_names\n product_cat.user = self.user\n product_cat.save\n end", "def images_attributes=(image_attributes)\n image_attributes.each do |attributes| \n post_images.build(attributes) \n end\n end", "def assign_categories \n if @category_names \n self.categories = @category_names.split(/\\s+/).map do |name|\n Category.find_or_create_by_name(name)\n end\n end\n end", "def create\n @categories_post = CategoriesPost.new(categories_post_params)\n\n respond_to do |format|\n if @categories_post.save\n format.html { redirect_to @categories_post, notice: 'Categories post was successfully created.' }\n format.json { render :show, status: :created, location: @categories_post }\n else\n format.html { render :new }\n format.json { render json: @categories_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category_options = Category.all.map{|u| [u.title, u.id]}\n @post = Post.new(post_params)\n @post.user_id = current_user.id\n\n if @post.save\n # redirect_to posts_path\n redirect_to post_path(@post)\n else\n render :new\n end\n end", "def create_mobile\n begin\n @post = Post.new(post_params)\n if @post.save\n unless params[:post][:category].nil? || params[:post][:category].empty?\n params[:post][:category].each do |category_param|\n category = Category.where(name: category_param).first\n unless category.nil?\n type = PostType.new(post_id: @post.id, category_id: category.id)\n type.save!\n end\n end\n end\n render json: @post\n else\n render json: @post.errors, status: :unprocessable_entity \n end\n rescue\n render json: @post.errors, status: :unprocessable_entity \n end\n end", "def create\n @category = Category.new(category_params)\n @category.save\n end", "def create\n @category = Category.new(category_params)\n @category.save\n end", "def attributes=(attributes, guard_protected_attributes = true)\r\n attributes.symbolize_keys!\r\n category_ids = attributes.delete(:category_ids)\r\n returning super do update_categories category_ids if category_ids end\r\n end", "def create\n @post = Post.new(params[:post])\n @categories = Category.all\n @tags = Tag.all\n\n @post.created_by = current_user.id\n @post.order_date = Time.current\n\n p_tags = params[:all_tags]\n p_tag_new = params[:tag_new]\n\n @post.category_id = request.POST[:category]\n\n respond_to do |format|\n if @post.save\n if !p_tag_new.empty?\n tag_new = Tag.new(:tag_name => p_tag_new)\n if tag_new.save\n tag_map = PostsTag.new(:post_id => @post.id, :tag_id => tag_new.id)\n tag_map.save\n end\n end\n\n if !p_tags.empty?\n split_tags = p_tags.split(\",\")\n split_tags.each_index do |i|\n tag_id = split_tags[i]\n\n tag_map = PostsTag.new(:post_id => @post.id, :tag_id => tag_id)\n tag_map.save\n end\n end\n\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render json: @post, status: :created, location: @post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories_post_params\n params.require(:categories_post).permit(:post_id, :category_id)\n end", "def post_params\n params.require(:post).permit(:title, :body, categories_ids: [])\n end", "def create \n\n user = User.find(@user_id)\n post = user.posts.build(params_post)\n \n category = Category.find_by_id(params[:category])\n return render json: { error: \"Category not found\"}, status: 404 if category.nil?\n \n post.category = category\n \n \n if post.save\n render json: post, status: :created\n else \n render json: post.errors, status: :unprocessable_entity\n end\n end", "def seed_categories\n ['Shelter', 'Food', 'Health', 'Jobs/Training'].each do |name|\n Category.find_or_create_by(name: name)\n end\nend", "def post_params\n params.require(:post).permit(:id, :title, :excerpt, :body, :slug, :publish_date, :category_ids => [], categories_attributes: [:id, :name] )\n end", "def create\n @category = PostCategory.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to cm_post_categories_url, notice: 'PostCategory was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categoria_post = CategoriaPost.new(categoria_post_params)\n @categoria = Categoria.find(params[:categoria_id])\n @post = Post.find(params[:post_id])\n @categoria_post.post = @post\n @categoria_post.categoria = @categoria\n\n respond_to do |format|\n if @categoria_post.save\n format.html { redirect_to @post, notice: 'As categorias foram adicionadas ao post.' }\n format.json { render :show, status: :created, location: @categoria_post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_cat(name_en, name_nl)\n c = Category.new(name_en: name_en, name_nl: name_nl)\n c.save!\nend", "def set_categories\n @categories = Category.all\n end", "def tags_attributes=(tag_attributes)\n tag_attributes.values.each do |tag_name|\n tag_name.values.each do |tag|\n tag.split(\", \").each do |name|\n tag = Tag.find_or_create_by(name: name)\n tag.slug = tag.to_slug\n tag.save\n self.tags << tag\n end\n end\n end\n end", "def category_name=(name)\n self.category = Category.find_or_create_by(name: name)\n self.save\n end", "def post_params\n params.require(:post).permit(:title, :content, category_ids: [])\n end", "def categories=(categories)\n @categories = categories\n end", "def update_categories(cats=[])\n rescue_extra_data\n cats = cats.to_i\n old_categories = categories.pluck(\"#{CamaleonCms::TermTaxonomy.table_name}.id\")\n delete_categories = old_categories - cats\n news_categories = cats - old_categories\n term_relationships.where(\"term_taxonomy_id in (?)\", delete_categories ).destroy_all if delete_categories.present?\n news_categories.each do |key|\n term_relationships.create(:term_taxonomy_id => key)\n end\n update_counters(\"categories\")\n end", "def create\n @post_category = current_user.post_categories.build(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to [:client,:post_categories], notice: 'Post category was successfully created.' }\n format.json { render json: @post_category, status: :created, location: @post_category }\n else\n format.html { render action: \"index\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n author_id = blog_post_params.delete(:author_id)\n @all_categories = get_all_categories \n\tchecked_categories = get_categories_from(params[:categories])\n\tremoved_categories = @all_categories - checked_categories\n\t@blog_post = BlogPost.new(blog_post_params)\n\t@blog_post.author = User.find(author_id)\n\t\n if @blog_post.save\n checked_categories.each {|cat| @blog_post.categories << cat if !@blog_post.categories.include?(cat)}\n removed_categories.each {|cat| @blog_post.categories.delete(cat) if @blog_post.categories.include?(cat)}\n redirect_to(:action => \"list\")\n flash[:notice] = \"Blog Post Created.\"\n else\n @user_list = get_user_list\n render('new') \n end\n end", "def create\n auction_category = Auction::Category.new(auction_category_params)\n\n begin\n if auction_category.save_category!(params[:auction_category][:attribute_ids])\n flash_msg('success', '添加分类成功!', 'index')\n end\n rescue Exception => e\n flash_render('danger', \"添加分类失败!#{error_msg(auction_category)}\", 'new')\n end\n end", "def assign_categories_for_admin\n categories = Category.all\n @categories = []\n categories.each { |category| @categories << [category.name, category.id] }\n end", "def create\n authorize! :create, @post\n @post = Post.new(params[:post])\n @post.user_id = current_user.id\n @post = Post.create(params[:post_category])\n @post.post_category = PostCategory.find(params[:category_id]) if params[:category_id]\n \n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_categories\n @categories = Category.order(:name).pluck(:name, :id)\n end", "def create\n begin\n @post = Post.new(post_params)\n if @post.save\n unless params[:post][:category].nil? || params[:post][:category].empty?\n params[:post][:category].each do |category_param|\n category = Category.where(name: category_param).first\n unless category.nil?\n type = PostType.new(post_id: @post.id, category_id: category.id)\n type.save!\n end\n end\n end\n if params[:post][:images]\n params[:post][:images].each do |image|\n asset = Asset.find_by_id(image.to_i)\n if asset\n @post.assets << asset\n end\n end\n end\n @post.save!\n render json: @post.to_json(:include => { :categories => { :only => [:name]}}), status: :ok\n else\n render json: @post.errors, status: :unprocessable_entity \n end\n rescue\n render json: @post.errors, status: :unprocessable_entity \n end\n end", "def create\n @category = Category.new(category_params)\n\n\n begin\n Category.transaction do # un ActiveRecord\n #@full_category.each do |f|\n #Category.create(f)\n #f.save!\n #end\n @category.save!\n end\n #Código de éxito\n rescue => e\n raise ActiveRecord::Rollback #Lanzamos el rollback de nuevo a saco\n #Seguimos con las acciones que queramos, como notificar, etc.\n end\n\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_categories\n\t\t@categories = Category.all\t\n\tend", "def new\n @post = Post.new\n @category_options = Category.all.map{|u| [u.title, u.id]}\n # @category_options = Category.all\n end", "def add_post_attributes(attributes_hash)\n attributes_hash.each do |attribute, value|\n self.send(\"#{attribute}=\", value)\n end\n end", "def set_add_category_to_post\n @add_category_to_post = AddCategoryToPost.find(params[:id])\n end", "def user_category\n # byebug\n @user = User.where(contact: params[:contact]).first\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-data\", data: \"category saved\"}, status: :ok\n end", "def create\n @post_category = Post::Category.new(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to @post_category, notice: 'Category was successfully created.' }\n format.json { render json: @post_category, status: :created, location: @post_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_categories\r\n csv = CSV.readlines(File.join('data', 'categories.csv'))\r\n @categories = csv.each_with_object({}) do |(key, val), hsh|\r\n hsh[key] = val\r\n end\r\n\r\n @items.each do |i|\r\n i.category = @categories[i.category]\r\n end\r\nend", "def create\n @product_category = ProductCategory.new(product_category_params)\n\n @product_category.assign_attributes(product_category_params)\n\n respond_to do |format|\n if @product_category.save\n\n if params[:images] != nil\n params[:images].each do |image|\n ProductCategoryAttacment.create(product_category_id: @product_category.id, image: image)\n end\n end\n format.html { redirect_to edit_administrator_product_category_path(@product_category) , notice: 'Запись добавлена' }\n format.json { render :show, status: :created, location: @product_category }\n else\n format.html { render :new }\n format.json { render json: @product_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def category_names=(names)\n names.each do |name|\n unless name == \"\"\n category = Category.find_or_create_by(name: name)\n self.categories << category unless self.categories.include?(category)\n end\n end\n end", "def create\n @project = Project.new(project_params)\n if params[:project][:category_list].present?\n @project.category_list = []\n params[:project][:category_list].each do |cat|\n @project.category_list.add(cat)\n end \n end\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Project was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_categories(product)\n categories = value('category').split('&')\n\n categories.each do |category_string|\n category_string.strip!\n subcategories = category_string.split('>')\n parent_id = self.root_category.id\n subcategories.each do |category_url_key|\n category_url_key.strip!\n category = Gemgento::Category.find_by(url_key: category_url_key, parent_id: parent_id)\n unless category.nil?\n pc = Gemgento::ProductCategory.find_or_create_by!(category: category, product: product, store: self.store)\n parent_id = category.id\n pc.sync_needed = true\n pc.save\n else\n self.process_errors << \"Row ##{@index}: Unknown category url key '#{category_url_key}' - skipped\"\n end\n end\n end\n end", "def create\n @categories = Category.all\n\n @category = Category.create(category_params)\n flash[:notice]=\"Catégorie créer avec succès!!!\"\n end", "def post_params\n params.require(:post).permit(:title, :content, category_ids: [])\n end", "def create\n @user = current_account\n # @category = Category.new(category_params)\n @category = @user.categories.build(category_params)\n respond_to do |format|\n if @category.save\n unless params[:images].nil?\n params[:images]['url'].each do |img|\n @image = @category.images.create!(url: img, category_id: @category.id)\n end\n end\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render :index, status: :created, location: @category } \n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_params\n params.require(:post).permit(:title, :content, :image, :status, :authority, category_ids: [])\n end", "def create\n @product = Product.new(params[:product])\n @product.image = params[:image] if params[:image]\n #params[:product][:category_ids].each{|c|\n # @product.category = c\n #}\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @add_category_to_post = AddCategoryToPost.new(add_category_to_post_params)\n\n respond_to do |format|\n if @add_category_to_post.save\n format.html { redirect_to @add_category_to_post, notice: 'Add category to post was successfully created.' }\n format.json { render :show, status: :created, location: @add_category_to_post }\n else\n format.html { render :new }\n format.json { render json: @add_category_to_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def associante_and_create_contact_categories(contact_type,attributes={})\n category = eval(contact_type.class_name)\n category = category.new(attributes)\n if category.valid?\n category.save\n contact_category = ContactCategory.new\n contact_category.contact_id = id\n contact_category.category_id = category.id\n contact_category.category_type = category.class.to_s\n contact_category.contact_type_id = contact_type.id\n contact_category.save\n end\n end", "def category_params\n if params[:category][:categories_attributes].present?\n params[:category][:categories_attributes].keys.each do |k|\n params[:category][:categories_attributes][k.to_s][:branch_id] = @current_branch.id\n params[:category][:categories_attributes][k.to_s][:shop_id] = @current_shop.id\n end\n end\n params.require(:category).permit(:name, categories_attributes: [:id, :name, :_destroy, :branch_id, :shop_id, :position])\n end", "def create\n @post_category = PostCategory.new(post_category_params)\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to '/administrator/post_categories', notice: 'Product category was successfully created.' }\n format.json { render :index, status: :created, location: @post_category }\n else\n format.html { render :new }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_category\r\n @product = Product.find(params[:product_id])\r\n # @product.categories.delete_all\r\n @product.category=Category.find(params[:id])\r\n @product.save\r\n end", "def create\n @category = Category.create(params[:category])\n \n if @category.save\n redirect_to categories_path\n else\n render 'new'\n end\n \n end", "def create\n\t\t@categories = Category.all.reject { |c| c.name == \"All\" }.map{|c| [c.name, c.id] }\n\t\t@post = current_user.posts.build(post_params)\n\t\t@post.completed = false;\n\t\tif @post.save\n\t\t\tredirect_to @post, notice: \"Post submitted successfully\"\n\t\telse\n\t\t\trender 'new' #else render the form again\n\t\tend\n\tend", "def create\n \n @category = Category.new(category_params)\n @category.category = @category.category.strip\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n \n \n end", "def save_hot_products_by_category\r\n Subcategory.fill_all_subcategories_of_category(params[:category][:fields][1])\r\n end", "def new\n\t\t@categories = Category.all.reject { |c| c.name == \"All\" }.map{|c| [c.name, c.id] }\n\t\t@post = current_user.posts.build\n\tend", "def post_params\n params.require(:post).permit(:name, :title, :content, category_ids: [])\n end", "def create\n json_create(category_params, Category)\n end", "def update\n # recipe_params[:ingredient_lists_attributes].each do |list|\n # list.each do |item|\n # item[:ingredient_attributes] = Ingredient.where(name: item[:ingredient_attributes].name).first_or_create\n # end\n # end\n \n # category_ids = params[:recipe][:categories_attributes].map { |k,v| v[:id] }\n # #pry.debugger\n \n # recipe_params.merge({ category_ids: category_ids })\n \n\n respond_to do |format|\n \n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_variables_for_create\r\n @category = Category.find_by_id(params[:category_id])\r\n @quiz = Quiz.new(params[:quiz].merge!(:user_id => current_user.id))\r\n @quiz.category = @category\r\n end", "def new\n @item = Item.new\n @item.item_categories.build\n end", "def set_post_category\n @post_category = PostCategory.find_by_name(to_de_param(params[:id]))\n end", "def set_category\n @category = PostCategory.find(params[:id])\n end", "def seed_categories\n template_categories = [\"Toys\",\"Cards\",\"Games\",\"Misc\"]\n template_categories.each do |category|\n Category.create(name: category)\n end\n puts \"created categories\"\nend", "def create\n @post_category = PostCategory.new(params[:post_category])\n \n respond_to do |format|\n if @post_category.save\n format.html { redirect_to(@post_category, :notice => 'Category was successfully created.') }\n format.xml { render :xml => @post_category, :status => :created, :location => @post_category }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post_category.errors, :status => :unprocessable_entity }\n end\n end\n end", "def categories=(value)\n\t\t@categories = value\n\tend", "def categories=(value)\n\t\t@categories = value\n\tend", "def categories=(value)\n\t\t@categories = value\n\tend", "def create_category\n @category = TestCategory.new(params[:category])\n @category.save\n @categories = TestCategory.find(:all)\n redraw 'categories'\n end", "def set_post_category\n @post_category = PostCategory.find(params[:id])\n end", "def categories=(value)\n @categories = value\n end", "def create\n \n category = params[:category]\n category_name = category['name']\n \n write_log(\"category.to_s: #{category.to_s}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n cats = []\n if category_name != nil\n cats = category_name.split(\" \")\n end\n \n write_log(\"cats.size: #{cats.size}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n if cats.size > 1\n \n flag = true\n counter = 0\n \n cats.each do |cat|\n # @category = Category.new(params[:category])\n # @category = Category.new(name=cat)\n @category = Category.new({\"name\"=> cat, \"genre_id\"=> category['genre_id']})\n \n if @category.save\n else\n counter += 1\n end\n end#cats.each do |cat|\n \n respond_to do |format|\n format.html { redirect_to @category, \n notice: \"New categories: Created => #{cats.size - counter}, Failed => #{counter}\" }\n format.json { render json: @category, status: :created, location: @category }\n end\n \n else#if cats.size > 1\n @category = Category.new(params[:category])\n \n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end#if cats.size > 1\n \n \n # @category = Category.new(params[:category])\n# \n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def category_params\n params.require(:post_category).permit(:name)\n end", "def create\n #Creates the category to be saved in the db\n @category = Category.new(params[:category])\n @all_categories = Category.all\n\n #Set Component Group to nil\n if(!@category.parent_id.nil?)\n @category.parent_id = nil\n end\n #Sets Component Group with new params\n if(!params[:parent_ids].nil?)\n for id in params[:parent_ids]\n @category.parent_id = id\n end\n end\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = current_mall.categories.new(params[:category])\n\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end" ]
[ "0.9196664", "0.8975524", "0.8964696", "0.88729185", "0.8813736", "0.8779456", "0.86788046", "0.86400026", "0.8604089", "0.85728335", "0.8567538", "0.84818256", "0.8350258", "0.8240415", "0.8079144", "0.78853565", "0.78066444", "0.7540729", "0.6951708", "0.6667189", "0.65911824", "0.65167016", "0.6501497", "0.6498885", "0.6493457", "0.64933115", "0.64722836", "0.64600056", "0.6438643", "0.6421132", "0.64172727", "0.64172727", "0.64112824", "0.6403523", "0.636614", "0.63277817", "0.627954", "0.62718254", "0.62455237", "0.62008405", "0.61785674", "0.61708534", "0.6155068", "0.61315185", "0.61272377", "0.61193043", "0.61062545", "0.6091513", "0.60906273", "0.60865766", "0.6062506", "0.6058659", "0.6053905", "0.6030266", "0.6026575", "0.60087353", "0.6007001", "0.599463", "0.59627223", "0.5961422", "0.595126", "0.5947599", "0.5945465", "0.59337294", "0.5920984", "0.59074324", "0.59073144", "0.5906692", "0.58944494", "0.5889391", "0.588339", "0.5878142", "0.5876506", "0.58742726", "0.58641243", "0.58618456", "0.58569396", "0.58530396", "0.58405596", "0.5840382", "0.58341604", "0.5820151", "0.581747", "0.5812854", "0.5798205", "0.57906556", "0.57862186", "0.57820773", "0.57817405", "0.5754919", "0.5743199", "0.5723912", "0.5723912", "0.5723912", "0.5722012", "0.57159936", "0.5713228", "0.5707712", "0.5706545", "0.57024175", "0.56851906" ]
0.0
-1
create a Module, Class, and lambda
def setup super @append_a = Module.new @append_a.define_singleton_method(:call) do |thing| thing << 'a' thing end @append_b = Class.new @append_b.define_singleton_method(:call) do |thing| thing << 'b' thing end @append_c = lambda do |thing| thing << 'c' thing end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_module(name, &block)\n mod = Module.new(&block)\n @managed.const_set(name, mod)\n mod\n end", "def make_function(exp, register = true)\n name = map_name exp.shift\n args = exp.shift\n ruby_args = args.deep_clone\n ruby_args.shift # :args\n\n @method_name = name\n @c_method_name = \"rrc_c#{@c_klass_name}_#{normal_to_C name}\"\n\n @env.scope do\n c_args = check_args args, register # registered methods get self\n @methods[name] = ruby_args if register\n\n body = process exp.shift\n\n if name == :initialize then\n body[-1] = \"return self;\\n}\"\n end\n\n return \"static VALUE\\n#{@c_method_name}#{c_args} #{body}\"\n end\n end", "def new\n raise('Sorry, modules cannot be instantiated!') if @is_module\n \n RObject.new self\n end", "def make_app(&blk)\n handler = Class.new(TestApp)\n handler.class_eval(&blk)\n handler\nend", "def __init__ context\n function = Virtual::CompiledMethod.new(:__init__ , [] , Virtual::Integer)\n clazz = Virtual::BootSpace.space.get_or_create_class :Kernel\n method = clazz.resolve_method :main\n me = Virtual::Self.new(Virtual::Reference)\n code = Virtual::Set.new(Virtual::Self.new(me.type), me)\n function.add_code(code)\n function.add_code Virtual::MethodCall.new(method)\n return function\n end", "def lambda; end", "def class() end", "def initialize name, type, callable: nil, request_class: nil, &block\n @name = name\n @type = type\n @request_class = request_class\n @callable = @callable_class = nil\n if callable.respond_to? :call\n @callable = callable\n elsif callable.is_a? ::Class\n @callable_class = callable\n elsif block_given?\n @callable_class = ::Class.new Callable do\n define_method :call, &block\n end\n else\n raise ::ArgumentError, \"No callable given for function\"\n end\n end", "def initialize(name, block)\n @name = name\n @attributes = block.select { |struct| struct.is_a?(AttributeAccessor) }\n\n methods = block.\n select { |struct| struct.is_a?(Function) }.\n each { |m| m.use_as_method }\n\n @constructor = methods.select { |m| m.name == 'init' }[0]\n @constructor = Function.new('init', [], nil) if @constructor.nil?\n @constructor.use_as_method\n @parameters = @constructor.parameters.map { |param| param_namer(param) }\n\n @private_methods = methods.select do |m|\n m.name != 'init' && m.name[0] == '_'\n end\n\n @public_methods = methods.select do |m|\n m.name != 'init' && m.name[0] != '_'\n end\n end", "def new(namespace, name, *args, &block); end", "def after_module(class_node); end", "def create(name)\n\t\t\n\t\t# if (mod_ambiguous[name])\n\t\t#\traise Rex::AmbiguousArgumentError.new(name), \n\t\t#\t\t\"The module name #{name} is ambiguous.\", caller\n\t\t# end\n\n\t\tklass = get_hash_val(name)\n\t\tinstance = nil\n\n\t\t# If there is no module associated with this class, then try to demand\n\t\t# load it.\n\t\tif (klass.nil? or klass == SymbolicModule)\n\t\t\t# If we are the root module set, then we need to try each module\n\t\t\t# type's demand loading until we find one that works for us.\n\t\t\tif (module_type.nil?)\n\t\t\t\tMODULE_TYPES.each { |type|\n\t\t\t\t\tframework.modules.demand_load_module(type + '/' + name)\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tframework.modules.demand_load_module(module_type + '/' + name)\n\t\t\tend\n\n\t\t\tklass = get_hash_val(name)\n\t\tend\n\n\t\t# If the klass is valid for this name, try to create it\n\t\tif (klass and klass != SymbolicModule)\n\t\t\tinstance = klass.new\n\t\tend\n\n\t\t# Notify any general subscribers of the creation event\n\t\tif (instance)\n\t\t\tself.framework.events.on_module_created(instance)\n\t\tend\n\n\t\treturn instance\n\tend", "def register_module_function(object); 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(name, modules)\n @modules, @body = modules, ->(&block) {\n return to_enum unless block\n instance_variable_get(:\"@#{name}\").each(&block)\n self\n }\n end", "def initialize(name,&ruby_block)\n # Checks and sets the name.\n @name = name.to_sym\n # Sets the block for instantiating a task.\n @ruby_block = ruby_block\n # Sets the instantiation procedure if named.\n return if @name.empty?\n obj = self\n HDLRuby::High.space_reg(@name) do |*args|\n obj.instantiate(*args)\n end\n end", "def otCreate(rconstant, &block)\n otObj = $otObjectService.createObject(rconstant.java_class)\n yield otObj\n otObj\nend", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def construct\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def initialize(name,&ruby_block)\n # Check and set the name of the task.\n @name = name.to_sym\n # Generate a name for the scope containing the signals of\n # the task.\n @scope_name = HDLRuby.uniq_name\n\n # # Sets the scope.\n # @scope = HDLRuby::High.cur_scope\n\n # Keep access to self.\n obj = self\n\n \n # The runner input ports by name.\n @runner_inputs = {}\n # The runner output ports by name.\n @runner_outputs = {}\n # The runner inout ports by name.\n @runner_inouts = {}\n \n # # The stopper input ports by name.\n # @stopper_inputs = {}\n # # The stopper output ports by name.\n # @stopper_outputs = {}\n # # The stopper inout ports by name.\n # @stopper_inouts = {}\n \n # The finisher input ports by name.\n @finisher_inputs = {}\n # The finisher output ports by name.\n @finisher_outputs = {}\n # The finisher inout ports by name.\n @finisher_inouts = {}\n\n # Create the namespaces for building the task, its readers\n # its writers and its accessers.\n\n # Creates the namespace of the task.\n @namespace = Namespace.new(self)\n # Make it give access to the internal of the class.\n @namespace.add_method(:runner_input, &method(:runner_input))\n @namespace.add_method(:runner_output, &method(:runner_output))\n @namespace.add_method(:runner_inout, &method(:runner_inout))\n # @namespace.add_method(:stopper_input, &method(:stopper_input))\n # @namespace.add_method(:stopper_output, &method(:stopper_output))\n # @namespace.add_method(:stopper_inout, &method(:stopper_inout))\n @namespace.add_method(:finisher_input, &method(:finisher_input))\n @namespace.add_method(:finisher_output, &method(:finisher_output))\n @namespace.add_method(:finisher_inout, &method(:finisher_inout))\n @namespace.add_method(:runner, &method(:runner))\n # @namespace.add_method(:stopper, &method(:stopper))\n @namespace.add_method(:finisher, &method(:finisher))\n\n # Creates the namespace of the runner.\n @runner_namespace = Namespace.new(self)\n # # Creates the namespace of the stopper.\n # @stopper_namespace = Namespace.new(self)\n # Creates the namespace of the finisher.\n @finisher_namespace = Namespace.new(self)\n @controller_namespace = Namespace.new(self)\n\n # Builds the task within a new scope.\n HDLRuby::High.space_push(@namespace)\n # puts \"top_user=#{HDLRuby::High.top_user}\"\n scope_name = @scope_name\n scope = nil\n HDLRuby::High.top_user.instance_eval do \n sub(scope_name) do\n # Generate the task code.\n ruby_block.call\n end\n end\n HDLRuby::High.space_pop\n\n # Keep access to the scope containing the code of the task.\n @scope = @namespace.send(scope_name)\n # puts \"@scope=#{@scope}\"\n # Adds the name space of the scope to the namespace of the\n # task\n @namespace.concat_namespace(@scope.namespace)\n\n # Gives access to the task by registering its name.\n obj = self\n # HDLRuby::High.space_reg(@name) { self }\n HDLRuby::High.space_reg(@name) { obj }\n end", "def class_def( name, &blk )\r\n class_eval { define_method name, &blk }\r\n end", "def compile(mod); end", "def compile_lambda(scope, args, body)\n compile_defun(scope, @e.get_local, args,body)\n end", "def class=(_arg0); end", "def define &block\n new block\n end", "def initialize(from, to, ops)\n @from = from.is_a?(Symbol) ? Unit.get(from) : from\n @to = to.is_a?(Symbol) ? Unit.get(to) : to\n raise(Error::Transformation, \"Put your lambda in an array\") if block_given?\n @ops = ops\n end", "def namespace(context, **class_or_module, &block)\n manager = Manager.for(context)\n\n case class_or_module\n in { module: Symbol => _creating_module, class: Symbol => _creating_class }\n raise ArgumentError, \"You must choose either class: or module: but not both.\"\n in { class: Symbol => creating_class, ** }\n parent = class_or_module[:parent] || Object\n\n manager.create_class(creating_class, parent: parent, &block)\n in { module: Symbol => creating_module, ** }\n if parent = class_or_module[:parent]\n warn \"An option for :parent was provided as `#{parent}' but was ignored when creating the module: #{creating_module}\"\n end\n\n manager.create_module(creating_module, &block)\n else\n manager.apply(&block)\n end\n end", "def class_def name, &blk\r\n class_eval { define_method name, &blk }\r\n end", "def initialize(mod)\n @method_table = mod.method_table\n @constant_table = mod.constant_table\n @module = mod\n end", "def boot_classes!\n # very fiddly chicken 'n egg problem. Functions need to be in the right order, and in fact we have to define some \n # dummies, just for the other to compile\n obj = get_or_create_class :Object\n [:index_of , :_get_instance_variable , :_set_instance_variable].each do |f|\n obj.add_instance_method Builtin::Object.send(f , @context)\n end\n obj = get_or_create_class :Kernel\n # create main first, __init__ calls it\n @main = Builtin::Kernel.send(:main , @context)\n obj.add_instance_method @main\n underscore_init = Builtin::Kernel.send(:__init__ , @context) #store , so we don't have to resolve it below\n obj.add_instance_method underscore_init\n [:putstring,:exit,:__send].each do |f|\n obj.add_instance_method Builtin::Kernel.send(f , @context)\n end\n # and the @init block in turn _jumps_ to __init__\n # the point of which is that by the time main executes, all is \"normal\"\n @init = Virtual::Block.new(:_init_ , nil )\n @init.add_code(Register::RegisterMain.new(underscore_init))\n obj = get_or_create_class :Integer\n [:putint,:fibo].each do |f|\n obj.add_instance_method Builtin::Integer.send(f , @context)\n end\n obj = get_or_create_class :String\n [:get , :set , :puts].each do |f|\n obj.add_instance_method Builtin::String.send(f , @context)\n end\n obj = get_or_create_class :Array\n [:get , :set , :push].each do |f|\n obj.add_instance_method Builtin::Array.send(f , @context)\n end\n end", "def open_class\n <<-CODE\n int created;\n t1 = stack_pop();\n t2 = staticscope_get_module(cpu_current_scope(state, c));\n next_literal;\n t3 = cpu_open_class(state, c, t2, t1, _lit, &created);\n\n if(AUTOLOAD_P(t3)) {\n cpu_send(state, c, t3, state->global->sym_call, 0, Qnil);\n } else if(t3 != Qundef) {\n stack_push(t3);\n if(created) cpu_perform_hook(state, c, t3, global->sym_opened_class, t1);\n }\n CODE\n end", "def make; end", "def instantiate!; end", "def initialize(logging_lambda, page_add_lambda, page_remove_lambda, collection_by_name_lambda)\r\n @logging_lambda = logging_lambda\r\n @page_add_lambda = page_add_lambda\r\n @page_remove_lambda = page_remove_lambda\r\n @collection_by_name_lambda = collection_by_name_lambda\r\n end", "def class_def(name, &blk)\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def call\n moduleFunction\n end", "def new_anon_class(parent, name=\"\", &proc)\n klass = Class.new(parent) \n mc = klass.instance_eval{ class << self ; self ; end }\n mc.send(:define_method, :to_s) {name}\n klass.class_eval(&proc) if proc\n klass\nend", "def class_def( name, &blk )\n class_eval { define_method name, &blk }\n end", "def build(&ruby_block)\n # Use local variable for accessing the attribute since they will\n # be hidden when opening the sytem.\n name = @name\n stages = @stages\n namespace = @namespace\n this = self\n mk_ev = @mk_ev\n mk_rst = @mk_rst\n scope = HDLRuby::High.cur_system.scope\n\n return_value = nil\n\n # Enters the current system\n HDLRuby::High.cur_system.open do\n sub do\n HDLRuby::High.space_push(namespace)\n # Execute the instantiation block\n return_value =HDLRuby::High.top_user.instance_exec(&ruby_block)\n HDLRuby::High.space_pop\n\n # Create the pipeline code.\n \n # Declare and register the pipeline registers generators.\n prs = []\n stages.each do |st|\n st.each do |rn|\n r = PipeSignal.new(name.to_s+\"::\"+rn.to_s,scope)\n prs << r\n namespace.add_method(rn) { r }\n end\n end\n\n # Build the pipeline structure.\n return_value = par(mk_ev.call) do\n hif(mk_rst.call == 0) do\n # No reset, pipeline handling.\n stages.each do |st|\n # Generate the code for the stage.\n HDLRuby::High.space_push(namespace)\n HDLRuby::High.top_user.instance_exec(&st.code)\n HDLRuby::High.space_pop\n end\n end\n helse do\n prs.each { |r| r <= 0 }\n end\n end\n end\n end\n\n return return_value\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def initialize(formals, body)\n @formals, @body, @enclosing_scope = [formals, body, Lambda.scope]\n @car = :lambda.sym\n @cdr = Cons.new(@formals.sexp, Cons.new(@body.sexp))\n end", "def class_def name, &blk\n class_eval { define_method name, &blk }\n end", "def create_provider_class(name, mod=Object, &init)\n parts = name.split('::', 2)\n cls = nil\n if parts.size == 1\n if mod.const_defined?(name)\n # Was already previously defined, undef all the known *instance* methods\n # (class methods are inherited and should not be undefined)\n cls = mod.const_get(name)\n (cls.instance_methods - RightScale::PowershellProviderBase.instance_methods).each { |m| cls.class_eval(\"undef #{m}\") }\n init.call(cls)\n else\n # New class\n cls = Class.new(RightScale::PowershellProviderBase) { |c| init.call(c) }\n mod.const_set(name, cls)\n end\n else\n m = parts[0]\n mod = if mod.const_defined?(m)\n # Recurse into existing module\n mod.const_get(m)\n else\n # Create new module and recurse\n mod.const_set(m, Module.new)\n end\n cls = create_provider_class(parts[1], mod, &init)\n end\n cls\n end", "def class_via(*args, &blk)\n klass = Class.new(*args)\n klass.class_eval(&blk) unless blk.blank?\n return klass\n end", "def create_class\n attributes = content['attributes']\n mod.const_set class_name, Class.new(parent_class) {\n attr_accessor(*attributes)\n # include Concerns::Extendable\n }\n end", "def module_function(sym, *rest) end", "def initialize(name, parser, &block)\n @name = name\n @parser = parser\n @modules = []\n @wrapped_functions = []\n @wrapped_classes = []\n @wrapped_structs = []\n\n block.call(self) if block\n end", "def load(proc)\n\t\tbegin\n\t\t\t# run the lambda to get the bound Object\n\t\t\tobj = proc.call()\n\t\t\t\n\t\t\t\n\t\t\t# TODO: move this code into #load, so that it is properly guarded against any sort of exception that may arise.\n\t\t\t\n\t\t\t# --- make sure the object you want to bind behaves as expected\n\t\t\tif obj.nil?\n\t\t\t\traise \"Problem in #{@file}. Expected the file to define a lambda that returns a Object instance. The lambda was properly defined, but it's return was nil.\"\n\t\t\tend\n\t\t\t\n\t\t\tunless @contract.all?{|sym| obj.respond_to? sym }\n\t\t\t\ta = @contract.inspect\n\t\t\t\tb = obj.methods.inspect\n\t\t\t\t\n\t\t\t\tmsg = \n\t\t\t\t[\n\t\t\t\t\"Failed to bind the following object from #{@file}: #{obj}\",\n\t\t\t\t\" Object returned from lambda does not respond to all methods specified in the method contract.\",\n\t\t\t\t\" contract: #{a}\",\n\t\t\t\t\" methods: #{b}\",\n\t\t\t\t\" missing methods: #{a - b}\",\n\t\t\t\t].join(\"\\n\")\n\t\t\t\t\n\t\t\t\traise msg\n\t\t\tend\n\t\t\t# ------\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\tobj.setup(@window, @save_directory)\n\t\t\tputs \"Loaded: #{@file}\"\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t@wrapped_object = obj\n\t\trescue StandardError => e\n\t\t\tprocess_snippet_error(e)\n\t\t\t\n\t\t\t# If there's a problem, you need to get rid of the class that's causing it,\n\t\t\t# or errors will just stream into STDOUT, which is very bad.\n\t\t\tunload(kill:true)\n\t\t\t# (need to kill because #setup may have corrupted the state)\n\t\t\t\n\t\t\t# distinguish between 'safe shutdown' unloading, and 'kill this now' unloading. Safe shutdown needs to save state. Kill now should never save state (state is lkely to be corrupted.)\n\t\tensure\n\t\t\t# always do this stuff\n\t\tend\n\tend", "def initialize(name, source, block=nil)\n @name = name\n @source = source\n if(block.nil? && self.class == Callback)\n raise ArgumentError.new 'Block is required for dynamic callbacks!'\n end\n define_singleton_method(:execute, &block) if block\n execute_and_retry_forever(:setup) do\n setup\n end\n end", "def create_method(name, &block)\n eigen = class << self; self; end\n eigen.send(:define_method, name, &block)\n end", "def call\n klass = Class.new(parent)\n\n klass.class_eval <<-RUBY, __FILE__, __LINE__ + 1\n def self.name\n #{name.inspect}\n end\n\n def self.inspect\n name\n end\n\n def self.to_str\n name\n end\n\n def self.to_s\n name\n end\n RUBY\n\n yield(klass) if block_given?\n\n klass\n end", "def create(klass, *args, &block)\n\t\t\t#puts caller\n\t\t\tc = klass\n\t\t\t#go through rules\n\t\t\t#ask each replace? klass\n\n\t\t\tif(@rules)\n\t\t\t\t@rules.each { |r| \n\t\t\t\t\tx = r.replace?(klass)\n\t\t\t\t\tif x && r.test?(klass,*args,&block) then c = x end}\n\t\t\tend\n\n\t\t\tif(!c.is_a?(Class)) then\n\t\t\t\traise \"ClassConductor asked to init something which isn't a class: #{c}\"\n\t\t\tend\n\t\t\t\n\t\t\tobj = c.class_conductor_aliased_new(*args,&block)\n\t\t\t\n\t\t\tif(@rules)\n\t\t\t\t@rules.each {|r| if r.wrap?(obj) then obj = r.dowrap(obj) end}\n\t\t\tend\n\t\t\tobj\n\t\tend", "def block(name=\"block\", &proc)\n gen = self.class.new(@library, @module, @function, @function.add_block(name))\n gen.instance_eval(&proc)\n return gen\n end", "def to_module\n hash = self\n Module.new do\n hash.each_pair do |key, value|\n define_method key.to_sym do\n value\n end\n end\n end\n end", "def create_module\n puts \"\\n... Creating module '#{@module}' in '#{@dir}'\"\n # Base directory\n create_dir(\"#{@module}\")\n self.create_module_dirs\n self.create_module_files\n self.create_module_file\n self.create_module_database_files\n self.create_module_info_file\n puts 'Module created :)'\n end", "def initialize(callable)\n @callable = callable\n freeze\n end", "def from_module(mod, candidate_rank = 0, start_line = nil)\n candidate = Pry::WrappedModule(mod).candidate(candidate_rank)\n start_line ||= candidate.line\n new(candidate.source, start_line, :ruby)\n end", "def initialize(name, module_name, method_name, transaction)\n @module_name = module_name\n @method_name = method_name\n @transaction = transaction\n @name = name\n @labels = { module: @module_name, method: @method_name }\n @real_time = 0\n @cpu_time = 0\n @call_count = 0\n end", "def initialize(name, module_name, method_name, transaction)\n @module_name = module_name\n @method_name = method_name\n @transaction = transaction\n @name = name\n @labels = { module: @module_name, method: @method_name }\n @real_time = 0.0\n @cpu_time = 0.0\n @call_count = 0\n end", "def initialize(initial_state, klass, &block)\n @class = klass\n @initial = initial_state\n @states = Hash.new\n @events = Hash.new\n @callbacks = {before: Hash.new , after: Hash.new}\n instance_eval &block\n end", "def lambdaBuilder(message)\r\n lambda{puts message; return}\r\nend", "def initialize(*args)\n # This deals with all possible types of arguments that could be given.\n args = sanitize_args(*args)\n node_value, child1, child2 = args\n\n # At this point the first argument should be a symbol, and the rest LambdaExpressions.\n case args.length\n when 1\n @kind = :variable\n @value = node_value\n when 2\n @kind = :abstraction\n @bound_var = node_value\n @body = child1\n when 3\n @kind = :application\n @function = child1\n @argument = child2\n else raise ArgumentError, \"Wrong number of arguments. (Should be caught earlier.)\"\n end\n\n end", "def create_module(epackage, under=Module.new)\r\n with_empty_constant_order_helper do\r\n temp = under.to_s.start_with?(\"#\")\r\n mod = create_module_internal(epackage, under, temp)\r\n\r\n epackage.eAllClassifiers.each do |c| \r\n if c.is_a?(RGen::ECore::EClass)\r\n create_class(c, temp)\r\n elsif c.is_a?(RGen::ECore::EEnum)\r\n create_enum(c)\r\n end\r\n end\r\n\r\n load_classes_with_reserved_keywords(epackage)\r\n mod\r\n end\r\n end", "def create(name)\n klass = fetch(name, nil)\n instance = nil\n\n # If there is no module associated with this class, then try to demand\n # load it.\n if klass.nil? or klass == Msf::SymbolicModule\n # If we are the root module set, then we need to try each module\n # type's demand loading until we find one that works for us.\n if module_type.nil?\n Msf::MODULE_TYPES.each { |type|\n framework.modules.load_cached_module(type, name)\n }\n else\n framework.modules.load_cached_module(module_type, name)\n end\n\n recalculate\n\n klass = fetch(name, nil)\n end\n\n # If the klass is valid for this name, try to create it\n unless klass.nil? or klass == Msf::SymbolicModule\n instance = klass.new\n end\n\n # Notify any general subscribers of the creation event\n if instance\n self.framework.events.on_module_created(instance)\n end\n\n return instance\n end", "def closure! \n end", "def initialize(name, function_type)\n super(PuppetStrings::Yard::CodeObjects::Functions.instance(function_type), name)\n @parameters = []\n @function_type = function_type\n end", "def new(*args)\n obj = allocate()\n\n Rubinius.asm(args, obj) do |args, obj|\n run obj\n run args\n push_block\n send_with_splat :initialize, 0, true\n # no pop here, as .asm blocks imply a pop as they're not\n # allowed to leak a stack value\n end\n\n return obj\n end", "def class_def(name, &blk)\n class_eval { define_method(name, &blk) }\n end", "def process_defn(exp)\n raise if @result_name\n method_name = exp.shift || raise\n exp = exp.shift || raise\n\n method_body = want_result do\n case exp.first\n when :ivar\n process(s(:block, exp))\n when :attrset\n process(s(:block, s(:args, :_), s(:iasgn, exp[1], s(:lvar, :_))))\n when :scope, :block, :fbody\n process(exp)\n else\n raise\n end\n end\n\n str = \"\"\n\n if @argument_variables.empty?\n str << \"function(){\"\n else\n args_str = ([block_name()] + @arguments_no_splat).join(\",\")\n str << \"function(#{args_str}){\"\n end\n\n raise if @local_variables.include?(@model.encode_self)\n raise if @argument_variables.include?(@model.encode_self)\n\n #\n # Add \"self\" to the local variables\n #\n @local_variables.add(@model.encode_self)\n @local_variables_need_no_initialization.add(@model.encode_self)\n\n #\n # declare local variables (except arguments)\n #\n to_declare = (@local_variables - @argument_variables).to_a\n to_declare << @result_name if @result_name\n unless to_declare.empty?\n str << \"var \" + to_declare.join(\",\") + sep()\n end\n\n #\n # initialize all local variables (that need initialization) to nil\n #\n to_initialize = (@local_variables - @argument_variables - @local_variables_need_no_initialization).to_a\n to_initialize << @result_name if @result_name\n unless to_initialize.empty?\n str << to_initialize.join(\"=\")\n str << \"=#{@model.encode_nil}#{sep()}\"\n end\n\n #\n # initialize \"self\"\n #\n str << \"#{@model.encode_self}=this#{sep()}\"\n\n #\n # If a block argument is given (&block) convert it to nil if it is\n # undefined. \n #\n if @block_arg_name\n str << \"#{@block_arg_name}=#{block_name()}==null?#{@model.encode_nil}:#{block_name()}#{sep()}\"\n end\n\n #\n # generate initialization code for each read instance variable\n #\n @read_instance_variables.each do |iv|\n str << \"if(#{@model.encode_self}.#{iv}==null)#{@model.encode_self}.#{iv}=#{@model.encode_nil}#{sep()}\"\n end\n\n # \n # Used in a zsuper call to refer to the methods \"arguments\"\n # \"arguments\" itself does not work due to iterators using functions.\n if @arguments_name\n str << \"var #{@arguments_name}=arguments#{sep()}\"\n end\n\n method_body << \"#{sep()}return #{@result_name}\" if @result_name\n\n if @iterators_used\n str << \"try{\" \n str << method_body \n\n #\n # Declare variable x?\n # No, catch introduced a new scope, so we don't have to\n # use a local or temporary variable here! \n #\n x = exception_name()\n iter_jump = @model.encode_globalattr(\"iter_jump\")\n return_value = @model.encode_attr(\"return_value\")\n scope = @model.encode_attr(\"scope\")\n uid = unique_method_scope()\n\n str << \"}catch(#{x}){\"\n # scope == null or scope == uid\n str << \"if(#{x} instanceof #{iter_jump} && (!#{x}.#{scope} || #{x}.#{scope}==#{uid}))return #{x}.#{return_value}#{sep()}\"\n str << \"throw(#{x})}\"\n else\n str << method_body\n end\n\n str << \"}\"\n\n return str\n end", "def cls; end", "def build(*modules, &block)\n reset!\n\n modules.each { |mod| add_module(mod) }\n self.instance_eval(&block) if block\n\n [ '' ] + @modules + [ '' ]\n end", "def create_methods!\n return unless type == :normal\n\n fn = name\n dmm = session_class._dynamic_methods_module\n mn = name.to_s.downcase\n\n dmm.define_method(mn) do\n self[fn]\n end\n\n dmm.define_method(\"#{mn}=\") do |new_value|\n self[fn] = new_value\n end\n\n if visibility == :private\n dmm.send(:private, mn, \"#{mn}=\".to_sym)\n end\n end", "def new_mailer_class(name, &proc)\n return new_anon_class(ActionMailer::Base, name, proc) if proc\n new_anon_class(ActionMailer::Base, name){\n def test_email(to=\"someone@example.com\")\n from \"noreply@nowhere.local\"\n recipients to\n subject \"test email\"\n content_type \"text/plain\"\n body \"test email\"\n end\n }\n end", "def to_lambda(source_proc)\n return source_proc if source_proc.lambda?\n\n unbound_method = Module.new.module_eval do\n instance_method(define_method(:_, &source_proc))\n end\n\n lambda do |*args, &block|\n unbound_method.bind(self).call(*args, &block)\n end\n end", "def to_parfait( clazz = nil )\n raise \"No class given to class method #{name}\" unless clazz\n sol_m = clazz.single_class.create_instance_method_for(name , make_arg_type , make_frame , body )\n sol_m.create_callable_method_for(clazz.single_class.instance_type)\n sol_m\n end", "def lambda=(_); end", "def method_name\n :lambda\n end", "def initialize(name,description,function)\n @name = name\n @description = description\n @function = function\n end", "def create_lambda(arg)\n case arg\n when Proc then arg\n when Symbol then lambda { |request| request[arg] }\n else raise \"Canot create a lambda expression from this argument: #{arg.inspect}!\"\n end\n end", "def create_lambda(arg)\n case arg\n when Proc then arg\n when Symbol then lambda { |request| request[arg] }\n else raise \"Canot create a lambda expression from this argument: #{arg.inspect}!\"\n end\n end", "def define_python_methods\r\n @p.Execute(\"\r\ndef foo(x):\r\n return x + x\r\n\r\ndef bar(x):\r\n return x * x\r\n\"\r\n )\r\nend", "def register(&block)\n extend Module.new(&block)\n end", "def source_object\n @source_object ||= if name =~ /^[A-Z]/\n Pry::WrappedModule(self)\n else\n Pry::Method(block)\n end\n end", "def compile!( name, &block )\n # Get the already defined method\n m = instance_method( name )\n\n # Create a new method with leading underscore\n define_method( \"_#{name}\", &block )\n _m = instance_method( \"_#{name}\" )\n remove_method( \"_#{name}\" )\n\n # Define instance method\n define!( name, _m, m, &block )\n end", "def on_module(node)\n define_module(node, DefinitionBuilder::RubyModule)\n end", "def test_class_for(*mods, &blk)\n klass = Class.new\n klass.class_eval { include(*mods) }\n klass.class_eval(&blk) unless blk.blank?\n return klass\n end", "def constructor(new_fn = nil, **options, &block)\n next_fn = Function[new_fn || block]\n\n if next_fn.wrapper?\n self.class.wrapper_type.new(with(**options), fn: next_fn)\n else\n with(**options, fn: fn >> next_fn)\n end\n end", "def compile_lambda(scope, args=nil, body=nil)\n e = @e.get_local\n body ||= []\n args ||= []\n # FIXME: Need to use a special scope object for the environment,\n # including handling of self. \n # Note that while compiled with compile_defun, the calling convetion\n # is that of a method. However we have the future complication of\n # handling instance variables in closures, which is rather painful.\n r = compile_defun(scope, e, [:self,:__closure__]+args,[:let,[]]+body)\n r\n end", "def initialize(owner_class, *args, &block); end" ]
[ "0.63208824", "0.61317605", "0.6110549", "0.6006771", "0.5958146", "0.58892477", "0.5883861", "0.58518064", "0.5778411", "0.57108635", "0.5655776", "0.56211364", "0.56196415", "0.5612172", "0.5612172", "0.5586633", "0.55772567", "0.5567233", "0.5558745", "0.5558745", "0.5558735", "0.5553069", "0.5553069", "0.55340236", "0.5499174", "0.54877645", "0.5485861", "0.5479516", "0.5472471", "0.5470977", "0.54583555", "0.5456771", "0.5454076", "0.5449533", "0.54446954", "0.5434083", "0.5432699", "0.542517", "0.5414282", "0.5406765", "0.5406665", "0.5402443", "0.53997666", "0.5381086", "0.5374156", "0.53669477", "0.53669477", "0.53669477", "0.53669477", "0.53669477", "0.53669477", "0.536493", "0.5364837", "0.5350472", "0.5343035", "0.534209", "0.53323823", "0.5325262", "0.53245956", "0.5323141", "0.5317656", "0.52986646", "0.5295549", "0.5294857", "0.52941597", "0.52879435", "0.52878547", "0.5286618", "0.5284439", "0.52819085", "0.528024", "0.5280046", "0.5279255", "0.5278748", "0.5276966", "0.5271179", "0.52634573", "0.52446777", "0.524406", "0.52352685", "0.5231747", "0.5231463", "0.5227135", "0.52250963", "0.5222721", "0.52172214", "0.52142584", "0.5203942", "0.52032954", "0.5199498", "0.5199498", "0.5195031", "0.51917976", "0.51900655", "0.51889974", "0.5184017", "0.5177315", "0.5177311", "0.51761657", "0.5168151" ]
0.5784309
8
No shirt, no shoes, no problem
def test_noops_with_no_composites pipeline = Class.new(Pipeline) result = pipeline.process([]) assert_equal([], result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_shovel\n if @satchel.contents.include?(\"fragment1\") && @satchel.contents.include?(\"fragment2\") && @satchel.contents.include?(\"fragment3\")\n @house.last_move_message = \"You've collected all three paper fragments. When you put them all together, you see this message: 'Buried in the garden.' Oh! A gust of wind just carried away all your fragments.\"\n @house.create_item(\"shovel\", \"This shovel is pretty darn heavy.\", 0)\n @house.find_room(:shed).inventory << \"shovel\"\n @satchel.contents.delete_if {|x| [\"fragment1\", \"fragment2\", \"fragment3\"].include?(x)}\n end\n end", "def skip_measurements?\n !line_items.any? { |l| l.product.category == :suit || l.product.category == :shirt }\n end", "def sittinae_hooey(scrawny_appulsion, termly)\n end", "def make_eggs(quantity, style)\n if @hired == true\n puts \"making #{quantity} eggs in #{style}.\"\n else\n puts \"you are fired, and have to go home.\"\n end\n end", "def initialize(shoes)\n self.shoes = shoes\n end", "def initialize(shoes)\n self.shoes = shoes\n end", "def smoke_weed\n\tif (@inventory.include?('marijuana') && @inventory.include?('bong') && @inventory.include?('lighter'))\n\t\t@health = 100\n\t\t@pointless_points += 50\n\t\tputs \"You pack the bong full of weed and take a huge rip!\"\n\t\tputs \"\"\n\t\tputs \"Youre health is now at 100/100\"\n\t\tputs \"+50 points!\"\n\t\tputs \"\"\n\t\t@inventory.slice!(@inventory.index('marijuana'))\n\telse\n\t\tputs \"Maybe you can find somebody to help you out with that...\"\n\t\tputs \"\"\n\tend\n\tcontroller\nend", "def shoulders_stretch \n \"Raise both shoulders at once up toward the ears. Drop them and repeat 10 times each direction.\"\nend", "def stock\n if stock?\n\n if pile.empty?\n return if @areas[:waste].cards.size == 1\n pile.background = Ray::Sprite.new image_path('pile_background')\n refill_stock\n else\n displace_to_waste if @card\n end\n\n if pile.empty?\n if @areas[:waste].cards.size == 1\n pile.background = Ray::Sprite.new image_path('fully_empty_stock')\n else\n pile.background = Ray::Sprite.new image_path('empty_stock')\n end\n end\n\n end\n end", "def discardHiddenTreasure(t)\n \n end", "def index\n @shoe = Shoe.new \n @shoes = @runner.shoes\n end", "def weapon; end", "def weapon; end", "def weapon; end", "def textilize(text) \n text = swear_generator(text)\n RedCloth.new(text).to_html.html_safe unless text.blank? \n end", "def spice; end", "def make_noise\n puts \"Making a generic animal noise... Meep.\"\n end", "def mix\n\n # Abort if there is no glass inside the replicator.\n return unless glass_inside_replicator\n\n # Draw power if possible and then mix ingredients around.\n if @power && @enterprise.reactor.draw_power(3)\n glass_inside_replicator.inside.contents.shuffle!.compact!\n end\n end", "def empty_weapon\n s_to_h(<<-S)\n B1 96 B1 D3 ED AE 5F 92 25 AA 01 01 00 FF FF FF\n FF 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 02 00 00 00 99 32 C5 C4 CC 57 6D\n 43 00 00 00 00 FF FF FF FF 99 32 C5 C4 CC 57 6D\n 43 00 00 00 00 FF FF FF FF 01 00 00 00 99 32 C5\n C4 CC 57 6D 43 00 00 00 00 FF FF FF FF 13 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00\n 00\n S\nend", "def render_srep(*args)\n srep = args[0]\n shiftx = args[1]\n shifty = args[2]\n scale = args[3]\n show_sphere = args[4]\n show_sphere = false\n srep.atoms.each_with_index do |atom, i|\n render_atom(atom.x + shiftx, atom.y + shifty, atom.color)\n if show_sphere\n center_x = atom.x + shiftx - atom.spoke_length[0]\n center_y = atom.y + shifty - atom.spoke_length[0]\n d = atom.spoke_length[0] * 2\n # if (srep.index != 1 or i != 2)\n\t render_circle(center_x, center_y, d, srep.color)\n # else\n # render_circle(center_x+10, center_y+10, 80, srep.color)\n # end\n end\n if srep.show_extend_disk\n center_x = atom.x + shiftx - atom.expand_spoke_length[0]\n center_y = atom.y + shifty - atom.expand_spoke_length[0]\n d = atom.expand_spoke_length[0] * 2 \n render_circle(center_x, center_y, d, srep.color)\n end \n atom_x = atom.x+shiftx\n atom_y = atom.y+shifty\n #render_spokes(atom_x, atom_y, atom.type, atom.spoke_length, atom.spoke_direction, srep.color)\n end\n\n if srep.interpolated_spokes_begin.length > 0 and srep.show_interpolated_spokes\n spoke_begin = srep.interpolated_spokes_begin\n spoke_end = srep.interpolated_spokes_end\n render_interp_spokes(shiftx, shifty, Color.white, spoke_begin, spoke_end, srep.index)\n end\n\n if srep.show_curve\n # display the interpolated curve points\n render_curve($sreps, srep.index, srep, shiftx, shifty)\n end\n end", "def print_shoe\n for i in 0..@cards.size-1\n puts \"#{@cards[i].symbol} #{@cards[i].suit}\"\n end\n end", "def scabrous_sphenophyllaceae_fogdog(metastable, meio, unawakenedness_notably)\n redry_manifoldwise_photoactive()\n spongiae(internuncius)\n radialization?(lealness_pratiloma)\n end", "def are_photogelatin_alchitran(glossy_subdepot)\n unmelodiousness?(flavorsome)\n matico?(spetch_socager)\n unshod(estivator, hematoplastic_treasuryship, ergastic_anatifa)\n end", "def reset\n @shoe = Shoe.new(7)\n player.hand.clear;\n player.bust = false\n dealer.hand.clear;\n dealer.bust = false\n play\n end", "def reg_shirt(reg, opts={})\n c_width = opts[:width] || 300\n c_height = opts[:height] || 285\n r_name = opts[:name] || reg.uniform_name || \"WOSoMP\"\n r_number = opts[:number] || reg.uniform_number || DateTime.now.year - 2000\n r_shirt_image = if opts[:color]\n image_path(\"shirts/#{opts[:color]}.jpg\")\n elsif reg.team && reg.team.shirt_color\n image_path(\"shirts/#{reg.team.shirt_color}.jpg\")\n else\n image_path(\"shirts/gray.jpg\")\n end\n html_classes = opts[:class] ? \"shirt-preview #{opts[:class]}\" : \"shirt-preview\"\n html_id = opts[:id] || \"shirt-reg-#{reg.id}\"\n\n content_tag(:canvas, \"id\"=>html_id, \"class\"=>html_classes, \"width\"=>c_width, \"height\"=>c_height, \"data-shirt-preview\"=>true, \"data-shirt-name\"=>r_name, \"data-shirt-number\"=>r_number, \"data-shirt-image\"=>r_shirt_image) do\n content_tag(:div, :id=>html_id, :class=>html_classes) do\n image_tag(r_shirt_image, :class=>\"selected\") +\n content_tag(:span, r_name, :class=>\"name\") +\n content_tag(:span, r_number, :class=>\"number\")\n end\n end\n end", "def is_solid_masonery?()\n\n # p \"randomize is_solid_masonery?\"\n srand();rand(2)\n end", "def show_item_gold?(targets) #don't show item/gold gained during battle\n end", "def test_espresso_more_effective\n hipster = Human.new \"Hipster\"\n espresso = Espresso.new \"Espresso\"\n\n hipster.buy espresso\n assert espresso.drinks_before_empty == 1\n\n hipster.drink!\n assert (hipster.alertness > 0.4)\n\n end", "def play\n $game.surface.+$game.white.get('Ant')\n $game.surface.+$game.black.get('Beetle')\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]), Side::Face[:bottom_left])\n #$game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:bottom_left])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Ant'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Queen'), $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Queen'), $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]), Side::Face[:bottom_right])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]), Side::Face[:top_right])\n $game.surface.+($game.white.get('Spider'), $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]), Side::Face[:bottom_center])\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).move(Hive::Color[:black], Bug::Type[:beetle1], Side::Face[:bottom_left])\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).move(Hive::Color[:black], Bug::Type[:queen1], Side::Face[:bottom_center])\n $game.surface.+($game.black.get('Grasshopper'), $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]), Side::Face[:top_center])\n \n # Try putting a $game.list_moves after any move directive\n\n puts \"\\n\\n=====PROOF SECTION=======================\"\n $game.surface.bug(Hive::Color[:black], Bug::Type[:beetle1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper1]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper2]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:grasshopper3]).describe\n $game.surface.bug(Hive::Color[:black], Bug::Type[:queen1]).describe\n \n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant2]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:ant3]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:queen1]).describe\n $game.surface.bug(Hive::Color[:white], Bug::Type[:spider1]).describe\n end", "def troop; end", "def draw_item(index, color = Color.new(0,0,0))\n self.contents.font.color = color\n if !@icons\n draw_text(index+1, @commands[index])\n else\n icon = \"\"\n unless @commands[index] == \"Drop\" or @commands[index] == \"Drop \"\n icon = Config.get_command_icon(@commands[index])\n draw_text_icon(index+1, @commands[index], icon)\n else\n # Get the correct unit when drawing the \"Drop\" command(s)\n held_unit = @unit.holding_units[0] if @commands[index] == \"Drop\"\n held_unit = @unit.holding_units[1] if @commands[index] == \"Drop \"\n # Get the held unit's bitmap\n id = \"_\" + held_unit.army.id.to_s\n bitmap = RPG::Cache.character(held_unit.name + id, 0)\n y = 32 * (index+1) - 32\n rect = Rect.new(0,0,bitmap.width/4,bitmap.height)\n self.contents.blt(0, y, bitmap, rect)\n \n # Get held unit's flag\n if held_unit.holding_units.size > 0 or held_unit.hiding\n bitmap = RPG::Cache.picture(\"load\") if @unit.holding_units.size > 0\n bitmap = RPG::Cache.picture(\"hide\") if @unit.hiding\n rect = Rect.new(0,0,bitmap.width,bitmap.height)\n self.contents.blt(0, y+16, bitmap, rect)\n end\n \n # If unit has damage on it\n if held_unit.unit_hp < 10\n bitmap = RPG::Cache.picture(\"hp_\" + held_unit.unit_hp.to_s)\n rect = Rect.new(0,0,bitmap.width,bitmap.height)\n self.contents.blt(16, y+16, bitmap, rect)\n end\n draw_text_indent(index+1, \"Drop\")\n end\n end\n end", "def stone? = unit == 'stone'", "def handle_victory(entity)\n # Determine the rewards for defeating the entity.\n gold = entity.sample_gold\n treasure = entity.sample_treasures\n\n add_loot(gold, [treasure]) unless gold.nil? && treasure.nil?\n end", "def test_simpleArmor\n w = Window_EquipDetails.new(0,192,640,96,$data_armors[1])\n @windows.push(w)\n return true\n end", "def ice_cream_shop(flavors, favorite)\n return false if flavors.empty?\n if flavors[0] == favorite && flavors.length == 1\n return true\n else\n pick_one_flavors = flavors.sample\n flavors.delete(pick_one_flavors) unless pick_one_flavors == favorite\n ice_cream_shop(flavors, favorite)\n end\nend", "def add_loot(gold, treasures)\n type(\"Loot: \")\n if ((gold.positive?) || (treasures && treasures.any?))\n print \"\\n\"\n if gold.positive?\n type(\"* #{gold} gold\\n\")\n add_gold(gold)\n end\n if treasures && treasures.any?\n treasures.each do |treasure|\n unless treasure.nil?\n type(\"* #{treasure.name}\\n\")\n add_item(treasure)\n end\n end\n end\n print \"\\n\"\n else\n type(\"nothing!\\n\\n\")\n end\n end", "def play(shoe)\n while can_hit and total < 17\n hit(shoe.deal_card)\n end\n stand\n end", "def treasure\n [\"ring\", \"necklace\", \"dagger\", \"amulet\", \"ruby\", \"sapphire\", \"piece of jade\", \"human skull\", \"tarask skull\"].sample\nend", "def suivre; end", "def worn_or_wielded? item\n object = @inventory.find item\n return false if object.nil?\n\n pos = position_of object\n\n return false if object.nil?\n\n if [:left_wield, :right_wield, :dual_wield].include? pos\n return \"You will need to unwield #{object.name} first.\"\n else\n return \"You will need to remove #{object.name} first.\"\n end\n end", "def pbTossItemScreen\n if !$PokemonGlobal.pcItemStorage\n $PokemonGlobal.pcItemStorage = PCItemStorage.new\n end\n storage = $PokemonGlobal.pcItemStorage\n @scene.pbStartScene(storage)\n loop do\n item = @scene.pbChooseItem\n break if item==0\n if pbIsImportantItem?(item)\n @scene.pbDisplay(_INTL(\"That's too important to toss out!\"))\n next\n end\n qty = storage.pbQuantity(item)\n itemname = PBItems.getName(item)\n itemnameplural = PBItems.getNamePlural(item)\n if qty>1\n qty=@scene.pbChooseNumber(_INTL(\"Toss out how many {1}?\",itemnameplural),qty)\n end\n if qty>0\n itemname = itemnameplural if qty>1\n if pbConfirm(_INTL(\"Is it OK to throw away {1} {2}?\",qty,itemname))\n if !storage.pbDeleteItem(item,qty)\n raise \"Can't delete items from storage\"\n end\n pbDisplay(_INTL(\"Threw away {1} {2}.\",qty,itemname))\n end\n end\n end\n @scene.pbEndScene\n end", "def bottle_s\r\n if bottle_quantity > 1 || bottle_quantity == 0\r\n 'bottles'\r\n elsif one_bottle?\r\n 'bottle'\r\n end\r\n end", "def dish; end", "def hatch\n @status = Idle\n @target = nil\n @virility = 0\n babies = []\n rand(MaxBabiesFromEgg).to_i.times {babies << baby_salmon}\n babies\n end", "def variety; end", "def variety; end", "def terpene; end", "def is_cuffed?\n return weapon_id == 33\n end", "def test_turn_putter_none\n pros = Prospector.new(0,0,0)\n assert pros.turn_putter(0,0).eql? \"\\tFound no rubies or fake rubies in Enumerable Canyon\"\n end", "def ice_cream_shop(flavors, favorite)\n flavors.select{|word| word == favorite }.empty? == false \nend", "def img_dos carte\n carte = if @fin_partie\n carte\n elsif @debug\n carte\n else\n nil\n end\n if carte.nil?\n \"<div class='card dos'></div>\"\n else\n img_carte carte\n end\n end", "def cobble\n puts \"Your shoe is as good as new!\"\n @shoe_condition = \"new\"\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def food_and_drink; end", "def display_exp_and_gold\n # Does nothing, will be managed in Scene_Victory\n end", "def display_exp_and_gold\n # Does nothing, will be managed in Scene_Victory\n end", "def render_subset_extend_interp_spokes(shiftx, shifty, color, ibegin, iend, srep_index)\n\n iend.each_with_index do |p, i|\n#\tif p.size >= 4 and (p[3].is_a? Integer) and p[3] >= 0 and p[3] < 3 \n#\t @app.stroke $sreps[p[3]].color\n if srep_index == 0\n if $subset_index.include? i\n \n\t\tif p.size >=3 and (p[2].is_a? Integer) and p[2] >= 0 and p[2] < 3 \n\t\t @app.stroke $sreps[p[2]].color\n\n other_srep_index = p[2]\n other_srep_spoke_index = p[3]\n other_srep_spoke_begin = $sreps[other_srep_index].interpolated_spokes_begin[other_srep_spoke_index]\n @app.line(other_srep_spoke_begin[0]+shiftx, other_srep_spoke_begin[1]+shifty, p[0]+shiftx, p[1]+shifty)\n\t\telse \n\t\t @app.stroke color\n\t\tend\n \n\t\t@app.line(ibegin[i][0]+shiftx, ibegin[i][1]+shifty, p[0]+shiftx, p[1]+shifty)\n\t end\n end\n end\n end", "def studio?\n num_beds == 1\n end", "def bake_cake servings\n\t#in the beginning the oven is off, and the bowl is empty\n\toven_on = false\n\tbowl = \"\"\n\t#Step 1: turn on the oven\n\n\tputs \"Is the oven on? \" + oven_on.to_s\n\n\t#Step 2: add flour, add eggs, add sugar\n\n\tputs \"The bowl currently has: \" + bowl #should have all ingredients listed with the right quantities!\n\t\nend", "def sample_treasures\n raise(NotImplementedError, 'A Fighter Entity must know whether it returns treasure or not after losing a battle')\n end", "def special_weapon_slot?(slot)\n ['Main Hand', 'Held In Off-hand', 'One-Hand', 'Off Hand', 'Shield'].include? slot\n end", "def swing\n \"#{name} brings #{sword} crashing down!\"\n end", "def take_items\n items = @table.items\n unless complimentary? items\n if items\n puts \"#{name} eyes the table: #{items.map(&:class).join(' and ')} are useless to me!\"\n else\n puts \"#{name} says: The table is empty!\"\n end\n\n return\n end\n\n puts \"#{name} takes the items from the table\"\n items = @table.take\n\n puts \"#{name} whistles for the waitress because the table is empty\"\n @table.waitress.whistle!\n\n tobacco = find_item items, Tobacco\n paper = find_item items, Paper\n @match = find_item items, Matches\n\n @cigarette = paper.roll tobacco\n true\n end", "def sample_treasures\n raise(NotImplementedError, 'A Fighter must know whether it returns treasure or not after losing a battle.')\n end", "def test_fullArmor\n w = Window_EquipDetails.new(0,384,640,96,$data_armors[31])\n @windows.push(w)\n return true\n end", "def test_dark_roast\n beverage = DarkRoast.new\n beverage = Milk.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"Dark Roast Coffee, Milk, Mocha, Mocha, Whip\", \n beverage.description)\n assert_equal(1.59, beverage.cost)\n end", "def donizetti; end", "def species; end", "def special_skill(launcher, target, skill)\n case skill.symbol\n when :s_counter #Riposte & co\n if skill.id == 64 and (count = target.skill_category_amount(1)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n elsif skill.id == 243 and (count = target.skill_category_amount(2)) > 0\n @IA_Info[:other_factor] = rand * 0.6 + count * 0.1\n else\n @IA_Info[:other_factor] = rand * 0.7\n end\n else\n return false\n end\n return true\n end", "def wreathmaking(squilla, noncarbonate_tilly, angionosis_parvolin)\n prealarm_plaidie_premolar(philofelist, unacceptableness_printless)\n suzan()\n end", "def discardVisibleTreasure(t)\n \n end", "def play_se_for_item\n # Don't play the sound\n end", "def rohs\n @products = website.current_products.select{|p| p if p.rohs}\n render_template\n end", "def show\n\n\n # http://www.micamove.com/products/the-movement-black-tshirt\n # http://www.micamove.com/products/the-movement-ash-tshirt\n # http://www.micamove.com/products/the-blitzen-charcoal-tshirt\n # http://www.micamove.com/products/the-blitzen-cream-tshirt\n # http://www.micamove.com/products/the-aztek-white-tshirt\n # http://www.micamove.com/products/the-albuquerque-cardinal-tshirt\n\n @xl_na = false\n @l_na = false\n @m_na = false\n @s_na = false\n\n @product = Product.find(params[:id])\n\n if @product.friendly_id == 'the-albuquerque-cardinal-tshirt'\n @s_na = true\n @m_na=true\n @l_na = true\n @xl_na=true\n end\n if @product.friendly_id == 'the-snake-charmer-black-tshirt'\n @l_na = true\n end\n if @product.friendly_id == 'the-movement-black-tshirt'\n @s_na = true\n @m_na=true\n @l_na = true\n @xl_na=true\n end\n if @product.friendly_id == 'the-movement-ash-tshirt'\n @s_na = true\n @m_na=true\n @l_na = true\n @xl_na=true\n end\n if @product.friendly_id == 'the-blitzen-charcoal-tshirt'\n @s_na = true\n @m_na=true\n @l_na = true\n @xl_na=true\n end\n if @product.friendly_id == 'the-blitzen-cream-tshirt'\n @s_na = true\n @m_na=true\n @l_na = true\n @xl_na=true\n end\n if @product.friendly_id == 'the-tree-midnight-navy-tshirt'\n @l_na = true\n end\n if @product.friendly_id == 'the-tree-natural-tshirt'\n @l_na = true\n @xl_na = true\n end\n if @product.friendly_id == 'the-aztek-charcoal-tshirt'\n @l_na = true\n end\n if @product.friendly_id == 'the-aztek-white-tshirt'\n @s_na = true\n @m_na=true\n @l_na = true\n @xl_na=true\n end\n\n @plank_images = Product.where :name => \"The Plank\"\n @deck_images = Product.where :name => \"The Deck\"\n @drift_images = Product.where :name => \"The Drift\"\n @baron_images = Product.where :name => \"The Baron\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end", "def complex_super_heroe\n heroes = [\"iron man\", \"hulk\", \"black widow\", \"thor\", \"captain marvel\"]\nend", "def test_found_no_rubies\n\t\tp = Print.new\n\t\tassert_output(\"\\tFound no rubies or fake rubies in Town.\\n\") {p.print_day([0,0],'Town')}\n\tend", "def blend(smoothie_ingredients)\n # retrieves only the food items and not the measurements\n return smoothie_ingredients.keys.join.delete(\" \").split('').shuffle!.join \nend", "def sale\r\nshirts = [\"Iron Man\", \"Thor\", \"Hulk\", \"Captain America\"]\r\n\r\nend", "def ranged_weapon; end", "def hasNoEffect\n\t\treturn (super && @nWeapons == 0)\n\tend", "def draw_item_name(item, x, y, enabled = true, width = 172)\n if item && (item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor))\n draw_item_rarity(item, x, y, enabled)\n @rarity = item.not_common? ? Rarity_Settings::RARITY_THEME_COLORS[item.rarity] : nil\n end\n h87_ir_draw_item_name(item, x, y, enabled, width)\n end", "def sprout_name\n case\n when !equipment.nil?\n \"#{equipment.type}_#{equipment_id}\"\n when !thermostat.nil?\n \"Thermostat_#{thermostat_id}\"\n when !recirculating_infusion_mash_system.nil?\n \"RIMS_#{recirculating_infusion_mash_system_id}\"\n else\n nil\n end\n end", "def can_loot?\n false\n end", "def draw_drops_content\n y = draw_drops\n draw_steals(y)\n if enemy.robbery_amount > 0\n draw_steal_gold(contents_height - line_height)\n end\n end", "def makePetMakeNoise\n @pet.makeNoise(rand(10))\n end", "def brew(drink_size)\n #Requirements:\n #-check if there is a cartridge present\n #-check if there's any water\n #Outcome:\n #-assess drink size and select amount of water\n #-heat water\n #-puncture cartridge and run water through\n end", "def main_spriteset ; end", "def show_inventory\n\t\tempty = String.new\n\t\tempty = \"empty pockets\" if @player.inventory.size == 0\n\t\tputs \"\\nYou have: \" + @player.inventory.join(\", \") + empty\n\tend", "def grill_cheese(bread, cheese, cheese_num, melt)\n # If cheese_num is greater than 3 cheese slices you want it extra cheesy.\n if cheese_num > 3\n # Patty melt instead of grilled cheese sando.\n if melt == true\n puts \"We got one extra cheesy #{cheese} patty melt on #{bread}, coming right up!\"\n else\n puts \"We got one extra cheesy #{cheese} grilled cheese on #{bread}, coming right up!\"\n end\n # For less cheesey sandwich\n else\n # Patty melt instead of grilled cheese sando.\n if melt == true\n puts \"We got one cheesy #{cheese} patty melt on #{bread}, coming right up!\"\n else\n puts \"We got one cheesy #{cheese} grilled cheese on #{bread}, coming right up!\"\n end\n end\nend", "def heroine; end", "def random_joke\n joke nil\n end", "def play\n # round_started used to determine if we need to settle bets\n # if the user quits mid-game.\n @round_started = nil\n catch :quit do\n init_game\n\n want_to_play = 1\n while want_to_play\n\n # Create and shuffle Shoe\n @shoe = Shoe.new(@num_decks)\n @shoe.shuffle\n\n # Player can cut the shoe, pick a random one (excluding dealer)\n @io.show_shoe(@shoe) if @debug\n cut_at = @io.cut_shoe(@shoe, @players[ rand(@players.length - 1) ])\n @shoe.cut(cut_at)\n while @shoe.can_play(@players.length)\n @io.start_round(@players, @num_shoes + 1, @num_rounds + 1)\n @io.show_shoe(@shoe) if @debug\n place_your_bets\n @round_started = 1 # Round is considered started after bets are in\n deal_round\n @io.show_hands(@players) if @debug\n handle_insurance if @dealer.hand.up_card.is_ace\n play_round unless @dealer.hand.is_bj\n settle_round\n @num_rounds += 1\n @round_started = nil\n end\n\n @num_shoes += 1\n want_to_play = @io.want_to_play(@num_shoes)\n end\n end\n if @shoe\n settle_round if @round_started\n @io.show_game_results(@broke_players + @players, @num_rounds, @num_shoes)\n end\n @io.quit\n end", "def stole_item_set(user, ext)\n return false unless ext != nil\n @item_stole = @item_to_steal = @stole_item_index = nil\n steal_success = rand(100) < (Steal_Rate + self.steal_attempt) * user.agi / self.agi\n self.steal_attempt += 1\n return nil if self.steal_items.nil? or self.steal_items == []\n return false unless steal_success\n @item_stole = []\n ext.slice!('STEAL/')\n self.steal_items.each do |item, steal_rate|\n item = item.split('')\n if item[0] == 'i' and not ext == 'GOLD'\n item = item.join\n item.slice!('i')\n @item_stole << $data_items[item.to_i] if rand(1000) < (steal_rate * 10).to_i\n elsif item[0] == 'a' and not ext == 'GOLD'\n item = item.join\n item.slice!('a')\n @item_stole << $data_armors[item.to_i] if rand(1000) < (steal_rate * 10).to_i\n elsif item[0] == 'w' and not ext == 'GOLD'\n item = item.join\n item.slice!('w')\n @item_stole << $data_weapons[item.to_i] if rand(1000) < (steal_rate * 10).to_i\n elsif item[0] == 'g' and not ext == 'ITEM'\n item = item.join\n item.slice!('g')\n @item_stole << item.to_i if rand(1000) < (steal_rate * 10).to_i\n end\n end\n return false if @item_stole == []\n self.steal_attempt = 0\n @stole_item_index = rand(@item_stole.size)\n @item_to_steal = @item_stole[@stole_item_index]\n if Multi_Steal\n self.steal_items.delete_at(@stole_item_index)\n else\n self.steal_items = []\n end\n return @item_to_steal\n end", "def test_house_blend\n beverage = HouseBlend.new\n beverage = Soy.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"House Blend Coffee, Soy, Mocha, Whip\", \n beverage.description)\n assert_equal(1.34, beverage.cost)\n end", "def display_item_inventory\n if item_inventory.length == 0\n \"You haven't picked up any items yet.\"\n else\n items_on_hand = item_inventory.join(\" & \")\n \"Right now, you have a \" + items_on_hand\n end\n end", "def ice_cream_shop(flavors, favorite)\n flavors.empty? ? false : flavors.first == favorite ? true : ice_cream_shop(flavors.drop(1), favorite)\n end", "def test_dark_roast\n beverage = DarkRoast.new\n beverage = Milk.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"Dark Roast Coffee, Milk, Mocha, Mocha, Whip\",\n beverage.description)\n assert_equal(1.59, beverage.cost)\n end", "def skip_the_sugar(drinks)\n\ttoo_much = ['cola', 'fanta']\n\tdrinks.select! { |n| !too_much.include? n}\n\tdrinks\nend" ]
[ "0.56777275", "0.5550387", "0.55290455", "0.55221635", "0.55044913", "0.55044913", "0.5431501", "0.54129106", "0.5361606", "0.5352056", "0.5344399", "0.5315415", "0.5315415", "0.5315415", "0.52978647", "0.52878416", "0.5276686", "0.5268935", "0.52494806", "0.52153194", "0.5206085", "0.5192801", "0.51507145", "0.514863", "0.5142301", "0.5140257", "0.51121134", "0.51067907", "0.5098134", "0.50896615", "0.5063025", "0.5061692", "0.5055683", "0.50550675", "0.50537103", "0.50472885", "0.5042089", "0.50374115", "0.50347644", "0.50145483", "0.5007182", "0.5006671", "0.5002833", "0.50023", "0.499937", "0.499937", "0.49905774", "0.49893612", "0.4981175", "0.49784148", "0.4973406", "0.49720663", "0.49685696", "0.49685696", "0.49685696", "0.49685696", "0.49465653", "0.4939922", "0.4939922", "0.49382994", "0.49339357", "0.49273527", "0.4920186", "0.4912526", "0.49117473", "0.49059057", "0.49027514", "0.49018174", "0.49008334", "0.49004215", "0.4898292", "0.4888537", "0.48803145", "0.48786306", "0.4878038", "0.48766235", "0.48756754", "0.48723304", "0.48714688", "0.4869121", "0.48685175", "0.48680648", "0.4853568", "0.48527515", "0.48497117", "0.48493", "0.4848748", "0.48403844", "0.48384178", "0.4837727", "0.48347318", "0.48326796", "0.48305333", "0.48246357", "0.4823831", "0.48156708", "0.48142713", "0.4808217", "0.48034862", "0.4803355", "0.48019725" ]
0.0
-1
filters returns the filters
def test_filters_accessor pipeline = Class.new(Pipeline) pipeline.use @append_a, @append_b assert_equal([@append_a, @append_b], pipeline.filters) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filters\n end", "def filters; end", "def filters; end", "def filters\n @filters ||= {}\n end", "def filters\n @filters ||= {}\n end", "def filters\n mentos(:get_all_filters)\n end", "def filters\n @filters ||= {}\n end", "def filters\n @filters ||= FiltersProvider.new\n end", "def filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters\n end", "def filters\n if metaclass.method_defined? :_filters\n self._filters\n else\n []\n end\n end", "def filters\n\t\t@filters_array = Array(@profile[:filters]) unless(@filters_array)\n\t\t@filters_array.each do |filter|\n\n\t\t\tif respond_to?( \"filter_#{filter}\" )\n\t\t\t\t@form.keys.each do |field|\n\t\t\t\t\t# If a key has multiple elements, apply filter to each element\n\t\t\t\t\t@field_array = Array( @form[field] )\n\n\t\t\t\t\tif @field_array.length > 1\n\t\t\t\t\t\t@field_array.each_index do |i|\n\t\t\t\t\t\t\telem = @field_array[i]\n\t\t\t\t\t\t\t@field_array[i] = self.send(\"filter_#{filter}\", elem)\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tif not @form[field].to_s.empty?\n\t\t\t\t\t\t\t@form[field] = self.send(\"filter_#{filter}\", @form[field].to_s)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t@form\n\tend", "def filters\n self.class.filters\n end", "def filters\n unless (@filters)\n @filters = {}\n return @filters unless @params[:f_inclusive]\n @params[:f_inclusive].each_pair do |field, value_hash|\n value_hash.each_pair do |value, type|\n @filters[field] ||= []\n @filters[field] << value\n end\n end \n end\n return @filters\n end", "def filter *filters\n spawn :@filters, @filters + parse_filter_input(filters)\n end", "def filters\n [\n GoHiring::SlackMarkdown::Filters::MergeMethodFilter,\n GoHiring::SlackMarkdown::Filters::HeaderFilter,\n GoHiring::SlackMarkdown::Filters::EmptyBlockFilter,\n GoHiring::SlackMarkdown::Filters::BlockBreakerFilter\n ]\n end", "def all\n @filters\n end", "def add_filters(filters); end", "def filters=(_arg0); end", "def filters=(_arg0); end", "def list_filters\n if @filters.empty?\n fetch_configuration()\n end\n return @filters.keys\n end", "def liquid_filters\n [\n StylesheetFilter,\n JavascriptFilter,\n AssignToFilter,\n LinkToFilter,\n GoogleAnalyticsFilter,\n GoogleWebmasterToolsFilter,\n GoogleJavascriptFilter,\n TextileFilter,\n DesignResourceFilter,\n AttributeFilter,\n ResourceFilter,\n NodeFilter,\n FormFilter\n ]\n end", "def filters\n unless @filters\n @filters = {}\n return @filters unless @params[:f_inclusive] && @params[:f_inclusive].respond_to?(:each_pair)\n @params[:f_inclusive].each_pair do |field, value_array|\n @filters[field] ||= value_array.dup\n end\n end\n @filters\n end", "def filter\n end", "def liquid_filters\n [\n DesignResourceFilter,\n AttributeFilter\n ]\n end", "def config_filters\n []\n end", "def allowed_filters\n []\n end", "def filters\n filters_class&.new(self.scoped)\n end", "def filter(&block)\n filters = self.filters << yield\n metaclass.send(:define_method, :_filters) do\n filters\n end\n end", "def filter; end", "def filter; end", "def filter; end", "def filter\n\tfilter_disabled\n\tfilter_repeated\n\tfilter_silenced\n\tfilter_dependencies\n end", "def get_filters(object)\n if @options[:using].is_a?(Array)\n gen_array_attribute_filters(object, @options[:using])\n else\n gen_map_attribute_filters(object, @options[:using])\n end\n end", "def filters(type)\n case type\n when :before\n namespaces = self.ancestors + [self]\n all_filters = namespaces.map(&:befores).flatten\n when :after\n namespaces = [self] + self.ancestors.reverse\n all_filters = namespaces.map(&:afters).flatten\n else\n raise 'Invalid filter type. Use :before or :after'\n end\n all_filters.select{|f| f[:opts][:all] || self.send(\"#{type}s\").include?(f) }\n end", "def pipeline_filters(options)\n filters = [\n HTML::Pipeline::MarkdownFilter,\n HTML::Pipeline::SanitizationFilter,\n HTML::Pipeline::ImageMaxWidthFilter,\n HTML::Pipeline::HttpsFilter,\n HTML::Pipeline::EmojiFilter,\n GithubMarkdownPreview::Pipeline::TaskListFilter\n ]\n\n if HtmlPreview::SYNTAX_HIGHLIGHTS\n filters << HTML::Pipeline::SyntaxHighlightFilter\n end\n\n if options[:comment_mode]\n filters << HTML::Pipeline::MentionFilter\n else\n filters << HTML::Pipeline::TableOfContentsFilter\n end\n\n filters\n end", "def instance_filters\n @instance_filters ||= []\n end", "def apply_filter\n end", "def filters\n [\n HTML::Pipeline::SanitizationFilter,\n\n Gitlab::Markdown::EmojiFilter,\n\n Gitlab::Markdown::UserReferenceFilter,\n Gitlab::Markdown::IssueReferenceFilter,\n Gitlab::Markdown::ExternalIssueReferenceFilter,\n Gitlab::Markdown::MergeRequestReferenceFilter,\n Gitlab::Markdown::SnippetReferenceFilter,\n Gitlab::Markdown::CommitRangeReferenceFilter,\n Gitlab::Markdown::CommitReferenceFilter,\n Gitlab::Markdown::LabelReferenceFilter,\n ]\n end", "def get_ifilters\n retval = Ifilter.order(:name) #retval = Ifilter.all\n get_internal_ifilters.each do |f|\n retval.prepend(f)\n end\n\n return retval\n end", "def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end", "def applicable_filters\n fs = []\n fs << Spree::ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::ProductFilters.price_filter if Spree::ProductFilters.respond_to?(:price_filter)\n fs << Spree::ProductFilters.brand_filter if Spree::ProductFilters.respond_to?(:brand_filter)\n #fs << Spree::ProductFilters.occasion_filter if Spree::ProductFilters.respond_to?(:occasion_filter)\n #fs << Spree::ProductFilters.holiday_filter if Spree::ProductFilters.respond_to?(:holiday_filter)\n fs << Spree::ProductFilters.selective_occasion_filter(self) if Spree::ProductFilters.respond_to?(:selective_occasion_filter)\n fs << Spree::ProductFilters.selective_holiday_filter(self) if Spree::ProductFilters.respond_to?(:selective_holiday_filter)\n fs\n end", "def usage_filters\n get('/1/reporting/filters').to_a\n end", "def filter\n\t\treturn @filter\n\tend", "def response_filters\n @response_filters ||= []\n end", "def all_filters(**args)\n params = parameters(args) do\n optional_params :type\n end\n request(:get, 'filters', params)\n end", "def filter(filters)\n if filters.empty?\n return nodes\n end\n if filters[0] =~ /^\\+/\n # don't let the first filter have a + prefix\n filters[0] = filters[0][1..-1]\n end\n\n node_list = Config::ObjectList.new\n filters.each do |filter|\n if filter =~ /^\\+/\n keep_list = nodes_for_name(filter[1..-1])\n node_list.delete_if do |name, node|\n if keep_list[name]\n false\n else\n true\n end\n end\n else\n node_list.merge!(nodes_for_name(filter))\n end\n end\n return node_list\n end", "def filters(type=nil)\n unless(type)\n @filters.dup\n else\n const = Splib.find_const(type)\n type = const unless const.nil?\n @filters[type] ? @filters[type].dup : nil\n end\n end", "def filters=( args )\n @filters.clear\n add_filters(*args)\n end", "def run_filters\n status = :no_match\n matching_filters = [] \n DataFileFilter.active.each do |filter|\n case filter.match(self)\n when :positive_match\n status = :accepted if status == :no_match\n matching_filters << filter\n when :negative_match\n status = :rejected\n matching_filters << filter\n when :no_match\n next\n end\n end\n return [status,matching_filters]\n end", "def clear_filters\n\t\t@filters = []\n\t\treturn self\n\tend", "def filter\n @filter\n end", "def applicable_filters\n fs = []\n # fs << ProductFilters.taxons_below(self)\n ## unless it's a root taxon? left open for demo purposes\n\n fs << Spree::Core::ProductFilters.price_filter if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs << Spree::Core::ProductFilters.brand_filter if Spree::Core::ProductFilters.respond_to?(:brand_filter)\n fs\n end", "def remaining_filters\n filters[@processed..-1]\n end", "def get_feed_filters\n filters = self.filters.to_h.reject{ |k, _v| PROHIBITED_FILTERS.include?(k.to_s) }\n filters.merge!({ 'report_status' => ['published'] }) if self.published\n filters\n end", "def remove_filters!\n @filters = []\n end", "def add_filters\n add_term_filters\n add_terms_filters\n add_range_filters\n end", "def set_filters\n @filters ||= begin\n filters = []\n filters << { attribute: Gemgento::ProductAttribute.find_by!(code: 'color'), value: params[:color] } unless params[:color].blank?\n filters\n end\n end", "def filter(filters=nil, options={})\n Filter.new(filters, options, self).nodes()\n end", "def get_team_filters\n filters = []\n self.feed_teams.each do |ft|\n if ft.sharing_enabled?\n filters << ft.filters.to_h.reject{ |k, _v| PROHIBITED_FILTERS.include?(k.to_s) }.merge({ 'team_id' => ft.team_id })\n end\n end\n filters\n end", "def set_filters\n filter_param_keys = [\n 'brand', 'color',\n 'size', 'department', 'keywords'\n ]\n @filters = []\n filter_param_keys.each do |key|\n if !params[key].blank?\n params[key].split(',').each do |val|\n @filters << {:key => key, :val => val}\n end\n end\n end\n \n \n if params[:price]\n params[:price].split(',').each_slice(2).to_a.each do |range|\n @filters << {:key => 'price', :val => range.join(',')}\n end\n end\n\n if @products\n @brands = @products.facet('brand_facet').rows.sort_by{ |brand| brand.value.capitalize}\n @departments = @products.facet('department_facet').rows\n end\n \n @colors = ['green', 'blue', 'purple', 'red', 'pink', 'beige', 'brown', 'yellow', 'orange', 'black', 'white', 'gray', 'teal', 'glowing', 'gold', 'silver']\n \n if !@taxon.nil? && @taxon.has_size?\n sizes = (Spree::Product.sizes.sort_by{|size| size.position}.map(&:presentation) & @products.facet(\"size_facet\").rows.map(&:value))\n end\n end", "def available_filters\n unless @available_filters\n initialize_available_filters\n @available_filters.each do |field, options|\n options[:name] ||= l(options[:label] || \"field_#{field}\".gsub(/_id$/, ''))\n end\n end\n @available_filters\n end", "def filter_pipeline\n @filter_pipeline ||= HTML::Pipeline.new([TypogrubyFilter])\n end", "def filter!; end", "def typus_filters\n\n fields_with_type = ActiveSupport::OrderedHash.new\n\n if self.respond_to?('admin_filters')\n fields = self.admin_filters\n else\n return [] unless Typus::Configuration.config[self.name]['filters']\n fields = Typus::Configuration.config[self.name]['filters'].split(', ').collect { |i| i.to_sym }\n end\n\n fields.each do |field|\n attribute_type = self.model_fields[field.to_sym]\n if self.reflect_on_association(field.to_sym)\n attribute_type = self.reflect_on_association(field.to_sym).macro\n end\n fields_with_type[field.to_s] = attribute_type\n end\n\n return fields_with_type\n\n end", "def initialize\n @filters = []\n end", "def add_filters(filters)\n filters.each do |field, value|\n Array(value).each { |v| add_filter(field, v) }\n end\n end", "def filter_proc(filters = {})\n lambda do |p|\n (filters[:name].nil? || p.name =~ filters[:name]) &&\n (filters[:appid_name].nil? || p.app_id_name =~ filters[:appid_name]) &&\n (filters[:appid].nil? || p.entitlements.app_id =~ filters[:appid]) &&\n (filters[:uuid].nil? || p.uuid =~ filters[:uuid]) &&\n (filters[:team].nil? || p.team_name =~ filters[:team] || p.team_ids.any? { |id| id =~ filters[:team] }) &&\n (filters[:exp].nil? || (p.expiration_date < DateTime.now) == filters[:exp]) &&\n (filters[:has_devices].nil? || !(p.provisioned_devices || []).empty? == filters[:has_devices]) &&\n (filters[:all_devices].nil? || p.provisions_all_devices == filters[:all_devices]) &&\n (filters[:aps_env].nil? || match_aps_env(p.entitlements.aps_environment, filters[:aps_env])) &&\n true\n end\n end", "def index_filters\n {}\n end", "def global_filter; end", "def strict_filters; end", "def reset_filters\n @_filters = []\n end", "def get_filters\n session[:instances_filters]\n end", "def get_filters\n session[:instances_filters]\n end", "def get_filter_string\n\t\treturn nil if @filters.size == 0\n\t\tfilters = []\n\n\t\t# Loop over each filtergroup\n\t\t# All conditions in a filtergroup are combined using AND\n\t\t# All filtergroups are combined using OR\n\t\t@filters.each_with_index do |filter, index|\n\t\t\tfields = []\n\n\t\t\t# Loop over all conditions in a filter group\n\t\t\tfilter.each do |condition|\n\t\t\t\tfield = condition[:field]\n\t\t\t\toperator = condition[:operator]\n\t\t\t\tvalue = condition[:value]\n\n\t\t\t\t# Some filters operate on strings and need wildcards\n\t\t\t\t# Transform value if needed\n\t\t\t\tcase operator\n\t\t\t\t\twhen FilterOperators::LIKE\n\t\t\t\t\t\tvalue = \"%#{value}%\"\n\t\t\t\t\twhen FilterOperators::STARTS_WITH\n\t\t\t\t\t\tvalue = \"#{value}%\"\n\t\t\t\t\twhen FilterOperators::NOT_LIKE\n\t\t\t\t\t\tvalue = \"%#{value}%\"\n\t\t\t\t\twhen FilterOperators::NOT_STARTS_WITH\n\t\t\t\t\t\tvalue = \"#{value}%\"\n\t\t\t\t\twhen FilterOperators::ENDS_WITH\n\t\t\t\t\t\tvalue = \"%#{value}\"\n\t\t\t\t\twhen FilterOperators::NOT_ENDS_WITH\n\t\t\t\t\t\tvalue = \"%#{value}\"\n\t\t\t\t\twhen FilterOperators::EMPTY\n\t\t\t\t\t\t# EMPTY and NOT_EMPTY operators require the filter to be in a different format\n\t\t\t\t\t\t# This because they take no value\n\t\t\t\t\t\tfields.push(\"<Field FieldId=\\\"#{field}\\\" OperatorType=\\\"#{operator}\\\" />\")\n\t\t\t\t\t\tnext\n\t\t\t\t\twhen FilterOperators::NOT_EMPTY\n\t\t\t\t\t\tfields.push(\"<Field FieldId=\\\"#{field}\\\" OperatorType=\\\"#{operator}\\\" />\")\n\t\t\t\t\t\tnext\n\t\t\t\tend\n\n\t\t\t\t# Add this filterstring to filters\n\t\t\t\tfields.push(\"<Field FieldId=\\\"#{field}\\\" OperatorType=\\\"#{operator}\\\">#{value}</Field>\")\n\t\t\tend\n\n\t\t\t# Make sure all filtergroups are OR'ed and add them\n\t\t\tfilters.push(\"<Filter FilterId=\\\"Filter #{index}\\\">#{fields.join}</Filter>\")\n\t\tend\n\n\t\t# Return the whole filterstring\n\t\treturn \"<Filters>#{filters.join}</Filters>\"\n\tend", "def filters=(*filters)\n @filters = filters.flatten\n end", "def applicable_filters\n fs = []\n products_searched = []\n\n if params[:search] \n if @products\n @products.each do |p|\n products_searched << p.id\n end\n end\n else\n products_searched = @taxon.products.all.pluck(:id)\n end\n\n fs << Spree::Core::ProductFilters.selective_filter('Quantity', :selective_quantity_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Manufacturer', :selective_manufacturer_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Use Type', :selective_use_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Type', :selective_bullet_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Bullet Weight', :selective_bullet_weight_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Casing', :selective_ammo_casing_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Ammo Caliber', :selective_ammo_caliber_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Primer Type', :selective_primer_type_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.selective_filter('Condition', :selective_condition_any, products_searched) if Spree::Core::ProductFilters.respond_to?(:selective_filter)\n fs << Spree::Core::ProductFilters.price_filter(products_searched) if Spree::Core::ProductFilters.respond_to?(:price_filter)\n fs\n \n end", "def list_filters\n {\n track_end_date: 'TrkEndDate gt VALUE',\n track_first_submitted: 'TrkFirstSubmitted gt VALUE',\n app_no: 'AppNo eq VALUE',\n first_name: 'AppFirstName eq VALUE',\n last_name: 'AppLastName eq VALUE',\n email: 'AppEmailAddress eq VALUE'\n }\n end", "def filter_parameters\n if @filter_parameters\n @filter_parameters || []\n else\n defined?(Rails) && Rails.application.config.filter_parameters\n end\n end", "def set_filters\n @filters = []\n section_ids = Section.pluck(:id)\n\n [:ministers, :departments].each do |filter_type|\n if params[filter_type].present?\n id_list = params[filter_type].map(&:to_i)\n\n id_list.reject! do |item|\n !section_ids.include? item\n end\n\n @filters += Section.where(id: id_list)\n end\n end\n end", "def result_filters\n\t\t[\"undefined\",\"nan\",\"null\",\"infinity\",DEFAULT_RESULT,\".\",\"!\"]\n\tend", "def get_filter_backends\n return self.class.filter_backends || []\n end", "def html_clean_filters( src_key, tree_key = nil )\n\n tree_key = \"#{src_key}_tree\".to_sym unless tree_key\n src_key, tree_key = src_key.to_k, tree_key.to_k\n\n filters = []\n filters << html_parse_filter( src_key, tree_key )\n\n #FIXME: PAGE: filters << TitleExtractor.new, or after?\n\n # FIXME: if src is text, last filter\n # filters << TextCtrlWSFilter.new( ContentKeys::TITLE )\n\n tfc = TreeFilterChain.new( html_tree_filters )\n\n filters << HTMLTreeFilter.new( tree_key, tfc,\n HTMLTreeFilter::Order::DEPTH_FIRST )\n\n #FIXME: First block extractor back to text key?\n\n filters\n end", "def filters\n respond_to do |format|\n format.html{ redirect_to root_path }\n format.json{\n list = [\n {\n :display => 'This source does not define any filter',\n :value => 'invalid'\n }\n ]\n filters_module = (RUBY_VERSION < '1.9') ? 'Filters' : :Filters\n if (@source.constants.include?(filters_module))\n list.clear\n @source::Filters.constants.each do |filter_name|\n filter = \"#{@source.name}::Filters::#{filter_name}\".constantize \n list << { \n :display => \"#{filter_name}: #{filter::NAME}\", \n :value => filter_name \n }\n end\n end\n \n render :json => list\n }\n end\n end", "def input_filter_groups\n return @input_filter_groups\n end", "def set_filters\n @filters = ''\n @filters.concat(\"status:'Available'\")\n unless @manufacturer_or_publisher.blank?\n @filters.concat(\" AND (manufacturer:'#{@manufacturer_or_publisher}'\")\n @filters.concat(\" OR publisher:'#{@manufacturer_or_publisher}')\")\n end\n @filters.concat(\" AND category:'#{@category}'\") unless @category.blank?\n @filters.concat(\" AND seller_name:'#{@seller_name}'\") unless @seller_name.blank?\n end", "def cost_filters\n get('/1/reporting/cost/filters').to_a\n end", "def search_filters\n return category_filters if tree_end?\n\n reload\n end_nodes = all_children.filter(&:tree_end?)\n common_filters_in_categories(end_nodes)\n end", "def index\n @filters = Filter.all\n end", "def initialize()\n @filters ||= []\n end", "def prepare_filters\n params = instance_values.symbolize_keys\n filters = clean_params(params)\n validate_filters(filters)\n end", "def clean_filters\n cleaned_filters = {}\n self.filters.each do |name, value|\n if (self.filter_options[name.to_sym][:fields].detect{|f| f[:value] == value } rescue false)\n cleaned_filters[name.to_sym] = value\n end\n end\n self.filters = cleaned_filters\n end", "def filter!(filters)\n node_list = filter(filters)\n Util::assert! node_list.any?, \"Could not match any nodes from '#{filters}'\"\n return node_list\n end", "def filter_parameters; end", "def filter_parameters; end", "def liquid_view_filters\n []\n end", "def get_before_filters method, controller\n return [] unless controller[:options] and controller[:options][:before_filters]\n\n filters = []\n\n if controller[:before_filter_cache].nil?\n filter_cache = []\n\n controller[:options][:before_filters].each do |filter|\n filter_cache << before_filter_to_hash(filter.args)\n end\n\n controller[:before_filter_cache] = filter_cache\n end\n\n controller[:before_filter_cache].each do |f|\n if f[:all] or\n (f[:only] == method) or\n (f[:only].is_a? Array and f[:only].include? method) or\n (f[:except].is_a? Symbol and f[:except] != method) or\n (f[:except].is_a? Array and not f[:except].include? method)\n\n filters.concat f[:methods]\n end\n end\n\n filters\n end", "def apply_filters(methods)\n filters.inject(methods) { |methods, filter| filter.apply(methods, self) }\n end", "def filter!(filters, options={})\n node_list = filter(filters, options)\n Util::assert! node_list.any?, \"Could not match any nodes from '#{filters.join ' '}'\"\n return node_list\n end", "def default_filters\n params[:filter].keys.map(&:to_sym) - @request.resource_klass._custom_filters\n end", "def ts_apply_filters\n # TODO: Make filters for Thinking Sphinx\n end", "def filter(filtering_params)\n\t\t\tresults = self.where(nil)\n\t\t\tfiltering_params.each do |key, value|\n\t\t\t\tresults = results.public_send(key, value) if value.present?\n\t\t\tend\n\t\t\tresults\n\t\tend" ]
[ "0.8456019", "0.845181", "0.845181", "0.8269123", "0.8269123", "0.8209427", "0.801745", "0.797463", "0.79453737", "0.79149646", "0.7739799", "0.77340585", "0.77235585", "0.75622326", "0.7509202", "0.7498318", "0.74026656", "0.7327405", "0.7327405", "0.73237115", "0.73045784", "0.7260947", "0.71196294", "0.71183723", "0.71172357", "0.70943654", "0.70874935", "0.70687634", "0.705342", "0.705342", "0.705342", "0.69636583", "0.6931686", "0.6906909", "0.68981797", "0.6863585", "0.6844211", "0.6834189", "0.68173414", "0.6779809", "0.6779809", "0.6773665", "0.6762397", "0.67595834", "0.67449987", "0.67390174", "0.67382944", "0.6728132", "0.67205423", "0.6713087", "0.67098135", "0.67081594", "0.6704923", "0.66876566", "0.66867924", "0.668375", "0.665071", "0.6643784", "0.6641195", "0.6635414", "0.66246593", "0.6607631", "0.65921307", "0.6581765", "0.6575531", "0.65645236", "0.6560308", "0.6554532", "0.6553667", "0.6548026", "0.65476686", "0.6546535", "0.6546535", "0.6543428", "0.6527714", "0.6523141", "0.651259", "0.6504856", "0.6492372", "0.6491379", "0.64897996", "0.6481976", "0.6477256", "0.6452035", "0.6444141", "0.64436203", "0.6441238", "0.6433737", "0.6418281", "0.6417048", "0.641014", "0.64097154", "0.6404094", "0.6404094", "0.6403891", "0.6399305", "0.6387514", "0.63847893", "0.63831276", "0.6373871", "0.63659" ]
0.0
-1
Single call to ::use
def test_with_one_composite pipeline = Class.new(Pipeline) pipeline.use @append_a result = pipeline.process([]) assert_equal(['a'], result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use(*args, &block); end", "def use(*)\n super\n end", "def use *args, &block\n @app_builder.use(*args, &block)\n end", "def use!(name)\n @parent.gemset_use(name, :replace_env => true)\n end", "def use ware, *args, &proc\n return if locked?\n use? << {:ware => ware, :args => args, :proc => proc}\n end", "def use(sym); end", "def use(middleware, *args, &block)\n @build.use(middleware, *args, &block)\n end", "def use sym, str=nil\n @uses[sym] = str || \"USE #{sym.to_s}\"\n end", "def global_use mod\n use GlobalModule.name\n GlobalModule.instance.use mod\n end", "def use( opts, &block ) # :yield: self\n use! @defaults.merge( opts ), &block\n end", "def use(options={}, &block)\n software, version = parse_software_args((options[:software]||options[:package]), options[:version])\n run_command(\"#{command} use #{software} #{version}\", options, &block)\n end", "def use(name)\n require \"mutant/#{name}\"\n @strategy = Strategy.lookup(name).new\n rescue LoadError\n $stderr.puts(\"Cannot load plugin: #{name.inspect}\")\n raise\n end", "def use\n yield configuration\n nil\n end", "def use(path)\n @default_target.use(path)\n end", "def use!( opts )\n original = @defaults\n @defaults = opts\n\n if block_given?\n begin\n yield self\n ensure\n use! original\n end\n end\n\n return original\n end", "def use(*args, &block)\n @middleware << [args, block].freeze\n @app = nil\n end", "def using(mod)\n ::Kernel.raise 'Module#using is not permitted in methods'\n end", "def use(name)\n @parent.gemset_use(name)\n end", "def use(name)\n require \"mutant/#{name}\"\n @integration = Integration.lookup(name).new\n rescue LoadError\n $stderr.puts(\"Cannot load plugin: #{name.inspect}\")\n raise\n end", "def gemset_use!(name, options = {})\n gemset_use name, {:replace_env => true}.merge(options)\n end", "def using(mod)\n ::Kernel.raise 'main.using is permitted only at toplevel'\n end", "def use(name)\n with(database: name)\n end", "def use(name)\n with(database: name)\n end", "def use(source, as)\n self.query.uses << Source.new(source, as)\n self\n end", "def use(*args, &block)\n @middleware << [args, block].freeze\n build_rack_app\n end", "def use(&block)\n begin\n client = get_object\n\n result = block.call(client)\n result\n rescue Exception => e\n nil # TODO specify the Redis::ConnectionError instead\n ensure\n release(client)\n end\n end", "def use(*args, &block)\n @middleware.insert(@position, [args, block])\n @app.send(:build_rack_app)\n @position += 1\n nil\n end", "def use\n if block_given?\n yield self.config\n end\n self.config\n end", "def use plugin, *args\n Nutcracker.const_get(plugin.to_s.capitalize).start(self,*args)\n end", "def use(sym)\n Service.enable(sym)\n end", "def use(middleware, *args)\n @app = middleware.new(@app, *args)\n end", "def use\n reload_if_needed\n \n raise(@exception) if @exception\n \n @storage.lock.shared {yield}\n end", "def mix\n #future code\n end", "def defuse!\n @@mutex.synchronize { @defused = true }\n end", "def use\n\t\tglUseProgram @id\n\tend", "def setup &block\n block.try(:call, self)\n end", "def use\n @configuration ||= {}\n yield @configuration\n nil\n end", "def use\n @configuration ||= {}\n yield @configuration\n nil\n end", "def use(middleware, *args, &blk)\n @middleware.push([middleware, args, blk])\n end", "def configure(&block); end", "def configure(&block); end", "def call(*) end", "def call(*) end", "def use_block(obj, &method)\n\tmethod.call\nend", "def use(modname,usenames=[])\n unless uses?(modname,:all)\n new_usenames=[]\n code=\"use #{modname}\"\n unless usenames.empty?\n list=[]\n usenames.each do |x|\n h=x.is_a?(Hash)\n localname=(h)?(x.keys.first):(nil)\n usename=(h)?(x.values.first):(x)\n unless uses?(modname,usename)\n list.push(((h)?(\"#{localname}=>#{usename}\"):(\"#{usename}\")))\n new_usenames.push([localname||usename,usename])\n end\n end\n code+=((list.empty?)?(\"\"):(\",only:#{list.join(\",\")}\"))\n end\n up=use_part\n new_usenames=[[:all]] if new_usenames.empty?\n new_uses={modname=>new_usenames}\n old_uses=up.env[:uses]\n up.env[:uses]=(old_uses)?(old_uses.merge(new_uses)):(new_uses)\n # sub HACK start\n code=(\"!sms$ignore begin\\n#{code}\\n!sms$ignore end\")\n t=raw(code,:sms_ignore_use,@srcfile)\n t.parent=up\n up.e.push(t)\n # sub HACK end\n end\n end", "def use(*features); end", "def use(conn = nil)\n conn_given = !!conn\n conn = conn_given ? conn : @pool.checkout\n begin\n yield Thread.current[:squirm_connection] = conn\n ensure\n Thread.current[:squirm_connection] = nil\n @pool.checkin conn unless conn_given\n end\n end", "def use(middleware_class, *middleware_args)\n @stack.use(middleware_class, *middleware_args)\n end", "def use(mw, *args, &block)\n middleware << [mw, args, block]\n end", "def call(env); end", "def call(env); end", "def call(env); end", "def call(env); end", "def call(env); end", "def call(env); end", "def call(env); end", "def used?; end", "def use(middleware, *args, &block)\n @rack_middleware << [middleware, args, block]\n end", "def use(middleware, *args, &block)\n @middlewares ||= []\n @middlewares << [middleware, args.compact, block]\n end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def double_bind; 1; end", "def use_merging(use = T.unsafe(nil)); end", "def use(middleware_class, *middleware_args)\n @handler.use(middleware_class, *middleware_args)\n end", "def call(bind_vars={}, &block)\n bind(bind_vars).run(&block)\n end", "def use(middleware)\n @middlewares << middleware\n end", "def call!(env)\n instance.call(env)\n end", "def use\n raise \"No block was given.\" if !block_given?\n \n obj = self.get_and_lock\n \n begin\n yield(obj)\n ensure\n self.free(obj)\n end\n end", "def mark_as_used\n # noop\n end", "def use(current_player)\n get_model.use(current_player, self)\n end", "def use(klass, *args, &block)\n instance = klass.new(self, *args, &block)\n listen instance\n instance\n end", "def run(_); end", "def run(_); end", "def with(*args)\n spawn.with!(*args)\n end", "def bind; binding() end", "def use ware, *args, &proc\n @middleware << {ware: ware, args: args, block: proc}\n self\n end", "def refork; end", "def call() end", "def call!(*args)\n new(*args).call!\n end", "def use ware, *args, &proc\n @middleware << {ware: ware, args: args, block: proc} if configurable?\n end", "def run; new.run; end", "def hook_require!\n hook_instance_require!\n hook_singleton_require!\n end", "def run(&block)\n task('run').tap do |t|\n t.enhance &block if block\n end\n end", "def run(&block); end", "def bind(&block)\n self\n end", "def bind\n \n end", "def use(plugin, options = {})\n plugin_registry.environment.fetch(plugin).apply_to(self, options)\n end", "def use arg\n if arg.is_a? Symbol\n begin\n dirname = File.expand_path(File.dirname(self.__options[:recipe_file]))\n instance_eval File.read(\"#{dirname}/#{arg.to_s}.rb\")\n rescue Errno::ENOENT => e\n raise Screwcap::IncludeFileNotFound, \"Could not find #{File.expand_path(\"./\"+arg.to_s + \".rb\")}! If the file is elsewhere, call it by using 'use '/path/to/file.rb'\"\n end\n else\n begin\n instance_eval(File.read(arg))\n rescue Errno::ENOENT => e\n raise Screwcap::IncludeFileNotFound, \"Could not find #{File.expand_path(arg)}! If the file is elsewhere, call it by using 'use '/path/to/file.rb'\"\n end\n end\n end", "def use!\n self.used = true\n self.save\n end", "def use_function(name)\n call \"_#{name}\"\n end", "def use(&block)\n @mutex.synchronize { yield @obj, @mutex }\n end", "def call(&cont)\n #setup_all\n cont.call\n #teardown_all\n end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def set_usesr\n @usesr = Usesr.find(params[:id])\n end", "def standalone; end" ]
[ "0.7716489", "0.732768", "0.6622747", "0.62691236", "0.6262655", "0.6259941", "0.61921793", "0.6112874", "0.6057813", "0.60483676", "0.5994351", "0.59628904", "0.5937051", "0.5875306", "0.5856312", "0.57930684", "0.57675695", "0.57536083", "0.57299566", "0.56837475", "0.56675553", "0.56380033", "0.56380033", "0.55852574", "0.55345243", "0.55081284", "0.54912055", "0.54617304", "0.5431774", "0.54205495", "0.5419305", "0.5414445", "0.54005706", "0.53915614", "0.53517765", "0.53423566", "0.53347856", "0.53347856", "0.53201944", "0.5310359", "0.5310359", "0.529959", "0.529959", "0.528405", "0.52670133", "0.5254523", "0.52510977", "0.52437955", "0.5240361", "0.522756", "0.522756", "0.522756", "0.522756", "0.522756", "0.522756", "0.522756", "0.521366", "0.5195909", "0.5174657", "0.5147172", "0.5147172", "0.5147172", "0.5147172", "0.5147172", "0.5147172", "0.5147172", "0.5147172", "0.51302916", "0.5124121", "0.51240355", "0.5115158", "0.51090926", "0.509955", "0.5093035", "0.50848407", "0.50772583", "0.5074693", "0.50741774", "0.50741774", "0.5069008", "0.5067784", "0.50637275", "0.5050254", "0.5041623", "0.50397015", "0.5038547", "0.50360906", "0.5028061", "0.5028034", "0.502618", "0.5022353", "0.5022102", "0.5019953", "0.5017693", "0.50151384", "0.5007438", "0.50034213", "0.49998227", "0.49990243", "0.49979153", "0.499053" ]
0.0
-1
Single call to ::use with multiple classes are chained in the order they are added
def test_with_multiple_composites pipeline = Class.new(Pipeline) pipeline.use @append_a, @append_b result = pipeline.process([]) assert_equal(['a', 'b'], result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use(*)\n super\n end", "def uses(*classes)\n class_helpers.push(*classes).uniq!\n end", "def use(*args, &block); end", "def use(klass, options=nil)\n @ustack ||= []\n @ustack << [klass, options]\n end", "def use(middleware_class, *middleware_args)\n @stack.use(middleware_class, *middleware_args)\n end", "def use *args, &block\n @app_builder.use(*args, &block)\n end", "def import(*classes)\n setup_delegator_strategy!\n use_for(classes, self)\n # the problem here is that use_for sets the wrong target - the class instance, and not the instance itself.\n # this will lead to problems when a helper needs :method. :method will be called on the class, not on \n # the instance, which is wrong.\n end", "def use(middleware_class, *middleware_args)\n @handler.use(middleware_class, *middleware_args)\n end", "def chain(other)\n other.each { |handler| use(handler) }\n self\n end", "def import(*classes)\n setup_delegator_strategy!\n use_for(classes, self)\n end", "def use(middleware, *args, &block)\n @build.use(middleware, *args, &block)\n end", "def use( opts, &block ) # :yield: self\n use! @defaults.merge( opts ), &block\n end", "def apply_to(klass, options = EMPTY_HASH)\n if mod.respond_to?(:new)\n klass.send(:include, mod.new(options))\n else\n klass.send(:include, mod)\n end\n end", "def use ware, *args, &proc\n return if locked?\n use? << {:ware => ware, :args => args, :proc => proc}\n end", "def use(mware, *_args, &block)\n @middleware, @args, @block = mware, _args, block\n @name = @middleware if name.nil?\n if options[:before]\n raise \"#{options[:before].inspect} middleware is not defined for this stack\" unless self.class._mwares.keys.include?(options[:before])\n self.class._before[options[:before]] ||= []\n self.class._before[options[:before]] << name\n elsif options[:after]\n raise \"#{options[:after].inspect} middleware is not defined for this stack\" unless self.class._mwares.keys.include?(options[:after])\n self.class._after[options[:after]] ||= []\n self.class._after[options[:after]] << name\n else\n self.class._central_mwares << name unless self.class._central_mwares.include?(name)\n end\n self.class._mwares[name] = self\n self\n end", "def use(klass, *args)\n if index = @stack.index(@stack.find{|a| a.first == klass})\n @stack[index] = [klass, *args]\n else\n @stack << [klass, *args]\n end\n end", "def using *extension_names\n extension_names.each do |extension_name|\n if extension = @@__extensions.find{|ext| ext.__name.to_s == extension_name.to_s }\n extension.extension_used self if extension.respond_to? :extension_used\n self.metaclass.send :define_method, :\"#{extension_name}\" do\n return extension\n end\n else\n raise ExtensionNotFoundError, \"Extension not found: #{extension_name}\"\n end\n end\n end", "def chain_with(scope_name)\n self + klass.send(scope_name)\n end", "def use(middleware, *args, &block)\n @middlewares ||= []\n @middlewares << [middleware, args.compact, block]\n end", "def class_via(*args, &blk)\n klass = Class.new(*args)\n klass.class_eval(&blk) unless blk.blank?\n return klass\n end", "def stack(middleware, *args, &block)\n middleware.pre_use(self, *args, &block) if(middleware.respond_to?(:pre_use))\n @build.use(middleware, @core, *args, &block)\n middleware.post_use(self, *args, &block) if(middleware.respond_to?(:post_use))\n end", "def use(klass, *args, &block)\n instance = klass.new(self, *args, &block)\n listen instance\n instance\n end", "def initialize(klass, name, using: [], **options, &block)\n @name = name\n @options = Configuration.new(options, &block).options\n\n Array.wrap(using).each do |preset|\n klass.resourcerer_configuration.fetch(preset).apply(options)\n end\n end", "def use(source, as)\n self.query.uses << Source.new(source, as)\n self\n end", "def setup\n super\n @append_a = Module.new\n @append_a.define_singleton_method(:call) do |thing|\n thing << 'a'\n thing\n end\n\n @append_b = Class.new\n @append_b.define_singleton_method(:call) do |thing|\n thing << 'b'\n thing\n end\n\n @append_c = lambda do |thing|\n thing << 'c'\n thing\n end\n end", "def use_class_helpers!\n self.class.class_helpers.each { |helper| use helper }\n end", "def use(class_or_instance, *args)\n case class_or_instance\n when Class then add_listener(class_or_instance.new(*args))\n else add_listener(class_or_instance)\n end\n end", "def use(middleware, options = nil)\n self.middleware << [middleware, options].compact\n end", "def use(*args, &block)\n @middleware << [args, block].freeze\n build_rack_app\n end", "def use(middleware, *args, &blk)\n @middleware.push([middleware, args, blk])\n end", "def use(modname,usenames=[])\n unless uses?(modname,:all)\n new_usenames=[]\n code=\"use #{modname}\"\n unless usenames.empty?\n list=[]\n usenames.each do |x|\n h=x.is_a?(Hash)\n localname=(h)?(x.keys.first):(nil)\n usename=(h)?(x.values.first):(x)\n unless uses?(modname,usename)\n list.push(((h)?(\"#{localname}=>#{usename}\"):(\"#{usename}\")))\n new_usenames.push([localname||usename,usename])\n end\n end\n code+=((list.empty?)?(\"\"):(\",only:#{list.join(\",\")}\"))\n end\n up=use_part\n new_usenames=[[:all]] if new_usenames.empty?\n new_uses={modname=>new_usenames}\n old_uses=up.env[:uses]\n up.env[:uses]=(old_uses)?(old_uses.merge(new_uses)):(new_uses)\n # sub HACK start\n code=(\"!sms$ignore begin\\n#{code}\\n!sms$ignore end\")\n t=raw(code,:sms_ignore_use,@srcfile)\n t.parent=up\n up.e.push(t)\n # sub HACK end\n end\n end", "def use!( opts )\n original = @defaults\n @defaults = opts\n\n if block_given?\n begin\n yield self\n ensure\n use! original\n end\n end\n\n return original\n end", "def with_class_alias(x); end", "def use(*args, &block)\n @middleware << [args, block].freeze\n @app = nil\n end", "def start(klass, *args)\n # Get the hardcore alias.\n hals = \"#{klass}\" + klass.hardcore_alias(*args)\n\n # Has a service already been constructed for this guy? If so, increment\n # its reference count like it aint no thang.\n if (inst = self[hals])\n inst.ref\n return inst\n end\n\n inst = klass.new(*args)\n als = inst.alias\n\n # Find an alias that isn't taken.\n if (self[als])\n cnt = 1\n cnt += 1 while (self[als + \" #{cnt}\"])\n als = inst.alias + \" #{cnt}\"\n end\n\n # Extend the instance as a service.\n inst.extend(Rex::Service)\n\n # Re-aliases the instance.\n inst.alias = als\n\n # Fire up the engines. If an error occurs an exception will be\n # raised.\n inst.start\n\n # Alias associate and initialize reference counting\n self[als] = self[hals] = inst.refinit\n\n # Pass the caller a reference\n inst.ref\n\n inst\n end", "def using(mod)\n ::Kernel.raise 'Module#using is not permitted in methods'\n end", "def add_classes(*args)\n args.each {|x| self.add_class(x) }\n return self\n end", "def use(middleware)\n @middlewares << middleware\n end", "def use(*features); end", "def with(*args)\n spawn.with!(*args)\n end", "def add(classes)\n classes = classes.to_s.split(' ')\n classes.each { |cls| super cls }\n self\n end", "def using(options = {})\n merged = Ramaze::Cache::Moneta.trait[:default].merge(options)\n Class.new(self) { @options = merged }\n end", "def test_with_multiple_compositions\n pipeline = Class.new(Pipeline)\n pipeline.use @append_a, @append_b\n pipeline.use @append_c\n result = pipeline.process([])\n assert_equal(['a', 'b', 'c'], result)\n end", "def instance_final_activate\n self.instance_result =\n self.instance_block.map{ |name, inst|\n inst.(self.inst)\n } unless self.instance_block.nil?\n self.kinder\n .each{ |os|\n os.instance_final_activate unless os.reusable?\n }\n self\n end", "def use_scopes(*klasses, &block)\n self.scope_context += klasses.flatten\n yield\n self.scope_context -= klasses.flatten\n nil # should not be chained\n end", "def mixins(*scopes); end", "def use(mw, *args, &block)\n middleware << [mw, args, block]\n end", "def use(middleware, *args)\n @app = middleware.new(@app, *args)\n end", "def use ware, *args, &proc\n @middleware << {ware: ware, args: args, block: proc}\n self\n end", "def refined(klass, with:)\n Module.new do\n refine klass do\n Array(with).each &method(:include)\n end\n end\n end", "def using(*args)\n args.pop.each { |key, value| @options[key.to_sym] = value } if Hash === args.last\n\n until args.empty?\n new_runner = Run.select_by_name(args.pop)\n @runner = new_runner.new(project) unless new_runner.nil?\n end\n\n self\n end", "def use(sym); end", "def use!(name)\n @parent.gemset_use(name, :replace_env => true)\n end", "def use(middleware, *args, &block)\n @rack_middleware << [middleware, args, block]\n end", "def apply_to(target, **options)\n if mod.respond_to?(:apply)\n mod.apply(target, **config, **options)\n elsif mod.respond_to?(:new)\n target.include(mod.new(**options))\n elsif mod.is_a?(::Module)\n # Target can be either a component class, like a Relation class, or a DSL object\n # If it's the former, just include the module, if it's the latter, assume it defines\n # a component constant and include it there\n if target.is_a?(Class)\n target.include(mod)\n elsif target.respond_to?(:constant)\n target.constant.include(mod)\n end\n end\n self\n end", "def mix\n #future code\n end", "def using(options = {})\n merged = Ramaze::Cache::Sequel.trait[:default].merge(options)\n Class.new(self) { @options = merged }\n end", "def using(options = {})\n merged = Ramaze::Cache::Sequel.trait[:default].merge(options)\n Class.new(self) { @options = merged }\n end", "def use( klass, opts={} )\n behavior_options[SystemUser] ||= Hash.new\n behavior_options[SystemUser][klass] = opts\n end", "def lift_with(*args, &block)\n full_lift_proc(&block).call(*args)\n end", "def use(middleware, *middleware_params, &block)\n configure_proc = block_given? ? Proc.new(&block) : nil\n self.middleware << [middleware, middleware_params, configure_proc]\n end", "def with(options)\n @options_collectors << self.class.new(options)\n @options_collectors.last.requirements = self.requirements.dup # dup important so my reqs don't change\n return @options_collectors.last\n end", "def load!\n class_names.each { |name| self[name] }\n end", "def use(interceptor_class, options = {})\n interceptors_mutex do\n @registry << {\n klass: interceptor_class,\n options: options\n }\n end\n end", "def with(options={})\n alt = dup\n alt.with!(options)\n end", "def in_sklass\n @sclass.push true\n\n with_new_method_stack do\n yield\n end\n ensure\n @sclass.pop\n end", "def with(*args, &block)\n return with_and_options(args, &block)\n end", "def use(processor)\n definition << processor\n processor\n end", "def mark_subclasses_method_used(class_name, method_name)\n Prepares.klasses.select { |klass| klass.extend_class_name == class_name }.each do |klass|\n mark_subclasses_method_used(klass.to_s, method_name)\n method = get_method(klass.to_s, method_name)\n method&.mark_used\n end\n end", "def with(target = DEFAULT_TARGET)\n klass = Class.new(self.class)\n klass.configure { |c| c.target = target }\n\n yield(klass.new)\n end", "def use plugin, *args\n Nutcracker.const_get(plugin.to_s.capitalize).start(self,*args)\n end", "def with(*specs)\n @classpath |= Buildr.artifacts(specs.flatten).uniq\n self\n end", "def with(*specs)\n @classpath |= Buildr.artifacts(specs.flatten).uniq\n self\n end", "def wrappers(*args, &block); end", "def use(*args, &block)\n @middleware.insert(@position, [args, block])\n @app.send(:build_rack_app)\n @position += 1\n nil\n end", "def use ware, *args, &proc\n @middleware << {ware: ware, args: args, block: proc} if configurable?\n end", "def test_class_for(*mods, &blk)\n klass = Class.new\n klass.class_eval { include(*mods) }\n klass.class_eval(&blk) unless blk.blank?\n return klass\n end", "def auto_include!\n mixins = @@class_mixins[name]\n send(:include, *mixins) if mixins\n end", "def manages(*classes)\n @objectclasses = classes\n self\n end", "def use(processor, options = {})\n @stack << [self.class.get_callable(processor, HtmlMockup::Release::Processors), options]\n end", "def using(*args)\n args.pop.each { |key, value| options.send \"#{key}=\", value } if Hash === args.last\n self.compiler = args.pop until args.empty?\n self\n end", "def use(processor)\n @processors << processor\n self\n end", "def include_into(*klasses)\n klasses.flatten!\n klasses.each do |klass|\n (@@class_mixins[klass] ||= []) << self\n @@class_mixins[klass].uniq!\n end\n end", "def with(*specs)\n @dependencies |= Buildr.artifacts(specs.flatten).uniq\n self\n end", "def setup\n for c in @advised_classes\n apply(c)\n end\n end", "def gemset_use!(name, options = {})\n gemset_use name, {:replace_env => true}.merge(options)\n end", "def use sym, str=nil\n @uses[sym] = str || \"USE #{sym.to_s}\"\n end", "def with(opts={})\n self.merge(opts)\n end", "def use_for(klass)\n klass.use_dissident!\n end", "def call(*args)\n before *args\n klass = _extract_class!(args)\n Ing.execute(klass, *args) do |cmd|\n configure_command cmd\n end\n after\n end", "def use(plugin, options = {})\n case plugin\n when Array then plugin.each { |p| use(p) }\n when Hash then plugin.to_a.each { |p| use(*p) }\n else\n plugin_registry[:configuration].fetch(plugin).apply_to(self, options)\n end\n\n self\n end", "def use(name)\n @parent.gemset_use(name)\n end", "def setup(&block)\n passed_through_setup = self.setup_chained\n self.setup_chained = lambda { instance_eval(&passed_through_setup);instance_eval(&block) }\n define_method :setup, &self.setup_chained\n end", "def required_if_used(*args)\n unless @required_gems\n [:included, :extended, :inherited].each do |method_name|\n define_method(method_name) do |klass|\n super if defined?(super)\n @required_gems.each { |gem| require gem.to_s }\n end\n end\n end\n @required_gems ||= []\n @required_gems |= args\n end", "def use(name, options = {})\n return self if enabled_plugins.include?(name)\n\n raise PluginNotFoundError, name unless (plugin = Plugins.registry[name])\n\n plugin.load_dependencies\n plugin.apply_to(self, options)\n\n enabled_plugins << name\n\n self\n end", "def test_multiple_classes_using_module\n other = Class.new do\n extend Puppet::Util::SubclassLoader\n handle_subclasses :other, \"puppet/other\"\n end\n Object.const_set(\"OtherLoader\", other)\n\n mk_subclass(\"multipletest\", \"puppet/other\", \"OtherLoader\")\n mk_subclass(\"multipletest\", \"puppet/fakeloaders\", \"TestPuppetUtilSubclassLoader::LoadTest\")\n #system(\"find #{@basedir}\")\n #puts File.read(File.join(@basedir, \"puppet/fakeloaders/multipletest.rb\"))\n #puts File.read(File.join(@basedir, \"puppet/other/multipletest.rb\"))\n\n othersub = mainsub = nil\n assert_nothing_raised(\"Could not look up other sub\") do\n othersub = OtherLoader.other(:multipletest)\n end\n assert_nothing_raised(\"Could not look up main sub\") do\n mainsub = LoadTest.faker(:multipletest)\n end\n assert(othersub, \"did not get other sub\")\n assert(mainsub, \"did not get main sub\")\n assert(othersub.ancestors.include?(OtherLoader), \"othersub is not a subclass of otherloader\")\n assert(mainsub.ancestors.include?(LoadTest), \"mainsub is not a subclass of loadtest\")\n end", "def helper(*klazzes)\n klazzes.each { |klazz| self.class.send(:include, klazz) }\n end", "def assign_driver(cls, args, block)\n _cls = cls\n if not _cls.kind_of? Class\n _cls = cls.class\n end\n\n driver = nil\n name = nil\n \n self.class::DRIVERS.each_pair do |_name, _driver|\n begin\n _module = Module::get_module(_name.to_s)\n rescue NameError\n next\n end\n \n if _cls <= _module\n driver = _driver\n name = _name\n break\n end\n end\n \n ###\n \n require \"unified-queues/multi/driver/\" << driver\n \n path = name.to_s.split(\"::\")\n classname = path.shift << 'Driver::' << path.join('::')\n _module = Module::get_module(\"UnifiedQueues::Multi::Driver::\" << classname)\n \n args = [cls] + args\n @driver = _module::new(*args, &block)\n return @driver\n end", "def use(options={}, &block)\n software, version = parse_software_args((options[:software]||options[:package]), options[:version])\n run_command(\"#{command} use #{software} #{version}\", options, &block)\n end", "def alias_class_method_chain(target, feature)\n # Strip out punctuation on predicates or bang methods since\n # e.g. target?_without_feature is not a valid method name.\n aliased_target, punctuation = target.to_s.sub(/([?!=])$/, ''), $1\n yield(aliased_target, punctuation) if block_given?\n alias_class_method \"#{aliased_target}_without_#{feature}#{punctuation}\", target\n alias_class_method target, \"#{aliased_target}_with_#{feature}#{punctuation}\"\n end", "def load(namespaces = {})\n namespaces.each_pair { |name, uses| instance(name).use(uses) }\n end" ]
[ "0.6976594", "0.69018763", "0.6592517", "0.63450384", "0.61621755", "0.585968", "0.57918954", "0.5784724", "0.57833844", "0.571004", "0.5686177", "0.56314397", "0.5618399", "0.55834126", "0.55242056", "0.54829216", "0.5463985", "0.5443967", "0.5409996", "0.54028064", "0.5391037", "0.5348156", "0.532971", "0.5292222", "0.5264093", "0.5233846", "0.52243906", "0.5200355", "0.5192908", "0.51919335", "0.51864064", "0.51773417", "0.51710945", "0.51657057", "0.5165526", "0.515877", "0.51504046", "0.5113529", "0.5081798", "0.50753367", "0.50686854", "0.506419", "0.5050059", "0.50497174", "0.50474995", "0.50439566", "0.5026968", "0.50143486", "0.5007435", "0.50068384", "0.5005738", "0.49987194", "0.49958777", "0.49894834", "0.49774697", "0.49746057", "0.49658424", "0.49658424", "0.49436355", "0.4928474", "0.49274006", "0.49127692", "0.49072507", "0.49072424", "0.49060175", "0.49012047", "0.48989034", "0.48902705", "0.4886591", "0.4880635", "0.48800504", "0.4878544", "0.4878544", "0.4878087", "0.48754033", "0.48666328", "0.4859111", "0.485211", "0.48503748", "0.48502618", "0.48499852", "0.48436463", "0.4841402", "0.48353142", "0.48317695", "0.4828473", "0.48273352", "0.48242712", "0.4818353", "0.48174334", "0.4816962", "0.4813232", "0.4813054", "0.4812599", "0.4809915", "0.48098823", "0.480294", "0.47896984", "0.47795305", "0.47759315", "0.47702852" ]
0.0
-1
Multiple calls to ::use are chained in the order they are added
def test_with_multiple_compositions pipeline = Class.new(Pipeline) pipeline.use @append_a, @append_b pipeline.use @append_c result = pipeline.process([]) assert_equal(['a', 'b', 'c'], result) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use(*)\n super\n end", "def use(*args, &block); end", "def use *args, &block\n @app_builder.use(*args, &block)\n end", "def use ware, *args, &proc\n return if locked?\n use? << {:ware => ware, :args => args, :proc => proc}\n end", "def use(middleware, *args, &block)\n @build.use(middleware, *args, &block)\n end", "def use!(name)\n @parent.gemset_use(name, :replace_env => true)\n end", "def use( opts, &block ) # :yield: self\n use! @defaults.merge( opts ), &block\n end", "def use(sym); end", "def chain(other)\n other.each { |handler| use(handler) }\n self\n end", "def use(*args, &block)\n @middleware << [args, block].freeze\n @app = nil\n end", "def use(middleware, *args, &blk)\n @middleware.push([middleware, args, blk])\n end", "def using(mod)\n ::Kernel.raise 'Module#using is not permitted in methods'\n end", "def use!( opts )\n original = @defaults\n @defaults = opts\n\n if block_given?\n begin\n yield self\n ensure\n use! original\n end\n end\n\n return original\n end", "def use(mware, *_args, &block)\n @middleware, @args, @block = mware, _args, block\n @name = @middleware if name.nil?\n if options[:before]\n raise \"#{options[:before].inspect} middleware is not defined for this stack\" unless self.class._mwares.keys.include?(options[:before])\n self.class._before[options[:before]] ||= []\n self.class._before[options[:before]] << name\n elsif options[:after]\n raise \"#{options[:after].inspect} middleware is not defined for this stack\" unless self.class._mwares.keys.include?(options[:after])\n self.class._after[options[:after]] ||= []\n self.class._after[options[:after]] << name\n else\n self.class._central_mwares << name unless self.class._central_mwares.include?(name)\n end\n self.class._mwares[name] = self\n self\n end", "def use sym, str=nil\n @uses[sym] = str || \"USE #{sym.to_s}\"\n end", "def use(middleware, *args, &block)\n @middlewares ||= []\n @middlewares << [middleware, args.compact, block]\n end", "def use(name)\n @parent.gemset_use(name)\n end", "def mix\n #future code\n end", "def use(modname,usenames=[])\n unless uses?(modname,:all)\n new_usenames=[]\n code=\"use #{modname}\"\n unless usenames.empty?\n list=[]\n usenames.each do |x|\n h=x.is_a?(Hash)\n localname=(h)?(x.keys.first):(nil)\n usename=(h)?(x.values.first):(x)\n unless uses?(modname,usename)\n list.push(((h)?(\"#{localname}=>#{usename}\"):(\"#{usename}\")))\n new_usenames.push([localname||usename,usename])\n end\n end\n code+=((list.empty?)?(\"\"):(\",only:#{list.join(\",\")}\"))\n end\n up=use_part\n new_usenames=[[:all]] if new_usenames.empty?\n new_uses={modname=>new_usenames}\n old_uses=up.env[:uses]\n up.env[:uses]=(old_uses)?(old_uses.merge(new_uses)):(new_uses)\n # sub HACK start\n code=(\"!sms$ignore begin\\n#{code}\\n!sms$ignore end\")\n t=raw(code,:sms_ignore_use,@srcfile)\n t.parent=up\n up.e.push(t)\n # sub HACK end\n end\n end", "def use\n yield configuration\n nil\n end", "def gemset_use!(name, options = {})\n gemset_use name, {:replace_env => true}.merge(options)\n end", "def use(middleware)\n @middlewares << middleware\n end", "def use(*args, &block)\n @middleware.insert(@position, [args, block])\n @app.send(:build_rack_app)\n @position += 1\n nil\n end", "def global_use mod\n use GlobalModule.name\n GlobalModule.instance.use mod\n end", "def use(*args, &block)\n @middleware << [args, block].freeze\n build_rack_app\n end", "def stack(middleware, *args, &block)\n middleware.pre_use(self, *args, &block) if(middleware.respond_to?(:pre_use))\n @build.use(middleware, @core, *args, &block)\n middleware.post_use(self, *args, &block) if(middleware.respond_to?(:post_use))\n end", "def use(source, as)\n self.query.uses << Source.new(source, as)\n self\n end", "def using(mod)\n ::Kernel.raise 'main.using is permitted only at toplevel'\n end", "def use(middleware, options = nil)\n self.middleware << [middleware, options].compact\n end", "def uses(*classes)\n class_helpers.push(*classes).uniq!\n end", "def use(klass, options=nil)\n @ustack ||= []\n @ustack << [klass, options]\n end", "def use(mw, *args, &block)\n middleware << [mw, args, block]\n end", "def use(middleware, *args, &block)\n @rack_middleware << [middleware, args, block]\n end", "def use(options={}, &block)\n software, version = parse_software_args((options[:software]||options[:package]), options[:version])\n run_command(\"#{command} use #{software} #{version}\", options, &block)\n end", "def use_merging(use = T.unsafe(nil)); end", "def used?; end", "def using *extension_names\n extension_names.each do |extension_name|\n if extension = @@__extensions.find{|ext| ext.__name.to_s == extension_name.to_s }\n extension.extension_used self if extension.respond_to? :extension_used\n self.metaclass.send :define_method, :\"#{extension_name}\" do\n return extension\n end\n else\n raise ExtensionNotFoundError, \"Extension not found: #{extension_name}\"\n end\n end\n end", "def use(middleware_class, *middleware_args)\n @stack.use(middleware_class, *middleware_args)\n end", "def use ware, *args, &proc\n @middleware << {ware: ware, args: args, block: proc}\n self\n end", "def around_espionage\n 'this method is overriding #around_alias\n defined in the module, but will concateate\n the previously defined method, using the\n #convolutions alias defined in the included module.\n here it comes' << convolutions\n end", "def use(*features); end", "def use(middleware, *args)\n @app = middleware.new(@app, *args)\n end", "def reuse_setup(&block)\n setup do\n raise \"cannot nest reuse_setup\" if @_used_reuse_setup\n @_used_reuse_setup = true\n\n @shoulda_context.previous_setup ||= begin\n instance_exec(&block)\n variables = instance_variables - [:@method_name, :@internal_data, :@_result, :@shoulda_context, :@_used_reuse_setup]\n variables.map{|k| [k, instance_variable_get(k)] }\n end\n @shoulda_context.previous_setup.each { |k,v| instance_variable_set(k,v) }\n end\n end", "def use ware, *args, &proc\n @middleware << {ware: ware, args: args, block: proc} if configurable?\n end", "def hook_require!\n hook_instance_require!\n hook_singleton_require!\n end", "def double_bind; 1; end", "def use(middleware, *middleware_params, &block)\n configure_proc = block_given? ? Proc.new(&block) : nil\n self.middleware << [middleware, middleware_params, configure_proc]\n end", "def use(processor)\n definition << processor\n processor\n end", "def use(name)\n require \"mutant/#{name}\"\n @strategy = Strategy.lookup(name).new\n rescue LoadError\n $stderr.puts(\"Cannot load plugin: #{name.inspect}\")\n raise\n end", "def freeze\n context and inclusions and super\n end", "def with(*args)\n spawn.with!(*args)\n end", "def setup\n super\n @append_a = Module.new\n @append_a.define_singleton_method(:call) do |thing|\n thing << 'a'\n thing\n end\n\n @append_b = Class.new\n @append_b.define_singleton_method(:call) do |thing|\n thing << 'b'\n thing\n end\n\n @append_c = lambda do |thing|\n thing << 'c'\n thing\n end\n end", "def with(options)\n @options_collectors << self.class.new(options)\n @options_collectors.last.requirements = self.requirements.dup # dup important so my reqs don't change\n return @options_collectors.last\n end", "def alias_of; end", "def use(name, options = {})\n return self if enabled_plugins.include?(name)\n\n raise PluginNotFoundError, name unless (plugin = Plugins.registry[name])\n\n plugin.load_dependencies\n plugin.apply_to(self, options)\n\n enabled_plugins << name\n\n self\n end", "def use(name)\n with(database: name)\n end", "def use(name)\n with(database: name)\n end", "def call(&cont)\n #setup_all\n cont.call\n #teardown_all\n end", "def use\n if block_given?\n yield self.config\n end\n self.config\n end", "def defuse!\n @@mutex.synchronize { @defused = true }\n end", "def use(middleware_class, *middleware_args)\n @handler.use(middleware_class, *middleware_args)\n end", "def ridkuse(*versions)\n versions.each do |version|\n @executables << BenchmarkDriver::RidkUse.parse_spec(version)\n end\n end", "def using(*args)\n args.pop.each { |key, value| options.send \"#{key}=\", value } if Hash === args.last\n self.compiler = args.pop until args.empty?\n self\n end", "def used\n raise NotImplementedError\n end", "def setup &block\n block.try(:call, self)\n end", "def setup(&block)\n passed_through_setup = self.setup_chained\n self.setup_chained = lambda { instance_eval(&passed_through_setup);instance_eval(&block) }\n define_method :setup, &self.setup_chained\n end", "def uses?(mod); end", "def use\n @configuration ||= {}\n yield @configuration\n nil\n end", "def use\n @configuration ||= {}\n yield @configuration\n nil\n end", "def do_twice(what)\n what.call\n what.call\nend", "def adopt_dependencies\n super if defined? super\n end", "def with(options={})\n alt = dup\n alt.with!(options)\n end", "def use(processor)\n @processors << processor\n self\n end", "def with(*args, &block)\n return with_and_options(args, &block)\n end", "def with(opts={})\n self.merge(opts)\n end", "def use(&block)\n begin\n client = get_object\n\n result = block.call(client)\n result\n rescue Exception => e\n nil # TODO specify the Redis::ConnectionError instead\n ensure\n release(client)\n end\n end", "def use\n reload_if_needed\n \n raise(@exception) if @exception\n \n @storage.lock.shared {yield}\n end", "def instance_final_activate\n self.instance_result =\n self.instance_block.map{ |name, inst|\n inst.(self.inst)\n } unless self.instance_block.nil?\n self.kinder\n .each{ |os|\n os.instance_final_activate unless os.reusable?\n }\n self\n end", "def with!( &blk )\n self.instance_eval &blk\n self\n end", "def testReuseMixWithAlias\n execute_Mix_WithConf({\n :WaveFiles => {\n :FilesList => [\n {\n :Name => 'Wave.wav'\n }\n ]\n },\n :Mix => {\n 'Mix1' => {\n :Tracks => {\n 'Wave.wav' => {}\n },\n :Alias => 'First mix'\n },\n 'Final' => {\n :Tracks => {\n 'First mix' => {\n :Processes => [\n {\n :Name => 'Test',\n :Param1 => 'TestParam1'\n }\n ]\n }\n }\n }\n }\n },\n :PrepareFiles => [\n [ 'Wave/Empty.wav', 'Wave.wav' ]\n ]) do |iStdOUTLog, iStdERRLog, iExitStatus|\n assert_exitstatus 0, iExitStatus\n lWave0FileName = getFileFromGlob('05_Mix/Wave.0.Test.????????????????????????????????.wav')\n assert_rb_content [\n {\n :InputFileName => 'Wave.wav',\n :OutputFileName => lWave0FileName,\n :Params => {\n :Param1 => 'TestParam1'\n }\n }\n ], 'Process_Test.rb'\n assert_wave_lnk 'Empty', '05_Mix/Final/Mix1.wav'\n assert_wave_lnk 'Empty', '05_Mix/Final/Final.wav'\n end\n end", "def mark_as_used\n # noop\n end", "def setup(&block)\n block ? @setup << block : @setup\n end", "def with(*specs)\n @dependencies |= Buildr.artifacts(specs.flatten).uniq\n self\n end", "def with(*args)\n @_args = args\n self\n end", "def with!(*args)\n register_factory 'let!', *args\n end", "def use(path)\n @default_target.use(path)\n end", "def chain_with(scope_name)\n self + klass.send(scope_name)\n end", "def setup\n yield self\n self\n end", "def method_missing(sym, *args, &block)\n if @library.macros(true).include?(sym)\n call(sym, *args, &block)\n elsif @library.functions(true).include?(sym)\n call(sym, *args, &block)\n elsif @library.globals(true).include?(sym)\n global(sym, *args, &block)\n else\n super(sym, *args, &block)\n end\n end", "def setup_and_apply(source, error_reporter, consume_all); end", "def with( &blk )\n # blk[ self ]\n self.instance_eval &blk\n end", "def wrappers(*args, &block); end", "def initialize(klass, name, using: [], **options, &block)\n @name = name\n @options = Configuration.new(options, &block).options\n\n Array.wrap(using).each do |preset|\n klass.resourcerer_configuration.fetch(preset).apply(options)\n end\n end", "def using(options = {})\n merged = Ramaze::Cache::Sequel.trait[:default].merge(options)\n Class.new(self) { @options = merged }\n end", "def using(options = {})\n merged = Ramaze::Cache::Sequel.trait[:default].merge(options)\n Class.new(self) { @options = merged }\n end", "def configure(&block); end", "def configure(&block); end", "def use(name)\n require \"mutant/#{name}\"\n @integration = Integration.lookup(name).new\n rescue LoadError\n $stderr.puts(\"Cannot load plugin: #{name.inspect}\")\n raise\n end", "def use(processor, options = {})\n @stack << [self.class.get_callable(processor, HtmlMockup::Release::Processors), options]\n end", "def context(&block); end", "def context(&block); end" ]
[ "0.7466485", "0.72019905", "0.6407717", "0.62412554", "0.6098602", "0.6064689", "0.60187584", "0.59936553", "0.58786577", "0.58250964", "0.57923037", "0.576246", "0.57579744", "0.5709693", "0.570244", "0.56762785", "0.5671006", "0.5603355", "0.5594693", "0.5593962", "0.5583155", "0.5571614", "0.55568355", "0.5555216", "0.55455345", "0.554118", "0.5534248", "0.55292934", "0.5524484", "0.546308", "0.5432869", "0.5415852", "0.54146147", "0.5403453", "0.538384", "0.53277206", "0.53166336", "0.5315132", "0.52897143", "0.527385", "0.5259537", "0.5205823", "0.51845086", "0.51819664", "0.5175709", "0.5157608", "0.5154791", "0.5153623", "0.5145513", "0.51345515", "0.5108487", "0.51011723", "0.5083424", "0.5082926", "0.50610024", "0.5053435", "0.5053435", "0.5052933", "0.50516886", "0.5047985", "0.5044408", "0.5034939", "0.50236446", "0.50112945", "0.5005809", "0.50023663", "0.49892747", "0.4980718", "0.4980718", "0.49664468", "0.4951305", "0.49464372", "0.49356997", "0.4932769", "0.49316418", "0.49266908", "0.49228716", "0.4922265", "0.49074197", "0.49044454", "0.4902997", "0.490065", "0.48962596", "0.48873127", "0.48866272", "0.4877914", "0.48772144", "0.48569134", "0.48528793", "0.48500368", "0.48384187", "0.48290467", "0.48197713", "0.48144835", "0.48144835", "0.48062834", "0.48062834", "0.4795987", "0.4790017", "0.47866622", "0.47866622" ]
0.0
-1
GET /officers GET /officers.json
def index @officers = Officer.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def show\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @officer }\n end\n end", "def show\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @officer }\n end\n end", "def show\n @search = Search.find(params[:id])\n @public_officers = @search.public_officers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search.public_officers }\n end\n \n end", "def index\n @offices = Office.all\n json_response(@offices)\n end", "def index\n @offices = Office.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end", "def officers(id)\n items = []\n offset = 0\n xid = make_transaction_id\n\n loop do\n page = request(:officers, id, '/officers', { start_index: offset }, xid)\n new_items = page['items']\n total = page['total_results'] || new_items.count\n\n items += new_items\n offset += new_items.count\n\n break if items.count >= total\n end\n\n items\n end", "def index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end", "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end", "def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end", "def index\n respond_with(@collection) do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end", "def index\n @trafficofficers = Trafficofficer.all\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def index\n\t\t@guild_officers = @guild.officers.where.not(id: @guild.owner.id)\n\tend", "def index\n @offices = Office.where(\"user_id = ?\", current_user).order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def index\n @officers = Officer.find(:all)\n @clubs = Club.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @officers }\n end\n end", "def index\n @attendees = Attendee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attendees }\n end\n end", "def index\n #byebug\n #CHECK AUTHORIZATION HERE NOT JUST JUST AUTHENTICATION\n \n render json: {farmers: Farmer.all, customers: CustomerUser.all} #User.all #CustomerUser.all #{users: User.all, customers: Customer_User.all}\n end", "def index\n begin\n # Beers of current user\n beers = @current_user.beers\n\n #Filter by name\n if params[:name].present?\n beers = beers.where(name: params[:name])\n end\n\n #Filter by abv\n if params[:abv].present?\n beers = beers.where(abv: params[:abv])\n end\n render json: BeerSerializer.new(beers).collection_attr_array\n rescue StandardError => e\n message = e.message\n end\n end", "def index\n client = find_client(request.headers[\"X-CLIENT-TOKEN\"], request.headers[\"X-CLIENT-EMAIL\"])\n @appointments = client.appointments.includes(:stylist).includes(:offerings).order(\"created_at DESC\")\n respond_to do |f|\n f.json {\n render :json => @appointments\n }\n end\n end", "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end", "def index\n @offices = current_user.offices\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offices }\n end\n end", "def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end", "def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end", "def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end", "def appointments(officer_id)\n client.get(\"officers/#{officer_id}/appointments/\")\n end", "def index\n @attendees = Attendees.all\n render json: @attendees\n end", "def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @officer }\n end\n end", "def index\n @offerers = Offerer.all\n end", "def index\n @chargers = Charger.all\n render json: @chargers\n end", "def index\n if params[:for_applicant]\n @offers = current_user.applicant.offers\n elsif params[:for_positions]\n @offers = []\n current_user.positions.each { |offer| @offers << offer }\n else\n @offers = Offer.all\n end\n\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n end\n end", "def show\n render json: Agent.find(params[:id]).buyers\n end", "def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end", "def index\n @recent = Highfive.recent.approved\n @leaders = User.leaders\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @highfives }\n end\n end", "def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @officer }\n end\n end", "def index\n @telefones = Telefone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @telefones }\n end\n end", "def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n end\n \n respond_to do |format|\n format.json { render json: entities }\n end\n end", "def getOffers\n if current_contractor || current_user\n offers_per_post = Offer.where(post_id: params[:post_id])\n @offers = offers_per_post.order(created_at: :asc).limit(10)\n\n render json: @offers.as_json(include: [{contractor: { methods: [:avatar_url] }}, :post,])\n end\n end", "def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def index\n @adopters = Adopter.where(filtering_params)\n\n render json: @adopters\n end", "def index\n @offenders = Offender.all(:order => \"lastname\")\n respond_to do |format|\n format.mobile\n format.html # index.html.erb\n format.xml { render :xml => @offenders }\n end\n end", "def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\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 show\n @officer = Officer.find(params[:id])\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end", "def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers.to_json, :callback => params[:callback] }\n end\n end", "def new\n @clientsOffers = ClientsOffers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def show\n @prayers = Prayer.all\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end", "def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend", "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end", "def index\n @empskeds = Empsked.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empskeds }\n end\n end", "def index\n @faculties = Faculty.all\n json_response(@faculties)\n end", "def index\n render json: Client.all\n end", "def index\n @zones = Zone.all\n\n render json: @zones\n end", "def index\n @requesters = Requester.all\n end", "def findFollowees\n @user = User.find(params[:id])\n @followees = @user.followees.all\n render json: @followees, status: :ok\n end", "def response(env)\n uid = env.params['uid']\n if uid.nil?\n [200, {}, erb(:default, :locals => {:uid => nil, :pub0 => nil, :page => nil})]\n else\n pub0 = env.params['pub0']\n page = env.params['page']\n begin\n\n offers = Application.offersService.getOffers(uid, pub0, page)\n [200, {}, erb(:offers, :locals => {:offers => offers, :uid => uid, :pub0 => pub0, :page => page})]\n rescue Exception => error\n [200, {}, erb(:error, :locals => {:errorMsg => error.message, :uid => uid, :pub0 => pub0, :page => page})]\n end\n end\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n @parties = Party.order(:name).all\n\n respond_to do |format|\n format.html\n format.json { render json: @parties }\n format.xml { render xml: @parties }\n end\n end", "def index\n @offices = Office.all\n #Office.lets_scrape\n end", "def index_attending\n puts \"user: #{@current_user.json_hash[:id]}\"\n dinners = []\n @dinners = @current_user.attended_dinners\n @dinners.each do |dinner|\n dinners << dinner.all_info\n end\n render json: dinners\n end", "def index\n @alleys = Alley.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alleys }\n end\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def index\n @ozones = Ozone.all\n render json: @ozones\n end", "def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end", "def buyers\n result = get_buyers(params, false)\n render json: result, status: 200\n end", "def index\n @clients = Client.all\n render json: @clients\n end", "def index\n @loan_officers = LoanOfficer.all\n end", "def people\n Birdman::Requester.get(\"movies/#{id}/people\")\n end", "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end", "def show\n @agents = Agent.employees.order('created_at ASC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lead }\n end\n end", "def index\n @title = t('view.firefighters.index_title')\n @searchable = true\n @firefighters = Firefighter.filtered_list(params[:q]).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Firefighter.all }\n end\n end", "def index\n @papers = Paper.all\n\n render json: @papers\n end", "def index\n @briefs = Brief.includes(:user).order(created_at: :desc).all\n render json: @briefs, each_serializer: BriefsSerializer\n end", "def show\n @trainer = Trainer.find(params[:id])\n\n render json: @trainer.as_json(only: [:name], include: [:trainees])\n end", "def index\n\t\tall_people = Person.all.sort_by(&:id)\n\t\tif all_people\n\t\t\trender json: {people: all_people}\n\t\telse\n\t\t\trender body: 'People Not Found', status: 404\n\t\tend\n\tend", "def index\n json_response(Restaurant.all)\n end", "def index\n @flyer_infos = FlyerInfo.all(:select => \"id, topimg, sideimg, capacity, speed, stormresist, multiplier, price, tier, load_time, disabled\")\n @language = ApplicationHelper.preferred_language(request.headers[\"Accept-Language\"])\n\n @complete_flyers = @flyer_infos.collect { |flyer_info|\n flyer_info.as_json.merge(FlyerInfosHelper.getflyerloc(flyer_info, @language).first.as_json)\n }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @complete_flyers }\n end\n end", "def index\n # @faculties = Faculty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@faculties, mode: :compat) }\n end\n end", "def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end", "def index\n @zones = Zone.all\n render json: @zones\n #@zones\n end", "def officers(company_number, items_per_page = nil, start_index = nil, register_type = nil, order_by = nil, register_view = nil)\n params = {}\n params[:items_per_page] = items_per_page if items_per_page\n params[:start_index] = start_index if start_index\n params[:register_type] = register_type if register_type\n params[:order_by] = order_by if order_by\n params[:register_view] = register_view if register_view\n client.get(\"company/#{company_number}/officers/\", params)\n end", "def find_office_by_career\n @office_careers = OfficeCareer.find_office_by_career(params[:career_id])\n json_response(@office_careers)\n end", "def list_inventors\n json_out(Inventor.all)\n end", "def list_inventors\n json_out(Inventor.all)\n end", "def index\n @offers = getmydata(\"Offer\")\n\tpagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end" ]
[ "0.70120776", "0.68085766", "0.67574185", "0.6749666", "0.6535951", "0.6460695", "0.64397985", "0.643415", "0.6344507", "0.6323022", "0.63114", "0.62589526", "0.62439644", "0.6226215", "0.6191653", "0.6174885", "0.61508185", "0.6139957", "0.6135376", "0.61279106", "0.61194783", "0.61155367", "0.6080411", "0.6078964", "0.607454", "0.6070889", "0.6069249", "0.6039457", "0.60059875", "0.600463", "0.5984564", "0.5974974", "0.59464014", "0.59400165", "0.5938021", "0.59219193", "0.59198546", "0.59183204", "0.59109515", "0.5905805", "0.5900527", "0.5897944", "0.5891013", "0.5880066", "0.5873752", "0.5868719", "0.5860066", "0.58505017", "0.58471715", "0.5846088", "0.58321214", "0.58306414", "0.5827348", "0.58271307", "0.58234257", "0.58142537", "0.58133096", "0.58127075", "0.58125705", "0.5809683", "0.580708", "0.5807004", "0.5804738", "0.5790753", "0.5789848", "0.5789562", "0.57882", "0.5786811", "0.578465", "0.57825375", "0.5779604", "0.5777299", "0.57727855", "0.5769157", "0.5759882", "0.5759654", "0.5758433", "0.5751794", "0.5748023", "0.5741652", "0.573485", "0.57257307", "0.572537", "0.5724747", "0.5723547", "0.5723488", "0.57219", "0.5721104", "0.5718177", "0.57111347", "0.57106024", "0.5709561", "0.570492", "0.5704672", "0.56962126", "0.5695507", "0.5695453", "0.5695453", "0.56933326" ]
0.68126833
2
GET /officers/1 GET /officers/1.json
def show # No implementation needed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def show\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @officer }\n end\n end", "def show\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @officer }\n end\n end", "def index\n @officers = Officer.all\n end", "def index\n @officers = Officer.all\n end", "def show\n @search = Search.find(params[:id])\n @public_officers = @search.public_officers\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @search.public_officers }\n end\n \n end", "def index\n @offices = Office.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def index\n @offices = Office.all\n json_response(@offices)\n end", "def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @officer }\n end\n end", "def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @officer }\n end\n end", "def show\n @officer = Officer.find(params[:id])\n end", "def index\n head 404\n # @api_v1_followers = Api::V1::Follower.all\n\n # render json: @api_v1_followers\n end", "def index\n @offices = Office.where(\"user_id = ?\", current_user).order('created_at DESC').page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offices }\n end\n end", "def index\n @offers = Offer.all\n respond_to do |format|\n format.jsonapi { render jsonapi: @offers }\n format.html { @offers }\n end\n end", "def index\n @trafficofficers = Trafficofficer.all\n end", "def officers(id)\n items = []\n offset = 0\n xid = make_transaction_id\n\n loop do\n page = request(:officers, id, '/officers', { start_index: offset }, xid)\n new_items = page['items']\n total = page['total_results'] || new_items.count\n\n items += new_items\n offset += new_items.count\n\n break if items.count >= total\n end\n\n items\n end", "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end", "def allergies\n raise UserNotAuthenticated unless access_token\n\n get('records/allergies')\n end", "def index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def show\n @prayers = Prayer.all\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end", "def new\n @clientsOffers = ClientsOffers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def index\n @electors = Elector.all\n\n render json: @electors\n end", "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def index\n @employers = Employer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employers }\n end\n end", "def index\n @attendees = Attendee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attendees }\n end\n end", "def index\n @officers = Officer.find(:all)\n @clubs = Club.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @officers }\n end\n end", "def index\n client = find_client(request.headers[\"X-CLIENT-TOKEN\"], request.headers[\"X-CLIENT-EMAIL\"])\n @appointments = client.appointments.includes(:stylist).includes(:offerings).order(\"created_at DESC\")\n respond_to do |f|\n f.json {\n render :json => @appointments\n }\n end\n end", "def show\n @oferta_academica = OfertaAcademica.find(params[:id])\n\n render json: @oferta_academica\n end", "def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end", "def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end", "def show\n render json: Agent.find(params[:id]).buyers\n end", "def index\n @foodhampers = Foodhamper.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foodhampers }\n end\n end", "def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\n end\n end", "def show\n @beer = Beer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @beer }\n end\n end", "def index\n @telefones = Telefone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @telefones }\n end\n end", "def show\n begin\n @fucker = Fucker.find(params[:id])\n respond_to do |format|\n format.json { render json: @fucker }\n end\n rescue => err\n $log.warn(err)\n respond_to do |format|\n format.json { render json: err, status: :internal_server_error }\n end\n end\n end", "def index\n @offices = current_user.offices\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @offices }\n end\n end", "def show\n @getoff_infos = GetoffInfo.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @getoff_info }\n end\n \n end", "def show\n @dayoff = Dayoff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dayoff }\n end\n end", "def show\n @porter = Porter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @porter }\n end\n end", "def show\n @coff = Coff.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @coff }\n end\n end", "def appointments(officer_id)\n client.get(\"officers/#{officer_id}/appointments/\")\n end", "def index\n @chargers = Charger.all\n render json: @chargers\n end", "def index\n\t\t@guild_officers = @guild.officers.where.not(id: @guild.owner.id)\n\tend", "def show\n @attendee = Attendees.find(params[:id])\n render json: @attendee\n end", "def show\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @employer }\n end\n end", "def show\n\n respond_to do |format|\n format.html { # show.html.erb\n @flyer_info = FlyerInfo.find(params[:id])\n }\n format.json {\n render json: getflyer(params[:id])\n }\n end\n\n end", "def index\n respond_with(@collection) do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end", "def show\n @officer = Officer.find(params[:id])\n @clubs = Club.find(:all)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @officer }\n end\n end", "def show\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end", "def show\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retailer }\n end\n end", "def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end", "def show\n @beer = BreweryDB.beer(params[:id]) \n render json: @beer\n end", "def show\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status }\n end\n end", "def index\n @testers = Tester.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @testers }\n end\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n @offenders = Offender.all(:order => \"lastname\")\n respond_to do |format|\n format.mobile\n format.html # index.html.erb\n format.xml { render :xml => @offenders }\n end\n end", "def show\n @mailer = Mailer.find(params[:id])\n\n render json: @mailer\n end", "def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end", "def index\n users = User.all\n # cheer_ups = CheerUp.all\n render json: users\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n @prayers = Prayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prayers }\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 index\n render json: Client.all\n end", "def show\n @json = Punk::API.one_beer!(params[:id])\n render json: {\n beer: @json\n }\n create(@json)\n end", "def index\n @attendees = Attendees.all\n render json: @attendees\n end", "def find_office_by_career\n @office_careers = OfficeCareer.find_office_by_career(params[:career_id])\n json_response(@office_careers)\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def get(params = {})\n client.get(\"/v1/shopping/hotels/#{@hotel_id}/hotel-offers\", params)\n end", "def show\n @trainer = Trainer.find(params[:id])\n\n render json: @trainer.as_json(only: [:name], include: [:trainees])\n end", "def index\n #pseudo scope \n if params[:phone] \n @agencies = Agency.find_by_phone(params[:phone]);\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end \n else\n head :not_found\n end\n else\n # Aqui estoy haciendo que el api responda en mas de 1 formato\n @agencies = Agency.all\n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n end\n\n end \n end", "def show\n @trainer = Trainer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trainer }\n end\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def recent_foods\n get(\"/user/#{@user_id}/foods/log/recent.json\")\n end", "def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def index\n @recruiters = Recruiter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recruiters }\n end\n end", "def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end", "def show\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referee }\n end\n end", "def index\n @spoofers = Spoofer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @spoofers }\n end\n end", "def get_favourite_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.favourites\n\n render status: 200, json: @restaurants\n end", "def show_beer\n render json: BreweryDb::ShowBeer.new(params[:beerId]).results\n end", "def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end", "def officers(company_number, items_per_page = nil, start_index = nil, register_type = nil, order_by = nil, register_view = nil)\n params = {}\n params[:items_per_page] = items_per_page if items_per_page\n params[:start_index] = start_index if start_index\n params[:register_type] = register_type if register_type\n params[:order_by] = order_by if order_by\n params[:register_view] = register_view if register_view\n client.get(\"company/#{company_number}/officers/\", params)\n end", "def show\n @attendee = Attendee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @attendee }\n end\n end", "def show\n @caterer = Caterer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caterer }\n end\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def show\n @attendee = Attendee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @attendee }\n end\n end", "def index\n @employees = current_owner.employees.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employees }\n end\n end", "def show\n json_response(@office)\n end", "def index\n @offerers = Offerer.all\n end", "def postal_beers\n render json: BreweryDb::ShowBeers.new('postal', params[:postal]).results\n end", "def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end", "def show\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @oferta }\n end\n end", "def show\n @venue = Venue.find(params[:id])\n @papers = @venue.papers.order(:listorder)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end", "def getOffers\n if current_contractor || current_user\n offers_per_post = Offer.where(post_id: params[:post_id])\n @offers = offers_per_post.order(created_at: :asc).limit(10)\n\n render json: @offers.as_json(include: [{contractor: { methods: [:avatar_url] }}, :post,])\n end\n end", "def index\n @recent = Highfive.recent.approved\n @leaders = User.leaders\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @highfives }\n end\n end", "def recent\n if current_user.is_admin?\n @clients = Client.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients }\n end\n end", "def index\n @offices = Office.all\n #Office.lets_scrape\n end" ]
[ "0.7046348", "0.7001572", "0.69504637", "0.6497077", "0.6497077", "0.6368807", "0.6278744", "0.6259181", "0.6184809", "0.6145527", "0.6118715", "0.60677445", "0.60526764", "0.6042264", "0.60311687", "0.6016174", "0.6015207", "0.60082424", "0.5998717", "0.5947594", "0.5926632", "0.5919107", "0.59063166", "0.5904215", "0.5887562", "0.58843786", "0.5869064", "0.5853465", "0.5848969", "0.5847852", "0.5847852", "0.5823662", "0.5823433", "0.5818284", "0.58105963", "0.5789139", "0.57863975", "0.5780391", "0.576747", "0.5763818", "0.5759803", "0.5756431", "0.57488626", "0.57450825", "0.5738123", "0.5737335", "0.57373196", "0.57336646", "0.57327324", "0.570593", "0.5701618", "0.5697026", "0.5696657", "0.5693179", "0.5691761", "0.5682522", "0.56775814", "0.5676006", "0.56684804", "0.5668293", "0.5666259", "0.56661266", "0.56654435", "0.5664146", "0.56640136", "0.56619525", "0.56588024", "0.5658646", "0.56520504", "0.5649787", "0.564812", "0.56462604", "0.5639346", "0.5624682", "0.56167203", "0.56143373", "0.5609496", "0.56068575", "0.5606684", "0.5604137", "0.56017095", "0.5587411", "0.5582502", "0.55806226", "0.55726665", "0.5571822", "0.5570086", "0.55688584", "0.55616194", "0.55596507", "0.5558213", "0.5555407", "0.5554191", "0.55541366", "0.555116", "0.5549215", "0.5544499", "0.5543768", "0.5541659", "0.55397487", "0.55372417" ]
0.0
-1
POST /officers POST /officers.json
def create user = User.initialize_user(params[:email]) @officer = Officer.new(name: params[:name], surname: params[:surname], user: user) if @officer.save otp = Devise.friendly_token(20) user.update(password: otp) OfficerMailer.with(user: user, current_pass: otp).credential_mail.deliver_now respond_to do |format| format.js format.html { redirect_to administrator_add_user_url(current_user.administrator.id), notice: 'Officer successfully created'} end else format.html { redirect_to administrator_add_user_url(current_user.administrator.id), alert: @officer.print_pretty_errors} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @clientsOffers = ClientsOffers.new(params[:clientsOffers])\n\n respond_to do |format|\n if @clientsOffers.save\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully created.' }\n format.json { render json: @clientsOffers, status: :created, location: @clientsOffers }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "def create\n @officer = Officer.new(params[:officer])\n\n respond_to do |format|\n if @officer.save\n format.html { redirect_to @officer, notice: 'Officer was successfully created.' }\n format.json { render json: @officer, status: :created, location: @officer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @officer = Officer.new(officer_params)\n\n respond_to do |format|\n if @officer.save\n format.html { redirect_to @officer, notice: 'Officer was successfully created.' }\n format.json { render :show, status: :created, location: @officer }\n else\n format.html { render :new }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @adopter = Adopter.new(adopter_params)\n\n if @adopter.save\n render json: @adopter, status: :created, location: @adopter\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end", "def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @officer }\n end\n end", "def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offices = Office.create!(office_params)\n json_response(@offices, :created)\n end", "def new\n @officer = Officer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @officer }\n end\n end", "def create\n @offerer = Offerer.new(offerer_params)\n #byebug\n\n respond_to do |format|\n if @offerer.save\n format.html { redirect_to @offerer, notice: 'Offerer was successfully created.' }\n format.json { render :show, status: :created, location: @offerer }\n else\n format.html { render :new }\n format.json { render json: @offerer.errors, status: :unprocessable_entity }\n end\n end\n #byebug\n end", "def create\n @officer = Officer.new(params[:officer])\n\n respond_to do |format|\n if @officer.save\n flash[:notice] = 'Officer was successfully created.'\n format.html { redirect_to(@officer) }\n format.xml { render :xml => @officer, :status => :created, :location => @officer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @trafficofficer = Trafficofficer.new(trafficofficer_params)\n\n respond_to do |format|\n if @trafficofficer.save\n format.html { redirect_to @trafficofficer, notice: 'Trafficofficer was successfully created.' }\n format.json { render :show, status: :created, location: @trafficofficer }\n else\n format.html { render :new }\n format.json { render json: @trafficofficer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@guild_officer = GuildLinkOfficer.new(guild_officer_params)\n\t\t@guild_officer.guild = @guild\n\n\t\trespond_to do |format|\n\t\t\tif @guild_officer.save\n\t\t\t\tback_page = guild_officers_url\n\t\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\t\tformat.html { redirect_to back_page, notice: 'Officer was successfully created.' }\n\t\t\telse\n\t\t\t\tformat.html { render :new }\n\t\t\t\tformat.json { render json: @guild_officer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "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 create\n @retailer = Retailer.new(params[:retailer])\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: \"Retailer was successfully created.\" }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entry }\n end\n end\n end", "def create\n @officer = Officer.new(params[:officer])\n\n respond_to do |format|\n if @officer.save\n temp_password = SecureRandom.hex\n @officer.change_password temp_password\n UserMailer.creation_notice(@officer, temp_password).deliver\n format.html { redirect_to @officer, \\\n :notice => \"Officer was successfully created. An e-mail has been sent to #{@officer.email}.\" }\n format.json { render :json => @officer, :status => :created, :location => @officer }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n # @retailer = Retailer.new(params[:retailer])\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @retailer = Retailer.new(params[:retailer])\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render json: @retailer, status: :created, location: @retailer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end", "def create\n @attendee = Attendee.new(attendee_params)\n\n respond_to do |format|\n if @attendee.save\n format.json { render json: @attendee.to_json, status: :created }\n else\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @clientsOffers = ClientsOffers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def create\n @requester = Requester.new(requester_params)\n\n respond_to do |format|\n if @requester.save\n format.html { redirect_to @requester, notice: 'Requester was successfully created.' }\n format.json { render :show, status: :created, location: @requester }\n else\n format.html { render :new }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render :show, status: :created, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prayer = Prayer.new(params[:prayer])\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render json: @prayer, status: :created, location: @prayer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @retailer = Retailer.new(retailer_params)\n\n respond_to do |format|\n if @retailer.save\n format.html { redirect_to @retailer, notice: 'Retailer was successfully created.' }\n format.json { render :show, status: :created, location: @retailer }\n else\n format.html { render :new }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n if @offer.save\n render json: @offer, status: :created, location: @offer\n else\n render json: @offer.errors, status: :unprocessable_entity\n end\n end", "def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end", "def create(options = {})\n post(\"customers/#{customer_id}/deliveries\", options)\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 @attendee = Attendee.new(params[:attendee])\n\n respond_to do |format|\n if @attendee.save\n format.html { redirect_to attendees_path, flash: { success: \"#{@attendee.name} was successfully created.\" } }\n format.json { render json: @attendee, status: :created, location: @attendee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prayer = current_user.prayers.build(params[:prayer])\n\n respond_to do |format|\n if @prayer.save\n flash[:success] = \"Prayer created!\"\n format.html { redirect_to root_url, notice: 'Prayer was successfully created.' }\n format.json { render json: @prayer, status: :created, location: @prayer }\n else\n @feed_items = []\n format.html { render action: \"static_pages/home\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @elector = Elector.new(elector_params)\n\n if @elector.save\n render json: @elector, status: :created, location: @elector\n else\n render json: @elector.errors, status: :unprocessable_entity\n end\n end", "def create\n @office_career = OfficeCareer.create!(office_career_params)\n json_response(@office_career, :created)\n end", "def create\n @faculties = Faculty.create!(faculty_params)\n json_response(@faculties, :created)\n end", "def create\n @porter = Porter.new(params[:porter])\n\n respond_to do |format|\n if @porter.save\n format.html { redirect_to @porter, notice: 'Porter was successfully created.' }\n format.json { render json: @porter, status: :created, location: @porter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @porter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prayer = Prayer.new(prayer_params)\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render :show, status: :created, location: @prayer }\n else\n format.html { render :new }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def index\n if params[:name].present?\n @json = Punk::API.beers_name!(params[:name])\n elsif params[:abv_gt].present?\n @json = Punk::API.beers_abv_gt!(params[:abv_gt])\n elsif params[:abv_lt].present?\n @json = Punk::API.beers_abv_lt!(params[:abv_lt])\n else\n @json = Punk::API.all_beers!(params)\n end\n\n render json: {\n beers: @json\n }\n create(@json)\n end", "def create\n @auto_offer = AutoOffer.new(auto_offer_params)\n\n respond_to do |format|\n if @auto_offer.save\n format.html { redirect_to offers_path, notice: 'Auto offers ware successfully created.' }\n format.json { render action: 'show', status: :created, location: @auto_offer }\n else\n format.html { render action: 'new' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @attendee = Attendee.new(attendee_params)\n\n if @attendee.save\n render :status => 200,\n :json => { :success => true,\n :info => \"Attendee Created\",\n :data => {} }\n else\n render :status => :unprocessable_entity,\n :json => { :success => false,\n :info => resource.errors,\n :data => {} }\n end\n end", "def create\n @mailer = Mailer.new(mailer_params)\n\n if @mailer.save\n render json: @mailer, status: :created, location: @mailer\n else\n render json: @mailer.errors, status: :unprocessable_entity\n end\n end", "def create\n @attendee = Attendee.new(attendee_params)\n\n respond_to do |format|\n if @attendee.save\n format.html { redirect_to @attendee, :notice => 'Attendee was successfully created.' }\n format.json { render :json => @attendee, :status => :created, :location => @attendee }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @attendee.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 @admin_retailer = Admin::Retailer.new(admin_retailer_params)\n\n respond_to do |format|\n if @admin_retailer.save\n format.html { redirect_to @admin_retailer, notice: 'Retailer was successfully created.' }\n format.json { render :show, status: :created, location: @admin_retailer }\n else\n format.html { render :new }\n format.json { render json: @admin_retailer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @assigner = Assigner.new(assigner_params)\n\n respond_to do |format|\n if @assigner.save\n format.html { redirect_to @assigner, notice: 'Assigner was successfully created.' }\n format.json { render :show, status: :created, location: @assigner }\n else\n format.html { render :new }\n format.json { render json: @assigner.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prayer = Prayer.new(prayer_params)\n\n respond_to do |format|\n if @prayer.save\n format.html { redirect_to @prayer, notice: 'Prayer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prayer }\n else\n format.html { render action: 'new' }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @officers = Officer.all\n end", "def index\n @officers = Officer.all\n end", "def create\n\t\t@public_officer = PublicOfficer.find(params[:public_officer_id])\n\t\t@commission = @public_officer.commissions.find(params[:commission_id])\n\t\t@trip = @commission.trips.find(params[:trip_id])\n\t\t@detail = @trip.detail\n\t\t@flight = @detail.flights.new(params[:flight])\n\n\t\trespond_to do |format|\n\t\t\tif @flight.save\n\t\t\t\tformat.html { redirect_to @flight, notice: 'Flight was successfully created.' }\n\t\t\t\tformat.json { render json: @flight, status: :created, location: @flight }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @flight.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n\n species = Faker::Games::Pokemon.name\n nickname = Faker::Name.first_name\n trainer = Trainer.find(params[:trainer_id])\n if trainer.pokemons.length < 6\n pokemon = Pokemon.create(nickname: nickname, species: species, trainer_id: params[:trainer_id])\n render json: pokemon\n else\n render json: {message: \"Pokemon cannot be created\"}, status: 400\n end\n end", "def create\n @kickoff = Kickoff.new(params[:kickoff])\n\n respond_to do |format|\n if @kickoff.save\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully created.' }\n format.json { render json: @kickoff, status: :created, location: @kickoff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @face_off = FaceOff.new(face_off_params)\n\n respond_to do |format|\n if @face_off.save\n format.json { render json: @face_off, status: :created }\n else\n format.json { render json: @face_off.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n puts 'AQQQQQUUUUUUUIIIIII'\n json = ActiveSupport::JSON.decode(params[:pessoa])\n puts json\n @pessoa = Pessoa.new(json)\n # @address = Address.new(params[:address])\n\n # @client.addresses = @address\n\n respond_to do |format|\n if @pessoa.save\n format.html { redirect_to @pessoa, notice: 'Pessoa was successfully created.' }\n format.json { render json: @pessoa, status: :created, location: @pessoa }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pessoa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @elder = Elder.new(elder_params)\n\n respond_to do |format|\n if @elder.save\n format.html { redirect_to @elder, notice: 'Se añadió correctamente la información.' }\n format.json { render :show, status: :created, location: @elder }\n else\n format.html { render :new }\n format.json { render json: @elder.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hacker = Hacker.new(params[:hacker])\n\n respond_to do |format|\n if @hacker.save\n cookies[:auth_token] = @hacker.auth_token\n @hacker.create_initial_data\n Notifier.account_created(@hacker).deliver\n format.html { redirect_to entries_url, notice: \"Hacker #{@hacker.email} was successfully created.\" }\n format.json { render json: @hacker, status: :created, location: @hacker }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hacker.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zone_updater = ZoneUpdater.new(params[:zone_updater])\n\n respond_to do |format|\n if @zone_updater.save\n format.html { redirect_to @zone_updater, notice: 'Zone updater was successfully created.' }\n format.json { render json: @zone_updater, status: :created, location: @zone_updater }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zone_updater.errors, status: :unprocessable_entity }\n end\n end\n end", "def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def create\n @offer = current_user.offers.build(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer, notice: 'Oferta utworzona pomyślnie.' }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @calorie = Calorie.new(calorie_params)\n\n respond_to do |format|\n if @calorie.save\n format.html { redirect_to @calorie, notice: 'Calorie was successfully created.' }\n format.json { render :show, status: :created, location: @calorie }\n else\n format.html { render :new }\n format.json { render json: @calorie.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @partners = Partner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @partners }\n end\n end", "def create\n @telefone_fornecedor = TelefoneFornecedor.new(telefone_fornecedor_params)\n\n respond_to do |format|\n if @telefone_fornecedor.save\n format.html { redirect_to @telefone_fornecedor, notice: 'Telefone fornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @telefone_fornecedor }\n else\n format.html { render :new }\n format.json { render json: @telefone_fornecedor.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @empolyee = Empolyee.new(empolyee_params)\n\n respond_to do |format|\n if @empolyee.save\n format.html { redirect_to @empolyee, notice: 'Empolyee was successfully created.' }\n format.json { render action: 'show', status: :created, location: @empolyee }\n else\n format.html { render action: 'new' }\n format.json { render json: @empolyee.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @officer }\n end\n end", "def create\n @loan_officer = LoanOfficer.new(loan_officer_params)\n\n respond_to do |format|\n if @loan_officer.save\n format.html { redirect_to @loan_officer, notice: 'Loan officer was successfully created.' }\n format.json { render :show, status: :created, location: @loan_officer }\n else\n format.html { render :new }\n format.json { render json: @loan_officer.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 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 @fornecedor = Fornecedor.new(fornecedor_params)\n @telefones = get_telefones\n @emails = get_emails\n respond_to do |format|\n if validate_telefones && validate_emails && @fornecedor.save # TODO: deal with validates errors messages\n add_telefones\n add_emails\n format.html { redirect_to @fornecedor, notice: 'Fornecedor was successfully created.' }\n format.json { render :show, status: :created, location: @fornecedor }\n else\n format.html { render :new, error: 'Erro.' }\n format.json { render json: @fornecedor.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 create (attendee)\n\n # respond_to do |format|\n\n # Sends email to user when user is created.\n ItineraryMailer.sample_email(attendee).deliver_now\n\n\n # format.html { redirect_to attendee, notice: 'Attendee was successfully created.' }\n # format.json { render :show, status: :created, location: attendee }\n # else\n # format.html { render :new }\n # format.json { render json: @attendee.errors, status: :unprocessable_entity }\n # end\n end", "def create\n @responder = Responder.new(params[:responder])\n\n respond_to do |format|\n if @responder.save\n format.html { redirect_to @responder, :notice => 'Responder was successfully created.' }\n format.json { render :json => @responder, :status => :created, :location => @responder }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @responder.errors, :status => :unprocessable_entity }\n end\n end\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 @employee_reviewer = EmployeeReviewer.new(employee_reviewer_params)\n\n respond_to do |format|\n if @employee_reviewer.save\n format.html { redirect_to employee_reviewers_url, notice: 'Employee reviewer was successfully created.' }\n format.json { render :show, status: :created, location: @employee_reviewer }\n else\n format.html { render :new }\n format.json { render json: @employee_reviewer.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @officer }\n end\n end", "def create\n @fundraiser = Fundraiser.new(params[:fundraiser])\n\n respond_to do |format|\n if @fundraiser.save\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully created.' }\n format.json { render json: @fundraiser, status: :created, location: @fundraiser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @trafficofficers = Trafficofficer.all\n end", "def create\n @careers = Career.create!(career_params)\n json_response(@careers, :created)\n end", "def create\n @paper = Paper.new(paper_params)\n\n if @paper.save\n render json: @paper, status: :created, location: @paper\n else\n render json: @paper.errors, status: :unprocessable_entity\n end\n end", "def officer_params\n params.require(:officer).permit(:name, :email, :description, :image)\n end", "def create\n @beer = Beer.new(beer_params)\n\n respond_to do |format|\n if @beer.save\n format.html { redirect_to beers_path, notice: 'Beer was successfully created.' }\n format.json { render json: @beer, status: :created, location: @beer }\n else\n format.html { render action: 'new' }\n format.json { render json: @beer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dayoff = Dayoff.new(params[:dayoff])\n\n respond_to do |format|\n if @dayoff.save\n format.html { redirect_to @dayoff, notice: 'Dayoff was successfully created.' }\n format.json { render json: @dayoff, status: :created, location: @dayoff }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dayoff.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 index\n @retailers = Retailer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @retailers }\n end\n end", "def create\n @author_paper = AuthorPaper.new(params[:author_paper])\n\n respond_to do |format|\n if @author_paper.save\n format.html { redirect_to @author_paper, :notice => 'Author paper was successfully created.' }\n format.json { render :json => @author_paper, :status => :created, :location => @author_paper }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @author_paper.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @employer = Employer.new(employer_params)\n\n respond_to do |format|\n if @employer.save\n UserNotifier.send_signup_email(@employer).deliver\n format.html { redirect_to @employer, notice: 'Employer was successfully created.' }\n format.json { render :show, status: :created, location: @employer }\n else\n format.html { render :new }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offer = Offer.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to offers_url, notice: 'Offer was successfully created.' }\n format.json { render :index, estado: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, estado: :unprocessable_entity }\n end\n end\n end", "def create\n @beer = Beer.new(beer_params)\n\n respond_to do |format|\n if @beer.save\n format.html { redirect_to beers_path, notice: 'Beer was successfully created.' }\n format.json { render :show, status: :created, location: @beer }\n else\n format.html { render :new }\n format.json { render json: @beer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fastener = Fastener.new(fastener_params)\n\n respond_to do |format|\n if @fastener.save\n format.html { redirect_to @fastener, notice: 'Fastener was successfully created.' }\n format.json { render :show, status: :created, location: @fastener }\n else\n format.html { render :new }\n format.json { render json: @fastener.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:fortune_teller]['session'] = session[:session_id]\n hashedEmails = Array.new\n params[:fortune_teller]['dataset'].each_line do |email|\n hashedEmails << Digest::SHA1.hexdigest(email.strip)\n end\n params[:fortune_teller]['hasheddataset'] = hashedEmails.join(\"\\n\")\n @fortune_teller = FortuneTeller.new(params[:fortune_teller])\n\n respond_to do |format|\n if @fortune_teller.save\n format.html { redirect_to @fortune_teller, notice: 'Fortune teller was successfully created.' }\n format.json { render json: @fortune_teller, status: :created, location: @fortune_teller }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fortune_teller.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @railscareer = Railscareer.new(railscareer_params)\n\n respond_to do |format|\n if @railscareer.save\n format.html { redirect_to @railscareer, notice: 'Railscareer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @railscareer }\n else\n format.html { render action: 'new' }\n format.json { render json: @railscareer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @caterer = Caterer.new(params[:caterer])\n\n respond_to do |format|\n if @caterer.save\n format.html { redirect_to @caterer, notice: 'Caterer was successfully created.' }\n format.json { render json: @caterer, status: :created, location: @caterer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @caterer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fellowship = Fellowship.new(fellowship_params)\n @fellowship.users << current_user\n\n # Capitalize fellowship name\n @fellowship.fellowship_name = @fellowship.fellowship_name.titleize\n\n respond_to do |format|\n if @fellowship.save\n format.html { redirect_to @fellowship, notice: 'Fellowship was successfully created.' }\n format.json { render :show, status: :created, location: @fellowship }\n else\n format.html { render :new }\n format.json { render json: @fellowship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zoigl_beer = ZoiglBeer.new(zoigl_beer_params)\n\n respond_to do |format|\n if @zoigl_beer.save\n format.html { redirect_to @zoigl_beer, notice: 'Zoigl beer was successfully created.' }\n format.json { render :show, status: :created, location: @zoigl_beer }\n else\n format.html { render :new }\n format.json { render json: @zoigl_beer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @attendee = current_user.attendees.build( :paper => @paper )\n\n respond_to do |format|\n if @attendee.save\n format.html do \n flash[:notice] = 'Attendee was successfully created.'\n redirect_to paper_path(@paper)\n end\n format.xml { render :xml => @attendee, :status => :created, :location => @attendee }\n format.js { render :partial => 'papers/attendees' }\n else\n format.html do\n flash[:notice] = 'Error trying to create Attendee.'\n redirect_to paper_path(@paper)\n end\n format.xml { render :xml => @attendee.errors, :status => :unprocessable_entity }\n format.js { render :text => 'Some error ocurred', :status => :unprocessable_entity }\n end\n end\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @fighter = Fighter.new(fighter_params)\n\n respond_to do |format|\n if @fighter.save\n format.html { redirect_to admin_fighters_path, notice: 'Fighter was successfully created.' }\n format.json { head :ok }\n else\n format.html { render :new }\n format.json { render json: @fighter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @intervention = Intervention.new(intervention_params)\n @intervention.author_id = current_user.employee.id\n\n zendesk_ticket_intervention(@intervention)\n\n respond_to do |format|\n if @intervention.save\n format.html { redirect_to @intervention, notice: 'Intervention was successfully created.' }\n format.json { render :show, status: :created, location: @intervention }\n else\n format.html { render :new }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "def postal_beers\n render json: BreweryDb::ShowBeers.new('postal', params[:postal]).results\n end", "def create\n @telefone = Telefone.new(params[:telefone])\n\n respond_to do |format|\n if @telefone.save\n format.html { redirect_to @telefone, :notice => 'Telefone foi salvo com sucesso.' }\n format.json { render :json => @telefone, :status => :created, :location => @telefone }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @telefone.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @offer = current_user.offers.new(offer_params)\n\n respond_to do |format|\n if @offer.save\n format.html { redirect_to @offer }\n format.json { render :show, status: :created, location: @offer }\n else\n format.html { render :new }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n inc_id = 1\n unless @event.attendees.blank?\n inc_id = @event.attendees.last.attendee_id.gsub(@event.token_for_id, \"\").to_i + 1\n end\n params[:attendee][:attendee_id] = @event.token_for_id + \"%04d\" % inc_id\n params[:attendee][:a_platform] = params[:attendee][:a_platform].join(\";\") unless params[:attendee][:a_platform].nil?\n params[:attendee][:a_market_segment] = params[:attendee][:a_market_segment].join(\";\") unless params[:attendee][:a_market_segment].nil?\n params[:attendee][:confirmation_token] = Array.new(10) {[*'0'..'9', *'a'..'z'].sample}.join\n params[:attendee][:a_sector] = \"N/A\"\n params[:attendee][:e_ext_number] = 0\n params[:attendee][:e_lada] = 0\n params[:attendee][:e_zip_code] = \"N/A\"\n @attendee = Attendee.new(params[:attendee])\n \n respond_to do |format|\n if @attendee.save\n #AttendeeMailer.welcome_email(@attendee).deliver!\n format.html { redirect_to @attendee, notice: t(:successfully_created) }\n format.json { render json: @attendee, status: :created, location: @attendee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6437128", "0.6412024", "0.6352317", "0.59724355", "0.58118606", "0.5808218", "0.57724", "0.5758419", "0.57167304", "0.57057893", "0.5701031", "0.569019", "0.56374997", "0.56293696", "0.561928", "0.5607093", "0.5592523", "0.5548167", "0.5545246", "0.55001366", "0.54948425", "0.54797035", "0.54448533", "0.54435027", "0.53914165", "0.5374539", "0.5369423", "0.53569907", "0.5349464", "0.5348533", "0.53437144", "0.5342448", "0.5340769", "0.5330955", "0.5330086", "0.53300667", "0.5328599", "0.5321649", "0.5319697", "0.5307049", "0.52934015", "0.5285436", "0.52824557", "0.52817655", "0.52812487", "0.5280709", "0.5280709", "0.5265176", "0.5256622", "0.52412754", "0.5226767", "0.52261853", "0.52233624", "0.5220708", "0.5218434", "0.52162486", "0.52148944", "0.5206017", "0.5203741", "0.5192267", "0.51823395", "0.51784986", "0.5175462", "0.51704437", "0.5169258", "0.5169258", "0.5165924", "0.5160023", "0.51517737", "0.5136458", "0.51357704", "0.51327187", "0.5131319", "0.5126874", "0.512415", "0.5123823", "0.5118724", "0.51150626", "0.5113262", "0.5111375", "0.510762", "0.51011217", "0.51002055", "0.50991416", "0.50952137", "0.50947165", "0.5088245", "0.5085037", "0.50821966", "0.5079987", "0.5070384", "0.50694424", "0.5066304", "0.50617594", "0.5059669", "0.50538707", "0.50530523", "0.5052177", "0.505068", "0.50503016" ]
0.5384809
25
PATCH/PUT /officers/1 PATCH/PUT /officers/1.json
def update respond_to do |format| if @officer.update(officer_params) format.html { redirect_to @officer, notice: 'Officer was successfully updated.' } format.json { render :show, status: :ok, location: @officer } else format.html { render :edit } format.json { render json: @officer.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n format.html { redirect_to @officer, :notice => 'Officer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n format.html { redirect_to @officer, notice: 'Officer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @officer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "def update\n @officer = Officer.find(params[:id])\n\n respond_to do |format|\n if @officer.update_attributes(params[:officer])\n flash[:notice] = 'Officer was successfully updated.'\n format.html { redirect_to(@officer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @officer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fucker = Fucker.find(params[:id])\n\n respond_to do |format|\n if @fucker.update_attributes(params[:fucker])\n format.json { head :no_content }\n else\n format.json { render json: @fucker.errors, status: :internal_server_error }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n @getoff_info = GetoffInfo.find(params[:id])\n\n respond_to do |format|\n if @getoff_info.update_attributes(params[:getoff_info])\n format.html { redirect_to @getoff_info, :notice => 'Getoff info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @getoff_info.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 options={}\n client.put(\"/#{id}\", options)\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\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 @coff = Coff.find(params[:id])\n\n respond_to do |format|\n if @coff.update_attributes(params[:coff])\n format.html { redirect_to @coff, notice: 'Coff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @coff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @loan_officer.update(loan_officer_params)\n format.html { redirect_to @loan_officer, notice: 'Loan officer was successfully updated.' }\n format.json { render :show, status: :ok, location: @loan_officer }\n else\n format.html { render :edit }\n format.json { render json: @loan_officer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n if @prayer.update_attributes(params[:prayer])\n format.html { redirect_to @prayer, notice: 'Prayer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @requester.update(requester_params)\n format.html { redirect_to @requester, notice: 'Requester was successfully updated.' }\n format.json { render :show, status: :ok, location: @requester }\n else\n format.html { render :edit }\n format.json { render json: @requester.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @staffer = Staffer.find(params[:id])\n\n respond_to do |format|\n if @staffer.update_attributes(params[:staffer])\n format.html { redirect_to @staffer, notice: 'Staffer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @staffer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trafficofficer.update(trafficofficer_params)\n format.html { redirect_to @trafficofficer, notice: 'Trafficofficer was successfully updated.' }\n format.json { render :show, status: :ok, location: @trafficofficer }\n else\n format.html { render :edit }\n format.json { render json: @trafficofficer.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 update\n @person = Person.find(params[:id]) \n respond_to do |format|\n if @person.update(person_params)\n format.json { render json: @person, status: :ok }\n else\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n @client.update(client_params)\n render json: @client\n end", "def update(options = {})\n @client.put(self.link(:edit), self.to_json, options)\n end", "def update\n @safety_officer = SafetyOfficer.find(params[:id])\n\n respond_to do |format|\n if @safety_officer.update_attributes(params[:safety_officer])\n format.html { redirect_to(incident_timesheet_path, :notice => 'Safety officer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @safety_officer.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 respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @retailer = Retailer.find(params[:id])\n respond_to do |format|\n if @retailer.update_attributes(params[:retailer])\n format.html { redirect_to @retailer, notice: 'Retailer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @retailer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @finder = Finder.find(params[:id])\n\n respond_to do |format|\n if @finder.update_attributes(params[:finder])\n format.html { redirect_to @finder, notice: 'Finder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @auto_offer.update(auto_offer_params)\n format.html { redirect_to @auto_offer, notice: 'Auto offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @auto_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @employer = Employer.find(params[:id])\n\n respond_to do |format|\n if @employer.update_attributes(params[:employer])\n format.html { redirect_to @employer, :flash => {notice: 'Employer was successfully updated.' }}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @employer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @roof = Roof.find(params[:roof_id])\n @status = @roof.statuses.find(params[:id])\n\n respond_to do |format|\n if @status.update_attributes(params[:roof_status])\n format.html { redirect_to @roof, notice: 'Status was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n if @retailer.update_attributes(params[:retailer])\n format.html { redirect_to @retailer, notice: \"Retailer was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @retailer.errors, status: \"unprocessable_entry\" }\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 update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end", "def update\n @person = Person.find(params[:id])\n\n populate_attributes(@person, params[:person])\n respond_to do |format|\n \n if @person.save && @person.identifiable_entries.each(&:save!)\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @prayer_request.update_attributes(params[:prayer_request])\n format.html { redirect_to @prayer_request, notice: 'Prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.update_responsible(:status, 'Waiting for Staff Response')\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @office = Office.find(params[:id])\n\n respond_to do |format|\n if @office.update_attributes(params[:office])\n format.html { redirect_to offices_path, notice: 'Office was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @office.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 update\n respond_to do |format|\n if @waiter.update(waiter_params.slice(:name, :email, :mobile))\n format.html { redirect_to waiters_manager_path(current_user), notice: i18n_notice('updated',@waiter) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @waiter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @my_prayer_request.update_attributes(params[:my_prayer_request])\n format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update\n @retailer = Retailer.find(params[:id])\n\n respond_to do |format|\n if @retailer.update_attributes(params[:retailer])\n format.html { redirect_to @retailer, notice: 'Retailer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @retailer.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 respond_to do |format|\n if @offerer.update(offerer_params)\n format.html { redirect_to @offerer, notice: 'Offerer was successfully updated.' }\n format.json { render :show, status: :ok, location: @offerer }\n else\n format.html { render :edit }\n format.json { render json: @offerer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end", "def update\n respond_to do |format|\n if @face_off.update(face_off_params)\n format.html { redirect_to @face_off, notice: 'Face off was successfully updated.' }\n format.json { render :show, status: :ok, location: @face_off }\n else\n format.html { render :edit }\n format.json { render json: @face_off.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offer = Offer.find(params[:id])\n\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fred = Fred.find(params[:id])\n\n respond_to do |format|\n if @fred.update_attributes(params[:fred])\n format.html { redirect_to @fred, notice: 'Fred was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fred.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @officer = Officer.find(params[:id])\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 rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n respond_to do |format|\n if @fabricsofaset.update(fabricsofaset_params)\n format.html { redirect_to @fabricsofaset, notice: 'Fabricsofaset was successfully updated.' }\n format.json { render :show, status: :ok, location: @fabricsofaset }\n else\n format.html { render :edit }\n format.json { render json: @fabricsofaset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n if @referee.update_attributes(params[:referee])\n format.html { redirect_to @referee, notice: 'Referee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @referee.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 put :update\n end", "def update\n @conferencerm = Conferencerm.find(params[:id])\n\n respond_to do |format|\n if @conferencerm.update_attributes(params[:conferencerm])\n format.html { redirect_to @conferencerm, notice: 'Conferencerm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conferencerm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @attendee = Attendee.find(params[:id])\n\n respond_to do |format|\n if @attendee.update_attributes(params[:attendee])\n format.html { redirect_to @attendee, flash: { success: \"#{@attendee.name} was successfully updated.\" } }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @attendee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def edit\n @appointment_request = current_user.requests.find_by(\n id: params[:request_id]\n )\n\n if @appointment_request.present?\n render json: { appointment_request: @appointment_request, status: 200 }\n else\n render json: { status: 404, layout: false }, status: 404\n end\n end", "def update\n respond_to_update({thing: @author})\n end", "def update\n @adopter = Adopter.find(params[:id])\n\n if @adopter.update(adopter_params)\n head :no_content\n else\n render json: @adopter.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offer_params)\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\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 put!\n request! :put\n end", "def update\n @golfer = Golfer.find(params[:id])\n\n respond_to do |format|\n if @golfer.update_attributes(params[:golfer])\n format.html { redirect_to @golfer, notice: 'Golfer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golfer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_client\n\t\t@client = Client.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @client.update_attributes(client_update_params)\n\t\t format.html { redirect_to(@client, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@client) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@client) }\n\t\t end\n\n \t end\n\tend", "def put_update(options = {})\n options[:id] ||= @phone.id\n options[:phone] ||= @attributes\n\n # options[:email][@email.id.to_s] = @attributes\n put :update,options\n end", "def update\n @person = Person.find(params[:id])\n @person.delete_offices\n @person.delete_addresses\n @person.delete_phone_numbers\n\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, notice: 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @calorie.update(calorie_params)\n format.html { redirect_to @calorie, notice: 'Calorie was successfully updated.' }\n format.json { render :show, status: :ok, location: @calorie }\n else\n format.html { render :edit }\n format.json { render json: @calorie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @empolyee.update(empolyee_params)\n format.html { redirect_to @empolyee, notice: 'Empolyee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @empolyee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head 404\n # @api_v1_follower = Api::V1::Follower.find(params[:id])\n\n # if @api_v1_follower.update(api_v1_follower_params)\n # head :no_content\n # else\n # render json: @api_v1_follower.errors, status: :unprocessable_entity\n # end\n end", "def update\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n if @api_client.update_attributes(params[:api_client])\n format.html { redirect_to @api_client, notice: 'Api client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_client.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\t\trespond_to do |format|\n\t\t\tif @ride.update(offer_1_ride_params)\n\t\t\t\t@ride.set_routes\n\t\t\t\t@ride.handle_return_date_and_recurring_weeks\n\t\t\t\tformat.html { redirect_to \"/#{@ride.id}/offer-seats/2\" }\n\t\t\t\tformat.json { render :show, status: :created, location: @ride }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @ride.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def jsonapi_update!(attributes)\n assign_jsonapi_attributes(attributes)\n save!\n end", "def update\n @responder = Responder.find(params[:id])\n\n respond_to do |format|\n if @responder.update_attributes(params[:responder])\n format.html { redirect_to @responder, :notice => 'Responder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @responder.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @specie = Specie.find(params[:id])\n\n respond_to do |format|\n if @specie.update_attributes(params[:specie])\n format.html { redirect_to @specie, notice: 'Specie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @specie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.68309736", "0.6799758", "0.67633224", "0.6350563", "0.625601", "0.622225", "0.61765367", "0.6139897", "0.6112186", "0.6004454", "0.59752643", "0.5971121", "0.59509224", "0.59173036", "0.59173036", "0.5878323", "0.58642566", "0.5848602", "0.5843612", "0.583796", "0.58325344", "0.58184487", "0.58184487", "0.58184487", "0.5805293", "0.5777224", "0.5775391", "0.57669395", "0.57667285", "0.5766468", "0.5760176", "0.57548183", "0.57519144", "0.57481194", "0.57199955", "0.5719723", "0.5715747", "0.5715099", "0.5712602", "0.57124925", "0.5696635", "0.56926185", "0.56920564", "0.5688677", "0.568847", "0.56822073", "0.56822026", "0.56765085", "0.5675488", "0.5674429", "0.5672841", "0.56538135", "0.56517404", "0.56484896", "0.564815", "0.5645263", "0.5644953", "0.5639821", "0.5629775", "0.5624816", "0.5617562", "0.5617562", "0.5614149", "0.561111", "0.5610511", "0.5608085", "0.5608085", "0.56051856", "0.5604514", "0.55984014", "0.55975777", "0.5596766", "0.55950636", "0.5587866", "0.55871135", "0.55807316", "0.55783194", "0.5576203", "0.5574538", "0.556604", "0.5565387", "0.55633694", "0.55622786", "0.55606675", "0.55595785", "0.55588514", "0.5558798", "0.55557185", "0.5552713", "0.55488384", "0.5548095", "0.5544101", "0.5543309", "0.55415136", "0.5539628", "0.55367845", "0.55365396", "0.5535894", "0.5535894" ]
0.6686386
4
DELETE /officers/1 DELETE /officers/1.json
def destroy @officer.destroy respond_to do |format| format.html { redirect_to officers_url, notice: 'Officer was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @officer = Officer.find(params[:id])\n @officer.destroy\n\n respond_to do |format|\n format.html { redirect_to officers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @officer = Officer.find(params[:id])\n @officer.destroy\n\n respond_to do |format|\n format.html { redirect_to officers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientsOffers = ClientsOffers.find(params[:id])\n @clientsOffers.destroy\n\n respond_to do |format|\n format.html { redirect_to clientsOffers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@guild.officers.destroy(params[:id])\n\t\trespond_to do |format|\n\t\t\tback_page = guild_officers_url\n\t\t\tback_page = URI(request.referer).path if params[:back]\n\t\t\tformat.html { redirect_to back_page, notice: 'Officer was successfully destroyed.' }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @officer = Officer.find(params[:id])\n @officer.destroy\n\n respond_to do |format|\n format.html { redirect_to(officers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @trafficofficer.destroy\n respond_to do |format|\n format.html { redirect_to trafficofficers_url, notice: 'Trafficofficer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @theader.destroy\n respond_to do |format|\n format.html { redirect_to offices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n \n if @client.deleted_at.blank?\n @client.destroy\n else\n @client.revive\n end\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def destroy\n @staffer = Staffer.find(params[:id])\n @staffer.destroy\n\n respond_to do |format|\n format.html { redirect_to staffers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kickoff = Kickoff.find(params[:id])\n @kickoff.destroy\n\n respond_to do |format|\n format.html { redirect_to kickoffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @loan_officer.destroy\n respond_to do |format|\n format.html { redirect_to loan_officers_url, notice: 'Loan officer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_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 @retailer = Retailer.find(params[:id])\n @retailer.destroy\n\n respond_to do |format|\n format.html { redirect_to retailers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete(options={})\n connection.delete(\"/\", @name)\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 client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @client.delete(@name)\n end", "def delete\n request(:delete)\n end", "def delete!\n request! :delete\n end", "def destroy\n @api_client = ApiClient.find(params[:id])\n @api_client.destroy\n\n respond_to do |format|\n format.html { redirect_to api_clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @client = Client.find(params[:id])\r\n @client.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to clients_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\n @client.delete( name )\n end", "def destroy\n @getoff_info = GetoffInfo.find(params[:id])\n @getoff_info.destroy\n\n respond_to do |format|\n format.html { redirect_to getoff_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @coff = Coff.find(params[:id])\n @coff.destroy\n\n respond_to do |format|\n format.html { redirect_to coffs_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_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 @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attorney.destroy\n respond_to do |format|\n format.html { redirect_to attorneys_url, notice: 'Attorney was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy\n @foyer = Foyer.find(params[:id])\n @foyer.destroy\n\n respond_to do |format|\n format.html { redirect_to(foyers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def destroy\n @qa_client = QaClient.find(params[:id])\n @qa_client.destroy\n\n respond_to do |format|\n format.html { redirect_to qa_clients_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n \n respond_to do |format|\n format.html { redirect_to clients_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @auto_offer.destroy\n respond_to do |format|\n format.html { redirect_to auto_offers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fabric = Fabric.find(params[:id])\n @fabric.destroy\n\n respond_to do |format|\n format.html { redirect_to fabrics_url }\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 official = Official.find(params[:id])\n official.destroy\n head 204\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end", "def destroy\n @zone_updater = ZoneUpdater.find(params[:id])\n @zone_updater.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_updaters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prayer = Prayer.find(params[:id])\n @prayer.destroy\n\n respond_to do |format|\n format.html { redirect_to prayers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prayer = Prayer.find(params[:id])\n @prayer.destroy\n\n respond_to do |format|\n format.html { redirect_to prayers_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\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 @paper.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_path }\n format.json { head :ok }\n end\n end", "def destroy\n @dayoff = Dayoff.find(params[:id])\n @dayoff.destroy\n\n respond_to do |format|\n format.html { redirect_to dayoffs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attendee = Attendee.find(params[:id])\n @attendee.destroy\n\n respond_to do |format|\n format.html { redirect_to attendees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attendee = Attendee.find(params[:id])\n @attendee.destroy\n\n respond_to do |format|\n format.html { redirect_to attendees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end", "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client a été supprimer.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronist = Uchronist.find(params[:id])\n @uchronist.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @calorie.destroy\n respond_to do |format|\n format.html { redirect_to calories_url, notice: 'Calorie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n authorize! :update, @client\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Данные по клиенту удалены.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @farmer.destroy\n respond_to do |format|\n format.html { redirect_to farmers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @attendee = Attendee.find(params[:id])\n @attendee.destroy\n\n respond_to do |format|\n format.html { redirect_to attendees_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @empolyee.destroy\n respond_to do |format|\n format.html { redirect_to empolyees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end" ]
[ "0.7247002", "0.7247002", "0.71190375", "0.6972263", "0.69123363", "0.69038635", "0.6731143", "0.6599067", "0.65580136", "0.6528185", "0.64996713", "0.6478702", "0.6469267", "0.64634544", "0.6461432", "0.6461195", "0.646096", "0.6459006", "0.6459006", "0.6459006", "0.6459006", "0.6459006", "0.6459006", "0.6459006", "0.6459006", "0.6459006", "0.64581597", "0.64515376", "0.64476204", "0.6444073", "0.64345276", "0.64345276", "0.6434086", "0.6434086", "0.6434086", "0.6434086", "0.64321053", "0.643133", "0.6430917", "0.64262295", "0.64126885", "0.6407827", "0.6406629", "0.64045775", "0.64031184", "0.6392739", "0.6386071", "0.636157", "0.63594395", "0.63539344", "0.63529146", "0.6352445", "0.6352162", "0.635033", "0.6345849", "0.634138", "0.63406485", "0.6337846", "0.63374346", "0.6323575", "0.63164467", "0.63116735", "0.63069147", "0.63055104", "0.63035184", "0.63035184", "0.6303069", "0.62979496", "0.62979496", "0.6292121", "0.6291543", "0.6287365", "0.6286821", "0.6286821", "0.6286821", "0.62857425", "0.628504", "0.6284376", "0.6284376", "0.62826186", "0.6282442", "0.6280713", "0.6276794", "0.62741417", "0.6273119", "0.6267621", "0.6262268", "0.62603664", "0.6259342", "0.6255489", "0.6254795", "0.62512755", "0.6250763", "0.62488246", "0.6247984", "0.624507", "0.624507", "0.6243849", "0.62368965" ]
0.6990993
3
Use callbacks to share common setup or constraints between actions.
def set_officer @officer = Officer.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 officer_params params.fetch(:officer, {}).permit(:name, :surname) 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
Generate the "official" name for the 7600B form, comprised of the GTC number, the order number , and the mod number, both padded to 4 digits and all separated by dashes.
def name "#{gtc_number}-#{name_str(order_number)}-#{name_str(mod_number)}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_name_with_digit (digit)\n char_array = ('a'..'z').to_a + ('0'..'9').to_a + ['_'] # char_array.length is 37\n\n quotient = digit\n queue = []\n while true do\n queue.push quotient % N_CHAR\n quotient = (quotient / N_CHAR).round - 1\n if quotient <= -1\n break\n end\n end\n\n name = ''\n while queue.any? do\n name = name + char_array[queue.pop]\n end\n name\n end", "def pcb_name\n \"#{self.pcb_prefix}-#{self.pcb_number}-#{self.pcb_dash_number}\"\n end", "def design_name\n\n if 1 == 2 # self.part_number_id == 0\n design_name = self.prefix.pcb_mnemonic + self.number\n design_name += self.revision.name if self.revision && self.revision_id > 0\n \n case self.entry_type\n when 'dot_rev'\n design_name += self.numeric_revision.to_s if self.numeric_revision > 0\n when 'date_code'\n design_name += self.numeric_revision.to_s if self.numeric_revision && self.numeric_revision > 0\n design_name += '_eco'\n design_name += self.eco_number\n end\n \n \"#{design_name} (\" + \n self.prefix.pcb_number(self.number,\n self.revision.name,\n self.numeric_revision) + ')'\n else\n self.pcb_number\n end\n \n end", "def gen_name\n\t\tlast_id = Bill.last ? Bill.last.id + 1 : 1\n\t\t\"#{last_id}-1-1\"\n\tend", "def build_name\n \"#{manufacturer} #{weight} #{style} #{name}\"\n end", "def homework_number\n \"#{homework_phone_prefix}-#{rand(8..9)}#{FFaker.numerify('##-##-##')}\"\n end", "def name\n return \"LA100QAQC\"\n end", "def to_name\n \"#{MAJOR}_#{MINOR}_#{REVISION}\"\n end", "def to_name\n \"#{MAJOR}_#{MINOR}_#{REVISION}\"\n end", "def pcb_display_name\n name = self.pcb_name\n name += ' ' + self.pcb_revision if self.pcb_revision.size > 0\n name\n end", "def pcba_name\n \"#{self.pcba_prefix}-#{self.pcba_number}-#{self.pcba_dash_number}\"\n end", "def full_no\n # Debt claim no (Office & year & sequential number) => OOOO-YYYY-NNNNN\n if claim_no == \"$err\"\n \"0000-0000-00000\"\n else\n claim_no.blank? ? \"\" : claim_no[0..3] + '-' + claim_no[4..7] + '-' + claim_no[8..12]\n end\n end", "def south_african_pty_ltd_registration_number\n generate(:string) do |g|\n g.int(length: 4)\n g.lit('/')\n g.int(ranges: [1000..9_999_999_999])\n g.lit('/07')\n end\n end", "def name\n [cc_type, last_digits].join(' - ')\n end", "def swedish_organisation_number\n # Valid leading digit: 1, 2, 3, 5, 6, 7, 8, 9\n # Valid third digit: >= 2\n # Last digit is a control digit\n base = [sample([1, 2, 3, 5, 6, 7, 8, 9]), sample((0..9).to_a), sample((2..9).to_a), format('%06d', rand(10**6))].join\n base + luhn_algorithm(base).to_s\n end", "def get_full_name\n return nil unless GENUS_AND_SPECIES_RANK_NAMES.include?(self.rank_string) || self.type == 'Combination'\n d = full_name_hash\n elements = []\n eo = '<em>'\n ec = '</em>'\n d.merge!('genus' => [nil, '[GENUS NOT PROVIDED]']) if !d['genus']\n\n elements.push(\"#{eo}#{d['genus'][1]}#{ec}\")\n elements.push ['(', %w{subgenus section subsection series subseries}.collect { |r| d[r] ? [d[r][0], \"#{eo}#{d[r][1]}#{ec}\"] : nil }, ')']\n elements.push ['(', eo, d['superspecies'], ec, ')'] if d['superspecies']\n\n %w{species subspecies variety subvariety form subform}.each do |r|\n elements.push(d[r][0], \"#{eo}#{d[r][1]}#{ec}\") if d[r]\n end\n\n elements.flatten.compact.join(\" \").gsub(/\\(\\s*\\)/, '').gsub(/\\(\\s/, '(').gsub(/\\s\\)/, ')').squish.gsub('</em> <em>', ' ')\n end", "def south_african_listed_company_registration_number\n generate(:string) do |g|\n g.int(length: 4)\n g.lit('/')\n g.int(ranges: [1000..9_999_999_999])\n g.lit('/06')\n end\n end", "def pcb_unique_number\n self.pcb_prefix + '-' + self.pcb_number\n end", "def serial_generator\n \"OD#{id.to_s.rjust(10, \"0\")}\"\n end", "def default_abbreviation\n \"%03d\" % (id % 1000) if id\n end", "def long_name\n [number, title].join(' ')\n end", "def long_name\n [number, title].join(' ')\n end", "def create_name\n prefix = ('A'...'Z').to_a.shuffle[0..1].join('')\n suffix = (100..1000).to_a.sample\n \"#{prefix}#{suffix}\"\n end", "def live_name\n [\n transformed_part('product'),\n middle_name(standalone: false), # Will have word dividers on either side\n idx,\n maybe_upto,\n '-',\n parts['sku'] =~ /editorial/ && bang? ? 'square-' : nil,\n [name_base, ext_name].join\n ].compact.join\n end", "def e010_fax(pedido)\n return \"%-16s\" % \"(19)3241-5135\"\n end", "def generate_name\r\n z = Time.now.getutc\r\n name = z.strftime(\"%Y%m%d.%H%M.%S.\") + sprintf(\"%03d\", (z.tv_usec / 1000))\r\n return name\r\n # Process.pid kddkd\r\n end", "def name\n\t\t\tnew_name_letters = (0...2).map { ('a'..'z').to_a[rand(26)] }.join.upcase\n\t\t\tnew_name_numbers = (0...3).map { (0..9).to_a[rand(10)] }.join\n\t\t\tnew_name = [new_name_letters, new_name_numbers].join\n\t\t\t3.times do\n\t\t\t\tputs new_name\n\t\t\tend\n\tend", "def pcb_a_part_number(number,\n revision, \n numeric_revision)\n\n self.loaded_prefix + '-' + number + '-00'\n \n end", "def display_number\n \"XXXX-XXXX-XXXX-#{last_digits}\"\n end", "def display_number\n \"XXXX-XXXX-XXXX-#{last_digits}\"\n end", "def calcIUPACname\n getIncompleteName + Constants::ALKANE_SFIX\n end", "def generate_production_number\n start_digits = rand(10000..99999)\n end_digits = rand(10000..99999)\n alphabet = (\"A\"..\"Z\").to_a\n middle_digits = \"2017\"\n 5.times { middle_digits << alphabet.sample}\n \"#{start_digits}-#{middle_digits}-#{end_digits}\"\n end", "def generate_production_number\n start_digits = rand(10000..99999)\n end_digits = rand(10000..99999)\n alphabet = (\"A\"..\"Z\").to_a\n middle_digits = \"2017\"\n 5.times { middle_digits << alphabet.sample}\n \"#{start_digits}-#{middle_digits}-#{end_digits}\"\n end", "def name\n [@n.to_s + character.to_s, symmetry].reject{|p| p == \"\"}.join(\"_\")\n end", "def full_display_name\n name = self.pcb_display_name\n if self.new?\n name += ' / ' + self.pcba_display_name\n end\n name\n end", "def generate_name\n @seed ||= 0\n @seed += 1\n \"_anon_#{@seed}\"\n end", "def create_filename(heat_number)\n name = competition.to_s\n name += \"_\"\n name += \"heat_\"\n name += heat_number.to_s.rjust(3, \"0\")\n \"#{name.first(59)}.txt\"\n end", "def south_african_close_corporation_registration_number\n generate(:string) do |g|\n g.oneof do |one|\n one.group do |g_|\n g_.lit('CK')\n g_.int(length: 2)\n end\n one.int(length: 4)\n end\n g.lit('/')\n g.int(ranges: [1000..9_999_999_999])\n g.lit('/23')\n end\n end", "def display_name\n temp = display_number\n if !name.blank?\n temp += ': ' + name\n end\n return temp\n end", "def name\n \"#{number}: #{short_name}\"\n end", "def full_account_number\n if account_number_prefix && !account_number_prefix.empty? && account_number_prefix != '000000'\n \"#{account_number_prefix}-#{account_number}\"\n else\n \"#{account_number}\"\n end\n end", "def e010_nome_do_registro\n return \"E010\"\n end", "def norwegian_organisation_number\n # Valid leading digit: 8, 9\n mod11_check = nil\n while mod11_check.nil?\n base = [sample([8, 9]), format('%07d', rand(10**7))].join\n mod11_check = mod11(base)\n end\n base + mod11_check.to_s\n end", "def get_full_name\n # [Steve, 20140725] Too long/repetitive: \"#{description} #{header_year} - #{get_federation_type}\"\n description\n end", "def generate_username3 (fir, las, year)\n\tye = year.to_s\n\tfir[0] + las + ye[-2..-1] unless ye.length != 4\nend", "def full_name\n \"#{@name}-#{@version}\"\n end", "def newrandombuildingid()\n while(true)\n if(@filename_pur.match(/^_/))\n id = \"\"\n else\n id = \"_\"\n end\n id += \"#{@filename_pur}_BD.#{@buildinggennr}\"\n if(@exportedid[id] == nil)\n break;\n end\n @buildinggennr += 1\n end\n return id\n end", "def name\n return 'AedgSmallToMediumOfficeExteriorDoorConstruction'\n end", "def unique_format_name\n string_with_id(name.observation_name)\n rescue StandardError\n \"\"\n end", "def build_id(disk_dev_name, nr)\n nr = deep_copy(nr)\n Builtins.sformat(\"%1:%2\", disk_dev_name, nr)\n end", "def grn_no_format\n grn_no.to_s.rjust(5, INOCRM_CONFIG[\"inventory_grn_no_format\"])\n end", "def name\n return 'XcelEDAReportingandQAQC'\n end", "def generate\n\t name = ' ' + get_starting_letter\n\t # since the name already has a starting letter the total name length will\n\t # be one more than the selected name_length_distribution selected\t\n\t\tname_length_distribution = [3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 8, 9]\n\t\tdesired_length = name_length_distribution.at(@random_number_generator.rand(0...12))\n\t\t\t\t\n\t\t(desired_length - 1).times do\t\t\t\t\t\t\n\t\t\tname += get_next_letter(name[name.length - 2], name[name.length - 1])\n\t\tend\n\n\t\tname += get_last_letter(name[name.length - 1], name[name.length - 2])\n name.lstrip.capitalize\n\tend", "def create_name\n colors = @colors\n first = colors.sort_by{rand}.first.split('')[0..2].sort_by{rand}.to_s\n last = colors.sort_by{rand}.last.split('')[0..2].sort_by{rand}.to_s\n return \"--- #{first}.#{@remainder}.#{last} ---\"\n end", "def name_bill\n \"#{name}:#{endNumber}\"\n end", "def home_work_phone_number\n FFaker.numerify(\"(#{home_work_phone_prefix}) #### ####\")\n end", "def build_name(name)\n \"_design/#{name}\"\n end", "def construct_supply_item_name(data)\n @supply_item_name = \"#{data[:name01]}\"\n @supply_item_name += \" #{data[:name02]}\" unless data[:name02].blank?\n @supply_item_name += \" (#{data[:name03]})\" unless data[:name03].blank?\n super\n end", "def construct_supply_item_name(data)\n @supply_item_name = \"#{data[:name01]}\"\n @supply_item_name += \" #{data[:name02]}\" unless data[:name02].blank?\n @supply_item_name += \" (#{data[:name03]})\" unless data[:name03].blank?\n super\n end", "def namegen desired = UUID.new.to_s, realuniq = false\n a = @desired2names.fetch desired, Array.new\n return a.first if not realuniq and not a.empty?\n n = nil\n cand0 = as_tr_cpp desired.to_s\n cand1 = cand0\n while @barenames.has_key? cand1\n n ||= 1\n n += 1\n cand1 = cand0 + n.to_s\n end\n if cand1.length <= @limit\n # OK, take this\n name = old_new @prefix + cand1\n a.push name\n @desired2names.store desired, a\n @barenames.store cand1, name\n return name\n elsif @phasechange\n # name too long, use UUID#to_s\n u = UUIDNS.new_sha1 desired.to_s\n return new u.to_s, realuniq\n else\n # yet too long, now use Integer#to_s\n u = UUIDNS.new_sha1 desired.to_s\n v = u.to_i.to_s @radix\n return new v, realuniq\n end\n end", "def to_s\n \"#%-3s %s\" % [ number, name]\n end", "def name\n self.pcb_name + ' / ' + self.pcba_name\n end", "def obfuscate_id_default_spin\n alphabet = Array(\"a\"..\"z\")\n number = name.split(\"\").collect do |char|\n alphabet.index(char)\n end\n\n number.shift(12).join.to_i\n end", "def heb_year_name\r\n year = @hy\r\n raise RangeError, \"only 5700 - 5899 supported\" if year < 5700 || year >= 5900\r\n prefix = year / 100 == 57 ? \"התש\" : \"התת\"\r\n suffix = HebrewDate.heb_number(year % 100)\r\n full = prefix + suffix\r\n end", "def generateBuildNamePrefix()\n testflight_version_number = get_version_number(\n xcodeproj: \"CICD-DemoApp.xcodeproj\"\n )\n testflight_build_number = get_build_number(\n xcodeproj: \"CICD-DemoApp.xcodeproj\"\n )\n return \"CICD_\" + testflight_version_number.to_s + \"-\" + testflight_build_number.to_s\nend", "def get_node_name(chef_node_name, prefix)\n return chef_node_name unless chef_node_name.nil?\n\n # lazy uuids, 15 chars cause windows has limits\n (\"#{prefix}-\" + rand.to_s.split(\".\")[1]).slice(0, 14)\n end", "def name\n @n.to_s + characterization\n end", "def full_name_24_length\n full = \"#{self.name} #{self.last_name}\"\n full[0,24]\n end", "def name_of_uvhw(well)\n plate, r, c = find_uvhw(well)\n return \"Well #{plate.id}(#{'ABCD'[r]}#{c+1})\"\n end", "def name\n return 'AedgSmallToMediumOfficeRoofConstruction'\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.to_s.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << eob.rendering_provider_suffix\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def pcba_display_name\n name = self.pcba_name\n name += ' ' + self.pcba_revision if self.pcba_revision.size > 0\n name\n end", "def package_name(buildno=nil)\n if buildno\n buildno = Time.now.strftime(\"%H*60+%M\")\n versnum = \"#{version}.#{buildno}\"\n else\n versnum = version\n end\n\n if platform\n \"#{name}-#{versnum}-#{platform}\"\n else\n \"#{name}-#{versnum}\"\n end\n end", "def mk_name\n \"quarley poller #{rand(1_000_000)} #{Time.now.to_i}\"\n end", "def service_prov_name\n Output835.log.info \"Printing NM1*82 for Patient Acc Num : #{eob.patient_account_number}\"\n prov_id, qualifier = service_prov_identification\n service_prov_name_elements = []\n service_prov_name_elements << 'NM1'\n service_prov_name_elements << '82'\n service_prov_name_elements << (eob.rendering_provider_last_name.strip.blank? ? '2': '1')\n service_prov_name_elements << prov_last_name_or_org\n service_prov_name_elements << eob.rendering_provider_first_name\n service_prov_name_elements << eob.rendering_provider_middle_initial\n service_prov_name_elements << ''\n service_prov_name_elements << ''\n service_prov_name_elements << qualifier\n service_prov_name_elements << prov_id\n service_prov_name_elements = Output835.trim_segment(service_prov_name_elements)\n service_prov_name_elements.join(@element_seperator)\n end", "def name\n return \"New Firmware\" if !id\n version + \" (\" + description.to_s + \") \" +\n \" (\" + (for_external ? \"internal\" : \"external\") + \")\"\n end", "def generate_name(id)\n return GameData::Item[id].exact_name\n end", "def gen_name\n \"gicon_#{@@count}\"\n end", "def generate\n name = ' ' + get_starting_letter\n # since the name already has a starting letter the total name length will\n # be one more than the selected name_length_distribution selected\n name_length_distribution = [3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 8, 9]\n desired_length = name_length_distribution.at(@random_number_generator.rand(0...12))\n\n (desired_length - 1).times do\n name += get_next_letter(name[name.length - 2], name[name.length - 1])\n end\n\n name += get_last_letter(name[name.length - 1], name[name.length - 2])\n name.lstrip.capitalize\n end", "def pick_name(n,w)\n return USERNAMES[ (n % USERNAMES.size) ] + n.to_s + \"_w#{w.to_s}\"\n end", "def pick_name(n,w)\n return USERNAMES[ (n % USERNAMES.size) ] + n.to_s + \"_w#{w.to_s}\"\n end", "def full_id9\n self.id.blank? ? '000000000' : self.id.to_s.rjust(9,'0')\n end", "def qualified_code\n team_id = team.code unless team.instance_of? Center\n \"%04d\" % center.code + \"-\" + \"%04d\" % team_id # team.code.to_s.rjust(3, \"0\")\n end", "def unique_format_name\n display_name + \" (#{id || \"?\"})\"\n end", "def random_name\n letters = ('AA'..'ZZ').to_a.sample()\n digits = ('000'..'999').to_a.sample()\n letters + digits\n end", "def random_name\n \"#{random_letters(pick_range(4..12)).capitalize} #{random_letters(pick_range(4..12)).capitalize}\"\n end", "def random_name\n \"#{random_letters(pick_range(4..12)).capitalize} #{random_letters(pick_range(4..12)).capitalize}\"\n end", "def get_short_name\n @state_org_id.to_s + \" LEA\"\n end", "def planet_name(planet_seed)\n s = planet_seed.clone\n pairs = 4.times.collect do\n pair = letter_pair(s)\n s = next_fib_triple(s)\n pair\n end \n pairs = pairs.take(3) unless long_name?(planet_seed)\n return pairs.join.capitalize, s \n end", "def format_market_uid\n @formated_market_uid = market_uid.to_s\n if specifier.present?\n @formated_market_uid += \"^#{specifier.to_s}\" \n self.specifier_name = specifier.to_s\n end\n end", "def name\n return 'AedgSmallToMediumOfficeExteriorWallConstruction'\n end", "def make_string(number, length=3)\n valid_day_number?(number) or raise ArgumentError\n name = @day_names[number - 1]\n name[0 ... [name.length, length].min]\n end", "def create_filename(prev_name)\n prev_name[/\\d+$/] ? prev_name.next : prev_name + '02'\n end", "def short_name\r\n return \"#{first_name[0].chr}. #{last_name}\"\r\n end", "def department_name_and_number\n \t\"#{department.abbreviation} #{number}\"\n end", "def south_african_pty_ltd_registration_number; end", "def numbername\n self.number + \" - \" + self.name\n end", "def to_s() designation_number; end", "def internationaldesignator\n launchyear+launchnumber+launchpiece\n end", "def generate_username3 (*allArgs)\n\tyear = allArgs[2].to_s\n\tif year.length != 4 then return nil end\n\talphaName = generate_username2(allArgs[0],allArgs[1])\n\treturn alphaName + year[-2..-1]\nend" ]
[ "0.6776644", "0.6734847", "0.66660166", "0.66488355", "0.6537759", "0.6443229", "0.6412352", "0.63953155", "0.63953155", "0.6392567", "0.6337869", "0.6336105", "0.6314855", "0.6234735", "0.62131804", "0.6210511", "0.620397", "0.618064", "0.6172254", "0.6171528", "0.6165391", "0.6165391", "0.614618", "0.6122257", "0.6122008", "0.61126024", "0.6098115", "0.60903615", "0.60818744", "0.60818744", "0.6065962", "0.6059195", "0.6059195", "0.6055722", "0.60536814", "0.60528386", "0.6045012", "0.6043511", "0.60194135", "0.601508", "0.6011279", "0.5993233", "0.5991287", "0.59840995", "0.59531903", "0.5947479", "0.59154385", "0.59124583", "0.59104604", "0.5907195", "0.59065264", "0.59057564", "0.5904306", "0.5896923", "0.58888656", "0.5875268", "0.58574945", "0.5848979", "0.5848979", "0.58444357", "0.58410746", "0.5840489", "0.583839", "0.5830323", "0.5827313", "0.58148193", "0.58126193", "0.5811931", "0.58068156", "0.58044046", "0.5800572", "0.5797058", "0.57970023", "0.5795462", "0.5795142", "0.578909", "0.5777343", "0.57689536", "0.5764494", "0.5753871", "0.5753871", "0.57523686", "0.57438594", "0.573344", "0.5730402", "0.5728694", "0.5728694", "0.5717727", "0.5708676", "0.5702086", "0.5697989", "0.56949663", "0.56862754", "0.568396", "0.5681207", "0.5679388", "0.5678032", "0.5673901", "0.56731063", "0.5660696" ]
0.74425554
0
Returns the estimated amount obligated based on the platform fee and entered usage across the associated integrations. Pricing parameters are managed in the environment
def cost_to_date total_auths = integration_usages.pluck(:auths).sum auth_cost = total_auths * Figaro.env.per_auth_cost.to_f ial2_user_cost = ial2_users * Figaro.env.per_ial2_user_cost.to_f platform_fee + auth_cost + ial2_user_cost end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insurance_fee\n (COMMISSION_RATE * INSURANCE_PART_RATE * price).round\n end", "def sum_835_amount (opt=true)\n net_835_amt = 0\n if @client.name.upcase == \"GOODMAN CAMPBELL\"\n @checks.each do |check|\n total_835_amt = 0\n get_gcbs_insurance_eobs(check)\n total_835_amt = complete_check_amount_condition ? check.check_amount.to_f : check.eob_amount_calculated(@eobs, @nextgen_insurance)\n net_835_amt += total_835_amt.to_f\n end\n else\n @checks.each do |check|\n total_835_amt = 0\n insurance_payment_eobs = check.insurance_payment_eobs\n patient_pay_eobs = check.patient_pay_eobs\n unless insurance_payment_eobs.blank?\n insurance_payment_eobs.each do |ins_pay_eob|\n total_835_amt += ins_pay_eob.total_amount_paid_for_claim.to_f\n total_835_amt += ins_pay_eob.late_filing_charge.to_f\n if facility.details[:interest_in_service_line].blank?\n total_835_amt += ins_pay_eob.claim_interest.to_f\n end\n end\n end\n unless patient_pay_eobs.blank?\n patient_pay_eobs.each do |pat_pay_eob|\n total_835_amt += pat_pay_eob.stub_amount.to_f\n end\n end\n unless config.content_layout.downcase == \"eob\"\n total_835_amt += check.provider_adjustment_amount.to_f\n end\n if !check.job.provider_adjustments.blank? && config.content_layout.downcase == \"eob\" &&\n config.print_plb == \"print plb\"\n total_835_amt += check.job.provider_adjustments.sum('amount').to_f\n end\n net_835_amt += total_835_amt.to_f\n end\n end\n @total_835_amount = @total_835_amount + net_835_amt if opt\n sprintf(\"%.2f\", net_835_amt) \n end", "def suitable_halfs\n required_amount\n end", "def payment_amount\n convert_email_to_user && save\n return override_cost if override_cost.present?\n\n event&.get_cost(member: user&.present?)\n end", "def total_price\n total = total_price_without_installments\n if promotions.any?\n adjustment = adjustments.eligible.map(&:amount).sum\n\n (total += adjustment).to_f\n end\n if line_items.any? { |li| li.request_installments == true }\n total = total / 5\n end\n total\n end", "def calculate_fee_amount base_amount\n (base_amount * SITE_FEE_PERCENTAGE).round(2)\n end", "def outstanding_amount\n if payment_item.is_a? GeneralPaymentItem\n [0.0, payment_item.amount - payment_installments.map(&:amount).sum].max\n else\n nil\n end\n end", "def compute_actual\n line[1] = @ho_form.line['sqft']\n line[2] = @ho_form.line['total_sqft']\n line[3] = (line[1] * 100.0 / line[2]).round(2)\n\n line['4/gross_inc'] = gross_income\n\n # We make a simplifying assumption that (1) every Home Office Expense\n # applies to every Home Office form, and (2) all expenses are indirect.\n categorize_records('Home Office Expense')\n #\n # We assume that the home office using the actual method is being rented and\n # thus there are no mortgage payments or such on it.\n #\n #fill_for_categories(self, '5b', 'Casualty_Losses')\n #fill_for_categories(self, '6b', 'Mortgage_Interest')\n #fill_for_categories(self, '7b', 'Real_Estate_Taxes')\n\n line['8b'] = sum_lines('5b', '6b', '7b')\n line[9] = (line['8b'] * line[3] / 100.0).round\n line[10] = line[9]\n\n line[11] = other_business_expenses\n\n line[12] = sum_lines(10, 11)\n line['13/ho_max_ded'] = line[4] - line[12]\n\n fill_for_categories(self, '16b', 'Insurance')\n fill_for_categories(self, '17b', 'Rent')\n fill_for_categories(self, '18b', 'Repairs')\n fill_for_categories(self, '19b', 'Utilities')\n fill_other_categories(\n self, '20b', continuation: 'Other Home Office Expenses'\n )\n line['21b'] = sum_lines(*%w(14b 15b 16b 17b 18b 19b 20b))\n line[22] = (line['21b'] * line[3] / 100.0).round\n\n # Assume no carryover for line 23\n line['24/ho_ded'] = sum_lines('21a', 22, 23)\n line[25] = [ line[13], line[24] ].min\n line[26] = line[13] - line[25]\n\n # Assume no casualty losses or depreciation for lines 27-29 and 33\n line[30] = sum_lines(27, 28, 29)\n line[31] = [ line[26], line[30] ].min\n line[32] = sum_lines(10, 25, 31)\n\n line[33] = BlankZero\n line['34/ho_expenses'] = line[32] - line[33]\n\n end", "def required_cost\n return nil unless payment_for && (payment_for.is_a?(Invite) || payment_for.is_a?(UserKroog))\n return payment_for.amount_usd.to_f\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 host_fee\n (total - net_rate).round(2)\n end", "def application_fee\n self[:application_fee] || (unit_price * (COMMISSION_RATE / 100) + TRANSACTION_COST / 100).round(2) || BigDecimal(0)\n end", "def deposit\n if admin_use\n 0\n elsif estimated_numbers < 20\n 150\n elsif estimated_numbers < 40\n 300\n else\n 600\n end\n end", "def billing_amount\n self.net_amount + self.taxes_amount\n end", "def billing_amount\n self.net_amount + self.taxes_amount\n end", "def fulfillment_fee\n\t line_items.inject(0.0) {|charge, line_item| charge = charge + (line_item.fulfillment_fee)}\n end", "def calculate_seller_amount base_amount, fee_amount\n (base_amount - fee_amount).round(2)\n end", "def amount_payment_outstanding\n capital_required - amount_payment_collected\n end", "def get_billable_net_amount\n @bill.calculate_net_amount()\n end", "def annual_cost_or_base_pay\n case request_model_type\n when 'staff', 'contractor'\n (annual_base_pay_cents / 100.0)\n when 'labor'\n (calculate_annual_cost_in_cents / 100.0)\n else\n logger.error(\"Unknown request model type: #{request_model_type}\")\n 0.00\n end\n end", "def amount_owed\n invoice_total - total_amount_paid\n end", "def fulfillment_fee\n begin\n if variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee > 0\n variant.product_costs.where(:retailer_id => self.order.retailer_id).first.fulfillment_fee * quantity\n else\n self.order.retailer.fulfillment_fee * quantity\n end\n rescue\n begin\n self.order.retailer.fulfillment_fee * quantity\n rescue\n 0.0\n end\n end\n end", "def get_provider_adjustment_amount\r\n net_plb_amt_of_batch = 0\r\n conditions = \"jobs.is_excluded = 0\r\n and (check_informations.payment_method = 'CHK' or check_informations.payment_method = 'OTH')\"\r\n jobs = Batch.select(\"provider_adjustments.id as plb_id, provider_adjustments.amount as plb_amt\"). \\\r\n where(conditions).\\\r\n joins(\"LEFT OUTER JOIN jobs ON jobs.batch_id = #{self.id} \\\r\n LEFT OUTER JOIN check_informations ON check_informations.job_id = jobs.id \\\r\n LEFT OUTER JOIN provider_adjustments ON provider_adjustments.job_id = jobs.id\").\r\n group(\"provider_adjustments.id\").each do |job| net_plb_amt_of_batch += job.plb_amt.to_f end\r\n net_plb_amt_of_batch\r\n end", "def total_paid_amount(facility)\n eobs = InsurancePaymentEob.select(\"SUM(total_amount_paid_for_claim) AS total_payment, \\\n SUM(claim_interest) AS total_interest, \\\n SUM(late_filing_charge) AS total_filing_charge, \\\n SUM(fund) AS total_fund, \\\n SUM(over_payment_recovery) AS total_over_payment_recovery\").\n where(\"check_information_id = #{id}\")\n eob = eobs.first if !eobs.blank?\n if !eob.blank?\n total_over_payment_recovery = facility.details[:over_payment_recovery] ? eob.total_over_payment_recovery : 0\n payment_amount = eob.total_payment.to_f\n net_payment_amount = payment_amount.to_f - total_over_payment_recovery.to_f\n total_paid_amount = net_payment_amount.to_f + eob.total_filing_charge.to_f + eob.total_fund.to_f\n if !facility.details[:interest_in_service_line]\n total_paid_amount += eob.total_interest.to_f\n end\n else\n total_paid_amount = PatientPayEob.where(\"check_information_id = #{id}\").sum('stub_amount')\n end\n job_ids = job.job_ids_for_check\n if !job_ids.blank?\n total_provider_amount = ProviderAdjustment.where(\"job_id in (#{job_ids.join(',')})\").sum('amount')\n end\n total_paid_amount += total_provider_amount.to_f\n total_paid_amount.to_f.round(2)\n end", "def get_provider_adjustment_amount\r\n amount = ProviderAdjustment.where([\"job_id in (?)\", get_ids_of_all_jobs]).sum(:amount)\r\n amount.to_f\r\n end", "def profit\n total_before_tax - total_cost\n end", "def profit\n total_before_tax - total_cost\n end", "def amount\n user.company.point_values[:received_approval_value]\n end", "def sum_eft_amount (opt=true)\n total_eft_amt = 0\n if @client.name.upcase == \"GOODMAN CAMPBELL\"\n @checks.each do |check|\n if check.payment_method == 'EFT'\n get_gcbs_insurance_eobs(check)\n check_amount = complete_check_amount_condition ? check.check_amount.to_f : check.eob_amount_calculated(@eobs, @nextgen_insurance)\n total_eft_amt += check_amount.to_f\n else\n total_eft_amt += 0.00\n end\n end\n @total_eft_amount = @total_eft_amount + total_eft_amt if opt\n else\n @checks.each do |check|\n if check.payment_method == 'EFT'\n total_eft_amt += check.check_amount.to_f\n else\n total_eft_amt += 0.00\n end\n end\n @total_eft_amount = @total_eft_amount + total_eft_amt if opt\n end\n total_eft_amt\n end", "def fees\n total_input - total_output\n end", "def fee\n (amount * 0.005) if amount\n end", "def local_sum_exempt_vat\n invoice_lines.joins(:official_fee_type).where(:official_fee_types => {:apply_vat => false}).sum('total_official_fee')\n end", "def estimated_effort\n total_estimated_effort = 0\n\n self.project_phase_deliverables.each do |deliverable|\n total_estimated_effort += deliverable.estimated_effort.to_f unless deliverable.nil?\n end\n\n return total_estimated_effort\n end", "def calculate_costs\n self.amount = self.transaction.shipping_cost + self.transaction.value\n self.shipping_cost = self.transaction.shipping_cost\n self.commission_rate = self.buyer.account.commission_rate || SiteVariable.get(\"global_commission_rate\").to_f # Calculate commission rate, if neither exist commission is set to 0\n self.commission = Money.new((commission_rate * self.transaction.value.cents).ceil) # Calculate commision as commission_rate * item value (without shipping), round up to nearest cent\n end", "def amount\n estimate_total = self.estimate_line_items.sum(:amount)\n if self.tax_inclusive? \n tax_total = 0 \n else\n tax_total = 0 \n tax_line_items.each do |line_item|\n tax_account = line_item.account\n next if (tax_account.accountable_type=='DutiesAndTaxesAccounts' && tax_account.accountable.calculation_method==4 && tax_account.accountable.split_tax == 0) \n tax_total += line_item.amount\n end\n end\n ship_charge = self.shipping_line_items.sum(:amount)\n estimate_total + tax_total + ship_charge\n end", "def investment\n if buy_price\n num_of_shares * buy_price\n end\n end", "def real_budget\n # Continue only if is possible to read it attr\n if read_attribute(:value)\n # operator value to decimal (readable value)\n operator_in_decimal = read_attribute(:value).to_f/100\n\n # Return it real budget\n operator_in_decimal - (operator_in_decimal*0.25) # TODO call here the taxes implementation\n end\n end", "def tc_amount(accounting_element)\n\t\t\t\t payment_form = accounting_element[:payment_info][:payment][:form]\n\t\t\t\t if payment_form == \"CC\" then\n\t\t\t\t return (ticket_base_fare(accounting_element).to_f + ticket_tax(accounting_element).to_f).round(2)\n\t\t\t\t else\n return 0\n\t\t\t\t end\n\t\t\t end", "def test_payment_amount_for_output_with_sum_of_interest_and_payment\n eob = insurance_payment_eobs(:eob_57)\n facility = facilities(:facility_94)\n facility_output_config = facility_output_configs(:facility_config_226)\n total_payment_amount_for_output = eob.payment_amount_for_output(facility, facility_output_config)\n assert_equal(total_payment_amount_for_output, 48.00)\n end", "def ext_effective_price\n (effective_list_price || 0) * (qty || 0)\n end", "def trading_fee\n return exchange_trading_fee if exchange_trading_fee > 0\n system_calculated_trading_fee\n end", "def supplier_commission_total\n ((final_price_with_items * supplier.commission_percentage / 100) + supplier.commission_flat_rate)\n end", "def state_fulfillment_fee\n adjustments.eligible.where(:label => 'Additional State Fulfillment Fee').first.amount rescue 0.0\n end", "def donated_amount\n self.fees.purchased.sum(:amount).to_f\n end", "def mark_up_amt\n rounder5(self.vehicle.price * 0.082)\n end", "def amount_owed\n total_price - amount_paid\n end", "def univ_fee_amount_to_charge()\n raise \"not a university\" if ! university\n payments.select(&:good?).empty? ? payments.first.amount : university.subscription_charge_for_n(univ_dvd_rate)\n end", "def total_amount_passed_to_field_worker\n # it is assumed that the setup fee is deducted from loan disbursement \n total_amount_passed = BigDecimal(\"0\")\n self.membership_to_receive_loan_disbursement.each do |glm|\n glp = glm.group_loan_product \n total_amount_passed += glp.loan_amount - glp.setup_payment_amount\n end\n \n return total_amount_passed\n end", "def test_processor_input_field_count_with_adjustment_amounts\n svc = service_payment_eobs(:service_line_26)\n total_field_count = svc.processor_input_field_count(facilities(:facility8), false)\n if $IS_PARTNER_BAC\n assert_equal(total_field_count, 15)\n else\n assert_equal(total_field_count, 11)\n end\n end", "def compute_unit_rental_price\n per_time_fee + per_mileage_fee\n end", "def charged_fee(amount)\n (amount * merchant.fee)\n end", "def assessed_value\n buyer_input = @contract_cost * @contract_length_years.to_f\n return buyer_input if buyer_input != 0.0 && @sum_uom == 0.0 && @sum_benchmark == 0.0\n\n return (@sum_uom + @sum_benchmark + buyer_input) / 3 unless buyer_input.zero?\n\n (@sum_uom + @sum_benchmark) / 2\n end", "def assessed_value\n buyer_input = @contract_cost * @contract_length_years.to_f\n return buyer_input if buyer_input != 0.0 && @sum_uom == 0.0 && @sum_benchmark == 0.0\n\n return (@sum_uom + @sum_benchmark + buyer_input) / 3 unless buyer_input.zero?\n\n (@sum_uom + @sum_benchmark) / 2\n end", "def debt_service\n property.net_operating_income / debt_payment\n end", "def adjustment\n return 0 unless eligible?\n\n calculation\n end", "def calculate(t, fraud, type)\r\n#\t\tpp \"1\"\r\n\t\treturn 0.0 if type == 'billable' && self.bid_fee #if this fee is a bid fee and we are not looking at the bid fees then return 0, else continue on\r\n\t#\tpp \"2\"\r\n \t\r\n \tfee = self.fixed if self.price_type == 'F'\r\n \r\n fee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) if self.price_type == 'V' #calculate the fee\r\n \r\n return fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\r\n\t\t#if we get here we know we are dealing with a variable fee\r\n\t\t#puts (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min)\r\n\t#\tfee = (self.fixed + (t.amount * self.percent) + (fraud == '1' ? self.fraud : 0)).at_least(self.min).at_most(self.max) #calculate the fee\r\n\t#\tpp fee\r\n\t#\tpp \"3\"\r\n\t#\treturn fee if self.sign == '>=' && self.threshold == 0 #if there is no threshold to worry about get out quick...this is what happens the majority of the time\r\n\t\t\r\n\t\t#otherwise we need to determine the sign and threshold before we can return\r\n\t\tcase self.sign\r\n\t\t\twhen '>'\r\n\t\t\t #pp \">\"\r\n\t\t\t\treturn fee if t.amount > self.threshold\r\n\t\t\twhen '>='\r\n\t\t\t #pp \">=\"\r\n\t\t\t\treturn fee if t.amount >= self.threshold\r\n\t\t\twhen '<'\r\n\t\t\t #pp \"<\"\r\n\t\t\t\treturn fee if t.amount < self.threshold\r\n\t\t\twhen '<='\r\n\t\t\t #pp \"<=\"\r\n\t\t\t\treturn fee if t.amount <= self.threshold\r\n\t\t\telse\r\n\t\t\t #pp \"4\"\r\n\t\t\t\treturn 0.0\r\n\t\tend\r\n\t\t\r\n\t\t#if we get here then we have no idea what to do so just return 0\r\n\t\treturn 0.0\r\n\tend", "def amount_earned\n completed? ? potential_incentive : 0\n end", "def unpaid_worked_days_amount_for(project)\n self.unpaid_worked_days_for(project) * self.rate\n end", "def final_bill\n total + tax + @tip_amount\n end", "def total_non_insured_fees\n total_fee - total_insured_fees\n end", "def gross\n params['LMI_PAYMENT_AMOUNT']\n end", "def outstanding_payment_amount\n (total - amount_paid).round(2)\n end", "def apply_fees\n remove_fees\n unless waive_fees\n #CHALKLE\n self.chalkle_gst_number = Finance::CHALKLE_GST_NUMBER\n self.chalkle_fee = course.chalkle_fee_no_tax\n self.chalkle_gst = course.chalkle_fee_with_tax - chalkle_fee\n \n self.processing_fee = course.processing_fee\n self.processing_gst = course.processing_fee*3/23\n self.processing_fee = course.processing_fee-self.processing_gst\n\n #TEACHER FEE\n if provider_pays_teacher?\n self.teacher_fee = 0\n self.teacher_gst = 0\n else\n if fee_per_attendee?\n self.teacher_fee = course.teacher_cost\n elsif flat_fee?\n confirmed_booking_count = course.bookings.fees_not_waived.paid.confirmed.count\n if confirmed_booking_count > 0\n self.teacher_fee = course.teacher_cost / confirmed_booking_count\n else\n self.teacher_fee = course.teacher_cost\n end\n end\n end\n\n #TEACHER TAX\n if course.teacher.present? && course.teacher.tax_registered?\n self.teacher_gst_number = course.teacher.tax_number\n self.teacher_gst = teacher_fee*3/23\n self.teacher_fee = teacher_fee-teacher_gst\n else\n self.teacher_gst = 0\n self.teacher_gst_number = nil\n end\n\n #PROVIDER\n self.provider_fee = course.provider_fee\n if provider.tax_registered?\n self.provider_gst_number = provider.tax_number\n self.provider_gst = course.provider_fee*3/23\n self.provider_fee = self.provider_fee-self.provider_gst\n else\n self.provider_gst_number = nil\n self.provider_gst = 0\n end\n\n #adjust in case calc_cost is not course cost, should only happen if flat_fee\n difference = course.cost - calc_cost\n if difference != 0\n self.provider_fee = course.provider_fee + difference\n if provider.tax_registered?\n self.provider_gst_number = provider.tax_number\n self.provider_gst = course.provider_fee*3/23\n self.provider_fee = self.provider_fee-self.provider_gst\n else\n self.provider_gst_number = nil\n self.provider_gst = 0\n end\n end\n\n #adjust in case payment has been made already\n difference = cost - calc_cost\n if difference != 0\n #adjust processing_fee\n self.processing_fee = cost * course.provider_plan.processing_fee_percent\n self.processing_gst = self.processing_fee*3/23\n self.processing_fee = self.processing_fee-self.processing_gst\n\n #reset difference to adjust for processing_fee changes\n difference = cost - calc_cost\n\n #if payment exists then adjust provider fee to ensure the payment amount matches calc_cost\n adjustment_for_provider = difference\n adjustment_for_teacher = 0\n\n if provider_fee+provider_gst+difference < 0\n #if adjusted provider_fee is negative then deduct that negative amount from teacher_fee and make provider_fee 0\n adjustment_for_teacher = provider_fee+provider_gst+difference \n self.provider_fee = 0\n self.provider_gst = 0\n else\n self.provider_fee = provider_fee+provider_gst+adjustment_for_provider\n if provider.tax_registered?\n self.provider_gst = provider_fee*3/23\n self.provider_fee = provider_fee - provider_gst\n end\n end\n \n if adjustment_for_teacher != 0\n self.teacher_fee = teacher_fee+teacher_gst+adjustment_for_teacher\n if course.teacher.present? && course.teacher.tax_registered?\n self.teacher_gst = teacher_fee*3/23\n self.teacher_fee = teacher_fee-teacher_gst\n end\n end\n end\n end\n cost\n end", "def profit(cal)\n day_rate = avg_rate_card_amount_cents.round(2)\n mins_tracked = Timing.minute_duration_submitted_for_period_and_client(id, cal.start_date, cal.end_date)\n invoiced_amount = Invoice.amount_cents_invoiced_for_period_and_client(id, cal.start_date, cal.end_date).round(2)\n days_tracked = (hours = mins_tracked.to_s.to_d / account.account_setting.working_day_duration_minutes).round(2)\n\n (invoiced_amount - (days_tracked * day_rate.to_s.to_d)).round(2)\n end", "def calc\n\n # get the amount (hrs or days)\n if self.rateType == 'Hour'\n\n std = self.hours.nil? ? 0 : TimeUtil.hours_to_numeric(self.hours)\n\n else\n\n std = dayValue.nil? ? 0 : dayValue\n \n end\n\n amt = 0\n \n amt = std * self.chargeRate unless self.chargeRate.nil? || self.chargeRate == 0\n self.netAmount = amt\n\n return amt\n \n end", "def current_payment_fee\n payment.try(:current_fee) || 0\n end", "def total_initial_investment\n fetch(:total_initial_investment) do\n if initial_investment.nil? && ccs_investment.nil? && cost_of_installing.nil? &&\n storage_costs&.zero? && capacity_costs&.zero?\n nil\n else\n (initial_investment || 0.0) +\n (ccs_investment || 0.0) +\n (cost_of_installing || 0.0) +\n (storage_costs || 0.0) +\n (capacity_costs || 0.0)\n end\n end\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 total_fee\n fee + fee2 + fee3 + fee4\n end", "def form_amount\n if withdrawal != nil\n if withdrawal\n return amount * -1\n else\n return amount\n end\n end\n return amount\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 fee\n params['amount_fee']\n end", "def askPrice()\n @price = @serviceCorp.askPriceFor(self) if(@serviceCorp) ;\n return @price ;\n end", "def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end", "def fee\n @fee || DEFAULT_FEE\n end", "def test_processor_input_field_count_for_claim_level_with_adjustment_amounts\n insurance_payment_eob = insurance_payment_eobs(:ins_pay_eob_for_gcbs_49)\n total_field_count = insurance_payment_eob.processor_input_field_count(facilities(:facility_1))\n if $IS_PARTNER_BAC\n assert_equal(total_field_count, 9)\n else\n assert_equal(total_field_count, 8)\n end\n end", "def application_fee_without_tax\n application_fee * (1 - tax_rate / 100)\n end", "def calculate(policy, mrg)\n case policy\n when 'Flexible'\n base_price * mrg\n when 'Fixed'\n base_price + mrg\n when 'Prestige'\n base_price + mrg\n end\n end", "def calc_potential_income_elec(val1= chp_salable_elec, val2= elec_price)\n\t\t(val1 * val2).round 2\n\tend", "def amount\n available_amount - blocked_amount\n end", "def calculate_trial_debt\n\n\t\tsales_tax = self.country.sales_tax\n\t\tday_number = Time.now.day\n \tmonth_number = Time.now.month\n \tmonth_days = Time.now.days_in_month\n\n\t\tdebt_proportion = (month_days - day_number + 1).to_f/month_days.to_f\n\n\t\t#debt = self.plan.plan_countries.find_by(country_id: self.country.id).price.to_f * debt_proportion * ( 1 + sales_tax)\n\t\tdebt = self.company_plan_setting.base_price * self.computed_multiplier * debt_proportion * (1 + sales_tax)\n\n\t\treturn debt\n\n\tend", "def estimated_charges\n @os_cloudwatch.estimated_charges\n end", "def estimate(down_payment, annual_income, options={})\n down_payment = down_payment.gsub(',', '').strip\n annual_income = annual_income.gsub(',', '').strip\n hash = self.calculate_affordability(down_payment, 0, annualincome: annual_income)\n return unless hash && hash['affordabilityAmount']\n rounded = hash['affordabilityAmount'].to_i.round(-4) # round to nearist 10k\n rounded < 10000 ? 10000 : rounded\n end", "def payment_amount\n params['asking_price'] = params['asking_price'].to_f\n params['down_payment'] = params['down_payment'].to_f\n params['amortization_period'] = params['amortization_period'].to_f\n\n insurance_cost = calculate_insurance_amount(params)\n payment_amount = calculate_payment_amount(params, insurance_cost, @@interest_rate)\n json_response(amount: payment_amount)\n end", "def seller_amount\n val = @invoice.seller.is_business? ? true : nil\n amt = @invoice.amount - CalcTotal::get_convenience_fee(sales_price, pixan_id, val) rescue @invoice.amount\n amt.round(2) rescue 0.0\n end", "def unit_cost_price\n self[:cost_price] || unit_price - application_fee\n end", "def pending_amount\n @calculator.pending_amount\n end", "def profit\n \tself.bid - self.payout\n end", "def total_payment_amount\n sum = 0.00\n unless self.insurance_payment_eobs.blank?\n self.insurance_payment_eobs.each do |eob|\n (sum = sum + eob.total_amount_paid_for_claim) unless eob.total_amount_paid_for_claim.nil?\n end\n end\n sum\n end", "def amount_available\n # puts \"------------ A boo at InvoiceAllocations -------------------------\"\n # InvoiceAllocation.all.each { |ia|\n # puts \"id: #{ia.id} cf0925_id: #{ia.cf0925_id} invoice_id: #{ia.invoice_id} cf0925_type: #{ia.cf0925_type} amount: #{ia.amount}\"\n #\n # }\n # puts \"-------------------------------------------------------------------\"\n res = requested_amount - cf0925\n .invoice_allocations\n .select { |ia| ia.cf0925_type == cf0925_type && ia.amount }\n .sum(&:amount)\n # puts \"!!!!!invoice_allocation.rb:#{__LINE__} - amount_available: #{res} cf0925.id #{cf0925.id} amount: #{amount}\"\n # puts \"invoice_allocation.id: #{id}\"\n # puts \"-------------------------------------------------------------------\"\n # puts \"This: id: #{id} cf0925_id: #{cf0925_id} invoice_id: #{invoice_id} cf0925_type: #{cf0925_type} amount: #{amount}\"\n # puts \"-------------------------------------------------------------------\"\n # puts cf0925.invoice_allocations.inspect\n # puts \"-------------------------------------------------------------------\"\n # partb = cf0925\n # .invoice_allocations\n # .select { |ia| ia.cf0925_type == cf0925_type && ia.amount }\n # .sum(&:amount)\n #\n # puts \"requested_amount: #{requested_amount} partb: #{partb}\"\n # puts \"-------------------------------------------------------------------\"\n # cf0925.invoice_allocations.each { |ia|\n # yeah = false\n # if (ia.cf0925_type == cf0925_type && amount)\n # yeah = true\n # end\n # yeah1 = false\n # if (ia.cf0925_type == cf0925_type)\n # yeah1 = true\n # end\n # yeah2 = false\n # if (amount)\n # yeah2 = true\n # end\n # puts \"Line #{__LINE__}: amount: #{ia.amount} cf0925_type #{cf0925_type} true?: #{yeah} part1?: #{yeah1} part2?: #{yeah2} class: #{amount.class}\"\n #\n # }\n # puts \"-------------------------------------------------------------------\"\n res\n end", "def assistance_fee\n ROADSIDE_ASSISSTANCE_FEE_PER_DAY * duration\n end", "def fees\n raise Sibit::NotSupportedError, 'Btc.com doesn\\'t provide recommended fees'\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 update_fee\n\t\tmoney_info = money_info()\n\t\t@fee = money_info['Trade_Fee'] / 100.0\n\tend", "def feature_adjustment\n total = 0\n self.contract_features.each do |f|\n if f.feature.amount\n total += f.feature.amount\n end\n end\n return total\n end", "def total_insured_fees\n services.select{|i| i[:btype] && i[:btype] < CASH_BILLING}.sum{|s| s[:fee]} rescue 0\n end", "def calc_spec_tax(_amount)\n _amountret = _amount.to_f * @_taxpr\n return _amountret\n end", "def get_amount(*params); raise('Stub or mock required.') end", "def claim_payment_amount(*options)\n @eob.amount('total_amount_paid_for_claim')\n end", "def ot_voucher_amount\n end" ]
[ "0.6326531", "0.6326295", "0.6258577", "0.6238494", "0.61906135", "0.61848503", "0.61620903", "0.6155133", "0.6148863", "0.6096127", "0.6091699", "0.60597026", "0.6053281", "0.6047944", "0.6047944", "0.60253364", "0.6011668", "0.59706074", "0.596953", "0.59604234", "0.59509504", "0.595012", "0.59263605", "0.59260565", "0.5911448", "0.5896098", "0.5896098", "0.5888442", "0.588396", "0.5865375", "0.58528084", "0.583984", "0.58383536", "0.5833018", "0.58326167", "0.58310556", "0.58218426", "0.5817844", "0.5817596", "0.580635", "0.5786064", "0.5779285", "0.57786584", "0.5769125", "0.57659775", "0.57574683", "0.5748329", "0.5738333", "0.57326865", "0.57307327", "0.57214206", "0.5709913", "0.5709913", "0.5709377", "0.5707603", "0.57068735", "0.57050925", "0.5698649", "0.56926876", "0.5692365", "0.5690911", "0.5679028", "0.56714773", "0.5670473", "0.5664824", "0.5663373", "0.5662171", "0.56607956", "0.5657708", "0.56574184", "0.5646347", "0.56438696", "0.56356615", "0.5633797", "0.56318593", "0.5629851", "0.5625828", "0.5618382", "0.56128204", "0.5601285", "0.5598144", "0.55949455", "0.55943835", "0.5589977", "0.558614", "0.5574774", "0.55722606", "0.557216", "0.5571629", "0.55681634", "0.55667704", "0.5561207", "0.5557175", "0.55522865", "0.55515915", "0.55504304", "0.55428743", "0.55387014", "0.5531967", "0.5529075" ]
0.6072137
11
HELPERS DRY: DO NOT REPEAT YOURSELF; WET == 'WE ENJOY TYPING' adhere to Single Responsibility Principle
def get_players game_hash[:away][:players] += game_hash[:home][:players] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_input; end", "def set_text_input(input); end", "def start_typing(data); end", "def start_typing(data); end", "def collect_and_validate_input(msg, type)\n input = prompt msg\n \n if valid?(input, type)\n return input.upcase\n else\n system(\"clear\")\n puts \"INVALID INPUT: Please try again\"\n input = collect_and_validate_input msg, type\n end\nend", "def get_user_input\n user_input_valid gets.chomp\n end", "def input(thing)\n print \"Enter #{thing}: \"\n gets.chomp\nend", "def query_user(user_prompt = 'Please enter a string: ', input_type = 'string')\n user_input = nil\n print user_prompt\n loop do\n user_input = gets.chomp\n case input_type\n when 'yesno'\n user_input = 'y' if user_input == 'Y' #give user some slack\n user_input = 'n' if user_input == 'N'\n return user_input if valid_yesno?(user_input)\n print \"Regrettably, a binary choice (\\'y\\' or \\'n\\') is required: \"\n when 'char'\n return user_input if valid_char?(user_input)\n print \"Sorry, single standard characters only. Please try again: \"\n when 'string'\n return user_input if valid_string?(user_input)\n print \"Sorry, standard keyboard characters only. \\nPlease try again: \"\n when 'int'\n return user_input.to_i if valid_int?(user_input)\n print 'Sorry, an integer is required. Try again: '\n when 'float'\n return user_input.to_f if valid_float?(user_input)\n print 'Sorry, a float is required. Try again: '\n else\n abort('Application Error: Improper input_type provided to query_user')\n end #case\n end #do\nend", "def begin_input\n\t\tinput = nil\n\t\tuntil input != nil\n\t\t\tinput = case gets.chomp.downcase\n\t\t\twhen \"hard\", \"h\" then :hard\n\t\t\twhen \"medium\", \"m\" then :medium\n\t\t\twhen \"mom\" then :mom\n\t\t\telse nil\n\t\t\tend\n\t\t\tputs \"That is not a valid input!\" if not input\n\t\tend\n\t\tinput\n\tend", "def ask_for_(thing)\n puts \"What's the #{thing}?\"\n gets.chomp\n end", "def get_user_input\n gets.strip\nend", "def validate_user_selection(input)\n VALID_CHOICES.each do |option, value|\n # test allows strings longer than valid keystrokes\n # requires start of input string is valid keystroke/strokes\n # strips leading or trailing spaces\n return option.to_s if input.downcase.strip.index(value.to_s) == 0\n end\n false\nend", "def get_user_input\n puts \"Please enter a search term\"\n gets.chomp\nend", "def user_input\n\tgets\nend", "def ask_name\n PROMPT.ask(\"Choose your name: \") do |q|\n q.required true\n q.modify :capitalize\n end\nend", "def prepare_input(prompt); end", "def take_user_word_input\r\n\t\t\t\t\t\t\t\t@input.gets.chomp.upcase\r\n\t\t\t\tend", "def determine_username\n\tputs \"What is your name?\"\n\tusername = gets.strip.to_s\nend", "def valid_input(str, type = \"string\")\r\n type.downcase!\r\n\r\n case type\r\n when \"string\"\r\n puts(\"Nothing inputted. Try again.\")\r\n input = gets.chomp\r\n while input.empty?\r\n puts(\"Nothing entered. Please try again.\")\r\n input = gets.chomp\r\n end\r\n return input\r\n when \"string-one-word\"\r\n puts(\"Invalid entry. Please try again\")\r\n input = gets.chomp\r\n while input.empty? || input.include?(\" \") || ((Integer(input) rescue \"invalid\") == input.to_i)\r\n if input.empty?\r\n puts(\"Nothing inputted. Try again.\")\r\n input = gets.chomp\r\n else\r\n puts(\"Entered more than one entry. Try again\")\r\n input = gets.chomp\r\n end\r\n end\r\n return input\r\n when \"integer-no-zero\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i == 0\r\n puts(\"Please enter an integer greater than 0.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n when \"integer-greater-zero\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i <= 0\r\n puts(\"Please enter an integer greater than 0.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n when \"integer\"\r\n puts(\"Incorrect type. Try again.\")\r\n input = gets.chomp\r\n while input.to_i == 0 && input != \"0\"\r\n puts(\"Please enter an integer.\")\r\n input = gets.chomp\r\n end\r\n input = input.to_i\r\n else\r\n false\r\n end\r\n\r\nend", "def search\n\tuser_search = gets.strip.downcase\n\tsearch_input(user_search)\nend", "def ask_for(detail)\n puts \"Enter #{detail}\"\n STDIN.gets.chomp \nend", "def get_user_input\n gets.chomp\nend", "def get_user_input\n gets.chomp\nend", "def get_valid_input(input_type, options = {})\n input = nil\n loop do\n input = gets.chomp\n # binding.pry\n if options.has_key?(:result) && input == \"\"\n input = options[:result]\n break\n else\n if input_type == \"num\"\n numeric?(input) || input.upcase == 'Q' ? break : say(\"Numbers only\")\n else\n %w(1 2 3 4 Q).include?(input.upcase) ? break : say(\"1, 2, 3, or 4 only\")\n end\n end\n end\n input\nend", "def get_name\n ask(\"give me a name to submit to local arena\") { |q|\n q.validate = /\\w+/\n }\nend", "def user_input_letter\n puts \"Type the first letter of the student names you want to see and press return.\".center(100)\n first_letter = STDIN.gets.chomp\nend", "def get_search_term\n puts \"Please enter a search term:\"\n gets.chomp\nend", "def getInput\r\n puts \"Your answer:\" \r\n answer = gets.downcase.strip #recieves user input into a variable and .downcase makes it all lower case\r\nend", "def get_input\n begin\n inp = gets.chomp\n raise Error unless %w{s h d}.include?(inp)\n rescue\n retry\n end\n inp\n end", "def get_input\n puts \"Please enter a search term(s)\"\n input = gets.chomp\n puts \"You've entered #{input}\"\n input\nend", "def ask_user_for(something)\n # Print question asking for the name, price, or something else\n puts \"What is the #{something.capitalize}?\"\n print \"> \"\n # return the user´s input\n return gets.chomp\n end", "def pt;z.gets 'Your choice:'; end", "def question\n puts \"What kind of maths would you like to do?\"\n @input = gets.chomp.downcase\nend", "def get_sport_choice(sports_reg_ex)\n print \"Please enter the full name of a sport you would like information about:\"\n # Converts input to match format how sports are stored\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n while !sports_reg_ex.has_key? sport\n sport_suggestion = auto_suggest sport, sports_reg_ex\n\n if sport_suggestion != \"\"\n if (yes_no_input \"Did you mean #{sport_suggestion}? (Y/N): \") == \"Y\"\n sport = sport_suggestion\n else\n list_sports sports_reg_ex if (yes_no_input \"Would you like to see the list of sports again?\") == \"Y\"\n print \"Please enter the full name of a sport you would like information about:\"\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n end\n else\n puts \"Couldn't identify a sport!\"\n list_sports sports_reg_ex if (yes_no_input \"Would you like to see the list of sports again?\") == \"Y\"\n print \"Please enter the full name of a sport you would like information about:\"\n sport = gets.chomp.gsub(/[A-Za-z']+/,&:capitalize)\n end\n end\n sport\nend", "def new_search\n puts \"Would you like to see other types of artists? If not, type 'exit' to exit or hit any key to see more careers.\"\n @input = gets.strip\n end", "def user_input\n user_input = gets.chomp\nend", "def input(type)\r\n print \"#{type}>\"\r\n gets.chomp\r\nend", "def user_input\n\tuser_selection = gets.strip.to_i\n\tinput_logic(user_selection)\nend", "def get_user_input(message)\n puts message\n gets.chomp\n end", "def user_input\n gets.chomp\nend", "def user_input\n gets.chomp\nend", "def ask_input\n\t\tputs \"where do you want to go ? N, S, W, E\"\n\t\tuser_input = gets.chomp\n\tend", "def username\n puts 'Please enter your full name and press ENTER:'\n gets.chomp\nend", "def get_input\n gets.strip #chomp was also used..\nend", "def get_search_term\n puts \"Enter a search term below:\"\n gets.chomp\nend", "def prompt(prompt_string, data_type = false, new_line = false)\n print \"#{prompt_string}#{\"\\n\" if new_line}\"\n input = gets\n if data_type\n data_type.downcase!\n input = case data_type\n when 'string'\n input.chomp\n when 'number'\n input.to_f\n when 'character'\n input.chr\n when 'symbol'\n input.chomp.to_sym\n end\n end\n input\nend", "def get_input(question)\n\t\tputs \"What's your #{question}?\"\n\t\tgets.chomp\nend", "def getinput(question, default = '')\n askuser = question + \" ('q' to quit)\"\n askuser << (!default.empty? ? \" [#{default}]: \" : \": \")\n puts askuser\n myui = gets.chomp\n if myui.casecmp('q').zero? then\n puts \"Okay, g'bye!\"\n exit\n end\n return myui\nend", "def get_user_input\n input = gets.chomp\n #input\nend", "def user_imput\n gets.chomp\n end", "def user_input\n input = gets.chomp\n end", "def input_name\n\tname = gets.chomp\nend", "def get_user_input_and_check(acceptable_input)\n input = gets.chomp.downcase\n\n if acceptable_input.include? input\n return input\n\n else\n puts \"This is not an acceptable input ('#{acceptable_input.join(\"', '\")}'), please try again:\"\n get_user_input_and_check(acceptable_input)\n\n end\n\nend", "def ask_user_for(something)\n puts \"What is the recipe #{something} ?\"\n return gets.chomp\n end", "def ask_twitterkeyword\r\n\tputs \"Tell me a keyowrd you would like to know more on twitter!\"\r\n\tgets.chomp.downcase\r\nend", "def get_input message\n\n puts message\n input = gets.chomp.downcase\n\nend", "def ask_input(text, color=nil, *args)\n self.ask(\"#{text}\", color, *args)\n end", "def prompt_user_song\n puts \"Please enter a song name or number:\"\nend", "def user_choice(input = nil)\n loop do\n input ||= gets.chomp.downcase\n break if %w[p i l].include?(input)\n puts \"invalid. (p)lay, (l)oad, or (i)nstructions\"\n input = nil\n end\n input\n end", "def question\n puts <<EOT\nEnter search, like : #{@defaultsearch} or just hit enter to start player! \nt search -> track search\nu search -> user search\nq -> exit! :)\nEOT\n search = STDIN.gets.strip\n if search.empty?\n @defaultsearch\n else\n search\n end\n end", "def get_character_from_user\n puts \" Please enter your name: \"\n gets.chomp.to_str\n puts \"\"\n end", "def get_user_input\n puts\n puts \"Type your question below or select from the following:\"\n puts\n puts \"1) Type Q to exit program\"\n puts\n puts \"2) Type P to print all answers\"\n puts\n puts \"3) Type R to reset answers to originals\"\n puts\n puts \"4) Type A to add your own answers to the originals\"\n puts\n question = gets.strip.to_s.downcase\n puts\n handle_user_input(question)\n end", "def instructor_or_student\n user_type = PROMPT.select(\"Are you a Student or Instructor?\", \n [\"Student\",\"Instructor\"])\nend", "def get_recipe_name_from_user\n puts \"\\nEnter a recipe name or ingredients you want to search by:\\n \".colorize(:green).bold\n find_by_name = gets.strip.downcase\n end", "def check_input(valid_inputs)\n input = \"\"\n loop do\n input = gets.chomp.upcase\n break if (valid_inputs).include?(input)\n puts \"Sorry. One more time:\"\n end\n return input\n end", "def get_user_input\n puts 'Welcome to Google Books Searcher'\n puts 'Enter a search term:'\n gets.chomp\nend", "def _whimsy_forms_input(**args)\n return unless args[:name]\n args[:label] ||= 'Enter string'\n args[:type] ||= 'text'\n args[:id] = args[:name]\n args[:aria_describedby] = \"#{args[:name]}_help\" if args[:helptext]\n _whimsy_control_wrapper(args) do\n args[:class] = 'form-control'\n if args[:rows]\n _textarea! type: args[:type], name: args[:name], id: args[:id], value: args[:value], class: args[:class], aria_describedby: args[:aria_describedby], rows: args[:rows] do\n _! args[:value]\n end\n else\n _input type: args[:type], name: args[:name], id: args[:id], value: args[:value], class: args[:class], aria_describedby: args[:aria_describedby]\n end\n end\n end", "def request_name\n\talias_store = {}\n\tspy_name = ''\n\tuntil spy_name == 'quit'\n\t\tp \"Please enter the name of the person who is NOT a spy ;) - otherwise type 'quit': \"\n\t\tspy_name = gets.chomp #returning user input\n\t\tif spy_name == 'quit'\n\t\t\tputs \"Thank you.\"\n\t\telsif spy_name == '' || !spy_name.strip.include?(\" \") || spy_name.count(\" \") > 1 || spy_name =~ /\\d/ #input validation\n\t\t\tputs \"Please enter a valid name\"\n\t\telse\n\t\t\tputs next_letter(swap_names(spy_name))\n\t\t\talias_store.store(spy_name, next_letter(swap_names(spy_name)))\t\t\t\t\t #storing hash key/values of input name, and return value from next_letter method\n\t\tend\n\tend\n\talias_store.each {|orig_name, spy_name| puts \"#{spy_name} is acutally #{orig_name}.\"} #storing names in hash t\nend", "def user_prompt\n print \"(or \\\"add\\\" or \\\"exit\\\"): \"\n user_input = gets.chomp.downcase\n return user_input\nend", "def get_input(message, choices)\n print(message)\n response = gets.chomp.downcase\n while response.length < 1 || !choices.include?(response[0])\n print(\"Invalid selection. \" + message)\n response = gets.chomp.downcase\n end\n return response[0]\nend", "def get_character_from_user\n puts \"Please enter a character:\"\n return gets.chomp.downcase\n\nend", "def put_in_user\n #setting variables\n name, cohort, city, hobby = placeholder\n #prompting the user for input and receiving it\n puts \"Hey there, type your name\".center(50)\n name = STDIN.gets.chomp\n\n puts \"Put your cohort\".center(50)\n cohort_input = STDIN.gets.chomp\n cohort = cohort_input.downcase\n\n puts \"Put your city\".center(50)\n city = STDIN.gets.chomp\n\n puts \"Put your hobby\".center(50)\n hobby = STDIN.gets.chomp\n\n validation_of_user_input(name, cohort, city, hobby)\n\nend", "def get_input\n input = gets\n return input\nend", "def get_input\n input = gets.chomp.to_str.downcase\n until valid_test(input)\n puts \"Please enter another word.\"\n input = gets.chomp.to_str.downcase\n end\n return input\nend", "def get_input(symbol)\r\n\tprint \"#{symbol} - \"\r\n\tinput = gets.chomp\r\n\tif symbol == \"name\" || symbol == \"theme\"\r\n\t\treturn input\r\n\telsif symbol == \"cats\" \r\n\t\tif input == \"y\"\r\n\t\t\treturn true\r\n\t\telse return false\r\n\t\tend\r\n\telse return input.to_i\r\n\tend\r\nend", "def ask(question)\n puts(question)\n answer = gets.chomp!\n answer.downcase\nend", "def welcome\n puts \"Welcome to the Star Wars Character Search!\"\n puts \"Are you searching for a movie or a character?\"\n\n input = gets.chomp.downcase\n\n if input == \"movie\" || input == \"character\"\n input\n else\n puts \"Sorry, please try again\"\n end\nend", "def get_hobby(name)\n\n puts \"Enter hobby for #{name}: -> hit return to skip\"\n\n hobby = gets.chomp\n\n if hobby.empty? then return \"N/A\" end\n\n # return whatever the user enters, no validation\n return hobby\nend", "def update_input\n # left key moves the cursor to the left\n if Input.repeat?(Input::LEFT)\n if Input.press?(Input::CTRL)\n self.cursor_move_left_word\n else\n self.cursor_move_left\n end\n return true\n end\n # right key moves the cursor to the left\n if Input.repeat?(Input::RIGHT)\n if Input.press?(Input::CTRL)\n self.cursor_move_right_word\n else\n self.cursor_move_right\n end\n return true\n end\n # home moves to the beginning\n if Input.trigger?(Input::Key['Home'])\n self.cursor_move_to_beginning\n return true\n end\n # end moves to the end\n if Input.trigger?(Input::Key['End'])\n self.cursor_move_to_end\n return true\n end\n # backspace deletes to the left\n if Input.repeat?(Input::Key['Backspace'])\n if Input.press?(Input::CTRL)\n self.delete_left_word\n else\n self.delete_left\n end\n return true\n end\n # backspace deletes to the right\n if Input.repeat?(Input::Key['Delete'])\n if Input.press?(Input::CTRL)\n self.delete_right_word\n else\n self.delete_right\n end\n return true\n end\n # get text\n text = Input.get_input_string\n # put text through input filter\n text.gsub!(@input_filter) {''}\n # if text is not empty\n if text != ''\n # insert it in the text\n self.insert(text)\n return true\n end\n return false\n end", "def prompt_user\n puts \"Type \\'h\\' to hit or \\'s\\' to stay\"\nend", "def get_cob(name)\n\n puts \"Enter country of birth for #{name}: -> hit return to skip\"\n\n cob = STDIN.gets.chomp\n\n if cob.empty? then return \"N/A\" end\n\n # return whatever the user enters, no validation\n return cob\n\nend", "def get_character_from_user\n puts \"Please enter a character\"\n character = gets.chomp.downcase\nend", "def asks_question(question)\n puts question\n gets.chomp\nend", "def get_user_item_if_valid(items_type, input_items)\n possible_item = gets.chomp.strip.gsub(/\\s+/, \" \")\n if possible_item.empty?\n puts \"Please provide a #{items_type}\"\n elsif input_items.any? { |item| item.casecmp?(possible_item) } # no duplicates\n puts \"Please provide a non-duplicate for #{items_type}\"\n else\n return possible_item\n end\nend", "def get_user_input(prompt, default)\n print(prompt)\n r = gets.chomp\n if r.length() > 0\n return r\n else\n return default\n end\nend", "def get_user_input(prompt)\n print \"#{prompt}: \"\n gets.chomp\nend", "def ask_first_name \n puts \"Quel est votre prénom ? \"\n name = gets.chomp\n return name\n end", "def valid_signup_form_input?(input, type)\n # reason to do this with not symbols or vv?\n # better to use =~ somehow?\n case type\n when :n, :s\n !input.match(/^[[:alpha:]\\- ]+$/)\n when :e\n !input.match(/^[\\w.]+@\\w+(\\.[[:alpha:]]+){1,2}$/) || User.exists?(email: input)\n when :u\n !input.match(/^\\w{5,15}$/) || User.exists?(username: input)\n when :p\n !input.match(/^(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])[\\w\\$!#&]{8,15}$/)\n else\n puts \"## wrong input type ##\"\n # how do this for the programmer?\n end\n end", "def get_input\n\t\tinput_given = gets.chomp\n\t\treturn nil if input_given == \"\"\n\t\tputs \"You entered '#{input_given}', are you happy with that? Y or N\"\n\t\tconfirmation = gets.chomp\n\t\twhile confirmation.upcase == 'N'\n\t\t\tputs \"Please re-enter\"\n\t\t\tinput_given = gets.chomp\n\t\t\tputs \"You entered '#{input_given}', are you happy with that? Y or N\"\n\t\t\tconfirmation = gets.chomp\n\t\tend\n\t\tinput_given\n\tend", "def choose_letter \n puts \"\\nPick your letter (X/O).\"\n print \"> \"\n letter = STDIN.gets.chomp.upcase\n\n\n if (letter != \"X\") && (letter != \"O\")\n puts \"\\nWrong character.\\nPlease press the \\\"X\\\" or \\\"O\\\" key\\non your keyboard.\\n\\n\\n\"\n letter = choose_letter\n end\n letter\nend", "def ask_for_user_input(msg=nil, opts={})\n print msg if msg\n print \": \"\n STDOUT.flush\n if opts[:password]\n system \"stty -echo\"\n result = STDIN.gets\n system \"stty echo\"\n puts\n else\n result = STDIN.gets\n end\n result.chomp\nend", "def user_input\n\t\tputs \"Please pick a letter to guess the word.\"\n\t\t@letter = gets.chomp.downcase\n\t\t@letters_array = [*?a..?z] #creates an array of the alphabet from a to z lowercase\n\t\tuser_input_check\n\tend", "def valid_input(input)\n valid = false\n parsed_input = downcase_camelcase_input(input)\n while valid == false\n #accepts uppercase or lowercase Y/N\n if parsed_input == \"Y\" || parsed_input ==\"N\"\n valid = true\n else\n puts \"\\nPlease enter Y or N:\\n\"\n print \"⚡️ \"\n input = gets.chomp.strip\n parsed_input = downcase_camelcase_input(input)\n end\n end\n parsed_input\n end", "def validate_item(input)\n case input\n when \"l\"\n return \"latte\"\n when \"s\"\n return \"scone\"\n when \"t\"\n return \"tea\"\n when \"d\"\n return \"done\"\n else\n return nil\n end\nend", "def validate_input input\r\n\t\t\t\t\t\t\tif @console\r\n\t\t (input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)) && (input.size < 2)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end", "def validate_input_last input\r\n\t\t if @console\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) || (check_enter input)\r\n\t\t else\r\n\t\t input.match(/\\A[[:alpha:][:blank:]]+\\z/) && !(check_enter input)\r\n\t\t end\r\n\t\t end", "def continue_prompt\n puts \"Do you wish to continue?\"\n response = gets.chomp\n response.downcase\nend", "def get_input\n gets.chomp\n end", "def name_of_person\n\tputs 'What is you name?'\n\ttheir_name = gets\nend", "def input_valid_username\n fill_in(USERNAME_INPUT_ID, :with => 'Believe')\n end", "def user_input\n puts \"Let's play rock, paper, scissors\"\n gets.chomp\nend" ]
[ "0.66188717", "0.6610209", "0.6604494", "0.6604494", "0.65815634", "0.65446305", "0.6416158", "0.64000434", "0.63606197", "0.6356474", "0.63379884", "0.632745", "0.6321558", "0.6312647", "0.6309214", "0.6287033", "0.6273473", "0.62026846", "0.6191361", "0.6176728", "0.61757004", "0.6174555", "0.6174555", "0.6172283", "0.6170888", "0.6149641", "0.613971", "0.6136514", "0.6118697", "0.6103674", "0.60840166", "0.60806036", "0.6072996", "0.60648084", "0.6064375", "0.60620296", "0.60575515", "0.6055045", "0.6051856", "0.6033642", "0.6033642", "0.6033065", "0.60327584", "0.5989976", "0.59866506", "0.5985408", "0.59847915", "0.59824836", "0.5973818", "0.5971182", "0.5964468", "0.5956926", "0.59543675", "0.59497863", "0.5949539", "0.59398454", "0.593716", "0.5935048", "0.59341216", "0.5931799", "0.59169436", "0.59125537", "0.59117454", "0.59097964", "0.59010714", "0.5898475", "0.58972293", "0.58971715", "0.58905435", "0.58903426", "0.58896124", "0.5882156", "0.58569354", "0.58538437", "0.5851344", "0.5850821", "0.58508086", "0.5849362", "0.58464193", "0.58420724", "0.58361447", "0.5834688", "0.5830562", "0.5824147", "0.58234024", "0.58217704", "0.5821543", "0.58204436", "0.58196425", "0.581764", "0.58174574", "0.5813892", "0.5812974", "0.5809071", "0.58028316", "0.5797606", "0.5795045", "0.57924384", "0.5788319", "0.5786984", "0.578677" ]
0.0
-1
^Takes in raw keystrokes to read Arrow Drectional Keys and the RETURN key for entry
def tab_carrot(l) "^" * l end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ctrl_l() send_keys(:ctrl_l) end", "def control_key_down\r\n command 'controlKeyDown'\r\n end", "def read_single_key\n c = read_char\n\n case c\n\n when \"\\r\"\n return \"RETURN\"\n when \"\\e\"\n return \"SAVE\"\n when \"\\e[A\"\n return \"w\"\n when \"\\e[B\"\n return \"s\"\n when \"\\e[C\"\n return \"d\"\n when \"\\e[D\"\n return \"a\"\n\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n else\n return \"SOMETHING ELSE: #{c.inspect}\"\n end\n end", "def show_single_key\n c = read_char\n\n case c\n when \" \"\n pickUpItem()\n when \"i\"\n showInventory\n when \"m\"\n showMap\n when \"v\"\n inspectSurroundings\n puts \"working\"\n when \"q\"\n system ('clear && printf \"\\e[3J\"') or system (\"cls\")\n exit 0\n when \"k\"\n gameOver\n when \"\\e[A\"\n move(c)\n when \"\\e[B\"\n move(c)\n when \"\\e[C\"\n move(c)\n when \"\\e[D\"\n move(c)\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n end\nend", "def alt_key_down\r\n command 'altKeyDown'\r\n end", "def pressKeyToContinue\n puts \"\\n-- press any key to continue --\"\n gets\nend", "def show_single_key\nc = read_char\ncase c\nwhen \" \"\nreturn \"SPACE\"\nwhen \"\\t\"\nreturn \"TAB\"\nwhen \"\\r\"\nreturn \"RETURN\"\nwhen \"\\n\"\nreturn \"LINE FEED\"\nwhen \"\\e\"\nreturn \"ESCAPE\"\nwhen \"\\e[A\"\nreturn \"UP ARROW\"\nwhen \"\\e[B\"\nreturn \"DOWN ARROW\"\nwhen \"\\e[C\"\nreturn \"RIGHT ARROW\"\nwhen \"\\e[D\"\nreturn \"LEFT ARROW\"\nwhen \"\\177\"\nreturn \"BACKSPACE\"\nwhen \"\\004\"\nreturn \"DELETE\"\nwhen \"\\e[3~\"\nreturn \"ALTERNATE DELETE\"\nwhen \"\\u0003\"\nreturn \"CONTROL-C\"\nexit 0\nwhen /^.$/\nreturn \"SINGLE CHAR HIT: #{c.inspect}\"\nelse\nreturn \"SOMETHING ELSE: #{c.inspect}\"\nend\nend", "def show_single_key\n c = read_char\n\n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts \"RETURN\"\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n when \"\\e[A\"\n puts \"UP ARROW\"\n when \"\\e[B\"\n puts \"DOWN ARROW\"\n when \"\\e[C\"\n puts \"RIGHT ARROW\"\n when \"\\e[D\"\n puts \"LEFT ARROW\"\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when /^.$/\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n end", "def show_single_key\n system(\"clear\")\n board.render\n\n c = read_char\n\n case c\n when \"\\e[A\"\n # puts \"UP ARROW\"\n board.selected_pos[0] -= 1 unless board.selected_pos[0] < 1\n when \"\\e[B\"\n board.selected_pos[0] += 1 unless board.selected_pos[0] > 7\n # puts \"DOWN ARROW\"\n when \"\\e[C\"\n board.selected_pos[1] += 1 unless board.selected_pos[1] > 7\n # puts \"RIGHT ARROW\"\n when \"\\e[D\"\n board.selected_pos[1] -= 1 unless board.selected_pos[1] < 1\n # puts \"LEFT ARROW\"\n when \"r\"\n make_move(board.selected_pos,\"r\")\n when \"f\"\n make_move(board.selected_pos,\"f\")\n when \"s\"\n save?\n end\n end", "def show_single_key\n c = read_char\n \n case c\n when \" \"\n puts \"SPACE\"\n when \"\\t\"\n puts \"TAB\"\n when \"\\r\"\n puts @cursor_pos\n when \"\\n\"\n puts \"LINE FEED\"\n when \"\\e\"\n puts \"ESCAPE\"\n \n\n when \"\\e[A\" ##up\n print \"\\033[1A\\033\"\n @cursor_pos[1] -= 1\n when \"\\e[B\" ##down\n print \"\\033[1B\\033\"\n @cursor_pos[1] += 1\n when \"\\e[C\" ##right\n print \"\\033[1C\\033\"\n @cursor_pos[0] += 1\n when \"\\e[D\" ##left\n print \"\\033[1D\\033\"\n @cursor_pos[0] -= 1\n \n\n when \"\\177\"\n puts \"BACKSPACE\"\n when \"\\004\"\n puts \"DELETE\"\n when \"\\e[3~\"\n puts \"ALTERNATE DELETE\"\n when \"\\u0003\"\n puts \"CONTROL-C\"\n exit 0\n when \"f\"\n puts \"flag\"\n puts \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n puts \"SOMETHING ELSE: #{c.inspect}\"\n end\n\n #p @cursor_pos\nend", "def onKeyDown( *args )\r\n capture = relay_event( :onKeyDown, args )\r\n relay_event( :onSetCursor, [] )\r\n capture\r\n end", "def press_any_key\n # TODO: Print footer.\n get_wch\n end", "def meta_key_down\r\n command 'metaKeyDown'\r\n end", "def key_press\n x = $stdin.getch\n x += handle_esc if x == \"\\e\"\n\n x\nend", "def alt_key_up\r\n command 'altKeyUp'\r\n end", "def ctrl_w() send_keys(:ctrl_w) end", "def bind_termcap_arrow_keys(map)\r\n xkeymap = @_rl_keymap\r\n @_rl_keymap = map\r\n\r\n rl_bind_keyseq_if_unbound(@_rl_term_ku, :rl_get_previous_history)\r\n rl_bind_keyseq_if_unbound(@_rl_term_kd, :rl_get_next_history)\r\n rl_bind_keyseq_if_unbound(@_rl_term_kr, :rl_forward_char)\r\n rl_bind_keyseq_if_unbound(@_rl_term_kl, :rl_backward_char)\r\n\r\n rl_bind_keyseq_if_unbound(@_rl_term_kh, :rl_beg_of_line) # Home\r\n rl_bind_keyseq_if_unbound(@_rl_term_at7, :rl_end_of_line) # End\r\n\r\n rl_bind_keyseq_if_unbound(@_rl_term_kD, :rl_delete)\r\n rl_bind_keyseq_if_unbound(@_rl_term_kI, :rl_overwrite_mode)\r\n\r\n @_rl_keymap = xkeymap\r\n end", "def handle_control_character(search, key)\n case key\n\n when KEY_CTRL_N then search.down\n when KEY_CTRL_P then search.up\n\n when KEY_CTRL_U then search.clear_query\n when KEY_CTRL_W then search.delete_word\n when KEY_CTRL_H, KEY_DELETE then search.backspace\n\n when ?\\r, KEY_CTRL_J, KEY_CTRL_M then search.done\n\n when KEY_CTRL_C then raise Abort\n\n else search\n end\n end", "def control_key_up\r\n command 'controlKeyUp'\r\n end", "def show_single_key\n c = read_char\n\n case c\n when \" \"\n RTermGame.println \"SPACE\"\n when \"\\t\"\n RTermGame.println \"TAB\"\n when \"\\r\"\n RTermGame.println \"RETURN\"\n when \"\\n\"\n RTermGame.println \"LINE FEED\"\n when \"\\e\"\n RTermGame.println \"ESCAPE\"\n when \"\\e[A\"\n RTermGame.println \"UP ARROW\"\n when \"\\e[B\"\n RTermGame.println \"DOWN ARROW\"\n when \"\\e[C\"\n RTermGame.println \"RIGHT ARROW\"\n when \"\\e[D\"\n RTermGame.println \"LEFT ARROW\"\n when \"\\177\"\n RTermGame.println \"BACKSPACE\"\n when \"\\004\"\n RTermGame.println \"DELETE\"\n when \"\\e[3~\"\n RTermGame.println \"ALTERNATE DELETE\"\n when \"\\u0003\"\n RTermGame.println \"CONTROL-C\"\n exit 0\n when /^.$/\n RTermGame.println \"SINGLE CHAR HIT: #{c.inspect}\"\n else\n RTermGame.println \"SOMETHING ELSE: #{c.inspect}\"\n end\nend", "def any_key\n puts \"\"\n puts \"Press any key to continue..\"\n STDIN.getch\n end", "def shift_key_down\r\n command 'shiftKeyDown'\r\n end", "def bind_arrow_keys_internal(map)\r\n xkeymap = @_rl_keymap\r\n @_rl_keymap = map\r\n\r\n if RUBY_PLATFORM =~ /mswin|mingw/\r\n rl_bind_keyseq_if_unbound(\"\\340H\", :rl_get_previous_history) # Up\r\n rl_bind_keyseq_if_unbound(\"\\340P\", :rl_get_next_history) # Down\r\n rl_bind_keyseq_if_unbound(\"\\340M\", :rl_forward_char) # Right\r\n rl_bind_keyseq_if_unbound(\"\\340K\", :rl_backward_char) # Left\r\n rl_bind_keyseq_if_unbound(\"\\340G\", :rl_beg_of_line) # Home\r\n rl_bind_keyseq_if_unbound(\"\\340O\", :rl_end_of_line) # End\r\n rl_bind_keyseq_if_unbound(\"\\340s\", :rl_backward_word) # Ctrl-Left\r\n rl_bind_keyseq_if_unbound(\"\\340t\", :rl_forward_word) # Ctrl-Right\r\n rl_bind_keyseq_if_unbound(\"\\340S\", :rl_delete) # Delete\r\n rl_bind_keyseq_if_unbound(\"\\340R\", :rl_overwrite_mode) # Insert\r\n else\r\n rl_bind_keyseq_if_unbound(\"\\033[A\", :rl_get_previous_history)\r\n rl_bind_keyseq_if_unbound(\"\\033[B\", :rl_get_next_history)\r\n rl_bind_keyseq_if_unbound(\"\\033[C\", :rl_forward_char)\r\n rl_bind_keyseq_if_unbound(\"\\033[D\", :rl_backward_char)\r\n rl_bind_keyseq_if_unbound(\"\\033[H\", :rl_beg_of_line)\r\n rl_bind_keyseq_if_unbound(\"\\033[F\", :rl_end_of_line)\r\n\r\n rl_bind_keyseq_if_unbound(\"\\033OA\", :rl_get_previous_history)\r\n rl_bind_keyseq_if_unbound(\"\\033OB\", :rl_get_next_history)\r\n rl_bind_keyseq_if_unbound(\"\\033OC\", :rl_forward_char)\r\n rl_bind_keyseq_if_unbound(\"\\033OD\", :rl_backward_char)\r\n rl_bind_keyseq_if_unbound(\"\\033OH\", :rl_beg_of_line)\r\n rl_bind_keyseq_if_unbound(\"\\033OF\", :rl_end_of_line)\r\n end\r\n\r\n @_rl_keymap = xkeymap\r\n end", "def pressKey\n STDIN.echo = false\n STDIN.raw!\n input = STDIN.getc.chr\n if input == \"\\e\" then\n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\nensure\n STDIN.echo = true\n STDIN.cooked!\n return input\nend", "def getchar\n @key_reader.getchar\n end", "def on_key_pressed(event)\n\n # Enter key\n if (event.keyval == Gdk::Keyval::GDK_Return)\n catch_text()\n\n # Backspace key\n elsif (event.keyval == Gdk::Keyval::GDK_BackSpace)\n iter = @buffer.end_iter\n if iter.offset == @@offset\n return true\n else\n return false\n end\n\n # Delete key\n elsif (event.keyval == Gdk::Keyval::GDK_Delete)\n iter = @buffer.end_iter\n if iter.offset == @@offset\n return true\n else\n return false\n end\n\n # Previous command\n elsif (event.keyval == Gdk::Keyval::GDK_Up)\n cmd = @historic.prev(current_line())\n replace(cmd)\n return true\n\n # Next command\n elsif (event.keyval == Gdk::Keyval::GDK_Down)\n cmd = @historic.next(current_line())\n replace(cmd)\n return true\n end\n\n end", "def keypress &block\n @keyblock = block\n end", "def on_key(ch)\n end", "def process_redio_keyboard_input(key)\n case key\n when :enter then @redio_loop = false\n when /\\d/ then print_redio(key.to_s)\n when :tab, :down, :left, :space then print_redio(@redio_res.succ)\n when :up, :right then print_redio(@redio_res.pred)\n end\n end", "def read_keypress(options = {})\n opts = { echo: false, raw: true }.merge(options)\n codes = unbufferred { get_codes(opts) }\n char = codes ? codes.pack('U*') : nil\n\n trigger_key_event(char) if char\n char\n end", "def read_line(*args)\n options = args.last.respond_to?(:to_hash) ? args.pop : {}\n prompt = args.empty? ? '' : args.pop\n opts = { echo: true, raw: true }.merge(options)\n line = Line.new('')\n ctrls = console.keys.keys.grep(/ctrl/)\n clear_line = \"\\e[2K\\e[1G\"\n\n while (codes = unbufferred { get_codes(opts) }) && (code = codes[0])\n char = codes.pack('U*')\n trigger_key_event(char)\n\n if console.keys[:backspace] == char || BACKSPACE == code\n next if line.start?\n line.left\n line.delete\n elsif console.keys[:delete] == char || DELETE == code\n line.delete\n elsif [console.keys[:ctrl_d],\n console.keys[:ctrl_z]].include?(char)\n break\n elsif ctrls.include?(console.keys.key(char))\n # skip\n elsif console.keys[:up] == char\n next unless history_previous?\n line.replace(history_previous)\n elsif console.keys[:down] == char\n line.replace(history_next? ? history_next : '')\n elsif console.keys[:left] == char\n line.left\n elsif console.keys[:right] == char\n line.right\n else\n if opts[:raw] && code == CARRIAGE_RETURN\n char = \"\\n\"\n line.move_to_end\n end\n line.insert(char)\n end\n\n if opts[:raw] && opts[:echo]\n output.print(clear_line)\n output.print(prompt + line.to_s)\n if char == \"\\n\"\n line.move_to_start\n elsif !line.end?\n output.print(\"\\e[#{line.size - line.cursor}D\")\n end\n end\n\n break if (code == CARRIAGE_RETURN || code == NEWLINE)\n\n if (console.keys[:backspace] == char || BACKSPACE == code) && opts[:echo]\n if opts[:raw]\n output.print(\"\\e[1X\") unless line.start?\n else\n output.print(?\\s + (line.start? ? '' : ?\\b))\n end\n end\n end\n add_to_history(line.to_s.rstrip) if track_history?\n line.to_s\n end", "def method_missing(sym, *args, &block)\n super if !args.empty? or block\n cmds = sym.to_s.split(\"_\")\n callsequence = \"\"\n cmds.each do |cmd|\n callsequence << case cmd.downcase\n when \"ctrl\" then \"^\"\n when \"shift\" then \"+\"\n when \"alt\" then \"!\"\n when \"win\" then \"#\"\n when \"enter\" then \"{ENTER}\"\n when \"return\" then \"{ENTER}\"\n when \"del\" then \"{DEL}\"\n else\n cmd\n end\n end\n send_keys(callsequence)\n end", "def on_char(evt)\n ch = evt.get_key_code\n mflag = evt.modifiers\n\n case ch\n when Wx::K_RIGHT : move_cursor_right(evt.shift_down)\n when Wx::K_LEFT : move_cursor_left(evt.shift_down)\n when Wx::K_DOWN : move_cursor_down(evt.shift_down)\n when Wx::K_UP : move_cursor_up(evt.shift_down)\n when Wx::K_BACK : on_key_back(evt)\n when Wx::K_DELETE : on_key_delete(evt)\n when Wx::K_TAB : on_key_tab(evt)\n when (mflag == Wx::MOD_CMD and ?a) # select all\n do_select_all\n when (mflag == Wx::MOD_CMD and ?c) # copy\n do_clipboard_copy\n when (mflag == Wx::MOD_CMD and ?x) # cut\n do_clipboard_cut\n when (mflag == Wx::MOD_CMD and ?v) # paste\n do_clipboard_paste\n when ((mflag == Wx::MOD_NONE or mflag == Wx::MOD_SHIFT) and 0x20..0x7e)\n if @cursor.area\n # redirect regular typing to on_char_AREANAME\n return self.send(\"on_char_#{AREAS[@cursor.area]}\", evt)\n end\n else # everything else is for dynamically handling key combo handlers\n m = []\n m << 'alt' if (mflag & Wx::MOD_ALT) != 0\n m << 'cmd' if (mflag & Wx::MOD_CMD) != 0\n m << 'shift' if (mflag & Wx::MOD_SHIFT) != 0\n mods = (m.empty?)? \"\" : \"_\" + m.join('_')\n\n ch = evt.get_key_code\n hex = ch.to_s(16).rjust(2,'0')\n meth=nil\n\n if (n=resolve_key_code(ch)) and respond_to?(\"on_key#{mods}_#{n}\")\n meth=\"on_key#{mods}_#{n}\"\n elsif respond_to?(\"on_key#{mods}_0x#{hex}\")\n meth=\"on_key#{mods}_#{hex}\"\n end\n\n if meth and ret=self.send(meth, evt)\n return ret\n else\n evt.skip()\n end\n end\n end", "def keystroke(character, *special_keys)\n special_keys = [\"command\"] if special_keys.length == 0\n special_keys_as_applescript_array = special_keys.map { |k|\n \"#{k} down\"\n }.join(\", \")\n execute_applescript(%Q'\n tell application \"System Events\"\n set frontApp to name of first item of (processes whose frontmost is true)\n tell application frontApp\n keystroke \"#{character}\" using {#{special_keys_as_applescript_array}}\n end\n end tell\n ')\n end", "def get_keyboard_input\n c = read_char\n\n case c\n # when \" \"\n # \"SPACE\"\n # when \"\\t\"\n # :query\n when \"\\r\"\n :error\n # when \"\\n\"\n # \"LINE FEED\"\n when \"\\e\"\n :abort\n # when \"\\e[A\"\n # \"UP ARROW\"\n # :error\n # when \"\\e[B\"\n # \"DOWN ARROW\"\n # :error\n when \"\\e[C\"\n \"RIGHT ARROW\"\n :right\n when \"\\e[D\"\n \"LEFT ARROW\"\n :left\n when \"\\177\"\n :backspace\n when \"\\004\"\n :delete\n when \"\\e[3~\"\n :delete\n # when \"\\u0003\"\n # \"CONTROL-C\"\n # exit 0\n when /^.$/\n c\n else\n :error\n end\n end", "def input\n keys = Vedeu::Input::Raw.read\n\n if click?(keys)\n Vedeu::Input::Mouse.click(keys)\n\n else\n keys\n\n end\n end", "def input\n if raw_mode?\n keys = console.getch\n if keys.ord == 27\n keys << console.read_nonblock(3) rescue nil\n keys << console.read_nonblock(2) rescue nil\n end\n keys\n\n else\n console.gets.chomp\n\n end\n end", "def on_arrows\n Document.on(\"keyup\") do |e|\n case e.which\n when 37 # left\n goto_link(\"prev\")\n when 39 # right\n goto_link(\"next\")\n else\n # puts \"something else pressed #{e.which}\"\n end\n end\n end", "def input\n loop do\n case STDIN.getch\n when 'a' then return :left\n when 'd' then return :right\n when 'q' then return :exit\n end\n end\n end", "def char_press\n begin\n system('stty raw -echo') # turn raw input on\n input = $stdin.getc if $stdin.ready?\n input.chr if input\n ensure\n system('stty -raw echo') # turn raw input off\n end\n end", "def map_key_to_move\n c = read_char\n step = @step\n step ||= 1\n case c\n when ' '\n puts 'SPACE'\n park\n when \"\\t\"\n puts 'TAB'\n :stop\n when \"\\r\"\n puts 'RETURN'\n :stop\n when \"\\n\"\n puts 'LINE FEED'\n :stop\n when \"\\e\"\n puts 'ESCAPE'\n :stop\n when \"\\e[A\", 'w'\n up step\n when \"\\e[B\", 's'\n down step\n when \"\\e[C\", 'd'\n right step\n when \"\\e[D\", 'a'\n left step\n when '+', 'r'\n forward step\n when '-', 'f'\n back step\n when 'q'\n gripper_on\n when 'e'\n gripper_off\n when ','\n gripper_close(5)\n when '.'\n gripper_open(5)\n when 'j'\n wrist_left\n when 'l'\n wrist_right\n when 'i'\n wrist_up\n when 'k'\n wrist_down\n when \"\\177\"\n log 'BACKSPACE', true\n :stop\n when \"\\004\"\n log 'DELETE', true\n :stop\n when \"\\e[3~\"\n log 'ALTERNATE DELETE', true\n :stop\n when \"\\u0003\"\n log 'CONTROL-C', true\n :stop\n when /^.$/\n log \"SINGLE CHAR HIT: #{c.inspect}\"\n :stop\n else\n log \"SOMETHING ELSE: #{c.inspect}\"\n :stop\n end\n end", "def process_key_press( typed_line )\n # retrieve typed character\n typed_character = get_character.chr\n # process backspace\n if typed_character == \"\\177\"\n putc \"\\b \\b\"\n typed_line.chop!\n return typed_line\n # ignore return\n elsif typed_character == \"\\r\"\n return typed_line\n end\n # append typed to current line character and write it out\n typed_line = typed_line + typed_character\n putc typed_character\n typed_line\n end", "def rl_read_key()\r\n @rl_key_sequence_length+=1\r\n\r\n if (@rl_pending_input!=0)\r\n c = @rl_pending_input\r\n rl_clear_pending_input()\r\n else\r\n # If the user has an event function, then call it periodically.\r\n if (@rl_event_hook)\r\n while (@rl_event_hook && (c=rl_get_char()).nil?)\r\n\r\n send(@rl_event_hook)\r\n if (@rl_done) # XXX - experimental\r\n return (\"\\n\")\r\n end\r\n if (rl_gather_tyi() < 0) # XXX - EIO\r\n @rl_done = true\r\n return (\"\\n\")\r\n end\r\n end\r\n\r\n else\r\n\r\n if (c=rl_get_char()).nil?\r\n c = send(@rl_getc_function,@rl_instream)\r\n end\r\n end\r\n end\r\n\r\n return (c)\r\n end", "def handle_key ch\n super\n end", "def keyctrl_d(*)\n @stop = true\n end", "def keypress\n $prompt.keypress(\"Press space or enter to continue\", keys: [:space, :return])\nend", "def bind_arrow_keys()\r\n bind_arrow_keys_internal(@emacs_standard_keymap)\r\n bind_arrow_keys_internal(@vi_movement_keymap)\r\n bind_arrow_keys_internal(@vi_insertion_keymap)\r\n end", "def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end", "def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end", "def getchar\n getch\n end", "def alpha_mapping\n {# 1st line\n Q: '__{ KeyCode::Q, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n W: \"__{ KeyCode::KEY_5, #{shift_opt}, KeyCode::MINUS, #{shift_opt}, #{left} }__\", # []\n E: \"__{ KeyCode::KEY_5, KeyCode::MINUS, #{left} }__\", # ()\n R: \"__{ KeyCode::KEY_5, #{opt}, KeyCode::MINUS, #{opt}, #{left} }__\", # {}\n T: \"__{ KeyCode::BACKQUOTE, KeyCode::BACKQUOTE, #{shift}, #{left} }__\", # <>\n Y: \"__{ KeyCode::KEY_1, #{shift} }__\", # 1\n U: \"__{ KeyCode::CURSOR_LEFT, #{cmd} }__\", # left\n I: '__{ KeyCode::CURSOR_UP }__', # up\n O: \"__{ KeyCode::CURSOR_RIGHT, #{cmd} }__\", # right\n P: nil,\n\n # 2nd line\n A: '__{ KeyCode::A, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n S: '__{ KeyCode::S, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n D: '__{ KeyCode::D, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n F: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # \"\",\n G: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # '',\n H: '__{ KeyCode::RawValue::0x97 }__', # nil, # 0, # ----- # todo: <- NC #'__{ KeyCode::M }__',\n J: '__{ KeyCode::CURSOR_LEFT }__', # LEFT\n K: '__{ KeyCode::CURSOR_DOWN }__', # DOWN\n L: '__{ KeyCode::CURSOR_RIGHT }__', # RIGHT\n QUOTE: '__{ KeyCode::RawValue::0x98 }__', # todo: -> NC\n\n # 3rd line\n Z: '__{ KeyCode::Z, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n X: '__{ KeyCode::X, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n C: '__{ KeyCode::C, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n V: '__{ KeyCode::V, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n B: '__{ KeyCode::B, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n N: '__{ KeyCode::N, ModifierFlag::COMMAND_L, ModifierFlag::OPTION_L, ModifierFlag::CONTROL_L }__', # hammer\n M: \"__{ KeyCode::CURSOR_LEFT, #{opt} }__\", # <- word\n COMMA: '__{ KeyCode::RawValue::0x96 }__', # down something\n DOT: \"__{ KeyCode::CURSOR_RIGHT, #{opt} }__\", # -> word\n # BACKQUOTE: 'BACKSLASH', Z: 'COMMA',\n\n KEY_2: \"__{ KeyCode::L, #{shift_opt}, KeyCode::L, #{shift_opt}, #{left} }__\", # ||\n KEY_3: \"__{ KeyCode::KEY_3, KeyCode::KEY_3, #{left} }__\", # '', # -----\n KEY_4: \"__{ KeyCode::KEY_4, KeyCode::KEY_4, #{left} }__\", # \"\", # -----\n KEY_5: \"__{ KeyCode::BACKSLASH, KeyCode::BACKSLASH, #{left} }__\", # ``,\n KEY_7: nil,\n KEY_8: '__{ KeyCode::RawValue::0x95 }__',\n KEY_9: nil\n }.with_indifferent_access\n end", "def any_key\n puts \"\\n\\n Press any key to go back to the main menu\"\n $stdin.getch\n clear\nend", "def key(k, x, y)\n case k\n when 27 # Escape\n exit\n end\n GLUT.PostRedisplay()\n end", "def normal(keys = \"\")\n server.remote_send(\"<C-\\\\><C-n>#{keys}\")\n self\n end", "def handle_key ch\n if ch == 32\n toggle\n else\n super\n end\n end", "def getch\n\n end", "def read\n @window.getch\n end", "def pressToContinue\n puts \"\\n\"\n print \"Press enter to continue. \"\n gets.chomp\n end", "def enter_to_continue\r\n @prompt.keypress('Press space or enter to continue', keys: %i[space return])\r\n end", "def key_pressed\n if STDIN.ready?\n input = STDIN.read_nonblock(1) rescue nil\n if input == \"\\e\" \n input << STDIN.read_nonblock(3) rescue nil\n input << STDIN.read_nonblock(2) rescue nil\n end\n end\n # STDIN.cooked!\n input\n\nend", "def getch\n return nil if eos?\n\n do_scan(/./u, true, true, true)\n end", "def next_line\n prompt = TTY::Prompt.new\n prompt.keypress\n # puts \" \\r\"\n end", "def handle_key(ch)\n @current_index ||= 0\n # added 2009-01-18 22:44 no point moving horiz or passing up to Field if not edit\n if !@editable\n if ch == KEY_LEFT or ch == KEY_RIGHT\n return :UNHANDLED\n end\n end\n case ch\n #when KEY_UP # show previous value\n # previous_row\n #when KEY_DOWN # show previous value\n # next_row\n # adding spacebar to popup combo, as in microemacs 2010-10-01 13:21 \n when 32, KEY_DOWN+ RubyCurses::META_KEY # alt down\n popup # pop up the popup\n else\n super\n end\n end", "def shift_key_up\r\n command 'shiftKeyUp'\r\n end", "def handle_key(ch)\n @current_index ||= 0\n # added 2009-01-18 22:44 no point moving horiz or passing up to Field if not edit\n if !@editable\n if ch == KEY_LEFT or ch == KEY_RIGHT\n return :UNHANDLED\n end\n end\n case @arrow_key_policy \n when :ignore\n if ch == KEY_DOWN or ch == KEY_UP\n return :UNHANDLED\n end\n when :popup\n if ch == KEY_DOWN or ch == KEY_UP\n popup\n end\n end\n case ch\n #when KEY_UP # show previous value\n # previous_row\n #when KEY_DOWN # show previous value\n # next_row\n # adding spacebar to popup combo, as in microemacs 2010-10-01 13:21 \n when 32, KEY_DOWN+ META_KEY # alt down\n popup # pop up the popup\n else\n super\n end\n end", "def getchar \n while 1 \n ch = getch\n #$log.debug \"window getchar() GOT: #{ch}\" if ch != -1\n if ch == -1\n # the returns escape 27 if no key followed it, so its SLOW if you want only esc\n if @stack.first == 27\n #$log.debug \" -1 stack sizze #{@stack.size}: #{@stack.inspect}, ch #{ch}\"\n case @stack.size\n when 1\n @stack.clear\n return 27\n when 2 # basically a ALT-O, this will be really slow since it waits for -1\n ch = 128 + @stack.last\n @stack.clear\n return ch\n when 3\n $log.debug \" SHOULD NOT COME HERE getchar()\"\n end\n end\n @stack.clear\n next\n end\n # this is the ALT combination\n if @stack.first == 27\n # experimental. 2 escapes in quick succession to make exit faster\n if ch == 27\n @stack.clear\n return ch\n end\n # possible F1..F3 on xterm-color\n if ch == 79 or ch == 91\n #$log.debug \" got 27, #{ch}, waiting for one more\"\n @stack << ch\n next\n end\n #$log.debug \"stack SIZE #{@stack.size}, #{@stack.inspect}, ch: #{ch}\"\n if @stack == [27,79]\n # xterm-color\n case ch\n when 80\n ch = KEY_F1\n when 81\n ch = KEY_F2\n when 82\n ch = KEY_F3\n when 83\n ch = KEY_F4\n end\n @stack.clear\n return ch\n elsif @stack == [27, 91]\n if ch == 90\n @stack.clear\n return KEY_BTAB # backtab\n end\n end\n # the usual Meta combos. (alt)\n ch = 128 + ch\n @stack.clear\n return ch\n end\n # append a 27 to stack, actually one can use a flag too\n if ch == 27\n @stack << 27\n next\n end\n return ch\n end\n end", "def getchar \n while true \n ch = getch\n #$log.debug \"window getchar() GOT: #{ch}\" if ch != -1\n if ch == -1\n # the returns escape 27 if no key followed it, so its SLOW if you want only esc\n if @stack.first == 27\n #$log.debug \" -1 stack sizze #{@stack.size}: #{@stack.inspect}, ch #{ch}\"\n case @stack.size\n when 1\n @stack.clear\n return 27\n when 2 # basically a ALT-O, this will be really slow since it waits for -1\n ch = 128 + @stack.last\n @stack.clear\n return ch\n when 3\n $log.debug \" SHOULD NOT COME HERE getchar()\"\n end\n end\n @stack.clear\n next\n end\n # this is the ALT combination\n if @stack.first == 27\n # experimental. 2 escapes in quick succession to make exit faster\n if ch == 27\n @stack.clear\n return ch\n end\n # possible F1..F3 on xterm-color\n if ch == 79 or ch == 91\n #$log.debug \" got 27, #{ch}, waiting for one more\"\n @stack << ch\n next\n end\n #$log.debug \"stack SIZE #{@stack.size}, #{@stack.inspect}, ch: #{ch}\"\n if @stack == [27,79]\n # xterm-color\n case ch\n when 80\n ch = KEY_F1\n when 81\n ch = KEY_F2\n when 82\n ch = KEY_F3\n when 83\n ch = KEY_F4\n end\n @stack.clear\n return ch\n elsif @stack == [27, 91]\n if ch == 90\n @stack.clear\n return 353 # backtab\n end\n end\n # the usual Meta combos. (alt)\n ch = 128 + ch\n @stack.clear\n return ch\n end\n # append a 27 to stack, actually one can use a flag too\n if ch == 27\n @stack << 27\n next\n end\n return ch\n end\n end", "def press(key_sequence)\n end", "def get_char\n system('stty raw -echo 2>/dev/null') # turn raw input on\n c = nil\n # if $stdin.ready?\n c = $stdin.getc\n cn = c.ord\n return 'ENTER' if cn == 10 || cn == 13\n return 'BACKSPACE' if cn == 127\n return 'C-SPACE' if cn == 0\n return 'SPACE' if cn == 32\n # next does not seem to work, you need to bind C-i\n return 'TAB' if cn == 8\n\n if cn >= 0 && cn < 27\n x = cn + 96\n return \"C-#{x.chr}\"\n end\n if c == '\u001b'\n buff = c.chr\n loop do\n k = nil\n if $stdin.ready?\n k = $stdin.getc\n # puts \"got #{k}\"\n buff += k.chr\n else\n x = @kh[buff]\n return x if x\n\n # puts \"returning with #{buff}\"\n if buff.size == 2\n ## possibly a meta/alt char\n k = buff[-1]\n return \"M-#{k.chr}\"\n end\n return buff\n end\n end\n end\n # end\n return c.chr if c\nensure\n # system('stty -raw echo 2>/dev/null') # turn raw input on\n # 2019-03-29 - echo was causing printing of arrow key code on screen\n # if moving fast\n system('stty -raw 2>/dev/null') # turn raw input on\nend", "def enter_to_continue\n puts \"\\n\"\n puts \"\\t\\t--------Press Enter to Continue------\"\n continue = gets\n end", "def activateKey _args\n \"activateKey _args;\" \n end", "def rekey!; end", "def rekey!; end", "def escape\n puts \"\"\n puts Rainbow(\"Press anything to return\").blue\n STDIN.getch\nend", "def key_bindings\n super\n @root.bind('u', proc {@board.rotate_clockwise\n @board.rotate_clockwise})\n @root.bind('c', proc {@board.call_cheat})\n end", "def move_for_keypress(keypress); nil; end", "def read\n if click?(keypress)\n Vedeu.trigger(:_mouse_event_, keypress)\n\n elsif reader.raw_mode?\n Vedeu.trigger(:_keypress_, keypress)\n\n elsif reader.fake_mode?\n name = Vedeu.focus\n interface = Vedeu.interfaces.by_name(name)\n key = keypress\n\n if Vedeu::Input::Mapper.registered?(key, name)\n Vedeu.trigger(:_keypress_, key, name)\n\n elsif interface.editable?\n Vedeu.trigger(:_editor_, key)\n\n else\n Vedeu.trigger(:key, key)\n\n end\n else\n Vedeu.trigger(:_command_, command)\n\n end\n end", "def rl_stuff_char(key)\r\n return 0 if (ibuffer_space() == 0)\r\n\r\n if (key == EOF)\r\n key = NEWLINE\r\n @rl_pending_input = EOF\r\n rl_setstate(RL_STATE_INPUTPENDING)\r\n end\r\n @ibuffer[@push_index] = key\r\n @push_index += 1\r\n if (@push_index >= @ibuffer_len)\r\n @push_index = 0\r\n end\r\n\r\n return 1\r\n end", "def key_press *args\n\t\t\tevent(:key_press, *args)\n\t\tend", "def process_key(key)\n case KeyHelper.key_symbol(key)\n when :up\n @past_menu = @cur_menu\n @cur_menu = (@cur_menu - 1) % @items.size\n when :down\n @past_menu = @cur_menu\n @cur_menu = (@cur_menu + 1) % @items.size\n when :enter\n # Erase body after call\n @past_menu = nil\n term.echo\n return :break, @items[@cur_menu].menu\n end\n\n return if key[0] != Ncurses::OK\n @items.each_with_index do |item, i|\n next unless key[2] =~ item.shortcut_regex\n @past_menu = @cur_menu\n @cur_menu = i\n end\n end", "def meta_key_up\r\n command 'metaKeyUp'\r\n end", "def send_keys_separately(*keyboard_keys)\n command('let &undolevels=&undolevels')\n keyboard_keys.map { |key| send_keys(key, split_undo_entry: false) }\n end", "def getch\n map_key(key_press)\n end", "def update_other_commands\n return unless active && cursor_movable?\n shift_left if Input.repeat?(:LEFT)\n shift_right if Input.repeat?(:RIGHT)\n #shift_left(true) if Input.repeat?(:L)\n #shift_right(true) if Input.repeat?(:R)\n action if Input.trigger?(:C) && enable?(item)\n end", "def restore_cursor; puts \"\\e[u\" end", "def handle_character\n char = characters.get_next\n return interupt if char.is?(:ctrl_c)\n return cancel if char.is?(:escape)\n return go_up if char.is?(:up)\n return go_down if char.is?(:down)\n return enter if char.is?(:enter)\n return right if char.is?(:right)\n return left if char.is?(:left)\n return right if char.is?(:option_right)\n return left if char.is?(:option_left)\n\n\n if editor\n editor.auto_complete_input = char\n cancel\n end\n end", "def map_keys\n return if @keys_mapped\n bind_key(KEY_F1, 'help') { hm = help_manager(); hm.display_help }\n bind_keys([?\\M-?,?\\?], 'show field help') { \n #if get_current_field.help_text \n #textdialog(get_current_field.help_text, 'title' => 'Help Text', :bgcolor => 'green', :color => :white) \n #else\n print_key_bindings\n #end\n }\n bind_key(FFI::NCurses::KEY_F9, \"Print keys\", :print_key_bindings) # show bindings, tentative on F9\n bind_key(?\\M-:, 'show menu') {\n fld = get_current_field\n am = fld.action_manager()\n #fld.init_menu\n am.show_actions\n }\n @keys_mapped = true\n end", "def getch\n scan(/./m)\n end", "def read_char &block\n STDIN.noecho do\n # as long as the block doen't return falsy,\n # read the user input key and sned it to the block\n while block.( IOHelper.get_char )\n end\n end\n end", "def handle_key ch\n case ch\n when KEY_DOWN\n # form will not do a next_field, it will ignore this\n return :NO_NEXT_FIELD\n when KEY_RIGHT\n @form.select_next_field\n when KEY_LEFT\n @form.select_prev_field\n when KEY_ENTER, 10, 13, 32 # added space bar also\n if respond_to? :fire\n fire\n end\n else\n # all thrse will be re-evaluated by form\n return :UNHANDLED\n end\n end", "def receive_input\n input = ''\n controls = %w(a s d w)\n until controls.include?(input)\n input = STDIN.getch\n abort 'escaped' if input == \"\\e\"\n end\n input\n end", "def source\n puts '------------------------------------------------'.colorize(:light_blue)\n puts 'Input keys? [y/n]'.colorize(:light_blue)\n puts '------------------------------------------------'.colorize(:light_blue)\n $stdin.gets.chomp == 'y' ? source_keys : all_keys\n end", "def press key, options = {}\n key = 'Return' if key == 'ENTER'\n widget = options[:in] || Gtk::Window.toplevels.first\n event = Gdk::EventKey.new(Gdk::Event::KEY_PRESS)\n event.window = widget\n event.state |= Gdk::Window::CONTROL_MASK if key =~ /CTRL+/\n event.state |= Gdk::Window::MOD1_MASK if key =~ /ALT+/\n event.state |= Gdk::Window::SHIFT_MASK if key =~ /SHIFT+/\n event.keyval = Gdk::Keyval.from_name(key.split('+').last)\n widget.grab_focus\n event.send_event = true\n entry = Gdk::Keymap.default.get_entries_for_keyval(event.keyval).first\n event.hardware_keycode = entry[0]\n widget.signal_emit('key_press_event', event)\n process_events\nend", "def readkey\n system('stty raw -echo') # => Raw mode, no echo\n c = (STDIN.read_nonblock(1).ord rescue nil)\n system('stty -raw echo') # => Reset terminal mode\n c\nend", "def key_down key\n @keys.push key\n end", "def prompt\n\tputs \"Any Key to continue\"\n\tgets\nend", "def key_pressed( event )\n @keys += [event.key]\n end", "def hold_screen\n print 'Press Enter to continue.'\n gets.chomp\n end", "def on_char_ascii(evt)\n @hexbyte_started=false\n ch = evt.get_key_code\n pos = self.cur_pos\n\n return if (pos > @data.size)\n\n if (idx = gui_set_value(pos, ch.chr)) != pos\n move_to_idx(idx, 1)\n else\n move_cursor_right()\n end\n @selection=nil\n end", "def read_char()\n STDIN.getch()\nend", "def get_char\n begin\n # save previous state of stty\n old_state = `stty -g`\n # disable echoing and enable raw (not having to press enter)\n system 'stty raw -echo'\n char = STDIN.getc.chr\n # gather next two characters of special keys\n if char == \"\\e\"\n char << STDIN.read_nonblock(3) rescue nil\n char << STDIN.read_nonblock(2) rescue nil\n end\n\n # restore previous state of stty\n system \"stty #{old_state}\"\n end\n\n key = IOChar.char_to_key(char)\n\n if key == 'ctrl-c' or key == 'ctrl-d'\n raise Interrupt\n end\n\n char\n end" ]
[ "0.6991457", "0.6985522", "0.69753957", "0.67441577", "0.67225677", "0.67162484", "0.6692415", "0.6681015", "0.66220427", "0.66190857", "0.65800613", "0.65413874", "0.6534051", "0.6529701", "0.6469654", "0.6448625", "0.64306074", "0.6424091", "0.6414777", "0.6399707", "0.6377013", "0.6365456", "0.63618517", "0.6349862", "0.633836", "0.6301983", "0.6289095", "0.6274953", "0.6236328", "0.6232296", "0.6195133", "0.616566", "0.6146937", "0.6102272", "0.6084982", "0.60677487", "0.60630953", "0.6058522", "0.60579365", "0.6055209", "0.6038971", "0.6027365", "0.6027121", "0.60184914", "0.6005144", "0.60032934", "0.6002523", "0.59994334", "0.59994334", "0.59913635", "0.59843385", "0.5981863", "0.59749055", "0.5970951", "0.59641224", "0.59556013", "0.593952", "0.5913083", "0.59044033", "0.5892058", "0.5888175", "0.5886281", "0.5870932", "0.5865687", "0.5850313", "0.58136725", "0.58115846", "0.58115554", "0.5811192", "0.57991993", "0.57719237", "0.574817", "0.574817", "0.57462656", "0.57402635", "0.5739942", "0.5721929", "0.5721153", "0.571146", "0.5708376", "0.570234", "0.5701135", "0.5699146", "0.5696103", "0.56959933", "0.56949884", "0.5684202", "0.56814754", "0.5680245", "0.5670349", "0.5669403", "0.5669323", "0.56593966", "0.56516075", "0.56442964", "0.5637638", "0.5635675", "0.5607609", "0.5606137", "0.55940527", "0.5585632" ]
0.0
-1
Searchs by collection_id not item ID
def show @item = Item.all.where(collection_id: params[:id]) render :json => @item end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items_by_id_collection(collection)\n FinderClass.match_by_data(@items.all, collection, :id)\n end", "def invoice_items_by_id_collection(collection)\n FinderClass.match_by_data(@invoice_items.all, collection, :id)\n end", "def find_item_in_collection(collection:, item:)\n collection.find(item)\n end", "def find_in_collection(id)\n collection.find_by_id(id)\n end", "def search_for_item\n search_service.fetch(params[:solr_document_id])\n end", "def find(id, collection)\n collection.find(id)\n end", "def find_collection\n @collection = Collection.find(params[:id])\n end", "def in_collection(collection_id)\n query_with_cursor(\"select place.in_collection('#{escape_quotes(collection_id)}', 'place_cursor')\")\n end", "def invoices_by_id_collection(collection)\n FinderClass.match_by_data(@invoices.all, collection, :id)\n end", "def find_in_collection(_id)\n raise(NotImplementedError, '#find_in_collection must be defined in the TypicalSituation implementation.')\n end", "def index\n @item_collections = ItemCollection.where('is_private=false')\n if !params[:search].nil? || params[:search] == ''\n t = ItemCollection.arel_table\n @item_collections = ItemCollection.where(t[:name].matches(\"%#{params[:search]}%\").and(t[:is_private].eq(false)))\n #@item_collections = ItemCollection.where('name LIKE ? AND is_private=false', \"%#{params[:search]}%\")\n end\n end", "def set_item_collection\n @item_collection = ItemCollection.find(params[:id])\n end", "def find_item_by_name_in_collection(name, collection)\n collection.each{|items|\n if items[:item] === name\n return items \n end}\n nil\nend", "def search_for_item\n search_service.fetch(params[:id], { fl: ['visibility_ssi'] })\n end", "def places(collection_id)\n PublicEarth::Db::Place.find_from_search(*(PublicEarth::Db::Place.many.in_collection(collection_id).map { |result| result['in_collection'] }))\n end", "def collection\n # needed for the list view\n @parent_object = parent_object if parent?\n \n feature_id=nil\n if params[:feature_id]\n feature_id = params[:feature_id]\n elsif params[:id]\n feature_id = object.feature_id\n end\n search_results = FeatureName.search(params[:filter])\n search_results = search_results.where(:feature_id => feature_id) if feature_id\n @collection = search_results.page(params[:page])\n end", "def find_collections_for_form\n Hyrax::CollectionsService.new(self).search_results(:edit)\n end", "def search(user, query, collection, wiki)\n end", "def find(id)\n fail(ArgumentError, \"Missing id/slug\") unless id\n id = OAuth::Helper.escape(id)\n result = access_token.get(\"#{API_BASE}/collection/#{id}\")\n fail(ArgumentError, \"Bad request\") unless result.code == \"200\"\n\n Collection.new(result.body)\n end", "def find_collection(title)\n collection_id = ActiveFedora::SolrService.query(\"primary_title_ssi:\\\"#{title}\\\"\", {fq: \"has_model_ssim:Collection\", fl: \"id\"})\n\n (collection_id.count > 0) ? Collection.find(collection_id.first[\"id\"]) : nil\n end", "def index\n # No authorize! call here to filter viewable items in the list.\n # We're assuming if you can view the index, you can see all published and\n # unpublished collections.\n\n\n # NOTE WELL: To use ransack, all attributes we want ransack to search or sort\n # on NEED TO be listed in Colletion.ransackable_attributes and/or Collection.ransackable_associations\n @q = Collection.ransack(params[:q]).tap do |ransack|\n ransack.sorts = 'title asc' if ransack.sorts.empty?\n end\n\n scope = @q.result\n if params[:title_or_id].present?\n scope = scope.where(id: params[:title_or_id]\n ).or(\n Collection.where(friendlier_id: params[:title_or_id])\n ).or(\n Collection.where(\"title ilike ?\", \"%\" + Collection.sanitize_sql_like(params[:title_or_id]) + \"%\")\n )\n end\n\n if params[:department].present?\n scope = scope.where(\"json_attributes ->> 'department' = :department\", department: params[:department])\n @department = params[:department]\n end\n\n @collections = scope.page(params[:page]).per(100)\n end", "def search_collection!\n return if search_fields.blank?\n\n query = params[:globalSearch]\n search_resource = ApiSearchResource.new(\n fields: search_fields\n )\n self.collection = search_resource.search!(collection, query)\n end", "def find(collection, *key)\n command(collection).get(key)\n end", "def find_item_by_name_in_collection(name, collection)\n index = 0 \n while index < collection.length do\n if collection[index][:item] == name\n return collection[index]\n end\n index += 1\n end\n nil\nend", "def find_item_by_name_in_collection(name, collection)\n i = 0\n while i < collection.length do\n item_hash = collection[i]\n item_hash[:item] == name ? (return item_hash) : nil\n i += 1\n end\nend", "def searchcollections\n @collections = Collection.select{ |collection| collection.name.include?(params[:term]) }\n render json: @collections, status: 200\n\n end", "def get_search_query\n {\n '_id' => \"#{resource[:name]}\"\n }\n end", "def collection\n feature_id = nil\n if params[:feature_id]\n feature_id = params[:feature_id]\n elsif params[:id]\n feature_id = object.feature_id\n end\n if params[:filter].blank? && !feature_id.blank?\n search_results = parent_object.definitions\n elsif !params[:filter].blank?\n search_results = Definition.search(params[:filter])\n search_results = search_results.where(:feature_id => feature_id) if feature_id\n else\n search_results = []\n end\n @collection = search_results.empty? ? search_results : search_results.page(params[:page])\n end", "def find_from!(collection, identifier, find_by = :id)\n if identifier.present?\n collection.detect { |instance| instance.send(find_by) == identifier.to_i } || (raise ActiveRecord::RecordNotFound)\n else\n raise ActiveRecord::RecordNotFound\n end\n end", "def set_item\n @inventory = collection.find(params[:id])\n end", "def find_item_by_name_in_collection(name, collection)\n count = 0 \n while count < collection.length\n if collection[count][:item] == name\n return collection[count]\n end\n count += 1 \n end\n nil\nend", "def find(id)\n @collection[id.to_s]\n end", "def get_collection(collection)\n filter_params = params[:filter] ? params[:filter].permit(self.class::DEFAULT_FIELDS) : {}\n if params[:filter].present? && filter_params.empty?\n render 'shared/http_status', locals: { code: '422', message:\n 'Invalid or malformed parameter values' }, status: :unprocessable_entity\n false\n else\n collection.order('id').where(filter_params)\n end\n end", "def find item\n\tend", "def add_collected_query\n return if options[:collection_ids].present? || !collected?\n body.must(:query_string, \"collections.id\" => \"*\")\n end", "def find_item_by_name_in_collection(name, collection)\n counter = 0\n while counter < collection.length #which it is 3\n #collection[counter] #collection[0] then collection[1] then collection [2] then collection[3] which will end the loop\n #now we are looking for this specific item in our collection. \n if collection[counter][:item] == name\n return collection[counter]\n end\n counter += 1\n end\n #nil -to ensure nil is return if item is not in the collection\nend", "def merchants_by_id_collection(collection)\n FinderClass.match_by_data(@merchants.all, collection, :id)\n end", "def search_by_id(id)\n @data.each do |item|\n return item if item.id == id\n end\n\n nil\n end", "def search_for_item\n Rails.logger.warn(\"starting search for item for #{request.headers['X-Origin-URI']}\")\n child_oid = request.headers['X-Origin-URI'].gsub(/^\\/iiif\\/2\\/(\\d+)\\/.*/, '\\1')\n # search_state[:q] = { child_oids_ssim: child_oid }\n search_state[:rows] = 1\n search_service_class.new(config: blacklight_config, search_state: search_state, user_params: search_state.to_h, **search_service_context)\n r, d = search_service.search_results do |builder|\n builder.where(child_oids_ssim: [child_oid])\n builder.processor_chain.delete(:filter_by_visibility)\n builder\n end\n [r, d.first]\n end", "def search\n @search ||= exhibit.searches.first\n # @searches ||= exhibit.searches.published.where(slug: item_ids).sort do |a, b|\n # order.index(a.slug) <=> order.index(b.slug)\n # end\n end", "def find_item\n @item = Item.new(query_service.find_by(id: params[:id]).symbolize_keys)\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def index\n if params[:search_item]\n @supplies = Supply.search_by_title(params[:search_item]).paginate(:page => params[:page]).per_page(10)\n else\n @supplies = Supply.order(\"id DESC\").paginate(:page => params[:page]).per_page(10) \n end\n end", "def index_query_results\n query = find_or_create_query(:CollectionNumber, by: params[:by])\n show_selected_collection_numbers(query, id: params[:id].to_s,\n always_index: true)\n end", "def set_collection\n @collection = Collection.friendly.find(params[:id])\n end", "def set_collection\n @collection = Collection.friendly.find params[:id]\n end", "def podio_helper_find_item_by_expa_id(expa_id)\n attributes = {:sort_by => 'last_edit_on'}\n attributes[:filters] = {117786190 => {'from'=>expa_id,'to'=>expa_id}}\n\n response = Podio.connection.post do |req|\n req.url '/item/app/15290822/filter/'\n req.body = attributes\n end\n Podio::Item.collection(response.body).first\n end", "def find_matching(collection, name)\n item = collection.find do |single|\n single.id == name ||\n single.name == name ||\n (name.is_a?(Regexp) && name =~ single.name)\n end\n\n # If it is not present in collection, it might be a non-standard image/flavor\n if item.nil? && !name.is_a?(Regexp)\n item = collection.get escape_name_if_necessary(name)\n end\n\n item\n end", "def filter(collection)\n collection\n end", "def filter(collection)\n collection\n end", "def index\n if params[:search]\n @items = Item.where('name LIKE ? OR category LIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n # session[:conversations] ||= []\n # @conversations = Conversation.all.where(id: @items.ids)\n # @conversations = Conversation.includes(:recipient, :messages).find(session[:conversations])\n else\n @items = Item.all\n end \n\n end", "def get_item_name_by_id(collection, item)\n\t\tselected = collection.detect { |i| i[1] == item }\n\n\t\tif selected\n\t\t\tselected[0]\n\t\telse\n\t\t\t''\n\t\tend\n\tend", "def collection\n @collection = NoteTitle.search(params[:filter]).page(params[:page])\n end", "def get(id)\n collection.find_one({\n Crocoduck::Store.id_field => id.to_i\n })\n end", "def user_edit_item\n @item = Item.find_by_id(params[:id])\n @disable_auction_flag = true\n @categories = Category.all\n @item_categories = ItemCategory.find_all_by_item_id(@item.id)\n @category_ids = @item_categories.collect{|c| c.category_id}\n if(!@category_ids) then @category_ids=[] end\n @search = Item.search(params[:search])\n @keyword = params[:search]\n end", "def index\n @category = params[:category_search]\n @keyword = params[:keyword_search]\n\n @items = Item\n if !@category.nil? && @category.length.positive?\n @items = @items.where(category_id: @category.to_i)\n end\n\n if !@keyword.nil? && @keyword.length.positive?\n @items = @items.where('LOWER(items.title) LIKE :keyword OR LOWER(items.description) LIKE :keyword', { keyword: \"%#{@keyword.downcase}%\" })\n end\n\n @items = @items.includes(:category).paginate(per_page: 20, page: params[:page])\n end", "def query_items(items)\n query = params[:query].downcase.split(' ').join('%')\n query = ActiveRecord::Base.sanitize(\"%#{query}%\")\n items.where(search_query(query))\n end", "def search\n if params[:collection_ids]\n data = {:sites => [], :clusters => []}\n params[:collection_ids].each do |id|\n result = search_by_collection id, params\n data[:sites].concat result[:sites] if result[:sites]\n data[:clusters].concat result[:clusters] if result[:clusters]\n end\n render json: data\n else\n render json: []\n end\n end", "def collection \n @search = Redirect.search(params[:search])\n\n #set order by to default or form result\n @search.order ||= \"descend_by_updated_at\"\n\n #set results per page to default or form result\n @collection_count = @search.count\n @collection = @search.paginate(:per_page => Spree::Config[:admin_products_per_page],\n :page => params[:page])\n end", "def set_collection\n @collection = user_collections.detect{ |c| c.id.to_s == params[:id] }\n end", "def search\n if params[:search].present?\n # This is for the elastic search\n #@bid_items = BidItem.search(params[:search])\n\n # Those are Ruby SQL queries\n # This is to search item_name\n #@bid_items = BidItem.where(:item_name => params[:search])\n # This is to search price larger than\n @bid_items = BidItem.where(\"starting_price > ?\", params[:search])\n else\n @bid_items = BidItem.order(\"id DESC\").limit(30)\n end\n end", "def place_in_source_collection(source_id, place_id, start = 0, limit = 25)\n source_id = clean_for_search(as_id(source_id))\n place_id = clean_for_search(as_id(place_id))\n \n results = PublicEarth::Db::Collection.search_for(\"place_id:#{place_id} && created_by_id:#{source_id}\", \n :qt => 'standard', :start => start && start.to_i, :rows => limit && limit.to_i > 0 && limit.to_i || 25)\n results.models\n end", "def collection_results_link(inst, coll)\n facet_params = search_state.add_facet_params_and_redirect(\n 'collection_titles_sms', coll.display_name\n )\n facet_params['f']['provenance_facet'] = [inst]\n search_action_path facet_params\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def set_collection\n @collection = Collection.find(params[:id])\n end", "def find_matching(collection, name, primary_key = :id)\n # Handle identity - so you can pass object, object_name\n return name if collection.include? name\n collection.each do |single|\n # It's usually id, but are other possibilities like device\n if single.respond_to? primary_key\n return single if single.send(primary_key) == name\n end\n if single.respond_to? :name\n return single if single.name == name\n return single if name.is_a?(Regexp) && name =~ single.name\n end\n end\n\n nil\n end", "def collection_by_title(title)\n return self.root_collection.subcollection_by_title(title)\n end", "def find_collections_for_form\n query = list_search_builder.with(q: '').query\n response = repository.search(query)\n response.documents\n end", "def find_or_new_collection(primary_id, title)\n collection_found = Collection.where(identifier_ssi: primary_id).last\n return collection_found if collection_found\n Collection.new(\n identifier: primary_id,\n title: title,\n depositor: job_owner,\n collection_type_gid: Tenejo::CsvImporter.default_collection_type.gid\n )\n end", "def index\n if params[:searchKeyword].present?\n @items = Item.where(\"category_id = ? and name LIKE ?\", params[:categoryId] ,\"%#{params[:searchKeyword]}%\", ).uniq\n else\n @items = Item.where(category_id: params[:categoryId])\n end\n end", "def find_from_search(*ids)\n unless ids.blank?\n results = {}\n ids.flatten.dice(20).each do |set|\n query = (set.map { |id| \"(id:\\\"#{id}\\\")\" }).join(' || ')\n search_results = search_for(query, :qt => 'standard', :rows => set.length)\n search_results.models.each do |result|\n results[result.id] = result\n end\n end\n ids.flatten.map { |id| results[id] }\n else\n []\n end\n end", "def containing(place_id, start = 0, limit = 25)\n place_id = clean_for_search(as_id(place_id))\n results = PublicEarth::Db::Collection.search_for(\"place_id:#{place_id}\", :qt => 'standard', \n :start => start && start.to_i, :rows => limit && limit.to_i > 0 && limit.to_i || 25)\n results.models\n end", "def find_collection model = controller_model\n parent = find_first_parent\n collection = parent ? parent.send(type_of(model)) : model\n collection = collection.with_permissions_to(:show)\n collection = collection.limit(offset_amount).offset(params[:offset].to_i)\n \n if params[:order].present? && match = valid_order_column?(model, params[:order])\n \n @collection_ordered_table = match[:table]\n \n # No need to sanitize sql query because it is validated against\n # valid_order_column? which ensures valid format, table name, column\n # name, and direction. Sort by whether the ordered column is NULL or ''\n # to put all meaningful rows at the top.\n collection = collection.reorder(\n \"(#{match[:table]}.#{match[:column]} IS NULL OR\" +\n \" #{match[:table]}.#{match[:column]} = '') asc, #{params[:order]}\"\n )\n end\n \n \n \n if params[:search].present? && collection.respond_to?(:search)\n collection = collection.search(params[:search])\n end\n \n collection\n end", "def find_by_id!(id)\n found = entities.detect { |elm| elm.id == id }\n raise Occi::Core::Errors::CollectionLookupError, \"Entity #{id.inspect} not found in the collection\" unless found\n found\n end", "def find_from_search(*ids)\n unless ids.blank?\n results = {}\n ids.flatten.dice(20).each do |set|\n query = (set.map { |id| \"(id:\\\"#{id}\\\")\" }).join(' || ')\n search_results = search_for(query, :qt => 'standard', :rows => set.length)\n search_results.models.each do |result|\n results[result.id] = result\n end\n end\n ids.flatten.map { |id| results[id] }.compact\n else\n []\n end\n end", "def collection_products\n CollectionProduct.joins(:collection).where(:\"collections.firm_id\" => @firm.id)\n end", "def from_search(document)\n collection = new\n collection.attributes[:id] = document['id']\n collection.attributes[:name] = document['name']\n collection.attributes[:slug] = document['slug']\n collection.attributes[:icon] = document['icon']\n collection.attributes[:description] = document['description']\n collection.attributes[:created_at] = document['created_at']\n collection.attributes[:updated_at] = document['updated_at']\n collection.attributes[:created_by_id] = document['created_by_id']\n \n collection.attributes[:what] = PublicEarth::Db::CollectionExt::QueryManager::What.new(document['what'])\n\n # Legacy compatibility\n collection.places = PublicEarth::Db::Place.find_from_search(*document['place_id']) if document['what'].blank?\n \n collection\n end", "def search_items\n @resources = current_company.items.search_for(params[:name]).limit(10)\n @resources = Admin::InventoryItemDecorator.decorate(@resources)\n end", "def find\n\t\tif defined?(@collection)\n\t\t\treturn @collection.find\n \tend\n\tend", "def findAndFetchDocuments(collection, query)\n return collection.find(query)\n end", "def index_collection_number\n query = find_or_create_query(:CollectionNumber, by: params[:by])\n show_selected_collection_numbers(query, id: params[:id].to_s,\n always_index: true)\n end", "def id\n @collection.id\n end", "def filter_collection_facet_for_access(solr_parameters)\n return if current_ability.admin?\n\n collection_ids = Hyrax::Collections::PermissionsService.collection_ids_for_view(ability: current_ability).map { |id| \"^#{id}$\" }\n solr_parameters['f.member_of_collection_ids_ssim.facet.matches'] = if collection_ids.present?\n collection_ids.join('|')\n else\n \"^$\"\n end\n end", "def get_collection\n @book_series = BookSeries.find(params[:book_series_id])\n @collection = @book_series.collections.find(params[:collection_id])\n @book_series_1 = BookSeries.first\n end", "def find_item_by_id(id)\n\n @items.each do |item|\n return item if item.item_id == id\n end\n return nil\n end", "def search_request_by_id(id)\n @search_requests[id]\n end", "def set_collection\n @collection = User.find(current_user.id).collections.find(params[:id])\n end", "def set_collection\n @collection = Collection.find_by_friendlier_id!(params[:id])\n end", "def [](key)\n key = key.to_s unless key.is_a? String\n puts \"SEARCHING for key '#{key}' in doc '#{@id}'\"\n cursor = @collection.find_one( { plgid: @id } )\n if cursor\n return cursor[key]\n end\n nil\n end", "def member_collections\n Collection.where(community_id: id)\n end", "def search\n @results = Cookbook.search(\n params.fetch(:q, nil)\n ).offset(@start).limit(@items)\n end", "def find(collection_name, id)\n collection = eval(\"@#{collection_name}\")\n unless collection.nil?\n position = collection.index { |c| c.id == id }\n return position ? collection[position] : 'Undefined'\n end\n \"Undefined collection named #{collection_name}\"\n end", "def search\n @collections, @total_count = Admin::Collection.search(params[:search], params[:pagination], params[:sorting])\n\n render json: { collections: @collections, totalCount: @total_count }\n end", "def query(&blk)\n @adapter.query(collection, self, &blk)\n end", "def collection\n instance_variable_get(collection_name) || set_collection(find_collection)\n end", "def get_collection_id()\r\n return @coll_id\r\n end" ]
[ "0.7667439", "0.7332168", "0.7266454", "0.7150835", "0.669353", "0.6650188", "0.6621962", "0.65737414", "0.6531809", "0.65317297", "0.6478626", "0.64216155", "0.62852824", "0.62078995", "0.61886036", "0.6167842", "0.60767937", "0.60709524", "0.60289854", "0.59846294", "0.597666", "0.5976634", "0.59715897", "0.5924332", "0.59169674", "0.59157133", "0.59087753", "0.5905463", "0.58888155", "0.5863527", "0.58503723", "0.5833146", "0.5815969", "0.5808324", "0.579354", "0.57879597", "0.5768708", "0.57517713", "0.57384944", "0.5736333", "0.5730914", "0.5730278", "0.5730278", "0.5730278", "0.57219434", "0.5717574", "0.57036656", "0.5685091", "0.5666887", "0.5666382", "0.5664553", "0.5664553", "0.5657306", "0.56490934", "0.5646449", "0.56347454", "0.5615779", "0.561376", "0.56112534", "0.5597673", "0.55890834", "0.55890155", "0.5586484", "0.5583729", "0.55780333", "0.5559838", "0.5559838", "0.5559838", "0.5559838", "0.55540705", "0.5552379", "0.5545907", "0.55413353", "0.5540145", "0.55392575", "0.5531071", "0.55277795", "0.5525291", "0.5516494", "0.5513809", "0.5503282", "0.5499615", "0.5499554", "0.5496796", "0.54916507", "0.54864395", "0.5483081", "0.5482289", "0.5480062", "0.5474901", "0.54710305", "0.54663414", "0.54635525", "0.5461645", "0.5452079", "0.544818", "0.54470843", "0.5446884", "0.5432864", "0.5426057" ]
0.6005691
19
additive inverse of each. Each positive becomes negatives, and the negatives become positives.
def invert(list) for i in 0..list.length-1 list[i] *= -1 unless list[i] == 0 end list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse_all!(collection)\r\n collection.each do |point|\r\n inverse!(point)\r\n end\r\n collection\r\n end", "def invert() end", "def inverse_all(collection)\r\n newcollection = collection.dup.clear\r\n collection.each do |point|\r\n newcollection << inverse(point)\r\n end\r\n newcollection\r\n end", "def inverse; end", "def inverse; end", "def inverse\n end", "def invert; end", "def invert\n end", "def invert!\n @cards.values.each {|c| c.invert! }\n end", "def inverse()\n map_hash{|k,v|[k,1/v] if v > 0}.to_p\n end", "def inversed; end", "def inverse!\n inverse self\n end", "def invert(lst)\n lst.map { |l| l * -1 }\nend", "def inverse(start=0)\n start = 0 if [true, false].include?(start) and start\n self.transpose(-1, true).transpose(start+1)\n end", "def opposite(x)\n x * -1\nend", "def inverse!\r\n conjugate!\r\n scale!(1.0/norm)\r\n end", "def positive_and_negative_numbers\n collection.flat_map{|num| [num.abs, num.abs * -1]}\n end", "def inverse\n\t\t\treturn self.dup.inverse!\n\t\tend", "def inverse\n Negation.new(self)\n end", "def inverse_vector(a, vector)\n inverse = a.dup\n (0...vector.size).each do |i|\n inverse[vector[i]] = i unless vector[i].nil?\n end\n inverse\n end", "def inverted; invert = true; self; end", "def inversed_sum\n 1.0 / sum\n end", "def inverse!\n\t\t\tsmag = self.sqr\n\t\t\t@elem = [\n\t\t\t\t-@elem[0] / smag,\n\t\t\t\t-@elem[1] / smag,\n\t\t\t\t-@elem[2] / smag,\n\t\t\t\t @elem[3] / smag\n\t\t\t]\n\t\tend", "def add_inversions\n @cards.values.each {|c| add_card c.invert }\n end", "def inverse_of; end", "def invert\n approximate_steps = [] # get list of approximate steps\n @degrees.each_cons(2){|a,b| approximate_steps << (b.to_i - a.to_i)}\n adjustments = [] # get list of adjustments (ie. '+' if the step is an augmented interval, '++' if the step is double augmented etc.)\n @degrees.each_cons(2) do |a,b|\n adjustments << case a\n when /#/\n case b\n when /#/\n ''\n when /b/\n a.to_i > b.to_i ? '++' : '--'\n else\n a.to_i > b.to_i ? '+' : '-'\n end\n when /b/\n case b\n when /#/\n a.to_i > b.to_i ? '--' : '++'\n when /b/\n ''\n else\n a.to_i > b.to_i ? '-' : '+'\n end\n else\n case b\n when /#/\n a.to_i > b.to_i ? '-' : '+'\n when /b/\n a.to_i > b.to_i ? '+' : '-'\n else\n ''\n end\n end\n end\n adjusted_steps = [] # invert approximate steps and add adjustments\n approximate_steps.size.times do |i|\n if md = adjustments[i].match(/--|\\+\\+/)\n md[0] == '--' ? approximate_steps[i] -= 1 : approximate_steps[i] += 1\n adjustments[i] = ''\n end\n adjusted_steps[i] = (-1 * approximate_steps[i]).to_s + adjustments[i]\n end\n # construct new Motive object from inverted steps\n new_degrees = [@degrees[0]]\n adjusted_steps.each do |s|\n next_degree = apply_adjusted_step(new_degrees.last, s)\n new_degrees << next_degree\n end\n Scails::Motive.new(new_degrees)\n end", "def opposite num\n -num\n end", "def positiveopposite(a)\n # create hashtable that will store the array of opposite values\n hTable = Hash.new \n for i in 0..a.size-1 do\n if hTable[a[i].abs] == nil then\n hTable[a[i].abs] = [a[i]]\n end\n\n case\n when a[i] < 0\n # insert negative if there exists a positive number in first position of the array\n # if the hashtable already has a negative number, do nothing\n if hTable[a[i].abs][0] > a[i] then \n hTable[a[i].abs].insert(0,a[i])\n end\n when a[i] > 0\n # insert positive number if the array has only the first negative opposite element\n if (hTable[a[i].abs][0] < 0) and (hTable[a[i].abs].size == 1) then \n hTable[a[i].abs].push(a[i])\n end\n end\n end\n # p hTable\n aResult = []\n hTable.each { |key, value| \n if (value.size == 2) then\n aResult.push(value)\n end\n }\n return aResult\n end", "def opposite(number)\r\n return number * (-1)\r\nend", "def invert\n clone.invert!\n end", "def inverse(other = nil)\n candidates = inverses(other)\n candidates.detect { |c| c } if candidates\n end", "def invert!(alpha = false); end", "def opposite(number)\n number*-1\nend", "def map_to_negativize(array)\n final_array = []\n counter = 0 \n while counter < array.size do \n final_array.push(array[counter] * -1)\n counter += 1\n end\n final_array\nend", "def invert(list)\n list.map(&:-@)\nend", "def inverse\n inverse_powers = {}\n powers.each{ |u,p| inverse_powers[u] = -p }\n PhysicalQuantity.new(1.0/@quantity, inverse_powers)\n end", "def -@\n self.map{|x| -x}\n end", "def inverse\r\n quaternion.inverse!\r\n end", "def invert\n OrderedExpression.new(@expression, !@descending, :nulls=>INVERT_NULLS.fetch(@nulls, @nulls))\n end", "def flip_sign\n self * -1\n end", "def inv(&block)\n block = ->(x) {true} if !block_given?\n list = invertir(@cabeza, &block)\n list.pop\n return nil if list.total == 0\n list\n end", "def inverse(x, operator)\n if x.num?\n x = x.to_numeric\n if operator == :+\n _(- x)\n else\n _(Rational(1, x))\n end\n elsif x.is_a?(Inverse) && x.operator == operator\n x.x\n else\n Inverse.new(x, operator)\n end\n end", "def negate!\n negate self\n end", "def opposite(num)\n if num < 0\n return num.abs\n else num >= 0\n return num * -1 end\nend", "def negate!\n @negated = @negated ? false : true\n end", "def -@\n return map {|currency, money| -money}\n end", "def inverse\n @commands.reverse.map { |name, args|\n method = :\"invert_#{name}\"\n raise IrreversibleMigration unless respond_to?(method, true)\n send(method, args)\n }\n end", "def -@\n return self.invert\n end", "def -@\n return self.invert\n end", "def opposite(number)\n return 0 - number\nend", "def inverse_sum\n sum = 0\n self.sport_odds.each do |odd|\n sum = sum + odd.inverse_ratio\n end\n return sum\n end", "def inversed=(_arg0); end", "def inverse_fft(vec)\n # The conjugate of a complex number works like this:\n # a + bi => b + ai\n # This is the modification we perform to invert\n # the FFT\n nv = vec.map(&:conjugate)\n # Do the actual FFT\n applied = fft_recurse(nv)\n # Now we re-conjugate\n # The inverse FFT actually multiplies each coefficient by the number\n # of coefficients, so we divide that out here to be accurate.\n applied.map!(&:conjugate)\n .map!{|x| x / applied.size}\n end", "def -@\n CAS.invert(self)\n end", "def pinv_left\n (transpose * self).inv * transpose\n end", "def inv!\n @numer, @denom = @denom, @numer\n self\n end", "def invert(num) \n puts -num \nend", "def reverse_each(elective_array)\n elective_array.each do |i|\n i.reverse!\n end\n return elective_array\nend", "def invert\n\tUnits.new(@units.inject({}) {|h,(k,v)| h[k] = -v; h })\n end", "def map_to_negativize(array)\n new_array = array.map{|n| n*-1}\n return new_array\nend", "def ~\n BooleanExpression.invert(self)\n end", "def map_to_negativize(source_array)\n new_array = []\n negativize = 0 \n i = 0\n while i < source_array.length do \n negativize = source_array[i] * - 1 \n new_array.push(negativize)\n i += 1 \n end \n return new_array \nend", "def non_transitive\n triples = vertices.product(vertices, vertices)\n \n adjacent_triples = triples.select do |triple|\n adjacent_undirected(triple.first).include?(triple[1]) && adjacent_undirected(triple[1]).include?(triple.last)\n end\n \n adjacent_triples.reject do |triple|\n (adjacent_undirected(triple.first).include? triple.last) || (triple.first == triple.last)\n end\n end", "def map_to_negativize(source_array)\n temp = []\n i = 0\n while i < source_array.length do\n temp[i] = -source_array[i]\n i += 1\n end\n return temp\nend", "def negative\n abs.flip_sign\n end", "def inverse\n return self if identity_matrix?\n raise 'not invertible' unless invertible?\n\n Matrix.new(size) do |result|\n det = determinant\n each_row_col do |row, col|\n result[col, row] = cofactor(row, col) / det\n end\n end\n end", "def reverse_polarity\n case @value\n when :+\n @value = :-\n return true\n when :-\n @value = :+\n return true\n end\n false\n end", "def get_inverse_sum\n sum = 0\n self.get_odd_names.each do |name|\n odd_value = self.best_odd_for(name).value\n sum = sum + 1.0 / odd_value\n end\n return sum\n end", "def complement\n\t\t\tc = Xmms::Collection.new(Xmms::Collection::TYPE_COMPLEMENT)\n\t\t\tc.operands << self\n\t\t\tc\n\t\tend", "def invert!\n @front, @back = @back, @front\n end", "def inverted_rows(options = {})\n rows = voucher_rows\n rows.reject!(&:canceled?) unless options[:canceled]\n rows.map do |old|\n vr = old.dup\n vr.sum *= -1\n vr\n end\n end", "def inverse_of=(_arg0); end", "def map_to_negativize(source_array)\n \n i = 0\n new_array = []\n \n while i < source_array.length do\n new_array_value = source_array[i] * -1\n new_array << new_array_value\n \n i += 1\n end\n \n new_array\nend", "def inverse\n rgba = self.to_a\n 3.times{|i| rgba[i] = 255 - rgba[i]}\n return self.new_extended_color(rgba)\n end", "def inverse(point)\r\n inverse!(point.dup)\r\n end", "def inverse\n input.aliases.inverse\n end", "def -(vector)\n self + (-vector)\n end", "def negate\n Negate.new(self)\n end", "def complement!\n tmp = self.from\n self.from = self.to\n self.to = tmp\n tmp = self.from_orient\n self.from_orient = (self.to_orient == :+) ? :- : :+\n self.to_orient = (tmp == :+) ? :- : :+\n self.overlap = self.complement_overlap\n return self\n end", "def inverse\n return @inverse if defined?(@inverse)\n\n if kind_of_inverse?(options[:inverse])\n return @inverse = options[:inverse]\n end\n\n relationships = target_model.relationships(relative_target_repository_name).values\n\n @inverse = relationships.detect { |relationship| inverse?(relationship) } ||\n invert\n\n @inverse.child_key\n\n @inverse\n end", "def opposite(ar, i)\n\tdst = ((ar.length-1.0)/2.0).ceil\n\tleft, right = (i-dst) % ar.length, (i+dst) % ar.length\n\n\tar[right]\nend", "def invert\n REVERSALS[self]\n end", "def inverses(other = nil)\n return [ inverse_of ] if inverse_of\n return [] if @options.key?(:inverse_of) && !inverse_of\n\n if polymorphic?\n polymorphic_inverses(other)\n else\n determine_inverses(other)\n end\n end", "def with_each_edge_and_inverse(edges=nil, &block)\n edges ||= self.edges\n\n yielded_pairs = Set.new\n edges.each do |e|\n pair = Set.new([e.from, e.to])\n if !yielded_pairs.include?(pair)\n e_inverse = edge(e.to, e.from)\n block.call(e, e_inverse)\n yielded_pairs << pair\n end\n end\n end", "def opposite(x)\n puts -(x)\nend", "def plusMinus(arr)\n posCount = 0\n negCount = 0\n\n arr.each do |e|\n if e < 0\n negCount += 1\n elsif e > 0\n posCount += 1\n end\n end\n\n len = arr.length*1.0\n posProp = posCount/(len)\n negProp = negCount/(len)\n zeroProp = 1 - posProp - negProp\n\n puts posProp\n puts negProp\n puts zeroProp\nend", "def flip(orientations)\n new_orientations = []\n orientations.each do |o|\n new_orientations << o.map(&:reverse)\n new_orientations << o.reverse\n end\n orientations.concat(new_orientations)\nend", "def simplify\n super\n return CAS.abs(@x.x) if @x.is_a? CAS::Invert\n return self.simplify_dictionary\n end", "def negatives \n negatives ||= numbers.select {|num| num < 0}\n end", "def inverse\n new_list = self.class.new\n origins.each do |origin|\n origin.items.each do |item, int_value|\n if self.list.none?{|item_to_search, other_value| item_to_search.equal?(item)}\n new_list.list[item] = int_value\n end\n end\n end\n\n new_list\n end", "def isolates\n edges.inject(Set.new(vertices)) { |iso, e| iso -= [e.source, e.target] }\n end", "def rankinverse(p,i,n)\n ri(p,i,n,1,0)\n return p\n end", "def neg\n push -pop\n end", "def invert\n REVERSALS[self]\n end", "def inv\n inv_num = 0\n 1.upto(size-1) do |i|\n (i+1).upto(size) do |j|\n inv_num += 1 if self[i] > self[j]\n end\n end\n return inv_num\n end", "def invert\n r = 1.0 - self.red\n g = 1.0 - self.green\n b = 1.0 - self.blue\n a = self.alpha\n UIColor.colorWithRed(r, green:g, blue:b, alpha:a)\n end", "def normalize!\n if self[2] < 0\n self[0], self[2] = self[0]+self[2], -self[2]\n end\n if self[3] < 0\n self[1], self[3] = self[1]+self[3], -self[3]\n end\n self\n end", "def reverse_polarity\n end", "def flipud\n reverse(0)\n end", "def invert!\n indices = unrank_indices(rank)\n inverted = Array.new(size)\n for i in 0...size\n inverted[indices[i]] = i\n end\n self.rank = rank_indices(inverted)\n self\n end" ]
[ "0.7145653", "0.6845122", "0.67997533", "0.67911917", "0.67911917", "0.6713504", "0.65575975", "0.65408677", "0.6412548", "0.63524204", "0.63486546", "0.63275796", "0.632646", "0.6321055", "0.6319893", "0.62782186", "0.62137294", "0.61885965", "0.6167924", "0.6123479", "0.61157155", "0.61035806", "0.60334414", "0.5957245", "0.5935964", "0.59014624", "0.586753", "0.5835717", "0.5834852", "0.58312666", "0.58185726", "0.57872707", "0.5779116", "0.5712916", "0.5686492", "0.5678076", "0.56264967", "0.5613801", "0.56136394", "0.560564", "0.56024677", "0.56017417", "0.5597985", "0.55808926", "0.556098", "0.5554697", "0.5549279", "0.5537051", "0.5537051", "0.5533972", "0.5531789", "0.55113524", "0.5502909", "0.54737604", "0.547363", "0.546488", "0.54635036", "0.5456872", "0.54565835", "0.5454755", "0.54451656", "0.5445044", "0.5442415", "0.54196626", "0.54066265", "0.539882", "0.538342", "0.53688854", "0.53603077", "0.5356655", "0.5349687", "0.5346868", "0.5345592", "0.5343176", "0.5337366", "0.533491", "0.53335756", "0.5332894", "0.5321175", "0.53073865", "0.5275221", "0.52601695", "0.5259437", "0.525157", "0.52499026", "0.5244911", "0.52401525", "0.5239871", "0.5227946", "0.5218593", "0.52136743", "0.5206382", "0.5206233", "0.5204509", "0.52020496", "0.5200318", "0.5187187", "0.51857823", "0.51743734", "0.5156612" ]
0.6761776
5
Method to handle record not found errors.
def path_not_found render json: { error: 'No route matches.' }, status: :not_found end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_not_found\n raise ActiveRecord::RecordNotFound\n end", "def record_not_found(exception)\n log_error(exception, request.fullpath)\n render \"errors/record_not_found\"\n end", "def record_not_found(error)\n render json: {\n success: false,\n message: error.message\n }, status: :record_not_found\n end", "def record_not_found\n render json: ErrorSerializer.serialize({ record: \"Record not found.\" }), status: :not_found\n end", "def record_not_found\n render json: {error: I18n.t('errors.not_found')}.to_json, status: 404\n end", "def record_not_found\n render json: \"Record not found\", status: 404\n end", "def record_not_found\n render json: { error: { message: 'Record not found.' }}, status: :not_found\n end", "def record_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to posts_path, :flash => { :alert => \"Record not found.\" }\n end", "def record_not_found\n ActiveRecord::RecordNotFound\n end", "def record_not_found\n render json: {\n error: 'Record not found.'\n }, status: :not_found\n end", "def handle_not_found_error!\n raise Common::Exceptions::UnprocessableEntity.new(detail: 'Person Not Found')\n end", "def record_not_found\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n logger.error(\"Attempt to #{action_name} invalid id #{params[:id]}\")\n flash[:error] = \"Invalid ID specified for #{action_name} action.\"\n redirect_to :action => 'index'\n end\n end", "def record_not_found\n render json: {error: \"Record not found\"}.to_json, status: 404\n end", "def record_not_found\n\t\tflash[:alert] = \"Cannot find record number \" + params[:id] + \". Displaying all records.\"\n\t\tredirect_to root_path \n\tend", "def catch_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :flash => { :error => \"Record not found.\" }\n end", "def record_not_found\n redirect_to four_oh_four_url\n end", "def handle_not_found(exception)\n raise exception\n end", "def create_record_for_not_found_response; end", "def record_not_found_error\n if Rails.env == 'development'\n render # will give us the stack trace\n else\n flash[:notice] = I18n.t('blacklight.search.errors.invalid_solr_id')\n params.delete(:id)\n index\n render 'index', :status => 404\n end\n end", "def record_not_found\n flash[:danger] = 'Record Not Found'\n redirect_to (request.referrer || root_path)\n end", "def record_not_found(error)\n render(\n json:{\n errors:[{\n type: error.class.to_s,\n message:error.message\n }]\n }\n )\n end", "def record_not_found\n render 'shared/not_found' # Assuming you have a template named 'record_not_found'\n end", "def record_not_found\n render :json => {:success=>false, :error_code => 404, :error_msg=>\"Record not Found\"}\n end", "def catch_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :flash => { :error => \"Nº de protocolo inexistente!\" }\n end", "def record_not_found!\n render partial: 'errors/404', status: 404 && return\n end", "def record_not_found\n flash[:error] = \"You don't have this record.\"\n redirect_to '/'\n end", "def catch_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"Hittades inte\"\n redirect_to root_url\n end", "def catch_not_found\n yield\n\n rescue ActiveRecord::RecordNotFound\n redirect_to root_path\n end", "def render_record_not_found\n record_name = !controller_name.blank? ? controller_name.singularize.titleize : \"Record\"\n respond_with(nil, :status => {:msg => \"#{record_name} not found\", :code => 404})\n end", "def record_not_found\n render :partial => \"shared/error\", :layout => \"one_box\", :status => 404, :locals => {:error_title => 'No hemos encontrado lo que buscabas', :error_message => 'Puedes haber tecleado mal la dirección o la página puede haber sido movida.'}\n end", "def render_record_not_found\n render :template => \"error/404\", :status => 404\n end", "def record_not_found\n puts \"RecordNotFound\"\n redirect_to request.referrer || root_path\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def resource_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :notice => \"Room not found.\"\n end", "def record_not_found\n redirect_to(\"#{BASE_DOMAIN}/infos/lost/\")\n end", "def record_not_found\n render :file => File.join(::Rails.root.to_s, 'public', '404.html'), :status => 404\n end", "def render_record_not_found_message\n render json: {error: \"Student not found\"}, status: :not_found\n end", "def resource_not_found\n\t\tyield\n\trescue ActiveRecord::RecordNotFound\n\t\tredirect_to root_url, :notice => \"Room Category not found.\"\n\tend", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def record_not_found\n render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n end", "def prevent_not_found\n address = Address.find(params[:id])\n rescue ActiveRecord::RecordNotFound => e\n redirect_to root_path\n\n end", "def resource_not_found\n yield\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :notice => \"Room Category not found.\"\n end", "def rescue_action(exception)\n case exception\n when ActiveRecord::RecordNotFound\n render :text => 'Could not find the requested record!', :status => 404\n else\n super\n end\n end", "def not_found; end", "def record_not_found\n \t\trender :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404\n \tend", "def not_found\n response_error(code: 404, message: 'Object not found.')\n end", "def not_found\n\n render_error( :not_found )\n\n end", "def not_found_exception(guid, find_model)\n CloudController::Errors::NotFound.new_from_details(not_found_exception_name(find_model), guid)\n end", "def return_not_found\n return_error(error_code: 404, message: 'Not Found')\n end", "def not_found\n\n r = Result::Base.error(\n {\n internal_id: 'ac_1',\n general_error_identifier: 'resource_not_found',\n http_code: GlobalConstant::ErrorCode.not_found\n }\n )\n\n return render_api_response(r)\n\n end", "def record_not_found_message\n resource_name&.present? ? I18n.t(:x_not_found, name: resource_name&.singularize&.titleize) : I18n.t(:not_found)\n end", "def log_invalid_record(record)\n puts \"#{type_of(record)} | #{record.id} | #{pretty_errors(record)}\"\n end", "def record_not_found\n render file: \"#{Rails.root}/public/404.html\", layout: false, status: :not_found\n end", "def not_found(message = t('messages.generics.errors.find'))\n error(message, 404)\n end", "def raise_record_not_found_exception!(ids = nil, result_size = nil, expected_size = nil, key = primary_key, not_found_ids = nil) # :nodoc:\n conditions = \" [#{arel.where_sql(klass)}]\" unless where_clause.empty?\n\n name = @klass.name\n\n if ids.nil?\n error = +\"Couldn't find #{name}\"\n error << \" with#{conditions}\" if conditions\n raise RecordNotFound.new(error, name, key)\n elsif Array.wrap(ids).size == 1\n error = \"Couldn't find #{name} with '#{key}'=#{ids}#{conditions}\"\n raise RecordNotFound.new(error, name, key, ids)\n else\n error = +\"Couldn't find all #{name.pluralize} with '#{key}': \"\n error << \"(#{ids.join(\", \")})#{conditions} (found #{result_size} results, but was looking for #{expected_size}).\"\n error << \" Couldn't find #{name.pluralize(not_found_ids.size)} with #{key.to_s.pluralize(not_found_ids.size)} #{not_found_ids.join(', ')}.\" if not_found_ids\n raise RecordNotFound.new(error, name, key, ids)\n end\n end", "def record_not_found\n render file: 'public/404.zh-TW.html', stats: :not_found\n end", "def fail_not_found_if_nil(promise)\n promise.then do |val|\n if val\n val\n else\n raise RecordNotFoundException.new\n end\n end\n end", "def object_not_found?\n @code == ERROR_OBJECT_NOT_FOUND\n end", "def exeception_rescuer\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n exeception_to_log\n false\n end\n end", "def exeception_rescuer\n begin\n yield\n rescue ActiveRecord::RecordNotFound\n exeception_to_log\n false\n end\n end", "def not_found\n render status: :not_found\n end", "def show_not_found\n render_json_error(code: :show_not_found, status: :not_found)\n end", "def resource_not_found\n flash.now.alert = \"notifications.document.not_found\"\n @info = { id: params[:id] }\n render \"shared/html/404\" and return\n end", "def handle_ignored\n if @note.ignore == true\n raise ActiveRecord::RecordNotFound\n end\n end", "def rescue_not_found\n render nothing: true, status: 404\n end", "def parse_not_found\n if @input.match?(/% Object \"(.*)\" not found in database\\n/)\n while @input.scan(/%(.*)\\n/) # strip junk\n end\n @ast[\"NotFound\"] = true\n end\n end", "def render_404\n render template: '/shared/record_not_found', layout: false, status: :not_found\n end", "def find_record\n record_id = params[:record_id] || params[:id]\n @record = Record.where(medical_record_number: record_id).first\n raise RequestError.new(404) if @record.nil?\n end", "def rescue_record_not_found(exception)\n respond_to do |format|\n format.html\n format.js { render :template => \"Images/404.js.erb\", :locals => {:exception => exception} }\n end\n end", "def record_not_found\r\n if %w{m mobile}.any? {|subdomain| subdomain == request.subdomain}\r\n render 'welcome/mobile/404', :layout => 'mobile', :status => 404\r\n return\r\n end\r\n render :file => File.join(Rails.root, 'public', '404.html'), :status => 404\r\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n rescue\n render_404\n end", "def not_found\n rescue_404(ActionController::RoutingError.new(\"No route matches #{request.request_method} #{request.path}\"))\n end", "def thumbwebs_record_not_found\n flash[:error] = \"Record not found\"\n redirect_to show_errors_thumbwebs_channels_path\nend", "def record_not_found\n render :file => Rails.root.join('public','404.html'), :status => \"404 Not Found\", layout: false\n end", "def render_not_found\n\t\tflash[:notice] = 'The object you tried to access does not exist!'\n\t\tredirect_to root_path\n\tend", "def error_route_not_found\n render 'errors/route_not_found', status: :not_found rescue last_chance\n end", "def raise_not_found\n\t\traise ActionController::RoutingError.new(\"No route matches #{params[:unmatched_route]}\")\n\tend", "def resource_not_found_for(env)\n raise case env[:url].path\n when %r{\\A(/_db/[^/]+)?/_api/document} then Ashikawa::Core::DocumentNotFoundException\n when %r{\\A(/_db/[^/]+)?/_api/collection} then Ashikawa::Core::CollectionNotFoundException\n when %r{\\A(/_db/[^/]+)?/_api/index} then Ashikawa::Core::IndexNotFoundException\n else Ashikawa::Core::ResourceNotFound\n end\n end", "def invalid_document_id_error(exception)\n error_info = {\n \"status\" => \"404\",\n \"error\" => \"#{exception.class}: #{exception.message}\"\n }\n\n respond_to do |format|\n format.xml { render xml: error_info, status: :not_found }\n format.json { render json: error_info, status: :not_found }\n\n # default to HTML response, even for other non-HTML formats we don't\n # neccesarily know about, seems to be consistent with what Rails4 does\n # by default with uncaught ActiveRecord::RecordNotFound in production\n format.any do\n # use standard, possibly locally overridden, 404.html file. Even for\n # possibly non-html formats, this is consistent with what Rails does\n # on raising an ActiveRecord::RecordNotFound. Rails.root IS needed\n # for it to work under testing, without worrying about CWD.\n render \"errors/not_found\", status: :not_found\n end\n end\n end", "def not_found(options={}, &b)\n error NotFound, options, &b\n end", "def handle_not_found(exception = nil)\n render \"shared/not_found\".freeze, status: 404\n end", "def handle_resource_not_found(msg = 'Not found.')\r\n flash.now[:notice] = msg\r\n @web_analytics.page_stack = ['Admin', 'Resource Not Found']\r\n @web_analytics.error_page = true\r\n @left_rail_ad_pixels = -1 # make sure no ads are shown\r\n render :template => 'common/resource_not_found', :status => 404, :layout => 'application'\r\n false\r\n end", "def object_not_found\n render json: 'Object not found', status: :not_found\n end", "def not_found(&block)\n error 404, &block\n end", "def not_found\n render json: nil, status: :not_found\n end", "def not_found\n raise ActionController::RoutingError.new('Not Found')\n end", "def not_found\n flash[:alert] = t('messages.project.errors.find')\n redirect_to projects_url\n end", "def not_found(exception)\n render json: { error: exception.message }, status: :not_found\n end", "def route_eval\n super\n rescue ActiveRecord::RecordNotFound\n not_found\n end", "def response_not_found\n render status: 404,\n json: {\n source: {\n pointer: request.original_url\n },\n errors: [ { message: \"Not Found\" } ]\n }\n end", "def not_found\n render json: { error: { message: 'There was nothing found at this address.' }}, status: :not_found\n end", "def not_found\n respond_with 404\n end", "def not_found_model(identifier, *args)\n identifier\n end", "def not_found\n render_error status: :not_found, body: 'page not found'\n end" ]
[ "0.8250229", "0.79091203", "0.76344144", "0.75092155", "0.7508313", "0.74981034", "0.7496555", "0.74548435", "0.74529165", "0.7434027", "0.74247783", "0.7420021", "0.73500806", "0.73294985", "0.7307254", "0.7307107", "0.7274329", "0.7250984", "0.7165259", "0.711203", "0.70942163", "0.7069102", "0.7037921", "0.703247", "0.70200014", "0.70092446", "0.6966627", "0.69664794", "0.69513714", "0.6918706", "0.68891186", "0.6850411", "0.6803483", "0.6803483", "0.6803483", "0.6791273", "0.6748734", "0.67348814", "0.6720204", "0.67123175", "0.6692241", "0.6692241", "0.6692241", "0.6692241", "0.6692241", "0.6692241", "0.6692241", "0.66630363", "0.6644235", "0.6612675", "0.66034335", "0.6588836", "0.6541906", "0.6465685", "0.64631873", "0.64407474", "0.6429898", "0.6419866", "0.6409767", "0.6381569", "0.6341335", "0.63302404", "0.6320621", "0.62887764", "0.6287477", "0.6285599", "0.6284841", "0.6278414", "0.6274656", "0.62684953", "0.6237085", "0.62361246", "0.62309206", "0.62229174", "0.6219443", "0.61681616", "0.61667246", "0.61465645", "0.6133382", "0.61313665", "0.61311644", "0.61062473", "0.60948557", "0.60597885", "0.6050776", "0.6049302", "0.604703", "0.6038754", "0.6016807", "0.60162306", "0.6013705", "0.6008225", "0.59729236", "0.59580475", "0.5948242", "0.5945063", "0.5935827", "0.5926492", "0.59260976", "0.5914556", "0.59124297" ]
0.0
-1
GET /mercadoria GET /mercadoria.json
def index @mercadoria = Mercadorium.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end", "def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def show\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def show\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mercado_metum }\n end\n end", "def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end", "def show\n @mesasredonda = Mesasredonda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mesasredonda }\n end\n end", "def index\n if params[:estado]\n @municipios = Uf.find(params[:estado]).municipios\n else\n @municipios = Uf.first.municipios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\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 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 show\n @municipio = Municipio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipio }\n end\n end", "def show\n @municipio = Municipio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipio }\n end\n end", "def show\r\n render json: @registro_medicion.to_json, status: :ok\r\n end", "def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @materia }\n end\n end", "def index\n @municipio_de_la_preparatoria_o_universidad_de_origens = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origens }\n end\n end", "def show\n @mutacao = Mutacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mutacao }\n end\n end", "def show\n @mecanicacomplejo = Mecanicacomplejo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mecanicacomplejo }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def show\n @jugador = Jugador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jugador }\n end\n end", "def index\n @materias = Materia.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @materias }\n end\n end", "def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end", "def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end", "def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end", "def show\n @municipio_de_la_preparatoria_o_universidad_de_origen = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origen }\n end\n end", "def show\n render json: @tutorado, status: :ok\n end", "def show\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @juzgado }\n end\n end", "def show\n @medicamento = Medicamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medicamento }\n end\n end", "def new\n @motivobaja = MotivoBaja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivobaja }\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 @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", "def show\n @orador = Orador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orador }\n end\n end", "def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\n end\n end", "def new\n @materia = Materia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @materia }\n end\n end", "def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end", "def show\n @municipio_dominio = MunicipioDominio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @municipio_dominio }\n end\n end", "def show\n @agendamento = Agendamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendamento }\n end\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def show\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metodo }\n end\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def show\n render json: @departamento\n end", "def show\n @unidade_medida = UnidadeMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_medida }\n end\n end", "def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end", "def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end", "def municipios_por_estado\n resp = {}\n resp[:estatus] = false\n\n if params[:region_id].present?\n resp[:estatus] = true\n parent_id = Estado::CORRESPONDENCIA[params[:region_id].to_i]\n municipios = Municipio.campos_min.where(cve_ent: parent_id)\n resp[:resultados] = municipios.map{|m| {region_id: m.region_id, nombre_region: m.nombre_region}}\n resp[:parent_id] = parent_id\n else\n resp[:msg] = 'El argumento region_id está vacio'\n end\n\n render json: resp\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @receita_medica = ReceitaMedica.find(params[:id])\n @item_receitas = @receita_medica.item_receitas.all\n respond_to do |format|\n format.html # show.html.erb \n format.json { render json: {\n :receita => @receita_medica, \n :medicamentos => @receita_medica.item_receitas.collect {|t| [t.medicamento.nome, t.posologia, t.quantidade]} } }\n end\n end", "def show\n @relacion_articulo_medida = RelacionArticuloMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relacion_articulo_medida }\n end\n end", "def new\n @municipio = Municipio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @municipio }\n end\n end", "def new\n @municipio = Municipio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @municipio }\n end\n end", "def show\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end", "def show\n render json: @lugar\n end", "def show\n @monnaie = Monnaie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monnaie }\n end\n end", "def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end", "def new\n @uf = Uf.first\n @municipios = @uf.municipios\n @cargo_eleicao = Eleicao.find(:first, :conditions => \"status = true\").cargo_eleicaos\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end", "def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end", "def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\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 @combinacion = Combinacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @combinacion }\n end\n end", "def show\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballo }\n end\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\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 show\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minicurso }\n end\n end", "def show\n @bordado = Bordado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bordado }\n end\n end", "def index\n @departamentos = Departamento.all\n\n render json: @departamentos\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def new\n @mapeamento = Mapeamento.new\n @professors = Professor.all\n @cursos = Curso.all\n @disciplinas = Disciplina.all\n @turmas = Turma.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mapeamento }\n end\n end", "def municipios_por_estado\n\t\tresp = {}\n\t\tresp[:estatus] = false\n\t\t\n\t\tif params[:region_id].present?\n\t\t\tresp[:estatus] = true\n\t\t\tparent_id = Estado::CORRESPONDENCIA[params[:region_id].to_i]\n\t\t\tmunicipios = Municipio.campos_min.where(cve_ent: parent_id)\n\t\t\tresp[:resultados] = municipios.map{|m| {region_id: m.region_id, nombre_region: m.nombre_region}}\n\t\t\tresp[:parent_id] = parent_id\n\t\telse\n\t\t\tresp[:msg] = 'El argumento region_id está vacio'\n\t\tend\n\t\t\n\t\trender json: resp\n\tend", "def new\n @orador = Orador.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @orador }\n end\n end", "def new\n @marina = Marina.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @marina }\n end\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end", "def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end", "def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end", "def show\n @preparatoria_o_universidad_de_origen = PreparatoriaOUniversidadDeOrigen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origen }\n end\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def new\n @aroma = Aroma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @aroma }\n end\n end", "def index\n\t\trender json: { prueba: 'Funciona'}\n\tend", "def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\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 respond_to do |format|\n format.html\n format.json { render json: @maudio}\n end\n end", "def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def getMerchants\n\tbegin\n\t\tresponse = RestClient.get('http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40')\n\trescue\n\t\tputs \"error retrieving response...\"\n\tend\n\n\tmerchants = JSON.parse(response)\n\treturn merchants\nend", "def show\n @ordinario = Ordinario.find(params[:id])\n @alumnos = @ordinario.alumnos\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ordinario }\n end\n end", "def index\n \n if current_user.tipo == 2\n @receita_medicas = ReceitaMedica.where(:medico_id => current_user.id)\n elsif current_user.tipo == 1\n @receita_medicas = ReceitaMedica.where(:paciente_id => current_user.id)\n elsif current_user.tipo == 3\n @receita_medicas = Venda.receitas_medicas(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @receita_medicas }\n end\n end", "def show\n @deporte= set_deporte\n render json: @deporte, status: :ok\n\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def show\n @medida = Medida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medida }\n end\n end", "def show\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end", "def new\n @mutacao = Mutacao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mutacao }\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 show\n @modelo = Modelo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @modelo }\n end\n end" ]
[ "0.7064855", "0.70645344", "0.6935587", "0.6920939", "0.69089544", "0.6897663", "0.68728936", "0.67873573", "0.67429346", "0.66999227", "0.66941893", "0.6685317", "0.6668537", "0.6668537", "0.66670257", "0.6656401", "0.6595273", "0.65823984", "0.6568594", "0.65684265", "0.65664965", "0.65407914", "0.653308", "0.65289277", "0.65231", "0.65172505", "0.65168977", "0.6505263", "0.6492073", "0.6483805", "0.6474279", "0.6463562", "0.6451713", "0.6446159", "0.64369184", "0.6436322", "0.64354616", "0.6421703", "0.6412739", "0.6405955", "0.6401598", "0.63969266", "0.6394142", "0.6387722", "0.6378362", "0.63690174", "0.6368381", "0.6368381", "0.6365342", "0.6355113", "0.6341083", "0.6341083", "0.63407415", "0.63392925", "0.6333791", "0.63072574", "0.6306175", "0.6304705", "0.63028026", "0.6299775", "0.62983304", "0.6296176", "0.6292986", "0.6283469", "0.62801194", "0.62791854", "0.62675506", "0.6259053", "0.6251361", "0.62451106", "0.62447286", "0.62414247", "0.6238114", "0.6236632", "0.62346166", "0.62339807", "0.6233174", "0.6232863", "0.62328607", "0.6230836", "0.6230804", "0.6229179", "0.6226604", "0.62262166", "0.6224935", "0.6224444", "0.6215496", "0.62142164", "0.62142164", "0.62142164", "0.6212755", "0.62056696", "0.62037086", "0.62013525", "0.61996746", "0.6194643", "0.61902446", "0.6183158", "0.61810577", "0.61791265" ]
0.6640198
16
GET /mercadoria/1 GET /mercadoria/1.json
def show @volumecont20 = 27 @volumepeca = @mercadorium.altura * @mercadorium.largura * @mercadorium.comprimento @multiplicador = @mercadorium.imposto/100.to_f @a = @volumepeca /3 @quantcont = (27/0.036176).round @quantporcbm = (1/0.036176).round(2) @precofobcont = (@quantcont * @mercadorium.preco).round(2) @cifvar = @mercadorium.precofrete + @precofobcont @impostocontainer = @multiplicador * @cifvar @custocontainernacional = (@multiplicador * @precofobcont) + @precofobcont @freteunit = @mercadorium.precofrete / @quantcont @custnaciounit = (@custocontainernacional / @quantcont).round(3) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mapeamento }\n end\n end", "def get_modelos\n marca = Marca.find(params[:marca_id])\n @modelos = Modelo.of_marca(marca.id)\n\n render json: @modelos\n\n end", "def show\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mercado_metum }\n end\n end", "def show\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.json { render json: @imobiliaria }\r\n end\r\n end", "def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end", "def show\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def index\n @mercado_meta = MercadoMetum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mercado_meta }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end", "def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @materia }\n end\n end", "def show\n @mesasredonda = Mesasredonda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mesasredonda }\n end\n end", "def show\n @mecanicacomplejo = Mecanicacomplejo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mecanicacomplejo }\n end\n end", "def show\n @municipio = Municipio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipio }\n end\n end", "def show\n @municipio = Municipio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipio }\n end\n end", "def show\n @mutacao = Mutacao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mutacao }\n end\n end", "def show\n @medicamento = Medicamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medicamento }\n end\n end", "def show\n @jugador = Jugador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jugador }\n end\n end", "def show\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metodo }\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\r\n render json: @registro_medicion.to_json, status: :ok\r\n end", "def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\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 if params[:estado]\n @municipios = Uf.find(params[:estado]).municipios\n else\n @municipios = Uf.first.municipios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\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", "def show\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @premio }\n end\n end", "def index\n @mercadoria = Mercadorium.all\n end", "def new\n @uf = Uf.first\n @municipios = @uf.municipios\n @cargo_eleicao = Eleicao.find(:first, :conditions => \"status = true\").cargo_eleicaos\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end", "def index\n @materias = Materia.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @materias }\n end\n end", "def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end", "def show\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minicurso }\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 @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end", "def show\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @aroma }\n end\n end", "def show\n @monnaie = Monnaie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monnaie }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comentario }\n end\n end", "def show\n @municipio_de_la_preparatoria_o_universidad_de_origen = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origen }\n end\n end", "def show\n unless possui_acesso?()\n return\n end\n @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end", "def show\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @juzgado }\n end\n end", "def show\n @relacion_articulo_medida = RelacionArticuloMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relacion_articulo_medida }\n end\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def 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 show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end", "def show\n @combinacion = Combinacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @combinacion }\n end\n end", "def new\n @motivobaja = MotivoBaja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def new\n @materia = Materia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @materia }\n end\n end", "def show\n @unidade_medida = UnidadeMedida.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_medida }\n end\n end", "def show\n @leito = Leito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @leito }\n end\n end", "def show\n @municipio_dominio = MunicipioDominio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @municipio_dominio }\n end\n end", "def index\n @municipio_de_la_preparatoria_o_universidad_de_origens = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origens }\n end\n end", "def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end", "def show\n @receita_medica = ReceitaMedica.find(params[:id])\n @item_receitas = @receita_medica.item_receitas.all\n respond_to do |format|\n format.html # show.html.erb \n format.json { render json: {\n :receita => @receita_medica, \n :medicamentos => @receita_medica.item_receitas.collect {|t| [t.medicamento.nome, t.posologia, t.quantidade]} } }\n end\n end", "def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end", "def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end", "def show\n @agendamento = Agendamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agendamento }\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 @matricula = Matricula.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @matricula }\n end\n end", "def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end", "def show\n @modelo = Modelo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @modelo }\n end\n end", "def show\n @personaje_mision = PersonajeMision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personaje_mision }\n end\n end", "def show\n @orador = Orador.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @orador }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @pagamento = Pagamento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pagamento }\n end\n end", "def show\n @remedio = Remedio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remedio }\n end\n end", "def show\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mencion }\n end\n end", "def show\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballo }\n end\n end", "def show\n @pessoa_receber = PessoaReceber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end", "def show\n @nominee = Nominee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nominee }\n end\n end", "def show\n @medio_pago = MedioPago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medio_pago }\n end\n end", "def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end", "def show\n @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 show\n @repuesto = Repuesto.find(params[:id])\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @repuesto.to_json }\n end\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def show\n render json: @tutorado, status: :ok\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 @plato = Plato.find(params[:id])\n\n if !@plato.comentario.first.nil?\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id], include: [comentario:{only: [:id]}])\n else\n render json: @plato.as_json(only: [:id, :nombre, :precio, :categoria, :tipo, :calificaciones, :total, :soda_id])\n end\n end", "def show\n @areco = Areco.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @areco }\n end\n end", "def show\n @mensaje = Mensaje.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mensaje }\n end\n end", "def show\n @monel = Monel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monel }\n end\n end", "def show\n @bordado = Bordado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bordado }\n end\n end", "def new\n @municipio = Municipio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @municipio }\n end\n end", "def new\n @municipio = Municipio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @municipio }\n end\n end", "def find_client\n cliente = get_cliente(params[:id])\n\n respond_to do |format|\n format.json {render json: {client: cliente}}\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 show\n @mouvement_recurrent = MouvementRecurrent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mouvement_recurrent }\n end\n end", "def show\n @preparatoria_o_universidad_de_origen = PreparatoriaOUniversidadDeOrigen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origen }\n end\n end", "def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end", "def show\n @asociado = Asociado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asociado }\n end\n end", "def show\n @ejercicio = Ejercicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ejercicio }\n end\n end", "def show\n @reparacion = Reparacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reparacion }\n end\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end", "def show\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cargo_eleicao }\n end\n end", "def show\n @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 @odontologia1 = Odontologia1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologia1 }\n end\n end", "def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end", "def show\n @cliente = Cliente.find(params[:cliente_id])\n @pago = @cliente.pagos.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pago }\n end\n end", "def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def show\n @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" ]
[ "0.711845", "0.7077771", "0.7061761", "0.7009957", "0.7008972", "0.70059913", "0.6951583", "0.6859146", "0.6814255", "0.67654616", "0.6758554", "0.6748133", "0.6718281", "0.67146385", "0.67146385", "0.66921794", "0.66721404", "0.6657802", "0.6653208", "0.6642004", "0.6641008", "0.66409665", "0.6621327", "0.6603114", "0.657973", "0.6578634", "0.65726113", "0.6567809", "0.65646356", "0.655521", "0.65547615", "0.6550028", "0.65468824", "0.65320593", "0.6528787", "0.65269566", "0.65269566", "0.6526955", "0.65163976", "0.6505316", "0.6485863", "0.6483841", "0.6477342", "0.64734375", "0.64731675", "0.6471167", "0.64706177", "0.6470003", "0.64569277", "0.6453289", "0.6452879", "0.6451926", "0.6444478", "0.643232", "0.6431141", "0.64306796", "0.6428016", "0.64244676", "0.64238554", "0.6410542", "0.64103603", "0.64089936", "0.64041877", "0.6402601", "0.6402601", "0.6402601", "0.6398357", "0.6390376", "0.63875735", "0.6382726", "0.6380179", "0.6379343", "0.6373713", "0.63697875", "0.6360473", "0.6358594", "0.6354964", "0.6348134", "0.63467497", "0.63387674", "0.6338726", "0.6336146", "0.6334813", "0.6333388", "0.6333388", "0.63273895", "0.63268614", "0.63231426", "0.6322885", "0.63192374", "0.6318659", "0.6318512", "0.6318082", "0.6317385", "0.6314773", "0.6311202", "0.6310057", "0.6309034", "0.63019466", "0.6298341", "0.6291826" ]
0.0
-1
POST /mercadoria POST /mercadoria.json
def create @mercadorium = Mercadorium.new(mercadorium_params) respond_to do |format| if @mercadorium.save format.html { redirect_to @mercadorium, notice: 'Mercadorium was successfully created.' } format.json { render action: 'show', status: :created, location: @mercadorium } else format.html { render action: 'new' } format.json { render json: @mercadorium.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @marca = Marca.new(marca_params)\n if @marca.save\n render json: @marca\n else\n render json: @marca.errors, status: :unprocessable_entity \n end\n end", "def create\n @municao = Municao.new(municao_params)\n\n respond_to do |format|\n if @municao.save\n format.html { redirect_to @municao, notice: 'A Munição foi criada com sucesso!' }\n format.json { render :show, status: :created, location: @municao }\n else\n format.html { render :new }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mapeamento = Mapeamento.new(params[:mapeamento])\n\n respond_to do |format|\n if @mapeamento.save\n format.html { redirect_to @mapeamento, notice: 'Mapeamento was successfully created.' }\n format.json { render json: @mapeamento, status: :created, location: @mapeamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mapeamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @materia = Materia.new(params[:materia])\n\n if @materia.save\n render json: @materia, status: :created, location: @materia\n else\n render json: @materia.errors, status: :unprocessable_entity\n end\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end", "def create\r\n @imobiliaria = Imobiliaria.new(imobiliaria_params)\r\n\r\n respond_to do |format|\r\n if @imobiliaria.save\r\n format.json { render json: @imobiliaria, status: :created }\r\n else \r\n format.json { render json: @imobiliaria.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @mensagem = Mensagem.new(params[:mensagem])\n @mensagem.autor = session[:current_user]\n id_to_post = String.new\n \n case @mensagem.recebedor_type\n when \"Turma\"\n aux = Turma.find(@mensagem.recebedor_id)\n id_to_post = aux.group_id\n end\n \n @mensagem.post_id = api_client.put_wall_post(@mensagem.conteudo, {}, id_to_post)['id']\n\n respond_to do |format|\n if @mensagem.save\n #format.html { redirect_to(@mensagem, :notice => 'Mensagem was successfully created.') }\n format.xml { render :xml => @mensagem, :status => :created, :location => @mensagem }\n format.js {}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @mensagem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @alumno = Alumno.new(params[:alumno])\n\n respond_to do |format|\n if @alumno.save\n render json: @alumno.as_json(include: :persona), status: :created, location: @alumno\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end", "def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, enviar, receber)\n\n render json: { status: trocou }\n end", "def create\n @motivobaja = MotivoBaja.new(motivo_baja_params)\n\n respond_to do |format|\n if @motivobaja.save\n format.html { redirect_to @motivobaja, notice: 'Motivo Baja was successfully created.' }\n format.json { render json: @motivobaja, status: :created, location: @motivobaja }\n else\n format.html { render action: \"new\" }\n format.json { render json: @motivobaja.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @materiaprima = Materiaprima.new(materiaprima_params)\n @materiaprima.cliente_id = current_user.cliente_id\n respond_to do |format|\n if @materiaprima.save\n format.html { redirect_to new_materiaprima_path, flash: { success: 'Matéria prima criada com sucesso.' } }\n format.json { render :show, status: :created, location: @materiaprima }\n else\n format.html { render :new }\n format.json { render json: @materiaprima.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @metodologia = Metodologia.new(metodologia_params)\n\n respond_to do |format|\n if @metodologia.save\n format.html { redirect_to @metodologia, notice: 'Metodologia was successfully created.' }\n format.json { render action: 'show', status: :created, location: @metodologia }\n else\n format.html { render action: 'new' }\n format.json { render json: @metodologia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\n\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @remuneracao = Remuneracao.new(remuneracao_params)\n\n respond_to do |format|\n if @remuneracao.save\n format.html { redirect_to @remuneracao, notice: 'Remuneracao was successfully created.' }\n format.json { render :show, status: :created, location: @remuneracao }\n else\n format.html { render :new }\n format.json { render json: @remuneracao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @municipio = Municipio.new(params[:municipio])\n\n respond_to do |format|\n if @municipio.save\n format.html { redirect_to @municipio, notice: 'Municipio was successfully created.' }\n format.json { render json: @municipio, status: :created, location: @municipio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @municipio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @municipio = Municipio.new(params[:municipio])\n\n respond_to do |format|\n if @municipio.save\n format.html { redirect_to @municipio, notice: 'Municipio criado com sucesso!' }\n format.json { render json: @municipio, status: :created, location: @municipio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @municipio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @municipio = Municipio.new(municipio_params)\n @municipio.creador = current_user.id\n @municipio.modificador = current_user.id\n\n respond_to do |format|\n if @municipio.save\n format.html { redirect_to @municipio, notice: 'Municipio was successfully created.' }\n format.json { render :show, status: :created, location: @municipio }\n else\n format.html { render :new }\n format.json { render json: @municipio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @novedad_mecanica = @unidad.novedades_mecanicas.build(novedad_mecanica_params)\n\n respond_to do |format|\n if @novedad_mecanica.save\n format.html { redirect_to [@unidad,@novedad_mecanica], notice: 'Novedad mecanica was successfully created.' }\n format.json { render :show, status: :created, location: @novedad_mecanica }\n else\n format.html { render :new }\n format.json { render json: @novedad_mecanica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mutacao = Mutacao.new(params[:mutacao])\n\n respond_to do |format|\n if @mutacao.save\n format.html { redirect_to mutacaos_path, notice: 'Mutacao was successfully created.' }\n format.json { render json: @mutacao, status: :created, location: @mutacao }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mutacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mercado_metum = MercadoMetum.new(params[:mercado_metum])\n\n respond_to do |format|\n if @mercado_metum.save\n format.html { redirect_to @mercado_metum, notice: 'Mercado metum was successfully created.' }\n format.json { render json: @mercado_metum, status: :created, location: @mercado_metum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mercado_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @merma_insumo = MermaInsumo.new(merma_insumo_params)\n\n respond_to do |format|\n if @merma_insumo.save\n format.html { redirect_to @merma_insumo, notice: 'Merma insumo was successfully created.' }\n format.json { render :show, status: :created, location: @merma_insumo }\n else\n format.html { render :new }\n format.json { render json: @merma_insumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @midia = Midia.new(midia_params)\n\n respond_to do |format|\n if @midia.save\n format.html { redirect_to @midia, notice: 'Um novo tipo de mídia foi criado com sucesso.' }\n format.json { render json: @midia, status: :created, location: @midia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @midia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_merc = TipoMerc.new(tipo_merc_params)\n\n respond_to do |format|\n if @tipo_merc.save\n format.html { redirect_to @tipo_merc, notice: 'Tipo merc was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_merc }\n else\n format.html { render :new }\n format.json { render json: @tipo_merc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @receita_medica = ReceitaMedica.new(params[:receita_medica])\n @receita_medica.medico = current_user\n\n respond_to do |format|\n if @receita_medica.save\n format.html { redirect_to @receita_medica, notice: 'Receita medica was successfully created.' }\n format.json { render json: @receita_medica, status: :created, location: @receita_medica }\n else\n format.html { render action: \"new\" }\n format.json { render json: @receita_medica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vacuna = Vacuna.new(vacuna_params)\n @vacuna.mascota_id = @mascota.id\n respond_to do |format|\n if @vacuna.save\n format.html { redirect_to @vacuna, notice: 'Vacuna Agregada exitosamente' }\n format.json { render :show, status: :created, location: @vacuna }\n else\n format.html { render :new }\n format.json { render json: @vacuna.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def create\n @mundo = Mundo.new(mundo_params)\n\n respond_to do |format|\n if @mundo.save\n format.html { redirect_to @mundo, notice: 'Mundo was successfully created.' }\n format.json { render :show, status: :created, location: @mundo }\n else\n format.html { render :new }\n format.json { render json: @mundo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @motivo = Motivo.new(motivo_params)\n\n respond_to do |format|\n if @motivo.save\n format.html { redirect_to @motivo, notice: 'Motivo was successfully created.' }\n format.json { render :show, status: :created, location: @motivo }\n else\n format.html { render :new }\n format.json { render json: @motivo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @municipio_dominio = MunicipioDominio.new(params[:municipio_dominio])\n\n respond_to do |format|\n if @municipio_dominio.save\n format.html { redirect_to @municipio_dominio, :notice => 'Municipio dominio was successfully created.' }\n format.json { render :json => @municipio_dominio, :status => :created, :location => @municipio_dominio }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @municipio_dominio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @registro_medicion = Api::RegistroMedicion.new(registro_medicion_params)\r\n @registro_medicion.microcontrolador = Api::Microcontrolador.find_or_create_by(nivel: params[:nivel], area: params[:area])\r\n #TODO Mande que tipo de variable ambiental es\r\n\r\n @registro_medicion.variable_ambiental = Api::VariableAmbiental.where(tipo: params[:tipo]).first\r\n\r\n if @registro_medicion.save && Api::RegistroMedicionesHelper.verify(@registro_medicion, params[:promedio])\r\n render json: @registro_medicion.to_json, status: :ok\r\n else\r\n render :json => { :mssg => 'Hubo un error creando el registro medicion.' }, status: :unprocessable_entity\r\n end\r\n end", "def morador_params\n params.require(:morador).permit(:nome, :rg, :cpf, :tel_residencial, :tel_celular, :tel_comercial, :ramal, :email, :parentesco, :tipo, :apartamento_id)\n end", "def create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'Turma criada com sucesso.' }\n format.json { render json: @turma, status: :created, location: @turma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @Empresa = Empresa.find(params[:empresa_id])\n p simulacion_params[:id]\n if simulacion_params[:id]!=nil\n respond_to do |format| \n format.html { render json: 1 and return}\n end\n end\n simulacion=@Empresa.simulacions.new(simulacion_params)\n respond_to do |format|\n if simulacion.save\n format.html { render json: {simulacion:simulacion}}\n else\n format.html { render action: simulacion.errors }\n end\n end\n end", "def create\n @prueba_json = PruebaJson.new(prueba_json_params)\n\n respond_to do |format|\n if @prueba_json.save\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully created.' }\n format.json { render action: 'show', status: :created, location: @prueba_json }\n else\n format.html { render action: 'new' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @alumno = Alumno.new(params[:alumno])\n @alumno.save\n @alumnos = Alumno.asignados(@alumno.maestra_id)\n @maestra = @alumno.maestra\n respond_with @alumno\n end", "def create\n @ministerio = Ministerio.new(params[:ministerio])\n\n respond_to do |format|\n if @ministerio.save\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully created.' }\n format.json { render json: @ministerio, status: :created, location: @ministerio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @manteni = Manteni.new(manteni_params)\n\n respond_to do |format|\n if @manteni.save\n format.html { redirect_to @manteni, notice: 'Manteni was successfully created.' }\n format.json { render :show, status: :created, location: @manteni }\n else\n format.html { render :new }\n format.json { render json: @manteni.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @morador = Morador.new(morador_params)\n @morador.ativo = true\n @morador.data_inclusao = DateTime.now\n respond_to do |format|\n if @morador.save\n format.html { redirect_to @morador, notice: 'Morador foi criado com sucesso!' }\n format.json { render :show, status: :created, location: @morador }\n else\n format.html { render :new }\n format.json { render json: @morador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reuniao = Reuniao.new(reuniao_params)\n @pautum=Pautum.new\n @reuniao.pautum =@pautum\n @reuniao.atum=Atum.new\n @reuniao.status=\"Preparação\"\n @pautum.status=\"Preparação\"\n \n respond_to do |format|\n if @reuniao.save\n @pautum.titulo=@reuniao.titulo\n @pautum.save\n format.html { redirect_to @reuniao, notice: 'Reuniao was successfully created.' }\n format.json { render :show, status: :created, location: @reuniao }\n else\n format.html { render :new }\n format.json { render json: @reuniao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quinto = Quinto.new(quinto_params)\n \n @quinto.anio = params[:anio]\n @quinto.mes = params[:mes]\n \n \n respond_to do |format|\n if @quinto.save\n format.html { redirect_to @quinto, notice: 'Quinto was successfully created.' }\n format.json { render :show, status: :created, location: @quinto }\n else\n format.html { render :new }\n format.json { render json: @quinto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @palabra = Palabra.new(params[:palabra])\n @palabra.significados = params[:significados] \n respond_to do |format|\n if @palabra.save\n format.html { redirect_to @palabra, notice: 'La palabra fue guardada correctamente.' }\n format.json { render json: @palabra, status: :created, location: @palabra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palabra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mencion = Mencion.new(params[:mencion])\n\n respond_to do |format|\n if @mencion.save\n format.html { redirect_to @mencion, notice: 'Mencion creada' }\n format.json { render json: @mencion, status: :created, location: @mencion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mencion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @motorista = Motorista.new(motorista_params)\n\n respond_to do |format|\n if @motorista.save\n format.html { redirect_to @motorista, notice: 'Motorista was successfully created.' }\n format.json { render :show, status: :created, location: @motorista }\n else\n format.html { render :new }\n format.json { render json: @motorista.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = Turma.new(turma_params)\n @turma.usuario = current_usuario\n @turma.turma_ativa = true\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to turmas_path, notice: 'Turma salva com sucesso.' }\n format.json { render :show, status: :created, location: @turma }\n else\n format.html { render :new }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n puts request.body.string\n\n if request.body.string.include? %q[\"id\"]\n render json: %q[{\"error\": \"No se puede crear usuario con id\"}], status: 400\n else\n @usuario = Usuario.new(usuario_params)\n #Tuve que hacerlo asi, pq por alguna razon no me dejaba de la forma tradicional!\n #@usuario = Usuario.new\n #@usuario.usuario = params[:usuario]\n #@usuario.nombre = params[:nombre]\n #@usuario.apellido = params[:apellido]\n #@usuario.twitter = params[:twitter]\n\n\n respond_to do |format|\n if @usuario.save\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully created.' }\n format.json { render :show, status: :created, location: @usuario }\n else\n #format.html { render :new }\n format.json { render json: @usuario.errors, status: 404}# status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @marca = Marca.new(marca_params)\n\n respond_to do |format|\n if @marca.save\n format.html { redirect_to '/marcas', notice: 'Registro Guardado' }\n format.json { render :show, status: :created, location: @marca }\n else\n format.html { render :new }\n format.json { render json: @marca.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jornada = Jornada.new(params[:jornada])\n\n respond_to do |format|\n if @jornada.save\n format.html { redirect_to jornadas_path, notice: 'La jornada se ha creado correctamente' }\n format.json { render json: @jornada, status: :created, location: @jornada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jornada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @materia = Materia.new(params[:materia])\n\n respond_to do |format|\n if @materia.save\n format.html { redirect_to @materia, notice: 'Materia was successfully created.' }\n format.json { render json: @materia, status: :created, location: @materia }\n else\n format.html { render action: \"new\" }\n format.json { render json: @materia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, notice: 'Premio was successfully created.' }\n format.json { render json: @premio, status: :created, location: @premio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @muneco = Muneco.new(muneco_params)\n\n respond_to do |format|\n if @muneco.save\n format.html { redirect_to @muneco, notice: 'Muneco was successfully created.' }\n format.json { render :show, status: :created, location: @muneco }\n else\n format.html { render :new }\n format.json { render json: @muneco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medicamento = Medicamento.new(params[:medicamento])\n\n respond_to do |format|\n if @medicamento.save\n format.html { redirect_to @medicamento, notice: 'Medicamento was successfully created.' }\n format.json { render json: @medicamento, status: :created, location: @medicamento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medicamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medico = Medico.new(medico_params)\n\n respond_to do |format|\n if @medico.save\n format.html { redirect_to @medico, notice: \"Medico criado com SUCESSO.\" }\n format.json { render :show, status: :created, location: @medico }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @medico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mineracao = Mineracao.new(mineracao_params)\n\n respond_to do |format|\n if @mineracao.save\n format.html { redirect_to @mineracao, notice: \"Mineracao was successfully created.\" }\n format.json { render :show, status: :created, location: @mineracao }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @mineracao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @apertura_moneda = AperturaMoneda.new(apertura_moneda_params)\n\n respond_to do |format|\n if @apertura_moneda.save\n format.html { redirect_to @apertura_moneda, notice: 'Apertura moneda was successfully created.' }\n format.json { render :show, status: :created, location: @apertura_moneda }\n else\n format.html { render :new }\n format.json { render json: @apertura_moneda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_pregunta = TipoPregunta.new(params[:tipo_pregunta])\n\n if @tipo_pregunta.save\n render json: @tipo_pregunta, status: :created, location: @tipo_pregunta\n else\n render json: @tipo_pregunta.errors, status: :unprocessable_entity\n end\n end", "def create \n @lancamentorapido = Lancamentorapido.new(params[:lancamentorapido])\n \n #Validações padrão\n @lancamentorapido.tipo = :receita if @lancamentorapido.tipo.blank?\n @lancamentorapido.valor = 0 if @lancamentorapido.valor.blank? \n \n respond_to do |format|\n if @lancamentorapido.save\n format.html { redirect_to lancamentorapidos_path, notice: 'Lancamento was successfully created.' } \n# format.html { redirect_to '/lancamentorapidos'}\n format.json { render json: lancamentorapidos_path, status: :created, location: @lancamentorapido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lancamentorapido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @materia = Materia.new(params[:materia])\n\n respond_to do |format|\n if @materia.save\n format.html { redirect_to @materia, notice: 'La materia ha sido registrada.' }\n format.json { render json: @materia, status: :created, location: @materia }\n else\n @docentes = Docente.find(:all)\n @cursos = Curso.find(:all)\n format.html { render action: \"new\" }\n format.json { render json: @materia.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mensagem = @campanha.mensagens.create(mensagem_params)\n\n @mensagem.enviada = false\n\n respond_to do |format|\n if @mensagem.save\n format.html do\n redirect_to campanha_mensagem_path(@campanha, @mensagem), notice: {\n type: 'info',\n message: 'Mensagem adicionada com sucesso.'\n }\n end\n format.json { render :show, status: :created, location: @mensagem }\n else\n format.html { render :new }\n format.json { render json: @mensagem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mueble = Mueble.new(mueble_params)\n \n\n respond_to do |format|\n if @mueble.save\n #@modelo = @mueble.modelos.new\n #@modelo.nombre = 'Base'\n #@modelo.codigo=@mueble.nombre.concat('-BASE')\n #@modelo.descripcion= 'Modelo BASE automático (creado al crear el mueble base)' \n #@modelo.save\n format.html { redirect_to @mueble, notice: 'Se ha creado el mueble correctamente' }\n format.json { render :show, status: :created, location: @mueble }\n else\n format.html { render :new }\n format.json { render json: @mueble.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sugerencia = Sugerencia.new(params[:sugerencia])\n\n respond_to do |format|\n if @sugerencia.save\n format.html { redirect_to @sugerencia, :notice => 'Sugerencia was successfully created.' }\n format.json { render :json => @sugerencia, :status => :created, :location => @sugerencia }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sugerencia.errors, :status => :unprocessable_entity }\n end\n end\n end", "def creacion\n fiesta = Fiesta.new (params[:id])\n if Fiesta.save\n puts \"su fiesta a sido registrada\"\n else \n puts \"su fiesta no a sido registrada\"\n end\n render = json: fiesta \n end", "def create\n @municipio_de_la_preparatoria_o_universidad_de_origen = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.new(params[:municipio_de_la_preparatoria_o_universidad_de_origen])\n\n respond_to do |format|\n if @municipio_de_la_preparatoria_o_universidad_de_origen.save\n format.html { redirect_to @municipio_de_la_preparatoria_o_universidad_de_origen, notice: 'Municipio de la preparatoria o universidad de origen was successfully created.' }\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origen, status: :created, location: @municipio_de_la_preparatoria_o_universidad_de_origen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, @mesasredonda\n @mesasredonda = Mesasredonda.new(params[:mesasredonda])\n\n respond_to do |format|\n if @mesasredonda.save\n format.html { redirect_to @mesasredonda, notice: 'Mesa redonda cadastrada com sucesso.' }\n format.json { render json: @mesasredonda, status: :created, location: @mesasredonda }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mesasredonda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n respond_to do |format|\n if @divpa.save\n format.html { redirect_to @divpa, notice: 'Municipio creado exitosamente.' }\n format.json { render :show, status: :created, location: @divpa }\n else\n format.html { render :new }\n format.json { render json: @divpa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reconocimiento = Reconocimiento.new(params[:reconocimiento])\n\n respond_to do |format|\n if @reconocimiento.save\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully created.' }\n format.json { render :json => @reconocimiento, :status => :created, :location => @reconocimiento }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n seleccionarMenu(:juzgados)\n @juzgado = Juzgado.new(params[:juzgado])\n\n respond_to do |format|\n if @juzgado.save\n format.html { redirect_to @juzgado, notice: 'Juzgado fue creado satisfactoriamente.' }\n format.json { render json: @juzgado, status: :created, location: @juzgado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @juzgado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @posto = Posto.new(params[:posto])\n\n respond_to do |format|\n if @posto.save\n format.html { redirect_to @posto, notice: 'Posto de Saude cadastrado com sucesso' }\n format.json { render json: @posto, status: :created, location: @posto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @posto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ministrante = Ministrante.new(ministrante_params)\n\n respond_to do |format|\n if @ministrante.save\n format.html { redirect_to @ministrante, notice: 'Ministrante was successfully created.' }\n format.json { render :show, status: :created, location: @ministrante }\n else\n format.html { render :new }\n format.json { render json: @ministrante.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n client = Cliente.new\n\n client.nombre = params[:nombre]\n client.cedula = params[:cedula]\n client.pagina = params[:pagina]\n\n client.dirrecion = params[:dirrecion]\n client.telefono = params[:telefono]\n \n client.sector = params[:sector]\n \n\n if client.save\n \n\n render(json: client,status: 201 ,location: client)\n else\n\n render(json: client.errors,status: 422 )\n\n end\n end", "def create\n @objetos_mensura = ObjetosMensura.new(objetos_mensura_params)\n\n respond_to do |format|\n if @objetos_mensura.save\n format.html { redirect_to @objetos_mensura, notice: 'Objetos mensura was successfully created.' }\n format.json { render :show, status: :created, location: @objetos_mensura }\n else\n format.html { render :new }\n format.json { render json: @objetos_mensura.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @departamento = Departamento.new(departamento_params)\n\n if @departamento.save\n render json: @departamento, status: :created, location: @departamento\n else\n render json: @departamento.errors, status: :unprocessable_entity\n end\n end", "def create\n @orador = Orador.new(params[:orador])\n\n respond_to do |format|\n if @orador.save\n format.html { redirect_to @orador, notice: 'Orador was successfully created.' }\n format.json { render json: @orador, status: :created, location: @orador }\n else\n format.html { render action: \"new\" }\n format.json { render json: @orador.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @panneau = Panneau.new(panneau_params)\n\n respond_to do |format|\n if @panneau.save\n format.html { redirect_to @panneau, notice: 'Panneau was successfully created.' }\n format.json { render :show, status: :created, location: @panneau }\n else\n format.html { render :new }\n format.json { render json: @panneau.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def create\n @estabelecimento = Estabelecimento.new(estabelecimento_params)\n @usuario = Usuario.find(usuario_params[:id])\n @estabelecimento_usuario = EstabelecimentosUsuario.create(estabelecimento: @estabelecimento, usuario: @usuario, ic_criador: true)\n\n respond_to do |format|\n if @estabelecimento.save\n format.html { redirect_to @estabelecimento, notice: 'Estabelecimento was successfully created.' }\n format.json { render json: @estabelecimento }\n else\n format.html { render :new }\n format.json { render json: @estabelecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @motivobaja = MotivoBaja.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivobaja }\n end\n end", "def create\n @monnaie = Monnaie.new(params[:monnaie])\n\n respond_to do |format|\n if @monnaie.save\n format.html { redirect_to @monnaie, notice: 'Monnaie was successfully created.' }\n format.json { render json: @monnaie, status: :created, location: @monnaie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monnaie.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medida = Medida.new(params[:medida])\n\n respond_to do |format|\n if @medida.save\n format.html { redirect_to @medida, notice: 'Medida se ha creado con éxito.' }\n format.json { render json: @medida, status: :created, location: @medida }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unidade_medida = UnidadeMedida.new(params[:unidade_medida])\n\n respond_to do |format|\n if @unidade_medida.save\n format.html { redirect_to @unidade_medida, notice: 'Unidade medida foi criado com sucesso.' }\n format.json { render json: @unidade_medida, status: :created, location: @unidade_medida }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unidade_medida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mascotum = Mascotum.new(mascotum_params)\n @mascotum.entrada = \"\"+ params[:entrada][:day] +'/' +params[:entrada][:month] +'/' +params[:entrada][:year]\n @mascotum.salida = \"\"+ params[:salida][:day] +'/' +params[:salida][:month] +'/' +params[:salida][:year]\n respond_to do |format|\n if @mascotum.save\n format.html { redirect_to @mascotum, notice: 'Mascota creada exitosamente' }\n format.json { render :show, status: :created, location: @mascotum }\n else\n format.html { render :new }\n format.json { render json: @mascotum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jugador = Jugador.find_by(id: params[:pago][:jugador_id])\n @pago = @jugador.pagos.build(pago_params)\n #@pago.jugador_id = params[:jugador_id]\n\n respond_to do |format|\n if @pago.save\n format.html { redirect_to jugadores_path, notice: 'Se ha registrado exitosamente el pago.' }\n format.json { render :show, status: :created, location: @pago }\n else\n format.html { render :new }\n format.json { render json: @pago.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @misione = Misione.new(misione_params)\n\n respond_to do |format|\n if @misione.save\n format.html { redirect_to @misione, notice: 'Misione was successfully created.' }\n format.json { render :show, status: :created, location: @misione }\n else\n format.html { render :new }\n format.json { render json: @misione.errors, status: :unprocessable_entity }\n end\n end\n end", "def manutencao_params\n params.require(:manutencao).permit(:nome, :serie, :razao, :modelo, :email, :telefone, :estado, :cidade, :solicitacao)\n end", "def create\n @remito = Remito.new(params[:remito])\n\n respond_to do |format|\n if @remito.save\n format.html { redirect_to @remito, notice: 'Remito was successfully created.' }\n format.json { render json: @remito, status: :created, location: @remito }\n else\n format.html { render action: \"new\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @veiculo_motorista = VeiculoMotorista.new(veiculo_motorista_params)\n\n respond_to do |format|\n if @veiculo_motorista.save\n format.html { redirect_to @veiculo_motorista, notice: 'Veiculo motorista was successfully created.' }\n format.json { render :show, status: :created, location: @veiculo_motorista }\n else\n format.html { render :new }\n format.json { render json: @veiculo_motorista.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n {:numero_parcelas=>@numero_parcelas}\n @matricula = Matricula.new(matricula_params)\n\n respond_to do |format|\n if @matricula.save\n format.html { redirect_to @matricula, notice: 'Matricula was successfully created.' }\n format.json { render :show, status: :created, location: @matricula }\n else\n format.html { render :new }\n format.json { render json: @matricula.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @medio_pago = MedioPago.new({ :medio_pago => params[:medio_pago], :odontologo_id => params[:odontologo_id] })\n #@medio_pago = MedioPago.new(params[:medio_pago])\n\n respond_to do |format|\n if @medio_pago.save\n format.html { redirect_to @medio_pago, notice: 'Medio pago was successfully created.' }\n format.json { render json: @medio_pago, status: :created, location: @medio_pago }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medio_pago.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:pseudo_administrateur, :email_administrateur, :motDePasse_administrateur)\n ajout = AdministrateurService.instance.creerNouveauAdmin(params[:pseudo_administrateur], params[:email_administrateur], params[:motDePasse_administrateur])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n @unidad_medida.user_id = current_user.id\n respond_to do |format|\n if @unidad_medida.save\n format.html { redirect_to @unidad_medida, notice: 'Unidad medida was successfully created.' }\n format.json { render :show, status: :created, location: @unidad_medida }\n else\n format.html { render :new }\n format.json { render json: @unidad_medida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unidad_medida.user_id = current_user.id\n respond_to do |format|\n if @unidad_medida.save\n format.html { redirect_to @unidad_medida, notice: 'Unidad medida was successfully created.' }\n format.json { render :show, status: :created, location: @unidad_medida }\n else\n format.html { render :new }\n format.json { render json: @unidad_medida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agente = Agente.new(agente_params)\n @agente.estado_agente_id = 1\n\n respond_to do |format|\n if@agente.save\n format.html { redirect_to new_agente_dato_laboral_path(@agente), notice: 'El agente fué creado exitosamente.' }\n format.json { render :show, status: :created, locatin: @agente }\n else\n cargar_datos_estaticos\n format.html { render :new }\n format.json { render json: @agente.errors, status: :unprocessble_entity }\n end\n end\n end", "def create\n @basico_marca = Basico::Marca.new(basico_marca_params)\n\n respond_to do |format|\n if @basico_marca.save\n format.html { redirect_to @basico_marca, notice: 'Marca was successfully created.' }\n format.json { render :show, status: :created, location: @basico_marca }\n else\n format.html { render :new }\n format.json { render json: @basico_marca.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relacion_articulo_medida = RelacionArticuloMedida.new(params[:relacion_articulo_medida])\n\n respond_to do |format|\n if @relacion_articulo_medida.save\n format.html { redirect_to @relacion_articulo_medida, notice: 'Relacion articulo medida was successfully created.' }\n format.json { render json: @relacion_articulo_medida, status: :created, location: @relacion_articulo_medida }\n else\n format.html { render action: \"new\" }\n format.json { render json: @relacion_articulo_medida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @responsavel = Responsavel.new(responsavel_params)\n\n if @responsavel.save\n render json: @responsavel, status: :created, location: @responsavel\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end", "def create\n @orcamento = Orcamento.new(orcamento_params)\n\n respond_to do |format|\n if @orcamento.save\n format.html { redirect_to @orcamento, notice: 'Orcamento criado com sucesso!' }\n format.json { render :show, status: :created, location: @orcamento }\n else\n format.html { render :new }\n format.json { render json: @orcamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @mercado_metum = MercadoMetum.new\n estrategia_promocional=@mercado_metum.estrategia_promocionals.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mercado_metum }\n end\n end", "def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n respond_to do |format|\n if @respuesta.save\n format.html { redirect_to @respuesta, notice: 'Respuesta was successfully created.' }\n format.json { render json: @respuesta, status: :created, location: @respuesta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @respuesta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mantenimiento = Mantenimiento.new(mantenimiento_params)\n\n respond_to do |format|\n if @mantenimiento.save\n format.html { redirect_to @mantenimiento, notice: 'Mantenimiento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mantenimiento }\n else\n format.html { render action: 'new' }\n format.json { render json: @mantenimiento.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.67477256", "0.6739276", "0.6739165", "0.6694551", "0.6689389", "0.6677803", "0.66533107", "0.6601493", "0.6569048", "0.65583456", "0.65311676", "0.6509675", "0.64973515", "0.6495338", "0.6489573", "0.64755064", "0.6461316", "0.64568335", "0.6423191", "0.6420336", "0.64185107", "0.6395331", "0.6385518", "0.63841295", "0.6369744", "0.63640064", "0.6337704", "0.6333137", "0.6321725", "0.6321227", "0.63175344", "0.6316596", "0.63127583", "0.6311893", "0.6310237", "0.6309407", "0.63046205", "0.62979704", "0.6283973", "0.6282823", "0.6278703", "0.62754005", "0.6260157", "0.62511116", "0.62419826", "0.6238949", "0.6235757", "0.6232904", "0.6219742", "0.6216993", "0.6214582", "0.62117386", "0.6210298", "0.62047297", "0.62001383", "0.619627", "0.61929506", "0.6190934", "0.61900735", "0.6183224", "0.61826634", "0.617835", "0.6177527", "0.61720985", "0.61704755", "0.61702186", "0.6166884", "0.6164978", "0.6164917", "0.61630553", "0.6160505", "0.6157952", "0.6157584", "0.61552745", "0.6154938", "0.615318", "0.6152578", "0.6150262", "0.61484355", "0.6137948", "0.61337566", "0.61336684", "0.6133129", "0.6131105", "0.6128178", "0.6127708", "0.61247635", "0.6116932", "0.61165506", "0.611113", "0.6111096", "0.6111096", "0.6109184", "0.610492", "0.6098988", "0.60966015", "0.6094197", "0.6094142", "0.60937774", "0.60926884" ]
0.6381713
24
PATCH/PUT /mercadoria/1 PATCH/PUT /mercadoria/1.json
def update respond_to do |format| if @mercadorium.update(mercadorium_params) format.html { redirect_to @mercadorium, notice: 'Mercadorium was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @mercadorium.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @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 @metodologia.update(metodologia_params)\n format.html { redirect_to @metodologia, notice: 'Metodologia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @metodologia.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @oferta = Oferta.find(params[:id])\n\n respond_to do |format|\n if @oferta.update_attributes(params[:oferta])\n format.html { redirect_to [:admin, @oferta], :notice => 'Exemplo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @oferta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mapeamento = Mapeamento.find(params[:id])\n\n respond_to do |format|\n if @mapeamento.update_attributes(params[:mapeamento])\n format.html { redirect_to @mapeamento, notice: 'Mapeamento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mapeamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.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 @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 @municao.update(municao_params)\n format.html { redirect_to @municao, notice: 'A Munição foi editada com sucesso!' }\n format.json { render :show, status: :ok, location: @municao }\n else\n format.html { render :edit }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mutacao = Mutacao.find(params[:id])\n\n respond_to do |format|\n if @mutacao.update_attributes(params[:mutacao])\n format.html { redirect_to @mutacao, notice: 'Mutacao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mutacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @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 @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.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 @mensagem.update(mensagem_params)\n format.html { redirect_to @mensagem, notice: 'Mensagem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mensagem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n retorno = {erro: \"322\" ,body: \"\"}\n if @usuario.update(valid_request?)\n retorno = {erro: \"000\", body: {evento_id: @usuario.id, usuario_nome: @usuario.nome}}\n end\n render json: retorno.to_json\n end", "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @voluntario.update(voluntario_params) and @voluntario.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @voluntario, notice: 'Voluntario was successfully updated.' }\n format.json { render :show, status: :ok, location: @voluntario }\n else\n format.html { render :edit }\n format.json { render json: @voluntario.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n respond_to do |format|\n if @ocorrencia.update(ocorrencia_params)\n format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ocorrencia.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @empresa.update(empresa_params) and @empresa.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @empresa, notice: 'Empresa was successfully updated.' }\n format.json { render :show, status: :ok, location: @empresa }\n else\n format.html { render :edit }\n format.json { render json: @empresa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n if @remito.update_attributes(params[:remito])\n format.html { redirect_to @remito, notice: 'Remito was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @remito.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_merc.update(tipo_merc_params)\n format.html { redirect_to @tipo_merc, notice: 'Tipo merc was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_merc }\n else\n format.html { render :edit }\n format.json { render json: @tipo_merc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @aroma = Aroma.find(params[:id])\n\n respond_to do |format|\n if @aroma.update_attributes(params[:aroma])\n format.html { redirect_to @aroma, notice: 'Aroma was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @aroma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @telefono.update(telefono_params)\n format.html { redirect_to @telefono, notice: 'Telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @telefono }\n else\n format.html { render :edit }\n format.json { render json: @telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @mesasredonda\n @mesasredonda = Mesasredonda.find(params[:id])\n\n respond_to do |format|\n if @mesasredonda.update_attributes(params[:mesasredonda])\n format.html { redirect_to @mesasredonda, notice: 'Mesa redonda modificada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mesasredonda.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @municipio.update(municipio_params) and @municipio.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @municipio, notice: 'Municipio was successfully updated.' }\n format.json { render :show, status: :ok, location: @municipio }\n else\n format.html { render :edit }\n format.json { render json: @municipio.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 @materia = Materia.find(params[:id])\n\n if @materia.update(params[:materia])\n head :no_content\n else\n render json: @materia.errors, status: :unprocessable_entity\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @receipe = Receipe.find(params[:id])\n\n respond_to do |format|\n if @receipe.update_attributes(params[:receipe])\n format.html { redirect_to @receipe, notice: 'Receipe was successfully updated.' }\n format.json { head :no_content }\n else\n @receipe.fix_highest_aroma_percentage!\n format.html do\n @selectable_aromas = Aroma.all\n render action: \"edit\"\n end\n format.json { render json: @receipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rotina.update(rotina_params)\n format.html { redirect_to rotinas_path, notice: 'Rotina atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rotina.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contador.update(contador_params)\n format.html { redirect_to @contador, notice: 'Contador was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mundo.update(mundo_params)\n format.html { redirect_to @mundo, notice: 'Mundo was successfully updated.' }\n format.json { render :show, status: :ok, location: @mundo }\n else\n format.html { render :edit }\n format.json { render json: @mundo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @municipio = Municipio.find(params[:id])\n\n respond_to do |format|\n if @municipio.update_attributes(params[:municipio])\n format.html { redirect_to @municipio, notice: 'Municipio atualizado com sucesso!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @municipio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.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 @estado_remate.update(estado_remate_params)\n format.html { redirect_to @estado_remate, notice: 'Estado remate was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @estado_remate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @motivobaja = MotivoBaja.find(params[:id])\n\n respond_to do |format|\n if @motivobaja.update(motivo_baja_params)\n format.html { redirect_to @motivobaja, notice: 'Motivo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @motivobaja.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 @remuneracao.update(remuneracao_params)\n format.html { redirect_to @remuneracao, notice: 'Remuneracao was successfully updated.' }\n format.json { render :show, status: :ok, location: @remuneracao }\n else\n format.html { render :edit }\n format.json { render json: @remuneracao.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 @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @modelo = Modelo.find(params[:id])\n\n respond_to do |format|\n if @modelo.update_attributes(params[:modelo])\n format.html { redirect_to @modelo, notice: 'Modelo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @modelo.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 @persona = Persona.find(params[:id])\n \n respond_to do |format|\n if @persona.update_attributes(params[:persona])\n format.json { head :ok }\n else\n format.json { render :json => @persona.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def update\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n if @reconocimiento.update_attributes(params[:reconocimiento])\n format.html { redirect_to @reconocimiento, :notice => 'Reconocimiento was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @reconocimiento.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ejemplo.update(ejemplo_params)\n format.html { redirect_to @ejemplo, notice: 'Ejemplo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ejemplo }\n else\n format.html { render :edit }\n format.json { render json: @ejemplo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mario.update(mario_params)\n format.html { redirect_to @mario, notice: 'Mario was successfully updated.' }\n format.json { render :show, status: :ok, location: @mario }\n else\n format.html { render :edit }\n format.json { render json: @mario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @responsavel = Responsavel.find(params[:id])\n\n if @responsavel.update(responsavel_params)\n head :no_content\n else\n render json: @responsavel.errors, status: :unprocessable_entity\n end\n end", "def update\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n if @sistema.update_attributes(params[:sistema])\n format.html { redirect_to @sistema, notice: 'Sistema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sistema.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @obra.update(obra_params)\n format.html { redirect_to @obra, notice: 'Obra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @operador.update(operador_params)\n format.html { redirect_to @operador, notice: 'Operador was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\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 { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\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 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 @protocolo.update(protocolo_params)\n addlog(\"Protocolo alterado\")\n format.html { redirect_to @protocolo, notice: 'Protocolo foi atualizado.' }\n format.json { render :show, status: :ok, location: @protocolo }\n else\n format.html { render :edit }\n format.json { render json: @protocolo.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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 respond_to do |format|\n if @manutencao.update(manutencao_params)\n format.html { redirect_to ajudas_path, notice: 'Manutencao was successfully updated.' }\n format.json { render :show, status: :ok, location: @manutencao }\n else\n format.html { render :edit }\n format.json { render json: @manutencao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(carpeta_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Carpeta was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @alumno.update(alumno_params)\n format.html { redirect_to grupos_path, notice: '#datos actualizados' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @alumno.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @preparar_mate = @producto.preparar_mates.find(params[:id])\n respond_to do |format|\n if @preparar_mate.update(preparar_mate_params)\n format.html { redirect_to empresa_producto_preparar_mates_path, notice: 'Preparar mate was successfully updated.' }\n format.json { render :show, status: :ok, location: @preparar_mate }\n else\n format.html { render :edit }\n format.json { render json: @preparar_mate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @personaje = Personaje.find(params[:id])\n\n respond_to do |format|\n if @personaje.update_attributes(params[:personaje])\n format.html { redirect_to @personaje, notice: 'Personaje was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @personaje.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @makrana_marble.update(makrana_marble_params)\n format.html { redirect_to @makrana_marble, notice: 'Marble product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @makrana_marble.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @municipio = Municipio.find(params[:id])\n\n respond_to do |format|\n if @municipio.update_attributes(params[:municipio])\n format.html { redirect_to @municipio, notice: 'Municipio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @municipio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @resa.update(resa_params)\n format.html { redirect_to edit_resa_path(@resa), notice: 'Resa was successfully updated.' }\n format.json { render json: @resa, status: :accepted }\n\n else\n format.html { render action: 'edit' }\n format.json { render json: @resa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cargo_eleicao = CargoEleicao.find(params[:id])\n\n respond_to do |format|\n if @cargo_eleicao.update_attributes(params[:cargo_eleicao])\n format.html { redirect_to @cargo_eleicao, notice: 'Cargo eleicao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cargo_eleicao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @modelo.update(modelo_params)\n format.html { redirect_to @modelo, notice: 'Modelo foi editado com sucesso.' }\n format.json { render :show, status: :ok, location: @modelo }\n else\n format.html { render :edit }\n format.json { render json: @modelo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(objeto_params)\n format.html { redirect_to @objeto, notice: 'Objeto was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario = Usuario.find_by_id(params[:id])\n if @usuario.nil?\n render :json => {:error => \"Usuario no encontrado\"}.to_json, :status => 404\n\n #render :json => {:error => \"id no es modificable\"}.to_json, :status => 400\n else\n if usuario_params.count==1\n respond_to do |format|\n # format.json { render json: usuario_params.count}\n if @usuario.update(usuario_params)\n #format.json { render json: @usuario}\n\n #format.html { redirect_to @usuario, notice: 'Usuario was successfully updated.' }\n #el segundo\n format.json { render :show, status: :ok, location: @usuario }\n end\n end\n elsif usuario_params.count==0\n # JSON.parse(usuario_params)\n respond_to do |format|\n format.json { render :json => {:error => \"id no es modificable\"}.to_json, :status => 400 }\n end\n else\n respond_to do |format|\n format.json { render :json => {:error => \"La modificación ha fallado\"}.to_json, :status => 500 }\n end\n end\n end\n end", "def update\n @formulario = Formulario.find(params[:id])\n\n respond_to do |format|\n if @formulario.update_attributes(params[:formulario])\n format.html { redirect_to @formulario, notice: 'Formulario was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nombr_comune.update(nombr_comune_params)\n format.html { redirect_to @nombr_comune, notice: 'Nombre comun was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nombr_comune.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n respond_to do |format|\n if @basico_marca.update(basico_marca_params)\n format.html { redirect_to @basico_marca, notice: 'Marca was successfully updated.' }\n format.json { render :show, status: :ok, location: @basico_marca }\n else\n format.html { render :edit }\n format.json { render json: @basico_marca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @parola.update(parola_params)\n format.html { redirect_to parolas_url, notice: 'Parola was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parola.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_ministerio.update(sivic_ministerio_params)\r\n format.html { redirect_to @sivic_ministerio, 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_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @atracao = Atracao.find(params[:id])\n\n respond_to do |format|\n if @atracao.update_attributes(params[:atracao])\n format.html { redirect_to @atracao, :notice => 'Atracao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @atracao.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @colaborador.update(colaborador_params)\n format.html { redirect_to @colaborador, notice: 'Colaborador atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @colaborador.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :ok }\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 pai = params[:pai] ? Conta.find_by_id(params[:pai]): nil\n \n respond_to do |format|\n if @conta.update(nome: conta_params[:nome], status: conta_params[:status], pai: pai) \n #format.json { render :show, status: :ok, location: @conta }\n format.json { render json: @conta.to_json, status: :ok }\n else \n format.json { render json: @conta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #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 @comentario = Comentario.find(params[:id])\n\n respond_to do |format|\n if @comentario.update_attributes(params[:comentario])\n format.html { redirect_to @comentario, notice: 'Comentario was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comentario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @celulare.update(celulare_params)\n format.html { redirect_to @celulare, notice: 'Celulare was successfully updated.' }\n format.json { render :show, status: :ok, location: @celulare }\n else\n format.html { render :edit }\n format.json { render json: @celulare.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ministrante.update(ministrante_params)\n format.html { redirect_to @ministrante, notice: 'Ministrante was successfully updated.' }\n format.json { render :show, status: :ok, location: @ministrante }\n else\n format.html { render :edit }\n format.json { render json: @ministrante.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cliente.update(cliente_params)\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @caixa = Caixa.find(params[:id])\n\n respond_to do |format|\n if @caixa.update_attributes(params[:caixa])\n format.html { redirect_to @caixa, notice: 'Caixa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @precio_boleto.update(precio_boleto_params)\n format.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @motivo.update(motivo_params)\n format.html { redirect_to @motivo, notice: 'Motivo was successfully updated.' }\n format.json { render :show, status: :ok, location: @motivo }\n else\n format.html { render :edit }\n format.json { render json: @motivo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @campeonato.update(campeonato_params)\n format.html { redirect_to @campeonato, notice: 'Campeonato was successfully updated.' }\n format.json { render :show, status: :ok, location: @campeonato }\n else\n format.html { render :edit }\n format.json { render json: @campeonato.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" ]
[ "0.6534382", "0.6483613", "0.6428888", "0.6423829", "0.6415252", "0.6411362", "0.63959414", "0.638086", "0.6361599", "0.6352019", "0.6350865", "0.6341838", "0.63382775", "0.6337906", "0.633349", "0.63049495", "0.6301073", "0.62753534", "0.62697166", "0.62685114", "0.62628907", "0.62599754", "0.62447417", "0.6228926", "0.62278056", "0.62278056", "0.6225956", "0.62252796", "0.6216975", "0.6216965", "0.6212997", "0.62049", "0.6202209", "0.6199152", "0.6196748", "0.61921114", "0.61864734", "0.6184127", "0.6184014", "0.61820346", "0.61703944", "0.61693966", "0.6168483", "0.61651355", "0.6157881", "0.61533546", "0.61452806", "0.61430055", "0.61401844", "0.6138052", "0.61353874", "0.6135127", "0.6131587", "0.6127487", "0.6125786", "0.6124452", "0.61215526", "0.6115041", "0.6114799", "0.6112051", "0.61106026", "0.61103964", "0.61103964", "0.61102253", "0.61060154", "0.61055064", "0.61051196", "0.6104549", "0.6103732", "0.61022794", "0.60992587", "0.6098998", "0.60985535", "0.6097114", "0.60938746", "0.60935897", "0.6091391", "0.6091391", "0.6088948", "0.60889435", "0.6087098", "0.60865974", "0.6086447", "0.6084028", "0.60823625", "0.60792416", "0.6077075", "0.6076079", "0.6075659", "0.60727644", "0.60718983", "0.6067628", "0.60661966", "0.6063356", "0.6058273", "0.6057651", "0.60570043", "0.60567206", "0.6056227", "0.6054266" ]
0.6128896
53
DELETE /mercadoria/1 DELETE /mercadoria/1.json
def destroy @mercadorium.destroy respond_to do |format| format.html { redirect_to mercadoria_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 @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 @remito = Remito.find(params[:id])\n @remito.destroy\n\n respond_to do |format|\n format.html { redirect_to remitos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ocorrencia.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencias_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to reconocimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @imobiliaria = Imobiliaria.find(params[:id])\r\n @imobiliaria.destroy\r\n\r\n respond_to do |format|\r\n format.json { head :no_content }\r\n end\r\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 @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 @metodologia.destroy\n respond_to do |format|\n format.html { redirect_to metodologias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mapeamento = Mapeamento.find(params[:id])\n @mapeamento.destroy\n\n respond_to do |format|\n format.html { redirect_to mapeamentos_url }\n format.json { head :no_content }\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 @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 @mutacao = Mutacao.find(params[:id])\n @mutacao.destroy\n\n respond_to do |format|\n format.html { redirect_to mutacaos_url }\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 @mensagem = Mensagem.find(params[:id])\n api_client.delete_object(@mensagem.post_id)\n @mensagem.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.js { head :ok }\n end\n end", "def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @razmer_go = RazmerGo.find(params[:id])\n @razmer_go.destroy\n\n respond_to do |format|\n format.html { redirect_to razmer_gos_url }\n format.json { head :no_content }\n end\n end", "def borrar \n\n fiesta.destroy\n render json: fiesta \n end", "def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end", "def 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 @receita_medica = ReceitaMedica.find(params[:id])\n @receita_medica.destroy\n\n respond_to do |format|\n format.html { redirect_to receita_medicas_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 @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 @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 @agronomiaquimica = Agronomiaquimica.find(params[:id])\n @agronomiaquimica.destroy\n\n respond_to do |format|\n format.html { redirect_to agronomiaquimicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 #--ADICIONADO\n @cliente.perfilclientes.destroy\n #--ADICIONADO\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 @orcamento.destroy\n respond_to do |format|\n format.html { redirect_to orcamentos_url, notice: 'Orçamento apagado com sucesso!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mantenimiento.destroy\n respond_to do |format|\n format.html { redirect_to mantenimientos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @veiculo = Veiculo.find(params[:id])\n @veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to veiculos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metodo = Metodo.find(params[:id])\n @metodo.destroy\n\n respond_to do |format|\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @municao.destroy\n respond_to do |format|\n format.html { redirect_to municaos_url, notice: 'A Munição foi deletada com sucesso!' }\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 @makrana_marble.destroy\n respond_to do |format|\n format.html { redirect_to makrana_marbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n\n respond_to do |format|\n format.html { redirect_to clientes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ordem_servico.destroy\n respond_to do |format|\n format.html { redirect_to ordem_servicos_url, notice: t('messages.cadastro_removido') }\n format.json { head :no_content }\n end\n end", "def destroy\n @midia.destroy\n\n respond_to do |format|\n format.html { redirect_to midias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @malarium.destroy\n respond_to do |format|\n format.html { redirect_to malaria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @novedad_mecanica.destroy\n respond_to do |format|\n format.html { redirect_to unidad_url(@unidad), notice: 'Novedad mecanica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contador.destroy\n respond_to do |format|\n format.html { redirect_to contadors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asociado = Asociado.find(params[:id])\n @asociado.destroy\n\n respond_to do |format|\n format.html { redirect_to asociados_url }\n format.json { head :ok }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @lancamentorapido = Lancamentorapido.find(params[:id])\n @lancamentorapido.destroy \n\n respond_to do |format|\n format.html { redirect_to lancamentorapidos_path }\n format.json { head :no_content }\n end\n end", "def delete\n unless possui_acesso?()\n return\n end\n @aviso = Aviso.find(params[:id])\n @aviso.destroy\n\n respond_to do |format|\n format.html { redirect_to avisos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mundo.destroy\n respond_to do |format|\n format.html { redirect_to mundos_url, notice: 'Mundo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @ministrante.destroy\n respond_to do |format|\n format.html { redirect_to ministrantes_url, notice: 'Ministrante was successfully destroyed.' }\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 @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 @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n head :no_content\n end", "def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @ocorrencium.destroy\n respond_to do |format|\n format.html { redirect_to ocorrencia_url, notice: 'Registro excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cliente = Cliente.find(params[:id])\n @cliente.destroy\n @crear = Clientesmkt.create_mikrotik\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 @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @requerimiento = Requerimiento.find(params[:id])\n @requerimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to requerimientos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @archivo = Archivo.find(params[:id])\n @archivo.destroy\n\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @merma_insumo.destroy\n respond_to do |format|\n format.html { redirect_to merma_insumos_url, notice: 'Merma insumo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @archivo.destroy\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @remocao = Remocao.find(params[:id])\n @remocao.destroy\n\n respond_to do |format|\n format.html { redirect_to(remocaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url, notice: 'Obra removida com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @respuestum.destroy\n respond_to do |format|\n format.html { redirect_to comentarios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sistema = Sistema.find(params[:id])\n @sistema.destroy\n\n respond_to do |format|\n format.html { redirect_to sistemas_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 @orador = Orador.find(params[:id])\n @orador.destroy\n\n respond_to do |format|\n format.html { redirect_to oradores_url }\n format.json { head :ok }\n end\n end", "def destroy\n @areco = Areco.find(params[:id])\n @areco.destroy\n\n respond_to do |format|\n format.html { redirect_to arecos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mario.destroy\n respond_to do |format|\n format.html { redirect_to marios_url, notice: 'Mario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @remuneracao.destroy\n respond_to do |format|\n format.html { redirect_to remuneracoes_url, notice: 'Remuneracao was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @farmacium.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @pedido.destroy\n respond_to do |format|\n format.html { redirect_to pedidos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @veiculo_motorista.destroy\n respond_to do |format|\n format.html { redirect_to veiculo_motoristas_url, notice: 'Veiculo motorista was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @atracao = Atracao.find(params[:id])\n @atracao.destroy\n\n respond_to do |format|\n format.html { redirect_to atracaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minicurso = Minicurso.find(params[:id])\n @minicurso.destroy\n\n respond_to do |format|\n format.html { redirect_to minicursos_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\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 @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 @aluno.destroy\n respond_to do |format|\n format.html { redirect_to alunos_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @amministrazione.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Amministrazione was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @operador.destroy\n respond_to do |format|\n format.html { redirect_to operadors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @redacao.destroy\n respond_to do |format|\n format.html { redirect_to redacaos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rango_fecha.destroy\n respond_to do |format|\n format.html { redirect_to rango_fechas_url, notice: 'Rango fecha was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @conta.destroy\n params[:id] = nil\n respond_to do |format|\n format.html { redirect_to contas_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end", "def destroy\n \t @motivobaja = MotivoBaja.find(params[:id])\n @motivobaja.destroy\n respond_with(@motivobaja)\n end" ]
[ "0.7356539", "0.7196844", "0.7193584", "0.7070339", "0.7066652", "0.7063075", "0.70554215", "0.7050196", "0.7041964", "0.7037224", "0.7035154", "0.70142454", "0.7003566", "0.6983386", "0.69828165", "0.69826126", "0.6982392", "0.69792145", "0.69763863", "0.6974049", "0.69692737", "0.6962261", "0.69608796", "0.6951947", "0.6949958", "0.69474494", "0.6940634", "0.69373775", "0.6935115", "0.6928101", "0.6922012", "0.69211847", "0.69199616", "0.6918042", "0.6912308", "0.6912308", "0.6912308", "0.6911639", "0.6911589", "0.6905471", "0.6902669", "0.69021875", "0.69015986", "0.6901088", "0.68962866", "0.68962824", "0.6891892", "0.6891761", "0.6891424", "0.6891424", "0.68911177", "0.6890696", "0.6890225", "0.68843305", "0.6882984", "0.68808144", "0.68646145", "0.6864441", "0.6860971", "0.6859695", "0.68567353", "0.6850007", "0.68483216", "0.6842058", "0.6840027", "0.6839801", "0.6839772", "0.6839641", "0.6836749", "0.6836708", "0.6835646", "0.68352914", "0.6834567", "0.68334556", "0.6832396", "0.6832251", "0.6831448", "0.6822698", "0.68226063", "0.6822602", "0.68186307", "0.68168926", "0.68161434", "0.6813625", "0.68128985", "0.6812066", "0.6812013", "0.68084675", "0.6805636", "0.68049365", "0.6802328", "0.6802219", "0.67984223", "0.6798264", "0.679652", "0.67956346", "0.67948", "0.6794598", "0.67943215", "0.67935693" ]
0.7224526
1
Use callbacks to share common setup or constraints between actions.
def set_mercadorium @mercadorium = Mercadorium.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!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def 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 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 before_action \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 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 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 setup(&blk)\n @setup_block = blk\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 callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); 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 duas1(action)\n action.call\n action.call\nend", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def call\n setup_context\n super\n end" ]
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", "0.5312988", "0.529798", "0.52968603", "0.52962637", "0.52577317", "0.5244704", "0.5236856", "0.5236856", "0.5236856", "0.5236856", "0.5236856", "0.5233461", "0.52322435", "0.5227552", "0.52224743", "0.5217851", "0.521241", "0.52069896", "0.5206555", "0.5176617", "0.51738507", "0.51725876", "0.51660734", "0.51605034", "0.51571786", "0.5152762", "0.5152164", "0.5151477", "0.5145819", "0.51408994", "0.5134412", "0.5114031", "0.5113695", "0.5113695", "0.5108603", "0.5107358", "0.5090405", "0.50889385", "0.50817686", "0.5081617", "0.50658226", "0.50551206", "0.5051746", "0.5049091", "0.5049091", "0.5034681", "0.5024972", "0.5021291", "0.5016024", "0.50134826", "0.50008893", "0.50000244", "0.4999155", "0.49907947", "0.49907947", "0.49853387", "0.49796683", "0.4979596", "0.49778128", "0.49673793", "0.49662578", "0.49587822", "0.4956063", "0.49550167", "0.49523485", "0.4951614", "0.49452996", "0.49442068", "0.49336892", "0.49306205", "0.49264124", "0.49259305", "0.4925823", "0.49229056", "0.4918999", "0.49171805", "0.49167436", "0.4916559", "0.49153692", "0.49148256" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def mercadorium_params params.require(:mercadorium).permit(:image, :fabricante, :nome, :descricao, :preco, :precoumcbm, :precomeiodevinte, :altura, :largura, :comprimento, :precofrete, :imposto, :precodevenda, :precodaconco, :vendamensal, :outroscustosdevenda, :precooriginal) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\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 reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\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 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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.6292164", "0.62917984", "0.62836355", "0.6242686", "0.6241917", "0.62210834", "0.6214862", "0.62125784", "0.619428", "0.617912", "0.617705", "0.61735916", "0.6163706", "0.61532795", "0.6152666", "0.6148062", "0.6123372", "0.61180484", "0.61088324", "0.6106139", "0.60925204", "0.608326", "0.60711503", "0.606551", "0.60216546", "0.6018924", "0.6015004", "0.60106766", "0.6008301", "0.6008301", "0.60028726", "0.60020626", "0.5999236", "0.59931505", "0.5993037", "0.59917194", "0.5982164", "0.5968051", "0.5960277", "0.5960268", "0.5960012", "0.59594494", "0.5954652", "0.5954304", "0.59440255", "0.59404963", "0.59404963", "0.59401006", "0.593522", "0.5932182", "0.5925528", "0.5924541", "0.5918796", "0.59123147", "0.5910144", "0.5909186", "0.5907257", "0.5899382", "0.5897783", "0.58972496", "0.58958495", "0.58948576", "0.5892734", "0.5888056", "0.58843875", "0.58818483", "0.5873746", "0.58700997", "0.5870056", "0.5869255", "0.58668107", "0.58662325", "0.5865003", "0.5862908", "0.5862406", "0.58614665", "0.5859661", "0.585562", "0.5855185", "0.58523446", "0.58504915" ]
0.0
-1
Pundit's core `authorize` helper always raises an error, but also lets the controller know an authorization has been performed. Sometimes it is preferrable to flag that an authorization check has been made, but return boolean rather than raise. So this uses an exception rescue for flow control, which is not optimal but fits nicely with the current API and doesn't cause serious breakage
def authorized?(record, query=nil) begin authorize(record, query) rescue Pundit::NotAuthorizedError false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize\n render :text => \"Authorization error\", :status => 401\n false\n end", "def authenticate!\n current_user ? true : raise(Pundit::NotAuthorizedError)\n end", "def authorized?(**args)\n super && (!defined?(Pundit) || current_user || raise(Pundit::NotAuthorizedError))\n end", "def authorize\n run_callbacks :authorize do\n\n policy = Pundit.policy!(context.fetch(:current_token), @model)\n permission = \"#{context.fetch(:current_action)}?\"\n\n unless policy.public_send(permission)\n raise Pundit::NotAuthorizedError.new(query:permission, record: @model, policy: policy)\n end\n end\n end", "def authorize\n (render :json => { :error => \"Authentication error\" }, :status => :unauthorized and return) unless User.current.present?\n authorized ? true : deny_access\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize_user!\n # binding.pry\n unless can?(:crud, @question)\n flash[:alert] = \"Access Denied!\"\n redirect_to root_path\n\n # `head` is a method similar to `render` or `redirect_to`. It finalizes\n # the response. However, it will add content to the response. It will simply\n # set the HTTP status of the response. (e.g. head :unauthorized sets the\n # the status code to 401)\n # For a list of available status code symbols to use with `head` go to:\n # http://billpatrianakos.me/blog/2013/10/13/list-of-rails-status-code-symbols/\n # head :unauthorized\n end\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def authorization_check\n raise Errors::UnauthorizedError.new unless current_user.present?\n end", "def authorize!\n unless authorized?\n flash[:error] = \"You are not authorized\"\n redirect_to '/'\n end\n end", "def authorize?\n unless admin?\n flash[:error] = \"unauthorized access\"\n redirect_to 'root' \n false\n end\n end", "def authorize\n if current_user.nil?\n flash[:danger] = \"Not authorized, please login first\"\n redirect_to login_url\n end\n end", "def authorize\n unless admin?\n flash[:error] = \"unauthorized access\"\n redirect_to home_path\n false\n end\n end", "def authorize\n return if current_user\n\n redirect_to login_url\n end", "def authorize_user\n if !user_signed_in? || !current_user.admin?\n raise ActionController::RoutingError.new(\"Not Found\")\n end\n end", "def authorize!\n\t\t\tredirect '/login' unless authorized?\n\t\tend", "def authorization_required\n authorized? || authorization_denied\n end", "def authorize!\n if current_user && current_user.clearance_level > 1\n return true\n else\n respond_to do |format|\n format.html do\n redirect_to main_app.new_session_path\n end\n format.json do\n render status: 403, nothing: true\n end\n end\n end\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def try_authorize!(question)\n authorize(question, policy_class: TestCasePolicy)\n end", "def authorize\n\t\tredirect_to '/login' unless current_user\n\tend", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n if session[:user_id] != 3\n raise AccessDenied\n #render \"public/404\", status: :not_found, layout: false\n end\n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def authorize_user!\n \n unless can?(:manage, @question)\n flash[:alert] = \"Access denied!\"\n redirect_to root_path\n end\n end", "def authorize?(user)\n true\n end", "def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end", "def authorize\n if current_user.nil?\n redirect_to login_path, alert: 'You must be logged in to access this page.'\n end\n end", "def login_required\n authorized? || throw(:halt, :access_denied)\n end", "def authorize\n if !current_user.has_role? :admin\n render plain:\"No access for you!\"\n end\n end", "def authorize\n redirect_to login_path, alert: 'You must be logged in to access this page.' if current_user.nil?\n end", "def authorize!(user)\n redirect '/not_authorized' unless authorized?(user)\nend", "def http_authorize \n redirect_to login_path, alert: 'Authorization required' if !logged_in? \n end", "def authorize\n debug 'authorize:'\n unless User.authorized? params[:controller], params[:action], params[:func]\n flash[:error] = I18n.t('general.Flash.NotAuth')\n debug 'authorize: not authorized'\n raise \"User not authorized\"\n end\n debug 'authorize: authorized'\n true\n rescue => err\n error 'authorize: ' + err.to_s\n redirect_to :controller => 'reservation', :action => 'list'\n end", "def login_required\n authorized? || throw(:halt, :access_denied)\n end", "def permit(current_context, record, action)\n Pundit.authorize(current_context, record, action)\n rescue Pundit::NotAuthorizedError\n false\n end", "def authorize?(*args)\n result = !!authorize(*args)\n yield if result && block_given?\n result\n end", "def check_authorization(**options)\n after_action(**options) do |controller|\n next if controller.instance_variable_defined?(:@_authorized)\n raise AuthorizationNotPerformed,\n 'This action failed the check_authorization because it does not authorize_resource. '\\\n 'Add skip_authorization_check to bypass this check.'\n end\n end", "def authorize\n if current_permission.allow?(params[:controller], params[:action], current_resource)\n # Authorized\n else\n session[:return_to] = request.original_url\n redirect_to login_url, error: (current_user ? t('authorization.error') : t('authorization.not_signed_in'))\n end\n end", "def authorize!\n redirect '/auth' unless authorized?\n end", "def authorize(action, model_object = nil)\n raise Pundit::NotAuthorizedError unless authorized?(action, model_object)\n end", "def authorize?(_user)\n true\n end", "def authorize?(_user)\n true\n end", "def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize_user\n if @user.present?\n # Pass the object @user to Pundit to check against @current_user\n authorize @user\n else\n authorize_users\n end\n end", "def bolt_failed_authorization #:nodoc:\n unauthorized if respond_to?(:unauthorized)\n redirect_to(request.env[\"HTTP_REFERER\"] ? :back : home_url) unless performed?\n return false\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if action is not public, force login\r\n return unless require_login \r\n # admin is always authorized\r\n return true if self.logged_in_user.admin?\r\n # if not admin, check membership permission \r\n @user_membership ||= Member.find(:first, :conditions => [\"user_id=? and project_id=?\", self.logged_in_user.id, @project.id]) \r\n if @user_membership and Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], @user_membership.role_id ) \r\n return true\t\t\r\n end\t\t\r\n render :nothing => true, :status => 403\r\n false\r\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def authorized?\n render nothing: true, status: :forbidden if !current_account\n end", "def authorization_checking\n authorize!(:authorization_checking,current_user) unless current_user.role?(:livia_admin) || current_user.role?(:lawfirm_admin)\n end", "def try_authorize\n authorize = Authorize.new(config, settings)\n authorize.configure\n end", "def authorize\n redirect_to :login unless user_signed_in?\n end", "def logged_in_authorize\n unless logged_in?\n unauthorized_access\n end\n end", "def authenticate_user!\n raise NotAuthorizedError unless user_logged_in?\n end", "def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end", "def authorized?\n domain_policy_class, domain_operation = DefaultOperationPolicy.authorization_components(self.class)\n\n raise Pundit::NotAuthorizedError,\n \"Missing authorization policy. \"\\\n \"Expected #{domain_policy_class} to be implemented, \"\\\n \"else override the #authorized? hook\" unless domain_policy_class.is_a? Class\n\n # TODO - figure out scoping of resources / records. Currently we pass a symbol of the action\n @policy = domain_policy_class.new(Current.user, domain_operation)\n @policy.public_send(domain_operation)\n end", "def authorize(action, subject)\n ability.authorize! action, subject\n rescue ::CanCan::AccessDenied\n Rails.logger.info I18n.t('errors.unauthorized', user: user, action: action, subject: subject)\n raise Forbidden\n end", "def authorize_superuser\n authorize\n redirect_to root_path and return unless current_user.is_superuser\n end", "def authorize_with(record, query = nil, devise_controller = nil)\n query ||= params[:action].to_s\n @_pundit_policy_authorized = true\n policy = policy(record)\n unless policy.public_send('general_policy', record, query, devise_controller)\n raise NotAuthorizedError.new(query: query, record: record, policy: policy)\n end\n true\n end", "def authorize_access_to(obj)\n unless authorized?(obj)\n raise Repia::Errors::Unauthorized\n end\n end", "def authorize\n redirect_to :root, alert: 'You must be logged in to view this page' if current_user.nil?\n end", "def require_login\n authorize_request || render_unathorized(\"Access denied\")\n end", "def admin_authorize\n unless admin?\n unauthorized_access\n end\n end", "def authorize\n redirect_to signup_path unless current_user\n end", "def check_authorization\n if current_user && current_user.admin_role.present?\n return true\n end\n render nothing: true, status: :unauthorized\n false\n end", "def authorize\n if (controller_name == 'region')\n return true\n end\n if (current_user.has_role?('admin')) # <-- admin is good. he need go not further.\n load_domain_config\n return true\n end\n\n if (!@config[:auth][controller_name].nil?) # <-- compare user's role with required_role on controller\n\n auth = @config[:auth][controller_name]\n\n # check if current_user has required_role\n if (!current_user.has_role?(auth[:required_role]))\n redirect_to(auth_url)\n #return false\n end\n end\n load_domain_config\n return true\n end", "def unauthorize!\n throw(:warden)\n end", "def require_login\n\t\tauthorize_request || render_unauthorized(\"Access Denied\")\n\tend", "def authorize\n if current_user.nil?\n redirect_to events_manager_index_path, :notice => \"Login to continue!\"\n return false\n else\n end \n end", "def authorize_author\n redirect_to '/login' unless self.user_access > 1 || current_user.access == 3\n end", "def authorized_or_raise!(&block)\n return_value = authorizer.authorized(&block)\n if return_value == nil || return_value == []\n raise Exceptions::EducatorNotAuthorized\n end\n return_value\n end", "def authorized_or_raise!(&block)\n return_value = authorizer.authorized(&block)\n if return_value == nil || return_value == []\n raise Exceptions::EducatorNotAuthorized\n end\n return_value\n end", "def authorize\n if !current_user.has_role? :admin\n render text:\"No Access For You!!!\"\n end\n end", "def authorize_admin\n redirect_to '/librarians/denied' unless current_user && current_user.admin?\n end", "def authorize!(failure_path=nil)\n redirect(failure_path ? failure_path : options.auth_failure_path) unless authenticated?\n end", "def authorize\n if !current_user\n flash[:alert] = \"Sign in to access that feature.\"\n redirect_to '/posts'\n end\n end", "def authorize!\n redirect '/' unless logged_in?\n end", "def authorize_user!\n if !current_user.present?\n render json: {error: 'No user error'}\n end\n end", "def pundit_authorize\n authorize [:admin, @testimonial||:testimonial]\n end", "def authorised?\n if current_user.role === 'SUPERVISOR' || current_user.role === 'ENGINEER'\n respond_to do |f|\n f.html { redirect_to root_path, alert: 'You are not authorised to access this page.' }\n end\n end\n end", "def authorize\r\n # check if action is allowed on public projects\r\n if @project.is_public? and Permission.allowed_to_public \"%s/%s\" % [ @params[:controller], @params[:action] ]\r\n return true\r\n end \r\n # if user not logged in, redirect to login form\r\n unless session[:user]\r\n store_location\r\n redirect_to(:controller => \"account\", :action => \"login\")\r\n return false\r\n end\r\n # if logged in, check if authorized \r\n if session[:user].admin? or Permission.allowed_to_role( \"%s/%s\" % [ @params[:controller], @params[:action] ], session[:user].role_for_project(@project.id) ) \r\n return true\t\t\r\n end\t\t\r\n flash[:notice] = \"Acces denied\"\r\n redirect_to(:controller => \"\")\r\n false\r\n end", "def authorize(access)\n @user = AuthorizeController.authorize(request)\n if @user == nil or not @user.has_access?(access)\n render status: :forbidden\n end\n end", "def authorize?(user)\n user && user.admin?\n end", "def authorize!(message = \"\")\n error!( message.presence || 'not authorized', 400) unless current_user.present?\n end", "def authorize\n redirect_to \"/log_in\", :alert => t('.need_to_be_logged_in') unless signed_in?\n end", "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 authorize(record, action = nil)\n action ||= guess_action!\n context[:pundit].send(:authorize, record, action)\n end", "def authorize\n end" ]
[ "0.6995548", "0.69605553", "0.6957514", "0.692206", "0.68917584", "0.68425024", "0.68425024", "0.68425024", "0.68248475", "0.6808626", "0.67907614", "0.67276007", "0.66958606", "0.66624707", "0.663759", "0.6618322", "0.6602031", "0.6591941", "0.6587434", "0.658231", "0.65583664", "0.65332335", "0.6524588", "0.650557", "0.650557", "0.650557", "0.650557", "0.650557", "0.650557", "0.650557", "0.650557", "0.64841884", "0.6479833", "0.64745516", "0.6469566", "0.6468668", "0.6463509", "0.643919", "0.6435181", "0.6432977", "0.64235896", "0.6416766", "0.6413015", "0.63918424", "0.6383781", "0.63799316", "0.6357355", "0.6331309", "0.63196284", "0.6319343", "0.630996", "0.630996", "0.62996024", "0.6299356", "0.62853175", "0.6271364", "0.6267962", "0.6267962", "0.6249026", "0.6244814", "0.62428015", "0.62385654", "0.62348646", "0.62268215", "0.6222187", "0.6221554", "0.6220368", "0.6209048", "0.6201327", "0.61967736", "0.61844385", "0.6177693", "0.6175679", "0.6170517", "0.6162292", "0.6162232", "0.61580914", "0.61441374", "0.6140335", "0.61367255", "0.6121222", "0.6115102", "0.61100286", "0.61100286", "0.61099946", "0.61003345", "0.6090633", "0.60791266", "0.60789293", "0.6077951", "0.60716355", "0.60692376", "0.60607094", "0.60500073", "0.60391146", "0.6036662", "0.60338306", "0.6018745", "0.60152596", "0.60141945" ]
0.63599473
46
The current user permissions can be policy checked in views:
def can?(query, record) query = "#{query}?" policy = Pundit.policy!(pundit_user, record) !! policy.public_send(query) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n end\n end", "def user_permission\n has_controller_permission?('user')\n end", "def custom_permissions\n if current_user.admin?\n can :manage, :all\n end\n end", "def user_can_view?(_check_user)\n true # everyone can view these\n end", "def user?\n permissions == 'user'\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def can_access?\n allows_current_user_access_to? :access\n end", "def is_view_permitted?(given_user = nil)\r\n return false unless self.active?\r\n \r\n given_user ||= self.current_user\r\n \r\n # If item is public, no need for further permission checks\r\n return true if self.public? && self.user && self.user.public? \r\n \r\n # Base case of identity, no need to check relationships\r\n return true if given_user && ((given_user.id == self.author_id) || (given_user.id == self.foruser_id) || given_user.is_self_or_owner?(self.user))\r\n\r\n # Special case -- allow recipient and owners to see private messages\r\n if self.is_a?(Pvtmessage)\r\n return true if given_user.is_self_or_owner?(self.foruser) || given_user.is_self_or_owner?(self.user)\r\n return false\r\n end\r\n\r\n return true if given_user.admin?\r\n \r\n # Otherwise no can do if only my owner can see it (if you got to here, you aren't my owner)\r\n return false if self.restriction_level == Relationshiptype.nobody\r\n\r\n # Content of private or blocked projects cannot be seen\r\n return false if self.user && !self.user.is_view_permitted?\r\n\r\n # Fine, we'll actually run some DB queries...\r\n return Relationship.has_follower?(self.user, given_user, self.levels_can_see)\r\n end", "def view_authorized(current_user)\n return self.public? || self.edit_authorized(current_user)\n end", "def view_authorized(current_user)\n return self.goal.public? || self.edit_authorized(current_user)\n end", "def can_access?(user)\n user == self.user\n end", "def authorize?(user)\n user && user.moderator?\n end", "def user_permission(instance,current_user)\n\t\tcase instance\n\t\twhen User #IF THAT THING IS A USER, ONLY A USER OR AN ADMIN CAN CHANGE\n\t\t\ttrue if self.admin || instance == current_user\n\t\telse\n\t\t\t#IF THAT THING IS SOMETHING BESIDES A USER, ONLY AN ADMIN OR THE USER THAT THE THING BELONGS TO CAN CHANGE IT\n\t\t\ttrue if self.admin || instance.user == current_user\n\t\tend\n\tend", "def can?\n current_user\n end", "def permission_required \n render_403 unless admin? || @item.is_editable_by?(current_user)\n end", "def show?\n @current_user.permission('Bid', :guest)\n end", "def permitted?\n appctrl_not_permitted() if ( @current_user.restricted? )\n end", "def permission?(permission_key)\n current_user_has_permission? permission_key\n end", "def check_permissions!(*which)\n Razor.config['auth.enabled'] and user.check_permissions(*which)\n true\n end", "def has_user_permission?(object)\n object and object.user and current_user and object.user == current_user\n end", "def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end", "def mayView? ( other_user )\n if ( (not other_user.valid?) or ( other_user.is_a?(User) == false ) )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"basic check failed\"\n # d other_user.type\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return false\n end\n user = getUser()\n if ( other_user == user )\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"same user as owner\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n return true\n end\n if ( ( self.public_policy == Dfile::PP_MAYVIEW ) or ( self.public_policy == Dfile::PP_MAYEDIT ) )\n return true\n end\n if self.special_users\n special = self.special_users[other_user.id.to_s]\n if special\n if ( ( special == Dfile::PP_MAYVIEW ) or ( special == Dfile::PP_MAYEDIT ) )\n return true\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has special permission but not right one\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"User has no special permission\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n \n else\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n # d \"no special permissions\"\n # d \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\" \n end\n return false\n end", "def get_permissions_for_user(user)\n get_filtered_policy(0, user)\n end", "def show\n enforce_view_permission(@user)\n \n end", "def mode_settings\n authorize!(@user)\n end", "def load_permissions \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]} \n end", "def permissions_policy(&block); end", "def permits_read_acccess_for(user)\n end", "def allow_access\n !@current_user.nil?\n end", "def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n current_user.permission.manage_quests ||\n current_user.permission.manage_skills ||\n current_user.permission.manage_achievements ||\n current_user.permission.manage_items ||\n current_user.permission.manage_titles\n end", "def can_be_modified_by?( user )\n return false if ( user.restricted? )\n return true if ( user.admin? )\n return self.active\n end", "def has_permission_with?(user)\r\n\t\t\treturn user.has_permission?(privacy_owner, self.class.privacy_rule_name, privacy_object_id)\r\n\t\tend", "def show\n @user = current_user\n authorize @user\n end", "def allow_edit(user)\n permission = self.content_permissions.by_user(user).first\n if !permission # Make sure the user is only added once\n permission = self.content_permissions.create(:user => user)\n end\n permission\n end", "def load_permissions\n authorize! :manage, :all\n end", "def allows?(action, user)\n case action.to_sym\n when :view then user.may_edit or user == self\n when :edit then user.may_authorize or user == self\n else false\n end\n end", "def user_permissions\n if current_user.id == params[:id].to_i\n @user = User.find(params[:id])\n else\n flash[:danger] = 'Unauthorized action.'\n redirect_to edit_user_path(current_user) \n end\n end", "def load_permissions\n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "def user_can_edit?\n current_user == @list.user\n end", "def update?\n @current_user.permission('Bid', :clerk)\n end", "def can_edit?(user)\n user == current_user\n end", "def user_actions(user)\n can_act_as_logged_in_user(user) unless Revs::Application.config.restricted_beta # also have logged in privileges if we are not in beta\n end", "def can_access user\n return self.users.include? user\n end", "def user_permission_greater? page, level \n return true if admin\n \n # access for non-members is not permitted\n as_member = Member.first(:conditions => { :user_id => id, :project_id => page.project.id })\n return false if as_member.nil?\n\n # user specific permissions have preference\n #Rails.logger.info \"Accessing user permission for user #{id} / member #{as_member.id} and page #{page.id}\"\n user_permission = WikiPageUserPermission.first(\n :conditions => {\n :wiki_page_id => page.id,\n :member_id => as_member.id\n }\n )\n\n unless user_permission.nil?\n Rails.logger.info \"Level: #{user_permission.level} => #{level}\"\n return user_permission.level >= level\n end\n \n # check whether the user belongs to a role that has permissions set\n role_permissions = WikiPageRolePermission.find(:all, :conditions => {:wiki_page_id => page.id})\n unless role_permissions.nil? or as_member.roles.empty?\n roles_ids = as_member.roles.map { |x| x.id }\n Rails.logger.info \"Accessing role permission\"\n \n role_permissions.each do |role|\n if roles_ids.index(role.role_id)\n Rails.logger.info \"Role.level #{role.level} >= #{level}\"\n return role.level >= level\n end\n end\n end\n\n # check default permission\n Rails.logger.info \"Checking default\"\n (default = page.default_permission) ? default.level >= level : true\n end", "def admin_actions(user)\n can_act_as_logged_in_user(user)\n can_view_any_profile\n can_view_any_gallery\n can_edit_saved_queries\n can_curate\n can_update_metadata\n can_administer\n end", "def allowed_user\n unless current_user.id == Design.find(params[:design_id]).user.id\n flash[:notice] = 'Voce não tem permissão para fazer isso!'\n redirect_to root_url\n end\n end", "def show?\n @current_user.permission('Ration', :guest)\n end", "def user_permitted_to_edit(item)\n item.user == current_user \n end", "def show\n \tauthorize! :read, @user\n end", "def create?\n @current_user.permission('Bid', :clerk)\n end", "def is_permitted_for?( user )\n ( user.id == self.user.id ) or ( user.privileged? )\n end", "def current_user_can(access_types)\n current_user.id == @list.user_id || access_types.include?(current_user.access_to_list(@list))\n end", "def access_whitelist\n current_user.try(:admin?) || current_user.try(:editor?) || current_user.try(:door_super?)\n end", "def check_access_control_all\n @user = User.find(params[:user_id])\n\n response_access_denied unless current_user.has_role?(:admin) || current_user.id == @user.id\n rescue\n response_access_denied\n end", "def check_permission\n unless current_user.is_admin == 1\n redirect_to \"/\", warning: \"You don't have permission to access that page.\"\n end\n end", "def allow_access_by_any_user\n @attributes[:allow_access_by_any_user]\n end", "def action_allowed?\n current_user_has_student_privileges?\n end", "def user_can_see?(user)\n !self.private || self.is_owner?(user)\n end", "def show\n authorize @user\n end", "def show\n authorize @user\n end", "def permitted?(user)\n Article.can_edit?(user)\n end", "def privacy_check(user_check)\n can_view = nil\n\n if self.public == false\n user = User.find_by_id(self.user_id)\n if user.company_id != user_check.company_id\n can_view = false\n else\n can_view = true\n end\n else\n can_view = true\n end\n\n return can_view\n\n end", "def is_view_permitted?(given_user = nil)\n given_user ||= self.current_actor\n\n # Guests can't see circles unless they log in\n return false if given_user.guest?\n \n # Oh look, it's me\n return true if given_user.is_self_or_owner?(self.user)\n \n # Fine, let's check the db\n return Relationship.has_follower?(self.user, given_user, self.levels_can_see)\n end", "def can_edit?\n allows_current_user_access_to? :edit\n end", "def permitted?\n appctrl_not_permitted() unless ( @current_user.privileged? )\n end", "def accountant_allow_edit(permission)\n return accountant_right(permission) == 2\n end", "def permitted?\n appctrl_not_permitted() unless( @current_user.privileged? )\n end", "def can_read?(user=@session.user)\n effective_acl.can_read?(user)\n end", "def load_permissions\n \n @current_permissions = current_user.role.permissions.collect{|i| [i.subject_class, i.action]}\n end", "def show\n authorize @user # Can only see your own profile\n end", "def access action\n\t\tif current_user\n \treturn true\n else\n \treturn false\n end\n\n\tend", "def custom_permissions\n if user_groups.include?(\"admin\")\n can :manage, :all\n end\n end", "def profile_authorization\n #if view admins' profile, allow only admin\n return false unless(params[:id])\n user = User.find(params[:id])\n return false unless user\n return admin_authorization if user.admin?\n return true if GraderConfiguration[\"right.user_view_submission\"]\n\n #finally, we allow only admin\n admin_authorization\n end", "def has_access?(permission, user)\n raise UnknownUserException if user.nil?\n\n AccessProvider.action_permitted_for_user?(permission, user)\n end", "def edit\n @user = User.find(params[:id])\n logger.tagged(\"edit current user: \") {logger.debug @current_user.attributes}\n #TODO : make sure permissions are handled correctly\n can_edit_hash = Permissions.currentLoggedInOrHasMorePermissions(@current_user,@user)\n logger.tagged(\"edit user perm hash: \") {logger.debug can_edit_hash}\n if can_edit_hash[:has_permission]\n can_destroy_hash = Permissions.hasMorePermissions(@current_user,@user)\n @can_destroy = can_destroy_hash[:has_permission]\n else\n flash[:warning] = can_edit_hash[:permission_message]\n redirect_to user_path(@user)\n end\n\n end", "def action_allowed?\n current_user_has_ta_privileges?\n end", "def action_allowed?\n current_user_has_ta_privileges?\n end", "def viewable_by?(user)\n Sugar.public_browsing? || user ? true : false\n end", "def show \n #if current_user.company_id == @user.company_id \n authorize @user \n end", "def check_if_user_can_perform_action_on_user\n is_current_user = (admin_user == @item)\n current_user_is_root = admin_user.is_root? && is_current_user\n\n case params[:action]\n when 'edit'\n # Edit other items is not allowed unless current user is root\n # and is not the current user.\n not_allowed if admin_user.is_not_root? && !is_current_user\n when 'toggle', 'destroy'\n not_allowed if admin_user.is_not_root? || current_user_is_root\n when 'update'\n # Admin can update himself except setting the status to false!. Other\n # users can update their profile as the attributes (role & status)\n # are protected.\n status_as_boolean = params[@object_name][:status] == \"1\" ? true : false\n\n status_changed = !(@item.status == status_as_boolean)\n role_changed = !(@item.role == params[@object_name][:role])\n\n root_changed_his_status_or_role = current_user_is_root && (status_changed || role_changed)\n not_root_tries_to_change_another_user = admin_user.is_not_root? && !is_current_user\n\n not_allowed if root_changed_his_status_or_role || not_root_tries_to_change_another_user\n end\n end", "def check_user_permissions\n if user_signed_in?\n if !current_user.is_admin? && !current_user.is_professor?\n redirect_to courses_path, notice: \"You don't have permission to access that page!\"\n end\n end\n end", "def authorize_show\n user = requested_user(:user_id)\n if request.format.ics?\n unauthorized(\"Invalid privacy token.\") unless params[:pt] == user.privacy_token\n else\n unauthorized unless user == current_user\n end\n true\n end", "def can_access user\n list = List.find(self.list_id)\n\n return list.can_access user\n end", "def admin_grant_permissions\n @user = User.includes(:perms).find(params[:id])\n authorize @user\n user_perms = current_user.perms\n @perms = user_perms & [Perm.grant_permissions, Perm.modify_templates, Perm.modify_guidance, Perm.use_api, Perm.change_org_details]\n end", "def custom_permissions_read(_notebook, _user, _use_admin=false)\n true\n end", "def user_permission(paid, cancelled, signed_in, admin)\n\tif paid == \"no\" or cancelled == \"yes\"\n\treturn \"Go away!\"\n\telsif signed_in == \"yes\" and admin == \"yes\"\n\treturn \"You can see and change all the pages!\"\n\telsif signed_in == \"yes\" and admin == \"no\"\n\treturn \"You can see all the pages!\"\n\telsif signed_in == \"no\"\n\treturn \"You can't see any of the pages, please sign in!\"\n\tend\nend", "def filter_access!\n treat_as get_current_role\n end", "def has_access_to(cp)\n if can_review(cp) || can_edit(cp) || is_admin\n true\n end\n\n end", "def current_ability\n current_user.ability\n end", "def index\n # @users = User.all\n # authorize @users \n @users = policy_scope(User)\n authorize @users\n end", "def service_user(_user)\n can :access, :stats\n can :access, :export unless RuntimeConfig.elections_active?\n can :access, :voters if RuntimeConfig.elections_started? && RuntimeConfig.elections_active?\n end", "def can_user_access?(user)\n if user.is_account_holder_or_administrator? || self.is_user_tagged_to_team?(user)\n true\n else\n false\n end\n end", "def pundit_user\n # if action_name == \"new\"\n # current_user\n # else\n current_user || current_company\n # end\n end", "def authorize_user\n if @user.present?\n # Pass the object @user to Pundit to check against @current_user\n authorize @user\n else\n authorize_users\n end\n end", "def before_filter\n if current_user\n true\n end\n end", "def user_authorized?(user)\n user == current_user || is_admin?\n end", "def project_permissions\n user.project_permissions(rule.project)\n end", "def phi_allowed_by\n phi_context[:user_id]\n end", "def read_allowed?(user)\n true\n end", "def show\n return unless check_permission\n end", "def get_user\n @current_user = current_user\n @can_manage = can? :manage, Event\n end" ]
[ "0.8114332", "0.7601134", "0.73948526", "0.7345559", "0.72514397", "0.72437453", "0.72036165", "0.7143711", "0.7127735", "0.7100951", "0.70516586", "0.705126", "0.70386326", "0.7028502", "0.7014997", "0.7005093", "0.6963206", "0.69574267", "0.6933564", "0.6930712", "0.6928344", "0.6922802", "0.6922576", "0.69042575", "0.68924576", "0.6887222", "0.6882206", "0.6863676", "0.68523866", "0.6811624", "0.68110526", "0.6797007", "0.67911834", "0.6790093", "0.6781167", "0.676078", "0.6758147", "0.6746656", "0.6737931", "0.6730406", "0.6728424", "0.6727164", "0.6722964", "0.67083174", "0.670815", "0.67080754", "0.6706398", "0.66997075", "0.66995066", "0.6697302", "0.6689944", "0.66893697", "0.66891855", "0.66828626", "0.66827327", "0.6682216", "0.66794914", "0.6679337", "0.66749334", "0.66749334", "0.66709954", "0.66704005", "0.66656274", "0.66557914", "0.6652762", "0.66481376", "0.66481304", "0.6643244", "0.6641872", "0.6640161", "0.6631467", "0.66306776", "0.66258717", "0.6623704", "0.6615275", "0.6614158", "0.6614158", "0.6612972", "0.6611428", "0.66085756", "0.6605415", "0.66051483", "0.66000885", "0.65976214", "0.65943265", "0.6593398", "0.65888864", "0.6588348", "0.6581744", "0.65811026", "0.6570272", "0.65634143", "0.65634", "0.6550674", "0.6549425", "0.65488446", "0.65461755", "0.65428036", "0.6540832", "0.65397", "0.65344304" ]
0.0
-1
If you implement you MUST remove the action from skip_authorization_check above!
def index # look up by messageable type and id head :not_implemented end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def skip_authorization; end", "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "def skip_authorization\n @_authorization_performed = true\n end", "def authorize_unauthenticated_user\n target_action = params[:controller] + '#' + params[:action]\n unless User::DEFAULT_PERMISSIONS.include?(target_action)\n head :unauthorized and return\n end\n end", "def show\n skip_authorization\n end", "def check_authorization(**options)\n after_action(**options) do |controller|\n next if controller.instance_variable_defined?(:@_authorized)\n raise AuthorizationNotPerformed,\n 'This action failed the check_authorization because it does not authorize_resource. '\\\n 'Add skip_authorization_check to bypass this check.'\n end\n end", "def needs_authorization?\n true\n end", "def authorization; end", "def unauthorized\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def implicit_authorization_target\n # no-op\n end", "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end", "def skip_actions; end", "def access_control\n \n end", "def before_authorization(action, role, resource_config)\n raise NotImplementedError\n end", "def needs_authenticate_user?\n except_actions = %w[index show]\n !except_actions.include?(action_name)\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def access_denied\n end", "def access_denied\n\n end", "def needs_authenticate_user?\n except_actions = %w[index show print]\n !except_actions.include?(action_name)\n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if current_user.nil?\n end", "def authorize\n end", "def authorize\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def user_action_on_resource_authorized\n end", "def authorization_checking\n authorize!(:authorization_checking,current_user) unless current_user.role?(:livia_admin) || current_user.role?(:lawfirm_admin)\n end", "def authorize!(user)\n redirect '/not_authorized' unless authorized?(user)\nend", "def do_not_check_authorization?\n respond_to?(:devise_controller?) ||\n respond_to?(:home_controller?)\n end", "def authorization_required\n case action_name.to_s\n when /index/, /show/ then list_authorized?\n when /create/ then create_authorized?\n when /update/ then update_authorized?\n when /destroy/ then delete_authorized?\n end\n false\n end", "def require_login\n\t\tauthorize_request || render_unauthorized(\"Access Denied\")\n\tend", "def require_authorization( message=\"You are not authorized to access this resource.\" )\n\t\tfinish_with( HTTP::FORBIDDEN, message )\n\tend", "def login_required\n authorized? || access_denied\n end", "def login_required\n authorized? || access_denied\n end", "def login_required\n authorized? || access_denied\n end", "def check_is_login_required\n authorized_denied unless logged_in?\n end", "def login_required\nauthorized? || access_denied\nend", "def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def require_no_authentication\n # skip this!\n end", "def authorize\n redirect_to '/' unless current_user || current_dealer\n end", "def api_authentication_required\n unauthorized unless current_user?\n end", "def pre_authorize_cb; end", "def skip_load_and_authorize_resource(*args)\n skip_load_resource(*args)\n skip_authorize_resource(*args)\n end", "def http_authorize \n redirect_to login_path, alert: 'Authorization required' if !logged_in? \n end", "def admin_authorize\n unless admin?\n unauthorized_access\n end\n end", "def require_no_authentication\n end", "def login_required\n authorized? || throw(:halt, :access_denied)\n end", "def without_access_control\n previous_state = Authorization.ignore_access_control\n Authorization.ignore_access_control(true)\n result = yield\n ensure\n Authorization.ignore_access_control(previous_state)\n result\n end", "def authorize\n redirect_to :login unless user_signed_in?\n end", "def enforce_requested_account_authorized!\n clear_authorization! unless requested_account_authorized?\n end", "def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\n store_location\n\n # Call access_denied for an appropriate redirect and stop the filter\n # chain here\n access_denied and return false\n end", "def authorize_admin!\n redirect_to login_path unless current_user\n end", "def admin_check\n render_401 && return unless current_user\n render_403 && return unless current_user.admin?\n end", "def skip_authentication?\n true\n end", "def require_authorization!\n unless current_user == @event.user\n render json: {}, status: :forbidden\n end\n end", "def login_required\n not_authorized unless current_user\n end", "def disable_authorization_checks\n saved = $authorization_checks_disabled\n $authorization_checks_disabled = true\n yield\n ensure\n $authorization_checks_disabled = saved\n end", "def authorize_admin\n redirect_to root_path unless current.user.immortal?\n end", "def authorizeAdmin\n redirect_to '/adminlogin' unless admin_user\n end", "def require_login\n authorize_request || render_unathorized(\"Access denied\")\n end", "def authorization_required\n authorized? || authorization_denied\n end", "def ignore_request_unless_permitted\n return if permitted?\n flash_notice(:permission_denied.t)\n redirect_to(action: \"index_article\") and return\n end", "def protect?(_action)\n true\n end", "def protect?(_action)\n true\n end", "def unauthorized\n\n render_error( :unauthorized )\n\n end", "def unauthenticated\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def redirect_403\n return hit_error(403) unless current_user\n end", "def authorize\n return if current_user\n\n redirect_to login_url\n end", "def unauthorized\n head :unauthorized\n end", "def check_permission\n redirect_to dashboard_path, notice: 'You are not authorised to perform this action.' unless current_user&.admin?\n end", "def protect?(action)\n true\n end", "def protect?(action)\n true\n end", "def protect?(action)\n true\n end", "def protect?(action)\n true\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 authorized?\n render nothing: true, status: :forbidden if !current_account\n end", "def authorize\n redirect_to signup_path unless current_user\n end", "def authorization_check\n if session[:current_user] == nil\n redirect '/not_authorized'\n else\n return true\n end\nend", "def authorization_check\n raise Errors::UnauthorizedError.new unless current_user.present?\n end", "def redirect_unauthorized!\n redirect_to not_authorized_path\n end", "def ensure_authorization_performed(options = {})\n after_filter(options.slice(:only, :except)) do |controller_instance|\n controller_instance.ensure_authorization_performed(options)\n end\n end" ]
[ "0.8585479", "0.8154678", "0.791911", "0.74044746", "0.7338426", "0.7254241", "0.72048473", "0.7202056", "0.7192164", "0.7164608", "0.7164608", "0.71039855", "0.70464736", "0.7004046", "0.6995758", "0.698332", "0.69416654", "0.6937841", "0.69256955", "0.6925487", "0.69239426", "0.6896437", "0.68849415", "0.6883496", "0.686702", "0.6857664", "0.6857664", "0.6857664", "0.6857664", "0.6857664", "0.6857664", "0.6857664", "0.6857664", "0.6846517", "0.67941344", "0.67941344", "0.67941344", "0.67889905", "0.67889905", "0.6780733", "0.6774549", "0.67725414", "0.67719054", "0.6763418", "0.67576087", "0.67444575", "0.674436", "0.67404616", "0.67404616", "0.67404616", "0.67384994", "0.6723811", "0.6722555", "0.67130196", "0.67130196", "0.67130196", "0.6698159", "0.6695569", "0.6688709", "0.6679459", "0.66789913", "0.6671556", "0.6668606", "0.66634405", "0.6661315", "0.6660399", "0.6659503", "0.6642847", "0.6640173", "0.66393346", "0.66348875", "0.6634699", "0.6631212", "0.6622111", "0.661957", "0.6603153", "0.659785", "0.65956384", "0.65878797", "0.6587671", "0.6583436", "0.6583436", "0.65827876", "0.6571544", "0.65712106", "0.65712106", "0.6556606", "0.65539527", "0.65533954", "0.6547147", "0.6536383", "0.6536383", "0.6536383", "0.6536383", "0.6533795", "0.6531307", "0.65298826", "0.6527273", "0.6524145", "0.65224725", "0.6520983" ]
0.0
-1
GET /permits GET /permits.json
def index if params[:category].blank? @permits = Permit.all.order("created_at DESC") else @category_id = Category.find_by(category_name: params[:category]).id @permits = Permit.where(:category_id => @category_id).order("created_at DESC") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permits\n return @permits if changed?\n @permits = loader.permits\n end", "def abilities\n get('/ability/')\n end", "def index\n permits = Permit.select('id, permit_type, applicant_name, start_date, end_date, address, application_data, city_name, ST_AsGeoJSON(geometry) AS geojson')\n .where(\"city_name = ? AND geometry IS NOT NULL AND address IS NOT NULL\", params[:city].upcase.gsub(/-/, \" \"))\n if permits\n respond_to do |format|\n format.json { render json: permits }\n end\n else\n respond_to do |format|\n format.json { render json: [], status: :bad_request }\n end\n end\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def index\n @vehiclepermits = VehiclePermit.all\n if params[:search]\n @vehiclepermits = VehiclePermit.search(params[:search]).order(\"created_at DESC\")\n else\n @vehiclepermits = VehiclePermit.all.order('created_at DESC')\n end\n authorize @vehiclepermits\n end", "def index\n\t\tauthorize! :read, Skill\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @skills }\n end\n end", "def create\n @permit = Permit.new(permit_params)\n\n respond_to do |format|\n if @permit.save\n format.html { redirect_to @permit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @permit }\n else\n format.html { render :new }\n format.json { render json: @permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @workpermits = Workpermit.all\n end", "def set_permit\n @vehiclepermit = Permit.find(params[:id])\n authorize @vehiclepermit\n end", "def permits\n @permits ||= builders.inject({}) do |permits, builder|\n debug \"++ Permit Builder: #{builder_class builder}\"\n built_permits = permits_built_with(builder)\n\n if built_permits\n debug \"== Permits built: #{built_permits.size}\"\n permits[builder] = built_permits\n end\n\n permits\n end\n end", "def whitelist\n if cannot_access_api?\n render json: [], status: :unauthorized\n end\n end", "def index\n @granted_scopes = GrantedScope.paginate(:page => params[:page], :per_page => 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @granted_scopes }\n end\n end", "def index\n authorize @user\n render :json => @user.tags\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def listings\n authorize! :read, @user\n end", "def show\n authorize @accounts\n render json: @account\n end", "def resources_permitted? kind, identifiers, privilege\n options = {\n privilege: privilege,\n identifiers: identifiers\n }\n resp = RestClient::Resource.new(Conjur::Authz::API.host, credentials)[\"#{Conjur.account}/resources/#{kind}?check=true\"].post(options)\n if resp.code == 204\n [true, []]\n else\n [false, JSON.parse(resp.body)]\n end\n end", "def index\n @accounts = policy_scope(Account)\n\n render json: @accounts, include: [:user]\n end", "def show\n list = policy_scope(List).includes(:cards).find(params[:id])\n authorize list\n json_response(list.decorate.as_json(cards: true), :ok)\n end", "def show\n @skill = Skill.find(params[:id])\n\t\tauthorize! :read, Skill\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill }\n end\n end", "def index\n @clubs = Club.all \n respond_to do |format|\n format.html { \n authorize! :index, @clubs\n }\n format.json { \n \n }\n end\n end", "def index\n lists = policy_scope(List).includes(:admin).page(page).per(per)\n authorize lists\n json_response(PageDecorator.decorate(lists).as_json(admin: true), :ok)\n end", "def index\n @users = User.all\n authorize @users\n\n render json: @users\n end", "def index\n @requests = Request.accessible_by(current_ability)\n\n \n\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def show\n @admin_whitelist = Admin::Whitelist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_whitelist }\n end\n end", "def index\n @admittings = Admitting.all\n render json: @admittings\n end", "def show\n @allowance = Allowance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @allowance }\n end\n end", "def show\n @granted_scope = GrantedScope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @granted_scope }\n end\n end", "def update\n respond_to do |format|\n if @permit.update(permit_params)\n format.html { redirect_to @permit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @permit }\n else\n format.html { render :edit }\n format.json { render json: @permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n authorize! :manage, @bid\n end", "def account_permit\n return nil if !registered_account? user_account.class\n found = account_permits_by(type)[name]\n debug account_permit_msg(found)\n found\n rescue\n nil\n end", "def index\n @bookings = policy_scope(current_user.bookings)\n authorize @bookings\n @experiences = policy_scope(current_user.experiences)\n authorize @experiences\n end", "def index\n users = policy_scope(User)\n render json: { users: users }\n end", "def index\n @alloweds = Allowed.all\n end", "def show\n authorize! :read, @it_park\n end", "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "def show\n authorize @user\n render json: @user\n end", "def show\n respond_to do |format|\n format.html { \n authorize! :index, @club\n }\n format.json { \n \n }\n end\n end", "def index\n @demands = Demand.all\n authorize @demands\n end", "def new\n @auth_assign_permit = Auth::AssignPermit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auth_assign_permit }\n end\n end", "def show\n @level = Level.find(params[:id])\n authorize! :show, @level, :message => 'Acceso denegado.'\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 respond_to do |format|\n if authorized?\n format.json { render json: User.all }\n else\n format.json { render json: unauthorized, status: :forbidden }\n end\n end\n end", "def ensure_permit_access_authorized!\n unless @_bsm_rails_api_authorized\n raise NotSecure, \"This action failed because permit_access filters were not run. Add permit_access to secure this endpoint.\"\n end\n end", "def index\n @accounts = current_user.accounts\n @wallet = current_user.wallet\n authorize @accounts\n end", "def permit(type,options={})\n raise NameError.new(\"duplicate ability definition\") if @ability.key? type\n ability_object = GraphQL::Authorization::AbilityType.new(type,nil,{})\n if options.key?(:except) && options.key?(:only)\n raise ArgumentError.new(\"you cannot specify white list and black list\")\n end\n if options[:except]\n ability_object.access(type.fields.keys.map(&:to_sym) - options[:except])\n elsif options[:only]\n ability_object.access(options[:only])\n end\n ability_object.execute options[:execute]\n if block_given?\n #note Proc.new creates a proc with the block given to the method\n ability_object.instance_eval(&Proc.new)\n end\n @ability[type] = ability_object\n end", "def deny_access\n respond_to do |format|\n format.json {\n # Some schools of thought advocate the use of 404 (:not_found). See\n # http://www.bennadel.com/blog/2400-handling-forbidden-restful-requests-401-vs-403-vs-404.htm\n render json: {}, status: :unauthorized\n }\n end\n end", "def show\n @assessment = Assessment.find(params[:id])\n authorize! :read, @assessment\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end", "def index\n @permitidos = Permitido.all\n end", "def index\n @people = Person.all\n respond_to do |format|\n format.json { \n render json: @people, :include => [:roles => { include: [:privileges] } ]\n }\n end\n end", "def index\n @abilities = Ability.all\n end", "def visit_params\n params.require(:visit).permit(*allowable)\n end", "def user_access_params\n params.require(:user_access).permit(:username, responsibility_ids:[])\n end", "def show\n respond_to do |format|\n format.json {\n render json: @person, :include => [:roles => { include: [:privileges] } ]\n }\n end\n end", "def index\n authorize! :index, Campus, :message => 'Acceso denegado.'\n @campuses = @university.campuses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campuses }\n end\n end", "def index\n @uploads = policy_scope(@user.uploads)\n authorize @uploads\n end", "def index\n # byebug\n if current_user\n recipes = Recipe.all \n render json: recipes\n else \n render json: { errors: [\"Not Authorized\"] }, status: :unauthorized\n end\n end", "def show\n authorize @info_practice\n end", "def index\n if params[:scope] == \"students\"\n @users = User.students.page(params[:page]).order(sort_column + \" \" + sort_direction)\n authorize! :list, :students\n elsif params[:scope] == \"advisors\"\n @users = User.advisors.page(params[:page]).order(sort_column + \" \" + sort_direction)\n authorize! :list, :advisors\n elsif params[:scope] == \"professors\"\n @users = User.professors.page(params[:page]).order(sort_column + \" \" + sort_direction)\n authorize! :list, :professors\n elsif params[:scope] == \"gods\"\n @users = User.gods.page(params[:page]).order(sort_column + \" \" + sort_direction)\n authorize! :list, :gods\n else\n @users = User.accessible_by(current_ability, :index).order(sort_column + \" \" + sort_direction).page(params[:page])\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @users }\n end\n end", "def accessory_params\n params.require(:accessory).permit(:name, :weapon, :shield)\n end", "def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end", "def show\n authorize @project\n render json: @project\n end", "def access_params\n params[:access].permit(:user_id)\n end", "def index\n authorize controller_class\n render json: policy_class::Scope.new(current_user, controller_class).editable.order(prepared_params[:sort]),\n include: prepared_params[:include], fields: prepared_params[:fields]\n end", "def show\n authorize! :show, @kit\n end", "def show\n render json: @admitting\n end", "def create\n @permit = Permit.new(permit_params)\n\n @permit.category_id = params[:category_id]\n @permit.employee_id = params[:employee_id]\n @permit.site_id = params[:site_id]\n\n respond_to do |format|\n if @permit.save\n format.html { redirect_to @permit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @permit }\n else\n format.html { render :new }\n format.json { render json: @permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def show\n authorize @application_form\n render json: @application_form\n end", "def show\n authorize @secret, :show?\n end", "def permits_read_acccess_for(user)\n end", "def show\n authorize! :read, @wishlist_project\n end", "def mood_list_params\n params[:moods] = encrypt_param params[:moods]\n params.permit(:moods)\n end", "def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end", "def index\n @scans = policy_scope(Scan)\n render json: @scans\n end", "def index\n authorize @ticket\n render :json => @ticket.tags\n end", "def show\n authorize @sector\n respond_to do |format|\n format.js\n end\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 index\n @resources = Resource.where(\"is_approved = true\")\n render json: @resources, status: 200\n end", "def show\n @question_pairing_disability = QuestionPairingDisability.with_names({id: params[:id], paginate: false})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_pairing_disability }\n end\n end", "def access_params\n params.require(:access).permit(:name, :mode)\n end", "def index\n @marketplace_tender_qualification_criterias = @tender.qualification_criterias.all\n # authorize @marketplace_tender_qualification_criterias\n render json: @marketplace_tender_qualification_criterias\n end", "def access\n @user = User.find_by_user(params[:id])\n @datasetID, @fileID = params[:resource].split '/'\n\n is_restricted = AccessLevel.dataset_is_restricted(@datasetID)\n category = is_restricted ? :b : :a\n\n permissions = @user.permissions_for_dataset(category, @datasetID, @fileID)\n\n pv = permissions\n .reject { |e| e.permissionvalue == 0 }\n .inject(0) { |a, e| a == 0 ? e.permissionvalue : a * e.permissionvalue }\n\n # # General datasets have analyse and download permissions if browse access is granted\n # if !is_restricted\n # pv *= UserPermissionB::PERMISSION_VALUES[:analyse] * UserPermissionB::PERMISSION_VALUES[:download]\n # end\n\n # result = {:browse => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:browse] == 0,\n # :analyse => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:analyse] == 0,\n # :download => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:download] == 0}\n\n if is_restricted\n result = {\n :browse => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:browse] == 0,\n :analyse => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:analyse] == 0,\n :download => pv > 0 && pv % UserPermissionB::PERMISSION_VALUES[:download] == 0 }\n else\n result = {\n :browse => true,\n :analyse => true,\n :download => pv > 0 }\n end\n\n render :json => result\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def semList\n @semesters = Semester.all\n authorize @semester\n end", "def show\n authorize @labor_request\n end", "def index\n authorize @organization\n render :json => @organization.tags\n end", "def show\n @fundamental_alliance = Fundamental::Alliance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n role = determine_access_role(@fundamental_alliance.leader_id, @fundamental_alliance.id)\n alliance_hash = @fundamental_alliance.sanitized_hash(role)\n \n if !current_character.nil? && !@fundamental_alliance.nil? && !alliance_hash.nil? && current_character.alliance == @fundamental_alliance\n alliance_hash[:vote_candidate_id] = current_character.voted_for_candidate_id\n end\n\n alliance_hash[:is_at_war] = @fundamental_alliance.is_at_war?\n \n render json: include_root(alliance_hash, :alliance)\n end\n end\n end", "def show\n @restriction = Restriction.find(params[:id])\n\n render json: @restriction\n end", "def deal_permitted_users(id:, **args)\n params = parameters(args) do\n optional_params :access_level\n end\n request(:get, \"deals/#{id}/permittedUsers\", params)\n end", "def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end", "def index\n @organization_memberships = OrganizationMembership.where(user_id: params['user_id'])\n authorize @organization_memberships\n\n render json: @organization_memberships\n end", "def index\n authorize Plate\n @plates = Plate.all\n end", "def index\n if params[:id]\n @skills = Skill.where(id:params[:id])\n elsif params[:user_id]\n @skills = Skill.where(user_id:params[:user_id])\n elsif params[:name]\n @skills = Skill.where(name:params[:name])\n else\n @skills = Skill.includes(:user).all() #fix n+1 query\n end\n render json: @skills\n end", "def ability_params\n params.require(:ability).permit(:number, :name, :description, :shortdescription)\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 will_params\n wills = params.select { |k, _v| k.starts_with?(\"vault_entry_\") }\n permitted_params = {}\n wills.keys.each do |will|\n permitted_params[will] = [:id, :title, :executor_id, :notes, :agent_ids, :document_id, primary_beneficiary_ids: [], secondary_beneficiary_ids: [], share_ids: [], share_with_contact_ids: []]\n end\n wills.permit(permitted_params)\n end", "def formulary_params\n allow = [:responsable_llenado,:cod01,:cod02,:ape01,:ape04,:ape07,:ape02,:ape05,:ape03,:ape06,:api01,:api04,:api02,:ssb01,:api03,:cao01,:cao04,:cao07,:cao10,:tit01,:cao02,:cao05,:cao08,:cao11,:cao03,:cao06,:cao09,:cao12,:uni01,:uni02,:uni03,:ben01,:ben02,:per01,:per02,:user_id]\n params.require(:formulary).permit(allow)\n end", "def show\n authorize Reading\n end" ]
[ "0.6468166", "0.64317036", "0.63783944", "0.6343692", "0.6298317", "0.6157982", "0.60996604", "0.6054717", "0.6009847", "0.6006947", "0.5958866", "0.5920648", "0.58385533", "0.58214986", "0.5737014", "0.57287884", "0.5726562", "0.570388", "0.5697023", "0.5682268", "0.56757617", "0.56023455", "0.55927104", "0.55884004", "0.5582057", "0.55784774", "0.55738735", "0.55720997", "0.5570359", "0.5568498", "0.5553647", "0.55321425", "0.5517415", "0.5512805", "0.551183", "0.55034006", "0.5499814", "0.5492963", "0.5447613", "0.5435942", "0.5429466", "0.542", "0.54198265", "0.5403763", "0.5401364", "0.5393709", "0.53917396", "0.5374049", "0.53717774", "0.53687906", "0.53617096", "0.5360685", "0.53553694", "0.5352699", "0.5352101", "0.5346291", "0.5343014", "0.5337239", "0.53341115", "0.5320817", "0.532045", "0.53148156", "0.5314679", "0.5312741", "0.5309935", "0.5308072", "0.53055304", "0.52978164", "0.52961266", "0.529309", "0.5293003", "0.5281513", "0.5280727", "0.52791786", "0.5277791", "0.5276776", "0.5272116", "0.5259831", "0.52590066", "0.5258725", "0.5240656", "0.52362645", "0.52359253", "0.5235021", "0.52326053", "0.52288437", "0.5225433", "0.5224209", "0.5223097", "0.52223265", "0.5221083", "0.52203304", "0.52184844", "0.5218219", "0.52177054", "0.52171123", "0.5215671", "0.5209424", "0.5206969", "0.5201766" ]
0.5915161
12
GET /permits/1 GET /permits/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_permit\n @permit = Permit.find(params[:id])\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def create\n @permit = Permit.new(permit_params)\n\n respond_to do |format|\n if @permit.save\n format.html { redirect_to @permit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @permit }\n else\n format.html { render :new }\n format.json { render json: @permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n permits = Permit.select('id, permit_type, applicant_name, start_date, end_date, address, application_data, city_name, ST_AsGeoJSON(geometry) AS geojson')\n .where(\"city_name = ? AND geometry IS NOT NULL AND address IS NOT NULL\", params[:city].upcase.gsub(/-/, \" \"))\n if permits\n respond_to do |format|\n format.json { render json: permits }\n end\n else\n respond_to do |format|\n format.json { render json: [], status: :bad_request }\n end\n end\n end", "def set_permit\n @vehiclepermit = Permit.find(params[:id])\n authorize @vehiclepermit\n end", "def update\n respond_to do |format|\n if @permit.update(permit_params)\n format.html { redirect_to @permit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @permit }\n else\n format.html { render :edit }\n format.json { render json: @permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @allowance = Allowance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @allowance }\n end\n end", "def show\n @skill = Skill.find(params[:id])\n\t\tauthorize! :read, Skill\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill }\n end\n end", "def index\n\t\tauthorize! :read, Skill\n\t\t\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @skills }\n end\n end", "def abilities\n get('/ability/')\n end", "def new\n @auth_assign_permit = Auth::AssignPermit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auth_assign_permit }\n end\n end", "def index\n @workpermits = Workpermit.all\n end", "def permits\n return @permits if changed?\n @permits = loader.permits\n end", "def show\n @admin_whitelist = Admin::Whitelist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_whitelist }\n end\n end", "def show\n @bid = Bid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bid }\n end\n authorize! :manage, @bid\n end", "def show\n @granted_scope = GrantedScope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @granted_scope }\n end\n end", "def index\n @vehiclepermits = VehiclePermit.all\n if params[:search]\n @vehiclepermits = VehiclePermit.search(params[:search]).order(\"created_at DESC\")\n else\n @vehiclepermits = VehiclePermit.all.order('created_at DESC')\n end\n authorize @vehiclepermits\n end", "def show\n @disability = Disability.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disability }\n end\n end", "def index\n if params[:category].blank?\n @permits = Permit.all.order(\"created_at DESC\")\n else\n @category_id = Category.find_by(category_name: params[:category]).id\n @permits = Permit.where(:category_id => @category_id).order(\"created_at DESC\")\n end \n end", "def show\n authorize @accounts\n render json: @account\n end", "def index\n @granted_scopes = GrantedScope.paginate(:page => params[:page], :per_page => 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @granted_scopes }\n end\n end", "def show\n @restriction = Restriction.find(params[:id])\n\n render json: @restriction\n end", "def show\n @assessment = Assessment.find(params[:id])\n authorize! :read, @assessment\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @assessment }\n end\n end", "def index\n @admittings = Admitting.all\n render json: @admittings\n end", "def show\n @level = Level.find(params[:id])\n authorize! :show, @level, :message => 'Acceso denegado.'\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level }\n end\n end", "def show\n @privacy_term = PrivacyTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @privacy_term }\n end\n end", "def show\n @question_pairing_disability = QuestionPairingDisability.with_names({id: params[:id], paginate: false})\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_pairing_disability }\n end\n end", "def show\n list = policy_scope(List).includes(:cards).find(params[:id])\n authorize list\n json_response(list.decorate.as_json(cards: true), :ok)\n end", "def create\n @permit = Permit.new(permit_params)\n\n @permit.category_id = params[:category_id]\n @permit.employee_id = params[:employee_id]\n @permit.site_id = params[:site_id]\n\n respond_to do |format|\n if @permit.save\n format.html { redirect_to @permit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @permit }\n else\n format.html { render :new }\n format.json { render json: @permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def show\n @fundamental_alliance = Fundamental::Alliance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json do\n role = determine_access_role(@fundamental_alliance.leader_id, @fundamental_alliance.id)\n alliance_hash = @fundamental_alliance.sanitized_hash(role)\n \n if !current_character.nil? && !@fundamental_alliance.nil? && !alliance_hash.nil? && current_character.alliance == @fundamental_alliance\n alliance_hash[:vote_candidate_id] = current_character.voted_for_candidate_id\n end\n\n alliance_hash[:is_at_war] = @fundamental_alliance.is_at_war?\n \n render json: include_root(alliance_hash, :alliance)\n end\n end\n end", "def show\n authorize @project\n render json: @project\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secret_record }\n end\n end", "def index\n authorize @user\n render :json => @user.tags\n end", "def show\n @grant = Grant.find(params[:id])\n @owner = User.find(@grant.owner)\n respond_to do |format|\n format.html { render :layout => false }# show.html.erb\n format.json { render json: @grant }\n end\n end", "def ability(id)\n get(\"/ability/#{id}\")\n end", "def set_permit_request\n @permit_request = PermitRequest.find(params[:id])\n raise ActiveRecord::RecordNotFound if @permit_request.nil?\n end", "def create\n @auth_assign_permit = Auth::AssignPermit.new(params[:auth_assign_permit])\n\n respond_to do |format|\n if @auth_assign_permit.save\n format.html { redirect_to @auth_assign_permit, notice: 'Assign permit was successfully created.' }\n format.json { render json: @auth_assign_permit, status: :created, location: @auth_assign_permit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auth_assign_permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def account_permit\n return nil if !registered_account? user_account.class\n found = account_permits_by(type)[name]\n debug account_permit_msg(found)\n found\n rescue\n nil\n end", "def show\n definition = Definition.where(id: params[:id]).first\n render json: definition, :include => {:user => {:only => :username}}\n end", "def show\n @secret_word = SecretWord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @secret_word }\n end\n end", "def show\n @role_permision = RolePermision.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @role_permision }\n end\n end", "def show\n @restriction = Restriction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restriction }\n end\n end", "def show\n render json: @admitting\n end", "def show\n @security = Security.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @security }\n end\n end", "def ability_params\n params.require(:ability).permit(:number, :name, :description, :shortdescription)\n end", "def show\n @skill = Skill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill }\n end\n end", "def permits\n @permits ||= builders.inject({}) do |permits, builder|\n debug \"++ Permit Builder: #{builder_class builder}\"\n built_permits = permits_built_with(builder)\n\n if built_permits\n debug \"== Permits built: #{built_permits.size}\"\n permits[builder] = built_permits\n end\n\n permits\n end\n end", "def index\n @accounts = policy_scope(Account)\n\n render json: @accounts, include: [:user]\n end", "def show\n @skill_set = SkillSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skill_set }\n end\n end", "def show\n respond_to do |format|\n format.json {\n render json: @person, :include => [:roles => { include: [:privileges] } ]\n }\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 show\n @intention = Intention.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intention }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n authorize! :read, @answer\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @grant_record = GrantRecord.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @grant_record }\n end\n end", "def show\n authorize @user\n render json: @user\n end", "def show\n render json: @admin_skill\n end", "def show\n authorize! :read, @it_park\n end", "def show\n @authorization = Authorization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authorization }\n end\n end", "def index\n @permitidos = Permitido.all\n end", "def show\n @spanish_vocab = SpanishVocab.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spanish_vocab }\n end\n end", "def show\n @nut = Nut.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nut, include: :user, except: [:user_id, :password_hash, :password_salt] }\n end\n end", "def show\n authenticate_user!\n authorize! :index, @user, :message => 'Not authorized as an administrator.'\n \n @key_policy_maker = KeyPolicyMaker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @key_policy_maker }\n end\n end", "def show\n @ingredient = Ingredient.find_by(id: params[:id])\n authorize @ingredient\n end", "def show\n @permission = Permission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json =>@permission }\n end\n end", "def show\n @access_right = AccessRight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @access_right }\n end\n end", "def permit(type,options={})\n raise NameError.new(\"duplicate ability definition\") if @ability.key? type\n ability_object = GraphQL::Authorization::AbilityType.new(type,nil,{})\n if options.key?(:except) && options.key?(:only)\n raise ArgumentError.new(\"you cannot specify white list and black list\")\n end\n if options[:except]\n ability_object.access(type.fields.keys.map(&:to_sym) - options[:except])\n elsif options[:only]\n ability_object.access(options[:only])\n end\n ability_object.execute options[:execute]\n if block_given?\n #note Proc.new creates a proc with the block given to the method\n ability_object.instance_eval(&Proc.new)\n end\n @ability[type] = ability_object\n end", "def accessory_params\n params.require(:accessory).permit(:name, :weapon, :shield)\n end", "def show\n @wallet = Wallet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wallet }\n end\n end", "def show\n @lab_permissions_role = LabPermissionsRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_permissions_role }\n end\n end", "def show\n @permission_resource = PermissionResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @permission_resource }\n end\n end", "def show\n @user_requirement = UserRequirement.find(params[:id])\n render json: @user_requirement\n end", "def index\n @scans = policy_scope(Scan)\n render json: @scans\n end", "def set_permitido\n @permitido = Permitido.find(params[:id])\n end", "def index\n @abilities = Ability.all\n end", "def show\n @achievment = Achievment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @achievment }\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def whitelist\n if cannot_access_api?\n render json: [], status: :unauthorized\n end\n end", "def create\n @workpermit = Workpermit.new(workpermit_params)\n\n respond_to do |format|\n if @workpermit.save\n format.html { redirect_to @workpermit, notice: 'Workpermit was successfully created.' }\n format.json { render :show, status: :created, location: @workpermit }\n else\n format.html { render :new }\n format.json { render json: @workpermit.errors, status: :unprocessable_entity }\n end\n end\n end", "def ability_params\n params.require(:ability).permit(:child_id, :skill_id, :status)\n end", "def show\n @sanitation = Sanitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sanitation }\n end\n end", "def index\n if params[:id]\n @skills = Skill.where(id:params[:id])\n elsif params[:user_id]\n @skills = Skill.where(user_id:params[:user_id])\n elsif params[:name]\n @skills = Skill.where(name:params[:name])\n else\n @skills = Skill.includes(:user).all() #fix n+1 query\n end\n render json: @skills\n end", "def show\n @user_skill = UserSkill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_skill }\n end\n end", "def show\n @availablity = Availablity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @availablity }\n end\n end", "def set_workpermit\n @workpermit = Workpermit.find(params[:id])\n end", "def show\n respond_to do |format|\n format.html { \n authorize! :index, @club\n }\n format.json { \n \n }\n end\n end", "def show\n @guarantor = Guarantor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guarantor }\n end\n end", "def show\n @audit = Audit.find(params[:id])\n respond_with @audit.as_json(:include => [:location, :fine_tunes, :auditors, :auditees, :paragraphs => {only: [:id, :name]}])\n end", "def index\n authorize! :index, Campus, :message => 'Acceso denegado.'\n @campuses = @university.campuses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @campuses }\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 show\n if params[:user_id]\n @user = User.find(params[:user_id])\n @skill = @user.skills.where(id:params[:id])\n render json: @skill\n elsif params[:id]\n @skill = Skill.where(id:params[:id])\n render json: @skill\n elsif params[:name]\n @skill = Skill.where(name:params[:name])\n render json: @skill\n else\n render json: {result:'nothing found'}\n end\n end", "def show\n authorize @application_form\n render json: @application_form\n end", "def show\n authorize! :read, @wishlist_project\n end", "def show\n rent = Rent.find(params['rent_id'])\n authorize rent\n render(json: rent, serializer: RentSerializer)\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 show\n @balance = scope.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @balance }\n end\n end", "def show\n authorize @sector\n respond_to do |format|\n format.js\n end\n end", "def hability_params\n params.require(:hability).permit(:name)\n end", "def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end", "def show\n @warrior = Warrior.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @warrior }\n end\n end", "def show\n @user = User.find(params[:id])\n @secrets = Secret.where(user:@user)\n @secrets_liked = @user.secrets_liked\n end" ]
[ "0.6687496", "0.6633081", "0.64910364", "0.6151438", "0.6097908", "0.6030518", "0.60210127", "0.60129726", "0.60122436", "0.5946877", "0.59093624", "0.59013546", "0.58755577", "0.5848156", "0.577358", "0.57587016", "0.57269484", "0.56988317", "0.5671168", "0.56572044", "0.56263787", "0.5615591", "0.5599321", "0.55896425", "0.5587501", "0.5581022", "0.5579434", "0.5577803", "0.5569775", "0.55405664", "0.5527992", "0.5516761", "0.55140525", "0.55085117", "0.55031973", "0.55025554", "0.55016106", "0.54897225", "0.5476568", "0.54728675", "0.54653037", "0.5464591", "0.54631", "0.54582167", "0.5446648", "0.5444046", "0.5439663", "0.54320854", "0.54319847", "0.54160714", "0.53938967", "0.53902143", "0.5389933", "0.53717417", "0.53527325", "0.53423697", "0.5337808", "0.5335482", "0.5334349", "0.53340423", "0.5331979", "0.5330362", "0.533004", "0.53146076", "0.53145385", "0.5308962", "0.5307468", "0.530695", "0.5305352", "0.5304727", "0.52981204", "0.5297041", "0.52927744", "0.5284701", "0.5284539", "0.52835524", "0.52827716", "0.5282768", "0.52773803", "0.5275099", "0.52750707", "0.5274026", "0.5269673", "0.5269259", "0.5265699", "0.52649933", "0.5258184", "0.52441365", "0.52430636", "0.5232961", "0.52305484", "0.5224693", "0.52215904", "0.52199394", "0.52111673", "0.520835", "0.52082723", "0.52075994", "0.52073246", "0.52073246", "0.5204852" ]
0.0
-1
POST /permits POST /permits.json
def create @permit = Permit.new(permit_params) @permit.category_id = params[:category_id] @permit.employee_id = params[:employee_id] @permit.site_id = params[:site_id] respond_to do |format| if @permit.save format.html { redirect_to @permit, notice: 'Permit was successfully created.' } format.json { render :show, status: :created, location: @permit } else format.html { render :new } format.json { render json: @permit.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @permit = Permit.new(permit_params)\n\n respond_to do |format|\n if @permit.save\n format.html { redirect_to @permit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @permit }\n else\n format.html { render :new }\n format.json { render json: @permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def set_permit\n @vehiclepermit = Permit.find(params[:id])\n authorize @vehiclepermit\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def visit_params\n params.require(:visit).permit(*allowable)\n end", "def create\n @auth_assign_permit = Auth::AssignPermit.new(params[:auth_assign_permit])\n\n respond_to do |format|\n if @auth_assign_permit.save\n format.html { redirect_to @auth_assign_permit, notice: 'Assign permit was successfully created.' }\n format.json { render json: @auth_assign_permit, status: :created, location: @auth_assign_permit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @auth_assign_permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n vehicle = Vehicle.find_by(license_number: permit_params[:vehicle_attributes][:license_number])\n if current_user.faculty?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today, \n entered_by: current_user.faculty.first_name + \" \" + current_user.faculty.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n elsif current_user.student?\n @vehiclepermit = current_user.vehiclepermit.build(permit_params.merge(date_entered: Date.today,\n entered_by: current_user.student.first_name + \" \" + current_user.student.last_name))\n @vehiclepermit.update(vehicle: vehicle)\n end\n authorize @permit\n\n respond_to do |format|\n if @vehiclepermit.save\n format.html { redirect_to @vehiclepermit, notice: 'Permit was successfully created.' }\n format.json { render :show, status: :created, location: @vehiclepermit }\n else\n format.html { render :new }\n format.json { render json: @vehiclepermit.errors, status: :unprocessable_entity }\n end\n end\n end", "def permits\n @permits ||= builders.inject({}) do |permits, builder|\n debug \"++ Permit Builder: #{builder_class builder}\"\n built_permits = permits_built_with(builder)\n\n if built_permits\n debug \"== Permits built: #{built_permits.size}\"\n permits[builder] = built_permits\n end\n\n permits\n end\n end", "def form_params\n # Remove role and privilege ids as these are managed by the app not by\n # the active record associations\n params[:user].delete :role_ids\n params[:user].delete :privilege_ids\n params.require(:user).permit(user_allowable_params)\n end", "def post_params\n permit_params\n end", "def post_block_params\n permit_params\n end", "def tam_policy_params\n params.require(:tam_policy).permit(TamPolicy.allowable_params)\n end", "def post_card_params\n params[:post_card].permit!\n end", "def access_control_params\n params.require(:access_control).permit(:uuid, :role_id, :ability_to_create_stream, :ability_to_create_discussion, :ability_to_comment, :ability_to_create_question, :ability_to_create_answer, :ability_to_administrate)\n end", "def user_access_params\n params.require(:user_access).permit(:username, responsibility_ids:[])\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 json_entry_params\n params.require(:json_entry).permit(:area_id, :data, :name, :verb, :post_body)\n end", "def create\n @workpermit = Workpermit.new(workpermit_params)\n\n respond_to do |format|\n if @workpermit.save\n format.html { redirect_to @workpermit, notice: 'Workpermit was successfully created.' }\n format.json { render :show, status: :created, location: @workpermit }\n else\n format.html { render :new }\n format.json { render json: @workpermit.errors, status: :unprocessable_entity }\n end\n end\n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def form_params\n params.require(:scenario).permit(Scenario.allowable_params)\n end", "def permit(type,options={})\n raise NameError.new(\"duplicate ability definition\") if @ability.key? type\n ability_object = GraphQL::Authorization::AbilityType.new(type,nil,{})\n if options.key?(:except) && options.key?(:only)\n raise ArgumentError.new(\"you cannot specify white list and black list\")\n end\n if options[:except]\n ability_object.access(type.fields.keys.map(&:to_sym) - options[:except])\n elsif options[:only]\n ability_object.access(options[:only])\n end\n ability_object.execute options[:execute]\n if block_given?\n #note Proc.new creates a proc with the block given to the method\n ability_object.instance_eval(&Proc.new)\n end\n @ability[type] = ability_object\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def ability_params\n params.require(:ability).permit(:number, :name, :description, :shortdescription)\n end", "def formulary_params\n allow = [:responsable_llenado,:cod01,:cod02,:ape01,:ape04,:ape07,:ape02,:ape05,:ape03,:ape06,:api01,:api04,:api02,:ssb01,:api03,:cao01,:cao04,:cao07,:cao10,:tit01,:cao02,:cao05,:cao08,:cao11,:cao03,:cao06,:cao09,:cao12,:uni01,:uni02,:uni03,:ben01,:ben02,:per01,:per02,:user_id]\n params.require(:formulary).permit(allow)\n end", "def will_params\n wills = params.select { |k, _v| k.starts_with?(\"vault_entry_\") }\n permitted_params = {}\n wills.keys.each do |will|\n permitted_params[will] = [:id, :title, :executor_id, :notes, :agent_ids, :document_id, primary_beneficiary_ids: [], secondary_beneficiary_ids: [], share_ids: [], share_with_contact_ids: []]\n end\n wills.permit(permitted_params)\n end", "def asset_fleet_params\n params.require(:asset_fleet).permit(AssetFleet.allowable_params)\n end", "def create\n @allowed = Allowed.new(allowed_params)\n\n respond_to do |format|\n if @allowed.save\n format.html { redirect_to @allowed, notice: 'Allowed was successfully created.' }\n format.json { render :show, status: :created, location: @allowed }\n else\n format.html { render :new }\n format.json { render json: @allowed.errors, status: :unprocessable_entity }\n end\n end\n end", "def ability_params\n params.require(:ability).permit(:child_id, :skill_id, :status)\n end", "def form_params\n params.require(:funding_request).permit(FundingRequest.allowable_params)\n end", "def permit_params\n params.require(:permit).permit(:permit_type, :applicant_name, :start_date, :end_date, :address, :payload, :geometry)\n end", "def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end", "def users_params\n\t\tparams.require(:user).permit(User::PERMIT_ATTRIBUTES)\n\tend", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def json_params\n params.require(:json).permit(:type, :data)\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def permits\n return @permits if changed?\n @permits = loader.permits\n end", "def request_permitted?(item)\n true\n end", "def accessory_params\n params.require(:accessory).permit(:name, :weapon, :shield)\n end", "def caste_params\n params.require(:caste).permit(:name, ability_ids: [])\n end", "def privilege_params\n params.require(:privilege).permit(:qDrive, :addSong, :editSong, :deleteSong, :grantPermission, :addUser, :editUser, :deleteUser)\n end", "def csrfattack_params\n params.require(:csrfattack).permit(:professor, :vote)\n end", "def update\n respond_to do |format|\n if @permit.update(permit_params)\n format.html { redirect_to @permit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @permit }\n else\n format.html { render :edit }\n format.json { render json: @permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_params\n params.require(:post).permit(:title, :body, :url, :user_id, :tag_list, religion_ids: [] )\n end", "def defect_params\n params.require(:defect).permit(Defect.allowable_params)\n end", "def resource_params\n deserialized_params.permit!\n end", "def form_params\n params.require(:ntd_form).permit(NtdForm.allowable_params)\n end", "def grant_params\n params.require(:grant).permit(:user_id, :entry_id, :status)\n end", "def analise_privacidade_params\n #params.require(:analise_privacidade).permit(:rede_social, :url_rede_social, :descricao_analise, tipo_coumunicacoes_attributes: [:id, :tipo_comunicacao, :observacao])\n \n \n params.require(:analise_privacidade).permit!\n \n \n \n \n \n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def hack_params\n params.require(:hack).permit(:title, :body, :tag_list, :tag)\n end", "def create\n @user = User.new()\n user_params = permitted_attributes(@user)\n @user.attributes = user_params\n authorize(@user)\n if @user.save\n users = policy_scope(User)\n render json: { users: users}\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @idea = current_member.ideas.new(idea_params) \n respond_to do |format|\n sectors_params.delete(\"\")\n if @idea.save\n sectors_params.each do |k|\n @idea.sectors << Sector.find_by(id:k)\n end\n format.json { head :no_content }\n format.js\n else\n\n format.json { render :json => { :error => @idea.errors.full_messages }, :status => 422 }\n end\n \n end\n end", "def permission_policy_params\n params.require(:permission_policy).permit(:name, :io1, :io2, :io3, :io4)\n end", "def access_params\n params.require(:access).permit(:name, :mode)\n end", "def create\n @permitido = Permitido.new(permitido_params)\n\n respond_to do |format|\n if @permitido.save\n addlog(\"Deu permissão a um usuário\")\n format.html { redirect_to @permitido, notice: 'Permissão criada com sucesso.' }\n format.json { render :show, status: :created, location: @permitido }\n else\n format.html { render :new }\n format.json { render json: @permitido.errors, status: :unprocessable_entity }\n end\n end\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def membership_params\n params.require(:membership).permit(:user_id, :year, :type, :stripe_card_token, :subscribe, privileges: [], membership: %i[info]).tap do |allowlisted|\n allowlisted[:info] = params[:membership][:info]\n end\n end", "def post(request, response)\n raise HTTPStatus::Forbidden\n end", "def post(request, response)\n raise HTTPStatus::Forbidden\n end", "def grant_params\n params.require(:grant).permit(:title, :name, :content, documents: [])\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end", "def admitting_params\n params.require(:admitting).permit(:patient, :content)\n end", "def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end", "def grant_params\n params.require(:grant).permit(:description, :is_active, :budget, :closing_at, :starting_at, :closed_at, :is_selection_done)\n end", "def post_params\n params.permit(:stars,\n :title,\n :comment,\n :course_id,\n :user_id,\n post_tag_ids: [])\n end", "def special_allowance_params\n params.require(:special_allowance).permit(:nama, :satuan)\n end", "def post_params\n params.require(:post).permit!\n end", "def json_account_params\n params.permit(:json_id, :data_id)\n end", "def permitted_params(action, kind=nil)\n params.require(model_name).permit!\n end", "def admission_params\n params.require(:admission).permit(:field, :specialization, :payment_type)\n end", "def skill_params\n params[:skill].permit(:music_id, :user_id, :kind, :rate, :isfc, :comment) # define right permission\n end", "def mood_list_params\n params[:moods] = encrypt_param params[:moods]\n params.permit(:moods)\n end", "def post_params\n # params.require(:post).permit(policy(@post).permitted_attributes) instead of permitted_attributes\n params.require(:post).permit(:title, :body)\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def params_not_permitted\n logger.warn('exception: params not permitted')\n render plain: \"403 ForbiddEn\", status: 403\n end", "def activity_params\n params[:activity].permit!\n end", "def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end", "def new\n @auth_assign_permit = Auth::AssignPermit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @auth_assign_permit }\n end\n end", "def submission_params\n allowed = :student_number, :last_name, :first_name, :week, :hours, :comments, :email, :github, :challenging\n (1..Course.current.exercises_max).each do |i|\n allowed << \"a#{i}\".to_s\n end\n params.require(:submission).permit(allowed)\n end", "def json_params\n params.require(:json).permit(:file1,:file,:filename,:filename1,:content_type1,:content_type,:file_contents,:file_contents1,:objekt,:objekt1)\n end", "def access_params\n params.require(:access).permit(:title, :code)\n end", "def ability_params\n params.require(:ability).permit(:name, :description , :video, :heroe_id, :image)\n end", "def hability_params\n params.require(:hability).permit(:name)\n end", "def index\n permits = Permit.select('id, permit_type, applicant_name, start_date, end_date, address, application_data, city_name, ST_AsGeoJSON(geometry) AS geojson')\n .where(\"city_name = ? AND geometry IS NOT NULL AND address IS NOT NULL\", params[:city].upcase.gsub(/-/, \" \"))\n if permits\n respond_to do |format|\n format.json { render json: permits }\n end\n else\n respond_to do |format|\n format.json { render json: [], status: :bad_request }\n end\n end\n end", "def innovation_params\n params.require(:innovation).permit(:title, :abstract, :body, :consented)\n end", "def penalty_params\n params.require(:penalty).permit plist\n end", "def post_params(*args)\n params.require(:student).permit(*args)\n end", "def set_aside_params\n params.require(:set_aside).permit(:name, :selection_criterium_ids => [])\n end", "def form_params\n params.require(:highway_structure).permit(HighwayStructure.new.allowable_params)\n end", "def form_params\n params.require(:culvert).permit(Culvert.new.allowable_params)\n end", "def vip_privilege_params\n params[:vip_privilege].permit!\n end", "def adopt_params\n params.permit(:user_id, :animal_id, :amount)\n end", "def submission_params\n params.require(:submission).permit(PERMIT_FIELDS)\n end", "def vacancy_params\n params.require(:vacancy).permit(:title, :description, :wage, :position, skill_ids: [])\n end", "def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end", "def seminar_params\n params.require(:seminar).permit policy(Seminar).permitted_attributes\n end", "def permission_params\n params.require(:permission).permit(:subjuct_class, :action, :name, :description)\n end" ]
[ "0.7121574", "0.6456046", "0.6390089", "0.6292707", "0.61748934", "0.6170476", "0.6135272", "0.6074082", "0.60365325", "0.6006201", "0.5979559", "0.59678626", "0.5920976", "0.5881255", "0.58673215", "0.5848935", "0.58320343", "0.58314365", "0.58283794", "0.5823748", "0.58190167", "0.5787645", "0.5780855", "0.57801706", "0.5778673", "0.57781833", "0.5766474", "0.576241", "0.5758433", "0.5756584", "0.57523394", "0.57179725", "0.57055056", "0.57049954", "0.56865716", "0.5685734", "0.568383", "0.5680256", "0.5676231", "0.56726736", "0.56609845", "0.56211185", "0.56020373", "0.55683845", "0.55658114", "0.5565174", "0.5559473", "0.5558173", "0.55469054", "0.5546332", "0.554442", "0.5539868", "0.5535214", "0.55347764", "0.552461", "0.55218595", "0.55169976", "0.5513329", "0.5508692", "0.5508692", "0.54997516", "0.5495144", "0.54914814", "0.54902935", "0.54892504", "0.5488943", "0.54876876", "0.5469588", "0.5469011", "0.5467915", "0.5467032", "0.5462855", "0.54623395", "0.5460395", "0.54568464", "0.54543525", "0.5453878", "0.54481894", "0.54434574", "0.5439181", "0.5438264", "0.54367495", "0.5428915", "0.5427397", "0.5418778", "0.5417951", "0.54065025", "0.54060006", "0.5404457", "0.54007834", "0.5395892", "0.53943574", "0.5394322", "0.5390973", "0.538404", "0.5379846", "0.537756", "0.5375823", "0.5373885", "0.53620654" ]
0.658533
1
PATCH/PUT /permits/1 PATCH/PUT /permits/1.json
def update @permit.category_id = params[:category_id] @permit.employee_id = params[:employee_id] @permit.site_id = params[:site_id] respond_to do |format| if @permit.update(permit_params) format.html { redirect_to @permit, notice: 'Permit was successfully updated.' } format.json { render :show, status: :ok, location: @permit } else format.html { render :edit } format.json { render json: @permit.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @permit.update(permit_params)\n format.html { redirect_to @permit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @permit }\n else\n format.html { render :edit }\n format.json { render json: @permit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@auth_assign_permit = Auth::AssignPermit.find(params[:id])\n if current_user.admin_group?\n @admin_user = current_user\n @owner_user = User.find(params[:id])\n\n respond_to do |format|\n if @owner_user.update_attributes(params[:user])\n format.html { redirect_to auth_assign_permit_path(@owner_user), notice: 'Assign permit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @auth_assign_permit.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n authorize! :update, @kit\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 { render :show, status: :ok, location: @kit }\n else\n format.html { render :edit }\n format.json { render json: @kit.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update_resource(resource, params)\n check_id_uniformity(params)\n resource.assign_attributes(json_api_attributes(params))\n authorize resource, :update?\n resource.save!\n resource\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def update\n authorize @specialization\n\n respond_to do |format|\n if @specialization.update(specialization_update_params)\n format.html { redirect_to @specialization, notice: I18n.t(\"activerecord.notice.specialization.success_update\") }\n format.json { render :show, status: :ok, location: @specialization }\n else\n format.html { render :edit }\n format.json { render json: @specialization.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n success = false;\n error = \"Resource not available.\"\n permissions = nil\n\n if params.key?(:id) and params.key?(:permissions)\n permissions = ProjectPermission.find_by(id: params[:id])\n if permissions\n if permissions.user and permissions.user == @current_user\n error = \"User permissions may not be modified.\"\n else\n project = permissions.project\n if project and user_can_access_project(project.id, [:can_author])\n\n p = params.require(:permissions).permit(\n :can_author, :can_view, :can_annotate).to_h\n\n p['can_view'] = p['can_view'] == 'true' if p.key? 'can_view'\n p['can_annotate'] = p['can_annotate'] == 'true' if p.key? 'can_annotate'\n p['can_author'] = p['can_author'] == 'true' if p.key? 'can_author'\n\n ## Authors get full permissions.\n if p['can_author']\n p['can_view'] = true\n p['can_annotate'] = true\n p['can_author'] = true\n ## Annotators get at least viewing and annotation permissions.\n elsif p['can_annotate']\n p['can_view'] = true\n end\n\n\n ## Make sure that can_view is not being taken away from a user with\n ## authoring or annotation permissions.\n if( !p['can_view'] and (\n get_with_default(p, 'can_author', permissions.can_author.to_s) == 'true' or \n get_with_default(p, 'can_annotate', permissions.can_annotate.to_s) == 'true'))\n # Rails.logger.debug \"Hello -- ILLEGAL STATE REACHED!\"\n error = \"Illegal state of permissions: you cannot revoke \"+\n \"viewing permissions from an author or annotator.\"\n else\n success = permissions.update(p)\n error = \"Error updating permissions.\" unless success\n end\n\n \n # success = false;\n # error = \"#{params.to_json} #{p.to_json}\"\n end\n end\n end\n end\n\n if success\n render json: permissions, serializer: ProjectPermissionSerializer,\n root: \"permissions\"\n else\n render_error error\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def set_permit\n @permit = Permit.find(params[:id])\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @skill = Skill.find(params[:id])\n\t\tauthorize! :update, Skill\n\t\t\n respond_to do |format|\n if @skill.update_attributes(params[:skill])\n format.html { redirect_to skills_path, notice: 'Skill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @skill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if( get_seeker_id = params[:id] )\n @seeker.skill_list = params[:seeker][:skill_list].to_s.downcase\n respond_to do |format|\n if @seeker.update(seeker_params)\n format.html { redirect_to root_path, notice: 'Seeker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @seeker.errors, status: :unprocessable_entity }\n end\n end\n else\n permission_denied \"You_do_no_own_this_profile\"\n end\n end", "def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end", "def update\n authorize @recipe\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n ## Can't review an already reviewed request.\n if @permission_request.reviewed\n respond_with_error 'This request has already been reviewed.', \n permission_request_path(@permission_request)\n else\n granted = (params.require(:permission_request).require(:action) == 'grant')\n \n ## Update the request with the review.\n @permission_request.update!({\n reviewed: true,\n granted: granted,\n reviewed_by: current_user,\n reviewed_on: Time.now\n })\n \n ## Update the user's permission level.\n if granted\n @permission_request.user.update!({\n permission_level: @permission_request.level_requested,\n permission_level_granted_on: @permission_request.reviewed_on,\n permission_level_granted_by: current_user\n })\n @user = @permission_request.user\n @user.send_permissions_changed_email\n end\n \n respond_to do |format|\n format.json { render json: {\n success: true, \n permission_request: {\n granted: @permission_request.granted,\n reviewed_by_username: current_user.username,\n reviewed_on: @permission_request.reviewed_on\n }\n } }\n format.html { redirect_to path }\n end\n end\n rescue => e \n respond_with_error 'There was a problem saving changes to this request.', \n permission_request_path(@permission_request)\n end\n end", "def update\n authorize @exam\n respond_to do |format|\n if @exam.update(exam_params)\n format.html { redirect_to @exam, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n end\n end\n end", "def update\n respond_to do |format|\n if @workpermit.update(workpermit_params)\n format.html { redirect_to @workpermit, notice: 'Workpermit was successfully updated.' }\n format.json { render :show, status: :ok, location: @workpermit }\n else\n format.html { render :edit }\n format.json { render json: @workpermit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @allowed.update(allowed_params)\n format.html { redirect_to @allowed, notice: 'Allowed was successfully updated.' }\n format.json { render :show, status: :ok, location: @allowed }\n else\n format.html { render :edit }\n format.json { render json: @allowed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person.update_attributes(permit_params)\n format.html { redirect_to(@person, :notice => 'Person was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @grant = Grant.find(params[:id])\n\n respond_to do |format|\n if @grant.update_attributes(params[:grant])\n format.html { redirect_to root_url, notice: 'Training was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @grant.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile_update_credibilty\n params.require.permit(:profile).permit(:credibility)\n end", "def update\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end", "def http_method_modifies_resource?\n ['PUT','POST','PATCH'].include?(method.to_s.upcase)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "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 authorize! :update, @recipe\n \n @recipe.modifier = current_user\n \n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe, notice: t('.success') }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.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 authorize\n render json: { status: 200, msg: 'You are not allowed to do this update' } unless current_user && current_user.can_modify_user?(params[:id])\n end", "def update\n head :unauthorized\n end", "def update\n @allowance = Allowance.find(params[:id])\n\n respond_to do |format|\n if @allowance.update_attributes(params[:allowance])\n format.html { redirect_to @allowance, notice: 'Allowance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @allowance.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 @editability = Editability.find(params[:id])\n\n respond_to do |format|\n if @editability.update_attributes(params[:editability])\n format.html { redirect_to @editability, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @editability.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize :resquest_type, :update?\n respond_to do |format|\n if @resquest_type.update(resquest_type_params)\n format.html { redirect_to @resquest_type, notice: 'Resquest type was successfully updated.' }\n format.json { render :show, status: :ok, location: @resquest_type }\n else\n format.html { render :edit }\n format.json { render json: @resquest_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n abilities = []\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n respond_to do |format|\n if @role.update(role_params)\n format.html { redirect_to roles_path, notice: 'Role was successfully updated.' }\n format.json { render :show, status: :ok, location: @role }\n else\n format.html { render :edit }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @ingredient.recipe\n respond_to do |format|\n if @ingredient.update(ingredient_params)\n format.html { redirect_to @ingredient}\n format.json { render :show, status: :ok, location: @ingredient }\n else\n format.html { render :edit }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @secret, :update?\n\n respond_to do |format|\n if @secret.update(secret_params)\n format.html { redirect_to @secret, notice: 'Secret was successfully updated.' }\n format.json { render :show, status: :ok, location: @secret }\n else\n format.html { render :edit }\n format.json { render json: @secret.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, Pupil\n respond_to do |format|\n if @pupil.update(pupil_attrs)\n format.html { redirect_to @pupil, notice: t('action.update.succeed', entity: Pupil.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pupil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, CompetenceTierGroup\n \n @competence_tier_group.update!(competence_tier_group_params)\n render json: {status: :ok}\n end", "def update\n @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 enforce_update_permissions(opts={})\n enforce_edit_permissions(opts)\n end", "def set_permit\n @vehiclepermit = Permit.find(params[:id])\n authorize @vehiclepermit\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end", "def special_update\n @petition = @signature.petition\n\n # only allow updates from admins\n authorize @petition\n\n respond_to do |format|\n if @signature.update(special_params)\n format.html { redirect_to @petition, notice: 'Signature was successfully updated.' }\n format.json { render :show, status: :ok }\n else\n format.html { redirect_to @petition, notice: 'Signature was successfully updated.' }\n format.json { render json: @signature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @theorem\n if @theorem.update(theorem_params)\n render json: @theorem, status: :ok, location: @theorem\n else\n render json: @theorem.errors, status: :unprocessable_entity\n end\n end", "def update\n @grant = Grant.find(params[:id])\n\n respond_to do |format|\n if @grant.update_attributes(params[:grant])\n format.html { redirect_to @grant, :notice => 'Grant was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @grant.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reqdifficulty.update(reqdifficulty_params)\n format.html { redirect_to @reqdifficulty, notice: 'Reqdifficulty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reqdifficulty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end", "def update\n respond_to do |format|\n if @permitido.update(permitido_params)\n addlog(\"Atualizou a permissão de um usuário\")\n format.html { redirect_to @permitido, notice: 'Permissão atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @permitido }\n else\n format.html { render :edit }\n format.json { render json: @permitido.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 unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n if @resource.update(resource_params)\n render json: @resource, status: :ok\n else\n render json: @resource.errors, status: :unprocessable_entity\n end\n end", "def update\n authorize! :update, @user, :message => 'Not authorized as an administrator.'\n respond_to do |format|\n if @wanted.update(wanted_params)\n format.html { redirect_to @wanted, notice: 'Wanted was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wanted.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @allows = args[:allows] if args.key?(:allows)\n @schema = args[:schema] if args.key?(:schema)\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @request = Request.find(params[:id])\n\n respond_to do |format|\n if current_user.has_role? :admin \n if @request.update_attributes(params[:request])\n format.html { redirect_to request_info_user_requests_path(current_user.id), notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n else\n if @request.update_attributes(params[:request])\n format.html { redirect_to user_requests_path(current_user.id), notice: 'Request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @grant_sector.update(grant_sector_params)\n format.html { redirect_to @grant_sector, notice: 'Grant sector was successfully updated.' }\n format.json { render :show, status: :ok, location: @grant_sector }\n else\n format.html { render :edit }\n format.json { render json: @grant_sector.errors, status: :unprocessable_entity }\n end\n end\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 authorize @recipe\n respond_to do |format|\n if @recipe.update(recipe_params)\n format.html { redirect_to @recipe }\n format.json { render :show, status: :ok, location: @recipe }\n else\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @default_ability.update(default_ability_params)\n format.html { redirect_to @default_ability, notice: 'Default ability was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @default_ability.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n respond_to do |format|\n if @api_v1_initiative_update.update(api_v1_initiative_update_params)\n format.html { redirect_to @api_v1_initiative_update, notice: 'Initiative update was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_update }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_update.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @security_and_privacy_vulnerability.update(security_and_privacy_vulnerability_params)\n format.html { redirect_to @security_and_privacy_vulnerability, notice: 'Security and privacy vulnerability was successfully updated.' }\n format.json { render :show, status: :ok, location: @security_and_privacy_vulnerability }\n else\n format.html { render :edit }\n format.json { render json: @security_and_privacy_vulnerability.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @gf_travel_request\n respond_to do |format|\n if @gf_travel_request.update(grant_funded_travel_request_params)\n format.html { redirect_to @gf_travel_request, notice: 'Grant funded travel request was successfully updated.' }\n format.json { render :show, status: :ok, location: @gf_travel_request }\n else\n format.html { render :edit }\n format.json { render json: @gf_travel_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, @flock\n\n respond_to do |format|\n if @flock.update(flock_params)\n format.html { redirect_to @flock, notice: \"Flock was successfully updated.\" }\n format.json { render :show, status: :ok, location: @flock }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @flock.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @specification.update(specification_params)\n audit(@specification, current_user)\n render json: @specification, status: :ok, serializer: Web::V1::SpecificationSerializer\n else\n render json: @specification.errors, status: :unprocessable_entity\n end\n end", "def update\n authorize! :update, @model\n respond_to do |format|\n if @model.update(model_params)\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { render :show, status: :ok, location: @model }\n else\n format.html { render :edit }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize(@user)\n user_params = permitted_attributes(@user)\n if @user.update(user_params)\n users = policy_scope(User)\n render json: { users: users}\n else\n render json: @user.errors, status: :unprocessable_entity\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 if @secret.update_attributes(secret_params)\n head :no_content\n else\n render json: @secret.errors, status: :unprocessable_entity\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_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\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 @req.update(req_params)\n flash[:notice] = \"Your requirement has been saved\"\n format.html { redirect_to @req }\n format.json { render :show, status: :ok, location: @req }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @req.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n vehicle = Vehicle.find_by(license_number: permit_params[:vehicle_attributes][:license_number])\n \n respond_to do |format|\n if @vehiclepermit.update(permit_params)\n @vehiclepermit.update(vehicle: vehicle)\n format.html { redirect_to @vehiclepermit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehiclepermit }\n else\n format.html { render :edit }\n format.json { render json: @vehiclepermit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @perk\n respond_to do |format|\n if @perk.update(perk_params)\n format.html { redirect_to perks_path, notice: 'Perk was successfully updated.' }\n format.json { render :show, status: :ok, location: @perk }\n else\n format.html { render :edit }\n format.json { render json: @perk.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n authorize! :manage, @user\n \n respond_to do |format|\n\n if (current_user.id == @user.id) \n # Don't let a non-administrator assign themselves admin/download/viewing priviledges.\n # (Also) Don't let the current user disable their own admin account!\n params[:user].delete \"is_administrator\"\n if ! current_user.is_administrator\n params[:user].delete \"is_data_downloader\"\n params[:user].delete \"is_data_viewer\"\n end\n end \n \n\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n # format.json { render :show, status: :ok, location: @user }\n format.json { respond_with_bip(@user) }\n else\n format.html { render :edit }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n format.json { respond_with_bip(@user) }\n end\n end\n end", "def update\n respond_to do |format|\n if @set_aside.update(set_aside_params)\n format.html { redirect_to @set_aside, notice: 'Set aside was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @set_aside.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update!(**args)\n @granted = args[:granted] if args.key?(:granted)\n @permission = args[:permission] if args.key?(:permission)\n @resource = args[:resource] if args.key?(:resource)\n @resource_attributes = args[:resource_attributes] if args.key?(:resource_attributes)\n end", "def update\n authorize! :update, @part\n respond_to do |format|\n if @part.update(part_params)\n format.html { redirect_to @part, notice: 'Part was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @part.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_params\n #json_data = request.raw_post()\n #params.require(:reference_number).permit(:name, :email, :twitter)\n params.permit(:dependents)\n end", "def update\n @admin_whitelist = Admin::Whitelist.find(params[:id])\n\n respond_to do |format|\n if @admin_whitelist.update_attributes(params[:admin_whitelist])\n format.html { redirect_to @admin_whitelist, notice: 'Whitelist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_whitelist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @attorney\n respond_to do |format|\n if @attorney.update(attorney_params)\n format.html { redirect_to @attorney, success: I18n.t('notices.updated', entity: Attorney.model_name.human, title: @attorney.name) }\n format.json { render :show, status: :ok, location: @attorney }\n else\n format.html { render :edit }\n format.json { render json: @attorney.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student]) &&\n @student.user.update_attributes({:role_pending => params[:role_pending]})\n\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: 'Vaga atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n authorize! current_user, @vacancy\n end", "def update\n @admin_skill = Admin::Skill.find(params[:id])\n\n if @admin_skill.update(admin_skill_params)\n head :no_content\n else\n render json: @admin_skill.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def update\n respond_to do |format|\n if @pet_true.update(pet_true_params)\n format.html { redirect_to @pet_true, notice: 'Pet true was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_true.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(context)\n context.request.body.rewind # in case someone already read it\n\n begin\n data = JSON.parse(context.request.body.read)\n rescue JSON::ParserError\n context.halt(406, { status: 'error', message: 'Not acceptable JSON payload' }.to_json)\n end\n\n set_resource(context)\n\n begin\n permitted_params = resource_fields.map { |k| k[:name] }\n permitted_params = data.select { |k, _| permitted_params.include?(k) }\n\n if instance_variable_get(:\"@#{resource_name}\").update_attributes(permitted_params)\n instance_variable_get(:\"@#{resource_name}\").reload\n instance_variable_get(:\"@#{resource_name}\").to_json\n else\n errors = instance_variable_get(:\"@#{resource_name}\").errors.map { |k, v| \"#{k}: #{v}\" }.join('; ')\n context.halt(406, { status: 'error', message: errors }.to_json)\n end\n rescue StandardError => e\n context.halt(500, { status: 'error', message: e.message }.to_json)\n end\n end", "def update\n @skill = Skill.find(params[:id])\n\n if @skill.update(skill_params)\n head :no_content\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end", "def update\n @request = @skill.requests.find(params[:id])\n\n respond_to do |format|\n if @request.update_attributes(params[:request])\n format.html { redirect_to myrequests_path, notice: 'request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @review.update(review_params) && @review.revoke_approval!\n format.json { render :show, status: :ok, location: @review }\n else\n format.json { render json: @review.errors, status: :unprocessable_entity }\n end\n end\n end", "def permit_params_on_update *keys\n filter_strong_params :permit, [:update], keys\n end", "def update\n respond_to do |format|\n if @vip_privilege.update(vip_privilege_params)\n format.html { redirect_to @vip_privilege, notice: 'Vip privilege was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vip_privilege.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, @vspec\n\n respond_to do |format|\n if @vspec.update(vspec_params)\n format.html { redirect_to [@vspec.metric, @vspec], notice: 'Vspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vspec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end", "def update_resource(resource, params)\n resource.update_without_password(params)\n end" ]
[ "0.7037591", "0.6089023", "0.5942867", "0.592158", "0.5903526", "0.5898621", "0.5896345", "0.58882254", "0.58475435", "0.5841189", "0.5823558", "0.5815913", "0.5815889", "0.5787355", "0.57859033", "0.5783836", "0.5781662", "0.576887", "0.57535344", "0.5747716", "0.5733261", "0.5715137", "0.57134545", "0.57081825", "0.5701543", "0.5700232", "0.56966144", "0.5682057", "0.5679071", "0.56778437", "0.56702584", "0.56655127", "0.5663861", "0.5661822", "0.5658007", "0.5643948", "0.56362057", "0.5625989", "0.5620919", "0.56167585", "0.5616346", "0.56115764", "0.56104845", "0.5608158", "0.56063294", "0.5603153", "0.55919605", "0.55907565", "0.5590383", "0.55832624", "0.55724055", "0.5569477", "0.55687296", "0.55607104", "0.5559209", "0.5557824", "0.5554962", "0.5554134", "0.555045", "0.5548043", "0.55465496", "0.55434513", "0.55422944", "0.554214", "0.5538447", "0.5531098", "0.5527096", "0.551533", "0.5508036", "0.55034095", "0.5502328", "0.54963356", "0.5494409", "0.5493053", "0.54903", "0.5489031", "0.5487921", "0.54852057", "0.5483188", "0.54778945", "0.54758376", "0.5475166", "0.5474766", "0.54737025", "0.5467107", "0.5467048", "0.5464123", "0.54613346", "0.5461049", "0.54592496", "0.54551756", "0.5454094", "0.5453613", "0.54505956", "0.54505575", "0.5447709", "0.544722", "0.544722", "0.544722", "0.544722" ]
0.62426394
1
DELETE /permits/1 DELETE /permits/1.json
def destroy @permit.destroy respond_to do |format| format.html { redirect_to permits_url, notice: 'Permit was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vehiclepermit.destroy\n respond_to do |format|\n format.html { redirect_to permits_url, notice: 'Permit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @privilege.destroy\n respond_to do |format|\n format.html { redirect_to privileges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @allowed.destroy\n respond_to do |format|\n format.html { redirect_to alloweds_url, notice: 'Allowed 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 @solo.destroy\n respond_to do |format|\n format.html { redirect_to solos_url, notice: 'Solo was successfully destroyed.' }\n format.json { head :no_content }\n end\n authorize @solo\n end", "def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def delete\n request(:delete)\n end", "def destroy\n @disability = Disability.find(params[:id])\n @disability.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_disabilities_url }\n format.json { head :ok }\n end\n end", "def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'El secreto se eliminó correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @permitido.destroy\n addlog(\"Negou permissão de um usuário\")\n respond_to do |format|\n format.html { redirect_to permitidos_url, notice: 'Permissão apagada com sucesso' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @characteristic\n @characteristic.destroy\n respond_to do |format|\n format.html { redirect_to characteristics_url, notice: 'Characteristic was successfully destroyed.' }\n format.json { head :no_content }\n end\nend", "def destroy\n @exam.destroy\n authorize @exam\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user.admin_group?\n @admin_user = current_user\n @owner_user = User.find(params[:id])\n #@auth_assign_permit = Auth::AssignPermit.find(params[:id])\n #@auth_assign_permit.destroy\n @owner_user.permits = []\n @owner_user.save\n respond_to do |format|\n format.html { redirect_to auth_assign_permits_url }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n authorize! :destroy, Solicitud\n @solicitud.destroy\n respond_to do |format|\n format.html { redirect_to solicitudes_url, notice: 'Solicitud was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @secret, :destroy?\n\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'Secret was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete\n request('delete').auth_required!\n end", "def delete(params = {})\n params ||= {}\n params[:path] = @attributes[:path]\n raise MissingParameterError.new(\"Current object doesn't have a path\") unless @attributes[:path]\n raise InvalidParameterError.new(\"Bad parameter: path must be an String\") if params[:path] and !params[:path].is_a?(String)\n raise InvalidParameterError.new(\"Bad parameter: token must be an String\") if params[:token] and !params[:token].is_a?(String)\n raise MissingParameterError.new(\"Parameter missing: path\") unless params[:path]\n raise MissingParameterError.new(\"Parameter missing: token\") unless params[:token]\n\n Api.send_request(\"/locks/#{@attributes[:path]}\", :delete, params, @options)\n end", "def destroy\n authorize @demand\n @demand.destroy\n respond_to do |format|\n format.html { redirect_to demands_url, notice: 'Demand was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Like.delete(params[\"id\"])\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @grant_sector.destroy\n respond_to do |format|\n format.html { redirect_to grant_sectors_url, notice: 'Grant sector was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @grant = Grant.find(params[:id])\n @grant.destroy\n\n respond_to do |format|\n format.html { redirect_to grants_url }\n format.json { head :ok }\n end\n end", "def destroy\n @claimant = Claimant.find(params[:id])\n @claimant.destroy\n\n respond_to do |format|\n format.html { redirect_to claimants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vip_privilege.destroy\n respond_to do |format|\n format.html { redirect_to vip_privileges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @capacitacion = Capacitacion.find(params[:id])\n @capacitacion.destroy\n\n respond_to do |format|\n format.html { redirect_to capacitacions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @withdrawal_request = WithdrawalRequest.find(params[:id])\n @withdrawal_request.destroy\n\n respond_to do |format|\n format.html { redirect_to withdrawal_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_whitelist = Admin::Whitelist.find(params[:id])\n @admin_whitelist.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_whitelists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n return redirect_to root_url, notice: \"Vous n'avez pas accès à cette ressource.\" if !permition_to_write?(@user)\n @capacite = Capacite.find(params[:id])\n @capacite.destroy\n\n respond_to do |format|\n format.html { redirect_to capacites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @intention = Intention.find(params[:id])\n @intention.destroy\n\n respond_to do |format|\n format.html { redirect_to intentions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @kit\n @kit.destroy\n respond_to do |format|\n format.html { redirect_to kits_url, notice: 'Kit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @workpermit.destroy\n respond_to do |format|\n format.html { redirect_to workpermits_url, notice: 'Workpermit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @much_withdraw.destroy\n respond_to do |format|\n format.html { redirect_to much_withdraws_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capa = Capa.find(params[:id])\n @capa.destroy\n\n respond_to do |format|\n format.html { redirect_to capas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authenticate_user!\n authorize! :index, @user, :message => 'Not authorized as an administrator.'\n \n @key_policy_maker = KeyPolicyMaker.find(params[:id])\n @key_policy_maker.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 authorize! :update, @user, :message => 'Not authorized as an administrator.'\n @wanted.destroy\n respond_to do |format|\n format.html { redirect_to wanteds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restriction = Restriction.find(params[:id])\n @restriction.destroy\n\n respond_to do |format|\n format.html { redirect_to restrictions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @ingredient.recipe\n @ingredient.destroy\n respond_to do |format|\n format.html { redirect_to @ingredient.recipe }\n format.json { head :no_content }\n end\n end", "def destroy\n @t403.destroy\n respond_to do |format|\n format.html { redirect_to t403s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @special_allowance.destroy\n respond_to do |format|\n format.html { redirect_to special_allowances_url, notice: 'Tunjangan Khusus Telah Dihapus.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy\n @reqdifficulty.destroy\n respond_to do |format|\n format.html { redirect_to reqdifficulties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @representante_athlete = Representante::Athlete.find(params[:id])\n @representante_athlete.destroy\n\n respond_to do |format|\n format.html { redirect_to representante_athletes_url, notice: 'Atleta apagado com sucesso' }\n format.json { head :no_content }\n end\n end", "def destroy\n @secret.destroy\n respond_to do |format|\n format.html { redirect_to secrets_url, notice: 'Secret was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @early_access_request.destroy\n respond_to do |format|\n format.html { redirect_to early_access_requests_url, notice: 'Anfrage wurde gelöscht.' }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n request(:delete, path, {})\n end", "def delete(*rest) end", "def destroy\n @aliquotum = Aliquotum.find(params[:id])\n @aliquotum.destroy\n\n respond_to do |format|\n format.html { redirect_to aliquota_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(params = {})\n Client.current.delete(resource_url, params)\n end", "def destroy\n head :unauthorized\n end", "def deleteRequest\n\n end", "def destroy\n @skill = Skill.find(params[:id])\n\t\tauthorize! :destroy, Skill\n\t\t\n @skill.destroy\n\n respond_to do |format|\n format.html { redirect_to skills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grant.destroy\n respond_to do |format|\n format.html { redirect_to grants_url, notice: 'Grant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @editability = Editability.find(params[:id])\n @editability.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @guarantor = Guarantor.find(params[:id])\n @guarantor.destroy\n\n respond_to do |format|\n format.html { redirect_to guarantors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @advertise = Advertise.find(params[:id])\n authorize! :destroy, @advertise, :message => 'Acceso denegado.'\n @advertise.destroy\n\n respond_to do |format|\n format.html { redirect_to advertises_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @status_ativ = StatusAtiv.find(params[:id])\n @status_ativ.destroy\n\n respond_to do |format|\n format.html { redirect_to status_ativs_url }\n format.json { head :no_content }\n end\n end", "def delete_option\n option_param = params.permit(:id)\n\n render json: Option.delete_option(option_param)\n end", "def destroy\n @withdraw.destroy\n respond_to do |format|\n format.html { redirect_to withdraws_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @grant.destroy\n respond_to do |format|\n format.html { redirect_to grants_url, notice: \"Grant was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @priv_policy.destroy\n respond_to do |format|\n format.html { redirect_to priv_policies_url, notice: 'Priv policy was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url, notice: 'Access was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url, notice: \"Access was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @allowance = Allowance.find(params[:id])\n @account = @allowance.account\n @allowance.destroy\n\n respond_to do |format|\n format.html { redirect_to account_allowances_url(@account) }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @appliance\n @appliance.destroy\n respond_to do |format|\n format.html { redirect_to appliances_url, notice: 'Appliance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end", "def destroy\n authorize @recipe\n @recipe.destroy\n respond_to do |format|\n format.html { redirect_to recipes_url}\n format.json { head :no_content }\n end\n end", "def destroy\n authorize :resquest_type, :destroy?\n @resquest_type.destroy\n respond_to do |format|\n format.html { redirect_to resquest_types_url, notice: 'Resquest type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @infrastructure = Infrastructure.find(params[:id])\n checkaccountobject(\"infrastructures\",@infrastructure)\n @infrastructure.send_delete\n\n respond_to do |format|\n format.html { redirect_to infrastructures_url }\n format.json { head :ok }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @abuse.destroy\n respond_to do |format|\n format.html { redirect_to abuses_url, notice: t('views.flash_delete_message') }\n format.json { head :no_content }\n end\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def destroy\n @valid_access.destroy\n respond_to do |format|\n format.html { redirect_to valid_accesses_url }\n format.json { head :no_content }\n end\n end", "def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end", "def destroy\n authorize! :destroy, @impact_level\n @impact_level.destroy\n respond_to do |format|\n format.html { redirect_to impact_levels_url, notice: 'Impact level was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @secret_record.destroy\n\n respond_to do |format|\n format.html { redirect_to @group }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_mission = MediumMission.find(params[:id])\n @medium_mission.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_missions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @drone_attack = DroneAttack.find(params[:id])\n @drone_attack.destroy\n\n respond_to do |format|\n format.html { redirect_to drone_attacks_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @assessment = Assessment.find(params[:id])\n authorize! :destroy, @assessment\n\n @assessment.destroy\n\n respond_to do |format|\n format.html { redirect_to assessments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @capacidad = Capacidad.find(params[:id])\n @capacidad.destroy\n\n respond_to do |format|\n format.html { redirect_to capacidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to insurer_claims_url, notice: 'Claim was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @restriction = Restriction.find(params[:id])\n @restriction.destroy\n\n head :no_content\n end", "def destroy\n @grant_record = GrantRecord.find(params[:id])\n @grant_record.destroy\n\n respond_to do |format|\n format.html { redirect_to grant_records_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n authorize! :destroy, @questionnaire\n\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def delete\n user = getUserByAuthToken(request)\n user.soft_delete\n head :no_content\n end", "def destroy\n authorize! :destroy, @individual\n @individual.destroy\n respond_to do |format|\n format.html { redirect_to individuals_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7002032", "0.69629705", "0.679106", "0.6709306", "0.6706271", "0.6676756", "0.66675395", "0.66483545", "0.66381675", "0.66159225", "0.660326", "0.6602588", "0.65897876", "0.6589017", "0.65862536", "0.6574142", "0.6567747", "0.65636426", "0.65345496", "0.6531613", "0.65076166", "0.6501618", "0.6500306", "0.64982426", "0.6498119", "0.6497449", "0.6485023", "0.6484366", "0.6471811", "0.64707613", "0.64679044", "0.6466452", "0.6462464", "0.6454958", "0.6441545", "0.64393514", "0.6437928", "0.6431189", "0.64248544", "0.6423869", "0.6423847", "0.6419823", "0.64121425", "0.6410007", "0.6408939", "0.6408751", "0.6408377", "0.6407217", "0.64009804", "0.6397243", "0.6373738", "0.636505", "0.6360239", "0.6351707", "0.63498765", "0.63491464", "0.63457465", "0.6342006", "0.63409036", "0.634029", "0.6339656", "0.6335735", "0.6335476", "0.6334863", "0.63255316", "0.6321507", "0.6320905", "0.63204837", "0.6319037", "0.6318189", "0.6318055", "0.6317449", "0.6315851", "0.63136727", "0.63133496", "0.6313284", "0.631273", "0.6311702", "0.6309305", "0.6309305", "0.6309305", "0.6309305", "0.63069326", "0.6306404", "0.63063425", "0.63062185", "0.630566", "0.6305188", "0.63020235", "0.6301103", "0.6300268", "0.62999165", "0.6299337", "0.629658", "0.6291348", "0.628663", "0.628657", "0.6281572", "0.62813044", "0.6278125" ]
0.77983844
0
Use callbacks to share common setup or constraints between actions.
def set_permit @permit = Permit.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 permit_params params.require(:permit).permit(:permitid, :filename, :category_id, :site_id, :employee_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def 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
Checkse if devfile has any user added observers and sends notification to those nodes
def checkForObservers(devfile) begin path = "/user/" + params[:username] + "/device/" + params[:devicename] + "/files" + devfile.path + devfile.name devfile.file_observers.each do |fo| begin if fo XmppHelper::notificationToNode(fo, devfile, "Content updated!") end rescue Exception => ex putsE(ex) end end rescue Exception => e puts "Error in cheking checking devfile for observers!" puts " -- line: #{e.backtrace[0].to_s}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_users_and_add_it\n return # disabled for now\n return true if remote?\n User.find_all_by_notify_on_new_torrents(true).each do |user|\n Notifier.send_new(user,self) if user.notifiable_via_jabber?\n user.watch(self) unless user.dont_watch_new_torrents?\n end\n end", "def listeners\n users_to_notify = Set.new\n users_to_notify += self.proposal.currently_awaiting_approvers\n users_to_notify += self.proposal.individual_steps.approved.map(&:user)\n users_to_notify += self.proposal.observers\n users_to_notify << self.proposal.requester\n # Creator of comment doesn't need to be notified\n users_to_notify.delete(self.user)\n users_to_notify\n end", "def run_on_additions(paths)\n @builder.notify\n end", "def observers\n @observer_peers\n end", "def notifier; end", "def notifier; end", "def notify_observers\n\t\t@observers.each do |observer|\n\t\t\tobserver.update(self)\n\t\tend\n\tend", "def run_on_modifications(paths)\n @builder.notify\n end", "def notify_observers(*args)\n return unless changed?\n\n unwrap(connection).exec \"NOTIFY #{channel}, #{args}\"\n\n changed false\n end", "def observers\n @observers ||= []\n end", "def notify\n @observers.each { |observer| observer.update }\nend", "def notify_subscribers\n NotificationSubscription.notify(self)\n end", "def notify\n @subscribers.each { |ident, (block,obj)| block.call(obj) }\n end", "def content_added(content)\n update_attribute(:content_updated_on, content.created_on)\n notifications = []\n participants.each do |participant|\n next if participant.id == content.user_id\n next unless Notification.trigger(self, content, :recipient => participant, :sender => content.creator)\n notifications << participant.id \n end\n notifications\n end", "def run_on_changes(paths)\n @builder.notify\n end", "def notify_change\n SpecificNodeMailer.notify_change\n end", "def notified_users\n notified = []\n\n # Author and auditors are always notified unless they have been\n # locked or don't want to be notified\n notified << user if user\n\n notified += auditor_users\n\n # Only notify active users\n notified = notified.select { |u| u.active? }\n\n notified.uniq!\n\n notified\n end", "def notify_starting\n\t\tuser_list = []\n\t\tparty_list.each do |uid, uhash|\n\t\t\tuser_list <<= uid if uhash[:status] == STATUS_ATTENDING\t\t\t\n\t\tend\n\t\tnotification = EventNotification.new(NOTIF_EVENT_STARTING, self)\n\t\tnotify(notification, user_list, false)\n\tend", "def inform_obeservers\n\t\t@observers.each { |observer| observer.update(self) }\n\tend", "def send_notification\n self.target_followers.each do |target_follower|\n @user = User.find(target_follower.follower_id)\n Notification.create_notification(@user.profilable_id, @user.profilable_type, text = \"#{self.name} updated his/her profile\", \"Enterprise\") && reload unless target_follower == self || target_follower.nil?\n end\n end", "def notify(new_user)\n self.users.each do |user|\n if user.id != new_user.id\n SocketController.user_joined(user, new_user)\n end\n end\n end", "def add_watchers(obj)\n if user.allowed_to?(\"add_#{obj.class.name.underscore}_watchers\".to_sym, obj.project)\n addresses = [email.to, email.cc].flatten.compact.uniq.collect {|a| a.strip.downcase}\n unless addresses.empty?\n User.active.having_mail(addresses).each do |w|\n obj.add_watcher(w)\n end\n end\n end\n end", "def notify_users(action)\n sender = user\n recipients = []\n\n # Send to people who have registered interest.\n interests.each do |interest|\n recipients.push(interest.user) if interest.state\n end\n\n # Tell masochists who want to know about all observation changes.\n User.where(email_observations_all: true).find_each do |user|\n recipients.push(user)\n end\n\n # Send notification to all except the person who triggered the change.\n recipients.uniq.each do |recipient|\n next if !recipient || recipient == sender || recipient.no_emails\n\n case action\n when :destroy\n QueuedEmail::ObservationChange.destroy_observation(sender, recipient,\n self)\n when :change\n QueuedEmail::ObservationChange.change_observation(sender, recipient,\n self)\n else\n QueuedEmail::ObservationChange.change_images(sender, recipient, self,\n action)\n end\n end\n end", "def add_observer(observer)\n end", "def add_observer(observer)\n end", "def after_update(profile)\n \n puts(\"observer called----------------<><><><><>?<<><><><><><><>--------------\") \n @user=User.find(profile.user_id)\n if(profile.changes.any?)\n ApplicationMailer.send_observer_mail(@user).deliver\n \n end\n end", "def changed_and_notify_observers(data)\n unless @generating_resume_template\n changed\n notify_observers([data, session, current_user])\n end\n end", "def activate_observer(client = isimud_client)\n create_queue(client)\n isimud_send_action_message(:update)\n end", "def notified_watchers\n notified = (watcher_users.active + watcher_users_through_groups.active).uniq\n notified.reject! {|user| user.mail.blank? || user.mail_notification == 'none'}\n if respond_to?(:visible?)\n notified.reject! {|user| !visible?(user)}\n end\n notified\n end", "def notify\n puts 'Subject: Notifying observers...'\n @observers.each { |observer| observer.update(self) }\n end", "def notify\n end", "def notify_users before_user_ids\n users_removed = before_user_ids - @roster.users.ids\n users_added = @roster.users.ids - before_user_ids\n\n # users added\n User.find(users_added).each do | u |\n @roster.send_welcome_message u\n i = @roster.invites.find_by :user => u\n NotificationWorker.perform_async(i.id, 'Invite', 'Notifications::EventInviteNotification', 'invited') if i.present?\n end\n\n # users removed\n User.find(users_removed).each do | u |\n @roster.send_removed_message u\n end\n end", "def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end", "def notifications\n end", "def add_observer &observer\n observers << observer\n end", "def listeners; end", "def notify_conierges_about_new_user(user)\n User.concierges.each do |concierge|\n Notification.create(\n user: concierge,\n object: user,\n name: 'user_created'\n )\n end\n end", "def update( fname )\n splitter.split_gnip_notification( fname )\n end", "def notify(changed_files)\n ::Guard.guards.each do |guard|\n paths = Watcher.match_files(guard, changed_files)\n guard.run_on_change paths unless paths.empty?\n end\n end", "def broadcast_presence\n services = CouchModels::Service.find_all\n users = services.map {|service| service.users }.flatten.uniq\n nodes = users.map {|jid| available(@stream.jid, jid) }\n nodes << services.map do |service|\n service.users.map {|jid| available(service.jid, jid) }\n end\n nodes.flatten!\n @throttle.async_send(nodes)\n end", "def notified_users\n notified = []\n\n # Author and assignee are always notified unless they have been\n # locked or don't want to be notified\n notified << author if author\n\n notified += assigned_to_users\n notified += assigned_to_was_users\n\n notified = notified.select {|u| u.active?}\n\n notified.uniq!\n notified\n end", "def listener\n NSWorkspace.sharedWorkspace.notificationCenter.addObserver(self, selector: 'app_launched:', name: NSWorkspaceDidLaunchApplicationNotification, object: nil)\n NSWorkspace.sharedWorkspace.notificationCenter.addObserver(self, selector: 'app_terminated:', name: NSWorkspaceDidTerminateApplicationNotification, object: nil)\n NSWorkspace.sharedWorkspace.notificationCenter.addObserver(self, selector: 'app_activated:', name: NSWorkspaceDidActivateApplicationNotification, object: nil)\n NSWorkspace.sharedWorkspace.notificationCenter.addObserver(self, selector: 'app_deactivated:', name: NSWorkspaceDidDeactivateApplicationNotification, object: nil)\n end", "def add_observer(o)\n @cpg.add_observer(o)\n end", "def notify(changed_files)\n ::Guard.guards.each do |guard|\n paths = Watcher.match_files(guard, changed_files)\n guard.run_on_change(paths) unless paths.empty?\n end\n end", "def notify_subscribers\n AdminMailer.notify_of_standard_change(self)\n end", "def notify_observers(*args, &block)\n notify_to(observers, *args, &block)\n self\n end", "def supports_observers?\n false\n end", "def send_notifications\n end", "def subscribe_to_notifications(receive_data_srv)\n receive_data_srv.on_notification {|bytes|\n ary= bytes.scan(/../)\n bytes= ary.collect {|hex| hex.to_i(16)}\n cmd= Protocol.find_cmd_by_code(bytes.shift)\n list= @observers[cmd.code]\n unless list.nil?\n list.each { |observer|\n observer.observe(cmd, cmd.rs(bytes))\n }\n end\n }\n end", "def notify_original_creators\n origins.each do |o|\n unless o.parent.user_id == o.jingle.user_id\n Notification.create(\n target_id: o.parent_id,\n target_type: \"Jingle\",\n notice_id: o.jingle_id,\n notice_type: \"JingleOrigin\",\n user_id: o.jingle.user_id,\n notifier_id: user_id\n )\n end\n end\n end", "def notify_startable_storm_services\n notify_startable_services(:storm, storm_services)\n end", "def add_observer(name, obs)\n @observ_list[name] = obs\n end", "def listeners\n self.watchers.collect(&:listening_user) \n end", "def run_on_removal(paths)\n @builder.notify\n end", "def send_update\n changed\n notify_observers(self)\n end", "def send_email_changed_notification; end", "def subscribers_dev\n if server_data\n @subscribers_dev ||= server_data[:subscribers_dev].map { |u| User.new(u[:core_id]) }\n else\n []\n end\n end", "def register_global_listeners\n Wisper.clear\n Wisper.subscribe(AdminNotifier.new)\n Wisper.subscribe(SlackNotifications.new)\n Wisper.subscribe(UserEmails.new)\n end", "def websocket_update\n json = self.to_jsonapi\n watching_users.each do |user|\n UpdatesChannel.broadcast_to(user, {loadModels: [json]})\n end\n end", "def register_observer(observer)\n unless @@delivery_notification_observers.include?(observer)\n @@delivery_notification_observers << observer\n end\n end", "def option_observers\n block = proc { |observers| observers.split(',').each { |observer| save_option_value(\"task.observer.#{observer}\", nil) }; propagate_option('--observers', observers) }\n @cl_parser.on('--observers NAME1,NAME2', 'Enter a list of observers to use for this run.', &block)\n\n end", "def send_ready_notification\n\n end", "def notify\n changed(true)\n notify_observers(self)\n end", "def add_observer!(klass)\n\t\tsuper unless self.class.orbserved?(klass)\n\tend", "def will_notify\n #Resque.safe_enqueue Notification, to_user_id, id, APP::NOTIFICATIONS::MESSAGE\n end", "def notify \n hosts = get_entity(\"hoststatus\")\n services = get_entity(\"servicestatus\")\n \n unless hosts.empty? and services.empty?\n @config[:subscribers].each do |subscriber|\n Notifier.send_notification({\n :hosts => hosts,\n :services => services,\n\n :from => @config[:smtp_settings][:user_name],\n :to => subscriber,\n :subject => @config[:subject],\n template: \"#{@config[:conf_dir]}/notification.html.erb\"\n }).deliver\n end\n else\n @logger.info(\"No hosts or services were found.\")\n end\n end", "def notifys_by_username mem\n notifys(mem).map { |doc| doc['owner_id'] }\n end", "def notify_users_after_change\n if !id ||\n saved_change_to_when? ||\n saved_change_to_where? ||\n saved_change_to_location_id? ||\n saved_change_to_notes? ||\n saved_change_to_specimen? ||\n saved_change_to_is_collection_location? ||\n saved_change_to_thumb_image_id?\n notify_users(:change)\n end\n end", "def notify_user(copies, scope)\n return if copies.all?(&:copied)\n\n WorkerMailer.node_copy_email(\n @context.user.email,\n copies,\n scope,\n ).deliver_now\n end", "def add_observer(observer)\n @conductor.observers << observer\n self\n end", "def subscribe_notifications\n @subscribe_notifications ||= true\n end", "def notify_users\n board = Conversation.find(conversation_id).board\n if (board.public)\n users = User.ids - [user_id]\n users.each do |u|\n Notification.create(user_id: u, comment_id: id, conversation_id: conversation_id)\n end\n else #if the board is not public, Notifications are sent to the specific people.\n role_applications = RoleApplication.where(status: 'Approved')\n role_applications.each do |app|\n Notification.create(user_id: app.user_id, comment_id: id, conversation_id: conversation_id) if app.user_id != user_id\n notify_production_team\n end\n end\n end", "def changed_and_notify(*args)\n changed\n notify_observers(*args)\n end", "def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @user.events.future.analisys.present?\n Notifier.user_event_visit(@user, @user.events.future.visits.first).deliver_now if @user.events.future.visits.present?\n end", "def notified_users_with_custom_users\n notified = notified_users_without_custom_users\n\n custom_users_current = custom_users\n custom_users_changed = custom_users_added_or_removed\n\n notified_custom_users = (custom_users_current + custom_users_changed).select do |u|\n u.active? && u.notify_custom_user?(self, custom_users_current, custom_users_changed) && visible?(u)\n end\n notified += notified_custom_users\n notified.uniq\n end", "def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end", "def notify\n {\n }\n end", "def notify\n {\n }\n end", "def prePushListener\n end", "def listen(monitored_paths)\n @monitored_paths = monitored_paths\n attach\n @loop.run\n end", "def after_registration\n send_pending_messages\n end", "def notify_subscribers\n AdminMailer.notify_of_comment(self)\n end", "def add_observer(observer)\n @observers << observer\n end", "def start_watch_files\n coffee_files.each do |file|\n @notifier.watch(file, :modify) do\n CoffeeCompiler.compile_file(file, true, true)\n end\n end\n end", "def notify_attribute_changes\n ignore = [\"updated_at\", \"user_id\"]\n changed.each do |property|\n delta = changes[property]\n event_name = \"user_update_item_#{property}\" \n ActivityLogger.send(event_name, :from => self.user, :for => [self], :changes => delta) unless ignore.include? property\n end \n end", "def notify_attribute_changes\n ignore = [\"updated_at\", \"user_id\"]\n changed.each do |property|\n delta = changes[property]\n event_name = \"user_update_item_#{property}\" \n ActivityLogger.send(event_name, :from => self.user, :for => [self], :changes => delta) unless ignore.include? property\n end \n end", "def add_observer(&block)\n super(Observer.new(block))\n end", "def notify_observers(*arg)\n __notify_observers(false, false, *arg)\n end", "def run_all\n #run_on_changes(Watcher.match_files(self, Dir.glob(\"**/*.*\")))\n @builder.notify(true)\n end", "def callbacks(&block)\n observer.call(&block)\n end", "def add_observer(&observer)\n\t\t@observers << observer\n\tend", "def notify_clients\n http_post(body: {data: @pids.to_json})\n end", "def engine_notify_datas_updated(datas_updated)\n end", "def notify?\n true\n end", "def mark_all_user_notifications_notified(user)\n user.notifications.each do |n|\n n.notified = true\n n.save\n end\n end", "def notify?\n true\n end", "def refresh_observers\n logger.debug(\"refresh_observers: enter\")\n observers.each do |_, observer|\n observer.rerun unless observer.status\n end\n end", "def notification (user_id)\n requests = Requests.requests_for_edit_notification(user_id)\n if(requests != nil)\n senders_id = Array.new\n requests.each do |t|\n sender_id = t.senders_id\n senders_id.push sender_id\n end\n senders_id.each do |s|\n notification = Notifications.set_notification(s)\n user = Users.find_by_id(user_id).username\n requests.each do |t|\n if (t.senders_id == s)\n description = user + \" \" + \"edited his/her trip, please check it!\"\n Notifications.create_notification_trip(notification, description)\n end\n end\n end\n return\n end\n end", "def add_observer(observer) \n unless observer.respond_to? :update\n raise NoMethodError, \"observer, #{observer}, needs to respond to #update\" \n end\n LOG.debug \"#{self} is attempting to add an observer, #{observer}.\"\n @observers << observer\n LOG.debug \"#{observer} is now listening for events on #{self}.\"\n end", "def notify_of_change(opp, last_update)\n unless opp['applications'].length == 0\n send_webhooks(opp, last_update[:time])\n end\n update_changed_tag(opp, last_update[:time])\n end" ]
[ "0.6577711", "0.63400346", "0.6026646", "0.6013105", "0.59164107", "0.59164107", "0.58937824", "0.58516836", "0.58486545", "0.58194673", "0.58098394", "0.58038056", "0.5787016", "0.576124", "0.57510984", "0.57427704", "0.5741569", "0.57150155", "0.5703422", "0.5702", "0.56673723", "0.5666918", "0.56479895", "0.56410784", "0.56410784", "0.5638489", "0.56291634", "0.5611006", "0.56094426", "0.5592129", "0.55841386", "0.5578367", "0.5570036", "0.55686563", "0.55644786", "0.5560716", "0.5543323", "0.5530511", "0.55155957", "0.55084854", "0.55021966", "0.54783314", "0.54775", "0.54675126", "0.5457539", "0.5443723", "0.5438113", "0.5431458", "0.54222", "0.5407164", "0.53857565", "0.5381893", "0.53695875", "0.5368597", "0.53675944", "0.53489447", "0.5344397", "0.5335667", "0.5334234", "0.53278166", "0.53204244", "0.53193647", "0.53105694", "0.5308797", "0.5307682", "0.5305549", "0.53029656", "0.529988", "0.5296258", "0.5295424", "0.5290111", "0.5273771", "0.5271577", "0.5267119", "0.52613044", "0.5259347", "0.525024", "0.525024", "0.5244671", "0.5244605", "0.52414507", "0.5230879", "0.5228709", "0.5224728", "0.5222702", "0.5222702", "0.5219423", "0.5217566", "0.5213972", "0.52072394", "0.5205395", "0.5201937", "0.51957464", "0.5195395", "0.5194456", "0.51903445", "0.51893723", "0.51864356", "0.5180353", "0.5175569" ]
0.7739362
0
Method is used to get metadata of device's files.
def getMetadata #:doc: if @device == nil return false end puts "SENDING XMPP *****" # try to reach device through XMPP XmppHelper::sendXmppMessage(@device.xmppname, "list") @device.update_attribute(:xmpp_request_sent, DateTime.now) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_metadata; end", "def metadata_file; end", "def metadata_file; end", "def obtain_file_metadata(file_id)\n begin\n metadata = @drive_manager[file_id].get\n rescue StandardError => error\n warn \"#{error}; METHOD #{__callee__}; RESOURCE #{file_path}\"\n return\n end\n\n metadata = JSON.parse(metadata)\n metadata\n end", "def metadata\n metadata = {}\n @file.data.each { |key, value| metadata[key.to_sym] = value }\n\n metadata[:type] = @file.class.name.split('::')[1].downcase\n metadata[:url] = @file.url\n\n metadata[:slug] = slug\n\n metadata[:posted_at] = @file.date.to_time.to_i if @file.respond_to? :date\n metadata[:tags] = tags\n\n metadata\n end", "def get_file_details(file_id)\n begin\n api_result = @client.metadata(file_id, 1, true)\n rescue\n return nil\n end\n \n if api_result.present?\n self.item_into_standard_format(api_result, true)\n else\n nil\n end\n end", "def metadata\r\n self.class.service_instance.get_blob_properties(path)\r\n end", "def read_metadata\n @client.get(metadata_path)\n end", "def Fileinfo(path)\n Vidibus::Fileinfo::Base.new(path).data\nend", "def read_info(uid)\n grid_info = files_collection.find(filename: uid).first or raise Tus::NotFound\n grid_info[:metadata]\n end", "def fetch_metadata\n {\n \"public_fqdn\" => fetch_metadata_item(\"getFullyQualifiedDomainName.txt\"),\n \"local_ipv4\" => fetch_metadata_item(\"getPrimaryBackendIpAddress.txt\"),\n \"public_ipv4\" => fetch_metadata_item(\"getPrimaryIpAddress.txt\"),\n \"region\" => fetch_metadata_item(\"getDatacenter.txt\"),\n \"instance_id\" => fetch_metadata_item(\"getId.txt\"),\n }\n end", "def metadata\n return @metadata if @metadata\n return nil unless value\n value.each do |source|\n begin\n if data = Puppet::FileServing::Metadata.indirection.find(source)\n @metadata = data\n @metadata.source = source\n break\n end\n rescue => detail\n fail detail, \"Could not retrieve file metadata for #{source}: #{detail}\"\n end\n end\n fail \"Could not retrieve information from environment #{Puppet[:environment]} source(s) #{value.join(\", \")}\" unless @metadata\n @metadata\n end", "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.metadata\n end\n end", "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.metadata\n end\n end", "def file_details\n return @file_details\n end", "def get_file_metadata(path:, environment:, links: :manage, checksum_type: Puppet[:digest_algorithm], source_permissions: :ignore)\n validate_path(path)\n\n headers = add_puppet_headers('Accept' => get_mime_types(Puppet::FileServing::Metadata).join(', '))\n\n response = @client.get(\n with_base_url(\"/file_metadata#{path}\"),\n headers: headers,\n params: {\n links: links,\n checksum_type: checksum_type,\n source_permissions: source_permissions,\n environment: environment\n }\n )\n\n process_response(response)\n\n [response, deserialize(response, Puppet::FileServing::Metadata)]\n end", "def metadata\n output = shell!(\"ffprobe -v quiet -print_format json -show_format -show_streams #{file.path.shellescape}\")\n json = JSON.parse(output)\n json.with_indifferent_access\n end", "def metadata\n output = shell!(\"ffprobe -v quiet -print_format json -show_format -show_streams #{file.path.shellescape}\")\n json = JSON.parse(output)\n json.with_indifferent_access\n end", "def get_drive_metadata\n execute!(drive.about.get).data\n end", "def metadata\n @metadata ||= lambda { read_metadata }.call\n end", "def metadata\n @metadata ||= lambda { read_metadata }.call\n end", "def show(uuid, key)\n get(uri: \"/files/#{uuid}/metadata/#{key}/\")\n end", "def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end", "def metadata\n return @metadata if defined? @metadata\n\n @metadata = Henkei.read :metadata, data\n end", "def read_meta_info\n if meta_info_file_pathname.exist?\n inode, bytes_read = meta_info_file_pathname.read.strip.split(':').map(&:to_i)\n {\n inode: inode,\n bytes_read: bytes_read\n }\n else\n {\n inode: nil,\n bytes_read: 0\n }\n end\n end", "def metadata\n unless @metadata\n\n unless cached?\n begin\n Zip::ZipFile.open(@path) do |zip|\n zip.extract('iTunesMetadata.plist', Cache.path_to(plist))\n end\n rescue Zip::ZipError => e\n raise Invalid, e.message\n end\n end\n\n @metadata = CFPropertyList.native_types(CFPropertyList::List.new(:file => Cache.path_to(plist)).value)\n end\n\n @metadata\n end", "def metadata\n @metadata.tap do |h|\n # This represents the minimal set of attribute methods that should be available in every subclass.\n h[:mime_type] = mime_type if mime_type\n h[:filename] = filename if filename\n h[:digest] = digest if digest\n h[:size] = size if size\n h[:last_modified] = last_modified if last_modified\n end\n end", "def metadata\n @data[:metadata]\n end", "def metadata(options: DEFAULT_OPTIONS)\n output = %x(exiftool #{options} -json #{file.path.shellescape})\n json = JSON.parse(output).first\n json = json.except(\"SourceFile\")\n ExifTool::Metadata.new(json.with_indifferent_access)\n end", "def metadata(id)\n id = self.to_id(id)\n io = self.grid.get(id)\n { filename: io.filename, content_type: io.content_type }\n rescue ::Mongo::GridFileNotFound\n nil\n end", "def temp\n # Find all files in the system\n allFiles = Devfile.find(:all)\n \n metadatatype = MetadataType.find_by_name(\"backup_recovery_path\")\n if metadatatype == nil\n render :text => \"Metadatatype was not found\", :status => 404\n return\n end\n \n # Go through each file and add metadata to it\n allFiles.each do |x|\n metadatavalue = '/home/user/MyDocs/DCIM/'+x.name\n Metadata.find_or_create_by_metadata_type_id_and_devfile_id(:metadata_type_id => metadatatype.id,\n :value => metadatavalue,\n :devfile_id => x.id) \n end\n \n render :text => \"Metadata added to all files in the system\", :status => 201\n return\n end", "def metadata_files\n return @metadata_files unless @metadata_files.nil?\n @metadata_files = MetadataFile.all\n @existing_files, @new_files = [], []\n @metadata_files.each do |f|\n if f.cached?\n @existing_files << f\n else\n @new_files << f\n end\n end\n end", "def metadata_by_id(file_id)\n if file_id.is_a? String\n client = google_api_client\n metadata = client.get_file(\n file_id,\n fields: 'id, name, thumbnailLink, webContentLink, webViewLink, trashed'\n )\n validate_metadata(metadata)\n metadata\n end\n end", "def files\n info[\"Files\"].to_a\n end", "def metadata\n return @metadata if @metadata\n return nil unless value\n #debug 'fragment get metadata from source'\n value.each do |source|\n begin\n if data = Puppet::FileServing::Metadata.indirection.find(source, :environment => resource.catalog.environment)\n @metadata = data\n @metadata.source = source\n break\n end\n rescue => detail\n fail detail, \"Could not retrieve file metadata for #{source}: #{detail}\"\n end\n end\n fail \"Could not retrieve information from environment #{resource.catalog.environment} source(s) #{value.join(\", \")}\" unless @metadata\n @metadata\n end", "def metadata\n result = store.metadata_for_path(path).dup\n\n file_meta = store.metadata_for_file(source_file).dup\n result.deep_merge!(file_meta)\n\n local_meta = @local_metadata.dup\n result.deep_merge!(local_meta)\n\n result\n end", "def get_metadata(*args)\n self.metadata.get(*args)\n end", "def metadata\n DatasetService.get_metadata dataset_id\n end", "def metadata\n if any? && metadata_schema\n response = api('request',\n :uri => \"hm://metadata/#{resource_name}s\",\n :batch => true,\n :payload => map {|resource| {:uri => resource.metadata_uri}},\n :response_schema => metadata_schema\n )\n response['result']\n else\n []\n end\n end", "def metadata_file\n study_files.any_of(\n { file_type: 'Metadata' },\n { file_type: 'AnnData', 'ann_data_file_info.has_metadata' => true }\n ).first\n end", "def get_attachments_metadata(node)\n files_md = {}\n md_list = FileTableKeys\n md_list.delete(RawContent)\n md_fields = md_list.join(\"`, `\")\n \n model_key = node.my_GlueEnv.model_key\n sql = \"SELECT `#{md_fields}` FROM `#{@file_table_name}`\n WHERE `#{NodeName}` = '#{node.__send__(model_key.to_sym)}'\"\n sth = @dbh.prepare(sql)\n rtn = []\n sth.execute\n while row=sth.fetch do\n rtn << row.to_h\n end\n #rtn\n sth.finish\n objects = rtn\n objects.each do |object|\n obj_md = object \n #speputs \"Obj It: #{obj_md.inspect}\"\n obj_md_file_modified = obj_md[\"modified_at\"]\n obj_md_content_type = obj_md[\"content_type\"]\n new_md = {:content_type => obj_md_content_type, :file_modified => obj_md_file_modified}\n new_md.merge(obj_md) #where does the original metadata go?\n #p new_md.keys\n files_md[obj_md[\"basename\"]] = new_md\n #puts \"Obj METADATA: #{new_md.inspect}\"\n end\n files_md\n end", "def find_metadata\n versions.each do |v|\n m = v.metadata\n if m.exist?\n return m\n end\n end\n nil\n end", "def metadata_file\n [site.regenerator.metadata_file]\n end", "def get_file_info(object_id:)\n {\n method: \"DOM.getFileInfo\",\n params: { objectId: object_id }.compact\n }\n end", "def metadata\n @meta_data\n end", "def get_metadata(io, context)\n if io.is_a?(UploadedFile)\n io.metadata.dup\n else\n extract_metadata(io, context)\n end\n end", "def object_metadata(key)\n object_path = File.join(container_path, Raca::Util.url_encode(key))\n log \"Requesting metadata from #{object_path}\"\n\n response = storage_client.head(object_path)\n {\n :content_type => response[\"Content-Type\"],\n :bytes => response[\"Content-Length\"].to_i\n }\n end", "def metadata\n @metadata\n end", "def metadata\n api_get(\"$metadata\").body\n end", "def get_metadata(cloud_file)\n uri = {file_path: cloud_file.path} if cloud_file.path\n response = format_response(Dropbox.successful_request?(:metadata, access_token, uri))\n tree_cache(response)\n end", "def metadata\n log \"retrieving container metadata from #{container_path}\"\n response = storage_client.head(container_path)\n custom = {}\n response.each_capitalized_name { |name|\n custom[name] = response[name] if name[/\\AX-Container-Meta-/]\n }\n {\n :objects => response[\"X-Container-Object-Count\"].to_i,\n :bytes => response[\"X-Container-Bytes-Used\"].to_i,\n :custom => custom,\n }\n end", "def get_firmware_files\n response = request(:get, \"/devmgr/v2/firmware/cfw-files/\")\n status(response, 200, 'Failed to get uploaded firmware file list')\n JSON.parse(response.body)\n end", "def extract_metadata; end", "def get_fingerprint_metadata( params )\n LastFM.get( \"track.getFingerPrintMetadata\", params )\n end", "def extract_metadata!(data = {})\n data.tap do |d|\n file = File.open(@file)\n d[:filesize] = file.size\n file.close\n\n d[:content_type] = MIME::Types.type_for(@file).first.to_s\n end\n end", "def metadata\n @metadata ||= {}\n end", "def file_info(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n file.info\n end", "def get_remote_file_url_metadata(remote_file_url: \"\")\n @file_service.get_metadata_from_remote_url(remote_file_url: remote_file_url)\n end", "def extract_metadata(io, context = {})\n {\n \"filename\" => extract_filename(io),\n \"size\" => extract_size(io),\n \"mime_type\" => extract_mime_type(io),\n }\n end", "def get_metadata_source_info(ns)\n METADATA_FIELDS[ns][:info]\n end", "def get_metadata(resource_uri)\n log \"get_metadata for #{resource_uri}\"\n get \"#{resource_uri}/fcr:metadata\", \"text/plain\" \n end", "def metadata\n return @metadata\n end", "def metadata\n return @metadata\n end", "def info\n info = Hash.new\n output = @filer.invoke(\"system-get-info\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.children_get[0].children_get.each do |naelem|\n info[naelem.name] = naelem.content\n end\n end\n info\n end", "def file_stats\n @stats = @ff.get_stats\n end", "def metadata\n @manifest_options[:metadata] || {}\n end", "def metadata_info\n @metadata = Chef::Cookbook::Metadata.new\n @metadata.from_file(File.join(@opts[:path], 'metadata.rb'))\n end", "def file_info(path)\n info File.read(path)\n end", "def get_metadata\n DatasetService.get_metadata self.dataset_id\n end", "def get_file_details(id)\n uri = ENDPOINT + \"file/details/#{key}/#{id}\"\n data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)\n Reach::Helper::convert_keys(data)\n end", "def metadata(filepath)\n metadata = {}\n metadata.merge!(author(filepath))\n metadata.merge!(title(filepath))\n metadata.merge!(serie(filepath))\n metadata\n end", "def metadata\n @metadata ||= {}\n end", "def extract_metadata\n path = audio.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n TagLib::FileRef.open(path) do |fileref|\n tag = fileref.tag\n properties = fileref.audio_properties\n self.update_attributes(:artist => tag.artist,:album=> tag.album,:title => tag.title, :genre => tag.genre, :track_number => tag.track, :year_of_release => tag.year, :comments => tag.comment,:bitrate => properties.bitrate,:no_of_channels => properties.channels,:length=> properties.length,:sample_rate=> properties.sample_rate)\n end\n end", "def files\n @files=get_endpoint('extra').keys\n end", "def file_description\n @descriptive_detail.file_description\n end", "def get_metadata\n if (@document == nil)\n return false\n end\n \n @msdata = get_document_metadata(@document)\n #md_index = get_md_index() #Gets metadata index for (ace/dec) sorting \n #sort_metadata(md_index) #Sorts metadata (ace/dec)\n end", "def set_asset_metadata\n headers = fog_connection.head_object(CarrierWave::Uploader::Base.fog_directory, upload_data[:path]).headers\n\n self.name = upload_data[:filename]\n self.size = headers['Content-Length']\n self.etag = headers['Etag']\n self.content_type = headers['Content-Type']\n end", "def metadata\n self[:metadata] || {}\n end", "def files_info(params = {})\n fail ArgumentError, \"Required arguments 'file' missing\" if params['file'].nil?\n response = @session.do_post \"#{SCOPE}.info\", params\n Slack.parse_response(response)\n end", "def read_metadata\n raise NotImplementedError.new 'This is only a function body for documentation'\n end", "def parseUpdatedMetadata(doc, params, path)\n \n path += \"/files\"\n \n listOfUpdatedFiles = Array.new\n doc.find('//user/device/files/file').each do |file|\n\n fullpath = (file.attributes.get_attribute(\"fullpath\")) ? file.attributes.get_attribute(\"fullpath\").value : nil \n\n version = \"not_found\"\n if file.find_first('version')\n version = (file.find_first('version').attributes.get_attribute(\"num\")) ? file.find_first('version').attributes.get_attribute(\"num\").value.to_i : nil \n end\n \n if fullpath.to_s == \"\"\n raise Exception.new(\"fullpath cannot be empty\")\n elsif fullpath[0] == '/'\n raise Exception.new(\"path cannot begin with /\")\n elsif not version\n raise Exception.new(\"Error in version element\")\n end\n\n temp_path = (version) == \"not_found\" ? path + \"/#{fullpath}\" : path + \"/#{fullpath}\" + \"?version=#{version.to_s}\"\n \n file.find(\"metadata\").each do |mdata|\n mtype = mdata.attributes.get_attribute(\"metadata_type\") ? mdata.attributes.get_attribute('metadata_type').value : nil\n mvalue = mdata.content\n if not mtype or not mvalue\n raise Exception.new(\"Malformed metadata element\")\n end\n listOfUpdatedFiles << {:path => temp_path, :params => {:metadata_type => mtype.to_s, :metadata_value => mvalue.to_s}}\n end\n end\n \n\n listOfUpdatedFiles.each do |v| \n puts \"#{v[:path]} #{v[:params][:metadata_type]} #{v[:params][:metadata_value]}\"\n end\n \n \n return listOfUpdatedFiles\n end", "def get_metadata_file album\n Albatross::ThrowIf.is_nil? album, \"album\"\n \"storage/dropbox/#{album}.yml\"\nend", "def files\n list = []\n if @data['info'].key?('files')\n @data['info']['files'].each do |file|\n list << { 'name' => file['path'], 'length' => file['length'] }\n end\n return list\n end\n\n if @data['info'].key?('name') && @data['info'].key?('length')\n list << { 'name' => @data['info']['name'], 'length' => @data['info']['length'] }\n end\n list\n end", "def metadata\n stream.metadata\n end", "def metadata\n stream.metadata\n end", "def metadata\n return @metadata unless @metadata.nil?\n @metadata = fetch_metadata\n configure_with_metadata(@metadata)\n @metadata\n end", "def extract_metadata\n return unless audio?\n path = upload.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3info|\n self.metadata = mp3info.tag\n end\n end", "def extract_metadata\n return unless audio?\n path = upload.queued_for_write[:original].path\n open_opts = { :encoding => 'utf-8' }\n Mp3Info.open(path, open_opts) do |mp3info|\n self.metadata = mp3info.tag\n end\n end", "def metadata\n configuration.metadata\n end", "def metadata_full_path\n @metadata_full_path ||= \"#{File.dirname(@full_path)}/#{name}\"\n end", "def mediainfo(filename)\n\n puts(\"Running mediainfo on #{filename}\") if @debug\n metadata = {}\n output = %x[mediainfo --full '#{filename}']\n\n lines = output.split(/$/)\n\n lines.each do |line|\n line.gsub! /^$\\n/, ''\n line.strip!\n\n if (line =~ /duration\\s+:\\s+(\\d+)/i && metadata[:duration] == nil)\n duration = $1.to_i\n metadata[:duration] = duration / 1000\n end\n if (line =~ /scan type\\s+:\\s+interlaced/i)\n metadata[:interlaced] = true\n end\n if (line =~ /width\\s+:\\s+1440/i)\n metadata[:needs_scaling] = true\n end\n end\n\n metadata\nend", "def esri_opendata_metadata\n File.read(File.join(File.dirname(__FILE__), './docs/esri_open_data.json'))\n end", "def esri_opendata_metadata\n File.read(File.join(File.dirname(__FILE__), './docs/esri_open_data.json'))\n end", "def info\n Plist::parse_xml(hdiutil 'info', '-plist')['images'].each do |disk_info|\n return disk_info if @image_path.to_s == disk_info['image-path']\n end\n return nil\n end", "def metadata_full_path\n @metadata_full_path ||= File.join(File.dirname(@full_path), name)\n end", "def add_file_metadata\n file_data = {}\n file_data[:filename] = File.basename(options[:original_filename])\n file_data[:file_size] = File.size(options[:original_filename])\n file_data[:record_delimiter] = options[:delimiter]\n file_data[:rows] = options[:rows]\n file_data[:columns] = options[:csv_column_datatypes].keys.size\n file_data[:processed_filename] = File.basename(options[:filename])\n file_data[:processed_file_path] = options[:filename]\n file_data[:processed_file_size] = File.size(options[:filename])\n file_data[:error_report] = options[:temp_file]\n return file_data\n end", "def attributes\n @metadata\n end", "def package_metadata\n @package_metadata ||= ::ChefDk::Helpers.metadata_for(\n channel: channel,\n version: version,\n platform: node['platform'],\n platform_version: node['platform_version'],\n machine: node['kernel']['machine']\n )\n end", "def existing_files\n metadata_files if @existing_files.nil?\n @existing_files\n end", "def metadata\n attributes['metadata'] ||= {}\n attributes['metadata']\n end", "def files\n @files.values\n end" ]
[ "0.67700547", "0.6737775", "0.6737775", "0.66766864", "0.66589314", "0.6640562", "0.649501", "0.64556533", "0.644948", "0.644641", "0.6441036", "0.6434258", "0.6418977", "0.6418977", "0.6397409", "0.63751686", "0.63662493", "0.63662493", "0.6338634", "0.6327756", "0.6327756", "0.63039887", "0.62909395", "0.62909395", "0.6283187", "0.6278707", "0.6277833", "0.62757427", "0.6237979", "0.623202", "0.62227654", "0.62116325", "0.62109566", "0.6207289", "0.6193165", "0.6181688", "0.6172088", "0.6161494", "0.6123237", "0.61126757", "0.6100956", "0.6069391", "0.60325867", "0.6015804", "0.60156274", "0.601484", "0.6014526", "0.60108316", "0.6007346", "0.6004105", "0.6003676", "0.5982868", "0.5947033", "0.59424525", "0.59370756", "0.5923338", "0.59021074", "0.5897687", "0.58950794", "0.589507", "0.5890944", "0.5890294", "0.5890294", "0.58901507", "0.58756524", "0.5856046", "0.5847228", "0.58438694", "0.58396626", "0.58370215", "0.58361274", "0.58299136", "0.582987", "0.5826693", "0.5809944", "0.58086324", "0.5808416", "0.5805482", "0.5804347", "0.58031636", "0.5800786", "0.57911086", "0.57850677", "0.5783753", "0.5783753", "0.57717097", "0.5762177", "0.5762177", "0.5758262", "0.5748689", "0.57354915", "0.5733849", "0.5733849", "0.57157373", "0.56998855", "0.5695792", "0.56909454", "0.5690681", "0.5688946", "0.5687945", "0.5655846" ]
0.0
-1
Updates file's metadata to db parameters: f filehash commit the commit the file belongs to
def updateDevfile(f, commit) #:doc: dev_file = nil begin # Checks if there is any changes in files. f_filedate = DateTime.strptime(f['filedate'], "%T %F") f_filedate = f_filedate.strftime('%F %T').to_s now = DateTime.now.strftime('%F %T') puts "name: #{f['name']}" puts "path: #{f['path']}" puts "Finding devfile.." dev_file = @device.devfiles.find(:first, :conditions => ["name = ? and path = ?", f['name'], f['path']]) if dev_file != nil puts "devfile found: " + dev_file.id.to_s else puts "Devfile not found" raise Exception.new("Devfile not found. Can not update it!") end blob = dev_file.blobs.find_by_blob_hash_and_devfile_id(f['blob_hash'], dev_file.id) if blob != nil puts "Blob already exists!" puts "Blob: " + blob.id.to_s return else puts "Blob was not found!" end # Finds the blob that is newest one previous_blob_id = nil current_blob = dev_file.blobs.find_by_id(dev_file.blob_id) if current_blob != nil previous_blob_id = current_blob.id.to_s puts "Current blob: " + current_blob.id.to_s end # If the blob, didn't exist yet, creates it. Ensures that blob will have version number. if blob == nil #or current_blob == nil version = 0 if current_blob != nil version = current_blob.version + 1 end puts "Creates new blob, verion num: " + version.to_s sql = "insert into blobs(blob_hash, created_at, updated_at, size, filedate, uploaded, version, devfile_id, predecessor_id, latitude, longitude) values('#{f['blob_hash']}', '#{now}', '#{now}', '#{f['size']}', '#{f_filedate}', '0', '#{version}', '#{dev_file.id}', '#{previous_blob_id}', '#{@commit_location['latitude']}', '#{@commit_location['longitude']}');" ActiveRecord::Base.connection.execute(sql) end puts "Finding the newly created blob.." blob = dev_file.blobs.find_by_blob_hash(f['blob_hash']) puts " found blob: " + blob.id.to_s current_blob.update_attribute(:follower_id, blob.id) puts "Updating devfile" # Updates changes in devfile (current blob) sql = "update devfiles set filetype = '#{f['filetype']}', latitude = '#{f['latitude']}', longitude = '#{f['longitude']}', blob_id = '#{blob.id.to_s}', updated_at = '#{now}' where name = '#{f['name']}' and path = '#{f['path']}' and device_id = #{@device.id};" puts " SQL: " + sql.background(:red) ActiveRecord::Base.connection.execute(sql) BlobsInCommit.find_or_create_by_blob_id_and_commit_id(blob.id, commit.id) #checkForObservers(dev_file) rescue => e puts "Errors in updating file" + e raise e end puts "devfile updated!" return dev_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_file_metadata(data)\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end", "def update_file_in_db(file_id, filename, public_status, folder_id)\n $db.execute(\"UPDATE files SET file_name = ?, public_status = ?, folder_id = ? WHERE file_id = ?\", filename, public_status, folder_id, file_id)\nend", "def prepare_db_data( f, cl, tbd, df )\n s = File::Stat.new( f )\n if ! s\n puts \"couldn't stat #{f}\\n\"\n next\n end\n\n # grab extension\n m = /(\\.\\w+)$/.match( f )\n if m && m[1]\n # yes it's redundant, but this way, if the file is outside of it's directory i have half a chance of knowing what it is\n new_pathfile = s.mtime.strftime( \"%m/%d/%m%d%H%M\" ) + m[1]\n else \n puts \"couldn't find file extension for #{f}\\n\"\n next\n end\n\n md5_checksum = Digest::MD5.hexdigest( File.read( f ) )\n\n # make directories if needed\n testfile = tbd + s.mtime.strftime( \"/%m\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n testfile += s.mtime.strftime( \"/%d\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n # copy file to new location\n FileUtils.copy( f, \"#{tbd}/\" + new_pathfile )\n\n # save data for db push\n df.push( { :class => cl, :created_text_date => s.mtime, :created_epoch_seconds => s.mtime.to_i, :pathfile => new_pathfile, :md5_checksum => md5_checksum } )\nend", "def set_metadata( file_list, tag_hash)\n file_list = [*file_list] # make sure file_list is an array\n file_list.each do |file_name|\n if File.exist?(file_name) \n ok = TagLib::FileRef.open(file_name) do |f|\n tag = f.tag\n tag_hash.each do |tag_name, value|\n\n # make sure that the tag_nam (hash key) is a string and then add = to it\n if tag_name.class != String\n tag_name = tag_name.to_s\n end\n tag_name += \"=\"\n\n if tag.respond_to?(tag_name)\n tag.send(tag_name, value)\n else\n puts \"can't modify tag #{tag_name}\"\n end\n end\n f.save\n end\n if ok == false then\n puts \"uh-oh. There was a problem saving/opening #{f}, it's tags were not modified.\"\n end\n else\n puts \"file #{file_name} does not exist, so its tags were not updated.\"\n end\n end\n end", "def update_metadata\n file_attributes = ::FileSetEditForm.model_attributes(attributes)\n actor.update_metadata(file_attributes)\n end", "def update_db\n\n db = Sequel.sqlite(dbfilename)\n @db_update_data.each do |key,value|\n md5sum = {:md5sum => key}\n file_tupel = md5sum.merge(value)\n db[:pdfmd_documents].insert_conflict(:replace).insert(file_tupel)\n end\n\n end", "def createDevfile(f, commit) #:doc:\n \n dev_file = nil\n blob = nil\n b_in_c = nil\n \n # If file already exists, raises an error but nothing needs to be deleted (except the commit is cancelled)\n begin \n dev_file = Devfile.find_by_name_and_path_and_device_id(f['name'], f['path'], @device.id)\n if dev_file != nil\n puts \"Devfile: #{f['path'] + f['name']} already exits, cannot create, use update instead\"\n raise ArgumentError.new(\"Devfile already exits for this device, cannot use CREATE -method, use UPDATE instead to add new version\")\n end\n rescue Exception => e\n puts e.to_s\n puts e.backtrace[0].to_s\n raise e\n end\nputs \"name: #{f['name']}\"\nputs \"path: #{f['path']}\"\n \n # If something goes wrong, raises an error, and deletes the data created\n begin\n \n puts \"Creating new dev_file, blob etc..\"\n \n \n f_filedate = DateTime.strptime(f['filedate'], \"%T %F\")\n f_filedate = f_filedate.strftime('%F %T').to_s\n \n now = DateTime.now\n \n # get or create devfile\n dev_file = Devfile.find_or_create_by_name_and_path_and_device_id(f['name'], f['path'], @device.id)\n if dev_file.created_at >= now\n sql = \"update devfiles set filetype='#{f['filetype']}', path='#{f['path']}', privatefile=0 where id=#{dev_file.id}\" \n ActiveRecord::Base.connection.execute(sql)\n end\n \n # get or create blob\n blob = Blob.find_or_create_by_blob_hash_and_devfile_id(f['blob_hash'], dev_file.id)\n if blob.created_at >= now # if just created\n # Version number\n version = 0\n predecessor_blob_id = \"NULL\"\n follower_blob_id = \"NULL\"\n if dev_file.blob_id != nil\n predecessor_blob_id = dev_file.blobs.find_by_id(dev_file.blob_id) ? dev_file.blobs.find_by_follower_id(dev_file.blob_id).id.to_s : \"NULL\"\n follower_blob_id = dev_file.blobs.find_by_predecessor_id(blob.id) ? dev_file.blobs.find_by_predecessor_id(blob.id).id.to_s : \"NULL\"\n version = dev_file.blobs.find_by_id(dev_file.blob_id).version + 1 \n end\n \nputs \"predecessor_id=#{predecessor_blob_id.to_s},\"\nputs \"follower_id=#{follower_blob_id.to_s},\"\nputs \"size=#{f['size'].to_s},\" \nputs \"filedate='#{f_filedate.to_s}',\" \nputs \"version=#{version.to_s},\" \nputs \"uploaded='0',\" \nputs \"latitude=#{@commit_location['latitude'].to_s}, \" \nputs \"longitude=#{@commit_location['longitude'].to_s} \" \n \n sql = \"update blobs set predecessor_id=#{predecessor_blob_id.to_s}, follower_id=#{follower_blob_id.to_s}, size=#{f['size'].to_s}, filedate='#{f_filedate.to_s}', version=#{version.to_s}, uploaded='0', latitude=#{@commit_location['latitude'].to_s}, longitude=#{@commit_location['longitude'].to_s} where id=#{blob.id};\"\nputs \"sql: \" + sql\n \n ActiveRecord::Base.connection.execute(sql)\n end\n \n # Creates association between blob and commit\n b_in_c = BlobsInCommit.find_or_create_by_blob_id_and_commit_id(blob.id, commit.id)\n \n # update blob_id to devfile\n if dev_file.blob_id != blob.id\n sql = \"update devfiles set blob_id=#{blob.id} where id=#{dev_file.id};\"\n ActiveRecord::Base.connection.execute(sql)\n end\n \n \n #checkForObservers(dev_file)\n \n # If parent_blob_hash is given, tries to find the parent, and creates new branch form the parent\n if f['file_origin'] \n createBranch(f['file_origin'], blob)\n end\n\n rescue Exception => e\n puts \" -- Error in createDevfile: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n \n puts \"Deleting created data..\"\n \n # If dev_file was created now, deletes it\n dev_file.delete if dev_file\n puts \"Deleted created dev_file!\" if dev_file\n \n if blob \n if b_in_c\n BlobsInCommit.delete_all([\"commit_id = ? AND blob_id = ?\", b_in_c.commit_id.to_s, blob.blob_id.to_s])\n puts \"Deleted created blobs_in_commits!\" if b_in_c\n end\n blob.delete \n puts \"Deleted created blob!\"\n end\n \n # Throws forward the exception..\n raise e\n end\n puts \"File created\"\n return dev_file\n end", "def update!(**args)\n @commit_metadata = args[:commit_metadata] if args.key?(:commit_metadata)\n @file_operations = args[:file_operations] if args.key?(:file_operations)\n @required_head_commit_sha = args[:required_head_commit_sha] if args.key?(:required_head_commit_sha)\n end", "def update_metadata!\n compilation_context.source_file_database.update_metadata(source_path)\n compilation_context.target_file_database.update_metadata(source_path)\n end", "def update_file(settings)\n file_path = self.full_path(settings)\n TagLib::MPEG::File.open(file_path) do |file|\n file.tag.artist = self.artist.name\n file.tag.album = self.album.name\n file.tag.year = self.album.year ? self.album.year : 0\n file.tag.genre = self.genre\n file.tag.title = self.name\n file.save\n end\n end", "def update_fileset_metadata(work, attrs)\n work.ordered_members.to_a.each_with_index do |member, i|\n builder = FileSetBuilder.new(member, user, attrs[i])\n builder.run\n end\n end", "def add_commit_to_db(hash)\n #insert hash values into proper attribute in commits table\n @con.exec_prepared('commitInsert', hash.values_at(*@@GIT_LOG_PROPERTIES))\n \n create_commit_filepath(hash[\"filepaths\"], hash[:commit_hash])\n create_commit_bug(hash[:bug], hash[:commit_hash]) if hash[:bug]!=nil\n end", "def on_file_metadata_updated(event)\n return unless resource? event[:metadata]\n Hyrax.index_adapter.save(resource: event[:metadata])\n end", "def update_content( file, relation = :original_file )\n Deepblue::LoggingHelper.bold_debug [ Deepblue::LoggingHelper.here,\n Deepblue::LoggingHelper.called_from,\n \"user=#{user}\",\n \"file_set.id=#{file_set.id}\",\n \"file=#{file}\",\n \"relation=#{relation}\" ]\n current_version = file_set.latest_version\n prior_revision_id = current_version.label\n prior_create_date = current_version.created\n file_set.provenance_update_version( current_user: user,\n event_note: \"update_content\",\n new_create_date: '',\n new_revision_id: '',\n prior_create_date: prior_create_date,\n prior_revision_id: prior_revision_id,\n revision_id: '' )\n IngestJob.perform_later( wrapper!(file: file, relation: relation), notification: true )\n end", "def update_metadata(file)\n metadata = MetadataEngine.new(file)\n\n # Special renaming case for misc files that do not need the tracklist\n if metadata.filepath.get_type == \"misc\"\n metadata.tags.artist = metadata.filepath.artist\n metadata.tags.year = metadata.filepath.year\n metadata.tags.album = metadata.filepath.album\n metadata.tags.cd = metadata.filepath.cd\n metadata.tags.index = metadata.filepath.index\n metadata.tags.title = metadata.filepath.title\n metadata.tags.save\n return\n end\n\n unless metadata.tracklist.has_tracklist?\n puts \"No .tracklist found for #{file}, generating it now.\"\n %x[generate-tracklist #{file.shellescape}]\n metadata = MetadataEngine.new(file)\n end\n\n # Update tags to reflect what's in the tracklist\n metadata.tags.artist = metadata.tracklist.artist\n metadata.tags.year = metadata.tracklist.year\n metadata.tags.album = metadata.tracklist.album\n metadata.tags.cd = metadata.tracklist.cd\n metadata.tags.index = metadata.tracklist.index\n metadata.tags.title = metadata.tracklist.title\n metadata.tags.type = metadata.tracklist.type\n metadata.tags.save\n\n # Update filepath to rename files based on new metadata\n metadata.filepath.artist = metadata.tracklist.artist\n metadata.filepath.year = metadata.tracklist.year\n metadata.filepath.album = metadata.tracklist.album\n metadata.filepath.cd = metadata.tracklist.cd\n metadata.filepath.index = metadata.tracklist.index\n metadata.filepath.title = metadata.tracklist.title\n metadata.filepath.save\n end", "def update_filepath(_package_id:, _filepath:, _sha1:, _size:); end", "def commit args = {}\n action = :deleted if self.deleted?\n action ||= self.is_new? ? :added : (self.is_changed? ? :updated : :nothing_to_commit) \n args[:skip_part_data] ||= false\n \n unless action.eql?(:nothing_to_commit)\n message = \"#{action} #{name}\"\n message = args[:m] if args[:m] \n if action.eql?(:deleted)\n repo.remove(self.file_name)\n self.history_count += 1\n else\n repo.add(self.file_name)\n end\n\n active_message = self.commit_messages[:most_recent]\n message = \"#{active_message.gsub(message,\"\")}\" unless self.deleted? || active_message.blank? || active_message.eql?(message)\n self.remove_message_from_temp_store(:most_recent) unless active_message.blank?\n \n repo.commit(message)\n self.last_commit = repo.log(self.local_path, :limit => 1).first.to_s\n end\n unless action.eql?(:deleted) \n self.part_count = parts.count\n self.part_count ||= 0 \n update_part_data unless args[:skip_part_data]\n\n self.history_count = self.history.size\n self.history_count = 1 if self.history_count.eql?(0) \n end\n self.save if self.changed?\n \n synchronize unless args[:dont_sync] || self.attributes[\"sync\"].blank? #rather than calling sync.blank? to skip the JSON parsing step.\n return action\n end", "def update!(**args)\n @file_contents = args[:file_contents] if args.key?(:file_contents)\n end", "def commit\n update\n end", "def update!(**args)\n @file_id = args[:file_id] if args.key?(:file_id)\n @justification = args[:justification] if args.key?(:justification)\n @last_modified_time = args[:last_modified_time] if args.key?(:last_modified_time)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n @title = args[:title] if args.key?(:title)\n @url = args[:url] if args.key?(:url)\n end", "def file_sent( proposal, filename )\n table_name, file_field, err_field, time_field = table_and_attribute_names\n unless table_name.blank? || file_field.blank? || err_field.blank?\n time_upd = time_field.blank? ? '' : \", #{time_field} = '#{Time.now}'\"\n upd = \"UPDATE #{table_name} SET #{file_field} = '#{filename}', #{err_field} = NULL#{time_upd} WHERE id = #{proposal.record_id}\"\n ActiveRecord::Base.connection.execute(upd)\n end\n end", "def commit(newrevision, content_io=nil)\n if not get_indexfile_with_revision(newrevision).nil?\n raise \"Committing already-existing revision: #{newrevision} for #{@fname}\"\n end\n if content_io.nil?\n compress_file_lines = Deflate.deflate(File.read(@fname))\n else\n cont = content_io.read\n compress_file_lines = Deflate.deflate(cont)\n end\n\n # append current file fname to datafile\n length = IO.readlines(@datafile).size\n\n File.open(@datafile, \"a\") do |append|\n append.puts compress_file_lines\n end\n length = IO.readlines(@datafile).size - length\n\n # new version is the old version plus 1\n # new offset is the last length + last offset\n parse_last_line = parse_indexfile_line get_indexfile_with_line(-1)\n new_offset = parse_last_line[1] + parse_last_line[2]\n\n File.open(@indexfile, \"a\") do |f|\n index_write_row(f, newrevision.to_s,\n new_offset.to_s, length.to_s)\n end\n end", "def update_pg(db, filename)\n\n v_filename = filename\n\n begin\n db.prepare('q_statement',\n \"insert into imageuploader (photo) values ($1)\") # bind parameters\n db.exec_prepared('q_statement', [v_filename])\n db.exec(\"deallocate q_statement\")\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n db.close if db\n end\n\n end", "def update_photo(album_id, photo_id, file, filename)\n \n end", "def update_info(uid, info)\n files_collection.update_one({filename: uid}, {\"$set\" => {metadata: info}})\n end", "def file_hash=(value)\n @file_hash = value\n end", "def update_meta_info!\n return unless has_been_read?\n\n ensure_meta_info_dir_exists!\n meta_info_file_pathname.write(\"#{@inode}:#{@read_bytes}\")\n end", "def update()\n Ini.write_to_file(@path, @inihash, @comment)\n end", "def update_file_size(file_id, file_size)\n $db.execute(\"UPDATE files SET file_size = ? WHERE file_id = ?\", file_size, file_id)\nend", "def commit\n # TODO\n # Update ./docProps\n # app.xml slides, notes, counts, etc\n # core.xml Times\n entries.each do |path, buffer|\n path = path.to_s\n if @original_files.include? path\n @zip.replace_buffer path, buffer\n else\n @zip.add_buffer path, buffer\n end\n end\n @zip.commit\n end", "def update_file(file, hash)\n\tupdate_file = File.open(file, 'w')\n\tupdate_file.write(hash.to_yaml)\nend", "def commit; end", "def commit; end", "def commit; end", "def set_file_info\n @file_info = FileInfo.includes(:component).find(params[:id])\n end", "def set_commit_filepath\n @commit_filepath = CommitFilepath.find(params[:id])\n end", "def update!(**args)\n @file_path = args[:file_path] if args.key?(:file_path)\n @gcs_timestamps = args[:gcs_timestamps] if args.key?(:gcs_timestamps)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "def update!(**args)\n @filename = args[:filename] if args.key?(:filename)\n end", "def update!(**args)\n @filename = args[:filename] if args.key?(:filename)\n end", "def update!(**args)\n @file_path = args[:file_path] if args.key?(:file_path)\n @gcs_timestamps = args[:gcs_timestamps] if args.key?(:gcs_timestamps)\n @size_bytes = args[:size_bytes] if args.key?(:size_bytes)\n end", "def update!(**args)\n @file = args[:file] if args.key?(:file)\n @line = args[:line] if args.key?(:line)\n @function_name = args[:function_name] if args.key?(:function_name)\n end", "def update!(**args)\n @delete_file = args[:delete_file] if args.key?(:delete_file)\n @write_file = args[:write_file] if args.key?(:write_file)\n end", "def update!(**args)\n @content = args[:content] if args.key?(:content)\n @file = args[:file] if args.key?(:file)\n @path = args[:path] if args.key?(:path)\n @permissions = args[:permissions] if args.key?(:permissions)\n @state = args[:state] if args.key?(:state)\n end", "def update!(**args)\n @uncommitted_file_changes = args[:uncommitted_file_changes] if args.key?(:uncommitted_file_changes)\n end", "def add_file_to_database(name, path, size, owner)\n $db.execute(\"INSERT INTO files (owner_id, file_name, file_size, file_path, publicity) VALUES (?, ?, ?, ?, 0)\", [owner, name, size, path])\nend", "def update\n version_event = false\n\n if params.has_key?(:revision) and params[:revision] != @generic_file.content.latest_version.versionID\n revision = @generic_file.content.get_version(params[:revision])\n @generic_file.add_file_datastream(revision.content, :dsid => 'content')\n version_event = true\n begin\n Resque.enqueue(ContentRestoredVersionEventJob, @generic_file.pid, current_user.user_key, params[:revision])\n rescue Redis::CannotConnectError\n logger.error \"Redis is down!\"\n end\n end\n\n if params.has_key?(:filedata)\n return unless virus_check(params[:filedata]) == 0\n add_posted_blob_to_asset(@generic_file, params[:filedata])\n version_event = true\n begin\n Resque.enqueue(ContentNewVersionEventJob, @generic_file.pid, current_user.user_key)\n rescue Redis::CannotConnectError\n logger.error \"Redis is down!\"\n end\n end\n @generic_file.update_attributes(params[:generic_file].reject { |k,v| %w{ Filedata Filename revision part_of date_modified date_uploaded format }.include? k})\n @generic_file.set_visibility(params)\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n # do not trigger an update event if a version event has already been triggered\n begin\n Resque.enqueue(ContentUpdateEventJob, @generic_file.pid, current_user.user_key) unless version_event\n rescue Redis::CannotConnectError\n logger.error \"Redis is down!\"\n end\n record_version_committer(@generic_file, current_user)\n redirect_to sufia.edit_generic_file_path(:tab => params[:redirect_tab]), :notice => render_to_string(:partial=>'generic_files/asset_updated_flash', :locals => { :generic_file => @generic_file })\n\n end", "def git_commit\n init_structure\n sha = add_all_changes_to_git\n \n if self.attributes.has_key?(\"version\") \n self.version = sha\n self.connection.update(\"UPDATE #{self.class.table_name} SET version='#{sha}' WHERE id='#{self.id}'\")\n end\n \n return sha\n end", "def update_foreign_file_level_data(\n foreign_content_at_file,\n sync_commit,\n sts_that_require_review\n )\n existing_data = foreign_content_at_file.read_file_level_data\n already_flagged_sts = existing_data['st_sync_subtitles_to_review'] || {}\n\n new_flagged_sts = already_flagged_sts.dup\n # Convert existing data in json file from scalar String to Array of Strings.\n new_flagged_sts.each { |stid, ops_type_or_types|\n new_flagged_sts[stid] = [*ops_type_or_types]\n }\n # Add new sts that require review, or add more ops types to existing ones.\n sts_that_require_review.each { |stid, ops_types|\n new_flagged_sts[stid] ||= []\n new_flagged_sts[stid] += ops_types\n new_flagged_sts[stid].uniq!\n new_flagged_sts[stid].sort!\n }\n # TODO: Check if this clashes with #update_file_level_data! in merge\n foreign_content_at_file.update_file_level_data!(\n existing_data.merge({\n 'st_sync_commit' => sync_commit,\n 'st_sync_subtitles_to_review' => new_flagged_sts,\n })\n )\n end", "def update_file_info\n if self.path\n size = File.exists?(self.path) ? File.size(self.path) : nil\n end\n if size\n (value, units) = bits_to_human_readable(size)\n self.size = value unless value.nil? or value.empty?\n self.size_units = units unless units.nil? or units.empty?\n self.save if self.descMetadata.changed?\n end\n end", "def update!(**args)\n @file_id = args[:file_id] if args.key?(:file_id)\n @file_name = args[:file_name] if args.key?(:file_name)\n @mime_type = args[:mime_type] if args.key?(:mime_type)\n end", "def update(params = {})\n file = params.delete(:file)\n if file\n self.filename = sanitize_filename(file.original_filename)\n self.content_type = file.content_type\n self.file_contents = file.read\n end\n super\n end", "def update_file(params)\n self.processed = false\n self.attributes = params\n set_upload_attributes\n save!\n Avatar.delay.finalize_and_cleanup(id)\n end", "def update_file_level_data!(key_val_pairs)\n # Create corresponding data.json file if it doesn't exist yet\n cdjf = corresponding_data_json_file(true)\n cdjf.update_data!(key_val_pairs)\n end", "def update_metadata(filename, metadata, path, site_path=nil)\n sanitized_filename = sanitize_filename(filename)\n url = computed_web_api_url(site_path)\n server_relative_url = \"#{site_path}#{path}/#{sanitized_filename}\"\n easy = ethon_easy_json_requester\n easy.url = uri_escape \"#{url}GetFileByServerRelativeUrl('#{server_relative_url}')/ListItemAllFields\"\n easy.perform\n\n __metadata = JSON.parse(easy.response_body)['d']['__metadata']\n update_metadata_url = __metadata['uri']\n prepared_metadata = prepare_metadata(metadata, __metadata['type'])\n\n easy = ethon_easy_json_requester\n easy.headers = { 'accept' => 'application/json;odata=verbose',\n 'content-type' => 'application/json;odata=verbose',\n 'X-RequestDigest' => xrequest_digest(site_path),\n 'X-Http-Method' => 'PATCH',\n 'If-Match' => \"*\" }\n easy.http_request(update_metadata_url,\n :post,\n { body: prepared_metadata })\n easy.perform\n check_and_raise_failure(easy)\n easy.response_code\n end", "def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc:\n# sql = \"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\"\n# devfiles_of_prev_commit = ActiveRecord::Base.connection.execute(sql)\n#\n devfiles_of_prev_commit = Devfile.find_by_sql(\"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\")\n if devfiles_of_prev_commit.size > 0\n ActiveRecord::Base.connection.execute(\"begin\")\n now = DateTime.now\n devfiles_of_prev_commit.each do |df|\n if not changed_files.has_key?(df.path + df.name)\n begin\n sql = \"insert into blobs_in_commits(blob_id, commit_id, created_at, updated_at) values('#{df['blob_id']}', '#{commit.id}', '#{now}', '#{now}');\"\n ActiveRecord::Base.connection.execute(sql)\n rescue\n # do nothing\n end\n end\n end\n ActiveRecord::Base.connection.execute(\"commit\")\n end\n end", "def update!(**args)\n @file = args[:file] if args.key?(:file)\n @function = args[:function] if args.key?(:function)\n @line = args[:line] if args.key?(:line)\n end", "def update!(**args)\n @file_name = args[:file_name] if args.key?(:file_name)\n end", "def update\n cf = CoreFile.find(params[:id])\n cf.update(core_file_params)\n\n redirect_to cf\n end", "def update!(**args)\n @file_size = args[:file_size] unless args[:file_size].nil?\n @references_version = args[:references_version] unless args[:references_version].nil?\n end", "def changeMetadata\n begin\n \n \n # Gets parameters\n typename = params[:metadata_type].to_s.strip.downcase\n value = params[:metadata_value].to_s.strip\n\n if typename == \"\"\n render :text => \"Type of metadata not given.\", :status => 404\n return\n end\n \n if value == \"\"\n render :text => \"Value of metadata not given.\", :status => 404\n return\n end\n \n # Search for the user\n @user = User.find_by_username(params[:username].to_s.strip)\n if not @user\n # If the user was not found\n return\n render :text => \"User not found.\", :status => 404\n end\n \n # Search for the device\n findDeviceOfURI\n if @device != nil\n getPathAndFilename\n @devfile = @device.devfiles.find(:first, :conditions => ['name = ? and path = ?', @filename, @path])\n if @devfile == nil\n render :text => \"File was not found.\", :status => 404\n return\n end\n else\n # If the device was not found\n render :text => \"Device was not found.\", :status => 404\n return\n end\n \n # If updating description to devfile\n if typename == \"description\"\n @devfile.update_attribute(:description, value)\n render :text => \"Metadata description updated\", :status => 201\n return\n # If updating filetype to devfile\n elsif typename == \"filetype\"\n #TODO: Check valid mime type\n \n @devfile.update_attribute(:filetype, value)\n render :text => \"Metadata filetype updated\", :status => 201\n return\n \n # If updating metadata in blob\n elsif typename == \"uploaded\" or typename == \"latitude\" or typename == \"longitude\" or typename == \"filedate\" or typename == \"file_status\"\n # Looks for right version of the file\n if params[:version] != nil\n puts \"Fetching version: \" + params[:version]\n @blob = @devfile.blobs.find(:first, :conditions => ['version = ?', params[:version]])\n if not @blob\n render :text => \"Version of the file was not found.\", :status => 404\n return\n end\n if typename == \"filedate\"\n # Create new DateTime object from given value \n newtime = DateTime.strptime(value, '%F %T')\n @blob.update_attribute(:filedate, newtime)\n render :text => \"Metadata filedate updated\", :status => 201\n return\n elsif typename == \"uploaded\" or typename == \"file_status\" \n if value == \"0\" #or intti == 1 can only be changed to non-cached\n intti = value.to_i\n puts \"foo\" \n @blob.update_attribute(:uploaded, intti)\n render :text => \"Metadata uploaded updated\", :status => 201\n return\n else\n render :text => \"Invalid metadata value\", :status => 404\n return\n end\n \n elsif typename == \"latitude\"\n latitude = value.to_f\n @blob.update_attribute(:latitude, latitude) \n render :text => \"Metadata latitude updated to #{latitude}\", :status => 201\n return \n elsif typename == \"longitude\"\n longitude = value.to_f\n @blob.update_attribute(:longitude, longitude)\n render :text => \"Metadata longitude updated to #{longitude}\", :status => 201\n return\n end\n # If version of the file was not given\n else\n render :text => \"Version of the file needed.\", :status => 404\n return\n end\n \n # Can't change metadata value from: name, path, creater_at, updated_at, privatefile, \n # size, upload_requested, thumbnail_name, version, blob_hash \n elsif typename == \"name\" or typename == \"path\" or typename == \"created_at\" or typename == \"privatefile\" or\n typename == \"size\" or typename == \"upload_requested\" or typename == \"thumbnail_name\" or\n typename == \"version\" or typename == \"blob_hash\"\n render :text => \"Can't change this metadata from devfile or blob.\", :status => 404\n return\n \n else \n # Checks that metadata type is already added\n type = MetadataType.find_by_name(typename)\n \n if not type\n # If there is not such metadata type already added\n render :text => \"Metadata type not found. Please add metadata type first.\", :status => 404\n return\n end\n \n # Checks that value is either string/float/date/datetime, according to value_type from metadata_types\n if type.value_type == \"string\"\n # String doesn't need to be checked?\n \n elsif type.value_type == \"float\"\n # Check that value has float\n if value !~ /^\\s*[+-]?((\\d+_?)*\\d+(\\.(\\d+_?)*\\d+)?|\\.(\\d+_?)*\\d+)(\\s*|([eE][+-]?(\\d+_?)*\\d+)\\s*)$/\n render :text => \"Invalid float type\", :status => 404\n return\n end\n \n elsif type.value_type == \"date\"\n # Check that value is valid date\n \n value = QueryController::transform_date(value) \n\n begin\n Date.new(value[0..3].to_i, value[5..6].to_i, value[8..9].to_i)\n rescue \n render :text => \"invalid date\", :status => 404\n return\n end\n \n elsif type.value_type == \"datetime\"\n if not QueryController::check_datetime(value)\n render :text => \"invalid datetime\", :status => 404\n return\n end\n\n else\n # Couldn't find value_type. You should never find yourself here\n render :text => \"Error adding metadata, contact support hotline\", :status => 404\n return\n end\n\n \n # \n if @devfile\n \n metadata = Metadata.find(:first, :conditions => ['metadata_type_id = ? and devfile_id = ?', type.id, @devfile.id])\n if metadata and typename != \"tag\"\n metadata.update_attribute(:value, value)\n \n \n if typename == \"context_hash\"\n \n \n context = Context.find_by_context_hash(value)\n if context \n Thread.new{\n puts \"kylla lahtee\"\n XmppHelper::notificationToContextNode(@devfile, context, \"Context content updated!\", \"content-added-to-context\") \n }\n end\n end\n \n \n render :text => \"Metadata value changed\", :status => 200\n return\n end \n if params[:version] != nil\n puts \"Fetching version: \" + params[:version]\n @blob = @devfile.blobs.find(:first, :conditions => ['version = ?', params[:version]])\n if not @blob\n render :text => \"Version of the file was not found.\", :status => 404\n return\n end\n Metadata.find_or_create_by_value_and_blob_id_and_devfile_id_and_metadata_type_id(value, @blob.id, @devfile.id, type.id)\n else \n Metadata.find_or_create_by_value_and_blob_id_and_devfile_id_and_metadata_type_id(value, nil, @devfile.id, type.id)\n end\n render :text => \"Metadata added\", :status => 201\n return\n end\n end\n \n rescue ArgumentError\n render :text => \"Invalid arguments\", :status => 409\n rescue => e\n puts \"Error in updating metadata\".background(:red)\n puts e\n end\n end", "def update!(**args)\n @file_path = args[:file_path] if args.key?(:file_path)\n @function_name = args[:function_name] if args.key?(:function_name)\n @line_number = args[:line_number] if args.key?(:line_number)\n end", "def update_ID3(attributes)\n begin\n musicFile = TagLib::File.new(self.filePath())\n musicFile.title = attributes[:id3Title]\n musicFile.artist = attributes[:id3Artist]\n musicFile.save()\n rescue TagLib::BadFile => exc\n logger.error(\"Failed to id track: \\n #{exc}\")\n end \n end", "def update_file\n output = (@blocks[:before] + @blocks[:attributes] + @blocks[:after]).join(\"\\n\").strip + \"\\n\"\n File.open(@filename,'w') { |f| f.write(output) } if output != @file\n end", "def update_current_file_and_current_id\n if @data_file[@current_id] && has_id_col? && @current_id != line_id\n @data_file[current_pid].close\n end\n\n @current_id = line_id\n\n if @data_file[@current_id] && @data_file[@current_id].closed?\n @data_file[@current_id].reopen(@data_file[@current_id].path, \"a\")\n elsif @current_id and @data_file[@current_id].nil? and not date.nil?\n set_datestamp\n # TODO: Make this configurable ---v\n filename = \"#{@match_buffer[\"_datestamp\"]}_#{@current_id}.data\"\n filename = File.join @options[:output_dir], filename\n\n puts \"creating new file: #{filename}\" if true || @options[:verbose]\n @data_file[@current_id] = File.open(filename, :mode => \"w\")\n end\n end", "def update!(**args)\n @filename = args[:filename] if args.key?(:filename)\n @size = args[:size] if args.key?(:size)\n @upload_status = args[:upload_status] if args.key?(:upload_status)\n end", "def update_content(file, relation = :original_file)\n IngestJob.perform_later(wrapper!(file: file, relation: relation), notification: true)\n end", "def file=(f)\n @file = f\n @internal = nil # force reload\n @file\n end", "def update!(**args)\n @blob_generation = args[:blob_generation] if args.key?(:blob_generation)\n @blob_id = args[:blob_id] if args.key?(:blob_id)\n @download_read_handle = args[:download_read_handle] if args.key?(:download_read_handle)\n @read_token = args[:read_token] if args.key?(:read_token)\n @upload_metadata_container = args[:upload_metadata_container] if args.key?(:upload_metadata_container)\n end", "def commit_file\n\t\tlogger.info(\"[File Attribute #{sprintf('0x%08x', self.object_id)}] Committing file for #{@obj.class}(#{@obj.id}).#{attribute_name} ...\")\n\t\tif @file\n\t\t\tlogger.info(\"[File Attribute] Saving file #{local_file_name} ...\")\n\t\t\t@file.rewind if @file.respond_to?(:rewind)\n\t\t\tFile.makedirs(File.dirname(local_file_name))\n\t\t\tFile.open(local_file_name, \"w\") do |f|\n\t\t\t\tf.write(@file.read)\n\t\t\tend\n\t\t\tlogger.info(\"[File Attribute] Done.\")\n\t\telse\n\t\t\tlogger.info(\"[File Attribute] Skipping file save of #{@file.inspect}.\")\n\t\tend\n\t\ttrue\n\tend", "def commit opts = {}\n commit_attrs = opts.delete :commit_attributes\n update opts.merge(:data => xml.commit( commit_attrs ))\n end", "def commit_new_cb_version\n shellout('git add metadata.rb')\n @gitrepo.commit_index(\"release v#{@target_version}\")\n end", "def update\n @resource = params[:content]\n\n\t\tif params[:dir_path] == \"/\"\n\t\t\tparams[:dir_path]=\"\"\n\t\tend\n\n\t\tfile_path = \"#{params[:dir_path]}/#{params[:filename]}\"\n\n if File.open(file_path, 'w') {|f| f.write(params[:content]) }\n\t\t\tDir.chdir(params[:dir_path])\n\t\t\t@git = Git.init()\n\t\t\tGitHelper.commitAll(@git, params[\"comment\"])\n\n\t\t\trender json: {success: \"file successfully uploaded\"}\n else\n render json: { error: \"SOMETHING WENT WRONG SAVING RESOURCE\" }\n end\n end", "def update!(**args)\n @exec = args[:exec] if args.key?(:exec)\n @file = args[:file] if args.key?(:file)\n @id = args[:id] if args.key?(:id)\n @pkg = args[:pkg] if args.key?(:pkg)\n @repository = args[:repository] if args.key?(:repository)\n end", "def update_page(page, name, format, data, commit = {})\n name ||= page.name\n format ||= page.format\n dir = ::File.dirname(page.path)\n dir = '' if dir == '.'\n index = nil\n sha1 = commit_index(commit) do |idx|\n index = idx\n if page.name == name && page.format == format\n index.add(page.path, normalize(data))\n else\n index.delete(page.path)\n add_to_index(index, dir, name, format, data, :allow_same_ext)\n end\n end\n\n @access.refresh\n update_working_dir(index, dir, page.name, page.format)\n update_working_dir(index, dir, name, format)\n\n sha1\n end", "def update!(**args)\n @blob_id = args[:blob_id] if args.key?(:blob_id)\n @content_type = args[:content_type] if args.key?(:content_type)\n @hash_prop = args[:hash_prop] if args.key?(:hash_prop)\n @key = args[:key] if args.key?(:key)\n @name = args[:name] if args.key?(:name)\n @size = args[:size] if args.key?(:size)\n end", "def update_content(file, relation = :original_file)\n # HELIO-3506 override for tempfiles uploaded via Versioning\n if file.is_a?(Hyrax::UploadedFile)\n IngestJob.perform_later(wrapper!(file: file, relation: relation), notification: true)\n else\n IngestJob.perform_now(wrapper!(file: file, relation: relation), notification: true)\n end\n end", "def create_commit_filepath(filepaths, commit_hash)\n filepaths.each do |str_path, churn|\n @con.exec_prepared('fileInsert', [commit_hash,str_path, churn])\n end\n end", "def update!(**args)\n @data = args[:data] if args.key?(:data)\n @file_name = args[:file_name] if args.key?(:file_name)\n @size = args[:size] if args.key?(:size)\n end", "def internal_file_attributes=(_arg0); end", "def update\n return unless @hash\n begin\n lockf = File.open(@path+\".lock\", File::CREAT|File::RDWR, 0600)\n lockf.flock File::LOCK_EX\n f = File.open(@path+\".new\", File::CREAT|File::TRUNC|File::WRONLY, 0600)\n for k,v in @hash\n f.printf \"%s=%s\\n\", CGI.escape(k), CGI.escape(String(Marshal.dump(v)))\n end\n f.close\n File.rename @path+\".new\", @path\n ensure\n f&.close\n lockf&.close\n end\n end", "def update!(**args)\n @avro_file_format = args[:avro_file_format] if args.key?(:avro_file_format)\n @file_rotation_interval = args[:file_rotation_interval] if args.key?(:file_rotation_interval)\n @file_rotation_mb = args[:file_rotation_mb] if args.key?(:file_rotation_mb)\n @json_file_format = args[:json_file_format] if args.key?(:json_file_format)\n @path = args[:path] if args.key?(:path)\n end", "def update!\n if canonical_file.exist?\n if file.mtime > canonical_file.mtime\n save!\n end\n else\n save!\n end\n end", "def update!(**args)\n @files = args[:files] if args.key?(:files)\n @script_id = args[:script_id] if args.key?(:script_id)\n end", "def add1 fn, pid='NULL', fp='';\n #>! make alg. to fill pid/fp from that other value - to have known boths\n st = File .stat fp+'/'+fn\n #>! if exist update then\n sq = \\\n %Q{ INSERT INTO #{$config.local_disk}_files\n (pid,fileName,st_mode,st_nlink,st_uid,st_gid,\n st_size,st_atime,st_mtime,st_ctime,pathCache)\n VALUES\n (#{pid},'#{fn}',#{st.mode},#{st.nlink},#{st.uid},#{st.gid},\n #{st.size},'#{st.atime}','#{st.mtime}','#{st.ctime}','#{fp}'); }\n puts sq\n @db.execute sq\n check1 fn, pid\n end", "def update_file_content(new_content)\n return false if new_content.nil?\n self.file_content = new_content\n return self.save\n end", "def metadata_file; end", "def metadata_file; end", "def update\n @file = @map.meta_data\n # binding.pry\n\n @meta_data = []\n @kind = @map.kind\n fips_to_hc_key\n @map.meta_data = @meta_data\n\n respond_to do |format|\n if @map.update(map_params)\n format.html { redirect_to @map, notice: 'Map was successfully updated.' }\n format.json { render :show, status: :ok, location: @map }\n else\n format.html { render :edit }\n format.json { render json: @map.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_files(resource)\n updated = files.select { |file| file.is_a?(Hash) }.map do |file|\n node = resource.file_metadata.select { |x| x.id.to_s == file.keys.first.to_s }.first\n node.updated_at = Time.current\n # Uses the UploadDecorator to abstract the interface for the File Object during persistence by the storage_adapter\n file_wrapper = UploadDecorator.new(file.values.first, node.original_filename.first)\n\n # Ensure that errors for one file are logged but do not block updates for others\n begin\n storage_adapter.upload(file: file_wrapper, original_filename: file_wrapper.original_filename, resource: node)\n node.label = file.values.first.original_filename\n node.mime_type = file.values.first.content_type\n node\n rescue StandardError => error\n Valkyrie.logger.error \"#{self.class}: Failed to update the file #{file_wrapper.original_filename} for #{node.id}: #{error}\"\n # Ensure that this file is not created instead of updated\n @files.delete_if { |updated_file| updated_file.values.first.original_filename == file_wrapper.original_filename }\n nil\n end\n end\n\n updated.compact\n end", "def update_info_from_file()\n @ole.UpdateInfoFromFile()\n end", "def file\n # Se busca el proyecto\n @project = Project.find(params[:id])\n # Se archiva, seteandole un atributo del mismo en true\n @project.update_column(:filed, true)\n redirect_to :back, flash: {success: t('project.filed')}\n end", "def find_and_update_task_snapshot(previous_file_hash, new_file_hash)\n ::Snapshot.find_each do |snapshot|\n child = find_child_with_file_hash previous_file_hash, snapshot.contents\n if child\n # update snapshot to use new_file_hash instead of the previous_file_hash\n child['value'] = new_file_hash\n\n # we're updating the internals contents of the snaphot above so\n # be sure to save the snapshot\n snapshot.save!\n end\n end\n end", "def update_file_content(new_content)\n return false if new_content.nil?\n self.file_content = new_content\n self.save\n end", "def update_file_content(new_content)\n return false if new_content.nil?\n self.file_content = new_content\n self.save\n end", "def update\n RawFile.transaction do\n @raw_file = RawFile.find_by_user(params[:id],current_user.id)\n\n @raw_file.uploaded_file = params[:raw_file][:file]\n\n respond_to do |format|\n if @raw_file.save\n format.html { redirect_to @raw_file, :notice => 'Raw file was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\", :locals => { :raw_file => @raw_file } }\n format.json { render :json => @raw_file.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def commit(filename)\n initialize_lines = @attributes.map.with_index do |attribute, index|\n format('@%<name>s = row[indexes[%<index>d]]%<cast>s',\n name: attribute.first,\n index: index,\n cast: attribute.last)\n end.join(\"\\n\")\n load_lines = @attributes.map do |attribute|\n format('header.index(\"%<name>s\") || 0', name: attribute.first)\n end.join(',')\n definition = format <<~CLASS_DEF, initialize_lines: initialize_lines, load_lines: load_lines\n def initialize(row, indexes)\n %<initialize_lines>s\n end\n class << self\n def load(path)\n rows = CSV.read(File.join(path, '#{filename}'))\n header = rows.shift\n indexes = [%<load_lines>s]\n return @all = rows.map { |row| self.new(row, indexes) }\n end\n end\n CLASS_DEF\n class_eval(definition)\n end", "def save(upload)\n uploadFile = upload['datafile']\n originalName = uploadFile.original_filename\n self.fileType = File.extname(originalName)\n\n create_or_update()\n\n # write the file\n File.open(self.filePath, \"wb\") { |f| f.write(uploadFile.read) }\n \n # write ID3 metadata to database, to avoid the expense of fetching\n # from the file every time - quite costly as more files are displayed at a time\n begin\n musicFile = TagLib::File.new(self.filePath())\n self.id3Title = musicFile.title\n self.id3Artist = musicFile.artist\n self.id3Length = musicFile.length\n rescue TagLib::BadFile => exc\n logger.error(\"Failed to id track: \\n #{exc}\")\n end\n\n if(self.fileType == '.mp3')\n convertToOGG();\n end\n create_or_update()\n\n end", "def commit\n return if name.kind_of?(StringIO) || !commit_required?\n\n on_success_replace do |tmp_file|\n ::Zip::OutputStream.open(tmp_file) do |zos|\n @entry_set.each do |e|\n e.write_to_zip_output_stream(zos)\n e.dirty = false\n e.clean_up\n end\n zos.comment = comment\n end\n true\n end\n initialize(name)\n end", "def update\n respond_to do |format|\n\n if @file_upload.update(file_upload_params)\n format.html { redirect_to user_file_upload_path, notice: 'File was successfully updated.' }\n format.json { render :show, status: :ok, location: @file_upload }\n @md5 = Digest::MD5.file(@file_upload.attachment.path).hexdigest \n @file_upload[:hash_val]=@md5\n @file_upload.save\n else\n format.html { render :edit }\n format.json { render json: @file_upload.errors, status: :unprocessable_entity }\n end\n end\n end", "def insert_file_into_db(owner_id, file_name, upload_date, last_access_date, file_type, file_size, folder_id, public_status)\n p owner_id, file_name, upload_date, last_access_date, file_type, file_size, folder_id, public_status\n $db.execute(\"INSERT INTO files (owner_id,file_name,upload_date,last_access_date, file_type,file_size,folder_id,public_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?)\",\n owner_id,\n file_name,\n upload_date,\n last_access_date,\n file_type,\n file_size,\n folder_id,\n public_status)\nend" ]
[ "0.6721979", "0.6275223", "0.62125784", "0.6174687", "0.609163", "0.6052312", "0.6048062", "0.6019263", "0.6007592", "0.5907478", "0.5837032", "0.5811534", "0.5783385", "0.5722229", "0.5706745", "0.56770873", "0.5673615", "0.5644141", "0.5643654", "0.5631918", "0.56115127", "0.55969965", "0.5578389", "0.5543778", "0.5519366", "0.55156845", "0.55111086", "0.5507072", "0.55057245", "0.54987544", "0.54949087", "0.5468266", "0.5468266", "0.5468266", "0.54131335", "0.5406196", "0.5397842", "0.53958464", "0.53958464", "0.5395373", "0.53807825", "0.5366544", "0.5366143", "0.5364779", "0.5356865", "0.5339829", "0.53385633", "0.5327662", "0.53251797", "0.53209203", "0.53043777", "0.53035295", "0.52969766", "0.52938753", "0.5282314", "0.5279358", "0.52761394", "0.5274261", "0.52475655", "0.52472335", "0.524619", "0.5242541", "0.5233067", "0.5215909", "0.521299", "0.5204666", "0.5194857", "0.51937425", "0.51891714", "0.51883876", "0.518293", "0.51746297", "0.51742125", "0.5166694", "0.51498127", "0.51445794", "0.5132487", "0.5131993", "0.5130261", "0.51241964", "0.511395", "0.51103073", "0.5109637", "0.5102728", "0.5097094", "0.5089648", "0.5089648", "0.50883067", "0.5087733", "0.5086754", "0.50853896", "0.5082296", "0.5081356", "0.5081356", "0.50784874", "0.50732523", "0.506597", "0.50599104", "0.5052789", "0.50467753" ]
0.6593738
1
Creates metadata of a new file to db parameters: f file commit the commit the file belongs to
def createDevfile(f, commit) #:doc: dev_file = nil blob = nil b_in_c = nil # If file already exists, raises an error but nothing needs to be deleted (except the commit is cancelled) begin dev_file = Devfile.find_by_name_and_path_and_device_id(f['name'], f['path'], @device.id) if dev_file != nil puts "Devfile: #{f['path'] + f['name']} already exits, cannot create, use update instead" raise ArgumentError.new("Devfile already exits for this device, cannot use CREATE -method, use UPDATE instead to add new version") end rescue Exception => e puts e.to_s puts e.backtrace[0].to_s raise e end puts "name: #{f['name']}" puts "path: #{f['path']}" # If something goes wrong, raises an error, and deletes the data created begin puts "Creating new dev_file, blob etc.." f_filedate = DateTime.strptime(f['filedate'], "%T %F") f_filedate = f_filedate.strftime('%F %T').to_s now = DateTime.now # get or create devfile dev_file = Devfile.find_or_create_by_name_and_path_and_device_id(f['name'], f['path'], @device.id) if dev_file.created_at >= now sql = "update devfiles set filetype='#{f['filetype']}', path='#{f['path']}', privatefile=0 where id=#{dev_file.id}" ActiveRecord::Base.connection.execute(sql) end # get or create blob blob = Blob.find_or_create_by_blob_hash_and_devfile_id(f['blob_hash'], dev_file.id) if blob.created_at >= now # if just created # Version number version = 0 predecessor_blob_id = "NULL" follower_blob_id = "NULL" if dev_file.blob_id != nil predecessor_blob_id = dev_file.blobs.find_by_id(dev_file.blob_id) ? dev_file.blobs.find_by_follower_id(dev_file.blob_id).id.to_s : "NULL" follower_blob_id = dev_file.blobs.find_by_predecessor_id(blob.id) ? dev_file.blobs.find_by_predecessor_id(blob.id).id.to_s : "NULL" version = dev_file.blobs.find_by_id(dev_file.blob_id).version + 1 end puts "predecessor_id=#{predecessor_blob_id.to_s}," puts "follower_id=#{follower_blob_id.to_s}," puts "size=#{f['size'].to_s}," puts "filedate='#{f_filedate.to_s}'," puts "version=#{version.to_s}," puts "uploaded='0'," puts "latitude=#{@commit_location['latitude'].to_s}, " puts "longitude=#{@commit_location['longitude'].to_s} " sql = "update blobs set predecessor_id=#{predecessor_blob_id.to_s}, follower_id=#{follower_blob_id.to_s}, size=#{f['size'].to_s}, filedate='#{f_filedate.to_s}', version=#{version.to_s}, uploaded='0', latitude=#{@commit_location['latitude'].to_s}, longitude=#{@commit_location['longitude'].to_s} where id=#{blob.id};" puts "sql: " + sql ActiveRecord::Base.connection.execute(sql) end # Creates association between blob and commit b_in_c = BlobsInCommit.find_or_create_by_blob_id_and_commit_id(blob.id, commit.id) # update blob_id to devfile if dev_file.blob_id != blob.id sql = "update devfiles set blob_id=#{blob.id} where id=#{dev_file.id};" ActiveRecord::Base.connection.execute(sql) end #checkForObservers(dev_file) # If parent_blob_hash is given, tries to find the parent, and creates new branch form the parent if f['file_origin'] createBranch(f['file_origin'], blob) end rescue Exception => e puts " -- Error in createDevfile: " + e puts " -- line: #{e.backtrace[0].to_s}" puts "Deleting created data.." # If dev_file was created now, deletes it dev_file.delete if dev_file puts "Deleted created dev_file!" if dev_file if blob if b_in_c BlobsInCommit.delete_all(["commit_id = ? AND blob_id = ?", b_in_c.commit_id.to_s, blob.blob_id.to_s]) puts "Deleted created blobs_in_commits!" if b_in_c end blob.delete puts "Deleted created blob!" end # Throws forward the exception.. raise e end puts "File created" return dev_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_db_data( f, cl, tbd, df )\n s = File::Stat.new( f )\n if ! s\n puts \"couldn't stat #{f}\\n\"\n next\n end\n\n # grab extension\n m = /(\\.\\w+)$/.match( f )\n if m && m[1]\n # yes it's redundant, but this way, if the file is outside of it's directory i have half a chance of knowing what it is\n new_pathfile = s.mtime.strftime( \"%m/%d/%m%d%H%M\" ) + m[1]\n else \n puts \"couldn't find file extension for #{f}\\n\"\n next\n end\n\n md5_checksum = Digest::MD5.hexdigest( File.read( f ) )\n\n # make directories if needed\n testfile = tbd + s.mtime.strftime( \"/%m\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n testfile += s.mtime.strftime( \"/%d\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n # copy file to new location\n FileUtils.copy( f, \"#{tbd}/\" + new_pathfile )\n\n # save data for db push\n df.push( { :class => cl, :created_text_date => s.mtime, :created_epoch_seconds => s.mtime.to_i, :pathfile => new_pathfile, :md5_checksum => md5_checksum } )\nend", "def create_file(file)\n @generic_file = GenericFile.new\n @generic_file.batch_id = object.batch.pid\n @generic_file.add_file(file.read, 'content', file.name)\n @generic_file.apply_depositor_metadata(object.edit_users.first)\n @generic_file.date_uploaded = Time.now.ctime\n @generic_file.date_modified = Time.now.ctime\n @generic_file.save\n end", "def create\n File.open(@db_file, \"w\" ) do |file|\n end\n end", "def add_file_to_database(name, path, size, owner)\n $db.execute(\"INSERT INTO files (owner_id, file_name, file_size, file_path, publicity) VALUES (?, ?, ?, ?, 0)\", [owner, name, size, path])\nend", "def metadata_file; end", "def metadata_file; end", "def create_commit_filepath(filepaths, commit_hash)\n filepaths.each do |str_path, churn|\n @con.exec_prepared('fileInsert', [commit_hash,str_path, churn])\n end\n end", "def create_meta(file_name, uid, uname, user_address)\n hist_dir = history_dir(storage_path(file_name, user_address)) # get the path to the file history\n\n # write user name, user uid and the creation time to the json object\n json = {\n :created => Time.now.to_formatted_s(:db),\n :uid => uid,\n :uname => uname\n }\n\n # write file meta information to the createdInfo.json file\n File.open(File.join(hist_dir, \"createdInfo.json\"), 'wb') do |file|\n file.write(json.to_json)\n end\n end", "def create_file(title, description, parent_id, mime_type, file_name)\n \tinsert_file(title, description, parent_id, 'application/vnd.google-apps.file', file_name)\n\tend", "def insert_file_into_db(owner_id, file_name, upload_date, last_access_date, file_type, file_size, folder_id, public_status)\n p owner_id, file_name, upload_date, last_access_date, file_type, file_size, folder_id, public_status\n $db.execute(\"INSERT INTO files (owner_id,file_name,upload_date,last_access_date, file_type,file_size,folder_id,public_status) VALUES (?, ?, ?, ?, ?, ?, ?, ?)\",\n owner_id,\n file_name,\n upload_date,\n last_access_date,\n file_type,\n file_size,\n folder_id,\n public_status)\nend", "def create(filename, text); end", "def create_file_with_blog_metadata(title)\n filename = generate_filename(title)\n filepath = \"_posts/#{filename}\"\n\n raise 'The file already exists.' if File.exists?(filepath)\n\n blog_metadata = generate_metadata_for(title)\n File.write(filepath, blog_metadata)\n\n filepath\nend", "def make_new_file\n\t\tmetadata_file_data = \"\"\n\t\tmetadata_file_data << \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?><cp:coreProperties\"\n\t\tmetadata_file_data << \" xmlns:cp=\\\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\\\" \"\n\t\tmetadata_file_data << \"xmlns:dc=\\\"http://purl.org/dc/elements/1.1/\\\" xmlns:dcterms=\\\"http://purl.org/dc/terms/\\\" \"\n\t\tmetadata_file_data << \"xmlns:dcmitype=\\\"http://purl.org/dc/dcmitype/\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n\t\tmetadata_file_data << \"<dc:creator>#{datastore['DOCAUTHOR']}</dc:creator><cp:lastModifiedBy>#{datastore['DOCAUTHOR']}\"\n\t\tmetadata_file_data << \"</cp:lastModifiedBy><cp:revision>1</cp:revision><dcterms:created xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:created><dcterms:modified xsi:type=\\\"dcterms:W3CDTF\\\">\"\n\t\tmetadata_file_data << \"2013-01-08T14:14:00Z</dcterms:modified></cp:coreProperties>\"\n\n\t\t#where to find the skeleton files required for creating an empty document\n\t\tdata_dir = File.join(Msf::Config.install_root, \"data\", \"exploits\", \"docx\")\n\n\t\t#making the actual docx\n\t\tdocx = Rex::Zip::Archive.new\n\t\t#add skeleton files\n\t\tvprint_status(\"Adding skeleton files from #{data_dir}\")\n\t\tDir[\"#{data_dir}/**/**\"].each do |file|\n\t\t\tif not File.directory?(file)\n\t\t\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t\tend\n\t\tend\n\t\t#add on-the-fly created documents\n\t\tvprint_status(\"Adding injected files\")\n\t\tdocx.add_file(\"docProps/core.xml\", metadata_file_data)\n\t\tdocx.add_file(\"word/_rels/settings.xml.rels\", @rels_file_data)\n\t\t#add the otherwise skipped \"hidden\" file\n\t\tfile = \"#{data_dir}/_rels/.rels\"\n\t\tdocx.add_file(file.sub(data_dir,''), File.read(file))\n\t\t#and lets create the file\n\t\tfile_create(docx.pack)\n\tend", "def addMetadata(filename, metadatatype, metadatavalue)\n begin\n \n if @fileMetadata.has_key?(filename)\n @fileMetadata[filename] = @fileMetadata[filename].to_s + \"&&&\" + metadatatype.downcase + \":\" + metadatavalue.downcase\n else\n @fileMetadata[filename] = metadatatype.downcase + \":\" + metadatavalue.downcase\n end\n \n rescue Exception => e\n puts \"Error: #{e.to_s}\"\n puts \" -- line: #{e.backtrace[0].to_s}\"\n raise Exception.new(\"Could not add metadata to a new file!\")\n end\n end", "def create_file_ds(f, id= nil, label=nil)\n puts \"creating file ds for #{f} \"\n if id.nil? || id.empty?\n id = File.basename(f, File.extname(f)).gsub(\" \", \"-\")\n end\n if label.nil? || label.empty?\n label = File.basename(f, File.extname(f)).gsub(\" \", \"-\")\n end\n\n ActiveFedora::Datastream.new(:dsID=>id, :controlGroup=>\"M\" , :blob=>File.open(f), :dsLabel=>label)\n\n end", "def write_metadata; end", "def updateDevfile(f, commit) #:doc:\n \n dev_file = nil\n \n begin\n # Checks if there is any changes in files.\n f_filedate = DateTime.strptime(f['filedate'], \"%T %F\")\n f_filedate = f_filedate.strftime('%F %T').to_s \n \n now = DateTime.now.strftime('%F %T')\nputs \"name: #{f['name']}\"\nputs \"path: #{f['path']}\"\n puts \"Finding devfile..\"\n dev_file = @device.devfiles.find(:first, :conditions => [\"name = ? and path = ?\", f['name'], f['path']])\n if dev_file != nil\n puts \"devfile found: \" + dev_file.id.to_s\n else\n puts \"Devfile not found\"\n raise Exception.new(\"Devfile not found. Can not update it!\")\n end\n \n \n blob = dev_file.blobs.find_by_blob_hash_and_devfile_id(f['blob_hash'], dev_file.id)\n if blob != nil\n puts \"Blob already exists!\"\n puts \"Blob: \" + blob.id.to_s\n return\n else\n puts \"Blob was not found!\"\n end\n \n # Finds the blob that is newest one\n previous_blob_id = nil\n current_blob = dev_file.blobs.find_by_id(dev_file.blob_id)\n if current_blob != nil\n previous_blob_id = current_blob.id.to_s\n puts \"Current blob: \" + current_blob.id.to_s\n \n end\n \n # If the blob, didn't exist yet, creates it. Ensures that blob will have version number.\n if blob == nil #or current_blob == nil\n version = 0\n if current_blob != nil\n version = current_blob.version + 1\n end\n \n puts \"Creates new blob, verion num: \" + version.to_s\n sql = \"insert into blobs(blob_hash, created_at, updated_at, size, filedate, uploaded, version, devfile_id, predecessor_id, latitude, longitude) values('#{f['blob_hash']}', '#{now}', '#{now}', '#{f['size']}', '#{f_filedate}', '0', '#{version}', '#{dev_file.id}', '#{previous_blob_id}', '#{@commit_location['latitude']}', '#{@commit_location['longitude']}');\"\n ActiveRecord::Base.connection.execute(sql)\n end\n \n puts \"Finding the newly created blob..\"\n blob = dev_file.blobs.find_by_blob_hash(f['blob_hash'])\n puts \" found blob: \" + blob.id.to_s\n \n current_blob.update_attribute(:follower_id, blob.id)\n \n puts \"Updating devfile\"\n # Updates changes in devfile (current blob)\n sql = \"update devfiles set filetype = '#{f['filetype']}', latitude = '#{f['latitude']}', longitude = '#{f['longitude']}', blob_id = '#{blob.id.to_s}', updated_at = '#{now}' where name = '#{f['name']}' and path = '#{f['path']}' and device_id = #{@device.id};\"\n puts \" SQL: \" + sql.background(:red)\n ActiveRecord::Base.connection.execute(sql)\n \n BlobsInCommit.find_or_create_by_blob_id_and_commit_id(blob.id, commit.id)\n \n \n #checkForObservers(dev_file)\n \n rescue => e\n puts \"Errors in updating file\" + e\n raise e\n end\n \n puts \"devfile updated!\"\n return dev_file\n end", "def create\n\n if File.exists?(dbfilename)\n puts \"Moved '#{dbfilename}' to '#{dbfilename}.bak'.\"\n FileUtils.mv(dbfilename, dbfilename + '.bak')\n end\n db = Sequel.sqlite(dbfilename)\n db.create_table :pdfmd_documents do\n String :md5sum, :primary_key => true\n String :filename\n String :author\n String :title\n String :subject\n Date :createdate\n String :keywords\n String :filepath\n end\n db.add_index :pdfmd_documents, :md5sum\n db.add_index :pdfmd_documents, :keywords\n end", "def file_create(data)\r\n\r\n\t\tfname = datastore['FILENAME']\r\n\t\tltype = \"exploit.fileformat.#{self.shortname}\"\r\n\r\n\t\tif ! ::File.directory?(Msf::Config.local_directory)\r\n\t\t\tFileUtils.mkdir_p(Msf::Config.local_directory)\r\n\t\tend\r\n\r\n\t\tpath = File.join(Msf::Config.local_directory, fname)\r\n\t\tfull_path = ::File.expand_path(path)\r\n\t\tFile.open(full_path, \"wb\") { |fd| fd.write(data) }\r\n\r\n\t\treport_note(:data => full_path.dup, :type => \"#{ltype}.localpath\")\r\n\r\n\t\tprint_good \"#{fname} stored at #{full_path}\"\r\n\r\n\tend", "def create_file_set(file_node, file)\n attributes = {\n title: file_node.original_filename,\n file_metadata: [file_node],\n processing_status: \"in process\"\n }.merge(\n file.try(:container_attributes) || {}\n )\n persister.save(resource: FileSet.new(attributes))\n end", "def create_file_set(file_node, file)\n attributes = {\n title: fileset_title(file_node.original_filename.first),\n file_metadata: [file_node],\n processing_status: \"in process\"\n }.merge(\n file.try(:container_attributes) || {}\n )\n file_set = FileSet.new(attributes)\n change_set = ChangeSet.for(file_set)\n change_set_persister.save(change_set: change_set)\n end", "def create_metadata(work, file_set_params = {})\n file_set.apply_depositor_metadata(user)\n now = CurationConcerns::TimeService.time_in_utc\n file_set.date_uploaded = now\n file_set.date_modified = now\n file_set.creator = [user.user_key]\n\n interpret_visibility file_set_params if assign_visibility?(file_set_params)\n attach_file_to_work(work, file_set, file_set_params) if work\n yield(file_set) if block_given?\n end", "def add_commit_to_db(hash)\n #insert hash values into proper attribute in commits table\n @con.exec_prepared('commitInsert', hash.values_at(*@@GIT_LOG_PROPERTIES))\n \n create_commit_filepath(hash[\"filepaths\"], hash[:commit_hash])\n create_commit_bug(hash[:bug], hash[:commit_hash]) if hash[:bug]!=nil\n end", "def commit; end", "def commit; end", "def commit; end", "def create_release_meta_file!(current_commits, new_version)\n release_meta_path = \"#{RELEASE_META_DIR}/#{new_version}.toml\"\n\n # Grab all existing commits\n existing_commits = get_existing_commits!\n\n # Ensure this release does not include duplicate commits. Notice that we\n # check the parsed PR numbers. This is necessary to ensure we do not include\n # cherry-picked commits made available in other releases.\n #\n # For example, if we cherry pick a commit from `master` to the `0.8` branch\n # it will have a different commit sha. Without checking something besides the\n # sha, this commit would also show up in the next release.\n new_commits =\n current_commits.select do |current_commit|\n existing_commits.select do |existing_commit|\n existing_commit.fetch(\"sha\") == current_commit.fetch(\"sha\") ||\n existing_commit.fetch(\"pr_number\") == current_commit.fetch(\"pr_number\")\n end\n end\n if new_commits.any?\n if File.exists?(release_meta_path)\n words =\n <<~EOF\n I found #{new_commits.length} new commits since you last generated:\n\n #{release_meta_path}\n\n So I don't erase any other work in that file, please manually add the\n following commit lines:\n\n #{new_commits.to_toml.indent(4)}\n\n Done? Ready to proceed?\n EOF\n\n if Printer.get(words, [\"y\", \"n\"]) == \"n\"\n Printer.error!(\"Ok, re-run this command when you're ready.\")\n end\n else\n File.open(release_meta_path, 'w+') do |file|\n file.write(\n <<~EOF\n [releases.\"#{new_version}\"]\n date = #{Time.now.utc.to_date.to_toml}\n commits = #{new_commits.to_toml}\n EOF\n )\n end\n\n words =\n <<~EOF\n I've created a release meta file here:\n\n #{release_meta_path}\n\n I recommend reviewing the commits and fixing any mistakes.\n\n Ready to proceed?\n EOF\n\n if Printer.get(words, [\"y\", \"n\"]) == \"n\"\n Printer.error!(\"Ok, re-run this command when you're ready.\")\n end\n end\n end\n\n true\nend", "def file_save file\n\t\tfields \t\t\t\t= {}\n \t\tfields[:uid] \t\t= file_uid\n\t\tfields[:fnum] \t\t= file_num_generate\n\t\tfields[:name] \t\t= file[:filename].split('.').first\n\t\tfields[:created]\t= Time.now\n\t\tfields[:type]\t\t= file[:type]\n \t\tfields[:path] \t\t= \"#{file_uid}-#{fields[:created].to_i}#{_random(3)}\"\n\n\t\t# allow these file type to save\n\t\tunless _var(:file_type).include? file[:type]\n\t\t\t_throw Sl[:'the file type isn`t allowed to save']\n\t\tend\n\n\t\t# allow the scope of file size\n\t\tfile_content = file[:tempfile].read\n\t\tif (fields[:size] = file_content.size) > _var(:file_size).to_i\n\t\t\t_throw Sl[:'the file size is too big']\n\t\tend\n\n\t\t# save the info of file\n\t\tSdb[:file_info].insert(fields)\n\n\t\t# save the body of file\n\t\tpath = Spath[:upload_dir] + fields[:path]\n\t\tSimrb.path_write path, file_content\n\t\t_msg :file_save, Sl['saved file successfully']\n\n# \t\t\tFile.open(Spath[:upload_dir] + fields[:path], 'w+') do | f |\n# \t\t\t\tf.write file_content\n# \t\t\tend\n\n# \n# \t\t# return the value\n# \t\tunless reval == nil\n# \t\t\tSdb[:file_info].filter(fields).get(reval)\n# \t\tend\n\tend", "def write_tag(name, file)\n if $tags.nil?\n $tags = File.new(\"#{$datadir}/commitinfo-tags\", File::WRONLY|File::CREAT|File::APPEND);\n return if $tags.nil?\n end\n $tags.puts(\"#{name}\\t#{file}\")\nend", "def create\n @f = F.new\n original_filename = params['upload'].original_filename \n \n unless File.exists?(software_path)\n Dir.mkdir(software_path)\n end\n \n unless File.exists?(version_path)\n Dir.mkdir(version_path)\n end\n \n filename = version_path + '/' + original_filename\n file_object = File.open(filename, 'wb+') \n file_object.write(params['upload'].read)\n file_object.close\n \n md5sum = Digest::MD5.file(filename).hexdigest\n \n @f.sn = @package.fs.size + 1\n @f.name = original_filename\n @f.content_type = params['upload'].content_type.chomp\n @f.package_id = @package.id\n @f.md5sum = md5sum\n @f.save\n\n redirect_to software_package_fs_path(@software, @package) \n end", "def update_file_metadata(data)\n update_attributes!( :file_size => data.bytesize, :file_hash => Digest::SHA1.hexdigest( data ) )\n end", "def create_from_file\n end", "def set_metadata( file_list, tag_hash)\n file_list = [*file_list] # make sure file_list is an array\n file_list.each do |file_name|\n if File.exist?(file_name) \n ok = TagLib::FileRef.open(file_name) do |f|\n tag = f.tag\n tag_hash.each do |tag_name, value|\n\n # make sure that the tag_nam (hash key) is a string and then add = to it\n if tag_name.class != String\n tag_name = tag_name.to_s\n end\n tag_name += \"=\"\n\n if tag.respond_to?(tag_name)\n tag.send(tag_name, value)\n else\n puts \"can't modify tag #{tag_name}\"\n end\n end\n f.save\n end\n if ok == false then\n puts \"uh-oh. There was a problem saving/opening #{f}, it's tags were not modified.\"\n end\n else\n puts \"file #{file_name} does not exist, so its tags were not updated.\"\n end\n end\n end", "def update_metadata(file)\n metadata = MetadataEngine.new(file)\n\n # Special renaming case for misc files that do not need the tracklist\n if metadata.filepath.get_type == \"misc\"\n metadata.tags.artist = metadata.filepath.artist\n metadata.tags.year = metadata.filepath.year\n metadata.tags.album = metadata.filepath.album\n metadata.tags.cd = metadata.filepath.cd\n metadata.tags.index = metadata.filepath.index\n metadata.tags.title = metadata.filepath.title\n metadata.tags.save\n return\n end\n\n unless metadata.tracklist.has_tracklist?\n puts \"No .tracklist found for #{file}, generating it now.\"\n %x[generate-tracklist #{file.shellescape}]\n metadata = MetadataEngine.new(file)\n end\n\n # Update tags to reflect what's in the tracklist\n metadata.tags.artist = metadata.tracklist.artist\n metadata.tags.year = metadata.tracklist.year\n metadata.tags.album = metadata.tracklist.album\n metadata.tags.cd = metadata.tracklist.cd\n metadata.tags.index = metadata.tracklist.index\n metadata.tags.title = metadata.tracklist.title\n metadata.tags.type = metadata.tracklist.type\n metadata.tags.save\n\n # Update filepath to rename files based on new metadata\n metadata.filepath.artist = metadata.tracklist.artist\n metadata.filepath.year = metadata.tracklist.year\n metadata.filepath.album = metadata.tracklist.album\n metadata.filepath.cd = metadata.tracklist.cd\n metadata.filepath.index = metadata.tracklist.index\n metadata.filepath.title = metadata.tracklist.title\n metadata.filepath.save\n end", "def genfile(filename, args = nil, &block)\r\n realpath = file(filename)\r\n md5key = [MetaMD5, filename]\r\n filekey = [MetaFile, filename]\r\n if @cache.has?(md5key) && \r\n @cache.has?(filekey) &&\r\n FileTest.file?(realpath) && \r\n MD5.filehex(realpath) == @cache[md5key]\r\n elsif @cache.has?(filekey)\r\n _writefile realpath, @cache[filekey]\r\n else\r\n u = yield filekey\r\n @cache.transaction do |db|\r\n db[md5key] = MD5.hexdigest u\r\n db[filekey] = u\r\n _writefile realpath, @cache[filekey]\r\n end\r\n end\r\n realpath\r\n end", "def create\n tmpl = ERB.new(load_erb_file('metadata.erb'))\n @cookbook = @opts[:cookbook]\n @maintainer = @opts[:souschef][:maintainer]\n @maintainer_email = @opts[:souschef][:maintainer_email]\n @license = @opts[:souschef][:license]\n data = tmpl.result(binding)\n\n info 'Updating metadata.rb'\n write_file(cookbook_file_path('metadata.rb'), data)\n end", "def db_insert!( db_file )\n ####db = SQLite3::Database.new( db_file )\n ####db.transaction do |database|\n #### if not database.execute( db_fetch ).empty?\n #### raise(IndexError, \"Entry exists for #{filename}, #{@rmr_number}, #{@timestamp.to_s}... Skipping.\")\n #### end\n #### database.execute( db_insert )\n ####end\n ####db.close\n puts \"SQLite3\"\n end", "def settable_cmd(tablename, content)\n @datafiles[tablename] = DataFile.new\n @datafiles[tablename].insert_cmd(content, 1)\n end", "def create_log_file(npc_parameters, log_file)\n log_file.ensure_exists\n contents = <<~CONTENTS\n === Project information\n\n #{npc_parameters.summary || 'undefined'}\n\n CONTENTS\n new_file_entry = ObservationEntry.new(content: 'File generated by new-project command').render('File created')\n contents += new_file_entry\n write_file(log_file.path, contents)\n print 'created'\n end", "def add1 fn, pid='NULL', fp='';\n #>! make alg. to fill pid/fp from that other value - to have known boths\n st = File .stat fp+'/'+fn\n #>! if exist update then\n sq = \\\n %Q{ INSERT INTO #{$config.local_disk}_files\n (pid,fileName,st_mode,st_nlink,st_uid,st_gid,\n st_size,st_atime,st_mtime,st_ctime,pathCache)\n VALUES\n (#{pid},'#{fn}',#{st.mode},#{st.nlink},#{st.uid},#{st.gid},\n #{st.size},'#{st.atime}','#{st.mtime}','#{st.ctime}','#{fp}'); }\n puts sq\n @db.execute sq\n check1 fn, pid\n end", "def save(upload)\n uploadFile = upload['datafile']\n originalName = uploadFile.original_filename\n self.fileType = File.extname(originalName)\n\n create_or_update()\n\n # write the file\n File.open(self.filePath, \"wb\") { |f| f.write(uploadFile.read) }\n \n # write ID3 metadata to database, to avoid the expense of fetching\n # from the file every time - quite costly as more files are displayed at a time\n begin\n musicFile = TagLib::File.new(self.filePath())\n self.id3Title = musicFile.title\n self.id3Artist = musicFile.artist\n self.id3Length = musicFile.length\n rescue TagLib::BadFile => exc\n logger.error(\"Failed to id track: \\n #{exc}\")\n end\n\n if(self.fileType == '.mp3')\n convertToOGG();\n end\n create_or_update()\n\n end", "def commit_file\n\t\tlogger.info(\"[File Attribute #{sprintf('0x%08x', self.object_id)}] Committing file for #{@obj.class}(#{@obj.id}).#{attribute_name} ...\")\n\t\tif @file\n\t\t\tlogger.info(\"[File Attribute] Saving file #{local_file_name} ...\")\n\t\t\t@file.rewind if @file.respond_to?(:rewind)\n\t\t\tFile.makedirs(File.dirname(local_file_name))\n\t\t\tFile.open(local_file_name, \"w\") do |f|\n\t\t\t\tf.write(@file.read)\n\t\t\tend\n\t\t\tlogger.info(\"[File Attribute] Done.\")\n\t\telse\n\t\t\tlogger.info(\"[File Attribute] Skipping file save of #{@file.inspect}.\")\n\t\tend\n\t\ttrue\n\tend", "def create_file(uid, info = {})\n content_type = Tus::Info.new(info).metadata[\"content_type\"]\n\n create_grid_file(\n filename: uid,\n content_type: content_type,\n )\n end", "def temp\n # Find all files in the system\n allFiles = Devfile.find(:all)\n \n metadatatype = MetadataType.find_by_name(\"backup_recovery_path\")\n if metadatatype == nil\n render :text => \"Metadatatype was not found\", :status => 404\n return\n end\n \n # Go through each file and add metadata to it\n allFiles.each do |x|\n metadatavalue = '/home/user/MyDocs/DCIM/'+x.name\n Metadata.find_or_create_by_metadata_type_id_and_devfile_id(:metadata_type_id => metadatatype.id,\n :value => metadatavalue,\n :devfile_id => x.id) \n end\n \n render :text => \"Metadata added to all files in the system\", :status => 201\n return\n end", "def add_file_metadata\n file_data = {}\n file_data[:filename] = File.basename(options[:original_filename])\n file_data[:file_size] = File.size(options[:original_filename])\n file_data[:record_delimiter] = options[:delimiter]\n file_data[:rows] = options[:rows]\n file_data[:columns] = options[:csv_column_datatypes].keys.size\n file_data[:processed_filename] = File.basename(options[:filename])\n file_data[:processed_file_path] = options[:filename]\n file_data[:processed_file_size] = File.size(options[:filename])\n file_data[:error_report] = options[:temp_file]\n return file_data\n end", "def write_file (title, author, creator, producer, currentfile, outputfile = currentfile)\n\tif outputfile == nil\n\t\treturn false\n\tend\n\tf = Tempfile.new('pdfmetaedit')\n\tf.puts \"InfoKey: Title\"\n\tf.puts \"InfoValue: #{title}\"\n\tf.puts \"InfoKey: Author\"\n\tf.puts \"InfoValue: #{author}\"\n\tf.puts \"InfoKey: Creator\"\n\tf.puts \"InfoValue: #{creator}\"\n\tf.puts \"InfoKey: Producer\"\n\tf.puts \"InfoValue: #{producer}\"\n\tf.close\n\twillend = false\n\tupdateinfo\t= \"pdftk '#{currentfile}' update_info '#{f.path}' output '#{f.path}.pdf'\"\n\tcreateidir\t= \"pdftk '#{currentfile}' cat output '#{f.path}.pdf'\"\n\tmv\t\t\t= \"mv '#{f.path}.pdf' '#{outputfile}'\"\n\tsystem(updateinfo+\" || (\"+createidir+\" && \"+mv+\" && \"+updateinfo+\") && \"+mv)\n\tif $?.exitstatus == 0\n\t\tdialog = Gtk::MessageDialog.new(@window, \n\t\t\t\t\t\t\t\t\t\tGtk::Dialog::MODAL,\n\t\t\t\t\t\t\t\t\t\tGtk::MessageDialog::INFO,\n\t\t\t\t\t\t\t\t\t\tGtk::MessageDialog::BUTTONS_YES_NO,\n\t\t\t\t\t\t\t\t_(\"Metadata written successfully\") )\n\t\tdialog.title = _(\"Success\")\n\t\tdialog.secondary_text = _(\"Continue editing the source file?\")\n\t\tdialog.run do |response|\n\t\t\tif response == Gtk::Dialog::RESPONSE_NO\n\t\t\t\twillend = true\n\t\t\tend\n\t\t\tdialog.destroy\n\t\tend\n\telse\n\t\terror_window(_(\"Well, it seems something went wrong.\"))\n\tend\n\treturn willend\nend", "def update_file(settings)\n file_path = self.full_path(settings)\n TagLib::MPEG::File.open(file_path) do |file|\n file.tag.artist = self.artist.name\n file.tag.album = self.album.name\n file.tag.year = self.album.year ? self.album.year : 0\n file.tag.genre = self.genre\n file.tag.title = self.name\n file.save\n end\n end", "def add_attributes(source,attribute,data_type)\n file = File.open(source, \"r+\")\n file.each do |line|\n while line == \" create_table :#{@scaffold_name}s do |t|\\n\" do\n pos = file.pos\n rest = file.read\n file.seek pos\n file.write(\" t.#{data_type} :#{attribute}\\n\") \n file.write(rest)\n break\n end\n end\n end", "def create_document(file, file_type, object, comment, file_name=nil)\n if object.invoice_no.include?('/')\n file_obj=object.invoice_no.gsub('/','')\n else\n file_obj=object.invoice_no\n end\n filename = (file_name ? \"#{file_name}.#{file_type}\" : nil ) || \"InvoiceNo_#{file_obj}_#{Time.zone.now.to_i}_New.#{file_type}\"\n\n newfile=File.open(\"#{filename}\", \"w\") {|f| f.write(file) }\n\n root_file=File.open(\"#{RAILS_ROOT}/#{filename}\",'r')\n document={:name => \"Test\" ,:data=> root_file}\n document_home = {:document_attributes => document}\n document_home.merge!(:access_rights => 2, :created_by_user_id=>object.created_by_user_id,:company_id=>object.company_id,\n :mapable_id=>comment.id,:mapable_type=>'Comment', :owner_user_id=>object.owner_user_id)\n newdocument_home = comment.document_homes.new(document_home)\n newdocument = newdocument_home.documents.build(document.merge(:company_id=>object.company_id, :created_by_user_id=>object.created_by_user_id))\n newdocument_home.save\n if newdocument_home.save\n root_file.close\n File.delete(\"#{RAILS_ROOT}/#{filename}\")\n end\n end", "def create(revision=0, content_io=nil)\n # initialize datafile with compressed file @fname\n if content_io.nil?\n compress_file_lines = Deflate.deflate(File.read(@fname))\n else\n compress_file_lines = Deflate.deflate(content_io.read)\n end\n File.open(@datafile, \"w\") do |f|\n f.puts compress_file_lines\n end\n\n # initialize indexfile\n File.open(@indexfile, \"w\") do |f|\n index_write_row f, \"rev\", \"offset\", \"length\"\n index_write_row f, revision.to_s, \"0\", line_count_to_s(@datafile)\n end\n end", "def new_files; end", "def on_file_metadata_updated(event)\n return unless resource? event[:metadata]\n Hyrax.index_adapter.save(resource: event[:metadata])\n end", "def create\n data =params[:data]\n\n resource = ActiveSupport::JSON.decode(data)\n @repo = Repository.find(resource[\"repo_id\"])\n dir_path = resource[\"dirPath\"];\n post = DataFile.save(params['file'], @repo.path+dir_path)\n\n\t\t@git = GitHelper.init(@repo.path, current_user.email, current_user.name)\n\t\tGitHelper.commitAll(@git, resource[\"comment\"])\n\n\t\trender json: {success: \"file uploaded\"}\n end", "def add_metadata\n return if @metadata.nil?\n\n @tar_writer.add_file \"metadata.gz\", 0644 do |io|\n begin\n sio = @signer ? StringIO.new : nil\n gzos = Zlib::GzipWriter.new(sio || io)\n gzos.write @metadata\n ensure\n gzos.flush\n gzos.finish\n\n # if we have a signing key, then sign the metadata digest and return\n # the signature\n if @signer then\n digest = Gem::Security::OPT[:dgst_algo].digest sio.string\n @meta_signature = @signer.sign digest\n io.write sio.string\n end\n end\n end\n end", "def create_photo(album_id, photo_id, file, filename)\n \n end", "def create_locally\n write_file(@description, @news_name)\n write_file(@poster_file, @poster_name)\n end", "def create_file\n project = UserFile.publication_project!(current_user, @scope)\n\n api = DIContainer.resolve(\"api.user\")\n file_dxid = api.file_new(params[:name], project)[\"id\"]\n\n file = UserFile.create!(\n dxid: file_dxid,\n project: project,\n name: params[:name],\n state: \"open\",\n description: params[:description],\n user: current_user,\n parent: current_user,\n scope: @scope,\n UserFile.scope_column_name(@scope) => @folder&.id,\n )\n\n render json: { id: file.uid }\n end", "def base_file_create\n course = notey_notey_params['course']\n file = notey_notey_params['file']\n data = notey_notey_params['data']\n\n uri = \"/notebooks/#{course}_#{file}\"\n File.open(uri, 'wb') do |f|\n f.write(data)\n end\n render json: { result: true }\n end", "def commit args = {}\n action = :deleted if self.deleted?\n action ||= self.is_new? ? :added : (self.is_changed? ? :updated : :nothing_to_commit) \n args[:skip_part_data] ||= false\n \n unless action.eql?(:nothing_to_commit)\n message = \"#{action} #{name}\"\n message = args[:m] if args[:m] \n if action.eql?(:deleted)\n repo.remove(self.file_name)\n self.history_count += 1\n else\n repo.add(self.file_name)\n end\n\n active_message = self.commit_messages[:most_recent]\n message = \"#{active_message.gsub(message,\"\")}\" unless self.deleted? || active_message.blank? || active_message.eql?(message)\n self.remove_message_from_temp_store(:most_recent) unless active_message.blank?\n \n repo.commit(message)\n self.last_commit = repo.log(self.local_path, :limit => 1).first.to_s\n end\n unless action.eql?(:deleted) \n self.part_count = parts.count\n self.part_count ||= 0 \n update_part_data unless args[:skip_part_data]\n\n self.history_count = self.history.size\n self.history_count = 1 if self.history_count.eql?(0) \n end\n self.save if self.changed?\n \n synchronize unless args[:dont_sync] || self.attributes[\"sync\"].blank? #rather than calling sync.blank? to skip the JSON parsing step.\n return action\n end", "def initialize(file)\n\t\t#Initializes superclass -- creates database.\n\t\tsuper\n\t\t#Creates tables if they not exist\n\t\tTABLES.each do |table|\n\t\t\tsql = \"CREATE TABLE IF NOT EXISTS #{table.header} (\"\n\t\t\ttable.columns.each {|column| sql += \"#{column.header} \" +\n\t\t\t\t\"#{column.type_constraint}, \"}\n\t\t\tsql = table.constraint.nil? ?\n\t\t\t\t\"#{sql.slice(0, sql.length - 2)})\" :\n\t\t\t\t\"#{sql}#{table.constraint})\"\n\t\t\tself.transaction {|tdb| tdb.execute(sql)}\n\t\tend\n\tend", "def test_add_existing_file\n @gitit.add('hello.txt', 'Hello, dsyph3r')\n @gitit.commit('modifying hello world')\n\n file = @gitit.get_file('hello.txt')\n\n assert_not_nil(file)\n\n assert_equal('Hello, dsyph3r', file['data'], 'File data is incorrect')\n end", "def file_sent( proposal, filename )\n table_name, file_field, err_field, time_field = table_and_attribute_names\n unless table_name.blank? || file_field.blank? || err_field.blank?\n time_upd = time_field.blank? ? '' : \", #{time_field} = '#{Time.now}'\"\n upd = \"UPDATE #{table_name} SET #{file_field} = '#{filename}', #{err_field} = NULL#{time_upd} WHERE id = #{proposal.record_id}\"\n ActiveRecord::Base.connection.execute(upd)\n end\n end", "def create_films_table\n @db.execute(\"DROP TABLE Films\")\n @db.execute(<<EOF\nCREATE TABLE films (\n title VARCHAR(200),\n date DATETIME,\n channel VARCHAR(200),\n start_time TIME,\n end_time TIME,\n year NUMBER,\n description TEXT,\n duration NUMBER,\n PRIMARY KEY(title, date, channel)\n);\nEOF\n )\nend", "def persist\n if current_file.new_record?\n file_set.save\n else\n current_file.save\n end\n end", "def write_food_group_table()\n puts <<SQL\ndrop table if exists FOOD_GROUP;\ncreate table FOOD_GROUP(\n id char(5) not null,\n description varchar(60) not null,\n primary key(id)\n);\nSQL\n\n read_data('FD_GROUP.txt') do |fields|\n puts make_insert_statement('FOOD_GROUP', fields, 'id', 'description')\n end\nend", "def event_file_create_command(id, index, event_src)\n saver.file_create_command(event_filename(id, index), event_src)\n end", "def create_file (file_path)\n \"touch '#{file_path}'\"\n end", "def create_checksums\n # puts \"Ins: #{@basename}\"\n md5 = Digest::MD5.file(@fullname).to_s\n sha1 = Digest::SHA1.file(@fullname).to_s\n sha256 = Digest::SHA2.new(256).file(@fullname).to_s\n @pkgdb.query(\"insert into checksums values ( datetime('now'), '#{@basename}', '#{@suitename}', '#{@mtime.iso8601}', '#{md5}', '#{sha1}', '#{sha256}' )\")\n end", "def db_insert(image_dataset_id)\n ####\"INSERT INTO raw_image_files\n ####(filename, header_reader, file_type, timestamp, source, rmr_number, series_description, \n ####gender, num_slices, slice_thickness, slice_spacing, reconstruction_diameter, \n ####acquisition_matrix_x, acquisition_matrix_y, rep_time, bold_reps, created_at, updated_at, image_dataset_id)\n ####VALUES ('#{@filename}', '#{@hdr_reader}', '#{@file_type}', '#{@timestamp.to_s}', '#{@source}', '#{@rmr_number}', \n ####'#{@series_description}', '#{@gender}', #{@num_slices}, #{@slice_thickness}, #{@slice_spacing}, \n #### #{@reconstruction_diameter}, #{@acquisition_matrix_x}, #{@acquisition_matrix_y}, #{@rep_time}, \n #### #{@bold_reps}, '#{DateTime.now}', '#{DateTime.now}', #{image_dataset_id})\" \n puts \"Old no raw_image_files table\"\n end", "def post_file(filename,repo)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\",{\"operation\"=> \"create\"}).body_str\n end", "def event_file_create_command(id, index, event_src)\n disk.file_create_command(event_filename(id, index), event_src)\n end", "def add(file)\n # add file to object db\n return false if !File.exists?(file)\n return false if !File.file?(file)\n \n sha = get_raw_repo.put_raw_object(File.read(file), 'blob')\n \n # add it to the index\n @git_index.add(file, sha)\n end", "def register_file_info(object, file = T.unsafe(nil), line = T.unsafe(nil), comments = T.unsafe(nil)); end", "def create type\n return if type == :records ## no records for this\n @db.connect do\n\n sql = SqlGenerator.for_files(@table_files) \n @db.query(sql)\n Logger.<<(__FILE__,\"INFO\",\"Setup files table for #{@source.name}\")\n\n end\n end", "def create\n enforce_permissions!('edit', params[:object_id])\n\n file_upload = upload_from_params\n @object = retrieve_object! params[:object_id]\n if @object.nil?\n flash[:notice] = t('dri.flash.notice.specify_object_id')\n return redirect_to controller: 'catalog', action: 'show', id: params[:object_id]\n end\n preservation = params[:preservation].presence == 'true' ? true : false\n @generic_file = build_generic_file(object: @object, user: current_user, preservation: preservation)\n\n file_content = GenericFileContent.new(user: current_user, object: @object, generic_file: @generic_file)\n begin\n @object.increment_version\n\n if file_content.add_content(file_upload)\n flash[:notice] = t('dri.flash.notice.file_uploaded')\n record_version_committer(@object, current_user)\n file_content.characterize if file_content.has_content?\n else\n message = @generic_file.errors.full_messages.join(', ')\n flash[:alert] = t('dri.flash.alert.error_saving_file', error: message)\n @warnings = t('dri.flash.alert.error_saving_file', error: message)\n logger.error \"Error saving file: #{message}\"\n end\n rescue DRI::Exceptions::MoabError => e\n flash[:alert] = t('dri.flash.alert.error_saving_file', error: e.message)\n @warnings = t('dri.flash.alert.error_saving_file', error: e.message)\n logger.error \"Error saving file: #{e.message}\"\n end\n\n respond_to do |format|\n format.html { redirect_to controller: 'my_collections', action: 'show', id: params[:object_id] }\n format.json do\n response = { checksum: file_content.checksum }\n response[:warnings] = @warnings if @warnings\n\n render json: response, status: :created\n end\n end\n end", "def save_file \n Grit.debug = true\n contents = params[:contents]\n message = params[:commit_message]\n @node = Node.new(:name => params[:name], :git_repo_id => params[:git_repo_id], :git_repo_path => params[:git_repo_path])\n save_file_to_disk(contents, @node.abspath)\n stage_and_commit_file(@node.repo_base_path, @node.git_repo_path, message)\n flash[:notice] = \"Created New Version\"\n render :action => :file\n end", "def create_with_datafile\n unless params.require(:datafile).permit(:utf8, :authenticity_token, :title, :file, :'@tempfile', :'@original_filename', :'@content_type', :'@headers')\n flash[:error] = 'No data file given for upload'\n redirect_back(fallback_location: root_url) && return\n end\n\n datafile = Datafile.new(params.require(:datafile).permit(:utf8, :authenticity_token, :title, :file, :'@tempfile', :'@original_filename', :'@content_type', :'@headers'))\n unless datafile.save\n flash[:error] = datafile.errors.full_messages.to_sentence\n redirect_back(fallback_location: root_url) && return\n end\n\n attributes = datafile.general_metadata_hash\n attributes[:title] = params.slice(:title)[:title].to_s.squish if params[:title]\n\n @dataset = Dataset.new(attributes)\n if @dataset.save\n @dataset.add_datafile(datafile)\n @dataset.load_projects_and_authors_from_current_datafile\n current_user.has_role! :owner, @dataset\n @unfound_usernames = datafile.authors_list[:unfound_usernames]\n render action: :create\n else\n datafile.destroy\n flash[:error] = @dataset.errors.full_messages.to_sentence\n redirect_back(fallback_location: root_url)\n end\n end", "def metadata(filepath)\n metadata = {}\n metadata.merge!(author(filepath))\n metadata.merge!(title(filepath))\n metadata.merge!(serie(filepath))\n metadata\n end", "def add_file(file, line = T.unsafe(nil), has_comments = T.unsafe(nil)); end", "def update_pg(db, filename)\n\n v_filename = filename\n\n begin\n db.prepare('q_statement',\n \"insert into imageuploader (photo) values ($1)\") # bind parameters\n db.exec_prepared('q_statement', [v_filename])\n db.exec(\"deallocate q_statement\")\n rescue PG::Error => e\n puts 'Exception occurred'\n puts e.message\n ensure\n db.close if db\n end\n\n end", "def save\n ensure_file_open!\n @file.commit\n true\n end", "def create\n file = params[:file_store][:file]\n file_store = FileStore.new\n file_store.sha1_hash = Digest::SHA1.file(file.path).hexdigest\n file_store.file = file\n file_store.user_id, file_store.user_uname = user['id'], user['uname']\n\n if file_store.save\n File.delete file.path\n render json: { sha1_hash: file_store.sha1_hash }, status: :created\n else\n render json: file_store.errors, status: :unprocessable_entity\n end\n end", "def characterize(save: true)\n new_file = original_file.new(file_characterization_attributes.to_h)\n @file_node.file_metadata = @file_node.file_metadata.select { |x| x.id != new_file.id } + [new_file]\n @persister.save(resource: @file_node) if save\n @file_node\n end", "def create_data_file(info, filename: nil)\n content_type = info[:content_type] || DEFAULT_CONTENT_TYPE\n content = info[:base64] ? Base64.decode64(info[:data]) : CGI.unescape(info[:data])\n\n data_file = Shrine::DataFile.new(content, content_type: content_type, filename: filename)\n info[:data].clear\n\n data_file\n end", "def write_food_description_table()\n puts <<SQL\ndrop table if exists FOOD_DESCRIPTION;\ncreate table FOOD_DESCRIPTION(\n id char(5) not null,\n food_group_id char(4) not null,\n description varchar(200) not null,\n short_description varchar(60) not null,\n common_name varchar(100) default null,\n manufacturer_name varchar(65) default null,\n survey_code char(1) default null,\n refuse_description varchar(135) default null,\n refuse_percentage int default null,\n scientific_name varchar(65) default null,\n nitrogen_factor float default null,\n protein_factor float default null,\n fat_factor float default null,\n carbohydrate_factor float default null,\n primary key (id)\n);\nSQL\n\n read_data('FOOD_DES.txt') do |fields|\n puts make_insert_statement('FOOD_DESCRIPTION', fields,\n 'id', 'food_group_id', 'description',\n 'short_description', 'common_name',\n 'manufacturer_name', 'survey_code',\n 'refuse_description', 'refuse_percentage',\n 'scientific_name', 'nitrogen_factor',\n 'protein_factor', 'fat_factor',\n 'carbohydrate_factor')\n end\nend", "def create(filename, repository, stored, copies, public_flag)\n path, file_meta, checksum = stored\n @asset_model.create! asset_id: asset_id(path),\n identifier: path,\n public: public_flag,\n filename: filename,\n media_type: media_type(file_meta, path),\n md5sum: checksum,\n repository: repository,\n file_metadata_sets: file_meta,\n copies: copies\n end", "def create \n epub = params[:file]\n logger.debug(epub.inspect)\n new_book = Book.new()\n new_book.epub = epub\n new_book.user_id = current_user.id\n new_book.import_metadata\n\n if new_book.title.blank? && new_book.epub\n new_book.title = File.basename(new_book.epub.url, '.epub')\n end\n \n new_book.save\n\n respond_to do |format| \n format.html { render :nothing => true }\n format.xml { render :xml => books_url, :status => :created, :location => books_url }\n end\n end", "def create_local_commit author: nil, branch:, file_name:, file_content:, message:, push: false\n on_branch(branch) do\n if (folder_name = File.dirname file_name) != '.'\n Dir.mkdir folder_name\n end\n File.write file_name, file_content\n run \"git add '#{file_name}'\"\n run \"git commit -m '#{message}' #{\"--author='#{author}'\" if author}\"\n run 'git push' if push\n end\nend", "def create(filename)\n time = Time.now\n @files[filename] = time\n puts \"#{filename} was created by #{@username} at #{time}.\"\n end", "def create_data_file(resource_id)\n filename = Faker::File.file_name(dir: '', directory_separator: '')\n StashEngine::DataFile.create(\n {\n original_filename: filename,\n upload_file_name: filename,\n resource_id: resource_id,\n upload_content_type: 'text/plain',\n upload_file_size: 31_726,\n status_code: 200,\n file_state: 'created'\n }\n )\n end", "def create_metadata\n File.open(File.join(@env[\"export.temp_dir\"], \"metadata.json\"), \"w\") do |f|\n f.write(JSON.generate({\n provider: \"hyperv\"\n }))\n end\n end", "def add_file(*args)\n context = args.pop\n file_path_hash_or_string, content, commit_msg = args\n file_path_hash = file_path_hash_form(file_path_hash_or_string)\n get_adapter_repo(context).add_file(file_path_hash, content, commit_msg)\n end", "def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc:\n# sql = \"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\"\n# devfiles_of_prev_commit = ActiveRecord::Base.connection.execute(sql)\n#\n devfiles_of_prev_commit = Devfile.find_by_sql(\"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\")\n if devfiles_of_prev_commit.size > 0\n ActiveRecord::Base.connection.execute(\"begin\")\n now = DateTime.now\n devfiles_of_prev_commit.each do |df|\n if not changed_files.has_key?(df.path + df.name)\n begin\n sql = \"insert into blobs_in_commits(blob_id, commit_id, created_at, updated_at) values('#{df['blob_id']}', '#{commit.id}', '#{now}', '#{now}');\"\n ActiveRecord::Base.connection.execute(sql)\n rescue\n # do nothing\n end\n end\n end\n ActiveRecord::Base.connection.execute(\"commit\")\n end\n end", "def create(filename)\n time = Time.now\n @files[filename] = time # Updates the \"files\" hash with the timestamp for when the file was created\n puts \"The file #{filename} was created at #{time}\"\n end", "def add_file(fname, fdata=nil, xtra=nil, comment=nil)\n super(randomize(fname), randomize(fdata), xtra, comment)\n end", "def file_content(action)\n options = {\n source: @base_file,\n language: @language,\n file_type: @file_type\n }\n if action == \"update\"\n options[:target] = get_file\n @new_file = FileContent.new(options).update_file \n else\n @new_file = FileContent.new(options).generate_file\n end\n end", "def update_db\n\n db = Sequel.sqlite(dbfilename)\n @db_update_data.each do |key,value|\n md5sum = {:md5sum => key}\n file_tupel = md5sum.merge(value)\n db[:pdfmd_documents].insert_conflict(:replace).insert(file_tupel)\n end\n\n end", "def initialize(file_name)\n create(file_name)\n end", "def add_to_file entry, content\n path = repo_path.join entry\n File.write path, content, :mode => \"a\"\n end", "def write_file(metadata)\n return unless metadata.respond_to?(:has_key?)\n File.open(create_full_path(@file_name_prefix), \"w\", DEFAULT_FILE_MODE) do |f|\n f.print(metadata.to_json)\n end\n end" ]
[ "0.6870998", "0.6798961", "0.65737253", "0.6544489", "0.64065665", "0.64065665", "0.6313486", "0.63081837", "0.6294408", "0.6251297", "0.61757946", "0.61673397", "0.6143448", "0.6133419", "0.60675824", "0.6066988", "0.60098356", "0.6008737", "0.59878284", "0.59601647", "0.5937347", "0.59098953", "0.5861899", "0.58561563", "0.58561563", "0.58561563", "0.5844136", "0.58261824", "0.5825005", "0.57870156", "0.57792157", "0.5772126", "0.5771854", "0.57667243", "0.574953", "0.5681858", "0.56753826", "0.5652556", "0.5621565", "0.55948615", "0.55932945", "0.5589311", "0.55891377", "0.5575517", "0.5566028", "0.5565135", "0.5560148", "0.5556985", "0.55567527", "0.55416465", "0.5527284", "0.55191517", "0.55161196", "0.55157274", "0.55061084", "0.54983705", "0.54921305", "0.5484267", "0.5471114", "0.54677856", "0.5461713", "0.54606515", "0.5458019", "0.54527223", "0.54447234", "0.5443476", "0.5441646", "0.5438005", "0.5432119", "0.5430233", "0.5420443", "0.5395455", "0.53816", "0.5381226", "0.5379698", "0.5379291", "0.53762424", "0.5376153", "0.5374634", "0.5373694", "0.5370997", "0.536532", "0.53590065", "0.5355673", "0.5352458", "0.53436345", "0.5341141", "0.53209406", "0.53181577", "0.52956575", "0.5293259", "0.5284466", "0.5283407", "0.52780735", "0.52744144", "0.527256", "0.5269278", "0.5265787", "0.5264448", "0.52629715" ]
0.6989372
0
add blobs from prev_commit to commit ignoring blobs in changed_files parameters: prev_commit The previous commit commit new commit changed_files list of files to ignore
def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc: # sql = "select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};" # devfiles_of_prev_commit = ActiveRecord::Base.connection.execute(sql) # devfiles_of_prev_commit = Devfile.find_by_sql("select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};") if devfiles_of_prev_commit.size > 0 ActiveRecord::Base.connection.execute("begin") now = DateTime.now devfiles_of_prev_commit.each do |df| if not changed_files.has_key?(df.path + df.name) begin sql = "insert into blobs_in_commits(blob_id, commit_id, created_at, updated_at) values('#{df['blob_id']}', '#{commit.id}', '#{now}', '#{now}');" ActiveRecord::Base.connection.execute(sql) rescue # do nothing end end end ActiveRecord::Base.connection.execute("commit") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n filter_modified_files(@modified_files)\n end\n end", "def add_files(file_path__content_array, opts = {})\n if any_changes = RepoManager.add_files(@repo_manger_context, file_path__content_array, no_commit: opts[:no_commit], commit_msg: opts[:commit_msg])\n RepoManager.push_changes(@repo_manger_context) unless opts[:donot_push_changes]\n end\n any_changes\n end", "def push_files(files, commit_msg, prefix)\n ui.info(\"Applying your repository changes\")\n commit_prefix = \"#{prefix}:\"\n first_add = true\n files.each do |file|\n file_path = File.expand_path(file)\n if prefix == \"db\"\n file_name = file_path.split('/').last(3).join('/')\n else\n file_name = file_path.split('/').last(2).join('/')\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n if(!first_add)\n commit_prefix += \",\"\n end\n first_add = false\n commit_prefix += file_name.split('/').last\n ui.info(\"- #{file_name}\")\n git.add(\"#{file_name}\")\n end\n end\n Dir.chdir(Chef::Config[:git_repo]) do\n push(commit_prefix, commit_msg)\n end\n end", "def getChangesOfCommit(commit_id = false)\n my_commit = ((commit_id == false and @repo.commits.size > 0) ? @repo.commits.first : @repo.commit(commit_id))\n if my_commit == nil\n return false\n end\n \n # get list of changed files and parse it\n @filelist = Hash.new\n options = {:r => true, :name_status => true, :no_commit_id => true}\n if @repo.commit(my_commit.sha).parents[0] == nil # if my_commit is the first commit\n options[:root] = true\n end\n changed_files_list = @git.diff_tree(options, my_commit.id).strip\n if changed_files_list.class == String and changed_files_list.length > 0\n changed_files_list.split(\"\\n\").each do |f|\n commit = my_commit\n operation = f[0,1] # D/M/A\n filepath = f[2..-1] # path+filename\n path = \"/\" + filepath.match(/^.+\\//).to_s # just path\n status = \"created\"\n if operation =~ /^D$/i # deleted\n # the file was deleted, so get the blob from the parent-commit\n commit = @repo.commit(my_commit.parents[0].sha)\n status = \"deleted\"\n elsif operation =~ /^M$/i # modified\n status = \"updated\"\n end\n blob = commit.tree/(filepath)\n\n #name = filepath.gsub(path[1..-1], '') #blob.name\n path = path.gsub(/\\/private\\/[0-9]+\\//,'')\n \n \n \n @filelist[\"/\" + filepath] = {\"uploaded\" => '1', \"status\" => status, \"blob_hash\" => blob.id, \"name\" => blob.name, \"path\" => \"/#{path}\", \"size\" => blob.size, \"filetype\" => blob.mime_type, \"filedate\" => @repo.commit(commit.sha).date.strftime('%T %F').to_s}\n \n \n end\n end\n\n if @filelist.size > 0\n return @filelist\n else\n return false\n end\n end", "def git_add_all_files\n files = `git ls-files`.split(\"\\n\").collect {|f| \"'#{f}'\"}\n index = 0\n while index < files.size\n block_size = 100\n to_process = files[index, block_size]\n index += block_size\n mysystem(\"git add --all --force #{to_process.join(' ')} 2> /dev/null > /dev/null\")\n end\n end", "def altered_files; `git show --name-only #{node} 2> /dev/null`.split(\"\\n\"); end", "def uncommitted_files\n files = nil\n p4 (['change','-o']).each do |line|\n files << line.strip if files\n files = [] if line.start_with?('Files:')\n end\n files ||= []\n end", "def altered_files; raw_changeset.files; end", "def get_committed_files\n # set the current branch name to be the current branch you're on --> need to check that this works as part of push\n curr_branch_name = `git rev-parse --abbrev-ref HEAD`\n\n # raw_sha_list lists all the local, unpushed commit SHAs from your current branch\n raw_sha_list = `git log --graph --pretty=format:'%H' #{curr_branch_name}`\n\n committed_files = []\n # loop through the raw_sha_list and push properly formatted SHAs into the all_shas arr\n raw_sha_list.each_line { |sha|\n # using the .tr method on the sha makes a copy of the sha and replaces instances that matches with the to_str (second arg),\n # unless the range starts with a ^ carrot, in which case, it replaces on matches outside the range\n curr_sha = sha.tr('^A-Za-z0-9', '')\n\n # this `git diff-tree --no-commit-id --name-only -r <SHA>` will list the files of an individual commit when you add the SHA\n # on each iteration, set the changed_files variable to be the list of files from a particular commit, based its SHA\n changed_files = `git diff-tree --no-commit-id --name-only -r #{curr_sha}`\n\n # loop over the changed_files and add in each file that's part of a commit and add into the committed_files arr\n changed_files.each_line { |file|\n # remove any trailing whitespace from the file name and add into our arr\n committed_files << file.rstrip()\n }\n }\n # return the final, no-repeat array of committed files in this push\n return committed_files.uniq\nend", "def modified_files\n staged = squash?\n refs = 'HEAD^ HEAD' if merge_commit?\n @modified_files ||= Overcommit::GitRepo.modified_files(staged: staged, refs: refs)\n end", "def commit_files(author: nil, message: nil, parent: nil, files: {})\n # check parameters\n raise \"no author given\" if author.nil?\n raise \"no message given\" if message.nil?\n\n # get parent commit\n if not parent.nil?\n parent = @wiki.commit_for(parent)\n elsif parent.nil? and not @wiki.repo.head.commit.nil?\n parent = @wiki.commit_for(@wiki.repo.head.commit.id)\n end\n\n unless parent.nil?\n log_debug \" checkpoint (parent #{parent})\"\n if parent.id != @wiki.repo.head.commit.id\n log_debug \" (parent #{parent} is not head)\"\n\n # now check version of each file individually, if it has been\n # changed in one of the changes since parent.\n #\n # if so, raise error, else proceed\n\n files.each do |path,contents|\n next if @wiki.repo.log(nil, path, {:since => parent.authored_date}).empty?\n log_debug \" file has changed\"\n raise \"repo has changed\"\n end\n end\n end\n\n options = {\n :message => message,\n :author => author,\n }\n unless parent.nil?\n options[:parent] = parent\n end\n\n committer = Gollum::Committer.new(@wiki, options)\n\n files.each do |path,contents|\n path = path.dup.gsub(/^\\.\\//, '')\n if contents.nil?\n committer.index.delete(path)\n else\n committer.index.add(path, normalize(contents))\n end\n # if wikifile_exists? path, parent\n # log_debug \" U path: #{path}, contents: #{normalize(contents)}\"\n # committer.index.add(path.dup, normalize(contents))\n # else\n # log_debug \" A path: #{path}, contents: #{normalize(contents)}\"\n # dir, name, format = split_path path\n # committer.add_to_index(dir, name, format, contents)\n # end\n end\n\n committer.after_commit do |index, sha|\n log_debug \" after_commit: #{index}, #{sha}\"\n @wiki.clear_cache\n\n files.each do |path,contents|\n path = path.gsub(/^\\.\\//, '')\n #dir, name, format = split_path path\n unless @wiki.repo.bare\n Dir.chdir(::File.join(@wiki.repo.path, \"..\")) do\n if contents.nil?\n @wiki.repo.git.rm(path, :force => true)\n else\n @wiki.repo.git.checkout(path, 'HEAD')\n end\n end\n end\n end\n\n @wiki_manager.add_to_index(@wiki, index, sha, files)\n end\n\n sha = committer.commit\n log_debug \"sha #{sha}\"\n end", "def previously_changed_files\n `git show --pretty=\"format:\" --name-only`.split(\"\\n\")\n end", "def files_commits(num_commits)\n @repo = Grit::Repo.new(@directory)\n related_files = []\n commits_all(num_commits) do |commits|\n commits.each do |commit|\n paths = []\n begin\n commit.diffs.each do |diff|\n if diff.a_path != diff.b_path\n related_files += [[diff.a_path, diff.b_path]]\n end\n paths += [diff.a_path, diff.b_path]\n end\n rescue Grit::Git::GitTimeout\n puts \"Failed to diff for %s\" % commit.sha\n end\n paths.uniq!\n yield commit, paths, related_files\n end\n end\n end", "def target_files\n @target_files ||= git.modified_files + git.added_files\n end", "def stage_files(*files)\n command = \"git add --all #{files.join(' ')}\"\n command_success?(command)\n end", "def target_files\n @target_files ||= (git.modified_files - git.deleted_files) + git.added_files\n end", "def prev_commit\n init_commits\n @prev_commit\n end", "def file_changed(start_commit, end_commit, filepath)\n command = \"git diff --name-only '#{start_commit}..#{end_commit}' -- #{filepath}\"\n changed_file = `#{command}`.strip\n return !changed_file.empty?\n end", "def committed_files sha\n array_output_of \"git diff-tree --no-commit-id --name-only -r #{sha}\"\nend", "def commit_blob_change_to_repo_for_user(repo, user, branch, old_oid, files, message)\n return false unless repo.ready_for_writes?\n\n ref = repo.heads.find_or_build(branch)\n\n # use the branch's target_oid, or fall back on the supplied old_oid.\n # both can be nil for an absolutely new file in a new repo.\n parent_oid = ref.target_oid || old_oid\n\n author_email = params[:author_email]\n commit = repo.create_commit(parent_oid,\n message: message,\n author: current_comment.user,\n files: files,\n author_email: author_email,\n committer: user\n )\n\n return false unless commit\n\n if author_email\n if user.primary_user_email.email != author_email\n GitHub.dogstats.increment(\"commit.custom_commit_email\", tags: [\"email:custom\"])\n else\n GitHub.dogstats.increment(\"commit.custom_commit_email\", tags: [\"email:primary\"])\n end\n end\n\n before_oid = ref.target_oid\n ref.update(commit, user, reflog_data: request_reflog_data(\"blob edit\"))\n PullRequest.after_repository_push(\n repo,\n ref.qualified_name,\n user,\n before: before_oid,\n after: commit.oid\n )\n ref.enqueue_push_job(before_oid, commit.oid, user)\n ref.enqueue_token_scan_job(before_oid, commit.oid)\n ref.name\n rescue Git::Ref::HookFailed => e\n @hook_out = e.message\n false\n rescue Git::Ref::ProtectedBranchUpdateError => e\n @hook_out = \"#{ref.name} branch is protected\"\n false\n rescue Git::Ref::ComparisonMismatch, GitRPC::Failure\n false\n rescue Git::Ref::InvalidName, Git::Ref::UpdateFailed\n false\n rescue GitHub::DGit::UnroutedError, GitHub::DGit::InsufficientQuorumError, GitHub::DGit::ThreepcFailedToLock\n false\n end", "def files_changed_as_set(files)\n changed_files = files.select { |file| git.modified_files.include? file }\n not_changed_files = files.select { |file| !changed_files.include? file }\n all_files_changed = not_changed_files.empty?\n no_files_changed = changed_files.empty?\n return all_files_changed || no_files_changed\nend", "def revert(objects = [], commit = nil)\n unless (commit.nil? or commit.is_a? Grit::Commit) and objects.is_a? Array\n raise ArgumentError\n end\n\n if objects.empty?\n files = ['.']\n else\n objects.reject { |o| o.class.included_modules.include? self }\n files = objects.collect { |o| o.blob_path }\n end\n \n if commit.nil?\n revert_sha = self.repository.commits.first.parents.first.sha\n else commit.is_a? Grit::Commit\n revert_sha = commit.sha\n end\n\n self.repository.checkout revert_sha, files\n\n unless objects.empty?\n objects.each do |o|\n p o\n o = YAML.load_file(o.blob_path)\n p o\n end\n end\n end", "def process_primary_files_with_changes_only\n # We get the diff only so that we know which files have changed.\n # It's ok to use the reference commits because we're dealing with\n # content AT files only.\n diff = @repository.diff(@from_git_commit, @to_git_commit, context_lines: 0)\n fwc = []\n diff.patches.each { |patch|\n file_name = patch.delta.old_file[:path]\n # Skip non content_at files\n next if !@file_list.include?(file_name)\n # next if !file_name.index('63-0728')\n unless file_name =~ /\\/content\\/.+\\d{4}\\.at\\z/\n raise \"shouldn't get here: #{ file_name.inspect }\"\n end\n\n @logger.info(\" - process #{ file_name }\")\n\n absolute_file_path = File.join(@repository.base_dir, file_name)\n # Initialize content AT file `to` with contents as of `to_git_commit`.\n # It's fine to use the reference sync commit as the sync operation\n # doesn't touch content AT files, only STM CSV ones.\n content_at_file_to = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n absolute_file_path,\n @any_content_type\n ).as_of_git_commit(@to_git_commit)\n\n compute_st_ops_attrs = {\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n prev_last_operation_id: @prev_last_operation_id,\n execution_context: @execution_context,\n }\n\n compute_st_ops_attrs = refine_compute_st_ops_attrs(\n compute_st_ops_attrs,\n {\n from_table_release_version: @from_table_release_version,\n to_table_release_version: @to_table_release_version,\n absolute_file_path: absolute_file_path\n }\n )\n soff = SubtitleOperationsForFile.new(\n content_at_file_to,\n @repository.base_dir,\n compute_st_ops_attrs\n ).compute\n\n if soff.operations.any?\n # Only collect files that have subtitle operations\n @prev_last_operation_id = soff.last_operation_id\n fwc << soff\n end\n }\n\n # Then we add any files that have st_sync_required set to true and are\n # not in fwc already.\n @file_list.each { |content_at_filename|\n # Skip files that we have captured already\n next if fwc.any? { |soff| soff.content_at_file.repo_relative_path == content_at_filename }\n # Skip files that don't have st_sync_required set to true at to_git_commit\n dj_filename = content_at_filename.sub(/\\.at\\z/, '.data.json')\n # We use dj file contents at to_git_commit :at_child_or_ref\n dj_file = Repositext::RFile::DataJson.new(\n '_', # Contents are initialized later via #as_of_git_commit\n @language,\n dj_filename,\n @any_content_type\n ).as_of_git_commit(\n @to_git_commit,\n :at_child_or_ref\n )\n next if(dj_file.nil? || !dj_file.read_data['st_sync_required'])\n # This file is not in the list of fwc yet, and it has st_sync_required.\n # We add an soff instance with no operations. This could be a file\n # that has changes to subtitle timeslices only.\n content_at_file_from = Repositext::RFile::ContentAt.new(\n '_', # Contents are initialized later via `#as_of_git_commit`\n @language,\n content_at_filename,\n @any_content_type\n ).as_of_git_commit(@from_git_commit)\n soff = Repositext::Subtitle::OperationsForFile.new(\n content_at_file_from,\n {\n file_path: content_at_file_from.repo_relative_path,\n from_git_commit: @from_git_commit,\n to_git_commit: @to_git_commit,\n },\n [] # No operations\n )\n fwc << soff\n }\n # Return list of unique files with changes\n fwc.uniq\n end", "def test_add_back_a_remotely_removed_file\n a.add(\"two\" => \"two content\").commit(\"a added two\")\n a.rm(\"two\").commit(\"a removed two\")\n b.add(\"two\" => \"two content\").commit(\"b added two\")\n \n assert_equal nil, a['two']\n assert_equal \"two content\", b['two']\n \n b.pull\n \n assert_equal nil, a['two']\n assert_equal \"two content\", b['two']\n \n assert_log_equal [\n \"a added one\",\n \"a added two\",\n \"a removed two\",\n \"b added two\", \n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end", "def add_commits_in_current_repo\n existing_branches.each do |branch_name|\n add_commits_in_branch branch_name\n end\n @commit_list\n end", "def files_at_commit(pr, filter = lambda { |x| true })\n sha = pr[:base_commit]\n begin\n files = lslr(git.lookup(sha).tree)\n rescue StandardError => e\n log pr[:id]\n log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n return nil # not to the default branch\n end\n\n # # find the eariler than and closest to the creation time of commit\n # sha = commit_closest_earlier_pr(pr)\n # begin\n # files = sha.nil? ? [] : lslr(git.lookup(sha).tree)\n # rescue StandardError => e\n # log \"Cannot find commit #{sha} in base repo\" # some are in the other branches\n # files = [] # no files found before the pr\n # end\n\n\n if files.size <= 0\n log \"No files for commit #{sha}\"\n end\n files.select { |x| filter.call(x) }\n\n end", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n files = repo.lstree(base_commit, :recursive => true)\n\n files.select{|x| filter.call(x)}\n end", "def check_for_file_edits(committed_files)\n check_for_changes = `git ls-files --modified`\n\n if check_for_changes.each_line { |line|\n # if the user modified any files while executing this hook, then ask for a re-commit and abort the user push\n if committed_files.include?(line.rstrip())\n puts \"**File have been edited. Please stage/re-commit your changes and push again**\"\n exit(1)\n end\n }\n else\n exit(0)\n end\nend", "def changed_files\n DeliveryTruck::Helpers.changed_files(\n DeliveryTruck::Helpers.pre_change_sha(node),\n node['delivery']['change']['sha'],\n node\n )\n end", "def blobs_for_committish(committish)\n commits = grit.batch(committish)\n unless commits.empty?\n commits.first.tree.blobs\n end\n end", "def compute_changed_and_risk_files(params)\n commit_hash, file_arr = commit_info(params)\n changed_file_freq = file_arr.flatten!.each_with_object(Hash.new(0)) {|file, freq_acc| freq_acc[file] += 1}\n changed_g2_files = []\n changed_file_freq.select {|file, freq| changed_g2_files << file if freq > 2}\n risk_files = changed_g2_files.dup\n rf = risk_files.each_with_object({}) do |file, acc|\n author_set = Set.new\n commit_hash.each do |file_arr, author|\n acc[file] = (author_set << author ) if file_arr.include? (file)\n end\n end\n rf.delete_if {|_file, author_arr| author_arr.length < 2}\n {\n \"changed_files\" => changed_g2_files,\n \"risk_files\" => rf\n }\n end", "def prev_commit\n update_prev_latest_commit\n @prev_commit\n end", "def add_refs(commit)\n commit.refs = []\n refs = @repo.refs.select { |ref| ref.commit.id == commit.id }\n commit.refs << refs\n commit.refs.flatten!\n end", "def import\n @blob.blobs_commits.where(commit_id: @commit.id).find_or_create!\n\n if @blob.parsed?\n import_by_using_cached_keys\n else\n import_by_parsing_blob\n end\n end", "def files_at_commit(pr_id, filter = lambda{true})\n q = <<-QUERY\n select c.sha\n from pull_requests p, commits c\n where c.id = p.base_commit_id\n and p.id = ?\n QUERY\n\n def lslr(tree, path = '')\n all_files = []\n for f in tree.map{|x| x}\n f[:path] = path + '/' + f[:name]\n if f[:type] == :tree\n begin\n all_files << lslr(repo.lookup(f[:oid]), f[:path])\n rescue Exception => e\n STDERR.puts e\n all_files\n end\n else\n all_files << f\n end\n end\n all_files.flatten\n end\n\n base_commit = db.fetch(q, pr_id).all[0][:sha]\n begin\n files = lslr(repo.lookup(base_commit).tree)\n files.select{|x| filter.call(x)}\n rescue Exception => e\n STDERR.puts \"Cannot find commit #{base_commit} in base repo\"\n []\n end\n end", "def save_changes!(files_to_commit: [], custom_message: nil)\n not_implemented(__method__)\n end", "def add_commit(commit)\n\t\tpattern = ChangelogFilter.pattern\n\t\tfiltered_text = Git.get_filtered_message(commit, pattern)\n\t\tif filtered_text\n\t\t\tfiltered_lines = filtered_text.split(\"\\n\").uniq\n\t\t\tif @changelog\n\t\t\t\t@changelog = @changelog.concat(filtered_lines).uniq\n\t\t\telse\n\t\t\t\t@changelog = filtered_lines\n\t\t\tend\n\t\tend\n\tend", "def revert_unchanged_files(files = nil)\n files = (files && files.flatten) || self.files\n unless files.empty?\n @perforce.run(\"revert\", \"-a\", \"-c\", @number, *files)\n end\n end", "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\n end", "def uncommitted_files\n `git status`.scan(/^#(\\t|\\s{7})(\\S.*)$/).map { |match| match.last.split.last }\n end", "def add_files(context, file_path__content_array, opts = {})\n get_adapter_repo(context).add_files(file_path__content_array, no_commit: opts[:no_commit], commit_msg: opts[:commit_msg])\n end", "def changed_files(parent_sha, change_sha, node)\n response = shell_out!(\n \"git diff --name-only #{parent_sha} #{change_sha}\",\n :cwd => node['delivery']['workspace']['repo']\n ).stdout.strip\n\n changed_files = []\n response.each_line do |line|\n changed_files << line.strip\n end\n changed_files\n end", "def changed_files(parent_sha, change_sha, node)\n response = shell_out!(\n \"git diff --name-only #{parent_sha} #{change_sha}\",\n cwd: repo_path(node)\n ).stdout.strip\n\n changed_files = []\n response.each_line do |line|\n changed_files << line.strip\n end\n changed_files\n end", "def addFiles(branch, files)\n zombie_check\n on_worktree(branch) do |repo|\n repo.checkout_file(@repo.current_branch, files)\n repo.add(files)\n end\n end", "def db_add_pull_request_files(db, client, issues, org, repo)\n issues.each do |item|\n if(item.pull_request)\n begin\n files=client.pull_request_files(\"#{org}/#{repo}\", item.number.to_i)\n files.each do |file|\n if(db_pull_request_file_stored?(db, item.id, file.filename))\n db[\"DELETE FROM pull_request_files WHERE pull_request_id=? AND filename=?\", item.id.to_s, file.filename].delete\n end\n db[\n \"INSERT INTO pull_request_files (pull_request_id, filename, additions, deletions, changes, status)\n VALUES (?, ?, ?, ?, ?, ?)\",\n item.id, file.filename, file.additions, file.deletions, file.changes, file.status].insert\n end\n rescue Octokit::InternalServerError\n # 500 - Server Error: Sorry, there was a problem generating this diff. The repository may be missing relevant data. (Octokit::InternalServerError)\n # Skipping\n end\n end\n end\n end", "def filter_nonexistent(modified_files); end", "def altered_files; (modified + added + removed).sort; end", "def checkForThumbs(commit) #:doc:\n prev_commit_blob_ids = Array.new\n prev_commit = Commit.find(:first, :conditions => [\"id = ?\", commit.previous_commit_id])\n if prev_commit\n prev_commit.blobs.find_each(:batch_size => 1500) do |pb|\n prev_commit_blob_ids.push(pb.id)\n end\n end\n \n blobs_without_thumb = Array.new\n new_thumbs = 0\n new_thumbs_without_thumb = 0\n prev_thumbs_ok = true\n commit.blobs.find_each(:batch_size => 1500) do |blob|\n if blob.thumbnail_name == nil and not prev_commit_blob_ids.include?(blob.id) and not blobs_without_thumb.include?(blob.blob_hash)\n blobs_without_thumb.push(blob.blob_hash)\n new_thumbs_without_thumb += 1\n new_thumbs += 1\n elsif blob.thumbnail_name == nil and not blobs_without_thumb.include?(blob.blob_hash)\n blobs_without_thumb.push(blob.blob_hash)\n prev_thumbs_ok = false\n elsif blob.thumbnail_name != nil and not prev_commit_blob_ids.include?(blob.id)\n new_thumbs += 1\n end\n end\n \n if blobs_without_thumb.size == 0 # we have all thumbs, do nothing\n return\n elsif prev_thumbs_ok and new_thumbs_without_thumb == new_thumbs # all new thumbs missing\n XmppHelper::sendXmppMessage(@device.xmppname, \"thumbs \" + commit.commit_hash)\n else\n # some thumbs are missing. get them.\n i = 0\n blobs_per_message = 100\n message = blobs_without_thumb[i...blobs_per_message]\n while message != nil do\n XmppHelper::sendXmppMessage(@device.xmppname, \"thumbs \" + commit.commit_hash + \" \" + message.join(\" \"))\n i += blobs_per_message\n message = blobs_without_thumb[i...blobs_per_message]\n end\n end \n end", "def git_ignore(*paths)\n paths.each {|path| append_to_file '.gitignore', \"#{path}\\n\"}\n end", "def normalize_expected_commit_data commit_data\n # Convert file string list into real array\n commit_data[:file_name] = Kappamaki.from_sentence commit_data[:file_name]\n\n # Create individual expected commits for each location provided\n Kappamaki.from_sentence(commit_data.delete(:location)).map do |location|\n branch = branch_name_for_location location, commit_data[:branch]\n commit_data.clone.merge branch: branch\n end\nend", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n commits = commit_entries(pr, at_open = true)\n\n commits_per_file = commits.flat_map { |c|\n unless c[:files].nil?\n JSON.parse(c[:files]).map { |f|\n [c[:sha], f[\"filename\"]]\n }\n else\n []\n end\n }.select{|x| x.size > 1}.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]} # get the shas of pr related commits\n\n walker = Rugged::Walker.new(git)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr[:base_commit])\n\n commit_list = walker.select do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid # (oid is the object id - c.oid gets the commit sha). this commit is not part of pr's commits\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def commit_modified_files_task\n really_modified = `#{git} ls-files -m #{modified_files.entries.join(' ')}`.split(\"\\n\")\n if really_modified.any?\n really_modified.each { |file| sh git, 'add', file }\n sh git, 'commit', '-m', \"Released #{gemspec.name} gem version #{gemspec.version}.\"\n end\n end", "def staged\n @files.select { |k, f| f.sha_index != \"0000000000000000000000000000000000000000\" && f.type != nil }\n end", "def uncommitted_files\n svn('status', '--ignore-externals').split(\"\\n\").reject { |line| line =~ /^X\\s/ }\n end", "def create_commit_filepath(filepaths, commit_hash)\n filepaths.each do |str_path, churn|\n @con.exec_prepared('fileInsert', [commit_hash,str_path, churn])\n end\n end", "def get_files_in_commit(commit)\n\tfiles = {}\n\tcommit.diffs.each do | diff |\n\t\tfiles[diff.a_path] = nil unless files.has_key? diff.a_path\n\t\tfiles[diff.b_path] = nil unless files.has_key? diff.b_path\n\t\t# what about diff.deleted_file and diff.new_file?\n\tend\n\treturn files.keys\nend", "def git_diff_next\n unstaged_git_files.each do |unstaged_file|\n if unstaged_file.untracked?\n `echo UNTRACKED FILE #{unstaged_file.filename} >&2`\n copy_to_clipboard(unstaged_file)\n break\n elsif unstaged_file.deleted?\n `echo DELETED FILE #{unstaged_file.filename} >&2`\n copy_to_clipboard(unstaged_file)\n break\n elsif !unstaged_file.has_unstaged_changes?\n next\n else\n copy_to_clipboard(unstaged_file)\n exec \"git diff #{unstaged_file.filename}\"\n end\n end\nend", "def diff_files(commit)\n cache_key = [\n GITALY_TIMEOUT_CACHE_KEY,\n commit.project.id,\n commit.cache_key\n ].join(':')\n\n return [] if Rails.cache.read(cache_key).present?\n\n begin\n commit.diffs.diff_files\n rescue GRPC::DeadlineExceeded => error\n # Gitaly fails to load diffs consistently for some commits. The other information\n # is still valuable for Jira. So we skip the loading and respond with a 200 excluding diffs\n # Remove this when https://gitlab.com/gitlab-org/gitaly/-/issues/3741 is fixed.\n Rails.cache.write(cache_key, 1, expires_in: GITALY_TIMEOUT_CACHE_EXPIRY)\n Gitlab::ErrorTracking.track_exception(error)\n []\n end\n end", "def test_changed\n dir = \"changed_dir\"\n dir1 = \"changed_dir1\"\n dir2 = \"changed_dir2\"\n dir_path = File.join(@wc_path, dir)\n dir1_path = File.join(@wc_path, dir1)\n dir2_path = File.join(@wc_path, dir2)\n dir_svn_path = dir\n dir1_svn_path = dir1\n dir2_svn_path = dir2\n\n file1 = \"changed1.txt\"\n file2 = \"changed2.txt\"\n file3 = \"changed3.txt\"\n file4 = \"changed4.txt\"\n file5 = \"changed5.txt\"\n file1_path = File.join(@wc_path, file1)\n file2_path = File.join(dir_path, file2)\n file3_path = File.join(@wc_path, file3)\n file4_path = File.join(dir_path, file4)\n file5_path = File.join(@wc_path, file5)\n file1_svn_path = file1\n file2_svn_path = [dir_svn_path, file2].join(\"/\")\n file3_svn_path = file3\n file4_svn_path = [dir_svn_path, file4].join(\"/\")\n file5_svn_path = file5\n\n first_rev = nil\n\n log = \"added 3 dirs\\nanded 5 files\"\n make_context(log) do |ctx|\n\n ctx.mkdir([dir_path, dir1_path, dir2_path])\n\n FileUtils.touch(file1_path)\n FileUtils.touch(file2_path)\n FileUtils.touch(file3_path)\n FileUtils.touch(file4_path)\n FileUtils.touch(file5_path)\n ctx.add(file1_path)\n ctx.add(file2_path)\n ctx.add(file3_path)\n ctx.add(file4_path)\n ctx.add(file5_path)\n\n commit_info = ctx.commit(@wc_path)\n first_rev = commit_info.revision\n\n editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)\n assert_equal([\n file1_svn_path, file2_svn_path,\n file3_svn_path, file4_svn_path,\n file5_svn_path,\n ].sort,\n editor.added_files)\n assert_equal([], editor.updated_files)\n assert_equal([], editor.deleted_files)\n assert_equal([].sort, editor.updated_dirs)\n assert_equal([].sort, editor.deleted_dirs)\n assert_equal([\n \"#{dir_svn_path}/\",\n \"#{dir1_svn_path}/\",\n \"#{dir2_svn_path}/\"\n ].sort,\n editor.added_dirs)\n end\n\n log = \"deleted 2 dirs\\nchanged 3 files\\ndeleted 2 files\\nadded 3 files\"\n make_context(log) do |ctx|\n\n dir3 = \"changed_dir3\"\n dir4 = \"changed_dir4\"\n dir3_path = File.join(dir_path, dir3)\n dir4_path = File.join(@wc_path, dir4)\n dir3_svn_path = [dir_svn_path, dir3].join(\"/\")\n dir4_svn_path = dir4\n\n file6 = \"changed6.txt\"\n file7 = \"changed7.txt\"\n file8 = \"changed8.txt\"\n file9 = \"changed9.txt\"\n file10 = \"changed10.txt\"\n file6_path = File.join(dir_path, file6)\n file7_path = File.join(@wc_path, file7)\n file8_path = File.join(dir_path, file8)\n file9_path = File.join(dir_path, file9)\n file10_path = File.join(dir_path, file10)\n file6_svn_path = [dir_svn_path, file6].join(\"/\")\n file7_svn_path = file7\n file8_svn_path = [dir_svn_path, file8].join(\"/\")\n file9_svn_path = [dir_svn_path, file9].join(\"/\")\n file10_svn_path = [dir_svn_path, file10].join(\"/\")\n\n File.open(file1_path, \"w\") {|f| f.puts \"changed\"}\n File.open(file2_path, \"w\") {|f| f.puts \"changed\"}\n File.open(file3_path, \"w\") {|f| f.puts \"changed\"}\n ctx.rm_f([file4_path, file5_path])\n FileUtils.touch(file6_path)\n FileUtils.touch(file7_path)\n FileUtils.touch(file8_path)\n ctx.add(file6_path)\n ctx.add(file7_path)\n ctx.add(file8_path)\n ctx.cp(file1_path, file9_path)\n ctx.cp(file2_path, file10_path)\n ctx.mv(dir2_path, dir3_path)\n ctx.cp(dir1_path, dir4_path)\n ctx.rm(dir1_path)\n\n commit_info = ctx.commit(@wc_path)\n second_rev = commit_info.revision\n\n editor = traverse(Svn::Delta::ChangedEditor, commit_info.revision, true)\n assert_equal([file1_svn_path, file2_svn_path, file3_svn_path].sort,\n editor.updated_files)\n assert_equal([file4_svn_path, file5_svn_path].sort,\n editor.deleted_files)\n assert_equal([file6_svn_path, file7_svn_path, file8_svn_path].sort,\n editor.added_files)\n assert_equal([].sort, editor.updated_dirs)\n assert_equal([\n [file9_svn_path, file1_svn_path, first_rev],\n [file10_svn_path, file2_svn_path, first_rev],\n ].sort_by{|x| x[0]},\n editor.copied_files)\n assert_equal([\n [\"#{dir3_svn_path}/\", \"#{dir2_svn_path}/\", first_rev],\n [\"#{dir4_svn_path}/\", \"#{dir1_svn_path}/\", first_rev],\n ].sort_by{|x| x[0]},\n editor.copied_dirs)\n assert_equal([\"#{dir1_svn_path}/\", \"#{dir2_svn_path}/\"].sort,\n editor.deleted_dirs)\n assert_equal([].sort, editor.added_dirs)\n end\n end", "def forget_removed\n action = branch_merge ? :remove : :forget\n working_changeset.deleted.each do |file|\n act action, file unless target_changeset[file]\n end\n\n unless branch_merge\n working_changeset.removed.each do |file|\n forget file unless target_changeset[file]\n end\n end\n end", "def file_listing(commit)\n # The only reason this doesn't work 100% of the time is because grit doesn't :/\n # if i find a fix, it'll go upstream :D\n count = 0\n out = commit.diffs.map do |diff|\n count = count + 1\n if diff.deleted_file\n %(<li class='file_rm'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n else\n cla = diff.new_file ? \"add\" : \"diff\"\n %(<li class='file_#{cla}'><a href='#file_#{count}'>#{diff.a_path}</a></li>)\n end\n end\n \"<ul id='files'>#{out.join}</ul>\"\n end", "def branches_containing_commit(commit_ref); end", "def branches_containing_commit(commit_ref); end", "def diff_files_from(commit)\n git_args = ['diff', '--stat', '--name-only', commit]\n result = default_repository.git_output(git_args).lines.map { |line| line.strip }.sort\n # not sure if git would ever mention directories in a diff, but ignore them.\n result.delete_if { |item| ::File.directory?(item) }\n return result\n end", "def modified_files\n `git diff --cached --name-only --diff-filter=ACM --ignore-submodules=all`.split \"\\n\"\n end", "def grit_update\n grit_repo = Repo.new(self.aq_repository.path)\n new_commits_count = grit_repo.commit_count(self.name) - self.commits.count\n count = 0\n while (count < new_commits_count)\n commits = grit_repo.commits(self.name, 10, count)\n commits.each do |c|\n if not self.commits.find_by_sha(c.id)\n a_commit = AqCommit.new(:sha => c.id,\n :log => c.message,\n :author_name => c.author.name,\n :created_at => c.committed_date,\n :committed_time => c.committed_date,\n :repository => self.aq_repository)\n c.diffs.each do |diff|\n begin\n a_file = AqFile.find_by_path(diff.b_path, :conditions => [\"aq_branch_id = ?\", self.id])\n rescue\n a_file = nil\n end\n if !a_file\n a_file = AqFile.new(:name => diff.b_path.split(\"/\").last, :path => diff.b_path)\n a_file.branch = self\n end\n self.files << a_file if !a_file.branch\n self.aq_repository.files << a_file if !a_file.repository\n a_commit.aq_files << a_file\n end\n a_commit.author = self.aq_repository.owner\n self.commits << a_commit\n self.save\n end\n end\n diff_c = new_commits_count - count\n if (diff_c > 10)\n count += 10\n else\n count += diff_c\n end\n end\n if self.aq_repository.owner.nil?\n the_user = User.our_current_user.login || \"error: cant get user login\"\n else\n the_user = self.aq_repository.owner.login\n end\n aq_logger(Settings.logs.scm, \"User #{the_user}, Branch : #{self.name}, #{count} commits treated.\")\n end", "def create_files_and_commit\n Dir.chdir(\"#{LOCAL_PATH}/#{@name}\") do\n File.open('.gitignore', 'w+') do |f|\n f.write(\".idea\\n/vendor\\n/node_modules\\n.Thumbs.db\\n.DS_Store\")\n end\n\n `git add . && git commit -m \"initial commit\"`\n end\n end", "def git_add_everything(host, git_repo_path)\n git_on(host, \"add #{git_repo_path}/*\", git_repo_path)\nend", "def all_changed_files\n Set.new\n .merge(git.added_files.to_a)\n .merge(git.modified_files.to_a)\n .merge(git.renamed_files.map { |x| x[:after] })\n .subtract(git.renamed_files.map { |x| x[:before] })\n .to_a\n .sort\n end", "def currently_changed_files\n `git status --porcelain`.split(\"\\n\").map{ |file| file.split.last }\n end", "def gitignores\n %w[/tmp/librarian/]\n end", "def commits\n @commits ||= YAML.load_file(@commits_path).map do |commit_data|\n fields =\n if commit_data['fields'] == GLOB_COMMIT_FIELDS\n schema.changes\n else\n commit_data['fields']\n end\n\n ImportableCommit.new(fields, commit_data['message'])\n end\n end", "def commit args = {}\n action = :deleted if self.deleted?\n action ||= self.is_new? ? :added : (self.is_changed? ? :updated : :nothing_to_commit) \n args[:skip_part_data] ||= false\n \n unless action.eql?(:nothing_to_commit)\n message = \"#{action} #{name}\"\n message = args[:m] if args[:m] \n if action.eql?(:deleted)\n repo.remove(self.file_name)\n self.history_count += 1\n else\n repo.add(self.file_name)\n end\n\n active_message = self.commit_messages[:most_recent]\n message = \"#{active_message.gsub(message,\"\")}\" unless self.deleted? || active_message.blank? || active_message.eql?(message)\n self.remove_message_from_temp_store(:most_recent) unless active_message.blank?\n \n repo.commit(message)\n self.last_commit = repo.log(self.local_path, :limit => 1).first.to_s\n end\n unless action.eql?(:deleted) \n self.part_count = parts.count\n self.part_count ||= 0 \n update_part_data unless args[:skip_part_data]\n\n self.history_count = self.history.size\n self.history_count = 1 if self.history_count.eql?(0) \n end\n self.save if self.changed?\n \n synchronize unless args[:dont_sync] || self.attributes[\"sync\"].blank? #rather than calling sync.blank? to skip the JSON parsing step.\n return action\n end", "def stage_and_commit_file(repo_base_path, relpath_to_file, commit_message = nil)\n commit_message = \"Updated #{relpath_to_file} via website\" unless !commit_message.blank?\n gitRepo = Repo.new(repo_base_path)\n olddir = Dir.pwd\n Dir.chdir(repo_base_path)\n gitRepo.add(relpath_to_file)\n gitRepo.commit_index(commit_message)\n Dir.chdir(olddir)\n end", "def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACM --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end", "def git_add_commit_push(host, branch, message, git_repo_path)\n git_add_everything(host, git_repo_path)\n git_commit_push(host, branch, message, git_repo_path)\nend", "def migrate_files_to_external_storage!\n return if stored_externally? || !use_external_diff? || merge_request_diff_files.count == 0\n\n rows = build_merge_request_diff_files(merge_request_diff_files)\n\n transaction do\n MergeRequestDiffFile.where(merge_request_diff_id: id).delete_all\n create_merge_request_diff_files(rows)\n save!\n end\n\n merge_request_diff_files.reset\n end", "def git_add(file, msg)\r\n `git add #{file} && git commit -m \\\"#{msg}\\\"`\r\nend", "def updateDevfile(f, commit) #:doc:\n \n dev_file = nil\n \n begin\n # Checks if there is any changes in files.\n f_filedate = DateTime.strptime(f['filedate'], \"%T %F\")\n f_filedate = f_filedate.strftime('%F %T').to_s \n \n now = DateTime.now.strftime('%F %T')\nputs \"name: #{f['name']}\"\nputs \"path: #{f['path']}\"\n puts \"Finding devfile..\"\n dev_file = @device.devfiles.find(:first, :conditions => [\"name = ? and path = ?\", f['name'], f['path']])\n if dev_file != nil\n puts \"devfile found: \" + dev_file.id.to_s\n else\n puts \"Devfile not found\"\n raise Exception.new(\"Devfile not found. Can not update it!\")\n end\n \n \n blob = dev_file.blobs.find_by_blob_hash_and_devfile_id(f['blob_hash'], dev_file.id)\n if blob != nil\n puts \"Blob already exists!\"\n puts \"Blob: \" + blob.id.to_s\n return\n else\n puts \"Blob was not found!\"\n end\n \n # Finds the blob that is newest one\n previous_blob_id = nil\n current_blob = dev_file.blobs.find_by_id(dev_file.blob_id)\n if current_blob != nil\n previous_blob_id = current_blob.id.to_s\n puts \"Current blob: \" + current_blob.id.to_s\n \n end\n \n # If the blob, didn't exist yet, creates it. Ensures that blob will have version number.\n if blob == nil #or current_blob == nil\n version = 0\n if current_blob != nil\n version = current_blob.version + 1\n end\n \n puts \"Creates new blob, verion num: \" + version.to_s\n sql = \"insert into blobs(blob_hash, created_at, updated_at, size, filedate, uploaded, version, devfile_id, predecessor_id, latitude, longitude) values('#{f['blob_hash']}', '#{now}', '#{now}', '#{f['size']}', '#{f_filedate}', '0', '#{version}', '#{dev_file.id}', '#{previous_blob_id}', '#{@commit_location['latitude']}', '#{@commit_location['longitude']}');\"\n ActiveRecord::Base.connection.execute(sql)\n end\n \n puts \"Finding the newly created blob..\"\n blob = dev_file.blobs.find_by_blob_hash(f['blob_hash'])\n puts \" found blob: \" + blob.id.to_s\n \n current_blob.update_attribute(:follower_id, blob.id)\n \n puts \"Updating devfile\"\n # Updates changes in devfile (current blob)\n sql = \"update devfiles set filetype = '#{f['filetype']}', latitude = '#{f['latitude']}', longitude = '#{f['longitude']}', blob_id = '#{blob.id.to_s}', updated_at = '#{now}' where name = '#{f['name']}' and path = '#{f['path']}' and device_id = #{@device.id};\"\n puts \" SQL: \" + sql.background(:red)\n ActiveRecord::Base.connection.execute(sql)\n \n BlobsInCommit.find_or_create_by_blob_id_and_commit_id(blob.id, commit.id)\n \n \n #checkForObservers(dev_file)\n \n rescue => e\n puts \"Errors in updating file\" + e\n raise e\n end\n \n puts \"devfile updated!\"\n return dev_file\n end", "def modified_files\n remote_details = @container.list_objects_info\n same_files.reject do |file|\n (remote_details[file][:last_modified] <=> File.mtime(CloudfileAsset::Local.make_absolute(file))) == 1\n end\n end", "def filter_git_diff_issues(issues)\n modified_files_info = git_modified_files_info\n return [] if modified_files_info.empty?\n\n filtered_issues = []\n issues.each do |issue|\n file = issue[\"file\"].to_s\n next if modified_files_info[file].nil? || modified_files_info[file].empty?\n\n filtered_errors = issue[\"errors\"].select { |error| modified_files_info[file].include?(error[\"line\"].to_i) }\n filtered_issues << { \"file\" => file, \"errors\" => filtered_errors } unless filtered_errors.empty?\n end\n filtered_issues\n end", "def add_commit_to_db(hash)\n #insert hash values into proper attribute in commits table\n @con.exec_prepared('commitInsert', hash.values_at(*@@GIT_LOG_PROPERTIES))\n \n create_commit_filepath(hash[\"filepaths\"], hash[:commit_hash])\n create_commit_bug(hash[:bug], hash[:commit_hash]) if hash[:bug]!=nil\n end", "def commits_on_files_touched(pr, months_back)\n commits_on_pr_files(pr, months_back).reduce([]) do |acc, commit_list|\n acc + commit_list[1]\n end.flatten.uniq.size\n end", "def commits_on_pr_files(pr, months_back)\n\n oldest = Time.at(Time.at(pr[:created_at]).to_i - 3600 * 24 * 30 * months_back)\n pr_against = pull_req_entry(pr[:id])['base']['sha']\n commits = commit_entries(pr[:id])\n\n commits_per_file = commits.flat_map { |c|\n c['files'].map { |f|\n [c['sha'], f['filename']]\n }\n }.group_by {|c|\n c[1]\n }\n\n commits_per_file.keys.reduce({}) do |acc, filename|\n commits_in_pr = commits_per_file[filename].map{|x| x[0]}\n\n walker = Rugged::Walker.new(repo)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(pr_against)\n\n commit_list = walker.take_while do |c|\n c.time > oldest\n end.reduce([]) do |acc1, c|\n if c.diff(paths: [filename.to_s]).size > 0 and\n not commits_in_pr.include? c.oid\n acc1 << c.oid\n end\n acc1\n end\n acc.merge({filename => commit_list})\n end\n end", "def add_commits_in_branch branch_name\n array_output_of(\"git log #{branch_name} --format='%h|%s|%an <%ae>' --topo-order --reverse\").each do |commit|\n sha, message, author = commit.split('|')\n next if message == 'Initial commit'\n @commit_list.add sha: sha, message: message, branch_name: branch_name, author: author\n end\n @commit_list\n end", "def add_commit\n if (@is_commit)\n raise RuntimeError.new('Only one commit per request list allowed!')\n end\n @requests << {'commit' => ''}\n @is_commit = true\n self\n end", "def check_changed_files(git)\n git.status.select {|file| file.type || file.untracked }\n end", "def unmerged_commits\n commits = compare.commits\n\n if commits.present?\n commits = Commit.decorate(commits, merge_request.source_project).reverse\n end\n\n commits\n end", "def test_remove_the_same_file_in_both_repos\n a.rm(\"one\").commit(\"a removed one\")\n b.rm(\"one\").commit(\"b removed one\")\n \n assert_equal nil, a['one']\n assert_equal nil, b['one']\n \n b.pull\n \n assert_equal nil, a['one']\n assert_equal nil, b['one']\n \n assert_log_equal [\n \"a added one\",\n \"a removed one\",\n \"b removed one\",\n \"gitgo merge of origin/gitgo into gitgo\"\n ], b\n end", "def create_commits\n present_commits = user.repositories.find_by(name: repository_name).commits.pluck(:sha)\n commits_details = []\n commits.each do |commit|\n commits_details << get_commit_hash(commit) unless present_commits.include?(commit['sha'])\n end\n Commit.bulk_insert values: commits_details\n end", "def tracked_files\n all_files.reject { |f| ignore_matcher.matched?(f) }\n end", "def update!(**args)\n @uncommitted_file_changes = args[:uncommitted_file_changes] if args.key?(:uncommitted_file_changes)\n end", "def watch_files(files)\n @files.concat files\n self\n end", "def modified_files(options)\n flags = '--cached' if options[:staged]\n refs = options[:refs]\n subcmd = options[:subcmd] || 'diff'\n\n `git #{subcmd} --name-only -z --diff-filter=ACMR --ignore-submodules=all #{flags} #{refs}`.\n split(\"\\0\").\n map(&:strip).\n reject(&:empty?).\n map { |relative_file| File.expand_path(relative_file) }\n end", "def keep(*files)\n @keep.concat(files.flatten)\n end", "def altered_files\n raise NotImplementedError.new(\"altered_files() must be implemented by subclasses of AbstractChangeset.\")\n end", "def changed_files_since_deploy\n if File.exists?(\"log/latest-REVISION-syntaxcheck\")\n revision = File.read(\"log/latest-REVISION-syntaxcheck\").chomp\n\n `git whatchanged #{revision}..HEAD`.split(\"\\n\").select{|l| l =~ /^\\:/}.collect {|l| l.split(\"\\t\")[1]}.sort.uniq\n else\n puts \"log/latest-REVISION-syntaxcheck not found. run 'cap fetch_currently_deployed_version' to get it\"\n []\n end\n end", "def add_default_commit_data commit_data\n file_name = \"default_file_name_#{SecureRandom.urlsafe_base64}\"\n commit_data.clone.reverse_merge(\n file_name: file_name,\n message: 'default commit message',\n location: 'local and remote',\n branch: current_branch_name,\n file_content: default_file_content_for(commit_data[:file_name] || file_name)\n )\nend", "def all_files_except_git\n Dir.glob('*', File::FNM_DOTMATCH).delete_if { |file| file =~ /\\A\\.{1,2}\\z|\\A\\.git\\z/ }\n end", "def changeset\n @changeset ||= git_diff.map do |diff_file|\n file_diff = FileDiff.new(diff_file)\n file_diff unless FormattingChecker.pure_formatting?(file_diff)\n end.compact\n end" ]
[ "0.61535835", "0.585526", "0.58034074", "0.57718384", "0.575526", "0.57442135", "0.57291794", "0.57283944", "0.56657636", "0.5635432", "0.5591248", "0.5588017", "0.555051", "0.55259734", "0.54503167", "0.5441464", "0.5440389", "0.5426088", "0.54245037", "0.5422818", "0.54219663", "0.540742", "0.5403325", "0.5382114", "0.5359936", "0.5337765", "0.5325862", "0.5317372", "0.53124344", "0.53014493", "0.52963924", "0.52779365", "0.5272283", "0.52541345", "0.5252835", "0.5232509", "0.52138996", "0.5193432", "0.51921475", "0.51921475", "0.51753175", "0.51616937", "0.5153267", "0.5148204", "0.51370794", "0.5135205", "0.5134342", "0.51309705", "0.5102474", "0.5102019", "0.50856996", "0.50833845", "0.50779986", "0.50736994", "0.50705403", "0.5070176", "0.5057233", "0.50527", "0.50514346", "0.5041163", "0.5036509", "0.50299335", "0.50298953", "0.5016781", "0.50072396", "0.50054353", "0.5005168", "0.5002765", "0.49717912", "0.4944136", "0.49418694", "0.49297953", "0.49277046", "0.49257454", "0.48997784", "0.48981068", "0.48941252", "0.4890761", "0.4883406", "0.48741284", "0.48733842", "0.48656666", "0.48577064", "0.48545605", "0.4849087", "0.4833924", "0.48310226", "0.48294955", "0.48285568", "0.482603", "0.48236498", "0.48209658", "0.4811779", "0.48098764", "0.48088807", "0.479895", "0.4795892", "0.479296", "0.4791976", "0.4780121" ]
0.83637303
0
Tests if the device is reachable through http. If device is reachable, marks to db the ipaddress where the request came from, and value direct_access to true. If device was not reachable marks direct_access as false. parameters: Method needs digest, the ipaddress where the request came from and port.
def test_request(digest, rem_ip, port) device = Device.find_by_id_digest(digest) puts "-- Test_request on device " + device.dev_name + " (" + device.id.to_s + ")" address = nil i = 0 while i < 2 do begin address = "http://" << rem_ip uri = URI.parse(address) if port != nil address << ":" << port.to_s else port = uri.port end puts "-- Timeout count #" + (i+1).to_s + " BEGIN on device: " + device.dev_name + " (" + device.id.to_s + "), " + address timeout(5 + 15*i) do Net::HTTP.start(uri.host, port) { |http| response = http.head(uri.path.size > 0 ? uri.path : "/") } i = 2 end puts "-- Timeout count #" + (i+1).to_s + " END on device: " + device.dev_name + " (" + device.id.to_s + ")" rescue TimeoutError puts "-- TIMEOUT #" + (i+1).to_s + "on device: " + device.dev_name + " (" + device.id.to_s + ")" device.update_attribute(:direct_access, false) device.update_attribute(:address, nil) i += 1 if i == 2 return end rescue => exception puts exception puts "-- HTTP ERROR on device: " + device.dev_name + " (" + device.id.to_s + ")" device.update_attribute(:direct_access, false) device.update_attribute(:address, nil) return end end device.update_attribute(:direct_access, true) device.update_attribute(:address, address) ActiveRecord::Base.verify_active_connections!() puts "-- Test_request SUCCESSFUL on device: " + device.dev_name + " (" + device.id.to_s + "), " + address end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doi_server_reachable?\n # Invoke the API and get response\n true\n end", "def check_availability_by_http_request(host, port)\n uri = URI(\"http://#{host}:#{port}/info\")\n request = Net::HTTP::Get.new(uri)\n request[Datadog::Transport::Ext::HTTP::HEADER_DD_INTERNAL_UNTRACED_REQUEST] = '1'\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request(request)\n end\n response.is_a?(Net::HTTPSuccess)\n rescue SocketError\n false\n end", "def connection?\n check = Netchecker.new() \n @alive = check.check_url(\"google.com\", 80) \n end", "def server_reachable?\n puts \"Checking #{@address}:#{@port}\"\n res = Net::HTTP.start(@address, @port) {|http| http.get('/') }\n return res.code == \"200\"\n end", "def http?\n type == :basic || type == :digest\n end", "def host_2_url (host,port=80)\n\t\tputs \"Perform simple http(s) service detection on host #{host}, port #{port}\" if @verbose\n\t\tbegin\n\t\t\thost=host.strip\n\t\t\tif port.to_i == 80 \n\t\t\t\turl_1 = \"http://\" + host + \"/\"\n\t\t\telsif port.to_i ==443\n\t\t\t\turl_1 = \"https://\" + host + \"/\"\n\t\t\telse\n\t\t\t\turl_1 = \"http://\" + host + \":\" + port.to_s + \"/\"\n\t\t\t\turl_2 = \"https://\" + host + \":\" + port.to_s + \"/\"\n\t\t\tend\n\t\t\tputs \"Please ensure your internet connection is active before running this method: #{__method__}\" if @verbose\n\t\t\tchecker=Wmap::UrlChecker.new \n\t\t\tif checker.response_code(url_1) != 10000\n\t\t\t\tputs \"Found URL: #{url_1}\" if @verbose\n\t\t\t\treturn url_1\n\t\t\telsif checker.response_code(url_2) != 10000\n\t\t\t\tputs \"Found URL: #{url_2}\" if @verbose\n\t\t\t\treturn url_2\n\t\t\telse\n\t\t\t\tputs \"No http(s) service found on: #{host}:#{port}\" if @verbose\n\t\t\t\treturn nil\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def try_route\n\t\t\t\thttp_method = request.http_method\n\t\t\t\thttp_method = :GET if http_method == :HEAD\n\t\t\t\treturn unless available_endpoint\n\n\t\t\t\troute = available_endpoint[http_method]\n\t\t\t\treturn unless route || available_endpoint.allow\n\n\t\t\t\thalt(405, nil, 'Allow' => available_endpoint.allow) unless route\n\t\t\t\tstatus 200\n\t\t\t\texecute_route route\n\t\t\t\ttrue\n\t\t\tend", "def internet_http?\n host_http = 'http://www.google.com/index.html'\n check = Net::Ping::HTTP.new(host_http) #now http not as console\n check.ping?\n end", "def internet_http?\n host_http = 'http://www.google.com/index.html'\n check = Net::Ping::HTTP.new(host_http) #now http not as console\n check.ping?\n end", "def check_ip; end", "def url_valid?\n uri = URI(full_url)\n Net::HTTP.start(uri.host, uri.port, :use_ssl => full_url.start_with?(\"https\")) do |http|\n response = http.request_get(full_url)\n return response.is_a?(Net::HTTPOK) || response.is_a?(Net::HTTPRedirection)\n end\n end", "def http_call( opts )\n # [review] - Don't use DEBUG inside Remote class but pull from calling method's class?\n # [review] - Not sure if this is the best/proper way to do things but it works...\n\n # Identify method entry\n debug_print \"#{ self.class } : #{ __method__ }\\n\"\n\n # Merge default options with those passed in by user to form complete opt list\n opts = HTTP_opts.merge(opts)\n\n\n # Check URL in hash and get URI from it, then set up HTTP connection\n if opts[:url] =~ /^#{URI::regexp}$/\n _uri = URI(opts[:url])\n else\n debug_print \"No URL specified in input opts, exiting HTTP call\\n\"\n return false\n end\n\n _http = Net::HTTP.new(_uri.host, _uri.port)\n\n # Print out verbose HTTP request if :verbose is set\n # For hardcore debugging when shit really doesn't work\n _http.set_debug_output $stderr if opts[:verbose] == true\n\n # If SSL is set in hash, set HTTP connection to use SSL\n _http.use_ssl = true if opts[:ssl] == true\n\n # Create request based on HTTP method\n # [review] - Not sure if to fail with no method or default to GET?\n case opts[:method].upcase\n when \"GET\"\n _req = Net::HTTP::Get.new(_uri.request_uri)\n\n when \"POST\"\n _req = Net::HTTP::Post.new(_uri.request_uri)\n\n else\n debug_print \"No method specified, cannot make HTTP request\\n\"\n return false\n end\n\n # Check for basic authentication key in hash\n if opts[:basic_auth].size == 2\n _req.basic_auth(opts[:basic_auth][0], opts[:basic_auth][1])\n end\n\n # Check for Authentication token key in hash to be used in header\n # I think this is pretty universal, but specifically works for GitHub\n # This is standard for OAuth I think...\n if opts[:auth]\n _req[\"Authorization\"] = \"token #{ opts[:auth] }\"\n end\n\n # But sometimes we need we need other headers\n # Set specific header (GitLab requires PRIVATE_TOKEN)\n opts[:headers].each do |header|\n _req[\"#{ header[:field] }\"] = header[:value]\n end\n\n\n # [review] - Add :data_format to use set_form_data vs json body?\n # For now, use Hash or Array, this is to differentiate between\n # putting post data in body vs putting it in the form\n\n # If a POST method, :data is present, and is a Hash, fill request body with data\n if opts[:method].upcase == \"POST\" && opts[:data] && opts[:data].is_a?(Hash)\n _req.body = opts[:data].to_json\n end\n\n # If a POST method, :data is present, and is an Array, use set_form_data\n if opts[:method].upcase == \"POST\" && opts[:data] && opts[:data].is_a?(Array)\n _req.set_form_data(opts[:data][0])\n end\n\n # Make HTTP request\n _resp = _http.request(_req)\n\n # Debug prints for status and message\n debug_print \"HTTP Response Code: #{ _resp.code }\\n\"\n debug_print \"HTTP Response Msg: #{ _resp.message }\\n\"\n\n # [fix] - Not sure if 401 is the only code that gives nonparseable body?\n # Figure out what other response codes are bad news for JSON.parse\n _json = _resp.code == \"401\" ? Hash.new : JSON.parse(_resp.body)\n debug_print \"JSON: \\n #{ _json }\\n\"\n\n # [review] - Returning hash of json + response the right thing to do?\n # return {:json => _json, :resp => _resp}\n return _json, _resp\n end", "def network_available?(sample_uri = SAMPLE_URI.call)\n @agent.get('http://portal.titech.ac.jp').to_b\n rescue # check another website just to make sure\n @agent.get(sample_uri).to_b rescue return false\n end", "def allowed_http?\n port_protocol_allowed('80')\n end", "def hit_api_direct\n # CollegiateLink API needs some data to be hashed and sent for auth purposes\n time = (Time.now.to_f * 1000).to_i.to_s\n ipaddress = ENV['cl_ipaddress']\n apikey = ENV['cl_apikey']\n privatekey = ENV['cl_privatekey']\n random = SecureRandom.hex\n hash = Digest::SHA256.hexdigest(apikey + ipaddress + time + random + privatekey)\n\n url = ENV['cl_apiurl'] + @resource + \"?time=\" + time + \"&apikey=\" + apikey + \"&random=\" + random + \"&hash=\" + hash + @url_options\n return send_request(url, nil)\n end", "def check_connection\n one_wait = 5\n max_wait = 5\n request = Net::HTTP::Get.new('/')\n wait = 0;\n while (wait < max_wait)\n begin\n response = Net::HTTP.start(@url.host, @url.port) {|http|\n http.request(request)\n }\n break if Net::HTTPForbidden === response\n break if Net::HTTPNotFound === response\n break if Net::HTTPSuccess === response\n # When we try to connect to a down server with an Apache proxy, \n # we'll get Net::HTTPBadGateway and get here\n rescue Errno::ECONNREFUSED\n # When we try to connect to a down server without an Apache proxy, \n # such as a dev instance, we'll get here\n end\n sleep one_wait;\n wait += one_wait\n end\n if (wait == max_wait)\n puts(\"-- ERROR: couldn't connect to test host on \" + @url.host.to_s)\n return false\n end\n puts(\"-- SUCCESS: test host is alive !\\n\")\n return true\nend", "def get?\r\nHTTP_METHOD_LOOKUP[request_method] == :get\r\nend", "def ping\n response, body = send_request :get, '', :binary\n true\n end", "def route! env\n http_route = \"#{env[REQ_METHOD]} #{env[PATH_INFO]}\"\n return true if env[GIN_ROUTE] == http_route\n\n env[GIN_TARGET], env[GIN_PATH_PARAMS] =\n router.resources_for env[REQ_METHOD], env[PATH_INFO]\n\n env[GIN_ROUTE] = http_route\n\n !!env[GIN_TARGET]\n end", "def serverup?(ip, port)\n http = Net::HTTP.start(ip, port, {open_timeout:3, read_timeout:3})\n response = http.send_request('GET', '/')\n JSON.parse(response.body)\nrescue Timeout::Error, SocketError, Errno::ECONNREFUSED\n nil\nend", "def netnoop_parse_request_details(request)\n protocol = use_ssl? ? \"https\" : \"http\"\n\n path = request.path\n path = URI.parse(request.path).request_uri if request.path =~ /^http/\n\n if request[\"authorization\"] =~ /^Basic /\n userinfo = FakeWeb::Utility.decode_userinfo_from_header(request[\"authorization\"])\n userinfo = FakeWeb::Utility.encode_unsafe_chars_in_userinfo(userinfo) + \"@\"\n else\n userinfo = \"\"\n end\n \n # TODO: optionally store the port\n # uri = \"#{protocol}://#{userinfo}#{self.address}:#{self.port}#{path}\"\n uri = \"#{protocol}://#{userinfo}#{self.address}#{path}\"\n method = request.method.downcase.to_sym\n \n return uri, method\n end", "def check_host(ip)\n print_status(\"Checking #{peer} for DLSw exposure\")\n response = get_response\n\n if !response.blank? && (response =~ /IOS Software|cisco.com/)\n print_good(\"#{peer}: The target Cisco router appears vulnerable: parts of a Cisco IOS banner detected\")\n report_vuln(\n host: rhost,\n port: rport,\n name: name,\n refs: references,\n info: \"Module #{fullname} collected #{response.length} bytes\"\n )\n Exploit::CheckCode::Vulnerable\n else\n if response.blank?\n vprint_status(\"#{peer}: no response\")\n else\n vprint_status(\"#{peer}: #{response.size}-byte response didn't contain any leaked data\")\n end\n Exploit::CheckCode::Safe\n end\n end", "def ip_reachable?(ip)\n external = Net::Ping::External.new(ip)\n\n log_info %(attempting to contact host \"#{ip}\")\n reachable = external.ping || external.ping6\n if reachable\n log_success %(host \"#{ip}\" is reachable)\n else\n log_error %(unable to contact host \"#{ip}\")\n end\n\n reachable\n end", "def ping?\n base_url = url.end_with?(\"/\") ? url[0..-2] : url\n\n if normalized_api_version.nil?\n # for v4\n base_url = url.end_with?(\"/\") ? url[0..-2] : url\n public_url = \"#{base_url}/index.html\"\n else\n # for v5\n public_url = \"#{base_url}/api/v1/status/public\"\n end\n\n http = Net::Ping::HTTP.new(public_url)\n\n # use GET for v5\n http.get_request = true if normalized_api_version\n\n http.ping?\n end", "def ip_check\n logger.warn request.remote_addr.inspect\n if Rails.env == \"production\" && !request.remote_ip.include?(\"99.166.163.112\")\n render :text => \"GETTHEFUCKOUT\"\n end\n end", "def is_enable_direct_url\n return @direct_url != nil && @direct_url == \"true\"\n end", "def connectable?\n ssl_context = OpenSSL::SSL::SSLContext.new\n ssl_context.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n @http.head(URL_TO_CHECK, ssl_context: ssl_context).status.success?\n rescue StandardError\n false\n end", "def check\r\n res = send_request_cgi({'uri'=>'/'})\r\n if res.nil?\r\n fail_with(Failure::Unreachable, 'Connection timed out.')\r\n end\r\n # Checks for the `WWW-Authenticate` header in the response\r\n if res.headers[\"WWW-Authenticate\"]\r\n data = res.to_s\r\n marker_one = \"Basic realm=\\\"NETGEAR \"\r\n marker_two = \"\\\"\"\r\n model = data[/#{marker_one}(.*?)#{marker_two}/m, 1]\r\n vprint_status(\"Router is a NETGEAR router (#{model})\")\r\n model_numbers = ['DGN2200v1', 'DGN2200v2', 'DGN2200v3', 'DGN2200v4']\r\n if model_numbers.include?(model)\r\n print_good(\"Router may be vulnerable (NETGEAR #{model})\")\r\n return CheckCode::Detected\r\n else\r\n return CheckCode::Safe\r\n end\r\n else\r\n print_error('Router is not a NETGEAR router')\r\n return CheckCode::Safe\r\n end\r\n end", "def report_connectivity(controller, port, connectivity_map)\n me = `hostname`.chomp\n req = Net::HTTP::Post.new(\"/#{me}\", initheader = {'Content-Type'=>'application/json'})\n req.body = connectivity_map.to_json\n response = Net::HTTP.start(controller, port) do |http|\n http.request(req)\n end\n response.code == '200'\nend", "def url_active?\n begin\n response = Net::HTTP.get_response URI.parse(self.url)\n active_status = %w(200 301 302)\n active_status.include? response.code\n rescue\n false\n end \n end", "def private_net_checker; end", "def allow_net_connect?\n allow_net_connect\n end", "def allowed_request\n !((request.remote_ip =~ /127\\.0\\.0\\.1/).nil? && (request.remote_ip =~ /128\\.128\\./).nil? && (request.remote_ip =~ /10\\.19\\./).nil?)\n end", "def matches_directly?(request_path, http_method)\n @paths.path[request_path]&.operation(http_method)\n end", "def http_redirect?\n @get_resp.kind_of?(Net::HTTPRedirection)\n end", "def http_redirect?\n @get_resp.kind_of?(Net::HTTPRedirection)\n end", "def http; end", "def port_open?(server, port)\n http = Net::HTTP.start(server, port, open_timeout: 5, read_timeout: 5)\n response = http.head('/')\n response.code == '200'\n rescue Timeout::Error, SocketError, Errno::ECONNREFUSED\n false\n end", "def update_ip(ip, url, membersite, username, password)\n result = \"\"\n Net::HTTP.start(url) {|http|\n req = Net::HTTP::Get.new(\"/nic/update?hostname=#{membersite}&myip=#{ip}&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG\")\n req.basic_auth username, password\n req.add_field 'User-Agent', 'simpleddns'\n response = http.request(req)\n result = response.body\n }\n return result\nend", "def require_http_auth\n if `hostname` =~ /soykaf|lanpartei/i \n if auth = APP_CONFIG['http_auth']\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == auth['name'] && password == auth['password']\n end \n end\n end\n end", "def domain_2_site (domain,port=80)\n puts \"Perform simple http(s) service detection on domain #{domain}, port #{port}\" if @verbose\n begin\n domain=domain.strip\n if port.to_i == 80\n url_1 = \"http://www.\" + domain + \"/\"\n elsif port.to_i ==443\n url_1 = \"https://www\" + domain + \"/\"\n else\n url_1 = \"http://www\" + domain + \":\" + port.to_s + \"/\"\n url_2 = \"https://www\" + domain + \":\" + port.to_s + \"/\"\n end\n puts \"Please ensure your internet connection is active before running this method: #{__method__}\" if @verbose\n checker=Wmap::UrlChecker.new\n if checker.response_code(url_1) != 10000\n puts \"Found URL: #{url_1}\" if @verbose\n return url_1\n elsif checker.response_code(url_2) != 10000\n puts \"Found URL: #{url_2}\" if @verbose\n return url_2\n else\n puts \"No http(s) service found on: #{domain}:#{port}\" if @verbose\n return nil\n end\n rescue => ee\n puts \"Exception on method #{__method__}: #{ee}\" if @verbose\n return nil\n end\n end", "def server_ready?\n begin\n url = URI.parse(TEST_URI)\n req = Net::HTTP.new(url.host, url.port)\n res = req.request_head(\"/\")\n res.code == \"200\"\n rescue Errno::ECONNREFUSED\n false\n end\nend", "def http_endpoint_enabled\n data[:http_endpoint_enabled]\n end", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def check_head(url)\n http_basic_authentication = SS::MessageEncryptor.http_basic_authentication\n\n redirection = 0\n max_redirection = SS.config.cms.check_links[\"max_redirection\"].to_i\n\n if url.match?(/^\\/\\//)\n url = @base_url.sub(/\\/\\/.*$/, url)\n elsif url[0] == \"/\"\n url = File.join(@base_url, url)\n end\n\n begin\n Timeout.timeout(@head_request_timeout) do\n ::URI.open url, proxy: true, redirect: false, http_basic_authentication: http_basic_authentication, progress_proc: ->(size) { raise \"200\" }\n end\n false\n rescue OpenURI::HTTPRedirect => e\n return false if redirection >= max_redirection\n redirection += 1\n url = e.uri\n retry\n rescue Timeout::Error\n return false\n rescue => e\n return e.to_s == \"200\"\n end\n end", "def valid?(mac, url)\n Net::HTTP.get_response(URI.parse(url + mac)).code == '200'\nend", "def is_reachable_url?(url)\n begin\n wait(15, true, 1) {\n RestClient.get url\n }\n\n rescue Exception => e\n @@logger.an_event.debug \"url #{url} unreachable : #{e.message}\"\n false\n\n else\n @@logger.an_event.debug \"url #{url} reachable\"\n true\n\n end\n end", "def server?\n response = Net::HTTP.get_response(URI.parse('http://localhost:9533/'))\n raise unless response.class == Net::HTTPOK\nrescue\n skip 'Local server not detected'\nend", "def attempt_connection\n begin\n response = Net::HTTP.get_response(uri)\n unless response.code == \"200\"\n Puppet.notice \"HTTP request (#{uri}) failed: (#{response.code} #{response.body})\"\n return false\n end\n return true\n rescue Errno::ECONNREFUSED => e\n Puppet.notice \"Unable to establish HTTP connection to '#{uri}'; #{e}\"\n return false\n end\n end", "def http_peek(url)\n @log.debug \"http_peek... #{url}\"\n uri = Addressable::URI.parse url\n if uri.port\n http = Net::HTTP.new(uri.host, uri.port)\n else\n http = Net::HTTP.new(uri.host,\n Addressable::URI.port_mapping[uri.scheme])\n end\n http.open_timeout = 5\n\n # Unfortunately the net/http(s) API can't seem to do this for us,\n # even if we require net/https from the beginning (ruby 1.8)\n if uri.scheme == \"https\"\n require 'net/https'\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n end\n\n if bot.config[\"log_level\"] == \"debug\"\n http.set_debug_output $stderr\n end\n\n begin\n res = http.start { |http|\n @log.debug \"http.start, http object: \" + \n PP.singleline_pp(http, '')\n req = Net::HTTP::Get.new(uri.request_uri,\n { 'User-Agent' => 'campfire-bot/20110709 ' +\n '(x86_64-unknown-linux-gnu) ruby-stdlib-net/1.8.7' })\n\n if uri.user != nil && uri.user != \"\" &&\n uri.password != nil && uri.password != \"\"\n req.basic_auth uri.user, uri.password\n end\n\n response = http.request req\n @log.debug \"http.start, response: \" + \n PP.singleline_pp(response, '')\n response\n }\n\n rescue Exception => e\n @log.error \"Exception... #{e.class.name}, #{e.message}\"\n end\n\n case res\n when Net::HTTPRedirection\n uri.merge({ :host => res.header['Location'] })\n @log.debug \"following HTTPRedirection... res: #{res}, uri: \" +\n \"#{uri.omit(:user, :password)}, header: #{res.header['Location']}\"\n [res.header['Location'], res]\n\n else # Net::HTTPSuccess or error\n @log.debug \"proper non-redirected location... res: #{res}, uri: #{uri.omit(:user, :password)}\"\n [url, res]\n end\n end", "def head?\r\nHTTP_METHOD_LOOKUP[request_method] == :head\r\nend", "def proxied?\n return unless dns?\n return true if cloudflare_ip?\n return false if pointed_to_github_pages_ip? || pointed_to_github_user_domain?\n served_by_pages?\n end", "def request_method\r\n@request_method ||= check_method(env[\"REQUEST_METHOD\"])\r\nend", "def check_access\n @response = Response.new\n \n check_hash()\n \n if @response.error?\n access_denied\n return\n end\n end", "def connection?\n begin\n TCPSocket.new 'google.com', 80\n return true\n rescue SocketError\n return false\n end\n end", "def getHttp(fpUri,fpVerb=\"GET\",fpData=\"\")\n\t#@fpUserAgent = \"CMU/2.2 CFNetwork/672.0.8 Darwin/14.0.0\"\n\t@fpUserAgent = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:49.0) Gecko/20100101 Firefox/49.0\"\n\n\thttp = Net::HTTP.new(fpUri.host, fpUri.port)\n\n\tcase fpUri.scheme.upcase\n\t\twhen \"https\".upcase\n\t\t\thttp.use_ssl = true\n\t\t \t# For signature checks it doesn't matter if a valid certificate is present.\n\t\t \thttp.verify_mode = OpenSSL::SSL::VERIFY_NONE if fpUri.scheme.upcase == \"https\".upcase\n\t\telse\n\t\tend\n\n\tcase fpVerb.upcase\n\t\twhen \"Get\".upcase\n\t\t\t# For now forcing encoding to text as some devices being tested have broken compression implemented.\n\t\t\trequest = Net::HTTP::Get.new(fpUri,initheader = {'Accept-Encoding' => 'gzip, default, br', 'User-Agent' => @fpUserAgent}) if fpVerb.upcase == \"Get\".upcase\n\t\t\t# request = Net::HTTP::Get.new(fpUri) if fpVerb.upcase == \"Get\".upcase # Default Header\n\t\t\t\n\t\t\tputs \"GET #{fpUri}\"\n\n\t\twhen \"Post\".upcase\n\t\t\trequest = Net::HTTP::Post.new(fpUri.request_uri) if fpVerb.upcase == \"Post\".upcase\n\t\t\trequest.set_form_data(fpData) if fpVerb.upcase == \"Post\".upcase\n\t\t\n\t\telse\n\t\t\trequestFail = true\n\t\tend\n\n\tresponse = http.request(request) if !requestFail\n\treturn response\nend", "def direct?\n @direct\n end", "def request_get?\n request.get?\n end", "def available?\n resp = get do |req|\n req.url '/'\n end\n resp.status == 200\n end", "def online?\n get['state']['reachable']\n end", "def datadog_http_request?(req, address, port, tracer)\n transport = tracer.writer.transport\n\n transport_hostname = nil\n transport_port = nil\n\n # Get settings from transport, if available.\n case transport\n when Datadog::Transport::HTTP::Client\n adapter = transport.current_api.adapter\n if adapter.is_a?(Datadog::Transport::HTTP::Adapters::Net)\n transport_hostname = adapter.hostname.to_s\n transport_port = adapter.port.to_i\n end\n end\n\n # When we know the host & port (from the URI) we use it, else (most-likely\n # called with a block) rely on the URL at the end.\n if req.respond_to?(:uri) && req.uri\n if req.uri.host.to_s == transport_hostname &&\n req.uri.port.to_i == transport_port\n return true\n end\n elsif address && port &&\n address.to_s == transport_hostname &&\n port.to_i == transport_port\n return true\n end\n\n false\n end", "def check\n # we want to handle cases where the port/target isn't open/listening gracefully\n begin\n # only catch the response if we're going to use it, in this case we do for the version\n # detection.\n res = send_request_cgi(\n 'uri' => normalize_uri(target_uri.path, 'index.php'),\n 'method' => 'GET'\n )\n # gracefully handle if res comes back as nil, since we're not guaranteed a response\n # also handle if we get an unexpected HTTP response code\n fail_with(Failure::UnexpectedReply, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n fail_with(Failure::UnexpectedReply, \"#{peer} - Check URI Path, unexpected HTTP response code: #{res.code}\") if res.code == 200\n\n # here we're looking through html for the version string, similar to:\n # Version 1.2\n /Version: (?<version>[\\d]{1,2}\\.[\\d]{1,2})<\\/td>/ =~ res.body\n\n if version && Gem::Version.new(version) <= Gem::Version.new('1.3')\n vprint_good(\"Version Detected: #{version}\")\n Exploit::CheckCode::Appears\n end\n rescue ::Rex::ConnectionError\n fail_with(Failure::Unreachable, \"#{peer} - Could not connect to the web service\")\n end\n Exploit::CheckCode::Safe\n end", "def internal\n @internal ||= http.select { |link| URL.new(link).host == host }\n end", "def accessed_from_website?\n res = false\n \n referer = request.env['HTTP_REFERER']\n unless referer.nil? || referer.match(\"^#{Conf.base_uri}\").nil?\n res = true\n end\n \n return res\n end", "def accessed_from_website?\n res = false\n \n referer = request.env['HTTP_REFERER']\n unless referer.nil? || referer.match(\"^#{Conf.base_uri}\").nil?\n res = true\n end\n \n return res\n end", "def check\r\n\r\n res = send_request_cgi({\r\n 'method' => 'GET',\r\n 'uri' => normalize_uri(target_uri.path, \"#{datastore['CONTENT_DIR']}/\")\r\n })\r\n\r\n unless res\r\n vprint_error 'Connection failed'\r\n return CheckCode::Unknown\r\n end\r\n\r\n if res.code == 404\r\n return Exploit::CheckCode::Safe\r\n end\r\n return Exploit::CheckCode::Appears\r\n end", "def make_http_request\n Net::HTTP.get_response('localhost', '/ping', 3000).body\nend", "def url_accessibility(url)\n open(url).status.last == 'OK'\n rescue ::SocketError, Timeout::Error, Errno::ECONNREFUSED, OpenURI::HTTPError\n false\n end", "def directly_reachable(target)\n number_of_interfaces_checked = 0\n @facts['interfaces'].split(',').each do |inf|\n if @facts[\"ipaddress_#{inf}\"] && @facts[\"netmask_#{inf}\"]\n number_of_interfaces_checked += 1\n infaddr = IPAddr.new(@facts[\"ipaddress_#{inf}\"] + '/' + @facts[\"netmask_#{inf}\"])\n return true if infaddr.include?(IPAddr.new(target))\n end\n end\n if number_of_interfaces_checked > 0\n return false\n else\n # If Facter failed for some reason and didn't send us any interface\n # data we don't want to have etch unconfigure/misconfigure the\n # networking on the client\n abort \"No interface addresses/netmasks received\"\n end\nend", "def ident_http_request(method, uri_string, credentials=nil, headers={}, data=nil, limit = 3, open_timeout=15, read_timeout=15)\n\n response = nil\n begin\n\n # set user agent\n user_agent = \"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36\"\n headers[\"User-Agent\"] = user_agent\n\n attempts=0\n max_attempts=limit\n found = false\n timeout = false\n\n uri = URI.parse uri_string\n\n # keep track of redirects\n response_urls = [\"#{uri}\"]\n\n unless uri\n _log error \"Unable to parse URI from: #{uri_string}\"\n return\n end\n\n until( found || attempts >= max_attempts)\n @task_result.logger.log \"Getting #{uri}, attempt #{attempts}\" if @task_result\n attempts+=1\n\n if $global_config\n if $global_config.config[\"http_proxy\"]\n proxy_config = $global_config.config[\"http_proxy\"]\n proxy_addr = $global_config.config[\"http_proxy\"][\"host\"]\n proxy_port = $global_config.config[\"http_proxy\"][\"port\"]\n proxy_user = $global_config.config[\"http_proxy\"][\"user\"]\n proxy_pass = $global_config.config[\"http_proxy\"][\"pass\"]\n end\n end\n\n # set options\n opts = {}\n if uri.instance_of? URI::HTTPS\n opts[:use_ssl] = true\n opts[:verify_mode] = OpenSSL::SSL::VERIFY_NONE\n end\n\n http = Net::HTTP.start(uri.host, uri.port, proxy_addr, proxy_port, opts)\n http.open_timeout = open_timeout\n http.read_timeout = read_timeout\n\n path = \"#{uri.path}\"\n path = \"/\" if path==\"\"\n\n # add in the query parameters\n if uri.query\n path += \"?#{uri.query}\"\n end\n\n ### ALLOW DIFFERENT VERBS HERE\n if method == :get\n request = Net::HTTP::Get.new(uri)\n elsif method == :post\n # see: https://coderwall.com/p/c-mu-a/http-posts-in-ruby\n request = Net::HTTP::Post.new(uri)\n request.body = data\n elsif method == :head\n request = Net::HTTP::Head.new(uri)\n elsif method == :propfind\n request = Net::HTTP::Propfind.new(uri.request_uri)\n request.body = \"Here's the body.\" # Set your body (data)\n request[\"Depth\"] = \"1\" # Set your headers: one header per line.\n elsif method == :options\n request = Net::HTTP::Options.new(uri.request_uri)\n elsif method == :trace\n request = Net::HTTP::Trace.new(uri.request_uri)\n request.body = \"blah blah\"\n end\n ### END VERBS\n\n # set the headers\n headers.each do |k,v|\n request[k] = v\n end\n\n # handle credentials\n if credentials\n request.basic_auth(credentials[:username],credentials[:password])\n end\n\n # USE THIS TO PRINT HTTP REQUEST\n #request.each_header{|h| _log_debug \"#{h}: #{request[h]}\" }\n # END USE THIS TO PRINT HTTP REQUEST\n\n # get the response\n response = http.request(request)\n\n if response.code==\"200\"\n break\n end\n\n if (response.header['location']!=nil)\n newuri=URI.parse(response.header['location'])\n if(newuri.relative?)\n newuri=URI.parse(\"#{uri}#{response.header['location']}\")\n end\n response_urls << ident_encode(newuri.to_s)\n uri=newuri\n\n else\n found=true #resp was 404, etc\n end #end if location\n end #until\n\n final_url = uri\n\n ### TODO - create a global $debug config option\n \n rescue ArgumentError => e\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue Net::OpenTimeout => e\n #puts \"Unable to connect #{uri}: #{e}\"\n timeout = true\n rescue Net::ReadTimeout => e\n #puts \"Unable to connect #{uri}: #{e}\"\n timeout = true\n rescue Errno::ENETDOWN => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Errno::ETIMEDOUT => e\n #puts \"Unable to connect #{uri}: #{e}\" \n timeout = true\n rescue Errno::EINVAL => e\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue Errno::ENETUNREACH => e\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue Errno::EHOSTUNREACH => e\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue URI::InvalidURIError => e\n #\n # XXX - This is an issue. We should catch this and ensure it's not\n # due to an underscore / other acceptable character in the URI\n # http://stackoverflow.com/questions/5208851/is-there-a-workaround-to-open-urls-containing-underscores-in-ruby\n #\n #puts \"Unable to connect #{uri}: #{e}\"\n rescue OpenSSL::SSL::SSLError => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Errno::ECONNREFUSED => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Errno::ECONNRESET => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Net::HTTPBadResponse => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Zlib::BufError => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Zlib::DataError => e # \"incorrect header check - may be specific to ruby 2.0\"\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue EOFError => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue SocketError => e\n #puts \"Unable to connect #{uri}: #{e}\" \n rescue Encoding::InvalidByteSequenceError => e\n #puts \"Encoding issue #{uri}: #{e}\" \n rescue Encoding::UndefinedConversionError => e\n #puts \"Encoding issue #{uri}: #{e}\" \n end\n\n # generate our output\n out = {\n :timeout => timeout,\n :start_url => uri_string,\n :final_url => final_url.to_s,\n :request_type => :ruby,\n :request_method => method,\n :request_credentials => credentials,\n :request_headers => headers,\n :request_data => data,\n :request_attempts_limit => limit,\n :request_attempts_used => attempts,\n :request_user_agent => user_agent,\n :request_proxy => proxy_config,\n :response_urls => response_urls,\n :response_object => response\n }\n\n # verify we have a response before adding these\n if response\n out[:response_headers] = response.each_header.map{|x| ident_encode \"#{x}: #{response[x]}\" }\n out[:response_body] = ident_encode(response.body)\n end\n\n out\n end", "def http\n socket = Net::HTTP.new(uri.host, uri.port)\n socket.use_ssl = uri.is_a?(URI::HTTPS)\n socket.verify_mode = OpenSSL::SSL::VERIFY_NONE if socket.use_ssl?\n socket\n end", "def http_methods\n reload if executed_requests['GET'].nil? || executed_requests['GET']['headers'].nil? || executed_requests['GET']['headers'].empty?\n (executed_requests['GET']['headers']['Allow'] || \"GET\").split(/,\\s*/)\n end", "def verify\n @request = Net::HTTP::Get.new(@uri.path)\n @request.basic_auth @username, @password\n\n @response = @http.request(@request)\n @response.code.to_i == 200\n\n rescue Errno::ETIMEDOUT, Exception\n false\n end", "def secure?\n @uri.port == 443\n end", "def reachable?\n return true if (page_ref && (page_ref.good? || (page_ref.http_status == 200))) || (gleaning && gleaning.good?)\n return false if (page_ref && @@BadResponseCodes.include?(page_ref.http_status)) &&\n (gleaning && @@BadResponseCodes.include?(gleaning.http_status))\n end", "def on_a_fort\n fort_response = Net::HTTP.get_response(URI('http://files.fort/'))\n fort_response.is_a?(Net::HTTPSuccess)\nrescue\n false\nend", "def manage_ip?\n case type.hotspot\n when 'hsv1-mem' then true\n when 'hsv2-bam' then false\n else false\n end\n end", "def internet?(cmd)\n return true if cmd[:noinetchk]\n\n dns_resolver = Resolv::DNS.new\n begin\n dns_resolver.getaddress('icann.org')\n true\n rescue Resolv::ResolvError => _e\n print \"\\nThere appears to be no internet access on this computer, \".red,\n \"the script cannot continue.\\n\\n\".red\n false\n end\n end", "def post_tunnel_method_hack?\n @env['REQUEST_METHOD'] == 'POST' &&\n POST_TUNNEL_METHODS_ALLOWED.include?(self.POST.fetch('_method', '').upcase)\n end", "def api_call_method(kt_api_url, version, api_key, secret_key, api_func, arg_assoc_hash)\n\n socket = Socket.new(AF_INET, SOCK_STREAM, 0)\n sockaddr = Socket.sockaddr_in(@m_port, @m_ip)\n \n connected = true\n\n #puts Benchmark.measure{\n begin\n socket.connect_nonblock(sockaddr)\n rescue Errno::EINPROGRESS\n IO.select(nil, [socket])\n begin\n socket.connect_nonblock(sockaddr)\n rescue Errno::EISCONN\n connected = false\n #puts \"Errno::EISCONN!!\"\n end\n end\n #}\n \n if connected\n url_path = get_call_url(kt_api_url, version, api_key, secret_key, api_func, arg_assoc_hash)\n\n buf = \"GET \" + url_path + \" HTTP/1.1\\r\\n\"\n buf << \"Host:\" + @m_ip + \":\" + @m_port.to_s + \"\\r\\n\"\n buf << \"Content-type: application/x-www-form-urlencoded\\r\\n\"\n buf << \"Accept: */*\\r\\n\"\n buf << \"\\r\\n\"\n buf << \"\\r\\n\"\n \n socket.write_nonblock buf\n end\n socket.close\n \n return connected\n end", "def reachable?(url)\n page = MetaInspector.new(url)\n\n if page.response.status < 400\n true\n else\n false\n end\n rescue\n false\n end", "def post?\r\nHTTP_METHOD_LOOKUP[request_method] == :post\r\nend", "def ok?\n Net::HTTPSuccess === self || Net::HTTPRedirection === self\n end", "def doPost(url)\n init\n checkHTTP(url)\n display\nend", "def responds?\n begin\n @patron.head(\"/#{@path}/\")\n true\n rescue Patron::ConnectionFailed\n false\n end\n end", "def https?; end", "def ensure_http \n url.ensure_http\n end", "def public_https_enabled?\n get('beef.http.public.https') || false\n end", "def can_serve_request?(req)\n false\n end", "def do_request(request, response)\n if request.request_method != 'GET'\n response.status = 405\n LOG.error \"Unsupported request method #{request.request_method}\"\n return\n end\n\n do_get(request, response)\n end", "def online?\n Browser.get(url).code != 0\n end", "def check\n uri = URI.parse(\"https://ifconfig.co/ip\")\n begin\n response = Net::HTTP.get_response(uri)\n if response.code == \"200\" || response.code == 200\n current_ip = \"#{response.body}\".strip\n saved_ip = \"#{read_current_ip}\".strip\n if current_ip != saved_ip\n logger.log(\"New IP: #{current_ip}\")\n slack_notifier.log(\"New IP: #{current_ip}\")\n write_current_ip(current_ip)\n end\n else\n logger.log(\"Cannot Reach ifconfig.co\")\n end\n rescue => e\n logger.log(\"Error checking IFCONFIG\")\n logger.log(\"#{e.inspect}\")\n end\n nil\n end", "def verify_pcgw_url(pcgw_id)\n url = URI.parse(\"https://pcgamingwiki.com/wiki/#{pcgw_id}\")\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n res = req.request_head(url.path)\n if res.code == \"200\"\n return true\n elsif res.code == \"404\"\n return false\n else\n return false\n end\nend", "def connectable?\n ProxyFetcher.config.proxy_validator.connectable?(addr, port)\n end", "def connectable?\n ProxyFetcher.config.proxy_validator.connectable?(addr, port)\n end", "def is_redirection?\n code.to_i >= 300 && code.to_i <= 399\n end", "def reachable?\n ping\n true\n rescue Orocos::ComError\n false\n end", "def http_debug?\n Options[:http_debug]\n end", "def is_machine_running?\n if !pi_machine?\n raise I18n.t('not_web_enabled')\n end\n \n url = URI.parse(root_url)\n \n req = Net::HTTP::Get.new(url.to_s)\n res = Net::HTTP.start(url.host, url.port) {|http|\n http.request(req)\n }\n \n if res.is_a?(Net::HTTPSuccess)\n res.body\n else\n nil\n end \n \n rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError,\n Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e\n puts e.message\n puts e.backtrace.inspect\n end", "def direct?\n return data.direct\n end" ]
[ "0.6042585", "0.59668314", "0.5897502", "0.5796055", "0.5670178", "0.5597566", "0.55771816", "0.5515116", "0.5515116", "0.54601616", "0.5452217", "0.5439537", "0.541121", "0.5387958", "0.5355659", "0.53249204", "0.5293428", "0.52518976", "0.52444285", "0.52243257", "0.5216779", "0.51907", "0.5167936", "0.51677793", "0.51524174", "0.51268643", "0.5117001", "0.51111263", "0.51095515", "0.51048696", "0.50983816", "0.5089938", "0.50892353", "0.50706035", "0.5065219", "0.5065219", "0.5064141", "0.5056156", "0.5044013", "0.50383043", "0.50309765", "0.5024909", "0.50204885", "0.501423", "0.501423", "0.5004998", "0.5003313", "0.49982926", "0.49975574", "0.4994894", "0.49847445", "0.4983148", "0.4969239", "0.49402678", "0.4936635", "0.49317998", "0.49316612", "0.49254563", "0.4920829", "0.49160302", "0.49114433", "0.49086565", "0.4907964", "0.48973173", "0.48973173", "0.48947284", "0.48852003", "0.48847377", "0.4872511", "0.48707122", "0.48628798", "0.4855722", "0.48443574", "0.4842505", "0.48399073", "0.48321575", "0.4827057", "0.48166686", "0.48158517", "0.48157045", "0.48153627", "0.48124054", "0.48102555", "0.48091975", "0.48053235", "0.47952223", "0.47939187", "0.4791043", "0.47804314", "0.47794285", "0.4764552", "0.47615495", "0.4755309", "0.47474906", "0.47474906", "0.47473308", "0.47421712", "0.4742075", "0.47398093", "0.4736679" ]
0.5191332
21
check if commit is missing (some of) it's thumbnails. Sends xmppmessages to the device for the missing thumbnails. parameters: commit the commit in question
def checkForThumbs(commit) #:doc: prev_commit_blob_ids = Array.new prev_commit = Commit.find(:first, :conditions => ["id = ?", commit.previous_commit_id]) if prev_commit prev_commit.blobs.find_each(:batch_size => 1500) do |pb| prev_commit_blob_ids.push(pb.id) end end blobs_without_thumb = Array.new new_thumbs = 0 new_thumbs_without_thumb = 0 prev_thumbs_ok = true commit.blobs.find_each(:batch_size => 1500) do |blob| if blob.thumbnail_name == nil and not prev_commit_blob_ids.include?(blob.id) and not blobs_without_thumb.include?(blob.blob_hash) blobs_without_thumb.push(blob.blob_hash) new_thumbs_without_thumb += 1 new_thumbs += 1 elsif blob.thumbnail_name == nil and not blobs_without_thumb.include?(blob.blob_hash) blobs_without_thumb.push(blob.blob_hash) prev_thumbs_ok = false elsif blob.thumbnail_name != nil and not prev_commit_blob_ids.include?(blob.id) new_thumbs += 1 end end if blobs_without_thumb.size == 0 # we have all thumbs, do nothing return elsif prev_thumbs_ok and new_thumbs_without_thumb == new_thumbs # all new thumbs missing XmppHelper::sendXmppMessage(@device.xmppname, "thumbs " + commit.commit_hash) else # some thumbs are missing. get them. i = 0 blobs_per_message = 100 message = blobs_without_thumb[i...blobs_per_message] while message != nil do XmppHelper::sendXmppMessage(@device.xmppname, "thumbs " + commit.commit_hash + " " + message.join(" ")) i += blobs_per_message message = blobs_without_thumb[i...blobs_per_message] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_message_format(regex, oldrev, newrev)\n missed_revs = `git rev-list #{oldrev}..#{newrev}`.split(\"\\n\")\n bad_commits = \"\"\n auth_fail = 0\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !regex.match(message) then\n bad_commits += \"#{rev}\\n\"\n else\n # Increment fail counter on failure\n auth_fail += verify_authcode(msg)\n end\n \n end\n\n if auth_fail > 0 or bad_commits.split(\"\\n\").nitems.to_i > 0 then\n puts \"[POLICY] Please ensure that your commit messages contain ticket or a current authorization numbers\"\n puts \"The list of commits you sent were: \"\n puts bad_commits\n exit 1\n end\nend", "def commit_msg_empty?(msg)\n msg.lines.grep(/^(?!#).*\\S.*^/).empty?\nend", "def addUnchangedFilesToCommit(prev_commit, commit, changed_files) #:doc:\n# sql = \"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\"\n# devfiles_of_prev_commit = ActiveRecord::Base.connection.execute(sql)\n#\n devfiles_of_prev_commit = Devfile.find_by_sql(\"select devfiles.path, devfiles.name, devfiles.blob_id from devfiles, blobs, blobs_in_commits where blobs.devfile_id=devfiles.id and blobs_in_commits.blob_id=blobs.id and blobs_in_commits.commit_id=#{prev_commit.id};\")\n if devfiles_of_prev_commit.size > 0\n ActiveRecord::Base.connection.execute(\"begin\")\n now = DateTime.now\n devfiles_of_prev_commit.each do |df|\n if not changed_files.has_key?(df.path + df.name)\n begin\n sql = \"insert into blobs_in_commits(blob_id, commit_id, created_at, updated_at) values('#{df['blob_id']}', '#{commit.id}', '#{now}', '#{now}');\"\n ActiveRecord::Base.connection.execute(sql)\n rescue\n # do nothing\n end\n end\n end\n ActiveRecord::Base.connection.execute(\"commit\")\n end\n end", "def normal_commit?\n !ARGV[1] || ARGV[1] == 'message'\n end", "def commit_msg_empty?(commit_msg_file)\n File.open(commit_msg_file, 'r') do |f|\n f.readlines.each do |line|\n strip_line = line.strip\n return false if (!strip_line.empty? && !strip_line.start_with?('#'))\n end\n end\n true\nend", "def check\n super\n uncommitted = Git.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n # fail \"You are releasing from a local branch that does not track a remote!\" unless Git.remote\n end", "def no_new_commit\n puts red(\"No new commit found\")\n end", "def check\n super\n uncommitted = Git.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n fail \"You are releasing from a local branch that does not track a remote!\" unless Git.remote\n end", "def commit args = {}\n action = :deleted if self.deleted?\n action ||= self.is_new? ? :added : (self.is_changed? ? :updated : :nothing_to_commit) \n args[:skip_part_data] ||= false\n \n unless action.eql?(:nothing_to_commit)\n message = \"#{action} #{name}\"\n message = args[:m] if args[:m] \n if action.eql?(:deleted)\n repo.remove(self.file_name)\n self.history_count += 1\n else\n repo.add(self.file_name)\n end\n\n active_message = self.commit_messages[:most_recent]\n message = \"#{active_message.gsub(message,\"\")}\" unless self.deleted? || active_message.blank? || active_message.eql?(message)\n self.remove_message_from_temp_store(:most_recent) unless active_message.blank?\n \n repo.commit(message)\n self.last_commit = repo.log(self.local_path, :limit => 1).first.to_s\n end\n unless action.eql?(:deleted) \n self.part_count = parts.count\n self.part_count ||= 0 \n update_part_data unless args[:skip_part_data]\n\n self.history_count = self.history.size\n self.history_count = 1 if self.history_count.eql?(0) \n end\n self.save if self.changed?\n \n synchronize unless args[:dont_sync] || self.attributes[\"sync\"].blank? #rather than calling sync.blank? to skip the JSON parsing step.\n return action\n end", "def check\n super\n info \"Working in branch '#{Hg.current_branch}'\"\n uncommitted = Hg.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n fail \"You are releasing from a local branch that does not track a remote!\" if Hg.remote.empty?\n end", "def nothing_to_commit?\n @git.status do |file, status|\n return false unless status.empty?\n end\n return true\n end", "def breaking_change?(commit)\n !commit.fetch(\"message\").match(/^[a-z]*!/).nil?\nend", "def check_for_clean\n # can't believe there's not a simple yes/no here..\n out = `git status --porcelain`\n\n unless out.empty? then\n puts colorRed(\"you have uncommitted changes -- please commit and try again:\\r\\t#{out}\")\n exit\n end\n\n end", "def uncommitted_changes?\n inform \"Checking for any uncommitted changes...\"\n if nothing_to_commit?\n inform \"All changes committed :)\"\n false\n else\n inform \"You have uncommitted changes. Please commit them first, then run `rake release` again.\"\n true\n end\n end", "def check_commit\n return if @tree\n \n data = @base.lib.commit_data(@objectish)\n set_commit(data)\n end", "def barf!(msg=nil)\n puts \"*** add_nocommit: %s \" % msg if msg\n exit -1\nend", "def should_commit?(segregation)\n\t\tseg = @segregations[segregation]\n\t\tif @size_file > 0 and seg[:file_pointers][seg[:current_page]].size > @size_file\n\t\t\t@logger.info(\"S3> should_commit: upload because of size\")\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n\tend", "def test_git_log_can_have_no_changes\n assert_equal(0, extract_change_count_from_git_log(\"\"))\n end", "def check\n super\n uncommitted = Perforce.uncommitted_files\n fail \"Uncommitted files violate the First Principle Of Release!\\n#{uncommitted.join(\"\\n\")}\" unless uncommitted.empty?\n end", "def commit_required?; end", "def post_commit_image\n v1 = params[:blog_post][:initiated_at]\n\n v2 = %{\n insert into blog_post\n (initiated_at)\n values\n ($1)\n on conflict\n do nothing\n returning\n initiated_at::text\n ;\n }\n\n V3::U.qq(v2, [v1])\n\n v3 = v1.parameterize\n v4 = params[:blog_post][:attachment]\n v5 = v4.path\n v6 = v4.original_filename\n v7 = File.extname(v6).downcase\n v8 = File.basename(v6, v7)\n v9 = v8.parameterize + v7\n v10 = Rails.root.join('..', '..', 'shared', 'public', 'blog-post-images', v3, 'sources')\n v11 = Rails.root.join('..', '..', 'shared', 'public', 'blog-post-images', v3, 'thumbnails')\n v12 = v10.join(v9)\n v13 = v11.join(v9)\n\n FileUtils.mkdir_p(v10)\n FileUtils.mkdir_p(v11)\n FileUtils.mv(v5, v12)\n\n File.chmod(0744, v12)\n\n # Always create a thumbnail 128x128px wide, for use with the admin UI.\n #\n `convert #{v12} -resize 128x128! #{v13}`\n\n v14 = Pathname.new('/blog-post-images/' + v3 + '/sources/' + v9)\n v15 = Pathname.new('/blog-post-images/' + v3 + '/thumbnails/' + v9)\n v16 = `identify -format \"%wx%h\" #{v12}`\n v17 = v16.split('x')\n v18 = `identify -format \"%wx%h\" #{v13}`\n v19 = v18.split('x')\n v20 = File.size(v12)\n v21 = File.size(v13)\n\n v22 = %{\n insert into blog_post_image\n (initiated_at, file_name, type, path, src, width, height, bytes, cover)\n values\n ($1, $2, $3, $4, $5, $6, $7, $8, default)\n ;\n }\n\n V3::U.qq(v22, [v1, v9, 'source', v12, v14, v17[0], v17[1], v20])\n V3::U.qq(v22, [v1, v9, 'thumbnail', v13, v15, v19[0], v19[1], v21])\n\n v23 = {\n file_name: v9,\n images: {\n \"#{v9}\": [\n [v14.to_s, 'source', v17[0], v17[1]],\n [v15.to_s, 'thumbnail', 128, 128]\n ]\n },\n dimensions: {\n \"#{v9}\": {\n source_width: v17[0],\n source_height: v17[1],\n custom_width: nil,\n custom_height: nil\n }\n },\n thumbnails: {\n \"#{v9}\": v15.to_s\n },\n selected_image_dims: {\n \"#{v9}\": \"#{v17[0]}x#{v17[1]}\"\n },\n image_links: {\n \"#{v9}\": {\n \"#{v17[0]}x#{v17[1]}\": {\n a: v14.to_s,\n b: %{<a href=\"#{v14.to_s}\"><img src=\"#{v14.to_s}\" /></a>}\n },\n \"#{v19[0]}x#{v19[1]}\": {\n a: v15.to_s,\n b: %{<a href=\"#{v14.to_s}\"><img src=\"#{v15.to_s}\" /></a>}\n }\n }\n }\n }\n\n render(json: v23.to_json)\nend", "def validate_repo_clean\n @gitrepo = Grit::Repo.new(@repo_root)\n status = @gitrepo.status\n if !status.changed.nil? || status.changed.size != 0 # This has to be a convoluted way to determine a non-empty...\n # Test each for the magic sha_index. Ref: https://github.com/mojombo/grit/issues/142\n status.changed.each do |file|\n case file[1].sha_index\n when '0' * 40\n ui.error 'There seem to be unstaged changes in your repo. Either stash or add them.'\n exit 4\n else\n ui.msg 'There are modified files that have been staged, and will be included in the push.'\n end\n end\n elsif status.untracked.size > 0\n ui.warn 'There are untracked files in your repo. You might want to look into that.'\n end\n end", "def check_do_row\n err_arr = []\n begin\n if @row_hash[\"ao_ref_id\"].nil? && @row_hash[\"ao_uri\"].nil?\n err_arr.push I18n.t(\"bulk_import.error.no_uri_or_ref\")\n else\n result = archival_object_from_ref_or_uri(@row_hash[\"ao_ref_id\"], @row_hash[\"ao_uri\"])\n err_arr.push I18n.t(\"bulk_import.error.bad_ao\", :errs => result[:errs]) if result[:ao].nil?\n end\n obj_link = @row_hash[\"digital_object_link\"]\n thumb = @row_hash[\"thumbnail\"] || @row_hash[\"Thumbnail\"]\n err_arr.push I18n.t(\"bulk_import.error.dig_info_miss\") if @row_hash[\"digital_object_link\"].nil? && thumb.nil?\n end\n v = @row_hash[\"publish\"]\n @row_hash[\"publish\"] = (v == \"1\")\n err_arr.join(\"; \")\n end", "def check_message_format\n missed_revs = `git rev-list #{$oldrev}..#{$newrev}`.split(\"\\n\")\n missed_revs.each do |rev|\n message = `git cat-file commit #{rev} | sed '1,/^$/d'`\n if !$regex.match(message)\n puts \"[POLICY] Your message is not formatted correctly\"\n puts \"\\n\\tRefused message: #{message}\"\n puts \"\\nYour commit message should absolutely reference the issue number in redmine\"\n puts \"\\n\\tYou should use one of the below referencing keywords or fixing keywords\"\n puts \"\\n\\tReferencing keywords:\"\n puts \"\\t\\trefs #XXX\"\n puts \"\\t\\treferences #XXX\"\n puts \"\\t\\tIssueID #XXX\"\n puts \"\\n\\tFixing keywords:\"\n puts \"\\t\\tfixes #XXX\"\n puts \"\\t\\tcloses #XXX\"\n puts \"\\n\\treplace XXX with the issue's number.\"\n puts \"\\n\\tN.B: If the current commit is not related to any issue (which is usually a bad idea)\"\n puts \"\\tYou can use the MISC: keyword to bypass referencing an issue as follows.\"\n puts \"\\n\\t\\tMISC: Commit message\"\n puts \"\\n\\tN.B: There's a whitespace between MISC: and the commit message.\"\n puts \"\"\n exit 1\n end\n end\nend", "def check_commit_change_for_untagged_version\n return unless spec\n return unless spec.version == Version.new('0.0.1')\n ref_spec = related_specifications.find { |s| s.version != '0.0.1' }\n return unless ref_spec\n unless ref_spec.source[:commit] == spec.source[:commit]\n error \"Attempt to rewrite the commit of 0.0.1 version.\"\n end\n end", "def verify_existing_release_metadata\n return false if existing_files.empty?\n msg \"Verifying cached release metadata\"\n @invalid_metadata_files = existing_files.select {|f| !f.quick_verify}\n msg \"invalid_metadata_files: #{@invalid_metadata_files.size}\"\n end", "def test03_EmptyGPopDMPublish\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"Media Description #{random}.\")\n \t\t\t\tpostGroupPop\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\tpostPublishLater\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PPL04T03: FAILED! User unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tsleep 2\n\t\t\tassert $post_scheduled_post.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PPL04T03: FAILED! User unable to Post.\")\n\t\t\t\tputs e\n\t\t\tend\t\n\t\tend", "def check_commit(commit)\n contributors = commit_contributors(commit)\n all_contributors_signed = contributors.all? { |contributor|\n signed = signed_agreement?(contributor)\n if contributor\n Rails.logger.info(\"check_commit for #{commit.id}: #{contributor.id} #{contributor.email}: #{signed}\")\n else\n Rails.logger.info(\"check_commit for #{commit.id}: nil: #{signed}\")\n end\n signed\n }\n\n if all_contributors_signed\n mark(commit, 'success')\n else\n mark(commit, 'failure')\n end\n end", "def has_pushed_since_last_respin?(type)\n jobs = push_jobs_since_last_state(type, 'NEW_FILES').where('pub_task_id is not null')\n jobs.reject(&:is_nochannel?).any?(&:is_committed?)\n end", "def invalid_sha?(sha)\n sha.size != 40\n end", "def check_thumbnail\n picurl = nil if picurl.blank?\n if picurl.nil? || picurl =~ /^data:/\n # Shouldn't have a thumbnail\n self.thumbnail = nil\n elsif picdata =~ /^data:/\n # The current thumbnail is valid\n elsif picurl && (self.thumbnail = Thumbnail.acquire( url, picurl )) && !thumbnail.thumbdata\n Delayed::Job.enqueue self # Update the thumbnail image in background\n end\n true\n end", "def check_for_update\n file = download_file(UPSTREAM_DATABASE[:URL], Dir.mktmpdir)\n # Same hash = no update\n !check_hash(file, UPSTREAM_DATABASE[:HASH])\n end", "def test05_250RepostMedia\n\t\trepostMediaPop\n\t\tsleep 3\n\t\trepostPopulate250\n\t\tsleep 3\n\t\t\n\t\tbegin \n\t\tassert $repost_confirmation.exists?\n\t\t\trescue => e\n\t\t\tputs \"RS4T05: FAILED! User unable to repost!\"\n\t\t\tputs e\n\t\tend\n\tend", "def nothing_to_commit?\n Dir.chdir @root do\n cmd = \"git status\"\n stdout, stderr, status = Open3.capture3 cmd\n if status != 0\n case stderr\n when /Not a git repository/\n raise NotARepositoryError\n else\n raise Error, stderr\n end\n end\n # Check if status indicates nothing to commit\n return /nothing to commit/.match stdout\n end\n end", "def check_data\n if MissouriDatum.last.new_file\n @downloads.each_with_index do |download, index|\n obj = s3.bucket('missouridata').object(\"new/#{file_names[index]}\")\n @file_status = \"new\"\n puts \"new file\"\n upload(obj, download)\n end\n else \n downloads.each_with_index do |download, index|\n obj = s3.bucket('missouridata').object(\"same/#{file_names[index]}\")\n @file_status = \"same\"\n puts \"same file\"\n upload(obj, download)\n end\n end \n end", "def picture_validation\n if picture.attached?\n if picture.blob.byte_size > 2000000\n picture.purge\n errors[:base] << 'Maksymalny rozmiar logo klanu to 2MB'\n elsif !picture.blob.content_type.starts_with?('image/')\n picture.purge\n errors[:base] << 'Zły format'\n end\n else\n errors[:base] << 'Logo klanu jest obowiązkowe.'\n end\n end", "def test_commit_again\n\tex = [\"Author: Meghan Johnson <email@email.com>\"]\n\tassert_equal 0, num_commits(ex), \"Should have counted zero commits\"\n end", "def add_from_upload?(blob_params)\n !blob_params[:data].blank?\n end", "def empty?\n @commits.empty?\n end", "def checksvn_command(msg)\n msg.speak \"no new commits since I last checked #{@lastlast} ago\" if !check_svn(msg)\n end", "def check_for_file_edits(committed_files)\n check_for_changes = `git ls-files --modified`\n\n if check_for_changes.each_line { |line|\n # if the user modified any files while executing this hook, then ask for a re-commit and abort the user push\n if committed_files.include?(line.rstrip())\n puts \"**File have been edited. Please stage/re-commit your changes and push again**\"\n exit(1)\n end\n }\n else\n exit(0)\n end\nend", "def fail_commit(commit, message)\n fail(\"#{commit.sha}: #{message}\") # rubocop:disable Style/SignalException\nend", "def verify(state)\n transport.connection(state) do |conn|\n\n conn.execute(busser.cleanup_cmd)\n\n busser.sync_files.each do |file|\n conn.upload!(file[:local], file[:remote])\n end\n\n conn.execute(busser.sync_cmd)\n conn.execute(busser.run_cmd)\n\n conn.execute(busser.cleanup_cmd)\n end\n end", "def execute!\n logger.info(\"Pushing commit #{commit_log.commit_id}\")\n\n if phrases.size > 0\n commit_log.phrase_count = phrases.size\n repo_config.tms.store_phrases(phrases, commit_log.commit_id)\n commit_log.push\n else\n commit_log.finalize!\n end\n\n logger.info(\"Finished pushing commit #{commit_log.commit_id}\")\n rescue Java::OrgEclipseJgitErrors::MissingObjectException => ex\n commit_log.missing\n ensure\n save_commit_log\n end", "def check_commit(commit)\n contributors = commit_contributors(commit)\n all_contributors_signed = contributors.all? { |contributor| signed_agreement?(contributor) }\n\n if all_contributors_signed\n mark(commit, 'success')\n else\n mark(commit, 'failure')\n end\n end", "def commit_required?\n @entry_set.each do |e|\n return true if e.dirty\n end\n @comment != @stored_comment || @entry_set != @stored_entries || @create\n end", "def verify_image_not_in_use\r\n if @image.player_characters.size > 0 || @image.creatures.size > 0 || @image.features.size > 0\r\n flash[:notice] = 'Cannot delete \"' + @image.name + '\", it is in use.'\r\n false\r\n else\r\n true\r\n end\r\n end", "def test04_DraftEmptyGPopDM\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"Media Description #{random}.\")\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\tsleep 2\n\t\t\t\tsleep 4\n\t\t\t\t$post_save_draft.fire_event(\"onclick\")\n\t\t\telse puts \"PDEV04T04: FAILED! UUser unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_draft_error.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PDEV04T04: FAILED! User able to save incomplete draft.\")\n\t\t\t\tputs e\n\t\t\tend\t\n\t\tend", "def receive_push\n return if data['user'] == nil\n return if data['pass'] == nil\n return if data['url'] == nil\n return if data['title'] == nil\n # The line we add looks like: <msg> <commit URL>\n line_add = \"\\n* #{summary_message}: #{summary_url}\"\n # Log in to the install.\n mw = MediaWiki::Gateway.new(data['url'])\n mw.login(data['user'], data['pass'])\n # Good. Fetch page if it exists somehow.\n page_text = mw.get(data['title'])\n if page_text == nil\n mw.create(data['title'], '<!-- autocreated -->', :summary => 'Creating page -- did not exist during push')\n page_text = \"\"\n end\n # Append our line to the end of the page_text\n page_text << line_add\n # Save the page\n mw.edit(data['title'], page_text, :summary => 'Updated commits upon push')\n end", "def perform\n puts \">>>>>>>>>>>>>>>>>>>>>>>>>>>>> Validating picurl with url '#{url}' and picurl '#{picurl}'\"\n thumbnail.update_thumb if thumbnail\n end", "def send_in_progress?\n !MediaObject.where(locked: true).empty?\n end", "def success?\n failed_mutations.empty?\n end", "def valid?(message)\n super do |payload|\n payload.get(:data, :code_fetcher, :info, :commit_sha) &&\n !payload.get(:data, :code_fetcher, :asset)\n end\n end", "def notify_prepare_commit\n raise NotImplementedError\n end", "def git_commit(message, fail_on_error = true)\n begin\n mysystem(\"git commit -m \\\"#{message}\\\" 2> /dev/null > /dev/null\")\n return true\n rescue Exception => e\n raise e if fail_on_error\n return false\n end\n end", "def check_gallery_status_message(gal_name, action = \"deleted\")\n wait = Selenium::WebDriver::Wait.new(:timeout => 15)\n begin\n m_t = wait.until { @browser.find_element(:xpath => \"//div[contains(@class, 'messages status')]\") }\n rescue\n m_t = wait.until { @browser.find_element(:xpath => \"//div[contains(@class, 'messages error')]\") }\n end\n message = m_t.text\n if (action == \"deleted\")\n expected_message = \"Gallery #{gal_name} has been deleted.\"\n elsif (action == \"blocks_update\")\n expected_message = \"The block settings have been updated.\"\n else\n expected_message = \"Gallery #{gal_name} has been updated.\"\n end\n message.should include(expected_message)\n end", "def createDevfile(f, commit) #:doc:\n \n dev_file = nil\n blob = nil\n b_in_c = nil\n \n # If file already exists, raises an error but nothing needs to be deleted (except the commit is cancelled)\n begin \n dev_file = Devfile.find_by_name_and_path_and_device_id(f['name'], f['path'], @device.id)\n if dev_file != nil\n puts \"Devfile: #{f['path'] + f['name']} already exits, cannot create, use update instead\"\n raise ArgumentError.new(\"Devfile already exits for this device, cannot use CREATE -method, use UPDATE instead to add new version\")\n end\n rescue Exception => e\n puts e.to_s\n puts e.backtrace[0].to_s\n raise e\n end\nputs \"name: #{f['name']}\"\nputs \"path: #{f['path']}\"\n \n # If something goes wrong, raises an error, and deletes the data created\n begin\n \n puts \"Creating new dev_file, blob etc..\"\n \n \n f_filedate = DateTime.strptime(f['filedate'], \"%T %F\")\n f_filedate = f_filedate.strftime('%F %T').to_s\n \n now = DateTime.now\n \n # get or create devfile\n dev_file = Devfile.find_or_create_by_name_and_path_and_device_id(f['name'], f['path'], @device.id)\n if dev_file.created_at >= now\n sql = \"update devfiles set filetype='#{f['filetype']}', path='#{f['path']}', privatefile=0 where id=#{dev_file.id}\" \n ActiveRecord::Base.connection.execute(sql)\n end\n \n # get or create blob\n blob = Blob.find_or_create_by_blob_hash_and_devfile_id(f['blob_hash'], dev_file.id)\n if blob.created_at >= now # if just created\n # Version number\n version = 0\n predecessor_blob_id = \"NULL\"\n follower_blob_id = \"NULL\"\n if dev_file.blob_id != nil\n predecessor_blob_id = dev_file.blobs.find_by_id(dev_file.blob_id) ? dev_file.blobs.find_by_follower_id(dev_file.blob_id).id.to_s : \"NULL\"\n follower_blob_id = dev_file.blobs.find_by_predecessor_id(blob.id) ? dev_file.blobs.find_by_predecessor_id(blob.id).id.to_s : \"NULL\"\n version = dev_file.blobs.find_by_id(dev_file.blob_id).version + 1 \n end\n \nputs \"predecessor_id=#{predecessor_blob_id.to_s},\"\nputs \"follower_id=#{follower_blob_id.to_s},\"\nputs \"size=#{f['size'].to_s},\" \nputs \"filedate='#{f_filedate.to_s}',\" \nputs \"version=#{version.to_s},\" \nputs \"uploaded='0',\" \nputs \"latitude=#{@commit_location['latitude'].to_s}, \" \nputs \"longitude=#{@commit_location['longitude'].to_s} \" \n \n sql = \"update blobs set predecessor_id=#{predecessor_blob_id.to_s}, follower_id=#{follower_blob_id.to_s}, size=#{f['size'].to_s}, filedate='#{f_filedate.to_s}', version=#{version.to_s}, uploaded='0', latitude=#{@commit_location['latitude'].to_s}, longitude=#{@commit_location['longitude'].to_s} where id=#{blob.id};\"\nputs \"sql: \" + sql\n \n ActiveRecord::Base.connection.execute(sql)\n end\n \n # Creates association between blob and commit\n b_in_c = BlobsInCommit.find_or_create_by_blob_id_and_commit_id(blob.id, commit.id)\n \n # update blob_id to devfile\n if dev_file.blob_id != blob.id\n sql = \"update devfiles set blob_id=#{blob.id} where id=#{dev_file.id};\"\n ActiveRecord::Base.connection.execute(sql)\n end\n \n \n #checkForObservers(dev_file)\n \n # If parent_blob_hash is given, tries to find the parent, and creates new branch form the parent\n if f['file_origin'] \n createBranch(f['file_origin'], blob)\n end\n\n rescue Exception => e\n puts \" -- Error in createDevfile: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n \n puts \"Deleting created data..\"\n \n # If dev_file was created now, deletes it\n dev_file.delete if dev_file\n puts \"Deleted created dev_file!\" if dev_file\n \n if blob \n if b_in_c\n BlobsInCommit.delete_all([\"commit_id = ? AND blob_id = ?\", b_in_c.commit_id.to_s, blob.blob_id.to_s])\n puts \"Deleted created blobs_in_commits!\" if b_in_c\n end\n blob.delete \n puts \"Deleted created blob!\"\n end\n \n # Throws forward the exception..\n raise e\n end\n puts \"File created\"\n return dev_file\n end", "def initial_commit?\n !Overcommit::Utils.execute(%w[git rev-parse HEAD]).success?\n end", "def initial_commit?\n !Overcommit::Utils.execute(%w[git rev-parse HEAD]).success?\n end", "def create_at_launch?\n volume_id.to_s.empty? && (not snapshot_id.to_s.empty?)\n end", "def check_if_encoded_and_get_thumbnail_urls(queue_again = false)\n details = self.vimeo_details\n return false if details.blank?\n # If it's already been tried twice just re-upload it\n if self.ecc >= 2\n self.ecc = 0\n self.redo_vimeo_transfer\n else\n # Set as transcoded if it has completed\n self.vimeod = true if details['is_transcoding'].to_i == 0\n # Save image thumbnails\n if details['thumbnails'].present? && details['thumbnails']['thumbnail'].present? && details['thumbnails']['thumbnail'].last['_content'].match(/default\\..*\\.jpg/) == nil\n self.remote_image_url = details['thumbnails']['thumbnail'].last['_content']\n elsif queue_again\n self.ecc += 1\n Resque.enqueue_in(20.minutes, Video, self.id) # queue to check and see if it got encoded\n false\n end\n self.save\n end\n end", "def test04_EmptyGPopDM\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"Media Description #{random}.\")\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PEV03T04: FAILED! UUser unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_now.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PEV03T04: FAILED! User able to Post.\")\n\t\t\t\tputs e\n\t\t\tend\t\n\t\tend", "def test03_EmptyGPopDM\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_media_description.exists?\n\t\t\t\t$post_media_description.set(\"Media Description #{random}.\")\n \t\t\t\tpostGroupPop\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\t$post_now.fire_event(\"onclick\")\n\t\t\telse puts \"PEV04T03: FAILED! User unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tsleep 2\n\t\t\tassert $post_new_post.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PEV04T03: FAILED! User unable to Post.\")\n\t\t\t\tputs e\n\t\t\tend\t\n\t\tend", "def test03_DraftEmptyGDM\n\t\t\tloginPost\n\t\t\t$browser.goto($patch_media)\n\t\t\tsleep 2\n\t\t\tif $post_media_button.exists?\n\t\t\t\t$post_media_button.click\n\t\t\t\t$post_media_file_upload.set(\"#{$post_media_username}/patch-automation/test/TestData/GlacierBasinTrailMtRainier.JPG\")\n\t\t\t\tsleep 2\n\t\t\t\tsleep 4\n\t\t\t\t$post_save_draft.fire_event(\"onclick\")\n\t\t\telse puts \"PDEV04T03: FAILED! User unable to locate Post button.\"\n\t\t\tend\n\t\t\t\n\t\t\tbegin\n\t\t\tassert $post_draft_error.exists?\n\t\t\t\trescue => e\n\t\t\t\tputs (\"PDEV04T03: FAILED! User able to save incomplete draft.\")\n\t\t\t\tputs e\n\t\t\tend\n\t\tend", "def git_upload_pack\n enqueue_fetch_statistics_update\n\n render_ok\n end", "def send_hashes(event)\n levels = MappackLevel.where('mappack_id > 0')\n count = levels.count\n res = levels.each_with_index.select{ |l, i|\n dbg(\"Hashing level #{i} / #{count}...\", newline: false, pad: true)\n !l.compare_hashes\n }.map{ |map, i| map.name }\n event << \"There are #{res.size} levels with differing hashes:\"\n res.size <= 20 ? event << format_block(res.join(\"\\n\")) : send_file(event, res.join(\"\\n\"))\nrescue => e\n lex(e, \"Error getting hash discrepancies.\", event: event)\nend", "def detectAutoGeneratedCover(coverlog, final_cover, archived_cover, logkey='')\n gen = false\n if File.file?(coverlog) and !File.file?(final_cover)\n gen = true\n Mcmlln::Tools.deleteFile(coverlog)\n Mcmlln::Tools.deleteFile(archived_cover)\n elsif File.file?(coverlog) and File.file?(final_cover)\n gen = false\n Mcmlln::Tools.deleteFile(coverlog)\n Mcmlln::Tools.deleteFile(archived_cover)\n elsif !File.file?(coverlog) and !File.file?(final_cover) and !File.file?(archived_cover)\n gen = true\n end\n return gen\nrescue => logstring\n return ''\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def image_exist(gallery_id, filename)\n gallery_id = \"Default\" if gallery_id.strip.empty?\n perform_with_session_expire_retry {\n auth_login unless logged_in?\n path = BSAPI+\"mem/image/query?format=xml\"\n boundary = Digest::MD5.hexdigest(gallery_id).to_s # just hash the collection_name itself\n headers = get_default_headers(\"Content-type\" => \"multipart/form-data, boundary=#{boundary}\")\n parts = []\n parts << key_value_to_multipart(\"gallery_id\", gallery_id)\n parts << key_value_to_multipart(\"file_name\", filename)\n body = combine_parts(parts, boundary)\n resp = @http.post(path, body, headers)\n handle_server_response(path, resp, resp.body)\n #@last_response_xml.write($stderr, 0)\n # dbgprint @last_response_xml.inspect\n exists = false\n total = 0\n total = @last_response_xml.get_elements(\"PhotoShelterAPI/data/total\").map {|e| e.text }.join\n if total.to_i > 0\n exists = true\n end\n #dbgprint \"image_exist('#{gallery_id}','#{filename}') = #{exists}\"\n exists\n }\n end", "def commit_and_check_proposal\n answer = proposal_commit(\n \"default\",\n in_queue: false,\n validate: false,\n validate_after_save: false\n )\n # check if error message is saved in one of the nodes\n if answer.first != 200\n found_errors = []\n Node.find(\"state:crowbar_upgrade\").each do |node|\n error = node[\"crowbar_wall\"][\"chef_error\"] || \"\"\n next if error.empty?\n found_errors.push error\n Rails.logger.error(\"Chef run ended with an error on the node #{node.name}: #{error}\")\n node[\"crowbar_wall\"][\"chef_error\"] = \"\"\n node.save\n end\n unless found_errors.empty?\n raise found_errors.join(\"\\n\")\n end\n end\n\n proposal = Proposal.where(barclamp: \"crowbar\", name: \"default\").first\n # there could be different error than one raised from a recipe\n if proposal[\"deployment\"][\"crowbar\"][\"crowbar-status\"] == \"failed\"\n raise proposal[\"deployment\"][\"crowbar\"][\"crowbar-failed\"]\n end\n end", "def append_blob(uri, msgs, file_path, blocks_committed)\n if msgs.size == 0\n return 0\n end\n\n # concatenate the messages\n msg = ''\n msgs.each { |s| msg << \"#{s}\\r\\n\" if s.to_s.length > 0 }\n dataSize = msg.length\n\n if dataSize == 0\n return 0\n end\n\n # append blocks\n # if the msg is longer than 4MB (to be safe, we use 4,000,000), we should break it into multiple blocks\n chunk_size = 4000000\n blocks_uncommitted = []\n while msg.to_s.length > 0 do\n chunk = msg.slice!(0, chunk_size)\n blocks_uncommitted << upload_block(uri, chunk)\n end\n\n # commit blocks\n etag = commit_blocks(uri, blocks_committed, blocks_uncommitted, file_path)\n return dataSize, etag\n end", "def thumbnailable?\n false\n end", "def initial_commit?; end", "def initial_commit?; end", "def check_files\n updated = []\n files.each do |filename, mtime| \n begin\n current_mtime = File.stat(filename).mtime\n rescue Errno::ENOENT\n # file was not found and was probably deleted\n # remove the file from the file list \n files.delete(filename)\n next\n end\n if current_mtime != mtime \n updated << filename\n # update the mtime in file registry so we it's only send once\n files[filename] = current_mtime\n puts \"quick_serve: spotted change in #{filename}\"\n end\n end\n QuickServe::Rails::Snapshot.reset if updated != []\n false\n end", "def process_mail(mail)\n @files_to_commit = []\n keyvals = {\n :tags => \"\", # a YAML array\n :markup => @blog.markup,\n :slug => nil,\n :published => true,\n :layout => \"post\",\n }\n\n subject = mail.subject\n\n return false unless is_subject_valid?(subject, keyvals)\n\n # vvv -- updates the contents of keyvals\n # and adds kevals[:title]\n keyvals = extract_data_from_subject(subject, keyvals)\n return false unless is_secret_valid?(@blog, keyvals[:secret], subject)\n @logger.log(\"XXX secret was valid\")\n keyvals = update_and_infer_keyvals(@blog, keyvals)\n body = \"\"\n images_needing_replacement = {}\n if mail.multipart?\n #vvv updates images_needing_replacement\n body = process_multipart_mail(mail, body, images_needing_replacement, keyvals)\n else\n #Just grab the body no matter what it is\n body = mail.body.decoded\n end\n #If we have no body after all that, bail\n @logger.log(\"XXX will return if body empty\")\n return false if body.strip.empty?\n\n @logger.log(\"XXX body wasn't empty\")\n\n body = cleanup_html_and_replace_images(\n body,\n keyvals[:markup],\n images_needing_replacement\n )\n\n @logger.log(\"XXX calling write_to_disk\")\n write_to_disk(body, keyvals)\n @logger.log(\"XXX wrote to disk\")\n\n log_files_to_commit(@files_to_commit) if @files_to_commit.size > 0\n\n\n if @blog.add_to_git? and @files_to_commit.size() > 0\n @blog.commit(@files_to_commit, keyvals[:slug])\n end\n\n return @files_to_commit.size > 0\n end", "def send_post_commit_mail(revision)\n body = post_commit_html(revision)\n mail = Emailer.create_svn_mail(config.mails,revision.subject,revision.number,body,revision.patch)\n Emailer.deliver(mail)\nend", "def successful_conversion?\n source = File.join(\"tmp\", \"#{@user.screen_name}_full_size\")\n full_size = File.join(DIRECTORY, filename)\n thumbnail = File.join(DIRECTORY, thumbnail_name)\n File.open(source, \"wb\") { |f| f.write(@image.read) }\n img = system(\"#{convert} #{source} -resize #{IMG_SIZE} #{full_size}\")\n thumb = system(\"#{convert} #{source} -resize #{THUMB_SIZE} #{thumbnail}\")\n File.delete(source) if File.exists?(source)\n unless img and thumb\n errors.add_to_base(\"File upload failed: Try a different image\")\n return false\n end\n return true\n end", "def verify_local_screenshots_are_uploaded(iterator, screenshots_per_language)\n # Check if local screenshots' checksum exist on App Store Connect\n checksum_to_app_screenshot = iterator.each_app_screenshot.map { |_, _, app_screenshot| [app_screenshot.source_file_checksum, app_screenshot] }.to_h\n\n number_of_screenshots_per_set = {}\n missing_local_screenshots = iterator.each_local_screenshot(screenshots_per_language).select do |_, app_screenshot_set, local_screenshot|\n number_of_screenshots_per_set[app_screenshot_set] ||= (app_screenshot_set.app_screenshots || []).count\n checksum = UploadScreenshots.calculate_checksum(local_screenshot.path)\n\n if checksum_to_app_screenshot[checksum]\n next(false)\n else\n is_missing = number_of_screenshots_per_set[app_screenshot_set] < 10 # if it's more than 10, it's skipped\n number_of_screenshots_per_set[app_screenshot_set] += 1\n next(is_missing)\n end\n end\n\n missing_local_screenshots.each do |_, _, screenshot|\n UI.error(\"#{screenshot.path} is missing on App Store Connect.\")\n end\n\n missing_local_screenshots.empty?\n end", "def tx_commit\n write_bytes FrameBytes.tx_commit(@id)\n expect :tx_commit_ok\n nil\n end", "def check_gallery_status_message(gal_name, action = \"deleted\", _browser = @browser)\n wait = Selenium::WebDriver::Wait.new(:timeout => 10)\n message = wait.until { _browser.find_element(:xpath => \"//div[contains(@class, 'messages status')]\") }.text\n if (action == \"deleted\")\n expected_message = \"Gallery #{gal_name} has been deleted.\"\n elsif (action == \"blocks_update\")\n expected_message = \"The block settings have been updated.\"\n else\n expected_message = \"Gallery #{gal_name} has been updated.\"\n end\n Log.logger.info(\"Confirmation Message '#{message}' not correct, therefore #{action} action gallery might not have been executed.\") unless expected_message.include?(message)\n end", "def exists?(params = {})\n response = client.get \"/_snapshot/{repository}/{snapshot}\", update_params(params, action: \"snapshot.exists\", rest_api: \"snapshot.get\")\n response.success?\n rescue ElastomerClient::Client::Error => err\n if err.error && err.error.dig(\"root_cause\", 0, \"type\") == \"snapshot_missing_exception\"\n false\n else\n raise err\n end\n end", "def before_save\n changed_fields?\n if(@changed_fields && @changed_fields.keys.include?('rmt_product_id') && ((bins = Bin.find_all_by_delivery_id(self.id)).length>0))\n raise \"sorry cannot change rmt_product of this delivery , #{bins.length} bin(s) have already been scanned for this delivery\"\n end\n puts\n end", "def try_freeze(msg, allow_empty=false)\n @git.add_all\n @git.execute(%Q[commit -m \"#{msg}\"#{allow_empty ? \" --allow-empty\" : \"\"}])\n @git.head_sha\n end", "def needs_commit?(dir = Dir.pwd, file = nil)\n rval = false\n Dir.chdir(dir) do\n status = %x{git status}\n if file.nil?\n rval = true unless status =~ /nothing to commit \\(working directory clean\\)|nothing added to commit but untracked files present/\n if status =~ /nothing added to commit but untracked files present/\n puts \"WARNING: untracked files present in #{dir}\"\n show_changed_files(status)\n end\n else\n rval = true if status =~ /^#\\t.*modified: #{file}/\n end\n end\n rval\nend", "def already_uploaded?\n false\n seen_before = Zaphod::PhotoStorage.get(\"seen_id_#{@post_id}\",\"recommendation\")\n if seen_before && seen_before == @post_id\n @log.debug(\"already uploaded ID #{seen_before}... skipping\")\n true\n end\n end", "def commit; end", "def commit; end", "def commit; end", "def has_failed_upload?\n num_uploads = tasks.upload.count\n num_complete_uploads = tasks.upload.with_status(Task::COMPLETE).count\n num_valid_uploads = tasks.upload.valid.count # i.e. not-cancelled\n num_cancelled_uploads = num_uploads - num_valid_uploads\n\n # easy cases first\n return false if num_uploads == 0\n return false if num_complete_uploads == num_uploads\n return false if num_complete_uploads > 1\n return true if num_cancelled_uploads == num_uploads\n\n return false # conservative default\n end", "def forced_commit(mails,body)\n subject 'Forced commit realized'\n from 'svnadmin@ithol'\n recipients mails\n content_type 'text/html'\n body body\n end", "def commit_sha\n nil\n end", "def file_in_repo?(js_name)\n # Start-Open3\n Open3.popen3(\"git ls-files #{js_name} --error-unmatch\") do |stdin, stdout, stderr|\n # Start-If: Check if job script is committed in git repo \n if stderr.read.empty?\n return true\n else\n puts \"Please commit #{js_name} to the repository before qsub-ing it!\"\n return false\n end\n # End-If Check if job script is committed in git repo\n end\nend", "def incomplete?\r\n ![BatchStatus::OUTPUT_READY, BatchStatus::OUTPUT_GENERATED, BatchStatus::OUTPUT_EXCEPTION].include?(status)\r\n end", "def commit_file\n if @upload.public? && @upload.file_type.public? && @upload.address.blank? && (@upload.creating? || @upload.failed?)\n BlockchainCommitJob.perform_later(@upload.id)\n end\n end", "def verify_update_file\n @log.info('Beginning integrity check of downloaded file .')\n @file_sha1 = Digest::SHA1.file(@update_file.path).hexdigest\n\n @log.info('Verifying integrity of downloaded file.')\n\n if download_remote_sha1 == @file_sha1\n @log.info('Integrity verified.')\n true\n else\n abort('File was not downloaded correctly. Please try again.')\n end\n end", "def verify_user_for_changes!\n\n unless @item.editable_by_user?(auth_user)\n status_error = @item.errors[:status].present? ? @item.errors[:status].join(' ') : nil\n flash[:error] = status_error || \"You do not have permission to the item.\"\n redirect_back(items_path) && return\n\n else\n if ItemPhoto.over_the_limit?(@item)\n flash[:notice] = \"The images over the limit will be discarded.\"\n end\n end\n\n end", "def exam_been_uploaded?\n self.split_pdf_logs.exists?\n end", "def verify_commits expected_commits\n expected_commits.diff! commits_in_current_repo(expected_commits.headers)\nend", "def fill_in_missing_transcriptions\n text=\" \\n\"\n empty_items=self.master_files.where(:transcription_text => nil)\n if empty_items.count > 0\n empty_items.each do |item|\n item.transcription_text=text unless item.transcription_text\n item.save! \n item.reload\n if item.exists_in_repo?\n Fedora.add_or_update_datastream(item.transcription_text, item.pid,\n 'transcription', 'Transcription', :contentType => 'text/plain',\n :mimeType => 'text/plain', :controlGroup => 'M')\n end\n end\n end\n end", "def verify_hash_action_notify( file )\n hash = @hasher.generate_hash( file )\n res = @dbase.search_hashes( file ) \n\n unless hash.to_s.eql?( res[\"hash\"] ) \n \n puts \"Host:\\t\\t#{res[\"host\"]}\"\n puts \"File:\\t\\t#{file}\"\n puts \"Database date:\\t#{res[\"date\"]}\"\n puts \"Current date:\\t#{Time.now}\"\n puts \"Old hash:\\t#{res[\"algo\"]},\\t#{res[\"hash\"]}\"\n puts \"New hash:\\t#{@hasher.algo},\\t#{hash.to_s}\"\n puts \"\"\n \n end\nend" ]
[ "0.56348634", "0.55705476", "0.54291606", "0.539609", "0.5383907", "0.5365913", "0.53337544", "0.5283248", "0.52613395", "0.52486324", "0.52453136", "0.5227515", "0.52217984", "0.5221655", "0.5173013", "0.5149498", "0.51455617", "0.5126359", "0.51229066", "0.51177406", "0.5116962", "0.5110167", "0.5097296", "0.50874484", "0.5059925", "0.5037299", "0.5034488", "0.5029863", "0.5025966", "0.5017021", "0.5013076", "0.5011499", "0.4993348", "0.49809465", "0.49723798", "0.49608338", "0.4960634", "0.49582937", "0.49535462", "0.49383414", "0.4933195", "0.49254277", "0.4913442", "0.49039388", "0.49036312", "0.4878572", "0.48735484", "0.48638302", "0.48533052", "0.48453447", "0.48441926", "0.4842761", "0.48406273", "0.48389676", "0.4825222", "0.48172632", "0.48170137", "0.4811106", "0.4811106", "0.48091003", "0.4807693", "0.47985816", "0.47786796", "0.47754544", "0.477333", "0.476736", "0.47642636", "0.4761766", "0.47588477", "0.4753805", "0.4752627", "0.47498584", "0.47498584", "0.47489166", "0.47455692", "0.473718", "0.472781", "0.47215506", "0.47208768", "0.47161818", "0.47159353", "0.47136173", "0.46998692", "0.46977052", "0.4695893", "0.46956262", "0.46956262", "0.46956262", "0.4693017", "0.46920758", "0.46899343", "0.46850336", "0.46827486", "0.4678987", "0.46789247", "0.46766105", "0.46751165", "0.46691614", "0.4664677", "0.46643725" ]
0.7809339
0
Checks that all necessary http parameters are given. parameters: username, password, devicename and dev_type. port is optionla, but if given must be a number. Returns false is some of the parameters is missing or is in wrong form. Returns true if parameters are fine. register uses this method.
def check_params #:doc: if params[:username] !~ /.{1,}/ or params[:password] !~ /.{1,}/ or params[:devicename] !~ /.{1,}/ or params[:dev_type] !~ /.{1,}/ or (params[:port] != nil and params[:port] !~ /\d{1,10}/) return false else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end", "def _checkParams(node_number, port, slaveof)\n valid = node_number.is_a?(Fixnum) && port.is_a?(Fixnum) && ( slaveof.nil? || slaveof.is_a?(String))\n unless valid\n raise TypeError, \"Invalid Params\"\n end\n end", "def valid?(params)\n # Make sure the website is a passed in param.\n unless params['website'] && given?(params['website'])\n return false\n end\n\n # Make sure the width is a passed in param.\n unless params['width'] && given?(params['width'])\n return false\n end\n\n # Make sure the height is a passed in param.\n unless params['height'] && given?(params['height'])\n return false\n end\n\n true\nend", "def valid?\n return false if @domain.nil?\n return false if @domain.to_s.length > 64\n return false if @register_server.nil?\n transport_protocol_validator = EnumAttributeValidator.new('String', ['UDP', 'TCP', 'TLS', 'AUTO'])\n return false unless transport_protocol_validator.valid?(@transport_protocol)\n return false if @proxy_server.nil?\n transport_protocol2_validator = EnumAttributeValidator.new('String', ['UDP', 'TCP', 'TLS', 'AUTO'])\n return false unless transport_protocol2_validator.valid?(@transport_protocol2)\n transport_protocol3_validator = EnumAttributeValidator.new('String', ['UDP', 'TCP', 'TLS', 'AUTO'])\n return false unless transport_protocol3_validator.valid?(@transport_protocol3)\n return false if !@registration_expire_time.nil? && @registration_expire_time > 127\n return false if !@registration_expire_time.nil? && @registration_expire_time < 1\n return false if @user_name.nil?\n return false if @user_name.to_s.length > 64\n return false if @password.nil?\n return false if @authorization_name.nil?\n return false if @authorization_name.to_s.length > 64\n return false if @user_email.nil?\n return false if @user_email.to_s.length > 64\n return false if @voice_mail.nil?\n return false if @voice_mail.to_s.length > 255\n true\n end", "def arguments_valid?\n if @arguments.length == 1\n @options.port = @arguments[0].to_i\n return true\n end\n @arguments.length == 0\n end", "def valid_http_auth?\n controller.authenticate_with_http_basic do |login, password|\n if !login.blank? && !password.blank?\n send(\"#{login_field}=\", login)\n send(\"#{password_field}=\", password)\n return valid?\n end\n end\n \n false\n end", "def validate_parameters\n if (latitude.to_f == 0.0) || (longitude.to_f == 0.0)\n render :status=>401,\n :json=>{:Message=>\"The latitude and longitude parameters should be float values.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if (location_lock != \"true\") || (location_lock != \"false\")\n render :status=>401,\n :json=>{:Message=>\"The location_lock should be either true or false.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if proximity.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The proximity should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n if page.to_i == 0\n render :status=>401,\n :json=>{:Message=>\"The page should be an integer.\",\n :Response => \"Fail\",\n :Data => nil} \n end\n end", "def read_and_validate_params\n if @name_args.length < 1\n show_usage\n exit 1\n end\n\n if config[:hostname].nil? ||\n config[:username].nil? ||\n config[:flavor].nil? ||\n config[:password].nil? ||\n config[:main_network_adapter].nil?\n show_usage\n exit 1\n end\n\n if config[:guest_dhcp].eql? false\n if config[:guest_ip].nil? ||\n config[:guest_gateway].nil? ||\n config[:guest_netmask].nil? ||\n config[:guest_nameserver].nil?\n ui.fatal \"When using a static IP, you must specify the IP, Gateway, Netmask, and Nameserver\"\n exit 1\n end\n end\n\n end", "def check_params; true; end", "def validateParams \r\n\t \r\n\t \tif !@data.nil? && !@key.nil? && !@cipher.nil?\r\n\t\t\treturn true\r\n\t \telse\r\n\t\t\treturn false \t\r\n\t \tend\r\n\t \t\r\n\t end", "def verify_parameters\n # TODO: rails 3 and activemodel validation\n parts = (params[:mask].to_s.split('@', 2) + [params[:nick], params[:url]])\n if parts.length != 4 || params.any?(&:blank?)\n render :text => \"Invalid submission\", :status => 400\n return false\n end\n end", "def valid_user?\n params['username'] && params['password']\n end", "def validate\n [@user,@pass,@host,@db].each { |param|\n raise \"Insufficient parameters to connect to MySQL Database!\" if param.nil?\n }\n end", "def valid?\n\t\tparams['user'] && params['user']['username'] && params['user']['password']\n\tend", "def validates?\n # include the params to validate our request\n request_params = denormalize params.merge({\n :Comando => \"validar\",\n :Token => @token || PagSeguro.config[\"authenticity_token\"]\n }).dup\n\n return true if PagSeguro.developer?\n\n # do the request\n uri = URI.parse(API_URL)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.path)\n request.set_form_data request_params\n response = http.start {|r| r.request request }\n (response.body =~ /VERIFICADO/) != nil\n end", "def valid_params_request?\n true\n end", "def valid_params_request?\n true\n end", "def login_is_valid\n username = params[\"uname\"]\n password = params[\"psw\"]\n\n if username == \"admin\" && password == \"password\"\n return true\n else\n return false\n end\nend", "def require_http_auth\n if `hostname` =~ /soykaf|lanpartei/i \n if auth = APP_CONFIG['http_auth']\n authenticate_or_request_with_http_basic do |user_name, password|\n user_name == auth['name'] && password == auth['password']\n end \n end\n end\n end", "def validate_parameters?\n opts = OptionParser.new\n opts.parse!(@parameters) rescue return false\n @parameters.length >= 2\n end", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 30\n return false if @management_it_solution_type.nil?\n management_it_solution_type_validator = EnumAttributeValidator.new('String', [\"LevelPlatforms\", \"Kaseya\", \"NAble\", \"Continuum\", \"Custom\"])\n return false unless management_it_solution_type_validator.valid?(@management_it_solution_type)\n return false if !@management_solution_name.nil? && @management_solution_name.to_s.length > 30\n return false if !@management_server_url.nil? && @management_server_url.to_s.length > 200\n return false if !@webservice_override_url.nil? && @webservice_override_url.to_s.length > 200\n return false if !@portal_override_login_url.nil? && @portal_override_login_url.to_s.length > 200\n return false if !@global_login_username.nil? && @global_login_username.to_s.length > 50\n return false if !@global_login_password.nil? && @global_login_password.to_s.length > 50\n return false if !@n_able_username.nil? && @n_able_username.to_s.length > 50\n return false if !@n_able_password.nil? && @n_able_password.to_s.length > 50\n return false if !@continuum_api_username.nil? && @continuum_api_username.to_s.length > 100\n return false if !@continuum_api_password.nil? && @continuum_api_password.to_s.length > 100\n return false if !@level_api_username.nil? && @level_api_username.to_s.length > 100\n return false if !@level_api_password.nil? && @level_api_password.to_s.length > 100\n return false if !@level_var_domain.nil? && @level_var_domain.to_s.length > 100\n return true\n end", "def valid?\n params['user'] && params['user']['username'] && params['user']['password']\n end", "def allowed_http?\n port_protocol_allowed('80')\n end", "def check_port(v)\n return v unless v\n\n if @opaque\n raise InvalidURIError,\n \"can not set port with registry or opaque\"\n elsif !v.kind_of?(Integer) && parser.regexp[:PORT] !~ v\n raise InvalidComponentError,\n \"bad component(expected port component): #{v.inspect}\"\n end\n\n return true\n end", "def valid_params?(params)\n params.keys.each do |key|\n unless RealPush::API::App.params_accept.include? key.to_sym\n raise ConfigurationError, \"Invalid parameter! ( #{RealPush::API::App.params_accept.join(', ')} )\"\n end\n end\n true\n end", "def valid?\n return false if !@display_name.nil? && @display_name.to_s.length > 255\n return false if !@description.nil? && @description.to_s.length > 1024\n return false if @tcp_closed.nil?\n return false if @tcp_closed > 4320000\n return false if @tcp_closed < 10\n return false if @tcp_opening.nil?\n return false if @tcp_opening > 4320000\n return false if @tcp_opening < 10\n return false if @udp_single.nil?\n return false if @udp_single > 4320000\n return false if @udp_single < 10\n return false if @tcp_finwait.nil?\n return false if @tcp_finwait > 4320000\n return false if @tcp_finwait < 10\n return false if @tcp_first_packet.nil?\n return false if @tcp_first_packet > 4320000\n return false if @tcp_first_packet < 10\n return false if @tcp_closing.nil?\n return false if @tcp_closing > 4320000\n return false if @tcp_closing < 10\n return false if @tcp_established.nil?\n return false if @tcp_established > 4320000\n return false if @tcp_established < 120\n return false if @udp_multiple.nil?\n return false if @udp_multiple > 4320000\n return false if @udp_multiple < 10\n return false if @icmp_error_reply.nil?\n return false if @icmp_error_reply > 4320000\n return false if @icmp_error_reply < 10\n return false if @udp_first_packet.nil?\n return false if @udp_first_packet > 4320000\n return false if @udp_first_packet < 10\n return false if @icmp_first_packet.nil?\n return false if @icmp_first_packet > 4320000\n return false if @icmp_first_packet < 10\n true\n end", "def valid_parionsdirect_account_params?\n status = true\n if @pseudo.blank? || @firstname.blank? || @lastname.blank? || @email.blank? || @password.blank? || @password_confirmation.blank? || @birthdate.blank?\n status = false\n end\n\n return status\n end", "def username_and_password?\n params[:username].present? && params[:password].present?\n end", "def check_options\n unless @options[:stub]\n STDERR.puts \"Please specify a host to connect to using --host\" unless @options[:host]\n STDERR.puts \"Please specify a model to check using --model\" unless @options[:model]\n return false unless @options[:host] && @options[:model]\n end\n\n true\n end", "def validate_registeration_params\n\n return success if @client_token.registration_done?\n\n @airdrop_amount = @airdrop_amount.present? ? BigDecimal.new(@airdrop_amount) : @airdrop_amount\n @ost_to_bt = @ost_to_bt.present? ? BigDecimal.new(@ost_to_bt) : @ost_to_bt\n @number_of_users = @number_of_users.to_i\n\n return error_with_data(\n 'e_sam_8',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if @ost_to_bt.blank? || @bt_to_mint < 0\n\n return error_with_data(\n 'e_sam_11',\n 'invalid_api_params',\n GlobalConstant::ErrorAction.default\n ) if GlobalConstant::Base.sandbox_sub_environment? &&\n (@number_of_users < 0 || @airdrop_amount.blank? || @airdrop_amount < 0 || @airdrop_user_list_type.blank?)\n\n success\n\n end", "def check_initialization_params(params={})\n raise ArgumentError, \"You must provide Billwise connection parameters.\" if params.length == 0\n %w(companyCd username password).each { |param| raise ArgumentError, \"You must provide a valid #{param}.\" if params[param.to_sym].nil? }\n end", "def param_is_valid?\n robot_facings = @robot.class.const_get(:AVAIABLE_FACING).map(&:to_s)\n\n !(@args =~ /^\\d+,\\d+,(#{robot_facings.join('|').upcase})+$/).nil?\n end", "def creating_vault_validation_length(params)\n if params[\"Username\"].length > 0 and params[\"Password\"].length > 0\n return true\n else \n return false\n end \n end", "def http?\n type == :basic || type == :digest\n end", "def valid_for_params_auth?; end", "def can_rest?\n return false if driver_options[:ssh_options] && driver_options[:ssh_user]\n\n _, host, port = driver_url.split \":\", 3\n host != \"localhost\" || port.to_i > 0\n end", "def option_httpchk(params = nil)\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"option httpchk \" + params.to_s + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def valid?\n !Kontagent.configuration.base_url.nil? && !Kontagent.configuration.api_key.nil? && !Kontagent.configuration.secret_key.nil? \n end", "def check_config_params\n unless params[:redirect_uri] =~ %r{\\Ahttps?://(rapportive\\.com|rapportive\\.jelzo\\.com|localhost)(:\\d+)?/raplets/} &&\n params[:response_type] == 'token' && params[:client_id] == 'rapportive'\n raise \"invalid configuration parameters\"\n end\n end", "def check_params\n true\n end", "def original_is_valid?\n valid_host? && valid_length? && valid_scheme?\n end", "def valid_for_http_auth?; end", "def valid?\n return false if @account.nil?\n return false if @name.nil?\n return false if !@port_restriction.nil? && @port_restriction > 65535\n return false if !@port_restriction.nil? && @port_restriction < 1\n return false if @site_assignment.nil?\n true\n end", "def arguments_valid?\n valid_args = true\n valid_args = false if @options.min > @options.max\n valid_args = false if @options.user && !@options.password\n valid_args = false if @options.password && !@options.user\n valid_args\n end", "def validate_parameters?(op)\n temp_params = op.temporary[:plan_params]\n errors_noted = \"The following parameters for plan #{op.plan.id} have errors: \"\n er = false\n if temp_params[:fluorescent_marker]\n errors_noted.concat(\"dark_light invalid\") && er = true if !static_params[:dark_light_options].include? temp_params[:dark_light]\n errors_noted.concat(\"marker_type not supported\") && er = true if !static_params[:marker_type_options].include? temp_params[:marker_type]\n end\n op.error :invalid_parameters, errors_noted if er\n op.temporary[:valid_params?] = !er\n end", "def valid_params_request?; end", "def validateurl(myparameters)\n myparameters.each do |columnname, value|\n wheresqlstatement = columnname.to_s + \" = '\" + value + \"'\"\n if columnname.to_s == \"name\"\n existcheck = Teacher.all.where(wheresqlstatement).ids\n elsif columnname.to_s == \"coursename\"\n existcheck = Course.all.where(\"name = '\" + value + \"'\").ids\n else\n existcheck = Course.all.where(wheresqlstatement).ids\n end\n #If existcheck has no results, then the url parameter doesn't exist\n if existcheck.size() == 0\n respond_to do |format|\n format.html { render :file => \"#{Rails.root}/public/404\", :layout => false, :status => :not_found }\n format.xml { head :not_found }\n format.any { head :not_found }\n end\n return false\n end\n end\n return true\n end", "def check_params(mode = false)\n endpoint_info[:check_params] = mode\n end", "def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:filename].blank? &&\n !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end", "def validate_parameters(platform, browser_type, app_path)\n if platform == 'desktop'\n if !%w(ff ie chrome safari opera).include? browser_type\n print_error_desktop\n end\n elsif platform == 'android'\n print_error_android browser_type, app_path\n elsif platform == 'iOS'\n puts \"Not Implemented...\"\n # print_error_ios browser_type, app_path\n else\n print_invalid_platform\n end\nend", "def check_configuration_options\r\n if ($project_name == \"\")\r\n\t raise 'Project name must be set' \r\n\tend\r\n\tif ($repo_key == \"\")\r\n raise 'Repository is required'\r\n end\r\n\tif ($target_repo_key == \"\")\r\n raise 'Target repository is required'\r\n\tend\r\n\tif ($username == \"\")\r\n raise 'Codeporting username must be provided'\r\n\tend\r\n\tif ($password == \"\")\r\n raise 'Codeporting password must be provided'\r\n\tend\r\n end", "def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end", "def auth_provided?\n !username.nil? && !password.nil?\n end", "def validate_server(name)\n return true unless name # if no name is provided, just go with the defaults\n valid = name.is_a? String\n begin\n u = URI.parse(name)\n valid = false unless u.class == URI::HTTP || u.class == URI::HTTPS\n rescue URI::InvalidURIError\n valid = false\n end\n valid || raise(Exceptions::InvalidOptions, 'Invalid server')\n end", "def valid?\n @errors = []\n @errors << 'unique_id is required' if @unique_id.nil? && @response_type.eql?('NVP')\n @errors << 'developer_id is required' if @developer_id.nil? && @response_type.eql?('JSON')\n @errors << 'app_key is required' if @app_key.nil?\n @errors << 'cmd is required' if @cmd.nil?\n @errors << 'response_type is required' if @response_type.nil?\n @errors.empty?\n end", "def valid?\n return false if @identifier.nil?\n return false if @identifier.to_s.length > 25\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @status.nil?\n return false if @type.nil?\n return false if @address_line1.nil?\n return false if @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if !@city.nil? && @city.to_s.length > 50\n return false if !@state.nil? && @state.to_s.length > 50\n return false if !@zip.nil? && @zip.to_s.length > 12\n return false if !@phone_number.nil? && @phone_number.to_s.length > 30\n return false if !@fax_number.nil? && @fax_number.to_s.length > 30\n return false if !@website.nil? && @website.to_s.length > 255\n return false if !@account_number.nil? && @account_number.to_s.length > 100\n return false if !@lead_source.nil? && @lead_source.to_s.length > 50\n return false if !@user_defined_field1.nil? && @user_defined_field1.to_s.length > 50\n return false if !@user_defined_field2.nil? && @user_defined_field2.to_s.length > 50\n return false if !@user_defined_field3.nil? && @user_defined_field3.to_s.length > 50\n return false if !@user_defined_field4.nil? && @user_defined_field4.to_s.length > 50\n return false if !@user_defined_field5.nil? && @user_defined_field5.to_s.length > 50\n return false if !@user_defined_field6.nil? && @user_defined_field6.to_s.length > 50\n return false if !@user_defined_field7.nil? && @user_defined_field7.to_s.length > 50\n return false if !@user_defined_field8.nil? && @user_defined_field8.to_s.length > 50\n return false if !@user_defined_field9.nil? && @user_defined_field9.to_s.length > 50\n return false if !@user_defined_field10.nil? && @user_defined_field10.to_s.length > 50\n return true\n end", "def validate_params?\n true # TODO: add validation\n end", "def validate_parameters params = {}\n params.symbolize_keys!\n params.delete(:db) unless DBS.include?(params[:db].try(:to_sym))\n params.delete(:report_type) unless REPORT_TYPES.include?(params[:report_type].try(:to_sym))\n params.delete(:request_type) unless REQUEST_TYPES.include?(params[:request_type].try(:to_sym))\n @parameters = {:db => \"us\", :api_key => Semrush.api_key, :limit => \"\", :offset => \"\", :export_columns => \"\", :display_sort => \"\", :display_filter => \"\", :display_date => \"\"}.merge(@parameters).merge(params)\n raise Semrush::Exception::Nolimit.new(self, \"The limit parameter is missing: a limit is required.\") unless @parameters[:limit].present? && @parameters[:limit].to_i>0\n raise Semrush::Exception::BadArgument.new(self, \"Request parameter is missing: Domain name, URL, or keywords are required.\") unless @parameters[:request].present?\n raise Semrush::Exception::BadArgument.new(self, \"Bad db: #{@parameters[:db]}\") unless DBS.include?(@parameters[:db].try(:to_sym))\n raise Semrush::Exception::BadArgument.new(self, \"Bad report type: #{@parameters[:report_type]}\") unless REPORT_TYPES.include?(@parameters[:report_type].try(:to_sym))\n raise Semrush::Exception::BadArgument.new(self, \"Bad request type: #{@parameters[:request_type]}\") unless REQUEST_TYPES.include?(@parameters[:request_type].try(:to_sym))\n end", "def failed?\n false if @opts[:help]\n true if @opts[:get].nil?\n true if @opts[:token].nil? && @opts[:user].nil?\n true if @opts[:token].nil? && @opts[:pass].nil?\n end", "def valid_params?(name, size)\n return raise TypeError.new(\"A 'name' should be a string\") if name.class != String\n return raise TypeError.new(\"A 'size' should be an integer\") if size.class != Integer\n\n true\n end", "def validate_options(options = {})\n base_unity_url = options.fetch(:base_unity_url, @base_unity_url)\n username = options.fetch(:username, @username)\n password = options.fetch(:password, @password)\n appname = options.fetch(:appname, @appname)\n\n raise ArgumentError, 'base_unity_url can not be nil' if base_unity_url.nil?\n raise ArgumentError, 'username can not be nil' if username.nil?\n raise ArgumentError, 'password can not be nil' if password.nil?\n raise ArgumentError, 'appname can not be nil' if appname.nil?\n end", "def valid_component_op?(addr, user, password, http_resp, expected_state, pid, hc_params)\n # Check if POST request was successful\n if http_resp.code != '200'\n Chef::Log.error(\n \"OSGi component action ended with #{http_resp.code} code (expected 200) and #{http_resp.body} body\"\n )\n return false\n end\n\n max_checks = 4\n\n # Call API again to check component state\n max_checks.times do |i|\n info = component_get(addr, user, password, pid)\n Chef::Log.debug(\n \"[#{i + 1}/#{max_checks}] Current component info: #{info}\"\n )\n\n return true if info['state'] == expected_state\n\n sleep hc_params['sleep_time']\n\n Chef::Log.error(\n \"Expected #{expected_state} state, but got #{info['state']} after #{max_checks} checks\"\n ) if i == max_checks - 1\n end\n\n false\n end", "def valid?\n return false if !@token.nil? && @token.to_s.length > 36\n return false if !@token.nil? && @token.to_s.length < 1\n return false if !@notes.nil? && @notes.to_s.length > 255\n return false if !@notes.nil? && @notes.to_s.length < 0\n return false if !@ip_address.nil? && @ip_address.to_s.length > 39\n return false if !@ip_address.nil? && @ip_address.to_s.length < 0\n return false if !@password.nil? && @password.to_s.length > 255\n return false if !@password.nil? && @password.to_s.length < 0\n return false if !@phone.nil? && @phone.to_s.length > 255\n return false if !@phone.nil? && @phone.to_s.length < 0\n return false if !@account_holder_group_token.nil? && @account_holder_group_token.to_s.length > 36\n return false if !@account_holder_group_token.nil? && @account_holder_group_token.to_s.length < 0\n return false if !@business_name_legal.nil? && @business_name_legal.to_s.length > 255\n return false if !@business_name_legal.nil? && @business_name_legal.to_s.length < 0\n return false if !@business_name_dba.nil? && @business_name_dba.to_s.length > 255\n return false if !@business_name_dba.nil? && @business_name_dba.to_s.length < 0\n return false if !@website.nil? && @website.to_s.length > 255\n return false if !@website.nil? && @website.to_s.length < 0\n return false if !@general_business_description.nil? && @general_business_description.to_s.length > 255\n return false if !@general_business_description.nil? && @general_business_description.to_s.length < 0\n return false if !@history.nil? && @history.to_s.length > 255\n return false if !@history.nil? && @history.to_s.length < 0\n return false if !@business_type.nil? && @business_type.to_s.length > 255\n return false if !@business_type.nil? && @business_type.to_s.length < 0\n return false if !@international_office_locations.nil? && @international_office_locations.to_s.length > 255\n return false if !@international_office_locations.nil? && @international_office_locations.to_s.length < 0\n return false if !@taxpayer_id.nil? && @taxpayer_id.to_s.length > 255\n return false if !@taxpayer_id.nil? && @taxpayer_id.to_s.length < 0\n return false if !@duns_number.nil? && @duns_number.to_s.length > 255\n return false if !@duns_number.nil? && @duns_number.to_s.length < 0\n return false if !@attester_name.nil? && @attester_name.to_s.length > 64\n return false if !@attester_name.nil? && @attester_name.to_s.length < 0\n return false if !@attester_title.nil? && @attester_title.to_s.length > 64\n return false if !@attester_title.nil? && @attester_title.to_s.length < 0\n true\n end", "def valid?(params)\n true\n end", "def check_parameters\n update_param_version_ar()\n @param_version_db = @bot_dbaccess.read_parameter_with_default('PARAM_VERSION', 0)\n compare_and_write_parameters()\n end", "def valid?\n return false if !@login_name.nil? && @login_name.to_s.length > 100\n return false if !@name.nil? && @name.to_s.length > 100\n return false if !@shop_name.nil? && @shop_name.to_s.length > 100\n true\n end", "def validate_create_user(params)\n params[\"username\"].length < 25 and params[\"password\"].length < 25\n end", "def check_parameters\n\n # read the parameter version in the database and in the device \n read_parameter_from_device(0)\n @params.each do |p|\n if p['id'] == 0\n @param_version_ar = p['value_ar']\n end\n end\n\n @param_version_db = @bot_dbaccess.read_parameter_with_default('PARAM_VERSION', 0)\n\n # if the parameters in the device is different from the database parameter version\n # read and compare each parameter and write to device is different\n if @param_version_db != @param_version_ar\n load_param_values_non_arduino()\n differences_found_total = false\n @params.each do |p|\n if p['id'] > 0\n difference = check_and_write_parameter(p)\n if difference then\n @params_in_sync = false\n differences_found_total = true\n end\n end\n end\n if !differences_found_total\n @params_in_sync = true\n write_parameter_to_device(0, @param_version_db)\n else\n @params_in_sync = false\n end\n end\n end", "def able_to_login?(args = {})\n begin\n telnet = Net::Telnet::new(\"Host\" => args[:ip], \"Port\" => args[:port])\n telnet.login(args[:user], args[:password])\n return true\n rescue => e\n return false\n end\n end", "def pre_connect\n return false if params[:name].nil?\n true\n end", "def validate_request\n binding.pry if $debug\n rejected_error = validate_method || validate_arguments\n if rejected_error\n reject\n #if public mode\n #kill\n #else\n respond_with_rejected_error(rejected_error)\n #end\n return false\n end\n accept\n true\n end", "def is_wrong_password? password\nuri = URI.parse 'http://rubyschool.us/router'\n#response = Net::HTTP.get uri\n#p response\nresponse = Net::HTTP.post_form(uri, :login => \"admin\", :password => password).body\np response.include? \"denied\" # Тело объекта, который мы получаем через запрос\nend", "def validate_server(name)\n return true unless name # if no name is provided, just go with the defaults\n\n valid = name.is_a? String\n begin\n u = URI.parse(name)\n valid = false unless u.is_a?(URI::HTTP) || u.is_a?(URI::HTTPS)\n rescue URI::InvalidURIError\n valid = false\n end\n valid || raise(Exceptions::InvalidOptions, 'Invalid server')\n end", "def valid?\n return false if @grant_type.nil?\n return false if @code.nil?\n return false if @code.to_s.length > 128\n return false if @code.to_s.length < 1\n return false if !@refresh_token.nil? && @refresh_token.to_s.length > 128\n return false if !@refresh_token.nil? && @refresh_token.to_s.length < 1\n return false if !@redirect_uri.nil? && @redirect_uri.to_s.length > 256\n return false if !@redirect_uri.nil? && @redirect_uri.to_s.length < 1\n return false if !@client_id.nil? && @client_id.to_s.length > 128\n return false if !@client_id.nil? && @client_id.to_s.length < 1\n return false if !@client_secret.nil? && @client_secret.to_s.length > 128\n return false if !@client_secret.nil? && @client_secret.to_s.length < 1\n true\n end", "def valid?\n # Written like that for efficiency\n !(@ip.nil? || @date.nil? || @http_verb.nil? || @uri.nil? || @http_version.nil? || @status.nil? || @bytes.nil?)\n end", "def sauce?\n !!(@user && @key && @host && @port)\n end", "def is_valid?\n\t\treturn ERR_INVALID_NAME if name.blank? || name.length > NAME_MAX_LENGTH\n\t\treturn ERR_INVALID_TIME if time.blank? || (time < DateTime.now.ago(60*15).to_i)\n\n\t\treturn ERR_INVALID_FIELD if (admin.blank? || party_list.blank? || !party_list.is_a?(Hash))\n\n\t\treturn ERR_INVALID_FIELD if not party_list.has_key?(admin)\n\n\t\tparty_list.each do |key, value|\n\t\t\t\treturn ERR_INVALID_FIELD if not value.is_a?(Hash)\n\t\t\t\treturn ERR_INVALID_FIELD if not value.has_key?(:status)\n\t\tend\n\t\n\t\treturn SUCCESS\n\tend", "def valid_params_request?\n !!env[\"devise.allow_params_authentication\"]\n end", "def picatcha_valid?(options={})\n# LOGGER.debug \"def picatchs_valid? options=#{options}\"\n picatchadata = options[:picatcha] || \"\"\n private_key = options[:private_key] || Rack::Picatcha.private_key\n if picatchadata.to_s == \"\" then\n test = Rack::Picatcha.test_mode\n test.nil? ? request.env['picatcha.valid'] : test\n else\n retval, msg = Rack::Picatcha.verify_picatcha({\n :private_key => private_key,\n :ipaddr => request.ip,\n :picatcha => picatchadata\n })\n return retval\n end\n end", "def setup(opts={})\n if meets_restrictions?(opts)\n if require_user_pass(opts)\n @username = opts[:username]\n @password = opts[:password]\n @id = opts[:id] || SecureRandom.uuid\n @email = opts[:email] || false\n @real_name = opts[:real_name] || false\n end\n end\n true\n end", "def valid?\n return false if !@opt_id.nil? && @opt_id.to_s.length > 60\n return false if !@opt_id.nil? && @opt_id.to_s.length < 0\n return false if !@wallet_payer.nil? && @wallet_payer.to_s.length > 100\n return false if !@wallet_payer.nil? && @wallet_payer.to_s.length < 0\n return false if !@wallet_receiver.nil? && @wallet_receiver.to_s.length > 100\n return false if !@wallet_receiver.nil? && @wallet_receiver.to_s.length < 0\n return false if !@comment.nil? && @comment.to_s.length > 140\n return false if !@comment.nil? && @comment.to_s.length < 0\n return false if !@return_url.nil? && @return_url.to_s.length > 255\n return false if !@return_url.nil? && @return_url.to_s.length < 0\n return false if !@cancel_url.nil? && @cancel_url.to_s.length > 255\n return false if !@cancel_url.nil? && @cancel_url.to_s.length < 0\n return false if !@error_url.nil? && @error_url.to_s.length > 255\n return false if !@error_url.nil? && @error_url.to_s.length < 0\n return false if !@first_name_payer.nil? && @first_name_payer.to_s.length > 255\n return false if !@first_name_payer.nil? && @first_name_payer.to_s.length < 0\n return false if !@last_name_payer.nil? && @last_name_payer.to_s.length > 255\n return false if !@last_name_payer.nil? && @last_name_payer.to_s.length < 0\n return false if !@email_payer.nil? && @email_payer.to_s.length > 255\n return false if !@email_payer.nil? && @email_payer.to_s.length < 0\n return false if !@email_payer.nil? && @email_payer !~ Regexp.new(URI::MailTo::EMAIL_REGEXP)\n return false if !@style.nil? && @style.to_s.length > 255\n return false if !@style.nil? && @style.to_s.length < 0\n return false if !@atos_style.nil? && @atos_style.to_s.length > 255\n return false if !@atos_style.nil? && @atos_style.to_s.length < 0\n return false if !@notif_url.nil? && @notif_url.to_s.length > 255\n return false if !@notif_url.nil? && @notif_url.to_s.length < 0\n return false if !@options.nil? && @options.to_s.length > 255\n return false if !@options.nil? && @options.to_s.length < 0\n true\n end", "def passport_valid?(passport_input)\n return false unless has_required_fields?(passport_input)\n\n field_inputs = passport_input.split\n\n field_inputs.all? do |field_input|\n code, value = field_input.split(':')\n case code\n when 'byr'\n value.to_i.between?(1920, 2002)\n when 'iyr'\n value.to_i.between?(2010, 2020)\n when 'eyr'\n value.to_i.between?(2020, 2030)\n when 'hgt'\n unit = value[-2..]\n num = value[0...-2].to_i\n [\"cm\", \"in\"].include?(unit) && unit == \"cm\" ? num.between?(150, 193) : num.between?(59, 76)\n when 'hcl'\n /^#[0-9a-f]{6}$/.match?(value)\n when 'ecl'\n ['amb', 'blu', 'brn', 'gry', 'grn', 'hzl', 'oth'].include?(value)\n when 'pid'\n /^[0-9]{9}$/.match?(value)\n when 'cid'\n true\n else \n raise \"invalid code\"\n end\n end\nend", "def valid?\n return false if !@display_name.nil? && @display_name.to_s.length > 255\n return false if !@description.nil? && @description.to_s.length > 1024\n ip_protocol_validator = EnumAttributeValidator.new('String', ['TCP', 'UDP'])\n return false unless ip_protocol_validator.valid?(@ip_protocol)\n return false if @application_profile_id.nil?\n return false if !@max_concurrent_connections.nil? && @max_concurrent_connections > 2147483647\n return false if !@max_concurrent_connections.nil? && @max_concurrent_connections < 1\n return false if !@max_new_connection_rate.nil? && @max_new_connection_rate > 2147483647\n return false if !@max_new_connection_rate.nil? && @max_new_connection_rate < 1\n return false if @ip_address.nil?\n true\n end", "def check_rest_result_valid(json_result)\n \n\tdevice = Api::Device.find_by(mac_address: @device_given_attrs['mac_address'], serial_number: @device_given_attrs['serial_number'])\n\t\n # device register 的流程應檢查的項目包含:\n # 1. API response 內容\n # 2. personal cloud db\n # 3. xmpp db\n # 4. redis\n\n # 確認 API response 內容\n check_device_register_json_response(device, json_result)\n\n # 確認 personal cloud db 內容\n check_device_register_db_result(device)\n\n # 確認 xmpp db 內容\n check_device_register_xmpp_db_result(device)\n\n # 確認 redis 內容\n check_device_register_redis_result(device)\nend", "def validate_params\n assert_provided env, 'Missing \"env\"'\n assert_provided action, 'Missing \"action\"'\n\n case action\n when 'import'\n assert_provided path, 'Missing \"path\"'\n\n when 'export'\n assert_provided path, 'Missing \"path\"'\n\n when 'read'\n assert_provided name, 'Missing \"name\"'\n\n when 'rename'\n assert_provided name, 'Missing \"name\"'\n assert_provided to, 'Missing \"to\"'\n\n end\n\n assert_env_is_configured env\n end", "def valid_guce_params?\n if @order_id == nil || @amount == nil || not_a_number?(@amount)\n return false\n else\n return true\n end\n end", "def check\n # we want to handle cases where the port/target isn't open/listening gracefully\n begin\n # only catch the response if we're going to use it, in this case we do for the version\n # detection.\n res = send_request_cgi(\n 'uri' => normalize_uri(target_uri.path, 'index.php'),\n 'method' => 'GET'\n )\n # gracefully handle if res comes back as nil, since we're not guaranteed a response\n # also handle if we get an unexpected HTTP response code\n fail_with(Failure::UnexpectedReply, \"#{peer} - Could not connect to web service - no response\") if res.nil?\n fail_with(Failure::UnexpectedReply, \"#{peer} - Check URI Path, unexpected HTTP response code: #{res.code}\") if res.code == 200\n\n # here we're looking through html for the version string, similar to:\n # Version 1.2\n /Version: (?<version>[\\d]{1,2}\\.[\\d]{1,2})<\\/td>/ =~ res.body\n\n if version && Gem::Version.new(version) <= Gem::Version.new('1.3')\n vprint_good(\"Version Detected: #{version}\")\n Exploit::CheckCode::Appears\n end\n rescue ::Rex::ConnectionError\n fail_with(Failure::Unreachable, \"#{peer} - Could not connect to the web service\")\n end\n Exploit::CheckCode::Safe\n end", "def valid?\n return false if @name.nil?\n return false if @name.to_s.length > 100\n return false if !@phone_number.nil? && @phone_number.to_s.length > 30\n return false if !@email.nil? && @email.to_s.length > 250\n return false if @status.nil?\n return false if @assign_to.nil?\n return true\n end", "def valid?\n\n auth_params = params[scope]\n return false if !auth_params\n\n (nimbus_auth(auth_params)&.code == 200) ? true : false\n end", "def valid?\n return false if !@account_number.nil? && @account_number.to_s.length > 50\n return false if !@auth_code.nil? && @auth_code.to_s.length > 20\n return false if !@case_number.nil? && @case_number.to_s.length > 50\n return false if !@currency.nil? && @currency.to_s.length > 10\n return false if !@encryption_key.nil? && @encryption_key.to_s.length > 100\n return false if !@fax_failure_reason.nil? && @fax_failure_reason.to_s.length > 250\n return false if !@fax_number.nil? && @fax_number.to_s.length > 20\n return false if !@icsid.nil? && @icsid.to_s.length > 50\n return false if !@order_id.nil? && @order_id.to_s.length > 30\n return false if !@partial_card_number.nil? && @partial_card_number.to_s.length > 20\n return false if !@pdf_file_oid.nil? && @pdf_file_oid.to_s.length > 32\n return false if !@reason_code.nil? && @reason_code.to_s.length > 70\n return false if !@status.nil? && @status.to_s.length > 20\n return false if !@website_url.nil? && @website_url.to_s.length > 250\n true\n end", "def valid?\n @params_definition.each { |pd| return false unless @params.has_key?(pd) }\n true\n end", "def valid?\n header.schema == 'Basic' && credentials.length == 2\n end", "def is_valid(params)\n i = 0\n while params.length > i\n p params[i]\n if params[i] == nil || params[i] == \"\"\n session[:error] = \"Du missade en parameter! Försök igen.\"\n redirect('/error')\n end\n i += 1\n end\n end", "def oAuthValidate\r\n logger.info(\"UserController::oAuthValidate::Params:----#{params}\")\r\n \r\n end", "def validate_api(api)\n must_be_a_hash_if_set(api) ||\n invalid(api, \"api must be a hash\")\n if is_a_hash?(api)\n must_be_an_integer_if_set(api[:port]) ||\n invalid(api, \"api port must be an integer\")\n must_be_a_string_if_set(api[:bind]) ||\n invalid(api, \"api bind must be a string\")\n validate_api_authentication(api)\n validate_api_endpoints(api) if api[:endpoints]\n end\n end", "def valid?\n \n if @action_url.nil?\n false\n elsif @digit_timeout_ms.nil?\n false\n elsif @finish_on_key.nil?\n false\n elsif @flush_buffer.nil?\n false\n elsif @initial_timeout_ms.nil?\n false\n elsif @max_digits.nil?\n false\n elsif @min_digits.nil?\n false\n elsif @prompts.nil?\n false\n elsif @privacy_mode.nil?\n false\n else\n list_invalid_properties.length() == 0\n end\n end", "def valid?\n @errors = []\n @errors << 'you must give a new walltime' if walltime.blank?\n @errors << 'new walltime must be a String' if !walltime.blank? && !walltime.is_a?(String)\n @errors << 'timeout must be an Integer' if !timeout.blank? && !timeout.is_a?(Integer)\n\n # We support Booleans for YES_NO_ATTRIBUTES and also Strings with 'yes/no',\n # however only Booleans is documented.\n # OAR's Rest API needs 'yes/no' Strings, we transform the Booleans to\n # 'yes/no' Strings.\n YES_NO_ATTRIBUTES.each do |attribute|\n value = instance_variable_get \"@#{attribute}\"\n if !value.nil?\n if !([TrueClass, FalseClass].include?(value.class) ||\n (value.is_a?(String) && ['yes', 'no'].include?(value)))\n @errors << \"#{YES_NO_ATTRIBUTES.join(', ')} must be a Boolean\"\n break\n else\n case value\n when TrueClass\n instance_variable_set \"@#{attribute}\", 'yes'\n when FalseClass\n instance_variable_set \"@#{attribute}\", 'no'\n else\n end\n end\n end\n end\n\n @errors.empty?\n end", "def passport_valid?(passport_hash)\n has_required_fields = REQUIRED_FIELDS.all? do |required_field|\n !passport_hash[required_field].nil?\n end\n\n return false unless has_required_fields\n\n REQUIRED_FIELDS.all? do |field|\n case field\n when 'byr'\n valid_birth_year?(passport_hash[field])\n when 'iyr'\n valid_issue_year?(passport_hash[field])\n when 'eyr'\n valid_expiration_year?(passport_hash[field])\n when 'hgt'\n valid_height?(passport_hash[field])\n when 'hcl'\n valid_hair_color?(passport_hash[field])\n when 'ecl'\n valid_eye_color?(passport_hash[field])\n when 'pid'\n valid_passport_number?(passport_hash[field])\n else\n false\n end\n end\nend", "def validate\n needs :http_url unless http_url\n end", "def valid_params?; end" ]
[ "0.65269417", "0.649987", "0.62674534", "0.6239871", "0.6229742", "0.62291175", "0.621783", "0.6102586", "0.60032976", "0.59961194", "0.599198", "0.59414464", "0.590808", "0.58970714", "0.58827436", "0.58732766", "0.58732766", "0.5827013", "0.5811307", "0.5790262", "0.5785052", "0.57848495", "0.5757378", "0.57573074", "0.5744912", "0.574428", "0.5739723", "0.5739124", "0.57390714", "0.57357466", "0.5721671", "0.57095075", "0.5709098", "0.5709034", "0.570889", "0.5702588", "0.56882685", "0.5655281", "0.565351", "0.56516105", "0.5650748", "0.5624224", "0.5620442", "0.5610667", "0.56093127", "0.56030023", "0.5600466", "0.55956453", "0.5589255", "0.5580642", "0.5575929", "0.5571356", "0.5567211", "0.556269", "0.55499494", "0.5541053", "0.5536519", "0.5526531", "0.55254453", "0.5521101", "0.5517283", "0.5509742", "0.5506316", "0.5505821", "0.5497713", "0.5492914", "0.5489417", "0.54834956", "0.5477598", "0.5470649", "0.54696786", "0.5467332", "0.54579437", "0.5457201", "0.54481894", "0.54399997", "0.5421628", "0.54122156", "0.5404418", "0.54017526", "0.5394783", "0.5389713", "0.53842026", "0.5372143", "0.5368837", "0.53629786", "0.53610855", "0.5358212", "0.53512824", "0.5342184", "0.5340981", "0.5340042", "0.53387904", "0.53343415", "0.53312546", "0.5319256", "0.53183043", "0.53161657", "0.53038204", "0.5303779" ]
0.7656105
0
before_action :authenticate_user! CRUD on users
def index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorise\n unless User.find_by_id(session[:user_id]) || (self.controller_name == 'users' && (self.action_name == 'new' || self.action_name == 'create'))\n session[:original_uri] = request.request_uri\n flash[:notice] = \"Please login!\"\n redirect_to login_url\n end\n end", "def authenticate_current_user\n unless current_user.admin == true\n unless current_user == User.find(params[:id]) \n flash[:danger] = \"Impossible d'aller sur cette page.\"\n redirect_to root_path\n end\n end\n end", "def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end", "def authorize_as_admin\n create_admin_user\n login_into_alchemy\n end", "def authenticate_user!\n # unless current_user.present? && current_user.admin?\n # flash.now.alert = \"You are not an admin!\"\n # redirect_to root_path\n # end\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 authorize_user!\n user = Circle.find(params[:id]).user\n if current_user != user\n flash[:notices] = \"Unathorized action\"\n redirect_to user_url(user.id)\n end\n end", "def set_and_authorize_user!\n @user = User.find(params[:id])\n authorize_user_action!\n end", "def user_permissions\n if current_user.id == params[:id].to_i\n @user = User.find(params[:id])\n else\n flash[:danger] = 'Unauthorized action.'\n redirect_to edit_user_path(current_user) \n end\n end", "def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end", "def user_authentication\n end", "def authenticate_user!\n \tunless current_user?\n \trender status: :unauthorized\n \tend\n end", "def create_user\n @user = User.find(session[:user_id])\n redirect_to(root_url) unless current_user?(@user) || current_user.admin?\n end", "def user_access_create\n check_user_access(params[:user_id])\n end", "def user_access_create\n check_user_access(params[:user_id])\n end", "def set_user\n @user = User.find(params[:id])\n \tauthorize [:admin, @user]\n end", "def index\n @users = User.all\n authorize User\n end", "def user_edits\n redirect_to home_path if current_user != User.find(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n\n # only admins can CRUD non-regular users\n return if (@user.role == 'USER') || (current_user.role == 'ADMIN')\n render json: { error: 'Not allowed' }, status: :unauthorized\n end", "def set_user\n @user = User.find(params[:id])\n authorize @user\n end", "def authenticate_user\n\t\trender_unauthorized unless current_user\n\tend", "def auth_user!(opts = {})\n if admin_signed_in?\n \tauthenticate_admin!\n else\n \tauthenticate_user!\n end\nend", "def check_user\n unless user_signed_in?\n redirect_to root_url, alert: \"Sorry, only authorized users can add.\"\n end\n end", "def authenticate_user\n render_403 'Invalid user.' if @user.blank? || !@user.active?\n end", "def login_required\n authenticate_user! \n end", "def set_user\n @user = User.find(params[:user_id])\n authorize @user\n end", "def authenticate_user\n unauthorized unless current_user\n end", "def auth_user\n redirect_to new_user_registration_url unless user_signed_in?\n end", "def authenticate_correct_user\n redirect_unauthorized unless current_user? @run.user_id\n end", "def auth_user\n redirect_to new_user_session_url unless user_signed_in?\n end", "def authenticate\n if logged_in_user\n redirect_to root_url unless current_user?(find_user)\n end\n end", "def edit\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end", "def authorize_user\n puts \"AUTHORIZE USER\"\n puts \"params[:id] \" + params[:id].to_s\n # render json: { status: 401, message: 'Unauthorized' } unless get_current_user.id == params[:id].to_i\n render json: { status: 401, message: 'Unauthorized' } unless get_current_user\n end", "def auth_user\n if !current_user\n redirect_to root_url\n end\n end", "def auth_user\n if !current_user\n redirect_to root_url\n end\n end", "def auth_user\n if !current_user\n redirect_to root_url\n end\n end", "def authenticate_user!\n current_user.is_admin?\n end", "def authenticate_user\n redirect_to login_path unless logged_in_user?\n end", "def authorize\n return_unauthorized unless current_user && current_user.can_modify_user?(params[:id])\n end", "def set_user\n @user = User.find(params[:id])\n authorize @user\n end", "def set_user\n @user = User.find(params[:id])\n authorize @user\n end", "def authenticate_user!\n if current_user.id != @user.id\n redirect_back(fallback_location: root_path)\n end\n end", "def create\n\n user = current_instance.users.where(username: params[:username]).first\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to root_path, notice: 'You have been successfully logged in to Unify.'\n else\n flash[:error] = 'Invalid username and/or password.'\n render :new\n end\n\n end", "def create\n\t\tredirect_to '/users/sign_in', alert: 'Access denied.'\n\tend", "def authorize\n unless User.find_by_id(session[:user_id]) or User.count == 0\n session[:original_uri] = request.request_uri\n flash[:notice] = \"Please log in.\" \n redirect_to(:controller=>\"admin\", :action=>\"login\")\n end\n if User.count == 0 \n if request.path_parameters[:action]==\"add_user\" and request.path_parameters[:controller]==\"login\" \n #As we are already on our way to the add_user action, do nothing here.\n else\n flash[:notice] = \"Please create an account.\" \n redirect_to(:controller=>\"login\", :action=>\"add_user\")\n end\n end\n end", "def authenticate_user!\n unless current_user?\n render status: :unauthorized\n end\n end", "def authenticate\n\n redirect_to_login if current_user.nil?\n \n end", "def index\n @users = User.all\n authorize @users\n end", "def authorize_users\n authorize :user\n end", "def create\n @user = User.new(user_params)\n #set default privilege. anyone named sinjihn is an admin\n if(@user.first_name == \"sinjihn\")\n puts \"[USER_CONTROLLER] admin privileges accepted\"\n @user.update_attribute(:privilege, true)\n else \n @user.update_attribute(:privilege, false)\n end\n\n respond_to do |format|\n if @user.save #if succesfully saved to db\n puts \"[USER_CONTROLLER] user.save\" \n log_in @user\n format.html { redirect_to @user, success: 'User was successfully created. Automatically logged in' }\n format.json { render :show, status: :created, location: @user } #should render homepage\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def authorized_user\n @user = Post.find(params[:id]).user\n redirect_to(root_url) unless logged_in? && (current_user?(@user) || current_user.admin?)\n end", "def auth_user\n\t\t@user = User.find_by(id: params[:id] )\n\t\tif @user \n\t\t\tif current_user? @user \n\t\t\t\t@view = nil\n\t\t\telse\t#show @user \n\t\t\t\tflashs = { error: \"Insufficient priviledge on @#{@user.login}\" }\n\t\t\t\tuser_show(@user.to_slug, flashs)\n\t\t\tend\n\t\telse\n\t\t\tflashs = { error: \"Invalid user id : #{params[:id].to_i}\" }\n\t\t\tredirect_format(\"/\", flashs, params[:callback] )\n\t\tend\n\tend", "def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end", "def create_user\n super\n end", "def authorize_user\n redirect_to restrooms_path, flash: {message: \"You don't have permission to make changes to another user's profile.\"} unless current_user.admin? || @user == current_user\n end", "def authenticate_user!\n redirect_to '/auth/sweetsuite' unless access_token && current_user\n end", "def create?\n #everyone who is loggedin can do this action\n true\n end", "def show\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n \t@user = User.find(params[:id])\n else \n redirect_to '/'\n end\n end", "def find_user\n @user = User.find(params[:id])\n authorize @user\n end", "def set_user\n @user = User.find_by(id: params[:id])&.decorate\n\n redirect_to root_url, alert: 'Usuário não encontrado' if @user.blank?\n end", "def augment\n @users = User.all\n @user = current_user\n if @user.update_attributes(user_params)\n flash[:success] = \"Welcome to Telmi!\"\n render 'index'\n else\n render 'nda_page'\n flash[:danger] = \"Unable to create user. Please try again.\"\n end\n end", "def index\n #before_action :authenticate_user\n #if current_user.admin?\n @users = User.all\n render json: @users, status: :ok\n #else\n # render json: [], status: :unauthorized\n #end\n end", "def authenticate_user!\n redirect_to new_user_path unless user_signed_in?\n end", "def index\n # set_user, is the only action taken here\n end", "def index\n # set_user, is the only action taken here\n end", "def admin_auth\n user = User.find_by(id: params[:user_id])\n if ! user\n \trender json: {\n \"error\" => \"Unauthorized\"\n }, status: 401\n return\n end \n if user.is? :admin\n render json: {}, status: 201\n else\n render json: {\n \"error\" => \"Unauthorized\"\n }, status: 401\n end \n end", "def index\n redirect_to(:action => 'login') and return unless logged_in?\n \n @user = current_user\n end", "def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end", "def authenticate\n redirect_to '/login' unless current_user\n end", "def authorise\n unless User.find_by_id(session[:user_id])\n redirect_to login_url, :notice => \"Please log in\"\n end\n end", "def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => 'login' and return false\n else\n redirect_to :controller => 'authentication', :action => 'create_admin' and return false\n end\n end", "def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end", "def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end", "def create\n user = User.where(\"name like '#{params[:user]}'\")\n respond_to do |format|\n if user.first&.authenticate(params[:password])\n login_sucessfull user\n format.html { redirect_to root_path, notice: 'User was successfully logged in.' }\n else\n clear_login\n format.html { redirect_to :login_index, notice: 'Logon unsuccessful' }\n end\n end\n end", "def set_user\n @user = User.find(params[:id])\n redirect_to admin_users_path, alert: 'You are Unauthorized to access that page' if @user.super_admin?\n end", "def index\n validate_login\n @users = User.all\n end", "def authenticate_user!\n redirect_to '/login' unless current_user\n end", "def authenticate_admin_user!\n load_user\n unless @current_user && @current_user.admin?\n redirect_to(root_url)\n end\n end", "def authenticate\n unauthorized unless current_user\n end", "def authenticate!\r\n\tif !current_user\r\n\t\tredirect \"/login\"\r\n\tend\r\nend", "def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend", "def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend", "def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend", "def authenticate!\n\tif !current_user\n\t\tredirect \"/login\"\n\tend\nend", "def authorize_user_by_id\n\t\trender_unauthorized_msg unless current_user && current_user.id == params[:id].to_i\n\tend", "def index\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n else \n redirect_to '/'\n end\n end", "def destroy\n before_action :authenticate_user\n @user.destroy\n end", "def authenticate\n\t\t@authenticatedUser = User.where(:name => params[:user][:Name],:password => params[:user][:Password]).first\n\n\t\t@user = User.new(params[:user])\n\t\tfirst_time = false\n\n\t\tif (User.all.size == 0) && @authenticatedUser.nil? && params[:user][:Name] == \"admin\" && params[:user][:Password] == \"admin\"\n\t \t\t@authenticatedUser = User.new\n\t \t\tfirst_time = true\n\t \tend\n\n\t \tif (not @authenticatedUser.nil?) or first_time\n\t\t\tlogin_ok = is_admin(@authenticatedUser)\n\t\t\n\t\t\tif login_ok or first_time\n\t\t\t\tsession[:currentUser] = @authenticatedUser\n\t\t\t\tredirect_to :action => \"home\"\n\t\t\telse\n\t\t\t\tredirect_to '/login/index', :notice => 'Invalid username or password please try again.'\n\t\t\tend\n\t\telse\n\t\t\tredirect_to '/login/index', :notice => 'Invalid username or password please try again.'\n\t\tend\n\tend", "def index\n redirect_to after_sign_in_path_for current_user if current_user\n end", "def index\n redirect_to after_sign_in_path_for current_user if current_user\n end", "def create\n user = User.authenticate(params[:username], params[:password])\n if user\n session[:user_id] = user.id\n if !user.admin_rights\n redirect_to posts_url, :notice => \"Welcome #{user.username}!\"\n else\n redirect_to :controller => :admin, :action=>\"index\"\n # check for admin_rights\n # redirect to admin\n end\n else\n flash.now.alert = \"Login Denied! Invalid username or password\"\n render 'sessions/login'\n end\n end", "def create\n if user = User.Authenticate(params[:login][:email], params[:login][:password])\n # Save the user ID in the session so it can be used in\n # subsequent requests\n session[:current_user_id] = user.id\n redirect_to root_url\n else\n \tflash[:error] = \"Email ou senha incorreto.\"\n \trender :index\n end\n end", "def index\n # FIXME: if logged in as an author, only show own user's crUd stuff; for\n # admins, show all CRUD operations for all users\n if logged_in?\n @users = User.order(:name)\n else\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Cannot view all users.' }\n end\n end\n end", "def authenticate\n\t\tunless admin?\n\t\t\tflash[:error] = 'unauthorized access'\n\t\t\tredirect_to home_path\n\t\tend\n\tend", "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 index\n if signed_in?\n redirect_to current_user\n else\n redirect_to new_user_path\n end\n end", "def authenticate_admin\n if authenticate_user!\n # if current_user\n unless current_user\n redirect_to root_path, alert: \"You are not authorised to perform that Operation\"\n # end\n end\n else\n redirect_to new_user_session_path, alert: \"You need to be signed !\"\n end\n\n end", "def listing\n @user = User.all\n unless current_user.admin?\n redirect_to dashboard_show_path\n end \n end", "def index\n if Administrator.find_by_user_id(current_user.id).admin\n @users = User.all\n else\n redirect_to root_path\n end\n end", "def authenticate_user!\n \tif user_signed_in?\n \t super\n else\n redirect_to new_user_session_path, notice: 'Debes iniciar sesión'\n end\n end", "def authorized\n redirect_to new_user_session_path unless logged_in?\n end" ]
[ "0.6736386", "0.6728403", "0.668388", "0.6618737", "0.652342", "0.6512651", "0.6499058", "0.6483792", "0.6476901", "0.6444685", "0.64351386", "0.6434935", "0.6430866", "0.6414968", "0.6414968", "0.6412905", "0.641211", "0.64091873", "0.6405783", "0.64007723", "0.6395581", "0.63752466", "0.63467795", "0.63364047", "0.6335563", "0.63282347", "0.6327451", "0.6323577", "0.63101727", "0.63099116", "0.63049173", "0.629", "0.62842107", "0.6283467", "0.6283467", "0.6283467", "0.6281605", "0.6277502", "0.6276664", "0.6276452", "0.6276452", "0.6272562", "0.625952", "0.6252186", "0.6246882", "0.62445533", "0.6241438", "0.6241384", "0.62353575", "0.62289476", "0.62210566", "0.62210006", "0.62204474", "0.6214001", "0.6211468", "0.620688", "0.6201501", "0.61895674", "0.6176947", "0.61763066", "0.617508", "0.6174114", "0.61740834", "0.6169517", "0.6169517", "0.61685926", "0.616184", "0.6158849", "0.6151637", "0.6149831", "0.6147412", "0.6138673", "0.6138673", "0.61384547", "0.6137939", "0.61378616", "0.6135458", "0.61352694", "0.61337286", "0.6129293", "0.6129158", "0.6129158", "0.6129158", "0.6129158", "0.6129106", "0.6126092", "0.61192083", "0.61179715", "0.6108844", "0.6108844", "0.6108673", "0.6105866", "0.6105768", "0.6102459", "0.6100948", "0.60917276", "0.60884094", "0.6081208", "0.6076976", "0.60749936", "0.60727483" ]
0.0
-1
Executes queries using the replica database. Fails over to primary if no replica is found. if you want to execute a block of code on the replica you can go: Account.on_replica do Account.first end the first account will be found on the replica DB For oneliners you can simply do Account.on_replica.first
def on_replica(&block) on_primary_or_replica(:replica, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_replica(&block)\n on_master_or_replica(:replica, &block)\n end", "def use_replica_if_available(&block)\n ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries(&block)\n end", "def enable_replica\n begin\n ActiveRecord::Base.connection.enable_replica\n yield\n rescue Makara::Errors::AllConnectionsBlacklisted => e\n yield\n ensure\n ActiveRecord::Base.connection.disable_replica\n end\n end", "def get_any_replica(id, options = GetAnyReplicaOptions.new) end", "def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end", "def read_replica_db_instance_identifiers\n @dbi.read_replica_db_instance_identifiers\n end", "def replica_db_synced_with_master_db?(replica_host, agents)\n # Save a beaker host_hash[:vmhostname], set it to the supplied host_name param,\n # and then set it back to the original at the end of the ensure. The :vmhostname\n #overrides the host.hostname, and nothing should win out over it.\n original_host_name = host.host_hash[:vmhostname]\n begin\n host.host_hash[:vmhostname] = replica_host.hostname\n\n replica_nodes = query_nodes.body\n replica_catalogs = query_catalogs.body\n replica_facts = query_facts.body\n replica_reports = query_reports.body\n ensure\n host.host_hash[:vmhostname] = original_host_name\n end\n master_nodes = query_nodes.body\n master_catalogs = query_catalogs.body\n master_facts = query_facts.body\n master_reports = query_reports.body\n\n nodes_synced = nodes_synced?(agents, replica_nodes, master_nodes)\n catalogs_synced = catalogs_synced?(agents, replica_catalogs, master_catalogs)\n facts_synced = facts_synced?(replica_facts, master_facts)\n reports_synced = reports_synced?(agents, replica_reports, master_reports)\n\n errors = ''\n errors << \"Nodes not synced\\r\\n\" unless nodes_synced\n errors << \"Catalogs not synced\\r\\n\" unless catalogs_synced\n errors << \"Facts not synced\\r\\n\" unless facts_synced\n errors << \"Reports not synced\\r\\n\" unless reports_synced\n\n host.logger.warn(errors.chomp) unless errors.empty?\n errors.empty?\n end", "def run\n $stdout.write \"-\" if session.configuration.options[:replication_trace]\n\n RR.heartbeat(session.configuration.options[:heartbeat_file])\n\n return unless [:left, :right].any? do |database|\n next false if session.configuration.send(database)[:mode] == :slave\n changes_pending = false\n RR.limited_execute(session.configuration.options[:database_connection_timeout]) do\n changes_pending = session.send(database).select_one(\n \"select id from #{session.configuration.options[:rep_prefix]}_pending_changes limit 1\"\n ) != nil\n end\n changes_pending\n end\n\n # Apparently sometimes above check for changes takes already so long, that\n # the replication run times out.\n # Check for this and if timed out, return (silently).\n return if sweeper.terminated?\n\n success = false\n begin\n replicator # ensure that replicator is created and has chance to validate settings\n break_on_terminate = false\n\n loop do\n $stdout.write \".\" if session.configuration.options[:replication_trace]\n RR.heartbeat(session.configuration.options[:heartbeat_file])\n\n break unless loaders.update # ensure the cache of change log records is up-to-date\n\n loop do\n begin\n diff = load_difference\n break unless diff.loaded?\n break_on_terminate = sweeper.terminated? || $rubyrep_shutdown\n break if break_on_terminate\n if diff.type != :no_diff and not event_filtered?(diff) # Should probably be :no_change, :no_diff doesn't exist\n replicator.replicate_difference diff\n end\n rescue Exception => e\n if e.message =~ /violates foreign key constraint|foreign key constraint fails/i and !diff.second_chance?\n # Note:\n # Identifying the foreign key constraint violation via regular expression is\n # database dependent and *dirty*.\n # It would be better to use the ActiveRecord #translate_exception mechanism.\n # However as per version 3.0.5 this doesn't work yet properly.\n\n diff.second_chance = true\n second_chancers << diff\n else\n begin\n helper.log_replication_outcome diff, e.message, e.class.to_s + \"\\n\" + e.backtrace.join(\"\\n\")\n rescue Exception => _\n # if logging to database itself fails, re-raise the original exception\n raise e\n end\n end\n end\n\n break if break_on_terminate\n end\n end\n success = true\n ensure\n if sweeper.terminated?\n helper.finalize false\n session.disconnect_databases\n else\n helper.finalize success\n end\n end\n end", "def reconnect\n @read_replica.reconnect\n @primary.reconnect\n end", "def on_replica\n # Why where(nil)?\n # http://stackoverflow.com/questions/18198963/with-rails-4-model-scoped-is-deprecated-but-model-all-cant-replace-it\n context = where(nil)\n context.knockoff_target = :replica\n context\n end", "def replica_set?; true; end", "def execute(node)\n node.process(operation) do |reply|\n # Avoid LocalJumpError\n ret = nil\n if reply.unauthorized? && node.credentials.key?(@database)\n node.connection do |conn|\n username, password = node.credentials[@database]\n if username && password\n conn.login(operation.database, username, password)\n ret = execute(node)\n end\n end\n end\n\n if ret.nil?\n if operation.failure?(reply)\n raise operation.failure_exception(reply)\n end\n\n ret = operation.results(reply)\n end\n\n ret\n end\n end", "def with_primary(&block)\n if node = nodes.find(&:primary?)\n begin\n node.ensure_primary do\n return yield(node)\n end\n rescue Errors::ConnectionFailure, Errors::ReplicaSetReconfigured\n end\n end\n raise Errors::ConnectionFailure, \"Could not connect to a primary node for replica set #{inspect}\"\n end", "def primary_status\n session.cluster.with_primary do |primary|\n primary.command(:admin, replSetGetStatus: 1)\n end\n rescue => e\n raise ConnectionFailed, e\n end", "def update_replication\n replication.stored = true\n replication.update_admin\n replication.update_local\n end", "def resume_replication\n raise \"This DB object has no master\" unless master\n repl_binlog_coordinates(true)\n output \"Resuming replication from #{@master}.\"\n output mysql_root_cmd \"START SLAVE\"\n @repl_paused = false\n end", "def replicas; end", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|c| _execute(c, sql, opts, &block)} \n end", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|conn| check_database_errors{_execute(conn, sql, opts, &block)}}\n end", "def change_primary\n start = Mongo::Utils.monotonic_time\n existing_primary = admin_client.cluster.next_primary\n existing_primary_address = existing_primary.address\n\n target = admin_client.cluster.servers_list.detect do |server|\n !server.arbiter? && server.address != existing_primary_address\n end\n\n cfg = get_rs_config\n cfg['members'].each do |member|\n member['priority'] = case member['host']\n when existing_primary_address.to_s\n 1\n when target.address.to_s\n 10\n else\n 0\n end\n end\n set_rs_config(cfg)\n\n if unfreeze_server(target.address)\n # Target server self-elected as primary, no further action is needed.\n return\n end\n\n step_down\n persistently_step_up(target.address)\n\n new_primary = admin_client.cluster.next_primary\n puts \"#{Time.now} [CT] Primary changed to #{new_primary.address}. Time to change primaries: #{Mongo::Utils.monotonic_time - start}\"\n end", "def replica_set?; false; end", "def set_session_replica\n @session_replica = SessionReplica.find(params[:id])\n end", "def send_queries_to_slave(slave, method, *args, &block)\n using_shard(slave) do\n val = select_connection.send(method, *args, &block)\n if val.instance_of? ActiveRecord::Result\n val.current_shard = slave\n end\n val\n end\n end", "def initiate(replica_set)\n config = replica_set.config\n\n if replica_set.replica_set?\n if replica_set.key != config.key\n raise FatalError, 'Member already belongs to a different Replica Set?!'\n else\n logger.info 'Mongodb Replica set already inititated...'\n return\n end\n end\n\n begin\n replica_set.initiate(false)\n replica_set.connect\n rescue Mongo::Error::OperationFailure => rinit\n logger.info 'Failed to initiate Replica Set...'\n logger.info rinit.message\n raise\n end\n logger.info 'Mongodb Replica set inititated...'\nend", "def read_replica_db_instance_identifiers\n data[:read_replica_db_instance_identifiers]\n end", "def query(*args)\n try_count = 0\n\n begin\n client.query(*args)\n rescue Mysql2::Error => e\n raise e unless read_only_error?(e.message)\n\n if @disconnect_only\n warn '[mysql2-aurora] Database is readonly, Aurora failover event likely occured, closing database connection'\n disconnect!\n sleep @sleep_before_disconnect if @sleep_before_disconnect > 0\n raise e\n end\n\n try_count += 1\n\n if try_count <= @max_retry\n retry_interval_seconds = [1.5 * (try_count - 1), 10].min\n\n warn \"[mysql2-aurora] Database is readonly. Retry after #{retry_interval_seconds} seconds\"\n sleep retry_interval_seconds\n reconnect!\n retry\n end\n\n raise e\n end\n end", "def read_replica_source_db_instance_identifier\n @dbi.read_replica_source_db_instance_identifier\n end", "def read_replica_source_db_instance_identifier\n @dbi.read_replica_source_db_instance_identifier\n end", "def next_replica\n return @master.data_nodes[@master.data_nodes.keys[(rand * @master.data_nodes.size).floor]]\n end", "def execute(*args)\n @db.execute(*args)\n end", "def replica_set?\n $mongo_client ||= initialize_scanned_client!\n $replica_set ||= $mongo_client.cluster.replica_set?\nend", "def elect_primary(description, servers)\n if description.replica_set_name == replica_set_name\n unless detect_stale_primary!(description)\n servers.each do |server|\n if server.primary? && server.address != description.address\n server.description.unknown!\n end\n end\n update_max_election_id(description)\n update_max_set_version(description)\n end\n else\n log_warn(\n \"Server #{description.address.to_s} has incorrect replica set name: \" +\n \"'#{description.replica_set_name}'. The current replica set name is '#{replica_set_name}'.\"\n )\n end\n self\n end", "def master_db; machine_by_role('master_db'); end", "def replica_set\n return nil if @machine.config.mongodb.nil?\n\n @machine.config.mongodb.replsets.find do |rs|\n rs.members.find do |member|\n member[:host] == @machine.name\n end\n end\n end", "def update_with_masterdb(observed_method, object) #:nodoc:\n if object.class.connection.respond_to?(:with_master)\n object.class.connection.with_master do\n update_without_masterdb(observed_method, object)\n end\n else\n update_without_masterdb(observed_method, object)\n end\n end", "def update_with_masterdb(observed_method, object) #:nodoc:\n if object.class.connection.respond_to?(:with_master)\n object.class.connection.with_master do\n update_without_masterdb(observed_method, object)\n end\n else\n update_without_masterdb(observed_method, object)\n end\n end", "def replica_set?\n type == Mongo::Cluster::Topology::ReplicaSetNoPrimary ||\n type == Mongo::Cluster::Topology::ReplicaSetWithPrimary\n end", "def execute(sql, opts={}, &block)\n if opts[:sproc]\n call_sproc(sql, opts, &block)\n else\n synchronize(opts[:server]){|conn| _execute(conn, sql, opts, &block)}\n end\n end", "def reconcile_db_with_cluster\n rcs.each_value { |pods| pods.each_value { |pod| handle_pod_update(pod) } }\n end", "def retrieve_db(attempt = 0)\n require 'rubygems'\n require 'mongo'\n\n begin\n Mongo::MongoClient.new(\n @new_resource.connection['host'],\n @new_resource.connection['port'],\n :connect_timeout => 15,\n :slave_ok => true\n )\n rescue Mongo::ConnectionFailure => e\n if(attempt) < @new_resource.connection['user_management']['connection']['retries']\n Chef::Log.warn(\"Unable to connect to MongoDB instance, retrying in #{@new_resource.connection['user_management']['connection']['delay']} second(s)...\")\n sleep(@new_resource.connection['user_management']['connection']['delay'])\n retrieve_db(attempt + 1)\n end\n end\nend", "def create\n\n info(\"Initializing %s MongoDB replica set\" % resource[:host])\n\n command = \"echo 'rs.initiate()' | mongo #{resource[:host]} --quiet\"\n result = `#{command}`\n\n info(\"Sleeping 90 seconds for the replica set to become active\")\n sleep(90)\n\n end", "def initialize(primary: , read_replica: nil, **options)\n super(options)\n @primary = primary\n @read_replica = read_replica || primary\n end", "def primary\n @primary ||= @lmdb.transaction do\n if ret = @dbs[:control]['primary']\n ret.strip.to_sym\n end\n end\n end", "def execute\n server = next_primary\n validate_operations!\n merged_ops.each do |op|\n validate_type!(op.keys.first)\n execute_op(op, server)\n end\n finalize\n end", "def exec(&block)\n raise InvalidDbError if @stale\n\n return exec_in_staging(true, &block) if self.staging?\n\n begin\n self.staging\n exec_in_staging(false, &block)\n self.staging.write\n ensure\n self.unstage\n end\n\n end", "def run(&block)\n @repository.query(self, &block)\n end", "def replica_mode\n data[:replica_mode]\n end", "def run\n master_connection = acquire_connection\n worker_connection = acquire_connection\n\n run_cursor_loop(master_connection) do |row|\n process_method.call(worker_connection, row)\n end\n\n release_connection(master_connection)\n release_connection(worker_connection)\n end", "def execute\n view.send(:with_session, @options) do |session|\n write_concern = view.write_concern_with_session(session)\n context = Operation::Context.new(client: client, session: session)\n nro_write_with_retry(write_concern, context: context) do |connection, txn_num, context|\n send_initial_query_with_connection(connection, session, context: context)\n end\n end\n end", "def classifier_database_matches_self?(replica_host)\n original_host_name = host.host_hash[:vmhostname]\n begin\n host.host_hash[:vmhostname] = replica_host.hostname\n\n other_nodes = get_list_of_nodes\n other_classes = get_list_of_classes\n other_environments = get_list_of_environments\n other_groups = get_list_of_node_groups\n ensure\n host.host_hash[:vmhostname] = original_host_name\n end\n\n self_nodes = get_list_of_nodes\n self_classes = get_list_of_classes\n self_environments = get_list_of_environments\n self_groups = get_list_of_node_groups\n\n nodes_match = nodes_match?(other_nodes, self_nodes)\n classes_match = classes_match?(other_classes, self_classes)\n environments_match = environments_match?(other_environments, self_environments)\n groups_match = groups_match?(other_groups, self_groups)\n\n errors = ''\n errors << \"Nodes do not match\\r\\n\" unless nodes_match\n errors << \"Classes do not match\\r\\n\" unless classes_match\n errors << \"Environments do not match\\r\\n\" unless environments_match\n errors << \"Groups do not match\\r\\n\" unless groups_match\n\n host.logger.warn(errors.chomp) unless errors.empty?\n errors.empty?\n end", "def distribute(request)\n promote_replica_to_primary if primary_not_available?\n return \"Uh Oh, no primary\" if primary.nil?\n\n if write?(request)\n send(primary, request)\n else\n send(random_server, request)\n end\n end", "def execute(*args)\n bound_args = args.shift(@raw_metadata.size)\n consistency_level = args.shift\n @client.execute_statement(@connection_id, @statement_id, @raw_metadata, bound_args, consistency_level)\n end", "def execute\n puts DB_MSG\n logger.info(DB_MSG)\n # connect to the database and query on a Site\n CaTissue::Database.current.open { find_in_transit_site }\n end", "def master\n Mongo::Connection.from_uri(uri(self), optional.symbolize_keys).tap do |conn|\n conn.apply_saved_authentication\n end\n end", "def reconfiguring_replica_set?\n err = details[\"err\"] || details[\"errmsg\"] || details[\"$err\"] || \"\"\n NOT_MASTER.include?(details[\"code\"]) || err.include?(\"not master\")\n end", "def activity_database_matches_self?(replica_host)\n # Save a beaker host_hash[:vmhostname], set it to the supplied host_name param,\n # and then set it back to the original at the end of the ensure. The :vmhostname\n #overrides the host.hostname, and nothing should win out over it.\n original_host_name = host.host_hash[:vmhostname]\n begin\n host.host_hash[:vmhostname] = replica_host.hostname\n\n other_rbac_events = get_rbac_events.env.body\n other_classifier_events = get_classifier_events.env.body\n ensure\n host.host_hash[:vmhostname] = original_host_name\n end\n\n self_rbac_events = get_rbac_events.env.body\n self_classifier_events = get_classifier_events.env.body\n\n rbac_events_match = other_rbac_events == self_rbac_events\n classifier_events_match = other_classifier_events == self_classifier_events\n\n errors = ''\n errors << \"Rbac events do not match\\r\\n\" unless rbac_events_match\n errors << \"Classifier events do not match\\r\\n\" unless classifier_events_match\n\n host.logger.warn(errors.chomp) unless errors.empty?\n errors.empty?\n end", "def start\n @nodes.each(&:start)\n @worker = Thread.start do\n Thread.abort_on_exception = true\n catch(:shutdown) do\n loop do\n Moped.logger.debug \"replica_set: waiting for next client\"\n server, client = @manager.next_client\n\n if server\n Moped.logger.debug \"replica_set: proxying incoming request to mongo\"\n server.proxy(client, @mongo)\n else\n Moped.logger.debug \"replica_set: no requests; passing\"\n Thread.pass\n end\n end\n end\n end\n end", "def execute\n # First, execute the SQL, applying the valid after_filters\n ret = apply_after_filters(execute_sql)\n\n # Set changed property to true\n changed\n\n # Notify all observers of the ids of the current result\n # set\n notify_observers(\n ret.collect{|instance| instance.send(model.primary_key)},\n self\n )\n\n # Reset the Query\n reset!\n\n # Return the results\n ret\n end", "def run\n basecmd = []\n basecmd << command(:psql)\n basecmd << \"-U\" unless @resource[:role].nil?\n basecmd << \"#{@resource[:role]}\" unless @resource[:role].nil?\n basecmd << \"-d\" unless @resource[:database].nil?\n basecmd << \"#{@resource[:database]}\" unless @resource[:database].nil?\n \n # We execute by default.\n execute = true\n unless @resource[:query].nil?\n cmd = basecmd\n cmd << '-qAtc'\n \n sqlcmd = \"#{@resource[:query]}\"\n \n cmd << sqlcmd\n \n raw, status = Puppet::Util::SUIDManager.run_and_capture(cmd, 'postgres')\n if status == 0\n execute = false # Got an ok result, so we'll evaluate.\n\n if ! @resource[:rows].nil?\n target_rows = Integer(@resource[:rows].gsub(/[^\\d]/,''))\n operand = @resource[:rows].gsub(/[\\d]/,'').chomp.downcase\n returned_rows = (raw.length <= 0 ? 0 : raw.lines.count)\n if operand.match(/lte|less than or equal|<=/)\n execute = true if returned_rows <= target_rows\n elsif operand.match(/gte|greater than or equal|>=/)\n execute = true if returned_rows >= target_rows\n elsif operand.match(/lt|less than|</)\n execute = true if returned_rows < target_rows \n elsif operand.match(/gt|greater than|>/)\n execute = true if returned_rows > target_rows\n else\n execute = true if returned_rows == target_rows\n end\n end\n else\n # We stop an execution if rows or result params are set\n # on the assumption that if you want to evaluate against criteria like those\n # you want to actually do so.\n execute = false if (! @resource[:rows].nil? or ! @resource[:result].nil?)\n end\n end\n \n unless execute == false\n cmd = basecmd\n if ! @resource[:command].nil?\n cmd << '-qAtc'\n \n sqlcmd = \"#{@resource[:command]}\"\n \n cmd << sqlcmd \n elsif ! @resource[:file].nil?\n cmd << '-qAtf'\n \n sqlcmd = \"#{@resource[:file]}\"\n \n cmd << sqlcmd\n else\n # Right now we send a warning. This should still trigger a refresh if you\n # want to use queries to conditionally do things for some insane reason.\n self.warning(\"Nothing to do.\")\n end\n \n raw, status = Puppet::Util::SUIDManager.run_and_capture(cmd, 'postgres')\n if status != 0\n self.fail(\"Error executing SQL - result #{raw}\")\n else\n @ran = true\n end\n else\n self.fail(\"Execution criteria failed. Failing to prevent dependant resources from executing.\")\n end\n end", "def should_send_queries_to_replicated_databases?(method)\n replicated && method.to_s =~ /select/ && !block && !slaves_grouped?\n end", "def update_with_masterdb(observed_method, object) #:nodoc:\n connection = object.class.connection if object.class.respond_to?(:connection)\n connection ||= object.connection\n if connection.respond_to?(:with_master)\n connection.with_master do\n update_without_masterdb(observed_method, object)\n end\n else\n update_without_masterdb(observed_method, object)\n end\n end", "def increment(replica, increment_by=1)\n replicated_integer = @collection.get(replica)\n replicated_integer.increment(increment_by)\n self\n end", "def after_probe_master\n unless @running\n if collins_secondary_role == 'master'\n @master = false\n else\n pool = Jetpants.topology.pool(collins_pool)\n @master = pool.master if pool\n end\n end\n\n # We completely ignore cross-data-center master unless inter_dc_mode is enabled.\n # This may change in a future Jetpants release, once we support tiered replication more cleanly.\n if @master && @master.in_remote_datacenter? && !Jetpants::Plugin::JetCollins.inter_dc_mode?\n @remote_master = @master # keep track of it, in case we need to know later\n @master = false\n elsif !@master\n in_remote_datacenter? # just calling to cache for current node, before we probe its slaves, so that its slaves don't need to query Collins\n end\n end", "def perform\n track do\n reset!\n\n Restforce::DB::Registry.each do |mapping|\n run(\"CLEANING RECORDS\", Cleaner, mapping)\n run(\"ATTACHING RECORDS\", Attacher, mapping)\n run(\"PROPAGATING RECORDS\", Initializer, mapping)\n run(\"COLLECTING CHANGES\", Collector, mapping)\n end\n\n # NOTE: We can only perform the synchronization after all record\n # changes have been aggregated, so this second loop is necessary.\n Restforce::DB::Registry.each do |mapping|\n run(\"UPDATING ASSOCIATIONS\", Associator, mapping)\n run(\"APPLYING CHANGES\", Synchronizer, mapping)\n end\n end\n end", "def increment_replica_count\n self.original['spec']['replicas'] += 1\n end", "def check\n refresh\n primary_status = self.primary_status\n secondary_status = self.secondary_status\n mark_message \"Connected to #{session.cluster.nodes.count} nodes in mongodb replica set '#{primary_status['set']}'\"\n rescue ConnectionFailed => e\n mark_failure\n mark_message \"Error: '#{e}'\"\n end", "def execute\n return performModify(true)\n end", "def prepare_replication\n exclude_rubyrep_tables\n\n puts \"Verifying RubyRep tables\"\n ensure_infrastructure\n\n call_after_infrastructure_setup_handler\n\n puts \"Checking for and removing rubyrep triggers from unconfigured tables\"\n restore_unconfigured_tables\n\n puts \"Verifying rubyrep triggers of configured tables\"\n unsynced_table_pairs = []\n table_pairs = session.sort_table_pairs(session.configured_table_pairs)\n table_pairs.each do |table_pair|\n table_options = options(table_pair[:left])\n ensure_sequence_setup table_pair,\n table_options[:sequence_increment],\n table_options[:left_sequence_offset],\n table_options[:right_sequence_offset]\n\n unsynced = false\n [:left, :right].each do |database|\n next if session.configuration.send(database)[:mode] == :slave\n if !trigger_exists? database, table_pair[database]\n create_trigger database, table_pair[database]\n unsynced = true\n elsif !sync_complete? database, table_pair[database]\n unsynced = true\n end\n end\n if unsynced and table_options[:initial_sync]\n unsynced_table_pairs << table_pair\n end\n end\n unsynced_table_specs = unsynced_table_pairs.map do |table_pair|\n \"#{table_pair[:left]}, #{table_pair[:right]}\"\n end\n\n # Initialize heartbeat file\n RR.heartbeat(session.configuration.options[:heartbeat_file])\n\n unless session.configuration.options[:no_sync] || unsynced_table_specs.empty?\n puts \"Executing initial table syncs\"\n runner = SyncRunner.new\n runner.session = session\n runner.options = {:table_specs => unsynced_table_specs, :heartbeat_file => session.configuration.options[:heartbeat_file]}\n runner.execute\n end\n\n puts \"Starting replication\"\n end", "def execute(sql, opts=OPTS, &block)\n if sql.is_a?(Symbol)\n execute_prepared_statement(sql, opts, &block)\n else\n synchronize(opts[:server]){|c| _execute(c, sql, opts, &block)}\n end\n rescue Connection::Error => e\n raise_error(e)\n end", "def execute\n # build the query string\n # run the query\n # return the results\n end", "def index\n @session_replicas = SessionReplica.all\n end", "def read_replica_db_cluster_identifiers\n data[:read_replica_db_cluster_identifiers]\n end", "def read_replica_source_db_instance_identifier\n data[:read_replica_source_db_instance_identifier]\n end", "def delete_failed_replica(collection:, shard:, replica:)\n Utils.solr_request(\n connection,\n 'DELETEREPLICA',\n extra_params: {\n 'collection' => collection,\n 'shard' => shard,\n 'replica' => replica\n }\n )\n rescue RSolr::Error::Http => _e\n false\n end", "def ping\n exec_no_retry(\"select 1 from dual\")\n @active = true\n rescue Java::JavaSql::SQLException => e\n @active = false\n raise OracleEnhanced::ConnectionException, e.message\n end", "def exec(query, args = [], result = 0, &block)\n connect do |c|\n t = Txn.new(c, @log)\n if block_given?\n t.exec(query, args, result, &block)\n else\n t.exec(query, args, result)\n end\n end\n end", "def prime_database\n table = @creds['table']\n prime_script = \"#{APPSCALE_HOME}/AppDB/#{table}/prime_#{table}.py\"\n retries = 10\n loop {\n Djinn.log_run(\"APPSCALE_HOME='#{APPSCALE_HOME}' MASTER_IP='localhost' \" +\n \"LOCAL_DB_IP='localhost' python #{prime_script} \" +\n \"#{@creds['replication']}; echo $? > /tmp/retval\")\n retval = `cat /tmp/retval`.to_i\n return if retval.zero?\n Djinn.log_warn(\"Failed to prime database. #{retries} retries left.\")\n Kernel.sleep(5)\n retries -= 1\n break if retries.zero?\n }\n\n Djinn.log_fatal(\"Failed to prime #{table}. Cannot continue.\")\n HelperFunctions.log_and_crash(\"Failed to prime #{table}.\")\n end", "def db(*args)\n adapter = repository(:default).adapter\n args.first =~ /^select /i ? adapter.select(*args) : adapter.execute(*args)\n end", "def exec(*args, &block)\n if current = Thread.current[:squirm_connection]\n current.exec(*args, &block)\n else\n use {|conn| conn.exec(*args, &block)}\n end\n end", "def schedule_primary_and_connect #:nodoc:\n # Dump the one we were trying if it wasn't connected\n current = server_pool.shift\n\n # In case there was an error from the server we will take it out from rotation\n # unless we specify infinite reconnects via setting :max_reconnect_attempts to -1\n if current && (options[:max_reconnect_attempts] < 0 || can_reuse_server?(current))\n server_pool << current\n end\n\n # If we are out of options, go ahead and disconnect then\n # handle closing connection to NATS.\n process_disconnect and return if server_pool.empty?\n\n # bind new one\n next_server = bind_primary\n\n # If the next one was connected and we are trying to reconnect\n # set up timer if we tried once already.\n if should_delay_connect?(next_server)\n schedule_reconnect\n else\n attempt_reconnect\n schedule_primary_and_connect if had_error?\n end\n end", "def execute_query(sql, args)\n\t\t\t\t\t@db.log_connection_yield(sql, self, args){args ? self.async_exec(sql, args) : self.async_exec(sql)}\n\t\t\t\tend", "def jobs\n db[TABLE_NAME]\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end", "def query_execute(statement, operations = [], options = nil)\n policy = create_policy(options, WritePolicy, default_write_policy)\n\n if statement.nil?\n raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::INVALID_COMMAND, \"Query failed of invalid statement.\")\n end\n\n statement = statement.clone\n unless operations.empty?\n statement.operations = operations\n end\n\n task_id = statement.task_id\n nodes = @cluster.nodes\n if nodes.empty?\n raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::SERVER_NOT_AVAILABLE, \"Query failed because cluster is empty.\")\n end\n\n # Use a thread per node\n nodes.each do |node|\n Thread.new do\n Thread.current.abort_on_exception = true\n begin\n command = ServerCommand.new(@cluster, node, policy, statement, true, task_id)\n execute_command(command)\n rescue => e\n Aerospike.logger.error(e)\n raise e\n end\n end\n end\n ExecuteTask.new(@cluster, statement)\n end", "def establish_master_connection\n establish_connection(configuration.merge(\n \"database\" => \"postgres\",\n \"password\" => su_password,\n \"schema_search_path\" => \"public\",\n \"username\" => su_username\n ))\n end", "def pause_replication_with(sibling)\n [self, sibling].each &:pause_replication\n \n # self and sibling at same coordinates: all done\n return true if repl_binlog_coordinates == sibling.repl_binlog_coordinates\n \n # self ahead of sibling: handle via recursion with roles swapped\n return sibling.pause_replication_with(self) if ahead_of? sibling\n \n # sibling ahead of self: catch up to sibling\n sibling_coords = sibling.repl_binlog_coordinates\n output \"Resuming replication from #{@master} until (#{sibling_coords[0]}, #{sibling_coords[1]}).\"\n output(mysql_root_cmd \"START SLAVE UNTIL MASTER_LOG_FILE = '#{sibling_coords[0]}', MASTER_LOG_POS = #{sibling_coords[1]}\")\n sleep 1 while repl_binlog_coordinates != sibling_coords\n true\n end", "def execute!; end", "def execute(node)\n message = operation.piggyback(concern.command(database))\n node.process(message)\n end", "def get_all_replicas(id, options = GetAllReplicasOptions.new) end", "def execute *operations\n results = operations.map do |op|\n if tables.include? op.table\n op.execute @db[op.table]\n end\n end\n results.grep(Spinoza::ReadResult)\n end", "def execute()\n\n end", "def execute()\n\n end", "def test_writers_should_not_share_a_connection_with_replicas\n refute_equal(\n (AbstractPool1DbA.connected_to(role: :writing) { Pool1DbA.connection.raw_connection }),\n (AbstractPool1DbA.connected_to(role: :reading) { Pool1DbA.connection.raw_connection })\n )\n end", "def execute_query(sql, args)\n @db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}\n end", "def working\n waiting.invert\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end", "def execute\n Engine.instance.execute([self])[0]\n end", "def primary\n @primary ||= create_primary\n end", "def execute(sql, opts)\n r = synchronize(opts[:server]) do |conn|\n log_connection_yield((log_sql = opts[:log_sql]) ? sql + log_sql : sql, conn) do\n conn.query_with_flags(sql, timezone.nil? || timezone == :local ? LOCAL_TIME_QUERY_FLAGS : QUERY_FLAGS)\n end\n end\n yield r\n rescue ::Trilogy::Error => e\n raise_error(e)\n end", "def read_replica_identifiers\n data[:read_replica_identifiers]\n end", "def execute\n\n end", "def connect_to_master # :nodoc:\n return unless @master_uri\n\n tcp_server = DRb.start_service\n\n master = DRb::DRbObject.new_with_uri @master_uri\n\n c = DRb::Worm::Connection.new\n c.ca = master.ca\n\n DRb.primary_server = c.start_service\n\n DRb.remove_server tcp_server\n\n tcp_server.stop_service\n\n DRb.primary_server\n end" ]
[ "0.7477597", "0.668392", "0.6670695", "0.65752465", "0.608348", "0.608348", "0.60500693", "0.5932167", "0.59185046", "0.58502245", "0.5722108", "0.5598713", "0.5598639", "0.55542797", "0.5521975", "0.55065924", "0.55016047", "0.54923815", "0.5486671", "0.54787755", "0.5448023", "0.5414075", "0.54099977", "0.5387376", "0.5369433", "0.53573143", "0.5350424", "0.5350424", "0.5315527", "0.52992386", "0.5296462", "0.5294086", "0.52773774", "0.5206851", "0.52060425", "0.52060425", "0.52052736", "0.5197004", "0.5181452", "0.51608956", "0.51520133", "0.51293314", "0.5123597", "0.5111791", "0.51002246", "0.50988203", "0.50671524", "0.5057074", "0.5047545", "0.50439405", "0.504172", "0.5041492", "0.50379604", "0.5027961", "0.50164634", "0.4999032", "0.49926752", "0.49843037", "0.49792433", "0.49701214", "0.49681765", "0.49289125", "0.48943296", "0.4890497", "0.4889462", "0.4887091", "0.48839906", "0.48835522", "0.48745105", "0.48713148", "0.48695937", "0.48679942", "0.48646197", "0.48459703", "0.48417673", "0.4827471", "0.4826396", "0.48171365", "0.48143297", "0.4813488", "0.48078597", "0.47991195", "0.47888047", "0.47856745", "0.47810614", "0.47753152", "0.47697002", "0.47519124", "0.47498187", "0.47485366", "0.47485366", "0.47479558", "0.4747935", "0.4747001", "0.4745046", "0.47419545", "0.4737658", "0.47373238", "0.4732995", "0.4722982" ]
0.7675419
0
Make these few schema related methods available before having switched to a shard.
def with_default_shard(&block) if is_sharded? && current_shard_id.nil? && table_name != ActiveRecord::SchemaMigration.table_name on_first_shard(&block) else yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schema\n raise NotImplementedError\n end", "def functional_update_schema # abstract\n raise 'abstract'\n end", "def shard; end", "def skip_schema_queries; end", "def is_schemaless(options = {})\n options = { }.merge(options)\n # Add class-methods\n extend DataMapper::Is::Schemaless::ClassMethods\n # Add instance-methods\n include DataMapper::Is::Schemaless::InstanceMethods\n class_inheritable_accessor(:indexes)\n self.indexes ||= {}\n \n property :added_id, DataMapper::Types::Serial, :key => false \n property :id, DataMapper::Types::UUID, :unique => true, \n :nullable => false, \n :index => true,\n :default => Proc.new{ Guid.new.to_s }\n property :updated, DataMapper::Types::EpochTime, :key => true, \n :index => true, \n :default => Proc.new{ Time.now }\n property :body, DataMapper::Types::Json, :default => {}\n \n before :save, :add_model_type\n end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def migrate\n raise NotImplementedError\n end", "def abstract!\n GraphQL::SCHEMA.remove_call(self)\n end", "def run(&block)\n original_path = @connection.schema_search_path\n set_path_if_required(@schema)\n yield\n ensure\n set_path_if_required(original_path)\n end", "def alter_schemata\n end", "def alter_schemata\n end", "def set_schema(schema)\n define_class_method(:schema) {schema.to_s.to_sym}\n end", "def run\n # Ensure this is never run with a dirty in-memory shard cache\n ::Switchman::Shard.clear_cache\n migrate_strands\n migrate_everything\n end", "def broken_analyze_method_wtf\n ap Schema.create_from_many(schemas).attributes\n end", "def user_defined_schemas(stream)\n return if (list = (@connection.user_defined_schemas - ['public'])).empty?\n\n stream.puts \" # Custom schemas defined in this database.\"\n list.each { |name| stream.puts \" create_schema \\\"#{name}\\\", force: :cascade\" }\n stream.puts\n end", "def schema\n adapter.schema\n end", "def load_schemas!\n @schema_store.load_schemas!\n end", "def initialize(_, context = Ramom::Schema::Definition::Context.new)\n super\n infer_base_relations\n end", "def apply_schema_transformations\n # replace_exclusive_indicators_by_discriminators\n end", "def schema_updates\n @schema_updates ||= %i[\n add_vpc_subnet_id_to_amazon_clouds\n add_cluster_code_to_clusters\n add_ssh_port_to_data_centers\n add_ssh_port_to_amazon_clouds\n add_custom_jmeter_installer_url_to_projects\n ]\n end", "def methods() end", "def define_schema\n yield schema if block_given?\n end", "def initialize_schema!\n Schema.create(self)\n end", "def setup_object_for_schema\n data_collection_names.each.with_index do |data_collection_name, i|\n # define getter\n self.define_singleton_method(var_names[i]) do\n @data_collections[i]\n end\n # define setter\n self.define_singleton_method((data_collection_names[i].to_s + \"=\").to_sym) do |val|\n @data_collections[i] = val\n end\n end\n \n data_object_names.each.with_index do |data_object_name, i|\n # getters\n self.define_singleton_method(data_object_name) do\n @data_objects[i]\n end\n # setters\n self.define_singleton_method((data_object_name.to_s + \"=\").to_sym) do |val|\n @data_objects[i] = val\n end\n end\n \n end", "def skip_schema_queries=(_arg0); end", "def schema\n self.class.schema\n end", "def schema\n self\n end", "def chooseSchema\n @metadata.chooseSchema\n end", "def shard_for(id)\n result = self.result_for(id)\n ds = result.connection[schema_and_table(result)]\n ds.row_proc = self\n dataset_method_modules.each { |m| ds.instance_eval { extend(m) } }\n ds.shard_number = result.shard_number\n ds.model = self\n ds.tap do |d|\n Sequel::SchemaSharding::DTraceProvider.provider.shard_for.fire(id.to_s, d.shard_number, self.table_name_s) if Sequel::SchemaSharding::DTraceProvider.provider.shard_for.enabled?\n end\n end", "def setup *args, &block\n setup_without_mongoid *args, &block\n\n require 'active_admin/mongoid/comments'\n require 'active_admin/mongoid/adaptor'\n require 'active_admin/mongoid/filter_form_builder'\n require 'active_admin/mongoid/data_access'\n require 'active_admin/mongoid/resource'\n require 'active_admin/mongoid/document'\n require 'active_admin/mongoid/helpers/collection'\n require 'active_admin/mongoid/criteria'\n\n end", "def _define_methods\n @store.transaction(true){@store[@id]}.each_key do |method|\n _define_method(method)\n end\n end", "def schema\n connection.schema\n end", "def apply_schema(name, type, options={})\n raise NotImplementedError\n end", "def require_set_write_concern\n before do\n if ClusterConfig.instance.topology == :sharded && ClusterConfig.instance.short_server_version >= '4.0'\n skip \"mongos 4.0+ overrides write concern\"\n end\n end\n end", "def methods\n super + DELEGATED_METHODS\n end", "def scaffold_setup\n return if @scaffolding_shared_resources_are_setup\n self.scaffolded_methods ||= Set.new\n self.scaffolded_nonidempotent_methods ||= Set.new\n self.scaffolded_auto_complete_associations ||= {}\n scaffold_setup_helper\n @scaffolding_shared_resources_are_setup = true\n end", "def internal_methods; end", "def schema_overrides\n @schema_overrides || {}\n end", "def prepare_schema\n begin\n ActiveRecord::Schema.define do\n # a twobot instance\n create_table :twobots do |t|\n t.string :name\n t.string :status, :null => false, :default => \"active\"\n end\n add_index :twobots, :name\n \n # has many twitter searches\n create_table :searches do |t|\n t.integer :twobot_id, :null => false\n t.string :query, :null => false\n t.integer :last_twid, :null => false, :default => 0\n t.timestamp :last_run\n t.integer :last_result_count\n t.integer :total, :default => 0\n end\n add_index :searches, :query\n \n # a search has many actions\n create_table :actions do |t|\n t.integer :search_id, :null => false\n t.text :code\n end\n \n # cache of tweets\n create_table :tweets do |t|\n t.integer :twid, :null => false\n t.string :from_user\n t.string :to_user\n t.integer :from_user_id\n t.integer :to_user_id\n t.string :text\n t.string :profile_image_url\n t.timestamp :created_at\n end\n add_index :tweets, :twid\n end\n rescue\n end\n end", "def shard_world; end", "def create_setters\n schema_fields.keys.each do |key|\n self.class.send(:define_method, \"#{key.to_s}=\".to_sym) do |value| \n @data[key] = value #get_value key, value\n end\n end\n end", "def get_schematron_processor\n raise \"Implement me damn it\"\n end", "def get_schematron_processor\n raise \"Implement me damn it\"\n end", "def run(conn, identifier)\n builder = DbAgile::Core::Schema::builder\n builder.schema(identifier){\n builder.logical{ load_logical_schema(conn, builder) }\n builder.physical{ load_physical_schema(conn, builder) }\n }\n builder._dump\n end", "def get_schemas\n @schemas\n end", "def switch!\n solr_endpoint.switch!\n fcrepo_endpoint.switch!\n redis_endpoint.switch!\n data_cite_endpoint.switch!\n switch_host!(cname)\n setup_tenant_cache(cache_api?) if self.class.column_names.include?('settings')\n end", "def schema(&block)\n ActiveRecord::Schema.define(version: 0, &block)\nend", "def prepare_schema\n tables = [];ActiveRecord::Base.connection.execute(\"show tables\").each{|t| tables << t[0].strip}\n \n ActiveRecord::Schema.define do\n App.log.info(\"preparing schema\")\n \n unless tables.include?(\"services\")\n # a service entry\n begin\n create_table :services do |t|\n t.string :name\n t.string :status, :null => false, :default => \"active\"\n end\n add_index :services, :name\n rescue\n App.log_exception\n end\n end\n \n unless tables.include?(\"queries\")\n begin\n # queries\n create_table :queries do |t|\n t.string :query \n t.column :last_twid, :bigint, :null => false, :default => 0\n t.timestamp :last_run\n t.integer :last_result_count\n t.string :status, :default => 'active', :null=> false\n end\n add_index :queries, :query\n rescue\n App.log_exception\n end\n end\n \n unless tables.include?(\"tweets\")\n begin\n # cache of tweets\n create_table :tweets do |t|\n t.column :twid, :bigint, :null => false\n t.string :from_user\n t.string :to_user\n t.integer :from_user_id\n t.integer :to_user_id\n t.string :text\n t.string :profile_image_url\n t.timestamp :created_at\n end\n add_index :tweets, :twid\n rescue\n App.log_exception\n end\n end\n \n end # define schema\n end", "def run_load_schema\n load_code\n connect_to_database(false)\n require 'cloud_crowd/schema.rb'\n end", "def schema\n @schema ||= metadata.ancestors('Schema').first\n end", "def set_schema\n @schema = Schema.find(params[:id])\n end", "def shard_definitions\n definitions.dup\n end", "def schema\n @schema || (superclass.schema unless superclass == Model)\n end", "def method_missing(method, *args, &block)\n @klass.connection().current_shard = @shard\n @klass = @klass.send(method, *args, &block)\n return nil if @klass.nil?\n return @klass if @klass.is_a?(ActiveRecord::Base) or @klass.is_a?(Array) or @klass.is_a?(Fixnum)\n return self\n end", "def version; schema.version; end", "def schema\n @schema ||= []\n end", "def scheme_switch\n super\n end", "def set_functions\n super\n end", "def set_schema\n @schema = Schema.find(params[:id])\n end", "def set_schema\n @schema = Schema.find(params[:id])\n end", "def set_schema\n @schema = Schema.find(params[:id])\n end", "def _sanity_check(schema)\n raise SchemaInternalError, \"No name provided on #{self}\" if name.nil?\n super(schema)\n end", "def migration_railties; end", "def migration_railties; end", "def fields!\n @schema.fields!\n end", "def single_object_db; end", "def apis; end", "def set_schema( schema )\n @schema = schema if @schema == self\n schema\n end", "def default_scaffold_methods\n @default_scaffold_methods ||= @@default_scaffold_methods\n end", "def request_schema(&block)\n request_class = const_defined?(:Request) ? const_get(:Request) : const_set(:Request, Class.new { include ::Proper::Api::Entity })\n request_class.schema(fields: true) do |s|\n s.instance_eval(&block)\n end\n end", "def overrides; end", "def get_schema\n @schema = self\n yield\n @schema unless @schema == self\n ensure\n @schema = nil\n end", "def test_can_disable_synchronize_schema\n setup_schema\n\n begin\n cluster = Cassandra.cluster(synchronize_schema: false)\n refute cluster.has_keyspace?(\"simplex\"), \"Expected cluster metadata to not include keyspace 'simplex'\"\n\n cluster.refresh_schema\n assert cluster.has_keyspace?(\"simplex\"), \"Expected cluster metadata to include keyspace 'simplex'\"\n ensure\n cluster && cluster.close\n end\n end", "def shard\n self\n end", "def define_read_methods\n self.class.columns_hash.each do |name, column|\n unless respond_to_without_attributes?(name)\n define_read_method(name.to_sym, name, column)\n end\n\n unless respond_to_without_attributes?(\"#{name}?\")\n define_question_method(name)\n end\n end\n end", "def public_instance_methods(include_super=true) end", "def define_accessors\n columns.each do |column|\n underscored_column_name = column.name.underscore\n unless respond_to?(underscored_column_name)\n self.class.send :define_method, underscored_column_name do\n @attributes[column.name.underscore]\n end\n end\n end\n end", "def client_access\n super\n end", "def query_methods(result_type); end", "def orm; end", "def define_accessors\n self.metadata.properties_and_identity.each do |name, _|\n self.model.send :attr_accessor, name.downcase\n end\n end", "def schema\n []\n end", "def move_schema_content_step_by_step(old_schema, new_schema)\n @user.in_database(as: :superuser) do |conn|\n database = Database.new(@user.database_name, conn)\n database.create_schema(new_schema)\n @user.db_service.rebuild_quota_trigger_with_database(conn)\n\n conn.transaction do\n @user.real_tables(old_schema).\n each { |t| move_table_to_schema(t, conn, old_schema, new_schema) }\n\n views(conn, old_schema).\n each { |v| move_view_to_schema(v, conn, old_schema, new_schema) }\n\n materialized_views(conn, old_schema).\n each { |v| move_materialized_view_to_schema(v, conn, old_schema, new_schema) }\n\n functions(conn, old_schema).\n each { |f| move_function_to_schema(f, conn, old_schema, new_schema) }\n end\n end\n end", "def api_methods\n self.class.instance_methods(false)\n end", "def api_methods\n self.class.instance_methods(false)\n end", "def load_schema!\n @columns_hash = _projection_fields.except(*ignored_columns)\n\n @columns_hash.each do |name, column|\n define_attribute(\n name,\n connection.lookup_cast_type_from_column(column),\n default: column.default,\n user_provided_default: false\n )\n end\n end", "def definition\n super\n end", "def definition\n super\n end", "def refresh_schema\n GraphQL::Client.dump_schema(HTTP, SCHEMA_PATH)\n end", "def functions(name = nil)\n raise \"Internal Error: Connection adapter did not override abstract function\"\n end", "def public; end", "def public; end", "def right_primary_key_methods\n cached_fetch(:right_primary_key_methods){Array(right_primary_key_method)}\n end", "def db; end", "def db; end", "def get_setter_methods\n if allowed_columns\n # SEQUEL5: Remove allowed_columns handling\n allowed_columns.map{|x| \"#{x}=\"}\n else\n meths = instance_methods.map(&:to_s).select{|l| l.end_with?('=')} - RESTRICTED_SETTER_METHODS\n meths -= Array(primary_key).map{|x| \"#{x}=\"} if primary_key && restrict_primary_key?\n meths\n end\n end", "def instance_methods; end", "def protected_methods(all=true) end" ]
[ "0.6222472", "0.59928584", "0.5924963", "0.5776597", "0.5715524", "0.56666434", "0.56666434", "0.56666434", "0.56666434", "0.56546825", "0.5568859", "0.5504111", "0.54901856", "0.54901856", "0.5479614", "0.54578036", "0.545367", "0.5418144", "0.5410225", "0.54036254", "0.5380673", "0.53724533", "0.53710586", "0.53531134", "0.53505117", "0.53429073", "0.530942", "0.5308068", "0.5303162", "0.5291131", "0.5263711", "0.52627873", "0.52418566", "0.521962", "0.52102", "0.5207345", "0.5197309", "0.5177439", "0.51729965", "0.51660156", "0.51192105", "0.51150805", "0.51034236", "0.5081698", "0.5076075", "0.5076075", "0.50342804", "0.5029663", "0.5028671", "0.5016598", "0.5008651", "0.50055826", "0.499604", "0.49946186", "0.49924773", "0.49911815", "0.4988596", "0.49859476", "0.4972009", "0.49679762", "0.49611628", "0.49409968", "0.49409968", "0.49390662", "0.49245337", "0.49219367", "0.49219367", "0.4919464", "0.49156064", "0.490732", "0.49071145", "0.4904547", "0.48984167", "0.48978436", "0.48965138", "0.48835272", "0.4876675", "0.4876488", "0.48749107", "0.48741606", "0.48680195", "0.4866058", "0.4865715", "0.4865536", "0.48614067", "0.485699", "0.48566324", "0.48566324", "0.48550555", "0.48513782", "0.48513782", "0.4850638", "0.48435447", "0.48406753", "0.48406753", "0.4832374", "0.48285183", "0.48285183", "0.4820578", "0.48154706", "0.48131996" ]
0.0
-1
GET /companies GET /companies.xml
def index @title = "Customer Relation Management" @companies = Company.all @contacts = Contact.all @opportunities = Opportunity.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @companies } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = @person.companies\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n\n @company = Company.find(params[:id])\n\n\n \n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def index\n @companies = NasdaqCompany.all_companies\n respond_with(@companies)\n end", "def index\n @companies = current_user.companies.paginate(:page => 1, :page => params[:page], :order => \"name DESC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def show\n @title = \"Show Company\"\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend", "def index\n if request.format.to_sym == :html\n @companies = Company.page(params[:page]).order(\"LOWER(name)\")\n else\n @companies = Company.all\n end\n respond_with(@companies)\n end", "def index\n @contacts = current_company.contacts\n respond_to do |format|\n format.xml { render :xml => @contacts }\n format.json { render :json => @contacts }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @company }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def show\n @lib_company = LibCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lib_company }\n end\n end", "def index\n\t\t@companies = Company.all\n\tend", "def index\n\t\t@companies = Company.all\n\tend", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n\n end", "def show\n @az_company = AzCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @az_company }\n end\n end", "def index\n @companies = ClientCompany.all\n end", "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def show\n @companies = Company.all\n end", "def show\n @company = Company.find(params[:id])\n @title = @company.name\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def company_information(params)\n get('company-information',params)\n end", "def index\n @companies_info = Company.display_information\n end", "def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end", "def show\n\n @asset_company = AssetCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset_company }\n end\n end", "def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n respond_to do |format|\n format.html {}\n format.json {render json: {message: @companies}, status: 200}\n end\n end", "def index\n @companions = Companion.all\n end", "def index\n #location = GeoIp.geolocation('99.104.74.184')\n #companies = Company.within(5, :origin => [location[:latitude],location[:longitude]])\n #raise companies.inspect\n @companies = Company.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @business_companies = Business::Company.all\n end", "def showinfos\n# @company = Company.find_by_webaddress(params[:webaddress ])\n @company = Company.find(params[:id ])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def companies\n signed_get(COMPANIES_PATH)\n end", "def index\n @account_companies = Account::Company.all\n end", "def index\n\t\tif current_user.user_role.code == 'admin'\n\t\t\t@companies = Company.all\n\t\telse\n\t\t\t@companies = current_user.created_companies\n\t\tend\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @companies }\n\t\tend\n\tend", "def show\n @company_profile = CompanyProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company_profile }\n end\n end", "def all\n endpoint = 'Companies'\n response = JSON.parse(@client.get(endpoint).body)\n companies = response.key?('Items') ? response['Items'] : []\n companies.map { |attributes| Unleashed::Company.new(@client, attributes) }\n end", "def index\n @companies = Company.order(:name).page(params[:page]).per(10)\n end", "def show\n\t\t@company = Company.find(params[:id])\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @company }\n\t\tend\n\tend", "def index\n @companies = Company.all.page params[:page]\n end", "def show\n @breadcrumb = 'read'\n @company = Company.find(params[:id])\n @offices = @company.offices.paginate(:page => params[:page], :per_page => per_page).order(:office_code)\n @notifications = @company.company_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n @accounts = @company.company_bank_accounts.paginate(:page => params[:page], :per_page => per_page).order(:id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def show\n @companyprofile = Companyprofile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @companyprofile }\n end\n end", "def index\n @contact_companies = ContactCompany.all\n end", "def show\n @holding_company = HoldingCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @holding_company }\n end\n end", "def index\r\n # Get all companies alphabetized\r\n #@companies = Company.order(\"LOWER(name)\")\r\n @companies = Company.order(\"LOWER(name)\").paginate(:page =>params[:page], :per_page =>10)\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @companies }\r\n end\r\n end", "def index\n @companies = Company.paginate :page=>params[:page], :per_page => 5\n\n #redirect_to search_all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n format.xml { render :xml => @regios }\n end\n end", "def index\n @customer_companies = CustomerCompany.all\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = current_user.companies.find(params[:id])\n\n @events = @company.events.paginate(:page => 1, :page => params[:page], :per_page => 10, :order => \"created_at DESC\")\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def index\n\t\t@companies = []\n if params[:query].nil?\n @products = []\n else\n @products = Product.search params[:query]\n @products.each do |product|\n product.companies.each do |company|\n if !@companies.include? company\n @companies << company\n end\n end\n end\n end\n\tend", "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n @companies = current_user.account.companies || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @company = Company.find(params[:company_id])\n @positions = @company.positions\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def index\n @compania = Companium.all\n end", "def index\n @companies = current_user.companies.all\n flash[:notice] = t('flash.actions.index.notice') if @companies.empty?\n respond_with(@companies)\n end", "def company_info(company_id, *fields)\n get(\"/organizations/#{company_id}#{field_selector(fields)}\")\n end", "def show\n @company = Company.find(params[:id])\n employees_and_bio_signals\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @company = Company.all\n end", "def index\n @companies = Company.paginate(page: params[:page]).per_page(10) # pagination (gem 'will_paginate')\n end", "def show\n @company = Company.find(params[:id])\n respond_with @company\n end", "def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def index\n @sale_representatives = SaleRepresentative.find_all_by_company_id(current_user.company_id) \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sale_representatives }\n end\n end", "def show\n #@company_dashboard = CompanyDashboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company_dashboard }\n end\n end", "def index\n @production_companies = ProductionCompany.all\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def index\n @visit_companies = VisitCompany.all\n end", "def companies\n\t\tEmpresa.all\n\tend", "def index\n @companies = Company.page(params[:page])\n @log = ParsingLog.running_parser\n\n render partial: \"companies_list\" if request.xhr? \n end", "def new\n @company = Company.new\n @regios = Regio.find(:all)\n @sectors = Sector.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\r\n @company = Company.find(params[:id])\r\n set_seo_meta(\"#{@company.name}\",\"#{Setting.app_name}#{t(\"companycommon.yellowpage\")}\")\r\n drop_breadcrumb(t(\"companies.mycompany\"))\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @company }\r\n end\r\n end", "def index\n @boms = Bom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boms }\n end\n end", "def index\n if params[:company_type]\n @search = @community.companies.where(:company_type => params[:company_type]).search(params[:q])\n else\n @search = @community.companies.search(params[:q])\n end\n @companies = @search.result\n\n @tab_name = \"companies\"\n @page_title = \"Companies\"\n @page_subtitle = \"Loyal Businesses\"\n @page_description = \"\"\n\n add_breadcrumb \"Companies\", companies_path, :title => \"#{@community.name} Companies\"\n end", "def index\n @corporacion_policiacas = CorporacionPoliciaca.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @corporacion_policiacas }\n end\n end" ]
[ "0.75398785", "0.75327474", "0.75327474", "0.75327474", "0.75327474", "0.7497508", "0.7146844", "0.6935157", "0.6935157", "0.6935157", "0.69347507", "0.6854752", "0.6850258", "0.6823983", "0.6816815", "0.67808086", "0.6750553", "0.6741065", "0.67320025", "0.67320025", "0.67320025", "0.67320025", "0.66725767", "0.66707134", "0.66469914", "0.66469914", "0.6607456", "0.6607456", "0.6607456", "0.6607456", "0.6607456", "0.6607456", "0.6560981", "0.6556446", "0.65541476", "0.6526707", "0.6525972", "0.65231854", "0.64756966", "0.6466929", "0.64550745", "0.64359", "0.6428573", "0.6385973", "0.63818", "0.6373657", "0.63717854", "0.63399947", "0.6320394", "0.6317547", "0.63025075", "0.629995", "0.6291091", "0.62796855", "0.6274167", "0.6273125", "0.6266063", "0.6264614", "0.626265", "0.6247407", "0.62243855", "0.62165993", "0.6209496", "0.6206384", "0.6197807", "0.6197807", "0.6197807", "0.6197807", "0.6197807", "0.6197807", "0.61974734", "0.61944723", "0.6180929", "0.6177406", "0.6162379", "0.61462694", "0.6138105", "0.613728", "0.6132357", "0.6128497", "0.61163193", "0.61111134", "0.60984564", "0.6093346", "0.60890186", "0.6088659", "0.6088659", "0.6088659", "0.6088659", "0.6088659", "0.6088659", "0.6088659", "0.6086375", "0.6085248", "0.60648215", "0.60533804", "0.6052905", "0.60512185", "0.6048592", "0.60400814" ]
0.68223643
14
GET /companies/1 GET /companies/1.xml
def show @company = Company.find(params[:id]) @title = @company.name respond_to do |format| format.html # show.html.erb format.xml { render :xml => @company } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = @person.companies\n\n respond_to do |format|\n format.html # index.html.haml\n format.xml { render :xml => @companies }\n end\n end", "def show\n\n @company = Company.find(params[:id])\n\n\n \n\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @title = \"Show Company\"\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def index\n @companies = Company.all\n @users = User.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def show\n @lib_company = LibCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lib_company }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @company }\n end\n end", "def index\n @title = \"Customer Relation Management\"\n @companies = Company.all\n @contacts = Contact.all\n\t@opportunities = Opportunity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = current_user.companies.paginate(:page => 1, :page => params[:page], :order => \"name DESC\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @contacts = current_company.contacts\n respond_to do |format|\n format.xml { render :xml => @contacts }\n format.json { render :json => @contacts }\n end\n end", "def show\n @az_company = AzCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @az_company }\n end\n end", "def show\n\n @asset_company = AssetCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @asset_company }\n end\n end", "def showinfos\n# @company = Company.find_by_webaddress(params[:webaddress ])\n @company = Company.find(params[:id ])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @company_profile = CompanyProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company_profile }\n end\n end", "def index\n @companies = Company.all\n @com_info = Company.last\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n if request.format.to_sym == :html\n @companies = Company.page(params[:page]).order(\"LOWER(name)\")\n else\n @companies = Company.all\n end\n respond_with(@companies)\n end", "def show\n @companyprofile = Companyprofile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @companyprofile }\n end\n end", "def index\n @companies = NasdaqCompany.all_companies\n respond_with(@companies)\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def get_information_all_companies()\n\t\tpage = 275\n\t\tbegin\n\t\t\turl = create_url(\"organizations\",\"\",page)\n\t\t\tputs \"Reading #{url}\"\n\t\t\tresult = read_url(url)\n\t\t\t#save_json(result, [\"organizations\"])\n\n\t\t\tadd_organization_info(result,\"name\")\n\t\t\tadd_organization_info(result,\"path\")\n\t\t\t\n\t\t\tnext_url = result['data']['paging']['next_page_url']\n\t\t\tpage = page + 1\n\t\tend while next_url != nil\n\t\tcreate_permalink(@paths)\n\t\tsave_json(\"\", [\"names\", \"paths\", \"permalinks\"])\n\tend", "def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @holding_company = HoldingCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @holding_company }\n end\n end", "def show\n\t\t@company = Company.find(params[:id])\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @company }\n\t\tend\n\tend", "def show\n @title = @company.titles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @title }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def index\n\t\t@companies = Company.all\n\tend", "def index\n\t\t@companies = Company.all\n\tend", "def show\n #@company_dashboard = CompanyDashboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company_dashboard }\n end\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def index\n @companies = Company.all\n end", "def show\r\n @company = Company.find(params[:id])\r\n set_seo_meta(\"#{@company.name}\",\"#{Setting.app_name}#{t(\"companycommon.yellowpage\")}\")\r\n drop_breadcrumb(t(\"companies.mycompany\"))\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @company }\r\n end\r\n end", "def company_information(params)\n get('company-information',params)\n end", "def show\n @breadcrumb = 'read'\n @company = Company.find(params[:id])\n @offices = @company.offices.paginate(:page => params[:page], :per_page => per_page).order(:office_code)\n @notifications = @company.company_notifications.paginate(:page => params[:page], :per_page => per_page).order('id')\n @accounts = @company.company_bank_accounts.paginate(:page => params[:page], :per_page => per_page).order(:id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @companies = Company.all\n\n end", "def index\n @companies = ClientCompany.all\n end", "def index\n @companies = Company.paginate :page=>params[:page], :per_page => 5\n\n #redirect_to search_all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n format.xml { render :xml => @regios }\n end\n end", "def new\n @company = Company.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @companies_info = Company.display_information\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n @regios = Regio.find(:all)\n @sectors = Sector.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @company = Company.find(params[:id])\n respond_with @company\n end", "def show\n @company = current_user.companies.find(params[:id])\n\n @events = @company.events.paginate(:page => 1, :page => params[:page], :per_page => 10, :order => \"created_at DESC\")\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def show\n @draft_company = DraftCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @draft_company }\n end\n end", "def show\n @companies = Company.all\n end", "def index\n #location = GeoIp.geolocation('99.104.74.184')\n #companies = Company.within(5, :origin => [location[:latitude],location[:longitude]])\n #raise companies.inspect\n @companies = Company.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def new\n @company = Company.new\n @battalion = Battalion.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def index\n @boms = Bom.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boms }\n end\n end", "def index\n @company = Company.find(params[:company_id])\n @positions = @company.positions\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @positions }\n end\n end", "def index\n @companies = Company.all.page params[:page]\n end", "def show\n @company = Company.find(params[:id])\n @company.projects.build\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @company }\n end\n end", "def index\n @companies = Company.all\n respond_to do |format|\n format.html {}\n format.json {render json: {message: @companies}, status: 200}\n end\n end", "def show\n @company = Company.find(params[:id])\n employees_and_bio_signals\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def index\n @companies = Company.all\n if @companies\n render json: {\n companies: @companies\n }\n else\n render json: {\n status: 500,\n errors: ['No companies']\n }\n end\n end", "def show\n\t begin\n\t\t if params[:id].to_i != 0\n\t\t\t # id given\n\t\t @company = Company.find(params[:id])\n\t\t else\n\t\t\t # name given\n\t\t\t @company = Company.find_by_name(params[:id])\n\t\t end\n\t rescue Exception => e\n\t\t @company = nil\n\t\tend\n\n\t if @company.nil?\n\t\t redirect_to root_path, alert: \"This company does not exist.\"\n\t\t return\n\t end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @asset_company = AssetCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asset_company }\n end\n end", "def index\n @companions = Companion.all\n end", "def index\n @complaints = Complaint.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @complaints }\n end\n end", "def index\n @business_companies = Business::Company.all\n end", "def company(id)\n record \"/contacts/company/#{id}\"\n end", "def index\n @sale_representatives = SaleRepresentative.find_all_by_company_id(current_user.company_id) \n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sale_representatives }\n end\n end", "def new\n @az_company = AzCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @az_company }\n end\n end", "def index\n @companies = companies_scope\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @companies }\n end\n end", "def new\n @lib_company = LibCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lib_company }\n end\n end", "def get_company\n @company = Company.find(params[:company_id])\n end", "def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @company = Company.find(id_from_params)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def show\n @complaint = Complaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @complaint }\n end\n end", "def show\n @biz_company = BizCompany.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @biz_company }\n end\n end", "def index\n @contactos = Contacto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contactos }\n end\n end", "def show\n @compra = Compra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @compra }\n end\n end", "def index\n @companies = Company.order(:name).page(params[:page]).per(10)\n end", "def index\n @criancas = Crianca.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @criancas }\n end\n end", "def index\n @account_companies = Account::Company.all\n end", "def call_company_service\n ch_api = CompaniesHouseApi.new\n response = ch_api.company company_number\n parse_response response\n end" ]
[ "0.7401719", "0.7401719", "0.7401719", "0.7401719", "0.73485667", "0.734687", "0.71413237", "0.7129088", "0.7129088", "0.7129088", "0.7043135", "0.6897895", "0.6831758", "0.681194", "0.67071956", "0.6641179", "0.6620508", "0.6617118", "0.6612846", "0.6560536", "0.6478701", "0.6461026", "0.64582855", "0.6452417", "0.64424515", "0.6407033", "0.6407033", "0.6407033", "0.6407033", "0.6375498", "0.6368063", "0.6366695", "0.63589436", "0.631446", "0.6296853", "0.6294997", "0.6294997", "0.6294997", "0.6294997", "0.6294997", "0.6294997", "0.6294997", "0.628092", "0.628092", "0.62754685", "0.6250114", "0.6250114", "0.6250114", "0.6250114", "0.6250114", "0.6250114", "0.62381095", "0.62272644", "0.6226104", "0.6218834", "0.6212941", "0.61963034", "0.61937517", "0.61829275", "0.61829275", "0.61829275", "0.61829275", "0.61829275", "0.61829275", "0.61669713", "0.61633044", "0.6161963", "0.61587834", "0.6154706", "0.6146737", "0.6140819", "0.61285496", "0.6120503", "0.6115396", "0.61065936", "0.6100701", "0.60963106", "0.6065555", "0.6055094", "0.6045686", "0.6045501", "0.6036341", "0.60229164", "0.60203654", "0.6018186", "0.6013599", "0.60119116", "0.60096556", "0.6006462", "0.5998361", "0.5997479", "0.5987927", "0.59843206", "0.5980766", "0.5976567", "0.5971688", "0.5965487", "0.5965073", "0.5964476", "0.59469396" ]
0.676628
14
GET /companies/new GET /companies/new.xml
def new @title = "Create a Company" @company = Company.new render :layout => false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @company }\n end\n end", "def new\n load_data\n @company = Company.new\n @contactinfo = Contactinfo.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @lib_company = LibCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lib_company }\n end\n end", "def new\n @company = Company.new\n @regios = Regio.find(:all)\n @sectors = Sector.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new(:name => 'default')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company }\n end\n end", "def new\n @az_company = AzCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @az_company }\n end\n end", "def new\n @companyprofile = Companyprofile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @companyprofile }\n end\n end", "def new\n @holding_company = HoldingCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @holding_company }\n end\n end", "def new\r\n @company = Company.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @company }\r\n end\r\n end", "def new\n @company_profile = CompanyProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company_profile }\n end\n end", "def new\n @asset_company = AssetCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @asset_company }\n end\n end", "def new\n @company = Company.new\n @battalion = Battalion.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n\t\t@company = Company.new\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.json { render json: @company }\n\t\tend\n\tend", "def new\n @draft_company = DraftCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @draft_company }\n end\n end", "def new\n# @category = Category.by_company(current_company.id).new\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @category }\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n flash[:notice] = 'Company was successfully created.'\n format.html { redirect_to(@company) }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @company = Company.new\n respond_with(@company)\n end", "def new\n @company = Company.new\n respond_with(@company)\n end", "def new\n @people = People.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @people }\n end\n end", "def new\n @company = Company.new\n respond_with @company\n end", "def new\n @contacts = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contacts }\n end\n end", "def new\n @contactos = Contactos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contactos }\n end\n end", "def new\n @person = Person.new\n @title = \"people\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n logger.debug 'new_some interesting information'\n @comdty = Comdty.new\n setvariables\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @comdty }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person }\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 @compra = Compra.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @compra }\n end\n end", "def new\n @biz_company = BizCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @biz_company }\n end\n end", "def new\n\t\t@company = Company.new\n\tend", "def new\n @new_project = Project.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @new_project }\n end\n end", "def new\n return unless representsCompany?\n\n @category = Category.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category }\n end\n end", "def new\n @project = Project.new :company_id => params[:company_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @personal = Personal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @personal }\n end\n end", "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end", "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end", "def new\n @organization = Organization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\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 respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @chronopay_link }\n end\n end", "def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end", "def new\n @contact = Contact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end", "def new\n @contacto = Contacto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contacto }\n end\n end", "def new\n @convenio = Convenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @convenio }\n end\n end", "def new\n add_breadcrumb \"add\", nil, \"glyphicon-plus-sign\"\n\n if current_user.account.companies.empty?\n respond_to do |format|\n format.html { redirect_to new_dashboard_company_url, status: 302, notice: 'You need to pick a company first.' }\n end\n else\n @companies_sites = current_user.account.companies.zip( current_user.account.sites )\n @current_company = @companies_sites.last.first\n @current_company_sites = @current_company.sites\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: [ @companies_sites, @current_company, @current_company_sites ] }\n end\n end\n end", "def new\n @company = current_user.companies.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @company_account = CompanyAccount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @company_account }\n end\n end", "def new\n @domain = Domain.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @domain }\n end\n end", "def new\n @contact = Contact.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contact }\n end\n end", "def new\n @curso = Curso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curso }\n end\n end", "def new\n @colo = Colo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colo }\n end\n end", "def new\n @sale_representative = SaleRepresentative.new\n @contact = Contact.find_all_by_company_id(current_user.company_id)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sale_representative }\n end\n end", "def new\n @portfolio = Portfolio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @portfolio }\n end\n end", "def new\n @protocolo = Protocolo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocolo }\n end\n end", "def new\n @company = Company.new\n end", "def new\n @person_contact = PersonContact.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @person_contact }\n end\n end", "def new\n @countries = Countries.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @countries }\n end\n end", "def new\n @resp = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @resp }\n end\n end", "def new\n @atom = Atom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atom }\n end\n end", "def new\n @company = Company.new\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @organization }\n end\n end", "def new\n @models = self.class.model_class.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @models }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project }\n end\n end" ]
[ "0.795994", "0.78861517", "0.78720635", "0.78720635", "0.78720635", "0.78720635", "0.78720635", "0.78720635", "0.78720635", "0.7652966", "0.7507527", "0.74248517", "0.7414509", "0.72888076", "0.7282765", "0.72074085", "0.71907026", "0.7183615", "0.718282", "0.7162448", "0.71567464", "0.714787", "0.714787", "0.714787", "0.714787", "0.714787", "0.714787", "0.714787", "0.714787", "0.714787", "0.714787", "0.70696974", "0.69814086", "0.6927659", "0.6907149", "0.6907149", "0.6907149", "0.69038516", "0.68939656", "0.68939656", "0.68821687", "0.6865532", "0.6780976", "0.67413074", "0.67149776", "0.6710557", "0.6708505", "0.6708505", "0.6708505", "0.6708505", "0.6708505", "0.6708505", "0.6708505", "0.6708505", "0.6708505", "0.6708505", "0.66872925", "0.6683585", "0.66801137", "0.66758484", "0.6674982", "0.6657709", "0.6649423", "0.6637765", "0.66335577", "0.66335577", "0.66330856", "0.66289777", "0.66289115", "0.66126734", "0.66099894", "0.66099894", "0.66099894", "0.6609417", "0.660901", "0.66068786", "0.6603685", "0.6592963", "0.6591524", "0.65831006", "0.65714955", "0.656521", "0.6561153", "0.65605825", "0.6557813", "0.6554998", "0.6554326", "0.65529794", "0.6543276", "0.653325", "0.6529854", "0.65295845", "0.65295845", "0.65262175", "0.6518275", "0.65107274", "0.65107274", "0.65054077", "0.65054077", "0.65054077", "0.65054077" ]
0.0
-1
POST /companies POST /companies.xml
def create @company = Company.new(params[:company]) if @company.save flash[:success] = "Company was successfully created." redirect_to crm_path else render :action => 'new'# Clear page end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n flash[:notice] = 'Company was successfully created.'\n format.html { redirect_to(@company) }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n if @company = Company.find(entity_id_from_params(:company))\n respond_to do |format|\n current_user.account.companies << @company\n format.html { redirect_to root_path, notice: 'Company was successfully created.' }\n format.json\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n if @company.save\n respond_with @company, status: :created, location: @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, :notice => 'Company was successfully created.' }\n format.json { render :json => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_new_companies\n params[:new_companies].each do |name|\n c = Company.new\n c.name = CGI.unescape(name)\n c.save\n @movie.production_companies << ProductionCompany.new( :company => c )\n end\n end", "def create\n @company = Company.new(params[:company])\n #@battalion = Battalion.find(params[:battalion_id])\n respond_to do |format|\n if @company.save\n flash[:notice] = 'Company was successfully created.'\n format.html { redirect_to :back }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(nested_params)\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = @community.companies.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @company = Company.new(params[:company])\r\n respond_to do |format|\r\n if @company.save\r\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\r\n format.json { render json: @company, status: :created, location: @company }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @company.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n \n @company = Company.new(params[:company])\n \n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Empresa foi criada com sucesso.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n format.html {\n redirect_to @company, notice: 'Company was successfully created.'\n }\n format.json {\n render json: @company, status: :created, location: @company\n }\n else\n format.html { render action: \"new\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def create\n render json: Company.create(params[\"company\"])\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n #format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n #format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render action: 'show', status: :created, location: @company }\n else\n format.html { render action: 'new' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account_company = Account::Company.new(account_company_params)\n\n respond_to do |format|\n if @account_company.save\n format.html { redirect_to @account_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @account_company }\n else\n format.html { render :new }\n format.json { render json: @account_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.json { render :show, status: :created, location: @company }\n SignUpNotifier.registrated(@company).deliver\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def companies\n render \"company/companies.json.jbuilder\", status: :ok\n end", "def create\n @company = Company.create!(company_params)\n end", "def create\n @company = current_user.companies.build(params[:company])\n logger.debug params.to_yaml\n # logger.debug @company.code\n @company.code.upcase!\n \n respond_to do |format|\n if @company.save\n flash[:notice] = 'Company was successfully created.'\n format.html { redirect_to(root_path) }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n if @company.save\n redirect_to @company, notice: \"Company was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n end", "def create\n # binding.pry\n @company = Company.new(params[:company])\n if @company.save\n UpdateMailer.update_email(@company, current_user, action_name).deliver\n flash[:notice] = 'Company was successfully created.'\n end\n respond_with(@company)\n end", "def create\n @company = Company.new(params[:company])\n\n respond_to do |format|\n if @company.save\n add_to_log(t('Company created log') + @company.name,\"companies\",\"create\")\n flash[:notice] = t('Company created')\n if params[:submit_continue] == I18n.t('Create and continue')\n format.html { redirect_to(:action => :new) }\n else\n format.html { redirect_to(@company) }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tyc_company = Tyc::Company.new(tyc_company_params)\n\n respond_to do |format|\n if @tyc_company.save\n format.html { redirect_to @tyc_company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @tyc_company }\n else\n format.html { render :new }\n format.json { render json: @tyc_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.new(project_params)\n @companies = Array.new\n @project.name = @project.name.upcase\n Company.all.each do |comp|\n @companies << [comp.name, comp.id]\n end\n respond_to do |format|\n if @project.save\n format.html { redirect_to @project, notice: 'Proyecto registrado exitosamente.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html {redirect_to @company, notice: 'Company was successfully created.'}\n format.json {render :show, status: :created, location: @company}\n else\n format.html {render :new}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html {redirect_to @company, notice: 'Company was successfully created.'}\n format.json {render :show, status: :created, location: @company}\n else\n format.html {render :new}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @contact = CompanyContact.new(params[:company_contact])\n if @contact.save\n respond_with @contact, status: :created, location: @contact\n else\n respond_with @contact, status: :unprocessable_entity\n end\n end", "def create\n @intelcompany = IntelCompany.new(intelcompany_params)\n\n if @intelcompany.save\n render json: @intelcompany, status: :created, location: @intelcompany\n else\n render json: @intelcompany.errors, status: :unprocessable_entity\n end\n\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Bar criado com sucesso.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lib_company = LibCompany.new(params[:lib_company])\n\n respond_to do |format|\n if @lib_company.save\n format.html { redirect_to(@lib_company, :notice => 'Lib company was successfully created.') }\n format.xml { render :xml => @lib_company, :status => :created, :location => @lib_company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lib_company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @company = Company.new\n @regios = Regio.find(:all)\n @sectors = Sector.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def create\n @contact_company = ContactCompany.new(contact_company_params)\n\n respond_to do |format|\n if @contact_company.save\n format.html { redirect_to @contact_company, notice: 'Contact company was successfully created.' }\n format.json { render action: 'show', status: :created, location: @contact_company }\n else\n format.html { render action: 'new' }\n format.json { render json: @contact_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = current_user.companies.build(params[:company])\n flash[:notice] = t('flash.actions.create.notice', :resource_name => Company.model_name.human) if @company.save\n respond_with(@company, :location => companies_path)\n end", "def create\n @company = Company.new(params[:company])\n \n if current_user\n\t @company.user_id = current_user.id\n end\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to(@company, :notice => 'Company was successfully created.') }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @company = Company.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def create\n @company = Company.new(company_params[:company])\n @companyAuthority = @company.company_authority.new(company_params[:company_authority])\n\n if (!company_params[:lobs].blank?)\n company_params[:lobs].each do |lob|\n @companyAuthority.lob.new(lob)\n end\n end\n\n if @company.save\n render json: @company, status: :created, location: @company\n else\n render json: ErrorSerializer.serialize(@company.errors), status: :unprocessable_entity\n end\n end", "def create\n @companyreg = Companyreg.new(companyreg_params)\n\n respond_to do |format|\n if @companyreg.save\n format.html { redirect_to @companyreg, notice: 'Companyreg was successfully created.' }\n format.json { render :show, status: :created, location: @companyreg }\n else\n format.html { render :new }\n format.json { render json: @companyreg.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n # User becomes company admin\n current_user.update_attribute(:company_id, @company.id)\n current_user.update_attribute(:company_admin, true)\n # Send email notifications to Admins and current user\n ExampleMailer.create_company_admin(@company).deliver\n ExampleMailer.create_company(@company).deliver\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(params[:company])\n @company.create_default_infos\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company successfully created.' }\n format.json { render json: @company, status: :created, location: @company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def index\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def create\n respond_to do |format|\n if @company.save\n flash[:notice] = \"#{@company.name} was successfully created.\"\n format.html { redirect_to @person }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n format.js { render :layout => false }\n else\n format.html { render :action => :new }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n format.js { render :action => :invalid, :layout => false }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n \n if @company.save\n redirect_to companies_path, notice: 'Company was successfully created.' \n else\n format.html { render :new }\n end\n end", "def create\n @pagetitle = \"New compro\"\n \n \n \n @company = Company.find(params[:compro][:company_id])\n @compro = Compro.new(compro_params)\n \n \n @locations = @company.get_locations()\n @divisions = @company.get_divisions()\n @transports = @company.get_transports()\n \n \n respond_to do |format|\n if @compro.save\n format.html { redirect_to(@compro, :notice => 'compro was successfully created.') }\n format.xml { render :xml => @compro, :status => :created, :location => @compro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @compro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @title = \"New Company\"\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @company }\n end\n end", "def create\n @global_company = GlobalCompany.new(params[:global_company])\n\n respond_to do |format|\n if @global_company.save\n format.html { redirect_to @global_company, notice: 'Global company was successfully created.' }\n format.json { render json: @global_company, status: :created, location: @global_company }\n else\n format.html { render action: \"new\" }\n format.json { render json: @global_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n company = Company.create(company_params)\n if company\n render json:{\n status: :created,\n company: company\n }\n else\n render json: { status: 500 }\n end\n\n \n \n end", "def create\n @visit_company = VisitCompany.new(visit_company_params)\n\n respond_to do |format|\n if @visit_company.save\n format.html { redirect_to @visit_company, notice: 'Visit company was successfully created.' }\n format.json { render :show, status: :created, location: @visit_company }\n else\n format.html { render :new }\n format.json { render json: @visit_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @new_company = NewCompany.new(new_company_params)\n @new_company.user = current_user\n\n respond_to do |format|\n if @new_company.save\n format.html { redirect_to new_requesit_path, notice: 'Вы успешно добавили компанию!' }\n format.json { render :show, status: :created, location: @new_company }\n else\n format.html { render :new }\n format.json { render json: @new_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n @company.tipo = '01'\n if @company.save \n render json: { status: :created }\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end", "def create\n @company_account = CompanyAccount.new(params[:company_account])\n\n respond_to do |format|\n if @company_account.save\n format.html { redirect_to @company_account, :notice => 'Company account was successfully created.' }\n format.json { render :json => {:data => @company_account , :success => true }, :status => :created, :location => @company_account }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => {:msg => @company_account.errors, :status => :unprocessable_entity} }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n if @company.save\n flash[:success] = \"Company was successfully created.\"\n redirect_to companies_url\n else\n flash[:error] = @company.errors.full_messages.join(\" and \")\n redirect_to new_company_url(@company)\n end\n end", "def create\n @company = Company.new(company_params)\n @company.approved = false;\n respond_to do |format|\n if @company.save\n UserMailer.approve_email(@company).deliver\n # format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.html {redirect_to companies_url, notice: 'Company added successfully' }\n format.json { head :no_content }\n # format.json { render :show, status: :created, location: @company }\n\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@company = Company.new(company_params)\n\t\t# for admin to add a company\n\t\tif admin? && @company.save\n\t\t\tflash[:success] = \"#{@company.name} was successfully saved!\"\n\t\t\tredirect_to beanformed_company_beans_path(@company.id)\n\t\t# for all users; new companies come in as approved : false\n\t\telsif @company.save\n\t\t\tflash[:success] = \"Thanks for registering #{@company.name}! You will be notified when you are approved!\"\n\t\t\t@roaster = Roaster.find(session[:roaster_id])\n\t\t\t@roaster.update({company_id: @company.id, phone: params[:company][:phone], role: \"pending\"})\n\t\t\tredirect_to new_beanformed_company_path\n\t\telse\n\t\t\tflash[:error] = \"Please fill out all fields.\"\n\t\t\tredirect_to new_beanformed_company_path\n\t\tend\n\tend", "def create\n @company = Company.new(company_params)\n @company.user = current_user\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to companies_path, notice: 'Компания успешно создана' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n # result = self.add()\n # # @company = result[:company]\n # format.html { redirect_to result[:company], notice: 'Company was successfully created.' }\n # format.json { render :show, status: :created, location: result[:company] }\n end", "def index\n\t\t\n @companies = Company.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @companies }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @company }\n end\n end", "def create\n @company = Company.new(company_params)\n\n render status: \\\n current_user.save_company(@company) ? :created : :unprocessable_entity\n end", "def create\n @production_company = ProductionCompany.new(production_company_params)\n\n respond_to do |format|\n if @production_company.save\n format.html { redirect_to @production_company, notice: 'Production company was successfully created.' }\n format.json { render :show, status: :created, location: @production_company }\n else\n format.html { render :new }\n format.json { render json: @production_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @companium = Companium.new(companium_params)\n\n respond_to do |format|\n if @companium.save\n format.html { redirect_to @companium, notice: 'Companium was successfully created.' }\n format.json { render :show, status: :created, location: @companium }\n else\n format.html { render :new }\n format.json { render json: @companium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n \n detail = @@data_util.hash_data_to_upper_case( params[:company], ['description'])\n\n detail[:mypclient_id] = session[:client_id]\n detail[:createdby] = session[:username]\n detail[:isactive] = 1\n\n @company = Company.new(detail)\n if @company.save\n @@request_result[:success] = true\n @@request_result[:notice] = 'New company successfully created.'\n else\n @@request_result[:errormsg] = @company.errors.full_messages[0]\n end\n rescue Exception => e\n @@request_result[:errormsg] = e.message\n end\n render json: @@request_result\n end", "def create\n params[:company][:founded_on] = params[:company][:founded_on].blank? ? Date.today : params[:company][:founded_on].to_date\n @company = Company.new(company_params)\n\n respond_to do |format|\n if @company.save\n response_hash = @company.get_company_detail\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json {render json: {message: response_hash}, status: 200}\n else\n format.html { render :new }\n error = @company.errors.keys[0].to_s.capitalize+\" \"+@company.errors.values[0][0].to_s\n format.json { render json: {message: error}, status: 400 }\n end\n end\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 update_companies\n current_companies = @movie.companies.collect { |c| c.id.to_s }\n\n delete_production_companies( current_companies )\n add_production_companies( current_companies ) unless params[:companies].nil?\n create_new_companies unless params[:new_companies].nil?\n end", "def create\n\t\t@company = Company.new(params[:company].merge({:by_user_id => current_user.id}))\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @company.save\n\t\t\t\tformat.html { redirect_to @company, notice: t('app.companies.created') }\n\t\t\t\tformat.json { render json: @company, status: :created, location: @company }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\tformat.json { render json: @company.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @company = Company.new(company_params)\n if current_user\n current_user.companies << @company\n end\n @company.save\n flash[:safe] = %Q[#{t(\"company_created\")} #{view_context.link_to(t(\"create_new_open_jobs\"), administration_company_path(@company))}.]\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :internal_server_error }\n end\n end\n end", "def create\n @rail_company = RailCompany.new(rail_company_params)\n\n respond_to do |format|\n if @rail_company.save\n format.html { redirect_to @rail_company, notice: 'Rail company was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rail_company }\n else\n format.html { render action: 'new' }\n format.json { render json: @rail_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @az_company = AzCompany.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @az_company }\n end\n end", "def create\n Company.transaction do\n @company = Company.new(company_params)\n logger.warn \"asfafdas #{@company.to_yaml}\"\n respond_to do |format|\n if @company.save\n format.html { redirect_to @company, notice: 'Company was successfully created.' }\n format.json { render action: 'show', status: :created, location: @company }\n companyReview = CompanyReview.new\n companyReview.user_id = current_user.id\n companyReview.company_id = @company.id\n companyReview.save!\n else\n format.html { render action: 'new' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @company = Company.find(params[:company_id]) \n #@employee = Employee.new(employee_params)\n @employee = @company.employees.create(employee_params)\n \n respond_to do |format|\n if @employee.save\n format.html { redirect_to company_employees_url(@company), notice: 'Employee was successfully created.' }\n format.json { render :show, status: :created, location: @employee }\n else\n format.html { render :new }\n format.json { render json: @employee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @company = Company.new(company_params)\n respond_to do |format|\n if @company.save\n @company.visit.each do |visit|\n @visit = Visit.new(visit.attributes)\n @visit.companyId=@company.id\n daysFromNow = Frecuency.find(visit.frecuencyTypeId).days\n nextVisitDate = visit.visitDate + daysFromNow.day\n while nextVisitDate < (Date.today + 365.day)\n @nextVisit = Visit.new(visit.attributes)\n @nextVisit.visitDate = nextVisitDate\n @nextVisit.id = nil\n @nextVisit.companyId=@company.id\n @nextVisit.save\n nextVisitDate = nextVisitDate + daysFromNow.day\n end\n end\n if @company.save\n @company.expiration.each do |expiration|\n @expiration = Expiration.new(expiration.attributes)\n @expiration.companyId=@company.id\n end\n end\n format.html { redirect_to @company, notice: 'Cliente creado con exito' }\n format.json { render :show, status: :created, location: @company }\n else\n format.html { render :new }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listed_company = ListedCompany.new(listed_company_params)\n\n respond_to do |format|\n if @listed_company.save\n format.html { redirect_to listed_companies_path, notice: 'Listed company was successfully created.' }\n format.json { render :show, status: :created, location: @listed_company }\n else\n format.html { render :new }\n format.json { render json: @listed_company.errors, status: :unprocessable_entity }\n end\n end\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" ]
[ "0.6599383", "0.6599383", "0.6599383", "0.6528881", "0.64868504", "0.6303317", "0.6256015", "0.62385666", "0.62341565", "0.6211788", "0.61972684", "0.6196382", "0.6196382", "0.6196382", "0.6196382", "0.6196382", "0.61924773", "0.6191616", "0.6191616", "0.6191616", "0.6191616", "0.61913466", "0.6179694", "0.6173828", "0.6166583", "0.615961", "0.6156251", "0.6131721", "0.6121625", "0.6116518", "0.6075288", "0.6071917", "0.60354203", "0.6025879", "0.6022516", "0.6017489", "0.6012899", "0.60063213", "0.60048175", "0.5983225", "0.59582233", "0.59520763", "0.59520763", "0.58831", "0.5881874", "0.58775026", "0.58656895", "0.5850779", "0.58408576", "0.58375174", "0.58373624", "0.5832122", "0.5823618", "0.5823618", "0.5823618", "0.5823618", "0.5823618", "0.5823618", "0.5823618", "0.5820534", "0.58036524", "0.5788251", "0.57684267", "0.5767146", "0.5767146", "0.5767146", "0.5767146", "0.57619524", "0.57568467", "0.57516164", "0.57499355", "0.5737012", "0.5735041", "0.5731436", "0.57170707", "0.5708808", "0.5702172", "0.56991076", "0.56985354", "0.5691415", "0.5690862", "0.5690201", "0.568993", "0.5682131", "0.56819016", "0.5678884", "0.5670407", "0.5666863", "0.5664492", "0.56603634", "0.5659002", "0.5654975", "0.5650852", "0.56390643", "0.56364524", "0.5632347", "0.5616438", "0.5615265", "0.5607308", "0.5606094" ]
0.59223866
43
PUT /companies/1 PUT /companies/1.xml
def update @company = Company.find(params[:id]) if @company.update_attributes(params[:company]) flash[:success] = @company.name + " was successfully updated." redirect_to crm_path else @title = "Edit " + @company.name render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n add_to_log(t('Company updated log') + @company.name,\"companies\",\"update\")\n flash[:notice] = t('Company updated')\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @title = \"Update Company\"\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = current_user.companies.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n if @company.update_attributes(params[:company])\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end", "def update\n @company = Company.find(params[:id])\n Rails.logger.info \"******\\n\\n\\nCompany: #{params[:company]}***********\\n\\n\\n\"\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_companies\n current_companies = @movie.companies.collect { |c| c.id.to_s }\n\n delete_production_companies( current_companies )\n add_production_companies( current_companies ) unless params[:companies].nil?\n create_new_companies unless params[:new_companies].nil?\n end", "def update\r\n @company = Company.find(params[:id])\r\n \r\n respond_to do |format|\r\n if @company.update_attributes(params[:company])\r\n format.html { redirect_to @company, notice: 'Company 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: @company.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html {\n redirect_to @company, notice: 'Company was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @company.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, :notice => 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to companies_url, notice: @company.name + ' was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(company_params[:id])\n\n if @company.update(company_params)\n head :no_content\n else\n render json: @company.errors, status: :unprocessable_entity\n end\n end", "def update\n @az_company = AzCompany.find(params[:id])\n\n respond_to do |format|\n if @az_company.update_attributes(params[:az_company]) #TODO Защитить баланс!!!\n flash[:notice] = 'AzCompany was successfully updated.'\n format.html { redirect_to(@az_company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n params[:company][:category_ids] ||= []\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Empresa foi atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@company = Company.find(params[:id])\n\t\tmake_breadcrumbs\n\n\t\trespond_to do |format|\n\t\t\tif @company.update_attributes(params[:company])\n\t\t\t\tformat.html { redirect_to @company, notice: t('app.companies.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: @company.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @company = Company.find(COMPANY_ID)\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to administration_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.json { render :show, status: :ok, location: @company }\n else\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n\n @company.infos.each do |i|\n\t i.value = params[i.key]\n\t i.save\n end\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to @company, notice: 'Company successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_contact(companyId, id, model) path = \"/api/v2/companies/#{companyId}/contacts/#{id}\"\n put(path, model, {}, AvaTax::VERSION) end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Configurações da empresa alteradas com sucesso!' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lib_company = LibCompany.find(params[:id])\n\n respond_to do |format|\n if @lib_company.update_attributes(params[:lib_company])\n format.html { redirect_to(@lib_company, :notice => 'Lib company was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lib_company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_api_v1_company\n @api_v1_company = Api::V1::Company.find(params[:id])\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @asset_company = AssetCompany.find(params[:id]) \n respond_to do |format|\n if @asset_company.update_attributes(params[:asset_company])\n flash[:notice] = \"#{@asset_company.company_name} was successfully updated\"\n format.html { redirect_to(:action=>'show', :id => @asset_company.id ) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset_company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to companies_path, notice: 'Общая информация о компании успешно отредактирована' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @company }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_update_company()\n # Parameters for the API call\n\n campaign_model = CampaignModel.new()\n campaign_model.utm_source = \"Adwords\"\n campaign_model.utm_medium = \"Twitter\"\n\n company_model = CompanyModel.new()\n company_model.modified_time = Time.now.utc.iso8601\n company_model.company_id = \"12345\"\n company_model.campaign = campaign_model\n\n # Perform the API call through the SDK function\n self.class.controller.update_company(company_model)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end", "def update\n @company = Company.find(id_from_params)\n\n respond_to do |format|\n if @company.accounts.exists? current_user.account.id\n @company.accounts.delete(current_user.account)\n @company.accounts << current_user.account\n\n format.html { redirect_to root_path, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n @company.accounts << current_user.account\n format.html { redirect_to root_path, notice: 'Company was successfully updated.' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n #format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n #format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @company = Company.find(params[:id])\n\n params[:company][:projects_attributes][\"0\"].merge!(:user_id => current_user.id)\n respond_to do |format|\n if @company.update_attributes(params[:company])\n\tformat.html { redirect_to(@company, :notice => 'Company was successfully updated.') }\n\tformat.xml { head :ok }\n else\n\tformat.html { render :action => \"edit\" }\n\tformat.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\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\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: t(\"updated\") }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n respond_to do |format|\n if @company.update!(nested_params)\n format.html { redirect_to @company, notice: \"#{@company.name} Company has been updated.\" }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n if @company.update_attributes(params[:company])\n UpdateMailer.update_email(@company, current_user, action_name).deliver\n flash[:notice] = 'Company was successfully updated.'\n end\n respond_with(@company)\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html {redirect_to action: :index, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @company}\n else\n format.html {render :edit}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n\t\t@company = Company.find(params[:id])\n\t\t@company.update(company_params)\n\t\tredirect_to company_path(@company)\n\tend", "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 @contact = CompanyContact.find(params[:id])\n if @contact.update_attributes(params[:company_contact])\n head :no_content\n else\n respond_with @contact, status: :unprocessable_entity\n end\n end", "def update\n @company = Company.find(params[:id])\n @battalion = Battalion.find(params[:battalion_id])\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to battalion_company_path(@battalion, @company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @companies = Array.new\n Company.all.each do |comp|\n @companies << [comp.name, comp.id]\n end\n @project.name = @project.name.upcase\n respond_to do |format|\n if @project.update(project_params)\n format.html { redirect_to @project, notice: 'Proyecto actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @project }\n else\n format.html { render :edit }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Person was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html {redirect_to @company, notice: 'Company was successfully updated.'}\n format.json {render :show, status: :ok, location: @company}\n else\n format.html {render :edit}\n format.json {render json: @company.errors, status: :unprocessable_entity}\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n if @company.update(company_params)\n flash[:success] = \"Company updated!\"\n redirect_to @company\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Cliente actualizado con exito' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @company.update(company_params)\n redirect_to @company, notice: \"Company was successfully updated.\"\n else\n render :edit, status: :unprocessable_entity\n end\n end", "def update\n @ins_company = InsCompany.find(params[:id])\n\n respond_to do |format|\n if @ins_company.update_attributes(params[:ins_company])\n format.html { redirect_to @ins_company, notice: 'Ins company was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ins_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.friendly.find(params[:id])\n\n @company.companytype_id = params[:companytype_id]\n\n\n\n respond_to do |format|\n\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = \"#{@company.name} was successfully updated.\"\n format.html { redirect_to @person }\n format.xml { head :ok }\n format.js { @company.reload and render :layout => false }\n else\n format.html { render :action => :edit }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n format.js { render :action => :invalid, :layout => false }\n end\n end\n end", "def update\n respond_to do |format|\n if @new_company.update(new_company_params)\n format.html { redirect_to @new_company, notice: 'Вы успешно отредактировали компанию' }\n format.json { render :show, status: :ok, location: @new_company }\n else\n format.html { render :edit }\n format.json { render json: @new_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @events_company = EventsCompany.find(params[:id])\n\n respond_to do |format|\n if @events_company.update_attributes(params[:events_company])\n format.html { redirect_to @events_company, :notice => 'Events company was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @events_company.errors, :event => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to @company, notice: 'Bar atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n \n\t\t# logger.debug \"Hello\"\n # logger.debug params.to_yaml\n # logger.debug \"Hello\"\n # logger.debug params[\"company\"][\"code\"].upcase!\n # params[\"company\"[\"code\"]].to_upper!\n code_to_upper(params)\n \n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n respond_with(@company)\n end", "def update\n @sp_company_info = SpCompanyInfo.find(params[:id])\n\n respond_to do |format|\n if @sp_company_info.update_attributes(sp_company_info_params)\n format.html { redirect_to \"/sp_company_infos\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sp_company_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company_type = CompanyType.find(params[:id])\n\n if @company_type.update(company_type_params)\n head :no_content\n else\n render json: @company_type.errors, status: :unprocessable_entity\n end\n end", "def update\n @company_user = CompanyUser.find(params[:id])\n\n respond_to do |format|\n if @company_user.update_attributes(params[:company_user])\n format.html { redirect_to(@company_user, :notice => 'Company user was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # authorize @company\n respond_to do |format|\n if @company.update(company_params)\n format.html { redirect_to admin_company_path(@company), notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @company }\n else\n format.html { render :edit }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_company\n @company = Company.find(params[:company])\n end", "def set_company\n id = params[:company_id] ? params[:company_id] : params[:id]\n @company = Company.find(id)\n end", "def update\n respond_to do |format|\n if @account_company.update(account_company_params)\n format.html { redirect_to @account_company, notice: 'Company was successfully updated.' }\n format.json { render :show, status: :ok, location: @account_company }\n else\n format.html { render :edit }\n format.json { render json: @account_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :description => 'API Project Desc' }\r\n assert_response 401\r\n end", "def update\n @company_profile = CompanyProfile.find(params[:id])\n\n respond_to do |format|\n if @company_profile.update_attributes(params[:company_profile])\n format.html { redirect_to(@company_profile, :notice => 'Company profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company_profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @biz_company = BizCompany.find(params[:id])\n\n respond_to do |format|\n if @biz_company.update_attributes(params[:biz_company])\n format.html { redirect_to @biz_company, notice: '商业品牌更新成功。' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @biz_company.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.update(company_params)\n # $redis.publish('companies.update', @company.to_json)\n # render :action => 'show'\n end", "def update\n #@company = Company.find(params[:id])\n #@address=Address::getrightaddress params[:address]\n @company.attributes=params[:company]\n @success=help_process\n respond_to do |format|\n if @success\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:id])\n if precondition_met?(@customer) \n respond_to do |format|\n if @company.update_attributes(params[:company])\n flash[:notice] = 'Company was successfully updated.'\n format.html { redirect_to(@company) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n else\n head :precondition_failed\n end\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end" ]
[ "0.6664095", "0.66459405", "0.6639532", "0.6639532", "0.66363287", "0.66337687", "0.64504045", "0.6405931", "0.63770616", "0.6320883", "0.6316433", "0.6304934", "0.6301482", "0.6301482", "0.6301482", "0.6301482", "0.6301482", "0.6301482", "0.62998307", "0.6288434", "0.62848234", "0.6221155", "0.6214164", "0.62057126", "0.6184504", "0.616007", "0.61450124", "0.61413133", "0.6140688", "0.60945415", "0.60916305", "0.60487694", "0.6034143", "0.60223126", "0.6018592", "0.6018592", "0.6018592", "0.6018592", "0.6018592", "0.6018592", "0.6018592", "0.6018592", "0.6018592", "0.6018592", "0.6018592", "0.6018592", "0.6017255", "0.60102797", "0.6010167", "0.6009177", "0.59909475", "0.597629", "0.5975938", "0.59737337", "0.59706706", "0.59706706", "0.5958892", "0.5954597", "0.592598", "0.59211004", "0.589735", "0.5897159", "0.5892387", "0.58886135", "0.5879652", "0.58734787", "0.585298", "0.58495086", "0.5846624", "0.5843746", "0.5838039", "0.58311677", "0.5809834", "0.58046377", "0.580131", "0.57998335", "0.5795004", "0.57885796", "0.57698286", "0.574675", "0.5724789", "0.57233334", "0.5718064", "0.57168466", "0.56891406", "0.56885165", "0.56866646", "0.56831515", "0.56812155", "0.56794655", "0.5675007", "0.5673306", "0.5671608", "0.5670742", "0.5669411", "0.5669411", "0.5669411", "0.5669411", "0.5669411", "0.5669411" ]
0.5869893
66
DELETE /companies/1 DELETE /companies/1.xml
def destroy @company = Company.find(params[:id]) @company.destroy flash[:success] = "Company was successfully deleted." redirect_to crm_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n add_to_log(t('Company destroy log') + @company.name,\"companies\",\"destroy\")\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @title = \"Destroy Company\"\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = current_user.companies.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @contactinfo= Contactinfo.find(@company.contactinfos_id)\n @contactinfo.destroy\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @company = Company.find(params[:id])\r\n @company.destroy\r\n respond_to do |format|\r\n format.html { redirect_to(admincompany_manage_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n @lib_company = LibCompany.find(params[:id])\n @lib_company.destroy\n\n respond_to do |format|\n format.html { redirect_to(lib_companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company.destroy\n\n head :no_content\n end", "def destroy\n @rail_company.destroy\n respond_to do |format|\n format.html { redirect_to rail_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @biz_company = BizCompany.find(params[:id])\n @biz_company.destroy\n\n respond_to do |format|\n format.html { redirect_to biz_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @draft_company = DraftCompany.find(params[:id])\n @draft_company.destroy\n\n respond_to do |format|\n format.html { redirect_to(draft_companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @company = Company.find(params[:id])\r\n @company.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to companies_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @company = Company.find(id_from_params)\n @company.accounts.delete(current_user.account)\n #current_user.companies.delete(@company)\n #@company.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n redirect_to(companies_url)\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @guarantee_company.destroy\n respond_to do |format|\n format.html { redirect_to guarantee_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_authority.destroy\n\n head :no_content\n end", "def destroy\n\t\t@company = Company.find(params[:id])\n\t\t@company.destroy\n\t\tredirect_to beanformed_companies_path\n\tend", "def destroy\n @company = set_company\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_path, notice: \"#{@company.name} has been deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n Company.transaction do\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @crunch_company = CrunchCompany.find(params[:id])\n @crunch_company.destroy\n\n respond_to do |format|\n format.html { redirect_to crunch_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_path, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @project = Company.find(params[:company_id]).projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to(projects_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contact_company.destroy\n respond_to do |format|\n format.html { redirect_to contact_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @global_company = GlobalCompany.find(params[:id])\n @global_company.destroy\n\n respond_to do |format|\n format.html { redirect_to global_companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @visit_company.destroy\n respond_to do |format|\n format.html { redirect_to visit_companies_url, notice: 'Visit company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_type.destroy\n\n head :no_content\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @intelcompany.destroy\n end", "def destroy\n @companyprofile = Companyprofile.find(params[:id])\n @companyprofile.destroy\n\n respond_to do |format|\n format.html { redirect_to(companyprofiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t@company = Company.find(params[:id])\n\t\t@company.destroy\n\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to companies_url }\n\t\t\tformat.json { head :ok }\n\t\tend\n\tend", "def destroy\n @company.destroy\n flash[:success] = \"Company deleted!\"\n redirect_to companies_path\n end", "def destroy\n @products_category = ProductsCategory.find(params[:id])\n company_id = @products_category[:company_id]\n @products_category.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/companies/products_categories/\" + company_id.to_s) }\n format.xml { head :ok }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @compro = Compro.find(params[:id])\n \n # Erase compro id for products from compro\n #products = Product.find( {:compro_id => @compro[:id]})\n \n # for product in products\n # product.compro_id = nil\n # product.save\n # end\n \n @company = @compro.company\n @compro.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/companies/compros/#{@company.id}\" }\n format.xml { head :ok }\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n UpdateMailer.update_email(@company, current_user, action_name).deliver\n flash[:notice] = 'Company was successfully deleted.'\n respond_with(@company)\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 @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Cliente eliminado con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company_dashboard = CompanyDashboard.find(params[:id])\n @company_dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to(company_dashboards_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contact = CompanyContact.find(params[:id])\n @contact.destroy\n head :no_content\n end", "def destroy\n @company = Company.find(params[:id])\n @company.destroy\n\n flash[:notice] = \"company deleted\" \n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contactos = Contactos.find(params[:id])\n @contactos.destroy\n\n respond_to do |format|\n format.html { redirect_to(contactos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n #format.html { redirect_to companys_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n @companies = Company.all\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json {render json: {message: @companies}, status: 200}\n end\n end", "def destroy\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.destroy\n format.html { redirect_to companies_url,\n notice: (crud_notice('destroyed', @company) + \"#{undo_link(@company)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to companies_url, alert: \"#{@company.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @company.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @company_profile = CompanyProfile.find(params[:id])\n @company_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(company_profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @location = Location.find(params[:id])\n company_id = @location[:company_id]\n @location.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/companies/locations/\" + company_id.to_s) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ins_company = InsCompany.find(params[:id])\n @ins_company.destroy\n\n respond_to do |format|\n format.html { redirect_to ins_companies_url }\n format.json { head :ok }\n end\n end", "def destroy\n #@company = Company.find_by_slug(params[:id])\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to companies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: t(\"company_destroyed\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_company.destroy\n respond_to do |format|\n format.html { redirect_to customer_companies_url, notice: t(\"controllers.destroy_success\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @title = @company.titles.find(params[:id])\n Title.destroy(@title)\n\n respond_to do |format|\n format.html { redirect_to(financial_company_titles_url(@company)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @account_company.destroy\n respond_to do |format|\n format.html { redirect_to account_companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n logger.debug 'destroy_some interesting information'\n @comdty = Comdty.find(params[:id])\n @comdty.destroy\n\n respond_to do |format|\n format.html { redirect_to(comdties_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_company_detail = Admin::CompanyDetail.find(params[:id])\n @admin_company_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_company_details_url }\n format.json { head :ok }\n end\n end", "def destroy\n @business_company.destroy\n respond_to do |format|\n format.html { redirect_to business_companies_url, notice: 'Company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n redirect_to companies_url, notice: \"Company was successfully destroyed.\"\n end", "def destroy\n @company_account = CompanyAccount.find(params[:id])\n @company_account.destroy\n\n respond_to do |format|\n format.html { redirect_to company_accounts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Bar Deletado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \t\n @companydocument = Companydocument.find(params[:id])\n @companydocument.destroy\n\n respond_to do |format|\n format.html { redirect_to companydocuments_url }\n format.json { head :no_content }\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 @new_company.destroy\n respond_to do |format|\n format.html { redirect_to new_companies_url, notice: 'New company was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @company.destroy\n respond_to do |format|\n format.html { redirect_to companies_url, notice: 'Компания успешно удалена' }\n format.json { head :no_content }\n end\n end", "def destroy\n company = @moot.company\n @moot.destroy\n respond_to do |format|\n format.html { redirect_to [company], notice: 'Moot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @company.destroy\n respond_to do |format|\n format.html {redirect_to companies_url, notice: 'Company was successfully destroyed.'}\n format.json {head :no_content}\n end\n end" ]
[ "0.7353038", "0.7292837", "0.7292837", "0.7292837", "0.7292837", "0.7292837", "0.7292837", "0.7292837", "0.72816765", "0.7240932", "0.70299447", "0.69667876", "0.6966431", "0.68465614", "0.67923546", "0.66653526", "0.66401255", "0.66267467", "0.6621424", "0.66155344", "0.659556", "0.6595305", "0.6580053", "0.6580053", "0.6580053", "0.6580053", "0.6580053", "0.6580053", "0.6580053", "0.6580053", "0.6580053", "0.6580053", "0.65433985", "0.65405947", "0.6538433", "0.652229", "0.6514127", "0.6510822", "0.6482646", "0.6475493", "0.6475493", "0.6475493", "0.6471291", "0.646762", "0.64234436", "0.64205486", "0.64181954", "0.64159036", "0.6412036", "0.64118636", "0.6406463", "0.6404858", "0.6403092", "0.6396374", "0.63857055", "0.6377796", "0.63775843", "0.63742065", "0.63727015", "0.63683975", "0.63408804", "0.6335909", "0.6333517", "0.6327841", "0.6325552", "0.63248706", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63192266", "0.63177824", "0.63156724", "0.63147503", "0.6308908", "0.6307145", "0.6300918", "0.6296729", "0.62965107", "0.62945104", "0.62856233", "0.6283056", "0.6278246", "0.6272937", "0.62724555", "0.6269564", "0.6253956", "0.6250604", "0.6249247", "0.62407005", "0.6237793", "0.6237238" ]
0.686581
13
if more exist, use the select method or unique method or create a hash storing frequencies (although this takes up space)
def duplicate_number(array) raise ArgumentError, 'Parameter must be an array' unless array.is_a? Array raise ArgumentError, 'Parameter must be an array of integers' unless array.all? {|i| i.is_a?(Integer) } array.detect{ |number| array.count(number) > 1 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end", "def frequencies\n inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end", "def freq(array)\n hash = Hash.new(0)\n array.each{|key| hash[key] += 1}\n hash\nend", "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 frequencies_of(option)\n frequencies = Hash.new(0)\n if option == :artists\n artists.each do |artist|\n frequencies[artist] += 1\n end\n frequencies\n elsif option == :genres\n genres.each do |genre|\n frequencies[genre] += 1\n end\n frequencies\n elsif option == :tracks\n tracks.each do |track|\n frequencies[track] += 1\n end\n frequencies\n end\n end", "def getfreqs\n @freqs = Hash.new\n @fieldvalues.each do |v|\n @freqs[v] = @db.execute(\"select count(*) from #{@tablename} where #{@fieldname} = '#{v}'\").to_s \n end\nend", "def analyze_data(ary)\n frequency = count_frequency(ary)\n sort_hash(frequency)\nend", "def compute_frequencies(list)\n dict = {}\n list.each do |token|\n unless dict.has_key?(token)\n dict[token] = list.count(token)\n end\n end\n dict\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 count_freq(array)\n array.each_with_object(Hash.new(0)) { |obj, counts| counts[obj] += 1 }\n end", "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 favorite_food_frequency\n all_favorite_foods.each_with_object(Hash.new(0)) do |food, object|\n object[food] += 1\n end\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 element_frequency_count\n collection.each_with_object(Hash.new(0)) {|element, occurrence| occurrence[element] += 1}\n end", "def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end", "def frequency(a)\r\n a.group_by do |e|\r\n e\r\n end.map do |key, values|\r\n [values.size]\r\n end\r\nend", "def get_freq\n #instantiate with values to ensure consistent ordering\n freq = { 1 => 0, 2 => 0, 3 => 0, 4 => 0, 5 => 0 }\n #sum up freqencies of each number\n last_100 = get_last_100\n last_100.each do |item|\n freq[item.to_i] += 1\n end\n # convert to percentage\n freq.each do |key, val|\n #divide by real length to handle case of less than 100 outputs\n freq[key] = val / last_100.length.to_f\n end\n freq\n end", "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 frequency\n \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 word_frequency(words)\n frequencies = Hash.new(0)\n words.each do |word|\n frequencies[word] += 1\n end\n frequencies\nend", "def find_frequencies(keys)\n @frequencies = {}\n threads = []\n\n key_lengths = keys.map(&:size).uniq\n key_lengths.each do |key_length|\n threads << Thread.new do\n results_hash = key_frequency(key_length, @seq)\n @frequencies.merge!(results_hash)\n end\n end\n threads.each(&:join)\n @frequencies\nend", "def results_frequency_for_each_combination\n category_id = self.id\n results = Result.where({\"category_id\" => category_id})\n result_hash = Hash.new(0)\n count = 0\n\n results.each do |combo| \n winner = combo.loved_id\n loser = combo.lost_id\n if winner != nil && loser != nil\n result_hash[winner.to_s + \"-\" + loser.to_s] += 1\n end\n end\n return result_hash\n end", "def checkSearchTerms(wordHash, searchTermsArray, documentCounter, resultsHash, wordArray)\n documentCounter;\n documentNumber = \"Document \" + documentCounter.to_s\n searchTermsArray.each do |word|\n resultsHash.merge!(word => { documentNumber => wordHash[word]})\n # need to figure out the frequency based on the wordHash[word] and the wordArray.length\n end\n # puts wordArray.length\n # puts resultsHash\nend", "def freqQuery(queries)\n data_to_freq = Hash.new(0)\n freq_to_data = Hash.new { |h, a| h[a] = Set.new }\n\n answers = []\n queries.each do |(op, operand)|\n case op\n when 1\n freq = data_to_freq[operand]\n freq_to_data[freq].delete(operand)\n freq_to_data[freq + 1].add(operand)\n data_to_freq[operand] += 1\n when 2\n freq = data_to_freq[operand]\n if freq > 0\n freq_to_data[freq].delete(operand)\n freq_to_data[freq - 1].add(operand)\n data_to_freq[operand] -= 1\n end\n when 3\n if freq_to_data[operand].empty?\n answers << '0'\n else\n answers << '1'\n end\n end\n end\n answers\nend", "def count_frecuency(word_list)\n\tcounts = Hash.new(0) #es un hash que estará inicializado en 0, si indexamos en un key que no existe este retornará 0\n\tword_list.each do |word|\n\t\tcounts[word] +=1 #counts[word] es un hash con la clave del item actual, sabiendo que en principio no hay ningun item cuando asigne counts[word] +=1, sumará 1+0 ya que en principio el hash esta inicializado en 0\n \tend\n\tcounts\t\nend", "def word_frequency\n @word_use = Hash.new(0)\n words.each { |w| @word_use[w] += 1 }\n @word_use\n end", "def count_frequency(word_list)\n counts = Hash.new(0)\n for word in word_list\n counts[word] += 1\n end\n counts\nend", "def gen_frequency(pairs)\n\tprefix_sum =[]\n\tgens = []\n\taccum = 0\n\tpairs.each{|p| \n\t\taccum += p[0]\n\t\tprefix_sum.push(accum)\n\t\tgens.push(p[1])\n\t}\n\t# [[4, gen1], [5, gen2]]\n\tx = PRNG.rand(accum)+1\n\treturn gens[prefix_sum.index{ |v| v >= x}]\nend", "def unique_words\n @frequencies.keys\n end", "def count_frequencies s\n s.downcase.split(//).inject(Hash.new(0)) do |hash,item|\n hash[item] += 1\n hash\n end\n end", "def frequency_of(gram)\n @frequencies.fetch(gram,0)\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 freq_calc(mult_arr)\n\tresult_arr = []\n\tsubarrs_by_index = reorder_on_index(mult_arr)\n\tsubarrs_by_index.uniq.each do |arr|\n\t\tarr.uniq.each do |letter|\n\t\t\tresult_arr << {letter => (count(arr, letter))}\n\t\tend\n\t\tp arr.uniq\n\tend\n\treturn result_arr\nend", "def frequency\n # normal string which has assigned all the alphabets\n name = 'abcdefghijklmnopqrstuvwxyz'\n # this line will first split 'name' string and then assign it to hash\n @letters = name.split('').reduce(@letters){|alphabet,count| alphabet[count] +=0; alphabet}\n # this will convert all the alphabets of 'str' to lower case\n @str = @str.downcase\n # this will remove special characters from the string and only allow lower case alphabets\n @str = @str.gsub(/[^a-z]/, '')\n # this will split the 'str' and assign the letters to hash and add 1 each time the letter appeared\n @letters = @str.split('').reduce(@letters){|alphabet,count| alphabet[count] +=1; alphabet}\n\n end", "def occurences_count\n\t\t\t\t\t\tHash.new(0).tap do |result|\n\t\t\t\t\t\t each { |item| result[item] += 1 }\n\t\t\t\t\t\tend\n\t\t\t\tend", "def frequency string\n $frequencies[string]\nend", "def counts\n count = Hash.new(0)\n self.each{|ele| count[ele] += 1}\n count\n end", "def count_frequency(word_list)\n\tcounts = Hash.new(0)\n\tfor word in word_list\n\t\tcounts[word] += 1\n\tend\n\tcounts\nend", "def count(r)\n c = Hash.new(0)\n r.each { |z| c[z] += 1}\n c\nend", "def count_occurrences(array)\n frequncies = Hash.new(0)\n\n array.each do |word|\n frequncies[word] += 1\n end\n\n frequncies.each do |word, frequency|\n puts \"#{word} => #{frequency}\"\n end\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 overall_frequency\n categories.inject(0) { |carry, item| carry + item[1] }\n end", "def number_of_unique_words\n @frequencies.keys.length\n end", "def calculate_word_frequency\n puts \"calculate_word_frequency called\"\n#Ok, tänkte att göra det i en hash table. initiera till 1 om hittar ett ord som inte redan finns annars plussa med ett.\n\n#sedan hitta ordet med högst värde i tabellen. och ta ut \"nyckeln\" för denna.\n\n#fråga hur många olika ord ska man identifiera?\n \n #1. gör hash-lista med antal förekommande som value.\n a=@content.split\n #p a\n nH=Hash.new\n a.each { |word| nH[word]==nil ? nH[word]=1 : nH[word] = nH[word]+1}\n #puts nH.to_s\n #Hur identifierar man åt andra hållet nu då?\n #Gå igenom alla keys och jämför vilket värde som är högst?\n #Ok, men nu om det är flera ord är delad etta...\n highest=0\n nH.each do |key, value|\n if value>highest\n highest=value\n end\n #Ok, för att dela etta, kanske räkna ut highest först och sedan kolla vilka keys som har detta värde.\n end\n #puts \"ok, the highest was: #{highest}\"\n @highest_wf_count= highest #kanske ska sätta in denna i loopen ovan. Obs att det är en setter-metod som anropas här som är förklädd till att ge värde.\n #Nu...\n #Ok, kanske kan använda select mer effektivt.\n #En andra uppgift är att \"effektivisera\" eller snygga till det här programmet så att den drar nytta av rubys \"features\" på ett bättre sätt.\n\n\n\n #puts \"ok, highest was\"\n #p nH.select { |k,v| v==highest}.to_a\n initarray=[]\n nH.each { |k,v| initarray << k if v==@highest_wf_count }\n #highest_wf_words= [1,2,3] #initarray #ok, nu förstår jag, det var det där professorn varnade oss om att den inte anropar en funktion utan skapar och sätter en lokal variabel istället.\n #Dessutom är bara attr_reader definierad, inte setter.\n #Ok, getter och setter methods är till för saker utanför klassen att komma åt variablerna.\n @highest_wf_words= initarray\n\n end", "def compute_frequencies\n @transitions.map { |value, transition_hash|\n sum = 0.0\n transition_hash.each { |succ_value, occurencies| \n sum += occurencies\n }\n \n transition_hash.each { |succ_value, occurencies|\n @frequencies[value] ||= Hash.new{0}\n @frequencies[value][succ_value] = occurencies/sum \n }\n }\n end", "def freq\n @freq ||= begin\n # calculate ngram counts for the haystack\n counts = Hash.new(0)\n veach(\"Haystack\", @haystack) do |element|\n element.ngrams.each do |ngram|\n counts[ngram] += 1\n end\n end\n\n # turn counts into inverse frequencies\n map = Hash.new(1)\n total = counts.values.inject(&:+).to_f\n counts.each do |ngram, count|\n map[ngram] = ((total / count) * 10).round\n end\n map\n end\n end", "def genre_count(term)\n #count the genres in object.get_genres\n genres = Hash.new(0)\n object.get_genres(term).each do |genre|\n case\n when genre.include?(\"rap\")\n genres[:rap]+=1\n when genre.include?(\"pop\")\n genres[:pop]+=1\n when genre.include?(\"country\")\n genres[:country]+=1\n when genre.include?(\"indie\")\n genres[:indie]+=1\n when genre.include?(\"hip\")\n genres[\"hip hop\"]+=1\n when genre.include?(\"rock\")\n genres[:rock]+=1\n when genre.include?(\"jazz\")\n genres[:jazz]+=1\n when genre.include?(\"instrumental\")\n genres[:instrumental]+=1\n when genre.include?(\"r&b\")\n genres[\"r&b\"]+=1\n else\n genres[:misc] +=1\n end\n end\n genres\n end", "def tfreq word, labellist\n @tfreq=0\n labellist.each do |doc|\n @tfreq+=doc[word] if doc.has_key?(word)\n end\n @tfreq\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 solution3(a)\n freq = {}\n a.each do |num|\n num = num.abs\n freq[num] ? next : freq[num] = 1\n end\n freq.size\nend", "def calculate_frequencies(target_file)\n\tn_char=0.0\n\n\n\ttext=File.read(target_file)\n\n\t#creo l'hash delle lettere\n\thsh=Hash.new\n\tcode=97\n\twhile code<=122 do\n\t\thsh[code]=Occurrences.new(0,0.000)\n\t\tcode+=1\n\tend\n\t#conto le occorrenze delle lettere\n\ttext.each_byte {|c|\n\t\tif c>=97 and c<=122;\n\t\t\thsh[c].number+=1\n\t\t\tn_char+=1\n\t\tend\n\t}\n\t#creo le frequenze\n\thsh.each {|k, v|\n\t\tv[1]=v[0]/n_char\n\t\t#puts\"number:#{v[0]} - percentage:#{v[1]}\"\n\t}\n\t#print dei valori creati\n\t#i=0\n\t#hsh.each {|k, v| puts \"elemento #{i} ---> #{k} is #{v}\",\n\t#\ti+=1\n\t#}\n\treturn hsh;\nend", "def make_hash_with_count(passage)\n array_from_excerpt = strip_text(passage)#input from first question\n names_and_counts = Hash.new 0 #initializes at 0\n array_from_excerpt.each do |word|\n names_and_counts[word] += 1#for all subs. occurences, add 1\n end\n names_and_counts # must have the last line return the array!\nend", "def calculate_term_frequencies\n results = []\n \n @data.each do |document|\n document_result = {}\n \n document.each do |term|\n if document_result.key?(term)\n document_result[term] += 1.0\n else\n document_result[term] = 1.0\n end\n end\n \n # Normalize the count\n document_result.each_key do |term|\n document_result[term] /= document.size\n end\n \n results << document_result\n end\n \n results\n end", "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 num_unique_words\n @frequencies.keys.length\n end", "def frequency(word)\n arr = $words.select do |sample|\n word == sample\n end\n arr.size\nend", "def hash_letter_freq( array )\n\n i = 0 # keeps track of outter loop\n hash = Hash.new()\n\n while( array.length > i )\n\n count = 1\n\n i2 = 1 + i # keeps track of inner while loop\n\n while( array.length > i2 ) # this will never check the last element of the array - otherwise have i2 check itself by doing i2 = i\n\n # puts(\"i #{i} | i2 #{i2}\") -- check if iteration is made right\n\n if( array[i] == array[i2] )\n count += 1\n end\n\n i2 += 1\n end # inner - while\n\n # alternative cond: hash.has_key?(\"#{array[i]}\") http://ruby-doc.org/core-1.9.3/Hash.html#method-i-has_key-3F\n if( hash[\"#{array[i]}\"] == nil ) # checks if key exists\n hash[\"#{array[i]}\"] = count\n end\n\n # for the last element in the array -- skipped by i2\n if( i2 == array.length )\n if( hash[\"#{array[i]}\"] == nil )\n hash[\"#{array[i]}\"] = 1\n end\n end\n\n\n i += 1\n end # while -outter\n\n # puts( hash )\n return hash\n\nend", "def small_world\n freq = Hash.new(0)\n @graph.each_value do |v|\n\tfreq[v.size] += 1\n end\n return freq\n end", "def duplicates(array)\n frequency = Hash.new(0)\n array.each do |element|\n frequency[element] += 1\n end\n frequency.each do |k, v|\n return k if v > 1\n end\nend", "def solution(a)\n # write your code in Ruby 2.2 \n frecuencies = a.each_with_object(Hash.new(0)) { |key, value| value[key] += 1 } \n \n frecuencies.each do |key, value|\n if value.odd? then return key end\n end\nend", "def my_uniq(arr)\n count = Hash.new(0)\n arr.each {|ele| count[ele]+= 1}\n count.keys\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 frequencies\n analyzer = Frequency.call(\n dataset: dataset,\n stemming: stemming,\n block_size: window,\n last_block: :small_last,\n split_across: false,\n progress: ->(p) { progress&.call((p.to_f / 100.0 * 33.0).to_i) }\n )\n\n # Combine all the block hashes, summing the values\n total = analyzer.blocks.size.to_f\n\n base_frequencies = {}\n analyzer.blocks.each_with_index do |b, i|\n progress&.call((i.to_f / total * 16.0).to_i + 33)\n\n b.each_key do |k|\n base_frequencies[k] ||= 0\n base_frequencies[k] += 1\n end\n end\n\n # Get the frequencies of cooccurrence with the word in question\n joint_frequencies = {}\n pairs.each_with_index do |(word, word2_array), i|\n joint_frequencies[word] = {}\n\n analyzer.blocks.each_with_index do |b, j|\n if progress\n p = (i.to_f / pairs.size.to_f) +\n (1 / pairs.size.to_f) * (j.to_f / total.to_f)\n progress.call((p * 17.0).to_i + 49)\n end\n\n next unless b[word]&.>(0)\n\n if word2_array.empty?\n b.each_key do |k|\n joint_frequencies[word][k] ||= 0\n joint_frequencies[word][k] += 1\n end\n else\n word2_array.each do |w|\n if b.key?(w)\n joint_frequencies[word][w] ||= 0\n joint_frequencies[word][w] += 1\n end\n end\n end\n end\n end\n\n [base_frequencies, joint_frequencies, analyzer.blocks.size]\n end", "def counts_by_length(counts)\n counts_by_length = {}\n counts.each do |key, value|\n l = key.length.to_s\n if counts_by_length.has_key?(l)\n counts_by_length[l] << value\n else\n counts_by_length[l] = [value] \n end\n end\n counts_by_length\nend", "def count_occurences(array)\n\n # interate over array and add unique values as keys to a new hash\n unique_values = {}\n\n array.each do |item|\n if unique_values.keys.include?(item) == false\n unique_values[item] = 0\n end\n end\n # ------------\n\n\n # interate over hash and array, +1 the value of key for every match in array\n unique_values.each_key do |key|\n array.each do |item|\n if key == item\n unique_values[key] += 1\n end\n end\n end\n\n unique_values\nend", "def multi_histo_results(company_id)\n histo = Hash.new\n self.options.split(',').each do |option|\n histo[option] = self.get_answers(company_id).select { |a| a.content == option }.count\n end\n results = []\n #check if its a tie\n if histo.values.uniq.count <= 1\n results << \"Equal\"\n else\n results << histo.max_by{|k,v| v}[0]\n end\n results << histo\n results\n end", "def small_world\n freq = Hash.new(0)\n @graph.each_value do |v|\n freq[v.size] += 1\n end\n return freq\n end", "def find_unique_elements(arr)\n collect = Hash.new 0\n \n arr.each do |elt|\n collect[elt] += 1\n end\n\n unique_hash = Hash(collect.select {|k,v| v == 1})\n \n unique_hash.keys\nend", "def my_uniq(arr)\n counter = Hash.new(0)\n arr.each do |x|\n counter[x] += 1\n end\n counter.keys\nend", "def losing_results_frequency_for_each_nominee\n category_id = self.id\n results = Result.where({\"category_id\" => category_id})\n nominee_hash = Hash.new(0)\n\n results.each do |loser| \n loser = loser.lost_id\n if loser != nil\n nominee_hash[loser] +=1\n end\n end\n tallied_results = nominee_hash.sort_by{ |key, value| value}.reverse.to_h\n return tallied_results\n end", "def pre_compute_n_0_0\n results = {}\n\n # Logger\n n = 1\n\n classes.each do |q_klass|\n results[q_klass] = {}\n\n uniq_terms.each do |term|\n n += 1\n count = 0.0\n\n @data.each_pair do |klass, documents|\n if klass != q_klass\n documents.each do |document|\n count += 1 if !document.include?(term)\n end\n end\n end\n\n results[q_klass][term] = count\n end\n end\n\n results\n end", "def winning_results_frequency_for_each_nominee\n category_id = self.id\n results = Result.where({\"category_id\" => category_id})\n nominee_hash = Hash.new(0)\n\n results.each do |winner| \n winner = winner.loved_id\n if winner != nil\n nominee_hash[winner] +=1\n end\n end\n\n tallied_results = nominee_hash.sort_by{ |key, value| value}.reverse.to_h\n return tallied_results\n end", "def dupe_indices(array)\n #ht = Hash.new {|h,k| h[k]=[]}\n #ht[\"cats\"] << \"Jellicle\"\n #ht[\"cats\"] << \"Mr. Mistoffelees\"\n hash = Hash.new { |h,k| h[k]=[] }\n array.each_with_index do |char, i|\n hash[char] << i\n end\n \n # puts \"Hash b select form : #{b.select{|key, value| value < 200}}\\n\\n\n hash.select{ |k,v| v.length > 1}\n\n\nend", "def calcFrequency(freqs)\n\tsum = freqs.reduce(0, :+)\n\tputs sum\nend", "def find_different weights\n counts = Hash.new 0\n weights.each do |x|\n counts[x] += 1\n end\n k, _ = counts.rassoc 1\n k\nend", "def charFreq(someFile)\ntext = \"\"\nFile.open(someFile, 'r') do |file|\n text = file.to_a.to_s.downcase.gsub(/[^a-z\\s]/, '')\nend\n\nfreq = {}\nchar = text.split(\"\")\nfreq = char.uniq.each{|c| freq[c] = char.count(c)}\n\ncounts = {}\nfor c in char \n if counts.key?(c)\n counts[c] += 1\n else \n counts[c] = 1\n end\nend \n\nprint(counts)\nend", "def frequencies\n $heap[:word_freqs] = {}\n $heap[:count] = 0 # we need because of operator order, see below\n # A little flavour of the real Forth style here...\n while $stack.length > 0\n # ...but the following line is not in style, because the \n # naive implementation would be too slow\n if $heap[:word_freqs].include? $stack.last\n # Increment the frequency, postfix style: f 1 +\n $stack.push $heap[:word_freqs][$stack.last] # push f\n $stack.push 1\n $stack.push $stack.pop + $stack.pop\n else\n $stack.push 1\n end\n # Load the updated freq back onto heap\n $heap[:count] = $stack.pop\n $heap[:word_freqs][$stack.pop] = $heap[:count] # can't write head[_][stack.pop] = stack.pop\n end\n # Push result onto the stack\n $stack.push $heap[:word_freqs]\n $heap[:word_freqs] = nil; $heap[:count] = nil # Don't need this variable\nend", "def frequency_of_items(sorted=true)\n \n items = self.all_items(uniq=false)\n table = {}\n \n items.each do |item|\n table.has_key?(item) ? table[item] += 1 : table[item] = 1\n end\n \n # sort descending : minus sign of value\n sorted ? table.sort_by{ |key, value| -value} : table\n end", "def frequencies(book)\n book.downcase!\n words = book.split\n word_frequency = {}\n words.each do |word|\n if WORDS.include?(word)\n if word_frequency.key?(word)\n word_frequency[word] += 1\n else\n word_frequency[word] = 1\n end\n end\n end\n word_frequency\nend", "def my_uniq(arr)\n count = Hash.new(0)\n arr.each do |item|\n count[item] += 1\n end\n count.keys\n # or could do these_keys = {} arr.each {|item| these_keys[item] = true} these_keys.keys\nend", "def who_often_takes\n\t \thash = Hash.new(0)\n\t\tres = @orders.each { |order| hash[order.name] += 1 } \n\t\thash.max{|a, b| a.length <=> b.length}\n\t end", "def count_elements(array)\n counts = Hash.new 0\n unique_elements = array.uniq\n\n unique_elements.each do |item|\n item[:count] = array.count(item)\n end\n\n unique_elements\nend", "def calculate_frequencies\n order_attributes(true)\n build_tree\n end", "def mode(arr)\n\tarr.sort!\n\tfreq_val = Hash.new(0)\n\tarr.each{ |i|\n\t freq_val[i] += 1 }\n\t freq_val.sort_by { |k,v| v}\n\t return freq_val.values[0]\nend", "def word_frequency(text)\n norm_array = normalize(text).to_a\n freq = { }\n norm_array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1}\nend", "def consolidate_by_frequency(array)\n array.group_by{|x| x}.values.sort_by{|group| group.count}.reverse.flatten(1).uniq\nend", "def count_elements(collection)\n count_array = []\n hash_array = []\n\n collection.each do |hash|\n\n if count_array.include?(hash[:name])\n hash_array.each do |value|\n if value[:name] == hash[:name]\n value[:count] = value[:count] + 1\n end\n end\n else\n new_hash = {}\n new_hash[:name] = hash[:name]\n new_hash[:count] = 1\n\n count_array << hash[:name]\n hash_array << new_hash\n end\n\n\n end\n\n return hash_array\nend", "def perform_analytics(data)\n # input -> data: a hash of the form { users -> list of strings of commands }\n # output -> results: a nested array of two-element arrays\n results = [] # [[ string, count ]] or {string => count}, chartkick can deal with either.\n frequencies = Hash.new(0)\n data.keys.each do | user |\n data[user].each do | cmd |\n if !frequencies.include?(cmd)\n frequencies[cmd] = 1\n else\n frequencies[cmd] += 1\n end\n end\n end\n return frequencies \t\n end", "def genFreqTable(string)\n freqTable = Hash.new\n string.split(\"\").each do |i| #loop through every character in the string\n if freqTable.has_key?(string[i]) #if key already exists\n freqTable[string[i]] += 1 #increments its frequency\n else\n freqTable[string[i]] = 1 #else its a new key so set its frequency to 1\n end\n end\n return freqTable\nend", "def calculate_word_frequency\n # not a class method, it is used to poulate what are essentially properties on an instance of the class\n #word_frequency = @content.split(\" \").each_with_object(Hash.new(0)) {|word,count| count[word] +=1}\n word_frequency = Hash.new(0)\n #puts word_frequency\n @content.split.each do |word|\n word_frequency[word] += 1\n end\n\n\n @highest_wf_count = word_frequency.values.max\n @highest_wf_words = word_frequency.select { |word, freq| freq == @highest_wf_count }.keys\n @highest_wf_words\n\n end", "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 count(array)\n hash = {}\n array.each do |item|\n hash[item] = array.count(item)\n end\n hash\nend", "def mode(array)\n freq_hash = Hash.new(0)\n #hash_array = Hash[array.map{|x| [x,0]}]\n array.each do |arg|\n freq_hash[arg] += 1\n end\n freq_hash\n new_array = Array.new\n\n freq_hash.each do |key,value|\n if value == freq_hash.values.max\n new_array.push(key)\n end\n end\n new_array\nend", "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 counts = Hash.new(0)\n\n arr.each do |int|\n counts[int] += 1\n end\n\n freq = counts.values\n # returns array of frequencies [2,1]\n\n if freq.uniq! == false && freq.uniq.length > 1\n freq.max\n counts.key(freq.max)\n else\n nil\n end\n\n \nend", "def mode\n freqh = frequency.inject(Hash.new(0)) { |h,v| h[v] += 1; h}\n\n freqh.select { |k, v| v == freqh.values.max}.keys\n end", "def solution0(a)\n\n total_count = 0\n elem_counts = Hash.new(0)\n\n a.each do |elem|\n elem_counts[elem] += 1\n total_count += 1 if elem_counts[elem] == 2\n end\n\n return total_count\n\nend", "def gem_element arr\n freq = Hash.new(0)\n count = 0\n\n combo = arr.map(&:chars).map(&:uniq).flatten\n combo.each{ |key| freq[key]+=1 }\n freq.each{ |k,v| count +=1 if v == arr.size }\n count\n \nend", "def compute_freq_map(str)\n # OPTIMIZATION IDEA: Make this function also be able to determine if the curr_freq_map matches the last_freq_map\n freq_map = {}\n str.each_char do |char|\n if freq_map[char]\n freq_map[char] += 1\n else\n freq_map[char] = 1\n end\n end\n return freq_map\nend", "def count_elements(array)\n new_array = array.uniq\n new_array.each do |hash|\n hash[:count] = array.count(hash)\n end\n new_array\nend" ]
[ "0.7189087", "0.6992958", "0.6767406", "0.66592675", "0.65767807", "0.6547761", "0.6528727", "0.63719213", "0.63680774", "0.636455", "0.6290753", "0.6278185", "0.6274773", "0.6265522", "0.62090176", "0.6205272", "0.6203006", "0.61979276", "0.61768025", "0.616995", "0.6163011", "0.6117126", "0.6094556", "0.6093612", "0.6080068", "0.6056569", "0.6050534", "0.6046748", "0.60358906", "0.6031892", "0.6024811", "0.6016455", "0.6001071", "0.59837943", "0.5911795", "0.59026766", "0.5897244", "0.5896537", "0.58953416", "0.5879526", "0.58771706", "0.58528304", "0.5849043", "0.58467174", "0.5841235", "0.5841183", "0.5837863", "0.5835755", "0.58288383", "0.58161527", "0.581274", "0.58052063", "0.5795071", "0.57946825", "0.57919216", "0.5788444", "0.5772011", "0.5771048", "0.57683617", "0.5766663", "0.5763645", "0.5758683", "0.5758059", "0.5739991", "0.5735461", "0.5731553", "0.5728513", "0.57242376", "0.5722121", "0.5719722", "0.5717723", "0.570783", "0.5696596", "0.5684115", "0.567016", "0.56601226", "0.56595033", "0.5653886", "0.56524706", "0.564902", "0.5646691", "0.5645433", "0.56454074", "0.5632499", "0.56239694", "0.56198806", "0.5616481", "0.5613896", "0.5605276", "0.5604325", "0.5601929", "0.55997235", "0.5593932", "0.5591746", "0.55890816", "0.5586283", "0.5581956", "0.55722356", "0.5571248", "0.5570578", "0.5569447" ]
0.0
-1
puts duplicate_number([1,2,2,2,4,5]) => 2 puts duplicate_number([1,2,3,'4'])
def first_non_repeat_char(string) raise ArgumentError, 'Parameter must be a string' unless string.is_a? String char_array = string.upcase.chars unique = char_array.select { |char| char_array.count(char) == 1 } unique.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def duplicate_number(array)\n raise ArgumentError, 'Parameter must be an array' unless array.is_a? Array\n raise ArgumentError, 'Parameter must be an array of integers' unless array.all? {|i| i.is_a?(Integer) }\n\n array.detect{ |number| array.count(number) > 1 }\nend", "def find_dup(array_of_integers)\n array_of_integers.each do |integer|\n return integer if array_of_integers.count(integer) == 2\n end\nend", "def find_dup(arr)\n arr.select { |num| arr.count(num) == 2 }.uniq.join.to_i\nend", "def unique_number(arr)\n arr.uniq.find { |e| arr.count(e) == 1 }\nend", "def repeated_digit number\n raise \"Wrong type of argument\" if !number.is_a? Numeric\n # array = number.to_s.split(\"\").map(&:to_i)\n # array.count{ |item| item != array.first} == 0\n\n # number.to_s.squeeze.length == 1\n\n number.to_s.chars.uniq.length == 1\nend", "def find_duplicate(array)\n numberCount = {}\n array.each do |element|\n if !numberCount[element]\n numberCount[element] = 1\n else \n return element\n end \n end \n -1\nend", "def remove_duplicates(nums)\n puts nums.uniq.length\nend", "def find_dup(arr)\n dup = nil\n single_num = []\n arr.each do |num|\n if single_num.include?(num)\n dup = num\n else\n single_num << num\n end\n end\n dup\nend", "def numUnique2 list\n current_num = list[0]\n unique_numbers = [list[0]]\n\n list.each do |num|\n if num != current_num\n current_num = num\n unique_numbers << num\n end\n end\n return \"**#{unique_numbers.length}**\"\nend", "def find_dup(array)\n array.find { |num| num if array.count(num) > 1 }\nend", "def find_dup(arr)\n arr.select { |i| arr.count(i) == 2 }.uniq.join.to_i\nend", "def remove_duplicates(nums)\n nums.uniq!\n return nums.length\nend", "def find_dup(arr)\n arr.each do |item|\n item_count = arr.count(item)\n return item if item_count > 1\n end\nend", "def find_dup(array)\n array.each { |x| return x if array.count(x) == 2 }\nend", "def find_dup(array)\n for elem in array\n return elem if array.count(elem) == 2\n end\nend", "def single_number(nums)\n uniques = []\n nums.each do |num|\n uniques.include?(num) ? uniques.delete(num) : uniques << num\n end\n uniques\nend", "def num_unique2(arr)\n count = 0\n new_number = nil\n arr.each do |number|\n if new_number != number\n new_number = number\n count += 1\n end\n end\n return count\n end", "def find_dup(arr)\n arr.each{ | ele | return ele if arr.count(ele) == 2 }\nend", "def duplicate?(num, input_array)\n\tstatus = false\n\n\tinput_array.each do |i|\n\t\tif num == i \n\t\t\tstatus = true\n\t\tend\n\tend\n\treturn status\nend", "def remove_duplicates(nums)\n record_leng = 0\n uniq_arr = nums.uniq\n uniq_arr.each do |i|\n record_leng += 1 if count_great_two?(nums, i)\n end\n return (record_leng + uniq_arr.size)\nend", "def find_duplicate(array)\n\n if array.detect{ |value| array.count(value) > 1 }\n # use of detect method will find item in array\n \tduplicate = array.detect{ |value| array.count(value) > 1 }\n p \"duplicate is: #{duplicate}\"\n return duplicate\n else\n # if no duplicates, indicate to the user\n p \"no duplicate\"\n end\nend", "def find_dup(array)\n # 17 - (1 + 2 + 3 + 4 + 5) = 2 --- total in this array minus total if there were no dupes\n array.reduce(&:+) - (1..(array.length - 1)).reduce(&:+)\nend", "def find_duplicate(arr)\n\tarr.select{|e| arr.count(e) > 1}.uniq\nend", "def find_dup(array)\n array.find { |item| array.count(item) == 2 }\nend", "def find_dup(array)\n array.find { |element| array.count(element) == 2 }\nend", "def find_dup(array)\n array.find { |element| array.count(element) == 2 }\nend", "def find_dup_number(array)\n n = array.length - 1\n expected_sum = n*(n+1)/2\n actual_sum = array.reduce(:+)\n actual_sum - expected_sum\nend", "def find_dup(arr)\n arr.find { |element| arr.count(element) == 2 }\nend", "def numUnique list\n if list.length == 0\n return \"**0**\"\n end\n counter = Hash.new\n counter[list[0]] = 1\n\n list.each do |num|\n number_exists = false\n counter.each do |key, count|\n if num == key\n count += 1\n number_exists = true\n end\n end\n\n if !number_exists\n counter[num] = 1\n end\n\n end\n\n puts \"counter #{counter}\"\n unique_nums = []\n\n counter.each do |key, value|\n unique_nums << key\n end\n\n return \"**#{unique_nums.length}**\"\n\nend", "def find_duplicate_space(nums)\n # sort nums first (lgn), then check for dups by iterate over (n)\n last_seen = 0\n nums.sort!.each do |num|\n return num if last_seen == num\n last_seen = num\n end\nend", "def num_duplicates\n count = 0\n nums = Hash.new(0)\n @array.each do |num|\n nums[num] += 1\n count += 1 if nums[num] > 1\n end\n count\nend", "def duplicates?(input_numbers)\n collection_of_numbers = {}\n input_numbers.each do |number|\n if collection_of_numbers[number]\n return true\n else\n collection_of_numbers[number] = true\n end\n end\n return false\nend", "def contains_duplicate(nums)\n tmp_arr = nums.uniq\n result = \n tmp_arr.map do |i|\n nums.select { |j| i == j }.size > 1\n end\n return result.any?\nend", "def find_dup(arr)\n arr.reduce(0) { |acc, current| arr.count(current) == 2 ? current : acc }\nend", "def uniq?(num)\n num.to_s.chars.uniq.size == num.to_s.chars.size\nend", "def duplicate(array)\n if array.uniq.length == array.length\n return \"array doesn't have any duplicates homey\"\n else\n arycpy = array\n while arycpy != nil do \n y = arycpy.pop\n if arycpy.include? y\n return y\n end\n end\n end\nend", "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 non_duplicated_values(values)\n values.each do |num|\n values.delete(num) if values.count(num)>=2\n end\n return values\nend", "def find_first_dup(num_arr)\r\n set = []\r\n num_arr.each do |value|\r\n return value if set[value] #return value if it exists already in the set 'Array'\r\n set[value] = true \r\n end\r\n return -1 \r\nend", "def 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 find_dup(array)\n array.inject(Hash.new(0)) { |hash, item| hash[item] += 1; hash }.key(2)\nend", "def find_dup(cadena)\n cadena.detect{ |e| cadena.count(e) > 1 }\nend", "def single_number(nums)\n nums.sort.uniq.each do |i|\n if appears_three?(nums.sort, i)\n return i\n end\nend\nreturn -1\nend", "def dupe(array)\n n = array.length - 1\n sum = ((n * n) + n) / 2\n return array.reduce(&:+) - sum\n # array.each_with_object({}) { |i,o| o[i.to_s] ? o[i.to_s] += 1 : o[i.to_s] = 1 }.keep_if { |k,v| v > 1 }.to_a[0][0].to_i\nend", "def nondupes(array)\n array.map do |elem| \n array.count(elem) == 1\n \n end\n \nend", "def non_duplicated_values(values)\n return values.select {|x| values.count(x) == 1 } \nend", "def remove_duplicates(array)\n array.uniq!.length\nend", "def non_duplicated_values(values)\n p values.select{ |i|\n values.count(i) == 1\n \t}\nend", "def contains_duplicate(nums)\n nums.length.times do |i|\n (0..i - 1).each do |j|\n return true if nums[j] == nums[i]\n end\n end\n\n false\nend", "def hasDupes(a)\n return a.uniq.length == a.length\nend", "def remove_duplicates(nums)\n prev = nil\n count = 0\n nums.each do |num|\n if num == prev\n next\n else\n nums[count] = num\n prev = num\n count+=1\n end\n end\n\n return count\nend", "def single_number(nums)\n 2 * nums.uniq.reduce(:+) - nums.reduce(:+)\nend", "def non_duplicated_values(values)\n uniques = []\n for number in values.uniq.each do\n if values.count(number) == 1\n uniques.push(number)\n end\n end\n return uniques\nend", "def firstDuplicate(a)\n counters = Hash.new(0)\n \n a.each do |i|\n counters[i] = counters[i] += 1\n if counters[i] > 1\n i\n end\n end\n -1\nend", "def duplicates(array)\n frequency = Hash.new(0)\n array.each do |element|\n frequency[element] += 1\n end\n frequency.each do |k, v|\n return k if v > 1\n end\nend", "def duplicate_elements?(arr)\n arr.uniq.length != arr.length\nend", "def find_lonely_num(array_of_numbers)\n a = Hash.new(0)\n array_of_numbers.each do |elem|\n a[elem]+=1\n end\n a.key(1)\nend", "def nondupes(array)\n new_array = []\n array.each do |elem| \n if array.count(elem) == 1\n new_array << elem \n end\n end\n new_array\nend", "def find_duplicate_space(nums)\n current_num = nums[0]\n\n loop do\n potential_duplicate = nums[current_num] # check the number at the index represented by the current_num\n return current_num if current_num == potential_duplicate # return the current_num if it matches the value at the index (is duplicate)\n nums[current_num] = current_num\n current_num = potential_duplicate\n end\nend", "def find_dup(list)\n seen = { 0 => true }\n dup = nil\n current = 0\n loop do\n current = list.reduce(current) do |sum, i|\n sum = sum + i.to_i\n return sum if seen[sum]\n seen[sum] = true\n sum\n end\n end\nend", "def find_duplicates(array)\n result_hash = {}\n result_array = []\n\n array.each do |num|\n if result_hash[num].nil?\n result_hash[num] = 1\n else\n result_hash[num] += 1\n end\n end\n\n result_hash.each do |k, v|\n result_array.push(k) if v > 1\n end\n\n result_array\nend", "def contains_duplicate(nums)\n hash_table = {}\n (0..nums.length).each do |i|\n if hash_table.include? nums[i]\n return true\n else\n hash_table[nums[i]] = 1\n end\n end\n return false\nend", "def single_number(nums)\n counts = Hash.new(0)\n nums.each do |num|\n if counts[num] == 0\n counts[num] += 1\n elsif counts[num] == 1\n counts.delete(num)\n end\n end\n counts.first[0]\nend", "def single_number(nums)\n hash = Hash.new(0)\n nums.each do |val|\n if nums.include?val \n hash[val] += 1\n end\n end\n p hash.keys\nend", "def no_dupes?(arr)\n count = Hash.new(0)\n arr.each { |el| count[el] += 1 }\n count.keys.select { |el| count[el] == 1 }\nend", "def no_dupes?(arr)\n count_hash = Hash.new(0)\n non_dupes = []\n\n arr.each { |ele| count_hash[ele] += 1 }\n\n count_hash.each do |key, val|\n non_dupes << key if val == 1\n end\n\n non_dupes\nend", "def find_duplicates(a)\n len=a.length\n n=len-2\n sum_of_series= (n*(n+1))/2 #Sum of series 1 to n\n \n #Find sum and product of array elements\n sum=0\n product=1\n \n for x in a\n sum+=x\n product*=x\n end\n \n sum-=sum_of_series #sum is a+b now,where a and b are repeating numbers\n product/=fact(n) #product is a*b now,where a and b are repeating numbers\n \n temp= Math.sqrt((sum**2)-(4*product)).to_i # temp is a-b\n \n\tprint \"#{(sum+d)/2} #{(sum-d)/2}\"\nend", "def no_dupes?(arr)\n solved = Hash.new(0)\n arr.each { |ele| solved[ele] += 1 }\n solved.keys.select { |ele| solved[ele] == 1 }\nend", "def remove_duplicates(nums)\n return 0 if nums.empty?\n cur = nums.first\n primary = 1\n nums.each_with_index do |num, _idx|\n next if num == cur\n nums[primary] = num\n cur = num\n primary += 1\n end\n primary\nend", "def single_number(nums)\n num_hash = {}\n \n nums.each do |num|\n if num_hash[num]\n num_hash[num] += 1\n else\n num_hash[num] = 1\n end\n end\n \n num_hash.each do |num, quantity|\n if quantity == 1\n return num\n end\n end\nend", "def more_than_once(string)\n # Write your code here\n a = string.length\n array = []\n i = 0\n loop do \n array.push(string[i])\n i += 1\n break if i == a \n end\n p array\n array1 = array.uniq\n y = array1.length\n x = 0\n result = []\n loop do \n if array.count(array1[x]) > 2\n result.push(array1[x])\n end\n x += 1\n break if x == y \n end \nreturn result\nend", "def solution(a)\n a.uniq.count\nend", "def uniq_integer(input_array)\n unique = 0\n input_array.each do |num|\n unique = unique ^ num\n end\n\n unique\nend", "def no_dupes?(arr)\n counter_hash = Hash.new(0)\n arr.each { |ele| counter_hash[ele] += 1 }\n counter_hash.select { |key, val| val == 1 }.keys\n #counter_hash.keys.select { |blah| counter_hash[blah] == 1 }\nend", "def duplicate(array)\n array.uniq!\nend", "def unique_number(arr)\n existing_numbers = []\n not_unique = []\n arr.each do |entry|\n if existing_numbers[entry] === nil\n existing_numbers[entry] = true\n else\n not_unique[entry] = true\n end\n end\n arr.each do |entry|\n if not_unique[entry] == nil\n return entry\n end\n end\nend", "def first_duplicate(a)\n a.uniq.each do |i|\n return i if a.select {|j| i == j}.count > 1\n end\n nil\n end", "def has_duplicate_value_linear(array)\n existing_numbers = []\n (array.length - 1).times do |i|\n if existing_numbers[array[i]] == nil\n existing_numbers[array[i]] = 1\n else\n return true\n end\n end\n false\nend", "def no_dupes?(array)\n hash = Hash.new(0)\n array.each do |ele|\n hash[ele] += 1\n end\n new_array = []\n hash.each do |k, v|\n new_array << k if v == 1\n end\n return new_array\nend", "def duplicate_count(text)\n arr = text.downcase.split(\"\")\n arr.uniq.count { |n| arr.count(n) > 1 }\nend", "def no_dupes?(arr)\n count = Hash.new(0)\n\n arr.each { |ele| count[ele] += 1 }\n\n array = []\n count.each { |k, v| array << k if v == 1 }\n\n array\nend", "def find_duplicate(arr)\n # compare the last and next elements until they match\n dupe = arr.inject do |last, nxt|\n # return the match\n return last if last == nxt\n # otherwise return the next elem\n nxt\n end\nend", "def non_duplicated_values(values)\n values.find_all { |x| values.count(x) == 1 }\nend", "def no_dupes?(arr)\n counts = Hash.new(0)\n arr.each do |e|\n counts[e] += 1\n end\n counts.select {|k,v| v <= 1}.keys\nend", "def digits_repeat?(number)\n !(number.to_s.chars.eql? number.to_s.chars.uniq)\nend", "def find_dup(arr)\n sorted = arr.sort\n num_arr = sorted.select.with_index do |el, idx|\n current_el = sorted[idx]\n if current_el == sorted[idx + 1]\n current_el\n end\n end\n num_arr[0]\nend", "def uniq_digits?(num)\n digits = num.to_s.chars\n digits == digits.uniq\nend", "def non_duplicated_values(values)\n values.select { |value| values.count(value) == 1 }\nend", "def non_duplicated_values(values)\n values.select { |value| values.count(value) == 1 }\nend", "def no_dupes?(arr)\n counter = Hash.new(0)\n arr.each { |ele| counter[ele] +=1 }\n \n # new_array = []\n # counter.each do |k,v|\n # new_array << k if v == 1\n # end\n # new_array\n counter.keys.select { |el| counter[el] == 1 }\nend", "def no_dupes?(arr)\n new_hash = Hash.new(0)\n new_arr = []\n\n arr.each do |x|\n new_hash[x] += 1\n end\n\n new_hash.each do |k,v|\n if v == 1\n new_arr << k\n end\n end\n new_arr\nend", "def single_number(nums)\n (3 * nums.uniq.sum - nums.sum) / 2\nend", "def print_duplicates(array)\n size = array.size\n array.each do |element|\n element = element.abs # returns the absolute value\n if element < size # This would fail if we have an element in the array i.e. greater than size of array\n if array[element] > 0\n array[element] = -array[element] # Indicates first occurance\n else # Element at that pos already negative, indicates current element is duplicate.\n puts \"#{element} is repeated\" # printing the duplicate\n end\n else\n puts ArgumentError.new \"failed constraints for the array\"\n break\n end\n end\nend", "def numUnique2(array)\n uniq_length = 0\n for i in 0...array.length\n if array[i+1] != array[i]\n uniq_length += 1\n end\n end\n return uniq_length\nend", "def single_number(nums)\n\tnums.sort!\n\tn = nums.size - 1\n\ti = 0\n\twhile (i <= n)\n\t\tif nums[i] == nums[i+1]\n\t\t\ti+= 3\n\t\telse\n\t\t\treturn nums[i]\n\t\tend\n\tend\n\treturn 0\nend", "def non_duplicated_values(values)\n values.each do |x|\n values.delete(x) if values.count(x) == 2\n end\nend", "def no_dupes?(arr)\n hash = Hash.new(0)\n arr.each do |ele|\n hash[ele] += 1\n end\n #can use the select method\n # hash.keys.select {|ele| hash[ele] == 1}\n new = []\n hash.each do |k, v|\n new << k if v == 1\n end\n new\n #another way to do it is sort and if there are adjacent pairs\n # we know that it is not a unique pair\nend", "def has_group_of_at_least_two_repeating_nums(num)\n num.digits.group_by { |i| i }.any? { |c, values| values.length > 1 }\n end", "def no_dupes?(arr)\n arr.reject do |ele|\n # debugger\n arr.count(ele) > 1\n end\nend", "def find_unique_elements(arr)\n arr_fin=[]\n arr.each do |x|\n arr.count(x)\n if arr.count(x)==1\n arr_fin << x\n end\n end\n return arr_fin\nend", "def remove_duplicates(nums)\n size, cursor = 0, 0\n while cursor < nums.size # iterating through each number in nums starting from the first number at index 0.\n num = nums[cursor] # as I iterate through each number, I will assign it to a variable called \"num\", i.e \"num\" will be constantly rewritten to the value that I am currently at as I iterate through the numbers.\n cursor += 1 # so that I can iterate.\n while nums[cursor] == num # if the duplicates are next to each other\n cursor += 1 # I iterate to the next number.\n end\n nums[size] = num # use num(which exclude the duplicates) again and assign it to nums[size] (which is the actual number). this step is just a checker so that the next step (size += 1) will be accurate, it is not actually removing the duplicates inline, i.e return nums will not give you the array without duplicates.\n size += 1 # After filtering out the duplicates, increase the counter by 1 every time we move on to another number.\n end\n return size\nend" ]
[ "0.78283864", "0.74921274", "0.7293659", "0.7271644", "0.7268328", "0.719596", "0.7164671", "0.7142791", "0.71152014", "0.7110459", "0.7054195", "0.70180225", "0.6986368", "0.69740325", "0.6923069", "0.69219524", "0.6907931", "0.690389", "0.6875038", "0.68579787", "0.6796342", "0.67835665", "0.67835593", "0.67531955", "0.6707563", "0.6707563", "0.66804755", "0.666696", "0.666631", "0.66483504", "0.66117156", "0.657073", "0.65453404", "0.65431476", "0.6528835", "0.6521979", "0.6508472", "0.64844775", "0.6474606", "0.6456082", "0.64175236", "0.6393816", "0.6378866", "0.6374507", "0.63681346", "0.63569546", "0.6334081", "0.63318396", "0.6324667", "0.6323129", "0.63131535", "0.63071245", "0.63011754", "0.62966496", "0.6295906", "0.6293723", "0.6293249", "0.6290867", "0.6273475", "0.62728274", "0.6271679", "0.62676626", "0.6261133", "0.6260461", "0.62598556", "0.6242841", "0.6234747", "0.6227845", "0.62272793", "0.6225506", "0.6217823", "0.6217361", "0.621313", "0.6208591", "0.6201231", "0.61959517", "0.6187685", "0.6183011", "0.6182948", "0.6172772", "0.6169455", "0.6165668", "0.616472", "0.61540616", "0.61539423", "0.61535585", "0.61532766", "0.61529773", "0.61529773", "0.6151841", "0.61425495", "0.6138862", "0.6125482", "0.6121679", "0.6115605", "0.6107513", "0.6098903", "0.6098302", "0.60890627", "0.6083294", "0.6081498" ]
0.0
-1
If a block is passed in, it is given self.
def initialize(program_prefix = $0) @options = {} @order = [] @program_prefix = program_prefix @banner = nil @saved = nil if (block_given?) yield self end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_block\n @_block.call(self) if @_block\n end", "def call(&block)\n block.call(self) if block_given?\n self\n end", "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block\n end", "def initialize(&block)\n @block = block\n end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def set_block &b\n @block = b\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 call\n @block.arity < 1 ? self.instance_eval(&@block) : @block.call(self) if @block\n self\n end", "def with_block(&block)\n end", "def self \n if block_given?\n yield self\n else\n self\n end", "def run\n if @block.arity >= 1\n @block.call self\n else\n @block.call\n end\n end", "def block?; end", "def block=(_arg0); end", "def block=(_arg0); end", "def execute_block(block)\n case\n when block.is_a?(Symbol)\n send(block)\n when block.respond_to?(:call) && (block.arity == 1 || block.arity == -1)\n block.call(self)\n else\n block\n end \n end", "def use_block(obj, &method)\n\tmethod.call\nend", "def client(&block)\n eval('self', block.binding) if block_given?\n end", "def block\n options.fetch(:block)\n end", "def block_class() Block; end", "def initialize(&block)\n instance_exec(&block) if block_given?\n end", "def call_block(&block)\n block.call\nend", "def run(&block)\n end", "def initialize(&block)\n yield self\n end", "def block\n (@blocks ||= Array.new) << Block.new\n @in_block = @blocks.last\n yield\n @in_block = nil\n end", "def with_block(&block)\n yield self if block_given? && @value\n end", "def expect(&block)\n @block = block\n self\n end", "def call_this(&block)\n block.call\nend", "def client(&block)\n eval('self', block.binding)\n end", "def execute\n yield self if block_given?\n end", "def initialize(options = {}, &block)\n\t\t \n\t\t\tyield self unless block == nil\n\t\tend", "def initialize(&block)\n instance_eval(&block) 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\n yield self if block_given?\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def call(&block)\n instance_eval(&block)\n end", "def initialize\n @block_args = []\n end", "def block_node=(_); end", "def run\n block.call\n end", "def create_block_object(&block)\n block\nend", "def callBlock\n yield\n yield\nend", "def block_node; end", "def block_node; end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def 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 record_block\n @block = true\n end", "def initialize(_options = {}, &block)\n yield self unless block.nil?\n end", "def initialize(&block)\n instance_eval(&block) if block_given?\n end", "def with(&block)\n raise ArgumentError.new(\"Must pass a block\") unless block_given?\n case block.arity\n when 1\n yield self\n when 0\n instance_methods_eval(&block)\n else\n raise \"block arity must be 0 or 1\"\n end\n end", "def initialize(*)\n super\n yield self if block_given?\n end", "def initialize (&block)\n instance_exec(&block)\n end", "def explicit_block(&sloth)\n sloth.call # same as yield\nend", "def block\n true\n end", "def execute(&block)\n\tblock\nend", "def execute(&block)\n\tblock\nend", "def runblock\r\n\t\t\t@b.call\r\n\t\tend", "def runblock\r\n\t\t\t@b.call\r\n\t\tend", "def initialize(&block)\n configure(&block) if block_given?\n end", "def initialize(&block)\r\n yield(self) if block_given? \r\n end", "def run_block\n yield\nend", "def callBlock\n yield # Invokes block\n yield # Invokes block again\nend", "def blocks; end", "def blocks; end", "def blocks; end", "def run(&block); end", "def call(*args)\n block.call(*args) if block\n end", "def with( &blk )\n # blk[ self ]\n self.instance_eval &blk\n end", "def parent( &block )\n return unless parent?\n raise ArgumentError, \"A block must be supplied\" if block.nil?\n\n if block.arity > 0\n block.call(self)\n else\n block.call\n end\n end", "def call(*args)\n block.call(*args)\n end", "def setup &block\n block.try(:call, self)\n end", "def evaluate(&block)\n self.original_self = eval \"self\", block.binding\n instance_eval &block\n end", "def what_i_am(&block)\n\t\tblock.class\n\tend", "def run_block\n if @block\n _block = @block\n @block = nil\n instance_eval &_block\n true\n end\n end", "def execute(&block)\r\n block\r\nend", "def configure(&block)\n yield(self)\n end" ]
[ "0.79832894", "0.79593563", "0.78062487", "0.77270114", "0.77270114", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.76881003", "0.7683147", "0.75617474", "0.7558577", "0.7516807", "0.7458381", "0.7442498", "0.73670894", "0.72329366", "0.72329366", "0.714632", "0.71457446", "0.7106059", "0.7093336", "0.70322555", "0.7022683", "0.6998595", "0.69944346", "0.69898015", "0.69810575", "0.6967855", "0.6934517", "0.6922228", "0.68758184", "0.68571", "0.68515605", "0.6847821", "0.6826876", "0.6826876", "0.6826876", "0.6826876", "0.6825684", "0.6825684", "0.6825684", "0.6821419", "0.68195647", "0.68111145", "0.67980915", "0.67742956", "0.6769794", "0.6769794", "0.676786", "0.676786", "0.67672735", "0.67672735", "0.67672735", "0.67672735", "0.67641723", "0.67634565", "0.6758434", "0.67447937", "0.67445725", "0.6732327", "0.67093605", "0.67021734", "0.66938794", "0.66938794", "0.66615206", "0.66615206", "0.6650534", "0.66438925", "0.6641372", "0.66203797", "0.660743", "0.660743", "0.660743", "0.6586743", "0.6581823", "0.6573585", "0.6569909", "0.65691036", "0.6568528", "0.65659714", "0.65637743", "0.65534323", "0.6550211", "0.6546747" ]
0.0
-1
Enable saving of unknown barewords. With this, the only way to terminate parsing is to hit the end of the parse or with . You can retrieve the saved words from saved.
def save_unknown! @saved = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_save\n save = load_save\n @word = save.word\n @hints = save.hints\n @incorrect = save.incorrect\n @lives = save.lives\n end", "def save_unmatched_words # :nodoc:\n tokens = phrase_without_matches.split(' ')\n unmatched_db = Corpus.new(\"unmatched-#{program_name}.db\")\n tokens.each do |token|\n if !complex_token_matches?(token) # token was not transformed earlier\n @to_match << token\n unmatched_db[token] = @processor.original_text\n end\n end\n unmatched_db.close\n end", "def isolate(word)\n if @games.dict[word]\n @games.dict[word].isolate!\n @dict_adjustments.puts(\"!i #{msg}\")\n @dict_adjustments.flush\n end\n end", "def process()\n \n dict = DictionaryFactory::build(@data, @settings[:options])\n \n unless dict == false\n @data[:words] = dict\n return true\n else\n return false\n end\n \n end", "def handle_save(edit_lines, type)\n if validate_inputs edit_lines\n @word = Word.new do |word|\n word.type = type.downcase.to_sym\n edit_lines.each do |k,v|\n word[k] = v.text\n end\n end\n\n puts \"Created #{@word.inf}\"\n\n Words << @word\n File.open Words_File, 'w' do |file|\n file.truncate 0\n file.write Words.to_yaml\n file.close\n end\n\n clear_edit_lines edit_lines.values\n else\n puts 'not valid'\n end\n end", "def process_sentance(blob)\n # strip out enclosures\n blob = blob.gsub(/\\\\/,'')\n # test for quotes\n # if quotes, these words are important (flag them)\n test = blob.match(/[\"'](.*)['\"]/)\n if test && test.size > 1\n @words = test[1..test.size].join(\" \")\n #test.each{|word|\n # @words << word\n #}\n #blob = blob.gsub(@words,'')\n blob = blob.gsub(/([\"'])/,'')\n end\n unless @words.nil?\n # break up and add to @local_important\n tmp = @words.split(\" \")\n tmp.each{|word|\n @local_important << word.downcase unless @local_important.include? word\n }\n end\n #puts blob\n the_pieces = blob.split(\" \")\n parse_words(the_pieces)\n \n # try to sort words\n words = grab_important_words\n puts words.inspect\n \n puts \"Derived Tags: #{words.join(' ')}\"\n \n end", "def save\n\t\tNg2::HashDb.add(@word, serialize)\n\tend", "def parser_ignore!\n not_among(*OPS, C_QUOTE).many\n end", "def store_valid_word(word)\n @words << word\n @word_index[word] = @last_letter\n end", "def naive_term\n eat_ws_and_comments\n file, line, col = save\n buffer = \"\"\n until eof? || special? || ws?\n buffer += eat\n end\n handle_naive_term buffer, file, line, col\n end", "def save_ambigious_words(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n f.puts w.string + \"\\t\" + tag_strings.sort.join(\"\\t\") if tag_strings.count > 1\n end\n end\n end\n\n nil\n end", "def save_words\n\t\t @word_weight.each do |word, weight|\n\t\t \t@db.update_or_create_word(word, @filename, weight, @word_frequency[word])\n\t\t end\n\t\tend", "def allow_short_words\n not @emphasis[:ignore_short_words]\n end", "def word\n if @sym == SYM_ATOM || @sym == SYM_QTEXT\n save_text\n get\n else\n\t error \"expected word, got #{@sym.inspect}\"\n\tend\n end", "def import_kwords_warning\r\n kwords = settings.import_kwords\r\n return unless kwords.nil? || kwords.none?\r\n\r\n msg = \"ImportKeywords left empty in config file\"\r\n Message::Warning.warning_puts(msg)\r\n\r\n self.check_import = false\r\n end", "def valid_words\n return @valid_words if @valid_words && @valid_words.length > 0\n\n @valid_words = Set.new\n @io.each_line do |l|\n l.encode!('UTF-8', 'UTF-8', invalid: :replace, undef: :replace, replace: '')\n # Funny story, in place methods are faster.\n l.gsub!(/[^[:alnum:]^[:blank:]]/, \"\")\n l.downcase!\n l.strip!\n # Only 'short' words (discard numbers only)\n l.split(\" \").reject{|w| /\\A\\d+\\z/.match(w) || w.length < 3 || w.length > 10}.each do |w|\n @valid_words.add(w)\n end\n end\n @valid_words\n end", "def persist_words!\n start = Time.now\n # gdbm is a fast, simple key-value DB\n require 'gdbm'\n gdbm = GDBM.new('db/word_count.db')\n count = 0\n read_text_into_hash.each do |k, v|\n # gdbm stores values as strings, so values have to be converted to\n # integers, added together and then converted to strings again\n # to be stored\n current_value = gdbm[k].to_i\n gdbm[k] = (v.to_i + current_value).to_s\n count += 1\n end\n print_status(start, count)\n end", "def save_text\n @lexemes << @lexeme\n end", "def check_for_definitions\n @words.each do |word|\n @lemma ? lemma = \" - #{@lemmas[word]}\" : lemma = \"\"\n\n # Strip characters - mimics trimWordLowerCase in texts.js\n regex = /[\\u200B-\\u200D\\uFEFF\\u00A0]/\n word.gsub!(regex, \"\")\n regex = /^[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+|[.,!¡?¿:;\\/|\\\\'\"“”‘’‚„«»‹›()\\[\\]\\-_]+$/\n word.gsub!(regex, \"\")\n \n next if word.length == 0\n \n # Convert to lowercase\n word = word.mb_chars.downcase.to_s\n current_word = word\n \n while word.length > 0 do\n if Match.find_by_word_and_text_id(word, @text)\n break\n else\n if word.length == 1\n @missing.push(\"#{current_word}#{lemma}\")\n break\n else\n if word.last == \"*\"\n word.chomp!(\"*\") # Remove wildcard character, if present\n word = word[0..-2] # Remove last character\n end\n word << \"*\" # Add wildcard character\n end\n end\n end\n end\n end", "def user_add_vocab(db)\n\tuser_word = nil\n\twhile true\n\t\t#display without recognition column\n\t\tplain_display_vocab(db)\n\t\tputs \"What word would you like to insert? (or done)\"\n\t\tuser_word = gets.chomp.capitalize\n\t\tif user_word != \"Done\"\n\t\t\tputs \"What is the definition for #{user_word}?\"\n\t\t\tuser_def = gets.chomp.downcase\n\t\t\t#add new word and definition to table\n\t\t\tdb.execute(\"INSERT INTO nursing (word, definition) VALUES (?, ?)\", [user_word, user_def])\n\t\telse\n\t\t\treturn\n\t\tend\n\tend\nend", "def run\n\t\t\t\tif save_file\n\t\t\t\t\tdoc = Nokogiri::HTML(open(@file,\"r\"))\n\t\t\t\t\tparse_page(doc)\n\t\t\t\t\tflush_page\n\t\t\t save_words\n\t\t\t end\n\t\t\tend", "def save_word(word)\n id = MinWords::DB[:words].insert word_text: word[:word_text]\n save_definition(id, word[:definition_text])\n id\n end", "def _excluded_words\n Lexhub.configuration.excluded_words\n end", "def scan\n $stderr.print \"[words] \"\n\n files.each do |file|\n if $DEBUG\n $stderr.print \"\\n[scan] #{file}\"\n else\n $stderr.print \".\"\n end\n\n text = File.read(file).gsub(\"\\n\", \" \")\n states = text.split(/[.,:;?!()\"]\\s*/)\n\n states.each do |state|\n state.scan(WORD) do |word|\n word = normalize(word)\n if valid_word?(word)\n\t\t self[word] ||= Word.new(word)\n\t\t self[word].file!(file)\n end\n end\n end\n end\n\n $stderr.puts\n end", "def _word\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_atom)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_quoted_string)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_word unless _tmp\n return _tmp\n end", "def is_word_complete()\n !@current_state.include? \"_\"\n end", "def kill_word(*)\n first_non_letter = current_buffer.index(/\\P{L}/, current_buffer.point) || current_buffer.length\n word_beginning = current_buffer.index(/\\p{L}/, first_non_letter) || current_buffer.length\n current_buffer.slice!(current_buffer.point, word_beginning - current_buffer.point)\n true\nend", "def force_parse; end", "def reserved(words)\n lang_eval { @reserved = words }\n nil\n end", "def parser_ignore\n not_among(*OPS, C_QUOTE, *HEX).many\n end", "def parse\r\n @words = @line.split\r\n\r\n @invalid_words = []\r\n @words.each do |word|\r\n w = word.gsub(/([\\+\\.,*\\'\\\";:\\(\\)`\\[\\]?!#])*/,'')\r\n w = w.gsub('&lt;', '')\r\n w = w.gsub('&gt;', '')\r\n next if w == ''\r\n next if w.include?(\"`\") or w.include?(\"'\") or w.include?(\"/\")\r\n next if w.to_i.to_s == w # ignore integers\r\n next if is_white?(w)\r\n\r\n # process < and >\r\n if !(word.include? '<' or word.include? '>')\r\n next if w.start_with? \"http\"\r\n next if w.include? '-'\r\n next if w.downcase.start_with? 'todo'\r\n end\r\n\r\n\r\n if !$speller.correct? w\r\n @invalid_words.push w\r\n if ENV['HTML']\r\n @colorize_line = @colorize_line.gsub(word, \"<span style='color: red;font-weight: bold;'>#{word}</span>\")\r\n else\r\n @colorize_line = @colorize_line.gsub(word, \"\\e[31m#{word}\\e[0m\")\r\n end\r\n end # speller.correct\r\n\r\n end # end for each word\r\n @invalid_words.count !=0\r\n end", "def before_save\n self.theme = Theme.find_by_code('idle') if theme.nil?\n self.syntax = Syntax.find_by_code('plain_text') if syntax.nil?\n end", "def save_ambigious_file(file_name)\n File.open(file_name, 'w') do |f|\n sentences.each do |s|\n s.words.each do |w|\n tag_strings = w.get_correct_tags().collect { |t| t.clean_out_tag }\n tag_strings = ['unkjent_ord'] if tag_strings.count == 0\n f.puts w.norm_string + \"\\t\" + tag_strings.sort.join(\"\\t\")\n end\n\n f.puts\n end\n end\n\n nil\n end", "def on_words_beg(token)\n log \"WORDS_BEG: '#{token}'\"\n super(token)\n end", "def stop_words\n return {} if self.collection_yaml.nil?\n return self[:stop_words] unless self[:stop_words].nil?\n \n self[:stop_words] = Treat.languages[self.treat_collection.language].stop_words\n self.save!\n \n self[:stop_words]\n end", "def check_bad_word(o)\n @@bad_word_visitor.visit_this_0(self, o)\n end", "def restore\n parse\n end", "def custom_stopwords(stopwords)\n unless stopwords.is_a?(Enumerable)\n if stopwords.strip.empty?\n stopwords = []\n elsif File.exist?(stopwords)\n stopwords = File.read(stopwords).force_encoding(\"utf-8\").split\n else\n return # Do not overwrite the default\n end\n end\n Hasher::STOPWORDS[@language] = Set.new stopwords\n end", "def record_data_for_later_saving(data, definition)\n word = data[:word]\n word_index = data[:index]\n\n # Add current definition's see_also list to map for processing later\n @relateds[definition] = data[:see_also]\n\n # Add definition to map of word obj. -> definition objects.\n # This mapping will be used to link all related definitions after they've all been created\n @word_definitions[word.downcase] ||= []\n @word_definitions[word.downcase][word_index] = definition\n end", "def submit_word(word)\n letters_present_for(word) && @dictionary.include?(word)\n end", "def does_not_include_badwords\n\n badwords = %w(\n aloha!\n href=\n -online\n 1freewebspace.com\n 4u\n 5gighost.com\n accutane\n adipex\n adultsex\n advicer\n alprazolam\n amoxil\n arcadepages\n arimidex\n associations.missouristate.edu\n ativan\n augmentin\n baccarrat\n baclofen\n beaver\n blackjack\n bllogspot\n blogs.blackmarble.co.uk\n blowjob\n booker\n buspar\n byob\n car-rental-e-site\n car-rentals-e-site\n carisoprodol\n casino\n casinos\n chatroom\n cialis\n cipro\n citalopram\n clomid\n clonazepam\n comment1\n comment2\n comment3\n comment4\n comment5\n comment6\n coolcoolhu\n coolhu\n credit-card-debt\n credit-report-4u\n creditonlinepersonalloans\n cwas\n cyclen\n cyclobenzaprine\n dating-e-site\n day-trading\n debt-consolidation\n debt-consolidation-consultant\n diazepam\n diovan\n discreetordering\n dostinex\n duty-free\n dutyfree\n dvxuser.com\n equityloans\n fanreach.com\n fioricet\n flagyl\n flowers-leading-site\n fosamax\n freenet\n freenet-shopping\n gambling-\n hair-loss\n health-insurancedeals-4u\n hi5.com\n holdem\n holdempoker\n holdemsoftware\n holdemtexasturbowilson\n homeequityloans\n homefinance\n hotel-dealse-site\n hotele-site\n hotelse-site\n hydrocodone\n hyves.mn\n incest\n insurance-quotesdeals-4u\n insurancedeals-4u\n isuzuforums.com\n jestmaster\n jizz\n jrcreations\n kaboodle.com\n kamagra\n klonopin\n lamictal\n lesbian\n levaquin\n levitra\n lezbian\n loans\n lorazepam\n lycos\n macinstruct\n metformin\n metronidazole\n mortgage-4-u\n mortgagequotes\n musicstation\n nojazzfest\n nolvadex\n online-gambling\n onlinegambling-4u\n ottawavalleyag\n ownsthis\n palm-texas-holdem-game\n paxil\n paydal\n penguinforum\n penis\n personalloansbad\n pharmacy\n phenergan\n phentermine\n poker-chip\n porn\n poze\n profiles.friendster.com\n propecia\n proscar\n pussy\n remeron\n rental-car-e-site\n ringtone\n ringtones\n roulette\n shemale\n shoes\n slot-machine\n Staphcillin\n tamiflu\n tegretol\n texas-holdem\n thorcarlson\n top-e-site\n top-site\n toprol\n toradol\n tramadol\n tramodal\n tramodol\n trim-spa\n ultram\n valeofglamorganconservatives\n valium\n viagra\n vibramycin\n vicodin\n vioxx\n voltaren\n vytorin\n xanax\n zantac\n zithromax\n zofran\n zolpidem\n zolus\n )\n badwords.each do |bw|\n if !comment.nil? && comment.downcase.include?(bw) \n errors.add_to_base(\"Comment Rejected\") \n break\n end\n end\n end", "def badword_QualifiedName(o)\n if o.value == 'bigly'\n acceptor.accept(Issues::INVALID_WORD, o, :text => o.value)\n end\n end", "def known(words)\n #find all words for which condition is true,you need to figure out this condition\n known_words = words.find_all {|w| @dictionary.has_key?(w)} \n return known_words\n end", "def analyse!\n @words = formatted_mispelled_words\n @success = true\n rescue *rescued_exceptions_keys => e\n @success = false\n if rescued_exceptions_messages.include?(e.message)\n # aspell is not present. track analysis as failure\n else\n raise e\n end\n end", "def gensecretword \n @wordtable.sample.gsub(/\\s+/, \"\") # revoving all whitespaces as wordfile has phrases as possible secret words\nend", "def handle_controlled_vocabulary(data, import)\n print \"Handling CV \"\n if import.metadata['controlled_vocabulary']\n print \"from database.\\n\"\n ControlledVocabularyTerm.all.each do |cv|\n data.keywords.merge!(cv.name => cv)\n end\n else\n print \"as newly parsed.\\n\"\n # from collecting_events\n PREDICATES.each do |p|\n data.keywords.merge!(p => Predicate.create(name: \"CollectingEvents:#{p}\", definition: \"The verbatim value imported in for #{p}.\") )\n end\n\n # from handle taxa\n data.keywords.merge!( \n 'Taxa:Synonyms' => Predicate.create(name: 'Taxa:Synonyms', definition: 'The verbatim value on import from Taxa#Synonyms.'),\n 'Taxa:References' => Predicate.create(name: 'Taxa:References', definition: 'The verbatim value on import Taxa#References.')\n )\n\n # from handle specimens\n data.keywords.merge!( \n 'AdultMale' => BiocurationClass.create(name: 'AdultMale', definition: 'The collection object is comprised of adult male(s).'), \n 'AdultFemale' => BiocurationClass.create(name: 'AdultFemale', definition: 'The collection object is comprised of adult female(s).'), \n 'Immature' => BiocurationClass.create(name: 'Immature', definition: 'The collection object is comprised of immature(s).'), \n 'Pupa' => BiocurationClass.create(name: 'Pupa', definition: 'The collection object is comprised of pupa.'), \n 'Exuvium' => BiocurationClass.create(name: 'Exuvia', definition: 'The collection object is comprised of exuvia.'),\n 'AdultUnsexed' => BiocurationClass.create(name: 'AdultUnsexed', definition: 'The collection object is comprised of adults, with sex undetermined.'), \n 'AgeUnknown' => BiocurationClass.create(name: 'AgeUnknown', definition: 'The collection object is comprised of individuals of indtermined age.'), \n 'OtherSpecimens' => BiocurationClass.create(name: 'OtherSpecimens', definition: 'The collection object that is asserted to be unclassified in any manner.'), \n 'ZeroTotal' => Keyword.create(name: 'ZeroTotal', definition: 'On import there were 0 total specimens recorded in the FM database.'),\n 'IdentifiedBy' => Predicate.create(name: 'IdentifiedBy', definition: 'The verbatim value in the identified by field.'),\n 'YearIdentified' => Predicate.create(name: 'YearIdentified', definition: 'The verbatim value in the year identified field.'),\n 'OldIdentifiedBy' => Predicate.create(name: 'OriginalIdentifiedBy', definition: 'Imported value: Old identified by.'),\n 'LocalityCode' => Predicate.create(name: 'LocalityCode', definition: 'Imported value: Locality Code.'),\n 'Country' => Predicate.create(name: 'Country', definition: 'Imported value: Country.'),\n 'State' => Predicate.create(name: 'State', definition: 'Imported value: State.'),\n 'County' => Predicate.create(name: 'County', definition: 'Imported value: County.'),\n 'Locality' => Predicate.create(name: 'Locality', definition: 'Imported value: Locality.'),\n 'Park' => Predicate.create(name: 'Park', definition: 'Imported value: Park.'),\n 'BodyOfWater' => Predicate.create(name: 'BodyOfWater', definition: 'The verbatim value in the Body Of Water.'),\n 'DrainageBasinLesser' => Predicate.create(name: 'DrainageBasinLesser', definition: 'The verbatim value in the Drainage Basin Lesser.'),\n 'DrainageBasinGreater' => Predicate.create(name: 'DrainageBasinGreater', definition: 'The verbatim value in the Drainage Basin Greater.'),\n 'StreamSize' => Predicate.create(name: 'StreamSize', definition: 'The verbatim value in the StreamSize.'),\n 'INDrainage' => Predicate.create(name: 'INDrainage', definition: 'The verbatim value in the INDrainage.'),\n 'WisconsinGlaciated' => Predicate.create(name: 'WisconsinGlaciated', definition: 'The verbatim value in the Wisconsin Glaciated.'),\n 'OldLocalityCode' => Predicate.create(name: 'OldLocalityCode', definition: 'Imported value: Old Locality Code.'),\n 'Host' => Predicate.create(name: 'Host', definition: 'The verbatim value in the Host.'),\n )\n\n import.metadata['controlled_vocabulary'] = true\n end\n end", "def mysql_ignore(words)\r\n return false unless words\r\n return true if superset?(@semantic_matcher.mysql_stop_words,words)\r\n # if all words are #'s ignore it\r\n words.each do |word|\r\n return false unless word.match(/\\d+/)\r\n end\r\n true\r\n end", "def important?(word)\n\nend", "def load_words\n File.readlines(\"#{WORD_DIR}/#{language}.txt\").map(&:strip)\n end", "def process_unknown\n if @unknown.any?\n unknown_token = Tokens::Unknown.new(@unknown.join)\n @tokens << Tokens::Unknown.new(@unknown.join)\n @unknown = []\n end\n end", "def initialize\n @words = I18n.t :dictionary\n @max_word_index = @words.size - 1\n end", "def save_game\n game = {\n :word => @word,\n :max_turn => @max_turn,\n :current_turn => @current_turn,\n :display_word => @display_word,\n :current_guess => @current_guess\n }\n File.open(\"hangman.yaml\", 'w') { |f| f.write(game.to_yaml)}\n print \"Game is saved!\\n\"\n end", "def load_word_list\n @word_list = []\n puts \"Loading word list...\"\n File.readlines(WORDLIST_FILE).each{|word|\n word.gsub!(/[\\r\\n]+/,\"\")\n if valid_word?(word, @inner_letter, @outer_letters)\n @word_list << word\n end\n }\n @word_list.sort!\n puts \"Word list loaded.\"\n end", "def lex_en_plain_words; end", "def lex_en_plain_words; end", "def lex_en_plain_words; end", "def read_word(token)\n while (current = peek_next())\n break unless current == '_' ||\n ('0' <= current && current <= '9') ||\n ('a' <= current && current <= 'z') ||\n ('A' <= current && current <= 'Z')\n read_next()\n end\n\n token.value = @source[token.from .. @marker.source_index]\n\n token.kind = case token.value\n when 'true' then :true_kw\n when 'false' then :false_kw\n when 'null' then :null_kw\n else :id\n end\n end", "def load_vocab_translations\n pp_nl_serialized = File.read(\"#{$filepath_nl}alle danyvertalingen qff export.json\")\n pp_nl = JSON.parse(pp_nl_serialized)\n\n #orgins of words: passaporte (and chapter) or other\n construct_book_origins(pp_nl[\"folders\"])\n \n #saving the words to the database with reference to passaporte_words\n pp_nl[\"words\"].each do |ppnl_line|\n word_pt_raw = ppnl_line[\"word\"]\n word_pt_split = Translation.split_article_front(word_pt_raw)\n word_pt = word_pt_split[:word]\n genre_pt = word_pt_split[:article]\n # puts \"for word_pt_split: #{word_pt_split}\"\n passaporte_found = passaporte_unit?(word_pt_split)\n # puts \"found?:\"\n # puts passaporte_found\n pt_translation = nil\n if !passaporte_found.nil?\n pt_transl = Translation.find_by word_pt:word_pt_split[:word], genre_pt:word_pt_split[:article]\n # puts pt_transl\n end\n # puts \"pt_transl:\"\n # puts pt_transl\n translation_array = ppnl_line[\"translations\"]\n save_nl_translation(word_pt, pt_transl, genre_pt,translation_array, ppnl_line[\"comments\"])\n end\nend", "def load_words\n case @strategy\n when :user\n @words = twitter_user.status.text.split(/\\s/) \n when :search\n @words = twitter_search(@term).statuses.map(&:text).join(\" \").split(/\\s/)\n end\n end", "def save_guess\n if good_guess?\n matching_indexes(@code_word, @word_guesser.guess).each do |i|\n @good_guesses[i] = @word_guesser.guess\n end\n else\n @bad_guesses.push(@word_guesser.guess)\n end\n end", "def init_word_board\r\n\t\t if @resulta.size == 0\r\n\t\t\t\t\t\t\treadwordfile(@filename)\r\n\t\t\t\t\t\t\t@descr = @phrases\r\n\t\t\t\t\t\t\tsetsecretword(gensecretword)\r\n\t\t\t\t\t\tend\r\n\t\t end", "def initialize(dictionary_file_name)\n @dictionary = Set.new(File.open(dictionary_file_name).readlines.map(&:chomp))\n @current_words = []\n @all_seen_words = {}\n end", "def display_name_word\n if @sym == SYM_ATOM || @sym == SYM_ATOM_NON_ASCII || @sym == SYM_QTEXT\n save_text\n get\n else\n\t error \"expected word, got #{@sym.inspect}\"\n\tend\n end", "def guess_letters\n while @guess_count > 0 && @word_guessed.include?('_')\n print 'Guess a letter to play or type save to save game: '\n letter_guessed = gets.chomp.downcase\n if letter_guessed == 'save'\n save_game\n return\n else\n check_letters letter_guessed\n end\n end\n puts \"The secret word was #{@secret_word}\"\n end", "def new_illegal_words(board, dict)\n new_words(board).reject {|word| dict.legal_word?(word.to_s)}\n end", "def prepare_words(filename)\n @words = []\n File.readlines(filename).each do |line|\n line.split.each {|word| @words << word}\n end\n end", "def remove_bad_words(report_model = nil)\n all_words = Word.all_words\n contain_bad_words = false\n res = self.gsub(/\\b\\w+\\b/) do |word|\n if all_words.include?(word.downcase)\n contain_bad_words = true\n '***'\n else\n word\n end\n end.squeeze(' ')\n Report.where(description: 'Contain bad words', target: report_model).first_or_create if contain_bad_words\n res\n end", "def analyze phrase\n\t\t@meaningful_words = meaningful_words(phrase, \" \")\n\tend", "def augment_from_file(path)\n begin\n @word_file = File.open path\n rescue Errno::ENOENT => e\n puts \"[#{self.class}] could not find new dictionary file at \\\"#{word_file}\\\"\"\n exit 1\n end\n puts \"#{self.class} will augment AppleSpell with words from #{path}\"\n augment!\n end", "def lex_en_unknown; end", "def incomplete?\n language_words = BASIC_KEYWORDS.collect { |key| keywords[key].nil? }\n return true if language_words.include?(true)\n false\n end", "def enable_store(bot)\n # blee write <string>: Save <string> into store\n store_regex = /blee write (.*)/\n bot.message(with_text: store_regex) do |event|\n \tmessage = store_regex.match(event.message.content)[1]\n \twith_error_handling(event) do\n\t\t StoreCommands.write(message)\n \t\tevent.respond \"Stored: \" + message\n \t end\n end\n\n # blee read: Reply with the first 10 lines from the store\n bot.message(with_text: /blee read/) do |event|\n \twith_error_handling(event) do\n \t\tdata = StoreCommands.read()\n \t\tif data.nil? || data.empty?\n\t\t \tevent.respond \"No data in store\"\n\t\t else\n\t\t\t event.respond \"Store contents:\"\n\t\t\t event.respond data\n \t\tend\n\t end\n end\n\n # blee clear: Clear the store file\n bot.message(with_text: /blee clear/) do |event|\n\t with_error_handling(event) do\n\t\t StoreCommands.clear()\n \t\tevent.respond \"Cleared store\"\n \tend\n end \n end", "def extended_base(word)\n word_hash = self.words[word.value]\n if word_hash\n # automatically grab the stack values\n stack_input_types = word_hash[:input]\n from_stack = from_stack(word.value, *stack_input_types)\n input_params = []\n if [:both, :input].include?(word_hash[:automap_values])\n from_stack.each_with_index do |x, i|\n input_params.push( word_hash[:input_escapes][i] ? x : x.value )\n end\n end\n\n output_types = word_hash[:output]\n output_params = word_hash[:block].call(*input_params)\n\n output_params = [ output_params ] if output_types.length == 1\n\n output_types.each_with_index do |value, i|\n value = word_hash[:output_escapes][i] ? output_params[i] : StackObject.new(output_types[i], output_params[i])\n @stack.push( value )\n end\n\n return true\n end\n\n case word.value\n when \"accum>stack\"\n # debugger\n # @stack.push(@parse_accums.last.last)\n true\n else\n return false\n end\n true\n end", "def stop_words\n # Words taken from Jonathan Feinberg's cue.language (via jasondavies.com), see lib/cue.language/license.txt.\n \"i|me|my|myself|we|us|our|ours|ourselves|you|your|yours|yourself|yourselves|he|him|his|himself|she|her|hers|herself|it|its|itself|they|them|their|theirs|themselves|what|which|who|whom|whose|this|that|these|those|am|is|are|was|were|be|been|being|have|has|had|having|do|does|did|doing|will|would|should|can|could|ought|im|youre|hes|shes|its|were|theyre|ive|youve|weve|theyve|id|youd|hed|shed|wed|theyd|ill|youll|hell|shell|well|theyll|isnt|arent|wasnt|werent|hasnt|havent|hadnt|doesnt|dont|didnt|wont|wouldnt|shant|shouldnt|cant|cannot|couldnt|mustnt|lets|thats|whos|whats|heres|theres|whens|wheres|whys|hows|a|an|the|and|but|if|or|because|as|until|while|of|at|by|for|with|about|against|between|into|through|during|before|after|above|below|to|from|up|upon|down|in|out|on|off|over|under|again|further|then|once|here|there|when|where|why|how|all|any|both|each|few|more|most|other|some|such|no|nor|not|only|own|same|so|than|too|very|say|says|said|shall\"\nend", "def valid_words(rack)\n # Load the words\n list_of_words = load_words\n array_of_valid_words = []\n # for each word check if all the letters of word are in rack\n list_of_words.each do |word|\n array_of_valid_words << word if check_word(word, rack)\n end\n array_of_valid_words\nend", "def find_word\n if @text.match(/\\=\\=#{@language}\\=\\=/i)\n # Easen regexp to avoid end page match\n @text << \"\\n----\"\n\n language_segment = @text.match(/\\=\\=#{@language}\\=\\=([\\S\\s]+?)(?=(?:\\n----)|(?:\\n\\=\\=\\w+\\=\\=))/i)[1]\n\n lemma = find_lemma_word(language_segment)\n\n if lemma\n store_word(lemma)\n else\n store_word(@title)\n end\n end\n end", "def ignore_extra_tokens?\n @ignore_extra_tokens\n end", "def noop\n @parse_success = false\n @valid = false\n end", "def hide_word\t\n\t\thidden_word\n\tend", "def lex_en_plain_words=(_arg0); end", "def lex_en_plain_words=(_arg0); end", "def lex_en_plain_words=(_arg0); end", "def is_word?(fragment)\n dictionary.include?(fragment)\n end", "def set_word\n @word = current_user.words.includes(:flags).friendly.find(params[:id])\n rescue ActiveRecord::RecordNotFound => ex\n # set temporary word if given :id is a word (not integer)\n # only in case of show action\n temp_id = params[:id]\n if (temp_id.to_i.to_s != temp_id) && (params[:action] == \"show\")\n params[:word] = {word: temp_id}\n params[:id] = nil\n @word = current_user.words.build(word_params)\n else\n raise ex\n end\n end", "def lose_word\n if self.text.split.length > 1\n prev_line = self.text.split\n prev_line.delete_at(rand(prev_line.length))\n self.text = prev_line.join(\" \")\n self.save\n end\n end", "def known words\n known_words = words.find_all { |w| @dict_frequency.has_key? w }\n known_words.empty? ? nil : known_words\n end", "def autofinish; end", "def empty_storage!\n if storage_exists?\n empty_storage\n else\n raise IOError, \"No banned words file!\"\n end\n end", "def lex_en_unknown=(_arg0); end", "def finish_definitions_in_tree(words)\n load_for_prefix(words)\n len = words.length\n all_cur_definitions.each do |tool|\n name = tool.full_name\n next if name.length < len || name.slice(0, len) != words\n tool.finish_definition(self)\n end\n end", "def augment_from_dict(dict)\n path = DICTS[dict.to_sym] || raise(InvalidDictionaryName, dict)\n @word_file = File.open path\n puts \"#{self.class} will augment AppleSpell with words from #{path}\"\n augment!\n end", "def load_used_phrases\n\t@used_phrases = load_collection_from_file(@phrase_file_name, {});\nend", "def scan\n $stderr.print \"[lexicon] \"\n\n dict = Set.new\n\n files.each do |file|\n if $DEBUG\n $stderr.puts \"[scanning dictionary] #{file}\" if $DEBUG\n else\n $stderr.print \".\"\n end\n\n text = File.read(file).gsub(\"\\n\", \" \")\n states = text.split(/[.,:;?!()\"]\\s*/)\n\n states.each do |state|\n state.scan(WORD) do |word|\n word = normalize(word)\n dict << word if valid_word?(word)\n end\n end\n end\n\n @set = dict\n\n $stderr.puts\n end", "def saved\n require_login!\n\n @saved ||= get(SAVED_URL % @username).force_encoding(\"UTF-8\")\n parse_stories @saved\n end", "def add_noun!(word)\n @redis.rpush(\"store:nouns\", Unicode.downcase(word))\n end", "def noop(word)\n word\n end", "def checking_dictionary_for_word_match\n @prefix = @str[@i_last_real_word...@i]\n \n if valid_word?(@prefix)\n if @skip_counter > 0\n @skip_counter -= 1\n else\n @words[i] = @prefix\n @i_last_real_word = @i\n end\n end\n end", "def initialize \n @story_keywords = [] # Creates the array that will hold the part of speech keywords\n end", "def export_dictionary(filename)\n unless @data[:words].nil?\n File.open(filename, 'w') { |f| f.write(@data[:words].to_yaml) }\n end\n end", "def on_qwords_beg(token)\n log \"QWORDS_BEG: '#{token}'\"\n super(token)\n end" ]
[ "0.55728436", "0.5509204", "0.5457359", "0.533028", "0.523965", "0.52024263", "0.5179901", "0.5171566", "0.5164827", "0.51511115", "0.5146599", "0.51216525", "0.5108772", "0.50983286", "0.509507", "0.508494", "0.50693476", "0.50689787", "0.5053207", "0.502266", "0.5001643", "0.49877217", "0.4978647", "0.49705866", "0.4929979", "0.49199203", "0.49187922", "0.48939627", "0.4893726", "0.487647", "0.48455074", "0.48305306", "0.48172387", "0.48090258", "0.4794542", "0.4792494", "0.47910357", "0.47882587", "0.4777977", "0.47765112", "0.476335", "0.4753917", "0.4747035", "0.47305515", "0.47298777", "0.47154865", "0.4711728", "0.47114593", "0.4707723", "0.47071028", "0.4705692", "0.46959487", "0.4686563", "0.4656381", "0.4656381", "0.4656381", "0.4654588", "0.46533722", "0.46526945", "0.46491548", "0.46302214", "0.46300042", "0.46273494", "0.46262807", "0.46221247", "0.46195793", "0.4618722", "0.46088403", "0.46034405", "0.45996967", "0.4597842", "0.45869717", "0.45851585", "0.4583121", "0.4576362", "0.45760778", "0.457091", "0.45705786", "0.4569645", "0.4569416", "0.4569416", "0.4569416", "0.4559347", "0.45587087", "0.455689", "0.45546013", "0.45543107", "0.4549419", "0.45466498", "0.45454004", "0.45451602", "0.45260358", "0.4521983", "0.45118606", "0.45117354", "0.4509559", "0.4508969", "0.45061883", "0.45039922", "0.45028558" ]
0.5656883
0
This defines a command line argument that takes a value.
def argument(short_name, long_name, description, default_value, validate = nil, &block) return define_value(short_name, long_name, description, false, default_value, validate || block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_arg(name, value)\n arg = @args.add_element(REXML::Element.new(\"argument\"))\n add_key_to_element(arg, \"name\", name)\n add_key_to_element(arg, \"value\", value)\n end", "def arg(key, default = nil)\n args.fetch(key.to_s, default)\n end", "def cli=(value); end", "def argument_parser\n arg(external_name, value(type))\n end", "def add_argument(arg)\n @options[:args] << arg\n end", "def add_argument(arg); end", "def add_argument(arg); end", "def add_argument(arg); end", "def to_ruby_arg\n \"#{to_s_name}#{@default ? ' = ' + @default : ''}\"\n end", "def initialize(name, value, *args)\n @name = name\n @value = value\n @options = args.extract_options!\n end", "def initialize(value=\"\")\n @value = value\n end", "def specify(cmd, val)\n # set default value\n if val.nil? and not(self.default.nil?)\n val = self.default\n end\n\n # normalization\n if val\n val = Normalizer.normalize(type, val)\n end\n\n if range.nil? or range.include?(val)\n if processes.empty?\n cmd.model.specify(key, val)\n else\n execute(cmd, val)\n end\n else\n arg = {value: _val, range: range}\n raise OptionError.new(cmd, '\"%{value}\" is out of %{range}' % arg)\n end\n end", "def extract_command_line_argument(argument_name, default_value: nil)\n argument_name_index = ARGV.find_index(argument_name)\n argument_value = ARGV[argument_name_index + 1] if argument_name_index && argument_name_index < (ARGV.length - 1)\n if (argument_value)\n argument_value\n elsif default_value\n default_value\n else\n raise \"Cannot find argument '#{argument_name}'\" if argument_name_index.nil? || argument_name_index < 0\n raise \"Cannot find argument value for '#{argument_name}'\"\n end\nend", "def lunch(value=\"cheese\")\n value\nend", "def change_arg(arg, val)\n if arg == \"onset\"\n @onset = val\n elsif arg == \"offset\"\n @offset = val\n elsif arg == \"ordinal\"\n @ordinal = val\n else\n for i in 0..arglist.length-1\n if arglist[i] == arg and not arg.nil?\n argvals[i] = val.to_s\n end\n end\n end\n end", "def expected_value=(arg)\n end", "def expected_value=(arg)\n end", "def get_cli_arg( name )\n if $cli_args.has_key?(name)\n return $cli_args[name]\n else\n raise RSpec::Expectations::ExpectationNotMetError, \"Command line argument key '#{name}' not found, exiting.\"\n end\n end", "def PO113=(arg)", "def parse(flag, value=nil, argv=[], config={})\n unless value.nil?\n if flag == short\n argv.unshift \"-#{value}\"\n else\n raise \"value specified for #{flag}: #{value.inspect}\"\n end\n end\n\n value = (default.nil? ? true : !default)\n assign(config, process(value))\n end", "def arguments=(value)\n @arguments = value.to_s.strip # TODO: Parse\n end", "def addArg(val)\n @args << val.to_sym\n updateKey\n self\n end", "def cmdarg; end", "def cmdarg; end", "def cmdarg; end", "def PRF02=(arg)", "def PO105=(arg)", "def PO102=(arg)", "def argue(argument)\n argument\nend", "def get_version_argument\n version = ENV['VERSION']\n if version.to_s.empty?\n raise \"No version specified: Add VERSION=X.Y.Z to the command line\"\n end\n begin\n Gem::Version.create(version.dup)\n rescue ArgumentError\n raise \"Invalid version specified in `VERSION=#{version}'\"\n end\nend", "def parse(flag, value=nil, argv=[], config={})\n raise \"value specified for #{flag}: #{value.inspect}\" if value\n\n value = (flag == negative_long ? !default : default)\n assign(config, process(value))\n end", "def process_base_argument(arg)\n case arg\n when *@mapping[:help] then check_and_set_helpvalue\n when *@mapping[:version] then @parameters[:version] = true\n when *@mapping[:file] then create_argument_entry(:file) \n when /-[a-z]|--[a-z]+/ then process_argument(arg)\n else\n check_and_set_argument(@unflagged_arguments.shift, arg)\n end\n nil\n end", "def PRF03=(arg)", "def PO103=(arg)", "def PRF01=(arg)", "def parameterize(value); end", "def PO112=(arg)", "def PO110=(arg)", "def PO104=(arg)", "def add_argument(*args, &block)\n ArgParse.add_option(*args, &block)\n end", "def PO109=(arg)", "def parse_string_argument(key)\n if @opts[key].nil? and s=@argv.shift\n @opts[key] = s.dup \n end\n end", "def argument(name, options = {})\n call_arguments[name] = options\n attr_accessor name\n end", "def SAC05=(arg)", "def arg; end", "def rl_digit_argument(ignore, key)\r\n _rl_arg_init()\r\n if (rl_isstate(RL_STATE_CALLBACK))\r\n _rl_arg_dispatch(@_rl_argcxt, key)\r\n rl_message(\"(arg: #{@rl_arg_sign * @rl_numeric_arg}) \")\r\n return 0\r\n else\r\n rl_execute_next(key)\r\n return (rl_digit_loop())\r\n end\r\n end", "def title(val)\n args_def.title = val\n end", "def PO111=(arg)", "def PO115=(arg)", "def test_function(arg = 'hello')\n puts arg + ' world'\nend", "def arg(arg)\n self[arg]\n end", "def SAC03=(arg)", "def SAC12=(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 argument(name, args)\n @arguments ||= Launchr::OrderedHash.new\n @options_arguments ||= Launchr::OrderedHash.new\n raise(ArgumentError, \"Argument name must be a symbol\") unless name.kind_of?(Symbol)\n\n strip_arg(args,:short)\n strip_arg(args,:long)\n convert_argument_to_option(args)\n\n @arguments[name.to_sym] = args.dup\n @options_arguments[name.to_sym] = args\n end", "def method_missing(name, *_args)\n fail \"Unknown option #{name.to_s.gsub!('=', '')}\"\n end", "def PO101=(arg)", "def SAC02=(arg)", "def param(name, value, takes_arg, description)\n Task::Param.new(name, value, takes_arg, description)\n end", "def PO114=(arg)", "def command_arg(key, desc, opts = {}, &block)\n opts.merge!(@arg_opts){ |k, e, n| e || n } if @arg_opts\n @arg_opts = nil\n args_def.command_arg(key, desc, opts, &block)\n end", "def cli_path=(_arg0); end", "def argument_value(argument_name, value)\n a = @arguments.find_all { |a| a[:name] == argument_name }\n raise \"could not find argument_name of #{argument_name} in measure #{name}. Valid argument names are #{argument_names}.\" if a.empty?\n raise \"more than one argument with the same name of #{argument_name} in measure #{name}\" if a.size > 1\n\n a = a.first\n\n a[:value] = value\n\n a[:value] == value\n end", "def set(args, auto_compute=true)\n initialize_text(args[:value]) if args && args[:value]\n super(args, auto_compute)\n end", "def PO108=(arg)", "def set_arg(arg)\n @arg=arg\n return self\n end", "def set_arg(arg)\n @arg=arg\n return self\n end", "def SAC01=(arg)", "def initialize(value = nil)\n @value = value\n end", "def PRF04=(arg)", "def SE02=(arg)", "def arg(name, *args)\n Rake.application.DescribeArgument(name, *args)\n end", "def argument(args)\n args.first\n end", "def PO107=(arg)", "def SE01=(arg)", "def set_value value, name=nil\n @value = value\n return unless @commands\n @commands.each_with_index do |comm, ix|\n comm.call(self, *@args[ix]) unless comm.nil?\n end\n end", "def argue(argument)\n return argument\nend", "def pass(key, value)\n @out_args[key] = value\n end", "def version=(arg)\n @version = arg.to_s\n end", "def parse_value val\n case\n when val == nil then true # --flag option on its own means 'set that option'\n when val == '' then nil # --flag='' the explicit empty string means nil\n else val # else just return the value\n end\n end", "def SAC07=(arg)", "def param(val)\n Build.param(val)\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 argue(argument)\n return \"#{argument}\"\nend", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n end", "def update!(**args)\n @value = args[:value] if args.key?(:value)\n end" ]
[ "0.71850204", "0.67392343", "0.6381029", "0.6299818", "0.62333435", "0.6207733", "0.6207733", "0.6207733", "0.61628455", "0.61445284", "0.61251587", "0.59197974", "0.5889618", "0.5849626", "0.5841008", "0.58346695", "0.58346695", "0.58009326", "0.5742393", "0.57342243", "0.5717635", "0.57160705", "0.5691553", "0.5691553", "0.5691553", "0.56791306", "0.56785214", "0.5640713", "0.5639625", "0.56371415", "0.5634064", "0.56328857", "0.56324637", "0.56268466", "0.5624987", "0.56141764", "0.56073844", "0.5598829", "0.5596407", "0.5586533", "0.55831856", "0.55806684", "0.557731", "0.5575128", "0.5570415", "0.55608773", "0.55575275", "0.5553417", "0.5545642", "0.5543996", "0.553901", "0.5538915", "0.5529381", "0.55248564", "0.5524104", "0.552248", "0.5516435", "0.5513482", "0.5491812", "0.5482063", "0.54773223", "0.54756445", "0.5472674", "0.5471952", "0.54664516", "0.545795", "0.545795", "0.54555017", "0.5454074", "0.54533315", "0.5450952", "0.54409796", "0.5439634", "0.5429913", "0.542653", "0.5423154", "0.54143566", "0.54112434", "0.54089206", "0.5405458", "0.539591", "0.53874964", "0.53848195", "0.53848195", "0.53848195", "0.53848195", "0.53848195", "0.53848195", "0.53848195", "0.53848195", "0.5381444", "0.5376919", "0.5376919", "0.5376919", "0.5376919", "0.5376919", "0.5376919", "0.5376919", "0.5376919", "0.5376919" ]
0.6377714
3
This defines a command line argument that's either on or off based on the presense of the flag.
def flag(short_name, long_name, description, &block) return define_value(short_name, long_name, description, true, false, block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def switch_option(arg)\n if match = no_or_skip?(arg) # rubocop:disable AssignmentInCondition\n @switches[arg] || @switches[\"--#{match}\"]\n else\n @switches[arg]\n end\n end", "def test_stringflag_with_false_default\n @p.opt :log, \"desc\", :type => :stringflag, default: false\n opts = @p.parse []\n assert_nil opts[:log_given]\n assert_equal false, opts[:log]\n\n opts = @p.parse %w(--no-log)\n assert_equal true, opts[:log_given]\n assert_equal false, opts[:log]\n\n opts = @p.parse %w(--log)\n assert_equal true, opts[:log_given]\n assert_equal true, opts[:log]\n\n opts = @p.parse %w(--log other.log)\n assert_equal true, opts[:log_given]\n assert_equal \"other.log\", opts[:log]\n end", "def bool_on(word, description = \"\")\n Options[word.to_sym] = false\n on \"-#{word.chars.first}\", \"--[no]#{word}\", description do |o|\n Options[word.to_sym] == o\n end\n end", "def run_set_bool(args, default=true)\n set_val = args.size < 2 ? 'on' : args[1]\n setting = @name.gsub(/^(set|show)/,'')\n begin\n settings[setting.to_sym] = @proc.get_onoff(set_val)\n run_show_bool(string_in_show)\n rescue NameError, TypeError\n end\n end", "def flag _args\n \"flag _args;\" \n end", "def test_stringflag_as_flag\n @p.opt :xyz, \"desc\", :type => :stringflag\n @p.opt :abc, \"desc\", :type => :flag\n opts = @p.parse %w(--xyz )\n assert_equal true, opts[:xyz_given]\n assert_equal true, opts[:xyz]\n assert_equal false, opts[:abc]\n opts = @p.parse %w(--xyz --abc)\n assert_equal true, opts[:xyz_given]\n assert_equal true, opts[:xyz]\n assert_equal true, opts[:abc]\n end", "def dashed_flag_for setting_name, flag_name=nil\n return unless self[setting_name]\n flag_name ||= setting_name\n (self[setting_name] == true ? \"--#{flag_name.to_s.gsub(/_/,\"-\")}\" : \"--#{flag_name.to_s.gsub(/_/,\"-\")}=#{self[setting_name]}\" )\n end", "def test_stringflag_unset\n @p.opt :xyz, \"desc\", :type => :stringflag\n @p.opt :abc, \"desc\", :type => :flag\n opts = @p.parse %w()\n assert_equal false, opts[:xyz]\n assert_equal false, opts[:abc]\n opts = @p.parse %w(--abc)\n assert_equal false, opts[:xyz]\n assert_equal true, opts[:abc]\n end", "def dashed_flag_for setting_name, flag_name=nil\n return unless Settings[setting_name]\n flag_name ||= setting_name\n (Settings[setting_name] == true ? \"--#{flag_name.to_s.gsub(/_/,\"-\")}\" : \"--#{flag_name.to_s.gsub(/_/,\"-\")}=#{Settings[setting_name]}\" )\n end", "def test_stringflag_as_string\n @p.opt :xyz, \"desc\", :type => :stringflag\n @p.opt :abc, \"desc\", :type => :flag\n opts = @p.parse %w(--xyz abcd)\n assert_equal true, opts[:xyz_given]\n assert_equal \"abcd\", opts[:xyz]\n assert_equal false, opts[:abc]\n opts = @p.parse %w(--xyz abcd --abc)\n assert_equal true, opts[:xyz_given]\n assert_equal \"abcd\", opts[:xyz]\n assert_equal true, opts[:abc]\n end", "def process_argv!\n args = ARGV.dup\n self.rest = []\n until args.empty? do\n arg = args.shift\n case\n when arg == '--'\n self.rest += args\n break\n when arg =~ /\\A--([\\w\\-\\.]+)(?:=(.*))?\\z/\n param, val = [$1, $2]\n param.gsub!(/\\-/, '.') # translate --scoped-flag to --scoped.flag\n param = param.to_sym unless (param =~ /\\./) # symbolize non-scoped keys\n if val == nil then val = true # --flag option on its own means 'set that option'\n elsif val == '' then val = nil end # --flag='' the explicit empty string means nil\n self[param] = val\n when arg =~ /\\A-(\\w+)\\z/\n $1.each_char do |flag|\n param = param_with_flag(flag)\n self[param] = true if param\n end\n else\n self.rest << arg\n end\n end\n end", "def option(option)\n \"--\" << option.to_s.gsub('_', '-')\n end", "def update!(**args)\n @opt_in_enabled = args[:opt_in_enabled] if args.key?(:opt_in_enabled)\n end", "def flag_options\n return @flag_options unless @flag_options.nil?\n @flag_options = ''\n @flag_options << ' --auto-attach' if new_resource.auto_attach\n @flag_options << ' --force' if new_resource.force\n @flag_options << ' --insecure' if new_resource.insecure\n @flag_options\n end", "def args(options = {})\n \"-an\" if options[:audio].eql?(false)\n end", "def optional_pull\n if ARGV.include?(\"--pull\")\n puts %x(feature pull)\n end\nend", "def enable=(arg)\n # We implement our own setter to handle values being passed in as strings\n # rather than booleans\n parsed = arg.to_s.downcase\n\n @enable = parsed == \"true\"\n end", "def parse(flag, value=nil, argv=[], config={})\n unless value.nil?\n if flag == short\n argv.unshift \"-#{value}\"\n else\n raise \"value specified for #{flag}: #{value.inspect}\"\n end\n end\n\n value = (default.nil? ? true : !default)\n assign(config, process(value))\n end", "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 get_cli_attrib(attrib, fail_if_undefined=false, bool=false)\n if ENV.include?(attrib)\n if bool\n return (ENV[attrib] ==0 || ENV[attrib] == \"true\" ? true : false)\n else\n return ENV[attrib]\n end\n elsif fail_if_undefined\n exit_with_error(\"Command line attribute not found #{attrib} !\", ENV) if fail_if_undefined\n else\n return nil\n end\n end", "def process_base_argument(arg)\n case arg\n when *@mapping[:help] then check_and_set_helpvalue\n when *@mapping[:version] then @parameters[:version] = true\n when *@mapping[:file] then create_argument_entry(:file) \n when /-[a-z]|--[a-z]+/ then process_argument(arg)\n else\n check_and_set_argument(@unflagged_arguments.shift, arg)\n end\n nil\n end", "def flag(*names)\n names = [names].flatten\n verify_unused(names,flags,switches,\"in global options\")\n flag = Flag.new(names,@@next_desc,@@next_arg_name,@@next_default_value,@@next_long_desc)\n flags[flag.name] = flag\n clear_nexts\n end", "def boolean(arg)\n case arg\n when 'true'\n 1\n when 'false'\n 0\n when nil\n 0\n end\n end", "def parse_options\n case ARGV[1]\n when \"-p\", \"-plugin\"\n return true\n when \"-u\", \"-unplug\"\n return true\n else\n return false\n end\nend", "def make_flag(options)\n\tflagString=\" \"\n\tif(options.list != nil)\n\t\tflagString+=\" -l\"\n\tend\n\tif(options.all != nil)\n\t\tflagString+= \" -a\"\n\tend\n\treturn flagString\nend", "def option(flag, text, scope=nil)\n Runner.instance.add_option flag, text, scope\n end", "def generate_cli_flags\n @flags.map{|pair| pair.join(' ')}.join(' ').gsub(' true','')\n end", "def flag_option_sql(attrs, key, off=\"NO#{key}\".upcase, on=key.to_s.upcase, implicit=IMPLICIT_FLAG_ATTRIBUTES[key])\n\t case attrs[key]\n\t when NilClass, implicit\n\t when TrueClass then on\n\t when FalseClass then off\n\t else raise Error, \"Unsupported or invalid #{key} option\"\n\t end\n\t end", "def update!(**args)\n @opt_in = args[:opt_in] if args.key?(:opt_in)\n end", "def parse\n # parse flag arguments\n @oparse.parse!(@argv) rescue(bail_args($!))\n @parsed=true\n\n # the overriding class may implement additional arguments from here\n end", "def method(*args)\n args, options = Options.parse(args)\n\n force = options.getopt(:force, default=false)\n p force\n end", "def enforce_flags_before_args(state = true)\n check_definition_state\n if argument_parsing_disabled?\n raise ToolDefinitionError,\n \"Cannot enforce flags before args for tool #{display_name.inspect}\" \\\n \" because parsing is disabled.\"\n end\n @enforce_flags_before_args = state\n self\n end", "def flag(name,aliases,desc,long_desc,default_value,arg_name,must_match,type)\n abstract!\n end", "def shopt_set pref\n shopt_common pref, \"-s\"\n end", "def test_add_option02d\n assert_raise( RuntimeError ) { \n ArgumentManager.add_option(\n [ 'f' ],\n :bind => 'boolean opt'\n )\n }\n end", "def setFlag(flg)\r\n if (flg.class == Array)\r\n flg.each do |f|\r\n case f\r\n when '-v'\r\n @verbose = true\r\n end\r\n end # flg.each\r\n\r\n return\r\n end # if flg\r\n\r\n case flg\r\n when '-v'\r\n @verbose = true\r\n end\r\n\r\n end", "def short_for_optparse\n (arg and long.nil?) ? (\"%s %s\" % [short, arg]) : short\n end", "def optparse_args\n if short\n [\"--#{name}\", \"-#{short}\", desc, :REQUIRED]\n else\n [\"--#{name}\", desc, :REQUIRED]\n end\n end", "def switch_flag\n\t\t@flag = !@flag\n\tend", "def early_option?(args)\n if @options[:version]\n puts(\"boson #{Boson::VERSION}\")\n true\n elsif args.empty? || (@command.nil? && !@options[:execute])\n print_usage\n true\n else\n false\n end\n end", "def parse_value val\n case\n when val == nil then true # --flag option on its own means 'set that option'\n when val == '' then nil # --flag='' the explicit empty string means nil\n else val # else just return the value\n end\n end", "def accepts_optional_argument?\n config[:optional_argument] || config[:argument] == :optional\n end", "def flag(*names)\n names = [names].flatten\n GLI.verify_unused(names,flags,switches,\"in command #{name}\")\n flag = Flag.new(names,@next_desc,@next_arg_name,@next_default_value,@next_long_desc)\n flags[flag.name] = flag\n clear_nexts\n end", "def initialize(options={})\n super\n raise ArgumentError, \"arg_name specified for switch: #{arg_name}\" if arg_name\n raise ArgumentError, \"no long specified\" unless long\n @negative_long = Utils.prefix_long(long, 'no-')\n end", "def flags_before_args_enforced?\n @enforce_flags_before_args\n end", "def flag(attribute, flag)\n value = send attribute\n \"-#{flag}#{value}\" if value.present?\n end", "def set_mode\n $Counting_Mode = getopts(\"c\")\n $Training_Mode = getopts(\"t\")\n empty_argv\n set_counting_recommendation_strings if $Counting_Mode\n end", "def create_option(flag, argument = nil)\n return '' unless flag\n flag = flag.to_s\n return \" #{argument}\" if flag == 'extra'\n set_pandoc_ruby_options(flag, argument)\n if !argument.nil?\n \"#{format_flag(flag)} #{argument}\"\n else\n format_flag(flag)\n end\n end", "def convert_opt_in_to_true_false (opt_in_value_num)\n if opt_in_value_num == 0\n opt_in_boolean = false\n elsif opt_in_value_num == 1\n opt_in_boolean = true\n end\n end", "def convert_opt_in_to_true_false (opt_in_value_num)\n if opt_in_value_num == 0\n opt_in_boolean = false\n elsif opt_in_value_num == 1\n opt_in_boolean = true\n end\n end", "def param_with_flag flag\n params_with(:flag).each do |param|\n return param if param_definitions[param][:flag].to_s == flag.to_s\n end\n raise Configliere::Error.new(\"Unknown option: -#{flag}\") if complain_about_bad_flags?\n end", "def usage_mode(arg = nil)\n set_or_return(\n :usage_mode,\n arg,\n kind_of: String,\n equal_to: %w[exclusive normal],\n )\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 parse_flags(obj, opt, args)\n x = opt.sub(/^-/, '')\n #c = 0\n x.split(//).each do |k|\n #if obj.respond_to?(\"#{k}=\")\n obj.send(\"#{k}=\", true)\n #else\n # obj.option_missing(x, true)\n #end\n end\n end", "def process_argv!\n args = ARGV.dup\n self.rest = []\n @unknown_argvs = []\n until args.empty? do\n arg = args.shift\n case\n # end of options parsing\n when arg == '--'\n self.rest += args\n break\n # --param=val or --param\n when arg =~ /\\A--([\\w\\-\\.]+)(?:=(.*))?\\z/\n param, val = [$1, $2]\n warn \"Configliere uses _underscores not dashes for params\" if param.include?('-')\n @unknown_argvs << param.to_sym if (not has_definition?(param))\n self[param] = parse_value(val)\n # -abc\n when arg =~ /\\A-(\\w\\w+)\\z/\n $1.each_char do |flag|\n param = find_param_for_flag(flag)\n unless param then @unknown_argvs << flag ; next ; end\n self[param] = true\n end\n # -a val\n when arg =~ /\\A-(\\w)\\z/\n flag = find_param_for_flag($1)\n unless flag then @unknown_argvs << flag ; next ; end\n if (not args.empty?) && (args.first !~ /\\A-/)\n val = args.shift\n else\n val = nil\n end\n self[flag] = parse_value(val)\n # -a=val\n when arg =~ /\\A-(\\w)=(.*)\\z/\n flag, val = [find_param_for_flag($1), $2]\n unless flag then @unknown_argvs << flag ; next ; end\n self[flag] = parse_value(val)\n else\n self.rest << arg\n end\n end\n @unknown_argvs.uniq!\n end", "def option?(param)\n param[0] == \"-\"\n end", "def default_argument(argname)\n if (arg = find_argument(argname)) && arg.has_default?\n [true, arg.default]\n end\n end", "def method_missing(m)\n\n case m\n when :createproj\n @args[:projectdir] = @options[m]\n @args[m] = true\n \n when :quickpkg\n # raise BoilerMakerErr.new(\"Option -Q: This option is unimplemented.\") \n @args[m] = @options[:quickpkg]\n \n when :projectdir\n unless @options[:createproj] or @options[:tconvert] or @options[:fetch] or @options[:package] or @options[:boil] or @options[:rollup]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -C, -t, -f or -p\") \n end\n @args[m] = File.expand_path(@options[m])\n unless @options[:createproj]\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n end\n \n when :ktcheck\n if @options[:createproj] or @options[:projectdir] or @options[:tconvert] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -c, -h or -w\") \n end\n raise BoilerMakerErr.new(\"Option --#{m}: Use the -h to specify a Radmind server host\") unless @options[:radhost]\n @args[m] = @options[m]\n \n when :tconvert\n @args[m] = File.expand_path(@options[m])\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n \n when :fetch\n raise BoilerMakerErr.new(\"Option --#{m}: Use the -h to specify a Radmind server host\") unless @options[:radhost]\n @args[m] = File.expand_path(@options[m])\n raise BoilerMakerErr.new(\"No such file or dir: #{@args[m]}\") unless File.exists?(@args[m])\n \n when :radhost\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\") \n end\n @args[m] = @options[m]\n\n when :boil\n @args[m] = @options[m]\n \n when :package\n @args[m] = @options[m]\n\n when :rollup\n @args[m] = @options[m]\n \n when :secure\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\")\n end\n @args[m] = @options[m]\n\n when :cksum\n unless @options[:ktcheck] or @options[:fetch]\n raise BoilerMakerErr.new(\"Option --#{m}: This flag is only useful when combined with: -K or -f\")\n end\n @args[m] = @options[m]\n \n end\n \n end", "def get_flag_name(flag)\n if flag.start_with?(\"--no-\")\n flag[5..-1]\n elsif flag.start_with?(\"--\")\n flag[2..-1]\n else\n raise \"Assertion error: we're here by mistake\"\n end\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 process_option( opt, arg)\n case opt\n when '--ec2-user-id': @ec2_user_id = arg\n when '--aws-access-key-id': @aws_access_key_id = arg\n when '--aws-secret-access-key': @aws_secret_access_key = arg\n when '--snapshot': @do_snapshot = true\n when '--restore-most-recent': @do_restore = true\n when '--host-role': @host_role = arg\n when '--volume-size': @volume_size = arg\n when '--tell': @do_tell = true\n when '--debug': @do_debug = true\n end\n end", "def method(*args)\n args, options = Options.parse(args)\n options.validate(:force)\n\n force = options.getopt(:force, default=false)\n p force\n end", "def parse_option(obj, opt, argv)\n x = opt.sub(/^--/, '')\n #if obj.respond_to?(\"#{x}=\")\n obj.send(\"#{x}=\", true)\n #else\n # obj.option_missing(x, true)\n #end\n end", "def on!(*args, &block)\n register new_option(args, &block), 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 double_opt_in_status_user_setting\n 'double_opt_in_status'\n end", "def proc_arg(opt)\n case opt\n when '-h'\n :hash\n when '-m'\n :merge\n when '-n'\n :nested\n else\n nil\n end\nend", "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 lacp(arg = nil)\n set_or_return(\n :lacp,\n arg,\n kind_of: String,\n equal_to: %w[disable active passive]\n )\n end", "def parse_switch(arg)\n argument = arg[1..-1].downcase\n\n # Version\n if argument =~ /^(v|-version)$/\n print_version\n end\n\n # Argument output_dir\n if argument.eql?(\"m\")\n @merge = true\n @edit_in_place=false unless @mset==true\n @mset=true\n end\n\n # In place\n if argument.eql?(\"i\")\n @edit_in_place=true\n @merge=false unless @mset==true\n end\n\n # Argument threshold\n if argument.eql?(\"t\")\n if @expecting_threshold==false\n @expecting_threshold=true\n else\n puts \"Argument threshold expected after -t switch\\n\"\n print_help\n end\n end\n\n # Arguments -H, -h, --help, -help...\n if argument =~ /^-*h+(elp)*$/i\n print_help\n end\n\n end", "def get_option(option_name)\n\t\toption = nil\n\t\t# Could use ternary conditional expressions here (bool ? true_value : false_value) but chose not to for readability\n\t\tif use_short_option?(option_name)\n\t\t\tdebug_log \"Short version has been flagged for option: #{option}\"\n\t\t\tcase option_name\n\t\t\twhen 'badge'\n\t\t\t\toption = \"-b\"\n\t\t\telse\n\t\t\t\traise \"Option not supported: #{option_name}\"\n\t\t\tend\n\t\telse\n\t\t\tdebug_log \"Short version not flagged for option: #{option}. Using long version.\"\n\t\t\tcase option_name\n\t\t\twhen 'badge'\n\t\t\t\toption = \"--badge\"\n\t\t\telse\n\t\t\t\traise \"Option not supported: #{option_name}\"\n\t\t\tend\n\t\tend\n\n\t\treturn option\n\n\tend", "def parse(flag, value=nil, argv=[], config={})\n raise \"value specified for #{flag}: #{value.inspect}\" if value\n\n value = (flag == negative_long ? !default : default)\n assign(config, process(value))\n end", "def init\n # Validate and parse the flags\n OptionParser.new do |o|\n o.on('-a ALIAS', '--alias ALIAS') { |a| $alias = a }\n o.on('-r RECIEVER', '--reciever RECIEVER') { |e| $email = e }\n o.on('-h', '--help') { usage }\n o.parse!\n end\nend", "def one_word_command\n switch = cmd.switch ? cmd.switch.downcase : nil\n switch == \"pass\" || switch == \"reload\" || switch == \"evade\"\n end", "def argument_optional?\n !short.to_s.match(SHORT_ARGUMENT_OPTIONAL_RE).nil? ||\n !long.to_s.match(LONG_ARGUMENT_OPTIONAL_RE).nil?\n end", "def flag_arg(key, desc, opts = {}, &block)\n opts.merge!(@arg_opts){ |k, e, n| e || n } if @arg_opts\n @arg_opts = nil\n args_def.flag_arg(key, desc, opts, &block)\n end", "def apply_command_line_switch_overrides(options)\n present_switches = environment.options.present_switches\n registered_task_options.each do |option|\n # present_switches is a list of all valid switches that have been supplied by the user.\n if option.switch && present_switches.include?(option.switch)\n options.update(option.key, !option.default, add_missing: false)\n end\n end\n end", "def read_argv_flags argsIn\r\n skipVal = argsIn.length + 1\r\n argsIn.each_with_index do |argIn, ind|\r\n next if skipVal == ind\r\n arg = argIn.downcase()\r\n if arg[0].eql? '-'\r\n symAgr = strip_to_sym(arg)\r\n if @options[symAgr].is_a? String\r\n @options[symAgr] = argsIn[ind + 1]\r\n skipVal = ind + 1\r\n elsif @options[symAgr] == false\r\n @options[symAgr] = true\r\n elsif @options[symAgr].is_a? Array\r\n @options[symAgr] = argsIn[ind + 1]\r\n end\r\n elsif known_file_type arg\r\n @options[:f] << argIn.gsub(/(\\.\\/)|(\\.\\\\)/,'')\r\n end\r\n puts argIn\r\n end\r\n end", "def flag_as(flag)\n raise ArgumentError if flag.class != String\n @flag = flag\n end", "def set_pandoc_ruby_options(flag, argument = nil)\n case flag\n when 't', 'to'\n @writer = argument.to_s\n @binary_output = true if BINARY_WRITERS.keys.include?(@writer)\n end\n end", "def unshift_split_options argv, initial_boolean_option, remaining_str\n if boolean_option? initial_boolean_option.to_sym\n # boolean option, so put remaining on as option(s)\n argv.unshift \"-\" + remaining_str\n else\n # not a boolean option, so put remaining on as an arg\n argv.unshift remaining_str\n end\n\n # recurse to handle option through regular code paths\n argv.unshift \"-\" + initial_boolean_option\n end", "def require_exact_flag_match(state = true)\n check_definition_state\n if argument_parsing_disabled?\n raise ToolDefinitionError,\n \"Cannot require exact flag match for tool\" \\\n \" #{display_name.inspect} because parsing is disabled.\"\n end\n @require_exact_flag_match = state\n self\n end", "def allowed_on_commandline?\n @deprecated == :allowed_on_commandline\n end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end", "def options=(_arg0); end" ]
[ "0.666847", "0.6568296", "0.65617126", "0.6463394", "0.64377344", "0.6414854", "0.6394696", "0.6347101", "0.6332239", "0.6208723", "0.61391586", "0.61237323", "0.6078607", "0.6063073", "0.59903824", "0.594665", "0.5921182", "0.59109354", "0.5905872", "0.5879348", "0.5854362", "0.5836085", "0.58247846", "0.58183277", "0.58120185", "0.58083814", "0.57802397", "0.5773649", "0.57575774", "0.5748314", "0.5735366", "0.57116437", "0.56914866", "0.5690897", "0.5689352", "0.5680345", "0.566433", "0.5662359", "0.5654758", "0.5653219", "0.56522673", "0.56381464", "0.56350946", "0.5611723", "0.56005424", "0.55888075", "0.5571136", "0.55707884", "0.5548731", "0.5548731", "0.55222094", "0.55203074", "0.5514301", "0.5514301", "0.5514301", "0.5514301", "0.5514301", "0.5514301", "0.5510721", "0.55077296", "0.5501031", "0.548574", "0.54730177", "0.5456851", "0.5454143", "0.54518074", "0.5448752", "0.5443796", "0.5441086", "0.54354113", "0.5434436", "0.54232675", "0.54229176", "0.5417334", "0.5414237", "0.5412544", "0.54056245", "0.54051113", "0.5395757", "0.5387867", "0.53878146", "0.5386785", "0.53797066", "0.53687024", "0.5367208", "0.536204", "0.5358518", "0.5355114", "0.53483427", "0.53483427", "0.53483427", "0.53483427", "0.53483427", "0.53483427", "0.53483427", "0.53483427", "0.53483427", "0.53483427", "0.53483427", "0.53483427", "0.53483427" ]
0.0
-1
This produces a gap in the output of the help display but does not otherwise affect the argument parsing.
def gap(count = 1) 1.upto(count) { @order.push(nil) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_help\n\t\t\t\t# Print app name\n\t\t\t\tif @app_name then\n\t\t\t\t\tprint \"#{@app_name}\"\n\t\t\t\t\tprint \" #{@app_version}\" if @app_version > 0\n\t\t\t\t\tprint \" - #{@description}\" if @description\n\t\t\t\t\tprint \"\\n\"\n\t\t\t\tend\n\n\t\t\t\t# Print usage\n\t\t\t\tprint \"#{@messages[\"pre_usage\"]}\\n\" if @messages[\"pre_usage\"]\n\t\t\t\tprint \"#{@usage ? @usage : \"Usage: #{ARGV[0]} [OPTIONS]\"}\\n\"\n\n\t\t\t\t# Print pre_options\n\t\t\t\tprint \"#{@messages[\"pre_options\"]}\\n\" if @messages[\"pre_options\"]\n\t\t\t\tprint \"\\nValid options are:\\n\"\n\n\t\t\t\t# Order options for printing\n\t\t\t\t@sorted_opts = @inserted[:name].sort do |first, second|\n\t\t\t\t\t@options[first][:priority] != @options[second][:priority] ? @options[first][:priority] <=> @options[second][:priority] : @inserted[:name].index(first) <=> @inserted[:name].index(second)\n\t\t\t\tend\n\n\t\t\t\t# Add options, saving max length\n\t\t\t\tpopts = {}\n\t\t\t\tmaxlen = -1\n\t\t\t\t@sorted_opts.each do |key|\n\t\t\t\t\topt = @options[key]\n\n\t\t\t\t\tpopt = \"#{[opt[:short], opt[:long]].join(\", \")}\"\n\t\t\t\t\tpopt += (\"=\" + (opt[:meta] ? opt[:meta] : \"ARG\")) if ![:bool, :action].include?(opt[:type])\n\t\t\t\t\tpopts[key] = popt\n\t\t\t\t\tmaxlen = popt.length if popt.length > maxlen\n\t\t\t\tend\n\n\t\t\t\t# Print options\n\t\t\t\t@sorted_opts.each do |key|\n\t\t\t\t\tval = popts[key]\n\t\t\t\t\tprint \"\\t#{val}#{\" \" * (5 + (maxlen - val.length))}#{@options[key][:help]}\\n\"\n\t\t\t\tend\n\n\t\t\t\t# Print post_options\n\t\t\t\tprint \"#{@messages[\"post_options\"]}\\n\" if @messages[\"post_options\"]\n\t\t\tend", "def show_help\n abort option_parser.to_s\n end", "def strip_help_param!\n @help_given = ARGV.delete('--help')\n end", "def dump_help extra_msg=nil\n $stderr.puts help\n $stderr.puts \"\\n\\n\"+extra_msg unless extra_msg.blank?\n $stderr.puts ''\n end", "def extended_help\n\t\t\t{\n\t\t\t\t\"fun_fake_cmd\" => \"This is a fake command. It's got its own special docs.\" +\n\t\t\t\t\t (\" \" * longest_cmd_size) + \"It might be long so so deal with formatting somehow.\"\n\t\t\t}\n\t\tend", "def show_help\n display banner\n display \"\"\n display short_help\n display \"\"\n end", "def help_help\t# :nodoc:\n\t\t\"#{@program_name} -cmd help\\n\\tShow this message\\n\"\n\tend", "def cmd_help argv\n help\n end", "def cmd_help argv\n help\n end", "def user_help\n puts \"\"\n puts \"-l and --list\"\n puts \"Write either 'moodbooster -l' or 'moodbooster --list' in the command line to view your week's moods\"\nend", "def help(show_usage = true)\n help = ''\n\n if show_usage\n help << \" #{name}\" if name != :__default\n\n @params.values.uniq.sort_by {|a| a.name.to_s }.each do |param|\n help << ' ['\n ([param.name] + param.aliases).each_with_index do |name, index|\n name = name.to_s\n help << '|' if index > 0\n help << '-' if name.size > 1\n help << \"-#{name}\"\n end\n help << ' ...' if param.is_a?(Option)\n help << ']'\n end\n end\n\n help << \"\\n\\n#{description}\" unless description.nil?\n\n help_flags = {}\n help_options = {}\n params.each_value do |param|\n if param.is_a? Flag\n help_flags[param.name.to_s] = param\n else\n help_options[param.name.to_s] = param\n end\n end\n\n param_name = lambda { |name| \"#{name.size > 1 ? '-' : ' '}-#{name}\" }\n unless help_flags.empty? && help_options.empty?\n max_param_length = (help_flags.keys + help_options.keys).\n max_by { |a| a.size }.size + 2\n end\n\n unless help_flags.empty?\n help << \"\\n\\nFlags:\"\n help_flags.sort_by { |name, param| name }.each do |name, param|\n help << \"\\n #{param_name.call(name).ljust(max_param_length)}\"\n help << \" #{param.description}\" unless param.description.nil?\n end\n end\n\n unless help_options.empty?\n help << \"\\n\\nOptions:\\n\"\n help_options.sort_by { |name, param| name }.each do |name, param|\n help << \" #{param_name.call(name).ljust(max_param_length)} ...\"\n help << \" #{param.description}\" unless param.description.nil?\n help << \"\\n\"\n end\n end\n\n help\n end", "def print_options(format)\n help = execute(\"python #{@@executables[format]} --help\")\n # non-hyphenated long options to symbols\n help.gsub!(/(\\-\\-)([A-Za-z0-9]+)([=|\\s])/, ':\\2\\3')\n # hyphenated long options to quoted strings\n help.gsub!(/(\\-\\-)([\\w|\\-]+)(\\n)?[^$|^=|\\]]?/, '\\'\\2\\'\\3')\n # equal to hashrocket\n help.gsub!(/\\=/, ' => ')\n # hort options to symbols\n help.gsub!(/([^\\w])\\-(\\w)([^\\w])/, '\\1:\\2\\1')\n # short options with args get a hashrocket\n help.gsub!(/(:\\w) </, '\\1 => <')\n puts help\n end", "def show_help(opts)\n puts opts\n exit 0\nend", "def show_help(opts)\n puts opts\n exit 0\nend", "def long_help\n execute_string(\"-longhelp\")\n end", "def help\n puts @option_parser\n exit\n end", "def help\n puts \"For multi-word arguments, use 'single quotes' only.\"\n puts \"To create an event: \\t\\t\\t\\tCREATE EVENT event_name.\"\n puts \"To add a speaker to the most recent event: \\tCREATE SPEAKER speaker_name.\"\n puts \"To add a speaker to a different event: \\t\\tCREATE SPEAKER event_name speaker_name.\"\n puts \"To add a talk to an event: \\t\\t\\tCREATE TALK event_name talk_name talk_start_time talk_end_time speaker_name.\\n\\n\"\nend", "def example_arg\n s = self.arg_short ? \"#{self.arg_short},\" : nil\n l = self.arg_format ? \"#{self.arg_long} #{self.arg_format}\" : \"#{self.arg_long}\"\n # \" %-3s %s \" % [s, l]\n \"%-3s %s\" % [s, l]\n end", "def help\n prettify(description)\n end", "def help(additional_info=nil)\n \n set_colors\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (\"\\e[2A\" + @c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift \"\\e[H\\e[2J\"\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n \n array += @@commands.keys.collect do |key|\n default = (@@default_method and key == @@default_method.keys[0]) ? @color_bold : \"\"\n \n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default + key.to_s + @c_reset}\"+\n \" #{default + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" unless default == \"\"}#{@c_reset}\" \n end\n array << nil\n end", "def help(additional_info=nil)\n \n set_colors\n set_screen_clear\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (@c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift @s_clear_screen_code\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n\n array += @@commands.keys.collect do |key|\n is_default = (@@default_method and key == @@default_method.keys[0])\n default_color = is_default ? @c_bold : \"\"\n\n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default_color + key.to_s + @c_reset}\"+\n \" #{default_color + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default_color + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" if is_default}#{@c_reset}\" \n end\n array << nil\n end", "def command_help\n display_possible_actions\n end", "def help_info\n \"\"\n end", "def help\r\n end", "def help\r\n end", "def dump_help_if_requested\n return unless self[:help]\n dump_help\n exit\n end", "def display_help\n print(\n \"\n\nruby fuzzer.rb [discover | test] url OPTIONS\n\nCOMMANDS:\n discover Output a comprehensive, human-readable list of all discovered inputs to the system. Techniques include both crawling and guessing.\n test Discover all inputs, then attempt a list of exploit vectors on those inputs. Report potential vulnerabilities.\n\nOPTIONS:\n --custom-auth=string Signal that the fuzzer should use hard-coded authentication for a specific application (e.g. dvwa). Optional.\n\n Discover options:\n --common-words=file Newline-delimited file of common words to be used in page guessing and input guessing. Required.\n\n Test options:\n --vectors=file Newline-delimited file of common exploits to vulnerabilities. Required.\n --sensitive=file Newline-delimited file data that should never be leaked. It's assumed that this data is in the application's database (e.g. test data), but is not reported in any response. Required.\n --slow=1 Number of seconds considered when a response is considered \\\"slow\\\". Default is 1 second\n\nExamples:\n # Discover inputs\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n # Discover inputs to DVWA using our hard-coded authentication\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n \")\n exit\nend", "def short_help\n execute_string(\"-help\")\n end", "def help; end", "def help; end", "def help; end", "def help\n end", "def need_help \n end", "def help; summarize(\"#{banner}\".sub(/\\n?\\z/, \"\\n\")) end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def show_help(*args)\n args_def.show_help(*args)\n end", "def help\n lines = []\n end", "def display_help\n print(\n \"\n\nruby fuzzer.rb [discover | test] url OPTIONS\n\nCOMMANDS:\n discover Output a comprehensive, human-readable list of all discovered inputs to the system. Techniques include both crawling and guessing.\n test Discover all inputs, then attempt a list of exploit vectors on those inputs. Report potential vulnerabilities.\n\nOPTIONS:\n --custom-auth=string Signal that the fuzzer should use hard-coded authentication for a specific application (e.g. dvwa). Optional.\n\n Discover options:\n --common-words=file Newline-delimited file of common words to be used in page guessing and input guessing. Required.\n\n Test options:\n --vectors=file Newline-delimited file of common exploits to vulnerabilities. Required.\n --sensitive=file Newline-delimited file data that should never be leaked. It's assumed that this data is in the application's database (e.g. test data), but is not reported in any response. Required.\n --random=[true|false] When off, try each input to each page systematically. When on, choose a random page, then a random input field and test all vectors. Default: false.\n --slow=500 Number of milliseconds considered when a response is considered \\\"slow\\\". Default is 500 milliseconds\n\nExamples:\n # Discover inputs\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n # Discover inputs to DVWA using our hard-coded authentication\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n # Discover and Test DVWA without randomness\n fuzz test http://localhost:8080 --custom-auth=dvwa --common-words=words.txt --vectors=vectors.txt --sensitive=creditcards.txt --random=false\\n\"\n )\n exit\nend", "def help\n puts 'add help'\n end", "def help()\n $stderr.puts \"Usage: ruby __.rb -x cross_match_output -r reference.fasta -o prefix_of_output [-m minscore -s max_substitution -g max_gap] [-c]\"\nend", "def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend", "def setup_help(opts)\n opts.separator ''\n opts.separator <<-USAGE\nUsage:\n travis repositories|repos|rep|r {options}\n travis status|stat|s {options}\n USAGE\n opts.separator ''\n opts.separator <<-FURTHER_HELP\nFurhter Help:\n travis {command} --help\n FURTHER_HELP\n\n yield(opts)\n end", "def help\n \"Valid Inputs:\\n\\tAdd Baller\\n\\t-a <name>\\n\" \\\n \"\\tUpdate Name\\n\" \\\n \"\\t-un <name>\\n\" \\\n \"\\tRemove Baller\\n\" \\\n \"\\t-r\\n\" \\\n \"\\tList all Ballers\\n\" \\\n \"\\t-l\\n\" \\\n \"\\tBall Request\\n\" \\\n \"\\t-b <location> <time>\\n\" \\\n \"\\tUpdate Ball Request\\n\" \\\n \"\\t-ub <location> <time>\\n\" \\\n \"\\tRemove Ball Request\\n\" \\\n \"\\t-rb\\n\" \\\n \"\\tList Ball Events\\n\" \\\n \"\\t-lb\\n\" \\\n \"\\tList confirmed Ballers\\n\" \\\n \"\\t-c\\n\"\nend", "def help(shell)\n shell.say \"Usage:\"\n shell.say \" #{banner}\\n\"\n shell.say\n class_options_help(shell)\n shell.say desc if desc\n end", "def useHelp\r\n\t\t@usedHelp += 1\r\n\t\treturn self\r\n\tend", "def docopt_usage \n doc = [\"\\nUsage:\"];\n @actions.each do |_name, action|\n doc << \" run #{action.usage}\" unless action.usage == false\n end\n basic_flags = @version ? \"(-h|--help|--version)\" : \"(-h|--help)\"\n if @superspace\n doc << \" run #{@superspace} #{basic_flags}\\n\"\n else\n doc << \" run #{basic_flags}\\n\"\n end\n doc\n end", "def cmd_help(*args)\n\t\tprint(shell.help_to_s)\n\tend", "def show_help\n system 'clear'\n puts HELP_COMMANDS\n end", "def usage_break(label)\n @arg_opts = {usage_break: label}\n end", "def create_banner\n option_separator\n option_separator 'Usage: main.rb <application>-<mode> [options]'\n end", "def show_help\n\tputs \"These are the following commands that this application accepts:\"\n\tputs \"\\t 'add' (child name) (toy name) - gives a child a new toy\"\n\tputs \"\\t 'remove' (toy name) (child name) - takes away the child's toy\"\n\tputs \"\\t 'ls' - lists all children and the toys they are receiving\"\n\tputs \"\\t 'ls' (child name) - lists all the toys that one child is receiving\"\n\tputs \"\\t 'delivered' (child name) - marks that the toys have been delivered to the child\"\n\tputs \"\\t 'help' - shows all of the available commands that this application accepts\"\n\n\nend", "def help #:nodoc:\n Writer.help( { :banner => @@banner, :header => @@header,\n :options => @@options, :footer => @@footer },\n output_to, exit_on_help? )\n end", "def docopt_options(width)\n @options['Options'] = {} unless @options['Options']\n @options['Options']['-h --help'] = 'Show this screen'\n @options['Options']['--version'] = 'Show version number' if @version\n\n doc = []\n @options.each do |scope, values|\n doc << \"#{scope}:\"\n values.each do |flag, text|\n helpline = \" #{text}\"\n wrapped = word_wrap helpline, width\n doc << \" #{flag}\\n#{wrapped}\\n\"\n end\n end\n doc\n end", "def short_help(preamble, command_spec)\n return \" #{preamble} #{command_spec[:usage]}\", command_spec[:description]\n end", "def show_help\n puts HELP_MESSAGE\n end", "def show_help\n puts HELP_MESSAGE\n end", "def print_help(cmd)\n offset = docs.keys.longest_string_length\n write \"#{cmd.ljust(offset)} -- #{docs[cmd]}\" + \n (has_shortcuts?(cmd) ? \" #{display_shortcuts(cmd)}\" : '')\n end", "def help_extended\n \"#{help_extended_preamble}\\n\" +\n \"\\n\" +\n 'The shell command used to launch the program is platform-specific. On ' +\n \"Windows, the 'start' command is used. On other platforms, the 'open' \" +\n \"command is used. (The 'open' command may not be available on your \" +\n \"system.)\\n\" +\n \"\\n\" +\n 'You may specify options to be passed to the program. For example, on ' +\n 'Mac OS X, your default program for HTML files may be Google Chrome, ' +\n 'but you can launch Firefox instead by typing ' +\n \"#{strong command_line + ' -a firefox'}. Likewise, on Windows your \" +\n 'default program for HTML files may be Internet Explorer, but you can ' +\n \"launch Opera instead by typing #{strong command_line + ' opera'}.\"\n end", "def help\n help_str = [ usage ]\n if respond_to?(:descriptions)\n help_str += [\"\\nParams\"]\n ordered_params_and_descs = descriptions.sort_by{|p,d| p.to_s }\n param_help_strings = ordered_params_and_descs.map do |param, desc|\n if flag = param_definitions[param][:flag]\n \" -%s, --%-21s %s\" % [flag.to_s.first, param.to_s + ':', desc]\n else\n \" --%-25s %s\" % [param.to_s + ':', desc]\n end\n end\n help_str += param_help_strings\n end\n help_str += [ \"\\nEnvironment Variables can be used to set:\", params_from_env_vars.map{|param, env| \" %-27s %s\"%[env.to_s+':', param]}.join(\"\\n\"), ] if respond_to?(:params_from_env_vars)\n help_str.join(\"\\n\")\n end", "def help\n parse_command_line(['--help'])\n end", "def help\n parse_command_line(['--help'])\n end", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Load a XML file\\n\", \n\t\tFile.basename(__FILE__), \"-xml\", \"[filename]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search\\n\", \n\t\tFile.basename(__FILE__), \"list\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for ip\\n\", \n\t\t\"\", \"\", \"--ip\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for name(first and/or last)\\n\", \n\t\t\"\", \"\", \"--name\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for email\\n\", \n\t\t\"\", \"\", \"--email\"\n\t\texit\n\tend\nend", "def help_text\n build_html do\n p <<-P1\n Not much needed here.\n P1\n end\n end", "def help_tip(text); \"\" end", "def dump_help str=nil\n warn help(str)+\"\\n\"\n end", "def help\n \n end", "def testCommandLineHelpShort\n executeSlave( [ '-h' ] )\n end", "def print_help()\n puts \"modtools/spawn-liquid height liquid x y z xOff yOff zOff\"\n puts \" height: height of the water/magma (1 to 7)\"\n puts \" liquid: either water or magma, spawns that liquid\"\n puts \" x y z: the location to spawn liquid at (replacing any preexisting liquid)\"\n puts \" xOff yOff zOff: optional convenience offsets, added to x,y,z\"\n puts \"square brackets are ignored (so [ 0 0 -1 ] would be treated as 0 0 -1)\"\n puts \"note - in other scripts, \\\\\\\\LOCATION or similar is usually equivalent to x y z\"\nend", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Load a XML file\\n\", \n\t\tFile.basename(__FILE__), \"-xml\", \"[filename]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search\\n\", \n\t\tFile.basename(__FILE__), \"list\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for ip\\n\", \n\t\t\"\", \"\", \"--ip\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for name(first and/or last)\\n\", \n\t\t\"\", \"\", \"--name\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for email\\n\", \n\t\t\"\", \"\", \"--email\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search before a date\\n\", \n\t\tFile.basename(__FILE__), \"before\", \"[date]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search after a date\\n\", \n\t\tFile.basename(__FILE__), \"after\", \"[date]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search for emails sent \"+\n\t\t\"on a day of the week\\n\",\n\t\tFile.basename(__FILE__), \"--day\", \"[day]\"\n\t\texit\n\tend\nend", "def help_text\n format_block = proc {|key, flag, doc, required, kind|\n sprintf(\" %-3s %-14s %-10s %s %s\", flag, key, kind, doc, required ? '(REQUIRED)' : '')\n }\n required, options = help_attributes.partition{ |a| a[3]}\n [\n self.doc,\n \"\\n\",\n self.usage ? [\"Usage: \" + self.usage, \"\\n\"] : [],\n required.size > 0 ? [\"Required args:\", required.map(&format_block), \"\\n\"] : [],\n options.size > 0 ? [\"Options:\", options.map(&format_block), \"\\n\"] : [],\n (self.examples && self.examples.size > 0) ? \"Examples:\\n\" + \" \" + [self.examples].flatten.join(\"\\n \") : [],\n ]\n end", "def print_help\n puts \"Usage:\n \\t./#{$PROGRAM_NAME} file.gpx [file2.gpx ...] -i|-m|--help\\n\n \\t\\t#{$PROGRAM_NAME}\\t - name of script\n \\t\\tfile.gpx file2.gpx\\t - one or more file names to fix\n \\t\\t-i\\t - fix files 'in place'\n \\t\\t-m\\t - merge to one gpx file, if tracks are continous (see -t switch) (default)\n \\t\\t-t NUM - treshhold for merge tolerance in meters (default 30 meters)\n \\t\\t--help\\t - print usage\"\n exit 1\n end", "def help(*args)\n if args.count == 0\n puts <<-HEREDOC\n\nmiddleman-pagegroups version #{Middleman::MiddlemanPageGroups::VERSION}\n\nThis gem adds functionality to Middleman and is not executable on its own,\nother than for generating the documentation sample project and sample partial\nfiles. Instead, you must add this gem to your Middleman project's `Gemfile` \nand then activate it in your `config.rb` file. \n\nHEREDOC\n end\n super\n end", "def get_help\n nil\n end", "def arguments_missing\n write 'Invalid arguments'\n do_help(current_command) if docs.include?(current_command)\n end", "def show_help\n puts 'usage: '\n puts 'a, -a :List all interfaces and their Addresses'\n puts 'l, -l :List all interface names'\n puts 'n, -n :List interface netmask settings'\n puts 'b, -b :List interface broadcast info....err'\n puts 'h, -h :Show this message'\n puts 'o, -o :Show operating system'\nend", "def full_help\n [\n usage, \n nil,\n 'Summary:',\n summary,\n nil,\n 'Description:',\n description,\n nil,\n 'Arguments:',\n arguments,\n ].join(\"\\n\")\n end", "def show_help?\n args_def.show_help?\n end", "def dump_help_and_exit!\n dump_help\n exit(1)\n end", "def cmd_cli_help argv\n setup argv\n msg run_cmd(\"help\")\n end", "def help\n command_object.display_usage(cli.command)\n exit\n end", "def print_usage(msg = \"\")\n puts msg if msg\n\n puts <<MSG\nAll options are required.\nUsage: $0\n --hadoop-path [Hadoop directory],\n --bwa-path [Directory to compiled bwa - default hdfs://bwa-tools/bwa.tgz]\n --hadoop-bam-path [Directory that contains hadoop-bam jar and associated jars OPTIONAL]\n --reference [HDFS directory that contains the reference genome with index]\n --read-pair-dir [Directory that contains read files]\n --hdfs-path [HDFS directory for outputs]\n\n\n --help [See this message]\nMSG\n exit(-1)\nend", "def show_options(options, name)\n cpt_espace = 30\n options.each do |x,y|\n if y[\"value\"].size > cpt_espace\n cpt_espace = y[\"value\"].size + 7\n end\n end\n\n puts \"\\nOptions for module #{name}:\\n\"\n puts \"#{\"name\".ljust(15)}#{\"Current setting\".ljust(cpt_espace)}#{\"Required\".ljust(15)}#{\"Description\"}\"\n puts \"#{\"-----------\".ljust(15)}#{\"------------------\".ljust(cpt_espace)}#{\"-----------\".ljust(15)}#{\"--------------\"}\\n\\n\"\n\n options.each do |x,y|\n puts \"#{x.ljust(15)}#{y[\"value\"].ljust(cpt_espace)}#{y[\"required\"].ljust(15)}#{y[\"desc\"]}\" \n end\n puts \"\\n\\n\"\nend", "def add_help_option\n if @config[:help] && !(has_option?(:help) || has_option?(:h))\n h = self # bind self so that it can be called in the block\n self.option(:h, :help, \"Display this help message\", :tail => true) do\n puts h.help\n exit 0\n end\n end\n end", "def action\n puts \"\\nHelp menu\"\n puts '=' * 'Help menu'.length + \"\\n\\n\"\n puts \" Command \\t Description\"\n puts \" \" + '-' * 'Command'.length + \" \\t \" + '-' * 'Description'.length\n commands.map {|cmd , desc| puts \" #{cmd} \\t #{desc}\"}\n puts \"\\n\\n\"\n end", "def help_msg(basic_help_msg=true)\n init_basic_help_msg if !!basic_help_msg\n unless ::ARGV.options.select{ |e| __helper_flags__.include?(e) }.empty?\n\n tmp_ary= []\n __helper_msg_obj__.each do |ary|\n tmp_ary.push(ary[0])\n ary[1].each{|e| tmp_ary.push( ( e.to_s.length == 1 ? \"-#{e}\" : \"--#{e}\" ) )}\n tmp_ary.push('')\n end\n\n tmp_ary.each{ |element| element.include?('--') ? element.gsub!('--',\"\\t--\") : element.gsub!('-',\"\\t -\")}\n puts '',tmp_ary.join(\"\\n\"),''\n Process.exit!\n\n end\n return nil\n end", "def help(some, arg)\n say \"Bootic CLI v#{BooticCli::VERSION}\\n\\n\", :bold\n super\n\n examples if respond_to?(:examples)\n end", "def help\n spacer = \" %-32s %s\"\n\n op.banner = \"USAGE:\\n realm <COMMAND> [--OPT1 --OPT2 ...]\"\n\n op.separator \" \"\n op.separator \"COMMANDS:\"\n op.separator spacer % [\"list \", \"List available libraries.\"]\n op.separator spacer % [\"dump \", \"Dump serialized ledger.\"]\n op.separator spacer % [\"path \", \"Output bin PATH list.\"]\n op.separator spacer % [\"show <NAME> \", \"Show library details.\"]\n op.separator spacer % [\"where <FEATURE> \", \"Locate a library feature.\"]\n op.separator spacer % [\"add <DIR> \", \"Insert directory into current ledger.\"]\n op.separator spacer % [\"rm <DIR> \", \"Remove directory from current ledger.\"]\n op.separator spacer % [\"lock \", \"Cache load ledger.\"]\n op.separator spacer % [\"unlock \", \"Unlock load ledger.\"]\n op.separator spacer % [\"verify \", \"Verify library requirements are available.\"]\n op.separator spacer % [\"isolate \", \"Create an isolation list for a library.\"]\n #op.separator spacer % [\"gem \", \"Run gem command, then re-lock ledger.\"]\n\n op.separator \" \"\n op.separator \"GENERAL OPTIONS:\"\n\n puts op\n end", "def empty_action\n cli.argv << '-h'\n end", "def help\n\tusage\n\tputs \"This tool is oriented to separate web pages into segments called blocks, based on the structural and visual properties\"\nend", "def help\n\tputs <<-EOH\nUsage: #{$PROGRAM_NAME} <option> [name]\n options:\n\t-s\t--show\tshow instructions to install package specified by name\n\t-l\t--list\tlist available packages\n\t-h\t--help\tshow this help message and exit\n\tEOH\n\t0\nend", "def show_help(value = (not_set = true))\n return @show_ehlp if not_set\n\n @show_help = value\n end", "def print_missing_sec_arg\n puts ARGV[0] + \" requires second argument\"\n print_usage\nend", "def usage\n\t\t$stderr.printf \"usage: %s [ options ]\\n\",$0\n\t\t$stderr.printf \"\\n%s\\n\",$help\n\t\texit 0\n\tend", "def help\r\n\tputs \"-to add new student: add student\"\r\n\tputs \"-to display all students: display students\"\r\n\tputs \"-to display all subjects: display subjects\"\r\n\tputs \"-to update a grade: update grade\"\r\n\tputs \"-to display grades of a student: check grade\"\r\n\tputs \"-to quit: done, exit\"\r\nend", "def handle_option_intro(key = current_option_key)\n print_margin message(option_intro(key))\n end" ]
[ "0.67150533", "0.6650175", "0.66409653", "0.66179556", "0.651318", "0.64973545", "0.647828", "0.6446684", "0.6446684", "0.64186716", "0.63993746", "0.63486326", "0.63253415", "0.63253415", "0.63143826", "0.62979066", "0.62922305", "0.62797105", "0.62716347", "0.625714", "0.62379986", "0.62358856", "0.6224917", "0.62178224", "0.62178224", "0.6216242", "0.62076885", "0.61979276", "0.6190894", "0.6190894", "0.6190894", "0.61831796", "0.61612487", "0.6148864", "0.6135478", "0.6135478", "0.6135478", "0.6135478", "0.6135478", "0.6135478", "0.6135478", "0.61275625", "0.61219084", "0.6114771", "0.6095489", "0.60823655", "0.6071078", "0.60668707", "0.6040029", "0.6037572", "0.602074", "0.6015565", "0.6006396", "0.6004145", "0.59984726", "0.59979737", "0.5996057", "0.59957147", "0.59908575", "0.5990788", "0.598581", "0.598581", "0.59713924", "0.59667915", "0.5964208", "0.5958057", "0.5958057", "0.59515864", "0.59511644", "0.594683", "0.5944299", "0.5944278", "0.594351", "0.5931211", "0.592923", "0.5922869", "0.5922037", "0.5898058", "0.5882343", "0.5878965", "0.5874736", "0.5864378", "0.58639187", "0.58614844", "0.5845738", "0.5833927", "0.58291614", "0.58181924", "0.5816462", "0.5805218", "0.57873595", "0.57873476", "0.577867", "0.57766044", "0.577549", "0.5772488", "0.5769461", "0.57632107", "0.5761919", "0.5758927", "0.5754204" ]
0.0
-1
returns either the banner set with banner= or a simple banner like "Usage: $0 [arguments]"
def banner @banner || "Usage: #{program_prefix} [arguments]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def banner\n unless @banner\n @banner = +\"Usage: #{program_name} [options]\"\n visit(:add_banner, @banner)\n end\n @banner\n end", "def banner(arg=nil)\n @banner = arg if arg\n @banner || description\n end", "def banner(arg=nil)\n arg.nil? ? @option_parser.banner : (@option_parser.banner = arg)\n end", "def help; summarize(\"#{banner}\".sub(/\\n?\\z/, \"\\n\")) end", "def banner\n \"Usage: #{$0} minimal_cart\"\n end", "def banner\n \"Usage #{$0} compass_sass somethingelse whoknowswhat\"\n end", "def banner\n \"Usage: #{$0} #{spec.name} #{spec.name.camelize}Name [options]\"\n end", "def banner\n \"#{basename} #{self_command.formatted_usage(self, false)}\"\n end", "def banner\n \"Usage: #{$0} #{spec.name} <action>\"\n end", "def banner\r\n \"Usage: #{$0} generator [options] [args]\"\r\n end", "def banner\n \"Usage: #{$0} my_controller controller\"\n end", "def showBanner\n\treturn unless $options.show_banner\n\tputs <<BANNER\n ____ ____ ____ ___________ ____ __ __ ______\n / ___\\\\_/ __ \\\\ / \\\\_/ __ \\\\_ __ \\\\/ _ \\\\| | \\\\/ ___/\n / /_/ > ___/| | \\\\ ___/| | \\\\( <_> ) | /\\\\___ \\\\\n \\\\___ / \\\\___ >___| /\\\\___ >__| \\\\____/|____//____ >\n\\\\_____/ \\\\/ \\\\/ \\\\/ project generator \\\\/\n\nBANNER\nend", "def banner\n checkConnection()\n @banner\n end", "def banner\n checkConnection()\n @banner\n end", "def banner\n lines = []\n \n name_line = \"#{ name } role\"\n lines << name_line\n lines << \"=\" * name_line.length\n lines << ''\n if meta['description']\n lines << meta['description']\n lines << ''\n end\n lines << 'Usage:'\n lines << ''\n lines << \" #{ usage }\"\n lines << ''\n lines << ''\n \n lines.join(\"\\n\")\n end", "def cli_banner()\n print \"> \"\n end", "def banner\n out = <<-EOD;\n Usage: #{$0} authenticated ModelName [ControllerName] \n EOD\n end", "def banner\n \"Usage: #{$0} admin_ka ModelName\"\n end", "def banner\n self.class.instance_variable_get(:@__banner)\n end", "def print_banner(meta_info = nil)\n banner = meta_info.nil? ? \"#{@banner}\" : \"#{meta_info}\\n #{@banner}\"\n puts banner\n end", "def usage()\n\tputs \"Usage:\"\n\tputs \"\t\" + $0 + \" banner.bnr outfolder\"\nend", "def banner\n <<-EOS\nUsage #{$0} GeneratorName [license=#{LICENSES.join('|')}] [migration=true] [dir=/dir/to/install] [named=true]\n\nOptional arguments:\n\n named : When =true, generates a NamedBase generator.\n\n license : The license to install in the generator.\n\n migration : When =true (or when the generator name ends in\n 'migration') adds extra code to the generator.\n\n dir : Directory to install into. vendor/generator/generator_name\n is the default.\n\nEOS\n end", "def print_banner\n return if @silent\n say_blue \"=== #{@key} ===\", ['BOLD']\n say_blue description\n say_blue \" - os value: #{os_value}\" if os_value\n say_blue \" - os value: #{puppet_value}\" if puppet_value\n say_blue \" - recommended value: #{recommended_value}\" if recommended_value\n say_blue \" - chosen value: #{@value}\" if @value\n end", "def create_banner\n option_separator\n option_separator 'Usage: main.rb <application>-<mode> [options]'\n end", "def banner(command, namespace = nil, subcommand = false)\n \"#{basename} #{command.formatted_usage(self, $thor_runner, subcommand)}\"\n end", "def banner\n \"Usage: #{$0} simple_spec_controller [ControllerName]\"\n end", "def banner\n\tputs\n\tputs \"#{HC}#{FWHT}Linux Log Cleaner\"\n\tputs \"By: #{FGRN}Hood3dRob1n#{RS}\"\n\tputs\nend", "def banner\n puts \"TITO-BOT\\n\"\nend", "def banner\n I18n.t 'command.impressbox.usage', cmd: 'vagrant impressbox'\n end", "def print_banner\n notice( \"\\n=== #{@key} ===\", [:CYAN, :BOLD])\n notice( description, [:CYAN] )\n notice( \"----> OS value: #{os_value.inspect}\", [:CYAN] ) if os_value\n notice( \"----> Recommended value: #{recommended_value.inspect}\", [:CYAN] ) if recommended_value\n end", "def banner(text)\n @__banner = text.strip\n end", "def banner\n say %(\n\n ******************************************************************\n\n Your extension has been generated with a gemspec dependency on\n Archangel ~> v#{archangel_version}\n\n I have a feeling you're about to build something amazing.\n\n ******************************************************************\n\n )\n end", "def banner(value = (not_set = true))\n if not_set\n @properties[:banner]\n else\n @properties[:banner] = value\n end\n end", "def banner()\n print \"\"\" \n =================================================================\n =================================================================\n\t ==========International Morse Code translator v 0.0.1 =========\n ==========Transates user supplied Morse Code to text ============\n\t =================================================================\n ==========Coded by Rick Flores | nanotechz9l ====================\n ==========E-mail 0xnanoquetz9l<<\\|/>>gmail.com ===================\n\t =================================================================\n =================================================================\n \n\"\"\".foreground(:blue).bright\nend", "def print_banner\n print_line BANNER\n print_line\n print_line\n end", "def rails_banner\n env = defined?(Rails) ? Rails.env : 'development'\n\n puts Pry::Helpers::Text.__send__(ENV_COLORS[env], Object.const_get(\"#{env.upcase}_BANNER\"))\n\n ''\nend", "def banner(_config, message )\r\n\t_config.vm.provision \"shell\", privileged: true, inline: <<-BANNER\r\n\t\tdpkg -l | grep -q sysvbanner || apt install -y sysvbanner\r\n\t\techo\t'################################################################################'\r\n\t\techo\r\n\t\twhich banner > /dev/null 2>&1 && banner #{message} || echo #{message}\r\n\t\techo\r\n\t\techo\t'################################################################################'\r\n\tBANNER\r\nend", "def show_help\n display banner\n display \"\"\n display short_help\n display \"\"\n end", "def print_banner(banner_text, output)\n banner = Artii::Base.new\n output.puts\n output.puts banner.asciify(\" #{banner_text}\")\n output.puts\nend", "def getOptionsBanner\r\n return '[--name <MixName>]*'\r\n end", "def banner\n \"Usage: #{$0} ya_scaffold ModelName [field:type field:type]\"\n end", "def banner\n packetfu_ascii_art\n puts \">>> PacketFu Shell #{PacketFu.version}.\"\n if Process.euid.zero? && @pcaprub_loaded\n puts \">>> Use $packetfu_default.config for salient networking details.\"\n print \"IP: %-15s Mac: %s\" % [$packetfu_default.ip_saddr, $packetfu_default.eth_saddr]\n puts \" Gateway: %s\" % $packetfu_default.eth_daddr\n print \"Net: %-15s\" % [Pcap.lookupnet($packetfu_default.iface)][0]\n print \" \" * 13\n puts \"Iface: %s\" % [($packetfu_default.iface)]\n puts \">>> Packet capturing/injecting enabled.\"\n else\n print \">>> Packet capturing/injecting disabled. \"\n puts Process.euid.zero? ? \"(no PcapRub)\" : \"(not root)\"\n end\n puts \"<>\" * 36\nend", "def entry_banner\n 'Interview'\n end", "def banner\n\tpacketfu_ascii_art\n\tputs \">>> PacketFu Shell #{PacketFu.version}.\"\n\tif Process.euid.zero? && @@pcaprub_loaded \n\t\tputs \">>> Use $packetfu_default.config for salient networking details.\"\n\t\tprint \"IP: %-15s Mac: %s\" % [$packetfu_default.ip_saddr, $packetfu_default.eth_saddr]\n\t\tputs \" Gateway: %s\" % $packetfu_default.eth_daddr\n\t\tprint \"Net: %-15s\" % [Pcap.lookupnet($packetfu_default.iface)][0]\n\t\tprint \" \" * 13 \n\t\tputs \"Iface: %s\" % [($packetfu_default.iface)]\n\t\tputs \">>> Packet capturing/injecting enabled.\"\n\telse\n\t\tprint \">>> Packet capturing/injecting disabled. \"\n\t\tputs Process.euid.zero? ? \"(no PcapRub)\" : \"(not root)\"\n\tend\n\tputs \"<>\" * 36\nend", "def usage(args_and_such=nil)\n _banner = \"usage: #{File.basename($0)}\"\n (_banner << ' ' << args_and_such) if args_and_such\n @option_parser.banner = _banner\n end", "def banner\n @data['banner']\n end", "def banner\n \"Usage: #{$0} static_gen_specs ModelName [table_name]\"\n end", "def banner\n \"Usage: #{$0} salva_scaffold ModelName [ControllerName]\"\n end", "def banner\n \"Usage: #{$0} asf_scaffold ModelName RecordType [ControllerName] [action, ...]\" \n end", "def banner\n \"Usage: #{$0} scaffold ModelName [ControllerName]\"\n end", "def banner\n \"Usage: #{$0} scaffold ModelName [ControllerName]\"\n end", "def env_banner_text\n Settings.host_based_banner_labels[request.env['SERVER_NAME']] || Settings.env_based_banner_labels[Rails.env]\n end", "def entry_banner\n 'Four by four'\n end", "def banner\n return \"codnar-weave - Weave documentation chunks to a single HTML.\"\n end", "def getOptionsBanner\n return '[--name <DeliverableName>]*'\n end", "def banner?\n @properties.key?(:banner) && !@properties[:banner].nil?\n end", "def banner\n \"Usage: #{$0} ajax_scaffold ModelName [ControllerName]\"\n end", "def banner\n \"Usage: #{$0} sexy_scaffold ModelName [field:type field:type]\"\n end", "def get_banner\n @server.make_request('show.getbanner', tvdbid: @tvdbid)\n end", "def banner_label\n html_content[0..100]\n end", "def banner(options = {}, &block)\n options = {\n :comment => :js\n }.update(options)\n \n if block_given?\n @_banner = yield.to_s\n elsif !@_banner\n banner = []\n banner << \"Version : #{self.scm.version}\"\n banner << \"Date : #{self.scm.date.strftime(\"%Y-%m-%d\")}\"\n\n size = banner.inject(0){|mem,b| b.size > mem ? b.size : mem }\n banner.map!{|b| \"= #{b.ljust(size)} =\" }\n div = \"=\" * banner.first.size\n banner.unshift(div)\n banner << div\n @_banner = banner.join(\"\\n\")\n end\n \n if options[:comment]\n self.comment(@_banner, :style => options[:comment])\n else\n @_banner\n end\n end", "def banner(msg)\n puts \"\\n #{'*' * (msg.size + 6)}\"\n puts \" * #{msg} *\"\n puts \" #{'*' * (msg.size + 6)}\\n\"\nend", "def entry_banner\n 'Team Meeting'\n end", "def banner(options = {}, &_block)\n options = {\n comment: :js\n }.update(options)\n\n if block_given?\n @_banner = yield.to_s\n elsif !@_banner\n @_banner = default_banner.join(\"\\n\")\n end\n\n if options[:comment]\n comment(@_banner, style: options[:comment])\n else\n @_banner\n end\n end", "def banner\n \"Usage: #{$0} form_fu_scaffold [options] ModelName [field:type, field:type]\"\n end", "def banner_copyright\n return unless banner\n\n %(Header photo: &copy; <a href=\"#{banner.url}\">#{banner.author}</a>)\n end", "def print_usage\n puts \"USAGE: #{PROGNAME} <ip|host> [warning,critical] [snmp_community]\"\n puts \" Default values: warning=80, critical=90, snmp_community=public\"\nend", "def help(shell)\n shell.say \"Usage:\"\n shell.say \" #{banner}\\n\"\n shell.say\n class_options_help(shell)\n shell.say desc if desc\n end", "def banner\n \"Usage: #{$0} rspec_scaffold ModelName [field:type field:type]\"\n end", "def test_default_banner\n release = @rogerfile.release(scm: :fixed)\n\n # Set fixed version\n date = Time.now\n release.scm.version = \"1.0.0\"\n release.scm.date = date\n\n lines = release.banner.split(\"\\n\")\n\n assert_equal \"/* ====================== */\", lines[0]\n assert_equal \"/* = Version : 1.0.0 = */\", lines[1]\n assert_equal \"/* = Date : #{date.strftime('%Y-%m-%d')} = */\", lines[2]\n assert_equal \"/* ====================== */\", lines[3]\n end", "def banner(banner_src)\n content_for(:custom_banner) { banner_src.html_safe }\n end", "def banner\n \"Usage: #{$0} scaffold ModelName [field:type, field:type]\"\n end", "def banner\n \"Usage: #{$0} custom_scaffold ModelName [field:type, field:type]\"\n end", "def banner\n \"Usage: #{$0} mwd_scaffold ModelName [field:type, field:type]\"\n end", "def print_usage \n puts \"Usage: packagize [-h] [-v] [-r] [-s source_dir] [-d dest_dir]\"\n puts \"\\tSource and destination default to the current working directory.\"\n puts \"\\t-r search directory and all subdirectories. Defaults to true.\"\n puts \"\\t-v display verbose output. Defaults to false.\"\n puts \"\\t-h display this text.\"\nend", "def banner\n \"Usage: #{$0} ubiquo_scaffold ModelName [field:type, field:type]\"\n end", "def banner(text, line_width=40)\n banner_text = \"=\" * line_width\n banner_text << \"\\n\"\n banner_text << text.center(line_width)\n banner_text << \"\\n\"\n banner_text << \"=\" * line_width\n puts banner_text\n nil\n end", "def banner\n \"Usage: #{$0} admin_scaffold ModelName [field:type, field:type]\"\n end", "def output_usage\n print \"== Usage \n karmabyns number_of_dice value_sought\"\n end", "def display_banner()\n\n\tr = Random.rand(1..4)\n\n\tcase r\n\twhen 1\n\t\tputs \"\n\t.------..------..------..------..------.\n\t|D.--. ||V.--. ||A.--. ||S.--. ||H.--. |\n\t| :/\\\\: || :(): || (\\\\/) || :/\\\\: || :/\\\\: |\n\t| (__) || ()() || :\\\\/: || :\\\\/: || (__) |\n\t| '--'D|| '--'V|| '--'A|| '--'S|| '--'H|\n\t`------'`------'`------'`------'`------'\n\n\n\t\t\"\n\twhen 2\n\t\tputs \"\n\t@@@@@@@ @@@ @@@ @@@@@@ @@@@@@ @@@ @@@ \n\t@@@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@ @@@ @@@ \n\t@@! @@@ @@! @@@ @@! @@@ !@@ @@! @@@ \n\t!@! @!@ !@! @!@ !@! @!@ !@! !@! @!@ \n\t@!@ !@! @!@ !@! @!@!@!@! !!@@!! @!@!@!@! \n\t!@! !!! !@! !!! !!!@!!!! !!@!!! !!!@!!!! \n\t!!: !!! :!: !!: !!: !!! !:! !!: !!! \n\t:!: !:! ::!!:! :!: !:! !:! :!: !:! \n\t :::: :: :::: :: ::: :::: :: :: ::: \n\t:: : : : : : : :: : : : : :\n\t\n\n\t\t\"\n\twhen 3\n\t\tputs \"\n\n\t\t ^^ .-=-=-=-. ^^\n\t ^^ (`-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-`) ^^ ^^\n\t ^^ (`-=-=-=-=-=-=-=-`) ^^ ^^\n\t ( `-=-=-=-(@)-=-=-` ) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-=-`) ^^\n\t (`-=-=-=-=-=-=-`) ^^ ^^\n\t dvash (`-=-=-=-=-`)\n\t `-=-=-=-=-`\n\n\n\t\t\"\n\twhen 4\n\t\tputs \"\n\n\t _______________\n\t //~~~~~~~~~~~~~~~\\\\\\\\ |\n\t 0 / /_________________\\\\ \\\\| 0\n\t ---------------------------\n\t / /======|=D=V=A=S=H=|======\\\\ \\\\\n\t \\\\_____________________________/\n\t \\\\ _______ _______ /\n\t |\\\\ _/|__|__|\\\\_____/|__|__|\\\\_ /|\n\t | |`V' `---' `V'| |\n\t |______| |______|\n\t\t\n\n\t\t\"\n\tend\nend", "def banner\n \"Usage: #{$0} cmt ModelName field:type, field:type\"\n end", "def show_help\n puts 'usage: '\n puts 'a, -a :List all interfaces and their Addresses'\n puts 'l, -l :List all interface names'\n puts 'n, -n :List interface netmask settings'\n puts 'b, -b :List interface broadcast info....err'\n puts 'h, -h :Show this message'\n puts 'o, -o :Show operating system'\nend", "def default_description\n description = \"Run `#{@application_class.name}`\"\n description << ' quietly' if @quiet\n description << \" using config file #{@config}\" if @config\n description\n end", "def get_html_banner()\n\t\t\t\thtml = %Q{\n\t\t\t\t\t<html><body bgcolor=black style=\"color:cyan; font-family: monospace\">\n\t\t\t\t\t\t<pre>#{Xssf::XssfBanner::Logos[2]}</pre><h3 style=\"position:absolute; right:1%; top:75%\" align=\"right\"><u>msf ></u> _</h3>\n\t\t\t\t\t\t<table width=\"300\" height=\"35\" style=\"border: 1px solid green; position:absolute; left:450px; top:30%\">\n\t\t\t\t\t\t\t<tr align=center>\n\t\t\t\t\t\t\t\t<td width=\"33%\" onMouseover=\"this.bgColor='green'\" onMouseout=\"this.bgColor='black'\"\n\t\t\t\t\t\t\t\tonClick=\"parent.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=main';\" style=\"cursor:pointer; border: 1px solid green;\">LOGS</td>\n\t\t\t\t\t\t\t\t<td width=\"33%\" onMouseover=\"this.bgColor='green'\" onMouseout=\"this.bgColor='black'\"\n\t\t\t\t\t\t\t\tonClick=\"parent.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=stats';\" style=\"cursor:pointer; border: 1px solid green;\">STATS</td>\n\t\t\t\t\t\t\t\t<td width=\"33%\" onMouseover=\"this.bgColor='green'\" onMouseout=\"this.bgColor='black'\"\n\t\t\t\t\t\t\t\tonClick=\"parent.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=help';\" style=\"cursor:pointer; border: 1px solid green;\">HELP</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</body></html>\n\t\t\t\t}\n\t\t\t\treturn html\n\t\t\tend", "def basic_usage\n return '' if args.nil?\n usage_args.map {|e|\n (e.size < 2) ? e[0].upcase : \"[#{e[0].upcase}]\"\n }.join(' ')\n end", "def full_help\n [\n usage, \n nil,\n 'Summary:',\n summary,\n nil,\n 'Description:',\n description,\n nil,\n 'Arguments:',\n arguments,\n ].join(\"\\n\")\n end", "def print_missing_sec_arg\n puts ARGV[0] + \" requires second argument\"\n print_usage\nend", "def usage\n s = \"#{USAGE_HEADER}\\n\"\n s << \"\\n\"\n s << \" ABOUT\\n\"\n s << \" The 'help' command prints usage info for the Bake utility overall, or for a\\n\"\n s << \" given command.\\n\"\n s << \"\\n\"\n s << \" USAGE\\n\"\n s << \" bake help [command]\\n\"\n s << \"\\n\"\n return s\n end", "def to_s\n\t\t\tout = \"\"\n\t\t\tout << banner << \"\\n\"\n\t\t\t\n\t\t\t@order.each {|option|\n\t\t\t\tif (option.nil?)\n\t\t\t\t\tout << \"\\n\"\n\t\t\t\t\tnext\n\t\t\t\tend\n\t\t\t\t\n line = sprintf(\"-%-2s --%-#{longest+6}s \",\n option.short_name,\n option.long_name + (option.flag ? \"\" : \" [VAL]\"))\n\n out << line\n if (line.length + option.description.length <= 80)\n out << option.description\n else\n rem = 80 - line.length\n desc = option.description\n i = 0\n while (i < desc.length)\n out << \"\\n\" if i > 0\n j = [i + rem, desc.length].min\n while desc[j..j] =~ /[\\w\\d]/\n j -= 1\n end\n chunk = desc[i..j].strip\n out << \" \" * line.length if i > 0\n out << chunk\n i = j + 1\n end\n end\n\n if (!option.flag)\n out << \" (default: #{option.default_value})\"\n end\n\n out << \"\\n\"\n }\n return out\n\t\tend", "def msg_BAN(source, args)\n return nil\n end", "def short_usage\n short =<<HERE_YOU_GO\nmax_hp - calculate max HP for character, per AD&D rules (*FIRST* Edition,\nSpecifically as implemented by Pool of Radiance!)\n\nUsage:\nmax_hp [options] <constitution> <class><level> [<class><level> [...]]\n\nUse max_hp -h or max_hp --help for more help.\nHERE_YOU_GO\nend", "def banner\n \"Usage: #{$0} scaffold_resource ModelName [field:type, field:type]\"\n end", "def show(banner)\n\n ViewHelper.show(self, banner)\n end", "def game_banner\n puts <<-GRID\n ####### ####### ########{' '}\n # # ##{' '}\n # # ##{' '}\n # ## #### # #### #### # #### ####{' '}\n # # # # # # # # # ## ## # ##{' '}\n # # # # #### # # # # ######{' '}\n # # ## # # # ## # ## ## ##{' '}\n ### ### #### ### ##### #### ### #### ####\n GRID\nend", "def usage\n puts\n puts \"ruby bj_play.rb [OPTIONS]\"\n puts\n puts \" -c, --cash [integer]:\"\n puts \" set the player's starting cash\"\n puts\n puts \" -d, --debug:\"\n puts \" debug mode; shows deck and dealer hands\"\n puts\n puts \" -h, --help:\"\n puts \" show help\"\n puts\nend", "def usage()\n\tputs \"Usage: #{$0} [width resolution in pixels] [height resolution in pixels] [diagnonal size in inch]\"\nend", "def get_banner_header\n if (@banner_ad.nil? || @banner_ad.empty?)\n \"\"\n else\n render :partial => 'layouts/ads/dfp_header', :locals => {:banner_ad => @banner_ad, :banner_id => @banner_id}\n end\n end", "def banner_for(user, height=100)\n image_tag(url_for(user.set_banner(height)))\n end", "def options_title opts, colors\n\t\t\t\tversion_path = File.expand_path(\"../../VERSION\", File.dirname(__FILE__))\n\t\t\t\topts.version = File.exist?(version_path) ? File.read(version_path) : \"\"\n\t\t\t\topts.banner = \"Todo: A simple command line todo application\\n\\n\".colorize(colors[:green]) +\n\t\t\t\t\" usage:\".colorize(colors[:cyan]) + \" todo [COMMAND] [option] [arguments]\".colorize(colors[:red])\n\t\t\t\topts.separator \"\"\n\t\t\t\topts.separator \"Commands:\".colorize(colors[:green])\n\t\t\tend", "def usage\n str =<<USAGE\nadvantage - Calculate chance of beating a roll with advantage (or disadvantage)\n\nUsage:\nadvantage - show 1-20 advantage/disadvantage table\nadvantage <dc> <bonus|penalty> - show % chance of beating a specific DC with a\n given penalty or bonus, e.g advantage 23 +5 or advantage 10 -3.\nUSAGE\nend" ]
[ "0.843943", "0.8028383", "0.78630704", "0.7684364", "0.7683354", "0.7680522", "0.7669488", "0.76071167", "0.7602126", "0.7580503", "0.7570065", "0.7433965", "0.7418849", "0.7418849", "0.718152", "0.716194", "0.71595234", "0.71306896", "0.7129929", "0.70811784", "0.70571995", "0.6971372", "0.69704056", "0.6964458", "0.6958001", "0.68864024", "0.6835131", "0.6803267", "0.67931443", "0.6790769", "0.6701402", "0.6696337", "0.665398", "0.6636631", "0.6627488", "0.6569399", "0.6490583", "0.647885", "0.64445555", "0.6410284", "0.640118", "0.6398767", "0.6393354", "0.6372592", "0.6302754", "0.62620515", "0.62599623", "0.6238715", "0.6237271", "0.6232178", "0.6232178", "0.62109524", "0.61643434", "0.6161398", "0.6159694", "0.61158645", "0.61087066", "0.6106807", "0.60874593", "0.60306954", "0.60269076", "0.6007387", "0.5981343", "0.59504277", "0.5944195", "0.58975106", "0.58944756", "0.5875067", "0.58591497", "0.5825904", "0.582324", "0.5819744", "0.5777798", "0.57707316", "0.57528853", "0.5727036", "0.5718176", "0.5687052", "0.56809384", "0.5633184", "0.5627374", "0.56256473", "0.56237036", "0.56029314", "0.55924857", "0.5588881", "0.5581029", "0.5558411", "0.5536327", "0.5530704", "0.5487713", "0.5474913", "0.5459071", "0.5452693", "0.5438153", "0.5431812", "0.5424371", "0.5415916", "0.54039174", "0.5383119" ]
0.86538833
0
Outputs a help screen. Code largely taken from the awesome, but not quite right for my needs, Clip (
def to_s out = "" out << banner << "\n" @order.each {|option| if (option.nil?) out << "\n" next end line = sprintf("-%-2s --%-#{longest+6}s ", option.short_name, option.long_name + (option.flag ? "" : " [VAL]")) out << line if (line.length + option.description.length <= 80) out << option.description else rem = 80 - line.length desc = option.description i = 0 while (i < desc.length) out << "\n" if i > 0 j = [i + rem, desc.length].min while desc[j..j] =~ /[\w\d]/ j -= 1 end chunk = desc[i..j].strip out << " " * line.length if i > 0 out << chunk i = j + 1 end end if (!option.flag) out << " (default: #{option.default_value})" end out << "\n" } return out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_help\n display banner\n display \"\"\n display short_help\n display \"\"\n end", "def help\r\n end", "def help\r\n end", "def help\n end", "def dump_help extra_msg=nil\n $stderr.puts help\n $stderr.puts \"\\n\\n\"+extra_msg unless extra_msg.blank?\n $stderr.puts ''\n end", "def help\n lines = []\n end", "def help_help\t# :nodoc:\n\t\t\"#{@program_name} -cmd help\\n\\tShow this message\\n\"\n\tend", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n end", "def help\n\t puts \"\"\n\t puts Rainbow(\":doc\").color(\"#D65200\")+\" Open documentation online\"\n\t puts Rainbow(\":open\").color(\"#D65200\")+\" Open file or folder\"\n\t puts Rainbow(\":new\").color(\"#D65200\")+\" Create file or directory\"\n\t puts Rainbow(\":destroy\").color(\"#D65200\")+\" Destroy Params file or current directory\"\n\t puts Rainbow(\":clean\").color(\"#D65200\")+\" Clean the trash\"\n\t puts Rainbow(\":calendar\").color(\"#D65200\")+\" Show current month\"\n\t puts Rainbow(\":today\").color(\"#D65200\")+\" Show date of day\"\n\t puts \"\"\n\t end", "def display_help\n text = <<END_OF_STRING\n F1: This help screen\n ESC: Return to Edit\n\n 1-5: create object 1..5 shown in toolbar at mouse cursor\n CTRL+A: select all objects (not in-code-created ones though)\n CTRL+S: Save\n E: Save and Quit\n Q: Quit (without saving)\n ESC: Deselect all objects\n Right Mouse Button Click: Copy object below cursor for fast duplication\n Arrow-keys (with selected objects): Move objects 1 pixel at the time\n Arrow-keys (with no selected objects): Scroll within a viewport\n\n\n Below keys operate on all currently selected game objects\n -----------------------------------------------------------------------------------\n DEL: delete selected objects\n BACKSPACE: reset angle and scale to default values\n Page Up: Increase zorder\n Page Down: Decrease zorder\n\n R: scale up\n F: scale down\n T: tilt left\n G: tilt right\n Y: inc zorder\n H: dec zorder\n U: less transparency\n J: more transparency\n\n Mouse Wheel (with no selected objects): Scroll viewport up/down\n Mouse Wheel: Scale up/down\n SHIFT + Mouse Wheel: Tilt left/right\n CTRL + Mouse Wheel: Zorder up/down\n ALT + Mouse Wheel: Transparency less/more\nEND_OF_STRING\n\n push_game_state(GameStates::Popup.new(:text => text), :finalize => false)\n end", "def help\n help = <<HEREDOC \nreset - creates a new game\nrock - throws rock\npaper - throws paper\nscissors - throws scissors\nhelp - shows this screen\ngame - shows the results from this game\nuser - shows your results from all your games\nglobal - shows the global results from all users\nexit - quit the game\nHEREDOC\n end", "def help\n prettify(description)\n end", "def action\n puts \"\\nHelp menu\"\n puts '=' * 'Help menu'.length + \"\\n\\n\"\n puts \" Command \\t Description\"\n puts \" \" + '-' * 'Command'.length + \" \\t \" + '-' * 'Description'.length\n commands.map {|cmd , desc| puts \" #{cmd} \\t #{desc}\"}\n puts \"\\n\\n\"\n end", "def help #:nodoc:\n Writer.help( { :banner => @@banner, :header => @@header,\n :options => @@options, :footer => @@footer },\n output_to, exit_on_help? )\n end", "def show_help\n system 'clear'\n puts HELP_COMMANDS\n end", "def help\n \n end", "def user_help\n puts \"\"\n puts \"-l and --list\"\n puts \"Write either 'moodbooster -l' or 'moodbooster --list' in the command line to view your week's moods\"\nend", "def cmd_help(*args)\n\t\tprint(shell.help_to_s)\n\tend", "def print_help()\n puts \"--------------------------------------\"\n puts \"Use the following commands\"\n puts \"--------------------------------------\"\n puts \"HELP\\t\\tDisplays this message\"\n puts \"CLEAR\\t\\tClears the console\"\n puts \"DISPLAY\\t\\tClears the console and shows all Turns\"\n puts \"SURRENDER\\tSurrender the game\"\n puts \"RULES\\t\\tDisplay current Rules\"\n puts \"CHEAT\\t\\tDisplays a code with blackhit\"\n puts \"EXIT\\t\\tBack to main menu\"\n\n puts \"\\nCurrent status: #{@game.next_action} a code. Just press Enter to get prompted\"\n return self\n end", "def show_help\n\tputs \"These are the following commands that this application accepts:\"\n\tputs \"\\t 'add' (child name) (toy name) - gives a child a new toy\"\n\tputs \"\\t 'remove' (toy name) (child name) - takes away the child's toy\"\n\tputs \"\\t 'ls' - lists all children and the toys they are receiving\"\n\tputs \"\\t 'ls' (child name) - lists all the toys that one child is receiving\"\n\tputs \"\\t 'delivered' (child name) - marks that the toys have been delivered to the child\"\n\tputs \"\\t 'help' - shows all of the available commands that this application accepts\"\n\n\nend", "def help; end", "def help; end", "def help; end", "def short_help\n execute_string(\"-help\")\n end", "def help_message\n make_response %(*Usage:*\n\n To get stats about all players:\n `foosey stats`\n\n To do anything else:\n http://foosey.futbol)\nend", "def show_help\n puts HELP_MESSAGE\n end", "def show_help\n puts HELP_MESSAGE\n end", "def help\n\tusage\n\tputs \"This tool is oriented to separate web pages into segments called blocks, based on the structural and visual properties\"\nend", "def help\n puts \"_____________________________________\",\n \"Available commands:\",\n \" m <message> - chat with all players\",\n # \" m /t <player_name> <message> - chat with specified player\" #currently not supported\n \" u list - print all users in game with their states (busy or not)\",\n \" u game <username> - ask for game session with user <username>\",\n \"In game mode:\", #i'll write them later\n \" my hand - gets cards list (in hand)\",\n \" show board - shows my board and opponent's board\",\n \" move <card number> - puts card to board\"\n \"------------------------------------\"\n end", "def help\n puts \"I accept the following commands:\\n- help : displays this help message\\n- list : displays a list of songs you can play\\n- play : lets you choose a song to play\\n- exit : exits this program\"\nend", "def help_text\n build_html do\n p <<-P1\n Not much needed here.\n P1\n end\n end", "def print_help\n puts \"I'd cheer for you, if only I knew who you were :(\\nTry again with `./cheers [Name] [mm/dd Birthday]`\"\nend", "def cmd_cli_help argv\n setup argv\n msg run_cmd(\"help\")\n end", "def help\n\tputs \"Things a baby adventurer needs to know : \"\n\tputs \"(g)o (direction): (n,w,e,s) move that direction\"\n\tputs \"(o)pen: open doors, chests, your eyes, etc\"\n\tputs \"(l)ook: examine the room your in\"\n\tputs \"(t)ake: add an item to your inventory\"\n\tputs \"(u)se: use an item in your inventory\"\n\tputs \"(i)nventory: see what items you have\"\n\tputs \"(q)uit: quit the game, as a coward would.\"\nend", "def show_help\n puts '* I M N - Create a new M x N image with all pixels coloured white (O).\n* C - Clears the table, setting all pixels to white (O).\n* L X Y C - Colours the pixel (X,Y) with colour C.\n* V X Y1 Y2 C - Draw a vertical segment of colour C in column X between rows Y1 and Y2 (inclusive).\n* H X1 X2 Y C - Draw a horizontal segment of colour C in row Y between columns X1 and X2 (inclusive)\n* F X Y C - Fill the region R with the colour C. R is defined as: Pixel (X,Y) belongs to R. Any\nother pixel which is the same colour as (X,Y) and shares a common side with any pixel in R also belongs to this region.\n* S - Show the contents of the current image\n* ? - Displays help text\n* X - Terminate the session'\n end", "def help\n puts 'add help'\n end", "def print_help\r\n print <<~HEREDOC\r\n Usage: ruby caesar_cipher.rb [options] [message string]\r\n \\t-d, --decode\r\n \\t\\tset the program to decode (default is decode)\r\n \\t-e, --encode\r\n \\t\\tset the program to encode (default is decode)\r\n \\t-f=FILEPATH, --file=FILEPATH\r\n \\t\\tset a file to read from\r\n \\t-h, --help\r\n \\t\\tprint this message\r\n \\t-n, --negative\r\n \\t\\tnegate the offset. Can also pass a negative offset\r\n \\t-o=NUMBER, --offset=NUMBER\r\n \\t\\tset the offset used by the cipher. Default is 2\r\n \\t-p=FILEPATH, --path=FILEPATH\r\n \\t\\tsee -f\r\n HEREDOC\r\n end", "def cmd_help argv\n help\n end", "def cmd_help argv\n help\n end", "def print_help\n system('clear') or system('cls')\n puts \"\\tHELP - RICOCHET\\n\n \\tricochet.rb - Cue ball, Corner Pocket (but which corner)\\n\n \\tUSAGE: height width velocity {OPT: -p particle_height particle_width; -m}\\n\n \\t-p: Specifies that you want a custom particle size (other than 1x1).\n \\t-m: Specifies that you want the conclusion quickly, and no animation.\\n\n \\tINPUT: height, width, velocity\n \\theight: the height of the table.\n \\twidth: the width of the table.\n \\tvelocity: the velocity at which the particle is traveling.\\n\n \\tOUTPUT: Corner, Number of Bounces, Time taken\\n\n \\tSUGGESTIONS: If you have a low velocity value (i.e. <10), I suggest -m as the animation could be lengthy.\"\n exit\nend", "def print_help\n puts 'Here is a list of available commands:'\n puts '- new - Create a new contact'\n puts '- list - List all contacts'\n puts '- show - Show a contact'\n puts '- find - Find a contact'\n end", "def print_help(cmd)\n offset = docs.keys.longest_string_length\n write \"#{cmd.ljust(offset)} -- #{docs[cmd]}\" + \n (has_shortcuts?(cmd) ? \" #{display_shortcuts(cmd)}\" : '')\n end", "def help\n puts 'Here is a list of available commands:\n new - Create a new contact\n list - List all contacts\n show - Show a contact\n search - Search contacts'\n end", "def help()\n\tputs \"Hier is een lijst handige commando's die je gaan helpen met je quest:\"\n\tputs \"ga (richting): Ga in de gespecificeerde richting\"\n\tputs \"open: open deuren, kisten, je hart, etc\"\n\tputs \"kijk: Krijg een beschrijving van de kamer waar je nu bent\"\n\tputs \"neem: Neem een item en stop het in je inventory\"\n\tputs \"gebruik X op X: Gebruik een item uit je inventory op een object\"\n\tputs \"inventory: Bekijk je inventory\"\n\tputs \"stop: Stop de game\"\nend", "def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend", "def help(s=nil)\n puts send_cmd \"help #{s}\\n\\n\"\n end", "def strass_menu_help\n puts \"Available Options for the String Assistant Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n puts \"show basic \".light_yellow + \" => \".white + \"Show Basic Functions\".light_red\n puts \"show build \".light_yellow + \" => \".white + \"Show Builder Functions\".light_red\n puts \"show tamper \".light_yellow + \" => \".white + \"Show Tamper Functions\".light_red\n puts \"show append \".light_yellow + \" => \".white + \"Show Append Functions\".light_red\n puts \"show space \".light_yellow + \" => \".white + \"Show Whitespace Functions\".light_red\n puts \"show comma \".light_yellow + \" => \".white + \"Show Comma Functions\".light_red\n puts \"show floor \".light_yellow + \" => \".white + \"Show Floor() Functions\".light_red\n print_line(\"\")\nend", "def print_help\n File.read(__FILE__).lines[1..-1].each do |line|\n if line =~ /\\A#/\n puts line[2..-1]\n else\n break\n end\n end\nend", "def print_help\n File.read(__FILE__).lines[1..-1].each do |line|\n if line =~ /\\A#/\n puts line[2..-1]\n else\n break\n end\n end\nend", "def help_text\n build_html do\n p <<P1\nThis page is a simple presentation of the paths that match the file\nthat was searched for an the fileset that the file was shipped in.\nP1\n end\n end", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts \"I accept the following commands:\"\n puts \"- help : displays this help message\"\n puts \"- list : displays a list of songs you can play\"\n puts \"- play : lets you choose a song to play\"\n puts \"- exit : exits this program\"\nend", "def help\n puts <<-HEREDOC\n I accept the following commands:\n - help : displays this help message\n - list : displays a list of songs you can play\n - play : lets you choose a song to play\n - exit : exits this program\n HEREDOC\nend", "def help\n\t\tputs \"The CLI currently accepts the following commands:\"\n\t\tputs \"'help' - Displays the current help screen.\"\n\t\tputs \"'free' - Displays a list of the current free-to-play heroes.\"\n\t\tputs \"'<hero name>' - Will search for a hero of that name. No punctuation should be added and spaces should be represented with '-'\"\n\t\tputs \"'hero search' - Will return the user to the hero search prompt.\"\n\t\tputs \"'exit' - Closes the application.\"\n\tend", "def help\n\nend", "def print_help\n\n puts\n puts \"You can type a direction to move: 'north', 'south', 'east' and 'west'.\".colorize(:red).indent(10)\n puts\n puts \"You can type 'exits' to see which way you can go.\".colorize(:red).indent(10)\n puts\n puts \"You can type 'quit' to save your character and quit.\".colorize(:red).indent(10)\n puts\n\nend", "def help; summarize(\"#{banner}\".sub(/\\n?\\z/, \"\\n\")) end", "def help\n puts \"usage: simply type something and press enter to get started\\n\\n\"\n puts \"Talkbox commands available to you:\\n\"\n puts \"\\thelp\\t\\tyour current position\\n\"\n puts \"\\tset volume NUM\\tvolume of voice, ranges from 1 to 10\"\n puts \"\\tcorral\\t\\tsample all the voices offered to you\\n\"\n puts \"\\tshow voices\\ta list of voices you can use\\n\"\n puts \"\\tuse random\\tsample a random voice\\n\"\n puts \"\\tuse VOICE\\tuse a voice of your choosing(must be valid voice from list)\\n\"\n puts \"\\tdirty talk\\tallow talkbox to use colorful language\\n\"\n puts \"\\tclean talk\\tremove cuss words from talkbox\\n\"\n puts \"\\texit\\t\\tif your a party pooper\"\n end", "def help(*args)\n if args.count == 0\n puts <<-HEREDOC\n\nThis script (#{File.basename($0)}) converts back and forth between GNU gettext\nPO files preferred by localizers and Tidy's language header H files which\nensure that Tidy stays small and cross-platform.\n\nAll output files are placed into the current working directory using a file name\nappropriate to the operation being performed.\n\nComplete Help:\n--------------\n HEREDOC\n end\n\n super\n end", "def wash_command_help\n puts \"The Ruby Farm - a simple command line animals app\"\n puts\n puts \"Command Usage:\"\n puts \" [wash | w] <name=> gives a shower to a animal by name\"\n puts \"\"\n puts \"Examples:\"\n puts \" bin/run [wash | w] name=my_animal_name\"\n end", "def help\n command_object.display_usage(cli.command)\n exit\n end", "def help\n puts \"For multi-word arguments, use 'single quotes' only.\"\n puts \"To create an event: \\t\\t\\t\\tCREATE EVENT event_name.\"\n puts \"To add a speaker to the most recent event: \\tCREATE SPEAKER speaker_name.\"\n puts \"To add a speaker to a different event: \\t\\tCREATE SPEAKER event_name speaker_name.\"\n puts \"To add a talk to an event: \\t\\t\\tCREATE TALK event_name talk_name talk_start_time talk_end_time speaker_name.\\n\\n\"\nend", "def help(additional_info=nil)\n \n set_colors\n set_screen_clear\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (@c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift @s_clear_screen_code\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n\n array += @@commands.keys.collect do |key|\n is_default = (@@default_method and key == @@default_method.keys[0])\n default_color = is_default ? @c_bold : \"\"\n\n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default_color + key.to_s + @c_reset}\"+\n \" #{default_color + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default_color + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" if is_default}#{@c_reset}\" \n end\n array << nil\n end", "def help\n puts \"I accept the following commands:\" \n puts \"- help : displays this help message\" \n puts \"- list : displays a list of songs you can play\" \n puts \"- play : lets you choose a song to play\" \n puts \"- exit : exits this program\"\nend", "def display_help\n print(\n \"\n\nruby fuzzer.rb [discover | test] url OPTIONS\n\nCOMMANDS:\n discover Output a comprehensive, human-readable list of all discovered inputs to the system. Techniques include both crawling and guessing.\n test Discover all inputs, then attempt a list of exploit vectors on those inputs. Report potential vulnerabilities.\n\nOPTIONS:\n --custom-auth=string Signal that the fuzzer should use hard-coded authentication for a specific application (e.g. dvwa). Optional.\n\n Discover options:\n --common-words=file Newline-delimited file of common words to be used in page guessing and input guessing. Required.\n\n Test options:\n --vectors=file Newline-delimited file of common exploits to vulnerabilities. Required.\n --sensitive=file Newline-delimited file data that should never be leaked. It's assumed that this data is in the application's database (e.g. test data), but is not reported in any response. Required.\n --slow=1 Number of seconds considered when a response is considered \\\"slow\\\". Default is 1 second\n\nExamples:\n # Discover inputs\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n # Discover inputs to DVWA using our hard-coded authentication\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n \")\n exit\nend", "def help\n \n \"Here is a list of available commands:\n new - Create a new contact\n list - List all contacts\n show - Show a contact\n find - Find a contact\"\n\nend", "def help\n @out.puts <<-MSG\n\n Usage:\n docbones -h/--help\n docbones -v/--version\n docbones command [options] [arguments]\n\n Commands:\n docbones create create a new project from a skeleton\n docbones freeze create a new skeleton in ~/.mrdocbones/\n docbones unfreeze remove a skeleton from ~/.mrdocbones/\n docbones info show information about available skeletons\n\n Further Help:\n Each command has a '--help' option that will provide detailed\n information for that command.\n\n http://www.ossxp.com\n\n MSG\n nil\n end", "def help\n\t\tputs \"Commands: pick up (weapons/items) , move to, drop, examine myself, describe me, look at me, inventory, look\"\n\t\tputs \"Commands: grab (food items), examine food (details about your food), eat (food), drink (beverages)\" \n\tend", "def help\r\n\tputs \"-to add new student: add student\"\r\n\tputs \"-to display all students: display students\"\r\n\tputs \"-to display all subjects: display subjects\"\r\n\tputs \"-to update a grade: update grade\"\r\n\tputs \"-to display grades of a student: check grade\"\r\n\tputs \"-to quit: done, exit\"\r\nend", "def help()\n $stderr.puts \"Usage: ruby __.rb -x cross_match_output -r reference.fasta -o prefix_of_output [-m minscore -s max_substitution -g max_gap] [-c]\"\nend", "def show_help\n puts 'usage: '\n puts 'a, -a :List all interfaces and their Addresses'\n puts 'l, -l :List all interface names'\n puts 'n, -n :List interface netmask settings'\n puts 'b, -b :List interface broadcast info....err'\n puts 'h, -h :Show this message'\n puts 'o, -o :Show operating system'\nend", "def help(shell)\n shell.say \"Usage:\"\n shell.say \" #{banner}\\n\"\n shell.say\n class_options_help(shell)\n shell.say desc if desc\n end", "def help\n\tputs <<-EOH\nUsage: #{$PROGRAM_NAME} <option> [name]\n options:\n\t-s\t--show\tshow instructions to install package specified by name\n\t-l\t--list\tlist available packages\n\t-h\t--help\tshow this help message and exit\n\tEOH\n\t0\nend", "def help(additional_info=nil)\n \n set_colors\n \n cmd_length = \"Command\".length\n parm_length = \"Parameters\".length\n max_command = [(@@commands.keys.max_by{|key| key.to_s.length }).to_s.length, cmd_length].max\n max_parameter = @@commands[@@commands.keys.max_by{|key| @@commands[key][:argument_list].length }][:argument_list].length\n max_parameter = [parm_length, max_parameter].max if max_parameter > 0\n\n usage_text = \" #{@c_usage}Usage:#{@c_reset} \"\n\n if Commandable.app_exe \n cmd_text = \"<#{@c_command + @c_bold}command#{@c_reset}>\"\n parm_text = \" [#{@c_parameter + @c_bold}parameters#{@c_reset}]\" if max_parameter > 0\n usage_text += \"#{@c_app_exe + app_exe + @c_reset} #{cmd_text}#{parm_text} [#{cmd_text}#{parm_text}...]\"\n end\n\n array = [usage_text, \"\"]\n \n array.unshift additional_info if additional_info\n array.unshift (\"\\e[2A\" + @c_app_info + Commandable.app_info + @c_reset) if Commandable.app_info\n array.unshift \"\\e[H\\e[2J\"\n \n header_text = \" #{\" \"*(max_command-cmd_length)}#{@c_command + @c_bold}Command#{@c_reset} \"\n header_text += \"#{@c_parameter + @c_bold}Parameters #{@c_reset}#{\" \"*(max_parameter-parm_length)}\" if max_parameter > 0\n header_text += \"#{@c_description + @c_bold}Description#{@c_reset}\"\n \n array << header_text\n \n array += @@commands.keys.collect do |key|\n default = (@@default_method and key == @@default_method.keys[0]) ? @color_bold : \"\"\n \n help_line = \" #{\" \"*(max_command-key.length)}#{@c_command + default + key.to_s + @c_reset}\"+\n \" #{default + @c_parameter + @@commands[key][:argument_list] + @c_reset}\"\n help_line += \"#{\" \"*(max_parameter-@@commands[key][:argument_list].length)} \" if max_parameter > 0\n \n # indent new lines\n description = @@commands[key][:description].gsub(\"\\n\", \"\\n\" + (\" \"*(max_command + max_parameter + (max_parameter > 0 ? 1 : 0) + 4)))\n \n help_line += \": #{default + @c_description}#{\"<#{@@commands[key][:xor]}> \" if @@commands[key][:xor]}\" +\n \"#{description}\" +\n \"#{\" (default)\" unless default == \"\"}#{@c_reset}\" \n end\n array << nil\n end", "def display_help\n print(\n \"\n\nruby fuzzer.rb [discover | test] url OPTIONS\n\nCOMMANDS:\n discover Output a comprehensive, human-readable list of all discovered inputs to the system. Techniques include both crawling and guessing.\n test Discover all inputs, then attempt a list of exploit vectors on those inputs. Report potential vulnerabilities.\n\nOPTIONS:\n --custom-auth=string Signal that the fuzzer should use hard-coded authentication for a specific application (e.g. dvwa). Optional.\n\n Discover options:\n --common-words=file Newline-delimited file of common words to be used in page guessing and input guessing. Required.\n\n Test options:\n --vectors=file Newline-delimited file of common exploits to vulnerabilities. Required.\n --sensitive=file Newline-delimited file data that should never be leaked. It's assumed that this data is in the application's database (e.g. test data), but is not reported in any response. Required.\n --random=[true|false] When off, try each input to each page systematically. When on, choose a random page, then a random input field and test all vectors. Default: false.\n --slow=500 Number of milliseconds considered when a response is considered \\\"slow\\\". Default is 500 milliseconds\n\nExamples:\n # Discover inputs\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n # Discover inputs to DVWA using our hard-coded authentication\n fuzz discover http://localhost:8080 --common-words=mywords.txt\n\n # Discover and Test DVWA without randomness\n fuzz test http://localhost:8080 --custom-auth=dvwa --common-words=words.txt --vectors=vectors.txt --sensitive=creditcards.txt --random=false\\n\"\n )\n exit\nend", "def helpmessage()\n\t\"\\nThis script will take a collection of input files to sass implementations and change the\\n\"+\n\t\"hierarchy in such a way that testrunner.rb can be used to run batches of tests. The\\n\"+\n\t\"expected_output.css files are generated by running sass (whichever version you have) on the\\n\"+\n\t\"input files. Sass is assumed to be on you path. View the initial comment of this script for\\n\"+\n\t\"more detailed info.\\n\\n\"\nend", "def long_help\n execute_string(\"-longhelp\")\n end", "def help\n base = [\"Usage: houst [action] [optional parameter]\"]\n\n @commands.each do |command|\n base << \"\\t#{command[:name]}: \\t#{command[:description]}\"\n end\n\n base << \"\\nAdditional help can be obtained by using\\n\\thoust help [command]\\n\"\n\n base.join \"\\n\"\n end", "def print_help()\n puts \"modtools/spawn-liquid height liquid x y z xOff yOff zOff\"\n puts \" height: height of the water/magma (1 to 7)\"\n puts \" liquid: either water or magma, spawns that liquid\"\n puts \" x y z: the location to spawn liquid at (replacing any preexisting liquid)\"\n puts \" xOff yOff zOff: optional convenience offsets, added to x,y,z\"\n puts \"square brackets are ignored (so [ 0 0 -1 ] would be treated as 0 0 -1)\"\n puts \"note - in other scripts, \\\\\\\\LOCATION or similar is usually equivalent to x y z\"\nend", "def help\n command 'HELP' do\n response 113\n text\n end\n end", "def command_help\n display_possible_actions\n end", "def help_info\n \"\"\n end", "def help\n [['some command', 'description of some command'],\n ['some other command', 'description of some other command']]\n end", "def help(arguments, options)\n colors = $stdout.tty?\n\n description = <<-END_OF_DESCRIPTION.gsub(/^ {8}/, '') # |<- 80 cols ends here\n \\e[1mHELP\\e[0m\n\n See `#{$0} commands` for a list of available commands.\n You can also use `#{$0} COMMAND --help` to get information about\n the command COMMAND.\n END_OF_DESCRIPTION\n\n description.gsub!(/\\e.*?m/, '') unless colors\n\n puts description\n end", "def help\n\tcommands = [\"I accept the following commands:\", \"- help : displays this help message\", \"- list : displays a list of songs you can play\", \"- play : lets you choose a song to play\", \"- exit : exits this program\"]\n\tcommands.each {|command| puts command}\nend", "def help(msg)\n @console.info(msg.cyan)\n end", "def command_help\n @colour.help '--- Welcome to ForGen, the home of custom image creation ---'\n @colour.help 'ForGen command line structure'\n @colour.help 'ruby forgen.rb command [options]'\n @colour.help ''\n\n @colour.help '[command: main]'\n @colour.help \"r, run\\t\\t\\t\\t Run all aspects of ForGen\"\n @colour.help \"make-configuration\\t\\t Make configuration files for a new project\"\n @colour.help \"make-vagrant-basebox\\t\\t Make a vagrant basebox\"\n @colour.help \"make-virtual-machine\\t\\t Make a virtual machine\"\n @colour.help \"make-forensic-image\\t\\t Make a forensic image\"\n @colour.help ''\n\n @colour.help '[command: information]'\n @colour.help \"-h, --help\\t\\t\\t Display this help screen\"\n @colour.help \"--version\\t\\t\\t Displays the current ForGen version\"\n @colour.help \"--list-cases\\t\\t\\t List all case files currently in ForGen\"\n @colour.help \"--list-modules <type>\\t\\t List <type> modules that are in ForGen\"\n @colour.help ''\n\n @colour.help '[command: projects]'\n @colour.help \"--delete-all-projects\\t\\t Deletes ALL projects in the projects directory\"\n @colour.help ''\n\n @colour.help '[options: stdout]'\n @colour.help \"--disable-colours\\t\\t Disable all std output colour formatting\"\n @colour.help ''\n\n @colour.help '[options: cases]'\n @colour.help \"--case-path\\t\\t\\t The path to the case file to use\"\n @colour.help ''\n\n @colour.help '[options: forensic images]'\n @colour.help \"--forensic-image-output-dir\\t Output image output directory\"\n @colour.help \"--create-raw-image\\t\\t Create a RAW image of all VM drives\"\n @colour.help \"--create-ewf-image\\t\\t Create an EWF image of all VM drives\"\n @colour.help \"--delete-vm-after-image-creation\\b\\t Delete the VM after image generation\"\n @colour.help ''\n\n @colour.help '[options: modules]'\n @colour.help \"--basebox-url\\t\\t\\t URL to the basebox (overwrites basebox modules)\"\n @colour.help ''\n\n @colour.help '[options: vm]'\n @colour.help \"--no-vm-shutdown\\t\\t Stops vm shutdown (will stop forensic image generation)\"\n @colour.help \"--gui-output\\t\\t\\t Instructs ForGen to create vms in background\"\n @colour.help \"--max-processor-cap\\t\\t Sets processor execution cap\"\n @colour.help \"--max-memory-usage\\t\\t Sets max vm memory [RAM]\"\n @colour.help \"--number-of-processors\\t\\t Sets number of vm processing cores\"\n @colour.help ''\n\n @colour.help '[options: debug]'\n @colour.help \"--verbose\\t\\t\\t Run all ForGen elements in verbose mode\"\n @colour.help \"--debug\\t\\t\\t\\t Run all ForGen elements in debug mode\"\n @colour.help ''\n\nend", "def command_help(m)\n m.user.send [\n \"!next - When's the next live show?\",\n \"!schedule - What shows are being recorded live in the next seven days?\",\n \"!suggest - Be heard. Suggest a title for the live show.\",\n \"!link - Know the link for that? Suggest it and make the show better.\",\n \"!current - What's playing on #{shared[:Live_Url]}? I've got you covered.\",\n \"!last_status - The last tweet by @#{shared[:Twitter_User].join(\", @\")} delievered to you in IRC. Sweet.\",\n \"!about - Was #{shared[:Bot_Nick]} coded or did it spontaniously come into existence?\",\n \"!help - Uh, this.\",\n ].join(\"\\n\")\n end", "def help_msg(basic_help_msg=true)\n init_basic_help_msg if !!basic_help_msg\n unless ::ARGV.options.select{ |e| __helper_flags__.include?(e) }.empty?\n\n tmp_ary= []\n __helper_msg_obj__.each do |ary|\n tmp_ary.push(ary[0])\n ary[1].each{|e| tmp_ary.push( ( e.to_s.length == 1 ? \"-#{e}\" : \"--#{e}\" ) )}\n tmp_ary.push('')\n end\n\n tmp_ary.each{ |element| element.include?('--') ? element.gsub!('--',\"\\t--\") : element.gsub!('-',\"\\t -\")}\n puts '',tmp_ary.join(\"\\n\"),''\n Process.exit!\n\n end\n return nil\n end", "def cli_help\n self.class.help\n end", "def help(argm)\n\tif(argm)\n\t\tputs \"Commands:\"\n\t\tprintf \"%-15s %-6s %-10s # Shows the list of commands available\\n\", \n\t\tFile.basename(__FILE__), \"help\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Load a XML file\\n\", \n\t\tFile.basename(__FILE__), \"-xml\", \"[filename]\"\n\t\tprintf \"%-15s %-6s %-10s # Allows you to search\\n\", \n\t\tFile.basename(__FILE__), \"list\", \"\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for ip\\n\", \n\t\t\"\", \"\", \"--ip\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for name(first and/or last)\\n\", \n\t\t\"\", \"\", \"--name\"\n\t\tprintf \"%-15s %-6s %-10s # Searches for email\\n\", \n\t\t\"\", \"\", \"--email\"\n\t\texit\n\tend\nend" ]
[ "0.7576363", "0.7412535", "0.7412535", "0.7386542", "0.73505324", "0.7348062", "0.73433924", "0.7319129", "0.7319129", "0.7319129", "0.7319129", "0.7319129", "0.7319129", "0.7319129", "0.72921073", "0.7243393", "0.7234204", "0.7218127", "0.7217866", "0.7216112", "0.72073686", "0.71856195", "0.7184735", "0.71828383", "0.7180274", "0.71766263", "0.7164316", "0.7164316", "0.7164316", "0.71610105", "0.71497375", "0.71492815", "0.71492815", "0.7148731", "0.71444154", "0.71070486", "0.70964104", "0.70895433", "0.70613754", "0.70376617", "0.70329845", "0.7028697", "0.6999681", "0.6991112", "0.6991112", "0.6984566", "0.6979411", "0.6976683", "0.69733083", "0.6965256", "0.6959128", "0.69569", "0.69553584", "0.69501895", "0.69501895", "0.6947116", "0.6944707", "0.6944707", "0.6944707", "0.6944707", "0.6944707", "0.6944707", "0.69384027", "0.6908746", "0.6906904", "0.69061685", "0.68830264", "0.68817675", "0.6878401", "0.68661547", "0.68638253", "0.68599343", "0.68581074", "0.68180233", "0.68106276", "0.6803764", "0.67993367", "0.6795439", "0.678597", "0.6778024", "0.6775595", "0.6771626", "0.67559254", "0.6754891", "0.6735058", "0.67323375", "0.672597", "0.67258275", "0.6715938", "0.67049146", "0.66767347", "0.6659093", "0.66569", "0.6652932", "0.66447556", "0.66409767", "0.66247505", "0.66105294", "0.66101134", "0.660918", "0.6604736" ]
0.0
-1
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement.
def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name #SELECT title, SUM(quantity) FROM groceries GROUP BY aisle ORDER BY SUM(quantity); "SELECT projects.title, sum( pledges.amount) FROM projects JOIN pledges where projects.id=pledges.project_id group by projects.title order by projects.title ;" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_category_from_projects\n\"SELECT category FROM projects;\"\nend", "def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'music';\n\"\nend", "def current_categories(db)\r\n\tretrieve_categories = '\r\n\tSELECT name FROM categories'\r\n\tcategories = db.execute(retrieve_categories)\r\nend", "def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT projects.category, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects\nON pledges.project_id = projects.id \nWHERE projects.category = 'books';\"\nend", "def selects_the_category_name_and_the_sum_total_of_the_all_its_pledges_for_the_books_category\n\"SELECT Projects.category, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id WHERE Projects.category = 'books';\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\nend", "def categories()\n db = connect()\n db.execute('SELECT * FROM categories')\n end", "def category()\n sql = \"SELECT * FROM categories WHERE id = $1 ORDER BY name;\"\n values = [@category_id]\n sql_result = SqlRunner.run(sql, values)\n return Category.new(sql_result[0])\n end", "def get_category_name(category_id)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category = db.get_first_value(\"select name from category where id = ?\", [category_id])\n\n return categor\nend", "def projects\n where(:_type => ProjectCategory.name)\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title ORDER BY projects.title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(amount) FROM projects\n INNER JOIN pledges ON project_id = projects.id\n GROUP BY title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title\"\n\n# FROM owners\n# INNER JOIN cats_owners\n# ON owners.id = cats_owners.owner_id\n# JOIN cats ON cats_owners.cat_id = cats.id\n# WHERE cats_owners.owner_id = 2;\n\nend", "def current_categorized_expenses(db, user_name)\r\n\tretrieve_categorized_expenses = '\r\n\tSELECT categories.name, amount FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE users.name = ?'\r\n\tcategorized_expenses = db.execute(retrieve_categorized_expenses, [user_name])\r\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY(projects.title) ;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n sql = <<-SQL\n SELECT projects.title, SUM(pledges.amount) FROM projects JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title;\n SQL\n\nend", "def getCategories(_, _, _)\n @db.categories\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n <<-SQL\n SELECT projects.title , sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title\n SQL\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"Write your SQL query Here\"\n \n\"SELECT projects.title, SUM(amount) \nFROM pledges \nINNER JOIN projects \nON pledges.project_id = projects.id GROUP BY projects.title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Write your SQL query Here\"\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id = projects.id GROUP BY projects.title ORDER BY title\"\nend", "def category(id)\n db = connect()\n return db.execute('SELECT Id,Title FROM discussions WHERE CatId=?', id), db.execute('SELECT * FROM categories WHERE Id=?', id)\n end", "def list_projects # :nologin:\n query = create_query(:Project, :all, :by => :title)\n show_selected_projects(query)\n end", "def get_category_id(category)\n db = SQLite3::Database.new \"#{$script_dir}/cfps.db\"\n category_id = db.get_first_value(\"select id from category where name = ?\", [category])\n\n return category_id\nend", "def select(db); end", "def select(db); end", "def get_records_for_category categ\n if categ.nil? or categ == \"\"\n #return @records\n get_data \"select * from todo\"\n else\n #return @records.select { |row| row[0] == categ }\n get_data \"select * from todo where categ = '#{categ}' \"\n end\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL \n SELECT projects.title, SUM(pledges.amount)\n FROM projects \n INNER JOIN pledges on projects.id = pledges.project_id \n GROUP BY projects.title\n ORDER BY projects.title\n SQL\nend", "def project_statement\n project_clauses = []\n active_subprojects_ids = []\n\n active_subprojects_ids = project.descendants.active.map(&:id) if project\n if active_subprojects_ids.any?\n if has_filter?(\"subproject_id\")\n case operator_for(\"subproject_id\")\n when '='\n # include the selected subprojects\n ################\n # Smile specific : [project.id] + removed\n ids = values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!'\n # exclude the selected subprojects\n\n ################\n # Smile specific : [project.id] + removed\n ids = active_subprojects_ids - values_for(\"subproject_id\").map(&:to_i)\n project_clauses << \"#{Project.table_name}.id IN (%s)\" % ids.join(',')\n when '!*'\n # main project only\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n else\n # all subprojects\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n end\n elsif Setting.display_subprojects_issues?\n project_clauses << \"#{Project.table_name}.lft >= #{project.lft} AND #{Project.table_name}.rgt <= #{project.rgt}\"\n else\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n elsif project\n project_clauses << \"#{Project.table_name}.id = %d\" % project.id\n end\n project_clauses.any? ? project_clauses.join(' AND ') : nil\n end", "def select(sql, name = nil)\n raise NotImplementedError, \"select is an abstract method\"\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\nSQL\nend", "def index\n\n # @sql = \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n @sql = params[:name].present? ? \"Projects.name ILIKE '#{'%'+params[:name]+'%'}' \" : \"Projects.name ILIKE '%' \"\n @sql += \"OR Projects.description ILIKE '#{'%'+params[:name]+'%'}' \" if params[:name].present?\n\n @sql += \"and Projects.category ILIKE '#{'%'+params[:categorysdigital]+'%'}' \" if params[:categorysdigital].present?\n if params[:categorysdigital].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysmarketing]+'%'}' \" if params[:categorysmarketing].present?\n end\n\n if params[:categorysdigital].present? || params[:categorysmarketing].present?\n @sql += \"or Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n else\n @sql += \"And Projects.category ILIKE '#{'%'+params[:categorysdesign]+'%'}' \" if params[:categorysdesign].present?\n end\n\n @sql += \"and Projects.progress = #{params[:progresspropose].to_i} \" if params[:progresspropose].present?\n if params[:progresspropose].present?\n @sql += \"or Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n else\n @sql += \"and Projects.progress = #{params[:progressselected].to_i} \" if params[:progressselected].present?\n end\n\n if params[:progressselected].present?\n @sql += \"or Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n else\n @sql += \"and Projects.progress = #{params[:progressclose].to_i} \" if params[:progressclose].present?\n end\n\n # @sql += \"ORDER progress\"\n @projects = Project.where(@sql).order(:progress)\n @count = @projects.count\n @count_tt = Project.count\n end", "def projects_countries(site, category_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end", "def projects_countries(site, category_id = nil)\n if category_id.present?\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now())\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n #{category_join}\n where p.primary_organization_id=#{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM pledges\nINNER JOIN projects \nON pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n# Select projects title column and the sum of the pledges amount column\n# from the projects database,\n# join the pledges (Join table)\n# with projects.id and the pledges project id. Match these numbers\n# Group the tables together by Projects title and then\n# sort by projects.title\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM Projects\n JOIN Pledges\n ON Projects.id = Pledges.project_id\n GROUP BY Projects.title\n ORDER BY Projects.title;\n\"\nend", "def get_project_name(id)\n con = PG::Connection.connect(\"localhost\",5432,nil,nil,\"aaa\",\"admin\")\n sql = \"SELECT name \"\n sql += \"FROM projects \"\n sql += \"WHERE id='#{id}' \"\n res = con.exec(sql)\n con.close\n name = \"NA\"\n name = res[0]['name'] if res.num_tuples > 0\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\n SELECT DISTINCT title ,SUM(amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title\n SQL\nend", "def sql\n <<-SQL\n -- Search learning paths\n SELECT DISTINCT\n c.id,\n c.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_path' AS content_type,\n c.id AS learning_path_id,\n 0 AS learning_objective_id\n FROM courses c\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = c.id AND ts.taggable_type = 'LearningPath'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = c.id AND cc.contentable_type = 'LearningPath'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_course_worklow_clause}\n #{construct_name_sql}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning objectives\n SELECT DISTINCT\n cm.id,\n cm.name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_objective' AS content_type,\n cm.context_id::bigint AS learning_path_id,\n cm.id::bigint AS learning_objective_id\n FROM context_modules cm\n INNER JOIN courses c\n ON c.id = cm.context_id\n AND cm.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = cm.id AND ts.taggable_type = 'LearningObjective'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = cm.id AND cc.contentable_type = 'LearningObjective'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('cm')}\n #{construct_name_sql('cm')}\n #{construct_all_tags_search('t', 'name')}\n UNION ALL\n -- Search learning learning_event\n SELECT DISTINCT\n ct.id,\n ct.title AS name,\n c.course_code,\n c.settings,\n cc.content,\n 'learning_event' AS content_type,\n ct.context_id::bigint AS learning_path_id,\n ct.context_module_id::bigint AS learning_objective_id\n FROM content_tags ct\n INNER JOIN courses c\n ON c.id = ct.context_id\n AND ct.context_type = 'Course'\n LEFT OUTER JOIN fearless_taggings ts\n ON ts.taggable_id = ct.id AND ts.taggable_type = 'LearningEvent'\n LEFT OUTER JOIN fearless_tags t\n ON t.id = ts.tag_id\n LEFT OUTER JOIN fearless_custom_contents cc\n ON cc.contentable_id = ct.id AND cc.contentable_type = 'LearningEvent'\n WHERE 0=0\n #{construct_account_clause}\n #{construct_generic_workflow_clause('ct')}\n #{construct_name_sql('ct', 'title')}\n #{construct_all_tags_search('t', 'name')}\n SQL\n end", "def get_category_name\n Category.find(:first, :select => ['name'],:conditions=>['has_complexity=?',false]).name rescue ''\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"\nSELECT \nProjects.title,\nSUM(Pledges.amount)\nFROM Pledges\nINNER JOIN Projects\nON Pledges.project_id = Projects.id\nGROUP BY Projects.title\nORDER BY Projects.title\n\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(pledges.amount) \nFROM projects \nJOIN pledges \nON Projects.id = pledges.project_id \nGROUP BY title\"; \nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges \nON projects.id=pledges.project_id\nGROUP BY projects.id\nORDER BY projects.title;\"\nend", "def makeQueryTableAll(tableName)\n #sql = \"SELECT * FROM [\" << tableName << \"]\"\n sql = \"SELECT * FROM [\" << tableName << \"]\" << \" WHERE id < 3\"\n #puts(sql) #debug\n return sql\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n \"SELECT projects.title, sum_pledges FROM (SELECT pledges.project_id, SUM(pledges.amount) AS sum_pledges FROM pledges GROUP BY pledges.project_id) INNER JOIN projects ON projects.id = project_id ORDER BY projects.title\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n<<-SQL\nSELECT projects.title, SUM(pledges.amount) \nFROM projects \nINNER JOIN pledges on projects.id = pledges.project_id\nGROUP BY (pledges.project_id)\nORDER BY projects.title;\nSQL\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\r\n\"SELECT title, SUM(pledges.amount) FROM projects\r\nJOIN pledges ON projects.id = pledges.project_id\r\nGROUP BY projects.id\r\nORDER BY title ASC\"\r\nend", "def category_totals(db, user_name, number)\r\n\tretrieve_totals = '\r\n\tSELECT categories.name, SUM(amount) FROM expenses\r\n\tJOIN users ON expenses.user_id = users.id\r\n\tJOIN categories ON expenses.category_id = categories.id\r\n\tWHERE categories.id = ?\r\n\tAND users.name = ?'\r\n\ttotals = db.execute(retrieve_totals, [number, user_name])[0]\r\nend", "def add_category(db, category)\r\n\tnew_category = '\r\n\tINSERT INTO categories (name)\r\n\tVALUES (?)'\r\n\tdb.execute(new_category, [category])\r\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"Select title, amount from projects, pledges where projects.id = pledges.id order by title ASC;\"\nend", "def select_category\n #Parbauda vai ekrans ir redzams\n @screens.screen_create_filter.visible?\n #Pievieno kategoriju no filtra datiem\n @screens.screen_create_filter.select_row(@filter_data.category)\n end", "def projects_countries(site, category_id = nil, organization_id = nil, location_id = nil)\n if category_id.present? && category_id.to_i > 0\n if site.navigate_by_cluster?\n category_join = \"inner join clusters_projects as cp on cp.project_id = p.id and cp.cluster_id = #{category_id}\"\n else\n category_join = \"inner join projects_sectors as pse on pse.project_id = p.id and pse.sector_id = #{category_id}\"\n end\n end\n\n if organization_id.present? && organization_id.to_i > 0\n organization_filter = \"and p.primary_organization_id = #{organization_id}\"\n end\n\n if location_id.present?\n location_filter = \"and c.id IN (#{location_id})\"\n end\n\n Country.find_by_sql(\n<<-SQL\nselect c.id,c.name,count(ps.*) as count from countries as c\n inner join countries_projects as pr on c.id=pr.country_id #{location_filter}\n inner join projects as p on p.id=pr.project_id and (p.end_date is null OR p.end_date > now()) #{organization_filter}\n inner join projects_sites as ps on p.id=ps.project_id and ps.site_id=#{site.id}\n inner join donations as dn on dn.project_id = p.id\n #{category_join}\n where dn.donor_id = #{self.id}\n group by c.id, c.name order by count DESC\nSQL\n ).map do |r|\n [r, r.count.to_i]\n end\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id=pledges.project_id GROUP BY projects.title;\"\n## FROM - where are they talking to each other - where is the scotch tape\nend", "def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title,\n SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\n\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, \nSUM(pledges.amount) \nFROM projects\nJOIN pledges ON pledges.project_id = projects.id\nGROUP BY projects.title\nORDER BY projects.title ASC;\"\nend", "def select_all(sql, name = nil) end", "def select\n @pds_projects = PdsProject.includes(:company).where('ProjectID in (?)', PROJECT_LIST)\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(amount) AS pledge_amount\nFROM pledges\nJOIN projects\nWHERE pledges.project_id = projects.id\nGROUP BY project_id\nORDER BY projects.title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n <<-SQL\n SELECT\n title, sum(amount)\n FROM\n projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY\n title\n ORDER BY\n title\n SQL\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount )\nFROM projects \nJOIN pledges\nON projects.id = pledges.project_id \nGROUP BY projects.title \nORDER BY projects.title \";\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title,(SELECT SUM(pledges.amount))\n FROM projects\n INNER JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, sum(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY pledges.project_id\n ORDER BY projects.title ASC;\n \"\nend", "def db_fetch\n \"SELECT *\" + from_table_where + sql_match_conditions\n end", "def select_project\n @projects = Project.find(:all)\n end", "def get_category(cate, limitl, limitr)\n return Product.find_by_sql(\"select * from products where tag like '%#{cate}%' order by id limit #{limitl}, #{limitr}\")\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title \"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges\n ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY projects.title\nORDER BY projects.title;\"\nend", "def sql_statement_find\n @sql_statement_find ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :project_plan AS project_plan,\n application_data -> :why_selected_project AS why_selected_project,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice,\n hstore_to_json_loose(slice(application_data, ARRAY[:student0_attrs])) AS student0,\n hstore_to_json_loose(slice(application_data, ARRAY[:student1_attrs])) AS student1\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id\n AND applications.id = :id;\n SQL\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT Projects.title, SUM(Pledges.amount)\n FROM projects\n JOIN pledges\n ON Projects.id = Pledges.project_id\n GROUP BY project_id\n ORDER BY Projects.title\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\n FROM pledges\n INNER JOIN projects\n ON pledges.project_id = projects.id\n GROUP BY projects.title\n ORDER BY projects.title\n\"\nend", "def select(componentName, text, componentInfo=nil)\n $marathon.select(ComponentId.new(componentName, componentInfo), text.to_s)\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nJOIN pledges\nON projects.id = pledges.project_id\nGROUP BY projects.title;\"\nend", "def sql\n @sql ||= begin\n bind_params = []\n 1.upto(selector_keys.length + setter_keys.length) { |i| bind_params << \"$#{i}\" }\n %{SELECT #{name}(#{bind_params.join(', ')})}\n end\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM (pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id\nGROUP BY title\nORDER BY title ASC;\"\nend", "def getCat \n\t\tputs ''\n\t\tputs 'Fetching categories . . '\n\t\t@page.css('ul.dropdown li a').each do |cat|\n\t\t\tarr=[]\n\t\t\tarr.push cat.text\n\t\t\tarr.push cat['href']\n\t\t\t@arr_cat.push arr\n\t\t\tprint '. '\n\t\tend\n\t\ti=0\n\t\t@arr_cat.each do |pair|\n\t\t\t@db.execute 'insert into category values (?, ? ,?)', i, pair[0], pair[1]\n \t\t\ti +=1\n \t\tend\n\tend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT Projects.title, SUM(Pledges.amount) FROM Projects JOIN Pledges ON Pledges.project_id = Projects.id GROUP BY Projects.title;\"\nend", "def add_project_name_to_jql jql_string\n unless jql_string.empty?\n jql_string.insert(0, \"project=#{@project} AND \")\n else\n \"project=#{@project}\"\n end\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT title, SUM(amount) FROM pledges INNER JOIN projects ON projects.id = pledges.project_id GROUP BY projects.id ORDER BY title;\"\nend", "def search(category, query_term)\nresult = @conn.exec(\"SELECT * FROM students WHERE #{category} = '#{query_term}';\");\n puts student\n result.each do |student|\n puts \"#{k}: #{v}\"\n end\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n INNER JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY(projects.title);\"\nend", "def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end", "def show_categories(html_dsl)\r\n categories = Category.where(\"user_id = #{session[:user_id]} and category_id is null\").order('name ASC')\r\n category_html = create_category_table(categories)\r\n html_dsl.inject(category_html)\r\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, sum(pledges.amount) FROM projects INNER JOIN pledges on pledges.project_id=projects.id group by pledges.project_id ORDER BY projects.title ASC\"\nend", "def selects_all_female_bears_return_name_and_age\n <<-SQL \n SELECT \n bears.name, \n bears.age \n FROM bears \n WHERE sex='F';\n SQL\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON pledges.project_id=projects.id GROUP BY projects.title ORDER BY projects.title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nINNER JOIN pledges\nON projects.id = pledges.project_id GROUP BY projects.title;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_title\n # SELECT titles, amounts FROM projects, pledges ORDER BY titles ASC\n #SELECT titles.projects, pledges.amounts ORDER BY titles ASC\n \"SELECT projects.title, SUM(pledges.amount) FROM projects\n JOIN pledges \n ON pledges.project_id = projects.id \n GROUP BY(pledges.project_id)\n ORDER BY projects.title ASC\n \";\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n \"SELECT projects.title, SUM(pledges.amount)\n FROM projects\n JOIN pledges ON pledges.project_id = projects.id\n GROUP BY title\n ORDER BY title ASC;\"\nend", "def sql_statement_all\n @sql_statement_all ||=\n <<-SQL\n SELECT\n applications.id AS id,\n teams.name AS team_name,\n projects.name AS project_name,\n (application_data -> :project_id)::int AS project_id,\n application_data -> :signed_off_at AS signed_off_at,\n (application_data -> :signed_off_by)::int AS signed_off_by,\n application_data -> :mentor_fav AS mentor_fav,\n CASE WHEN :project_id::text = 'project1_id' THEN 1 ELSE 2 END AS choice\n FROM applications\n INNER JOIN teams\n ON teams.id = applications.team_id\n INNER JOIN projects\n ON projects.id::text = applications.application_data -> :project_id\n WHERE (application_data -> :project_id)::int IN (:project_ids)\n AND applications.season_id = :season_id;\n SQL\n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title ASC;\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"select\nprojects.title,\nsum(pledges.amount) as sum_all_pledges\nfrom projects\ninner join pledges\non projects.id = pledges.project_id\ngroup by projects.title\norder by projects.title;\n\"\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n \"SELECT projects.title, SUM(pledges.amount) \n FROM projects\n JOIN pledges\n ON pledges.project_id = projects.id\n GROUP BY projects.title;\"\nend", "def category_selection(category)\n category = Public_apis.find_by_name(category)\n #goes over list item array . find method to find item\n\n \n end", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT projects.title, SUM(pledges.amount)\nFROM projects\nLEFT JOIN pledges\nON projects.id=pledges.project_id\nGROUP BY projects.title\nORDER BY projects.title;\"\nend", "def select &blck\n @projects.select(&blck)\n end", "def select &blck\n @projects.select(&blck)\n end", "def frey_example\n # Find all the cats that are the same color as the cat named 'Freyja'.\n # Including 'Freyja' in the results.\n # DO NOT USE A SUBQUERY\n\n execute(<<-SQL)\n SELECT\n color_cats.name\n FROM\n cats AS freyja_cats\n JOIN\n cats AS color_cats ON freyja_cats.color = color_cats.color\n WHERE\n freyja_cats.name = 'Freyja';\n SQL\nend", "def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name\n\"SELECT p.title, SUM(pl.amount) FROM pledges pl INNER JOIN projects p ON pl.project_id = p.id GROUP BY pl.project_id ORDER BY p.title\"\nend" ]
[ "0.9197518", "0.706776", "0.69898534", "0.6650572", "0.6621777", "0.6515018", "0.64854777", "0.6322148", "0.6059388", "0.5941603", "0.59389925", "0.593695", "0.59016377", "0.5880613", "0.5871285", "0.585486", "0.58529305", "0.5841195", "0.58199084", "0.5782777", "0.57827556", "0.5701758", "0.56953365", "0.5691811", "0.5691811", "0.56894094", "0.5683459", "0.5681202", "0.5633809", "0.562923", "0.56213367", "0.5618941", "0.5615255", "0.5589999", "0.5582928", "0.5575638", "0.5574344", "0.5573058", "0.5567199", "0.5544849", "0.5541476", "0.5528279", "0.54875743", "0.54810876", "0.5480277", "0.5476625", "0.54759395", "0.5463565", "0.5460371", "0.54600877", "0.5450856", "0.5448225", "0.54340184", "0.54312897", "0.54307234", "0.5428893", "0.5426046", "0.542417", "0.5423315", "0.5416633", "0.5408265", "0.5393778", "0.53859967", "0.53835857", "0.53833157", "0.5382596", "0.5381724", "0.53738195", "0.5363149", "0.53525823", "0.53521425", "0.5349348", "0.53486735", "0.5348572", "0.53413576", "0.5339859", "0.5333289", "0.5332628", "0.53227234", "0.5320933", "0.5320139", "0.5311129", "0.5311129", "0.53076553", "0.5299439", "0.5297254", "0.52915144", "0.5287347", "0.52854675", "0.52850217", "0.5284946", "0.5284067", "0.52773285", "0.5274247", "0.52715194", "0.52691233", "0.525939", "0.525939", "0.52583504", "0.5255897" ]
0.5265008
96
Check if there's an event trigger in front of the player (when he presses A)
def check_event_trigger_there(triggers) return false if $game_system.map_interpreter.running? result = false d = @direction new_x = @x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y = @y + (d == 2 ? 1 : d == 8 ? -1 : 0) + (@direction == 4 ? slope_check_left(false) : @direction == 6 ? slope_check_right(false) : 0) z = @z $game_map.events.each_value do |event| next unless event.contact?(new_x, new_y, z) && triggers.include?(event.trigger) next if event.jumping? || event.over_trigger? event.start result = true end z = @z return true if result # Try the event one tile after the front tile if it's a counter tile if $game_map.counter?(new_x, new_y) new_x2 = new_x + (d == 6 ? 1 : d == 4 ? -1 : 0) new_y2 = new_y + (d == 2 ? 1 : d == 8 ? -1 : 0) $game_map.events.each_value do |event| next unless event.contact?(new_x2, new_y2, z) && triggers.include?(event.trigger) next if event.jumping? || event.over_trigger? event.start result = true end end return true if result check_common_event_trigger_there(new_x, new_y, z, d) result ||= check_follower_trigger_there(new_x, new_y) if @follower return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def caught_by_player?\n return flags.anybits?(FLAG_CAUGHT_BY_PLAYER)\n end", "def check_event_trigger_here(triggers)\n persona_check_event_trigger_here(triggers)\n $persona.set_transparent($game_player.screen_x > 450) if $persona != nil\n end", "def check_event_trigger_at(x, y)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # if player touched this event and not jumping and not over_trigger\n if !jumping? && !over_trigger? && $BlizzABS.util.rect_intersection(\n Rect.new(@x * pix, @y * pix, pix, pix), Rect.new(x, y, pix, pix))\n # start\n start\n # started\n return true\n end\n # not started\n return false\n end", "def check_batevent_trigger\n return if @active_battler == nil\n for event in $game_system.battle_events.values\n if [0,1,2].include?(event.trigger) #on player touch or event touch\n if event.at_xy_coord(@active_battler.x, @active_battler.y)\n if event.list.size > 0\n event.start unless event.starting\n return\n end\n end\n end\n end\n end", "def check_event_trigger_auto\n # if triggered by event touch\n if @trigger == 2\n # check player touch\n return check_event_trigger_at($game_player.x, $game_player.y)\n # if autorun\n elsif @trigger == 3\n # start\n start\n # started\n return true\n end\n # not started\n return false\n end", "def event?\n\t\t\t\t(strings.first.match(/player\\./) || strings.first.match(/punkBuster/)) ? true : false\n\t\t\tend", "def check_event_trigger_here(triggers)\n # not started if already running\n return false if $game_system.map_interpreter.running?\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # initialize result\n result = false\n # iterate through all events\n $game_map.events.each_value {|event|\n # if coordinates fit and can be triggered and not jumping\n if event.x == (player.x+pix/2)/pix &&\n event.y == (player.y+pix/2)/pix &&\n triggers.include?(event.trigger) && !event.jumping? &&\n event.over_trigger?\n # start event\n event.start\n # events were started\n result = true\n end}\n # return result\n return result\n end", "def pressed?() sdl_event.press end", "def from_front?\n dir1 = get_character(-1).direction\n dir2 = get_character(@event_id).prelock_direction\n return dir1 == 10 - dir2\n end", "def tb_event_still?\n !@tb_event || !@tb_event.move_route_forcing\n end", "def update_action_trigger\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Same position and front event determinant\r\n check_event_trigger_here([0])\r\n check_event_trigger_there([0,1,2])\r\n end\r\n end", "def event_running?\n @battle_event.active?\n end", "def check_event_trigger_there(triggers)\n result = false\n # If event is running\n if $game_system.map_interpreter.running?\n return result\n end\n # Calculate front event coordinates\n new_x = @x + (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)\n new_y = @y + (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)\n # All event loops\n for event in $game_map.events.values\n # If event coordinates and triggers are consistent\n if event.x == new_x and event.y == new_y and\n triggers.include?(event.trigger)\n # If starting determinant is front event (other than jumping)\n if not event.jumping? and not event.over_trigger?\n event.start\n result = true\n end\n end\n end\n # If fitting event is not found\n if result == false\n # If front tile is a counter\n if $game_map.counter?(new_x, new_y)\n # Calculate 1 tile inside coordinates\n new_x += (@direction == 6 ? 1 : @direction == 4 ? -1 : 0)\n new_y += (@direction == 2 ? 1 : @direction == 8 ? -1 : 0)\n # All event loops\n for event in $game_map.events.values\n # If event coordinates and triggers are consistent\n if event.x == new_x and event.y == new_y and\n triggers.include?(event.trigger)\n # If starting determinant is front event (other than jumping)\n if not event.jumping? and not event.over_trigger?\n event.start\n result = true\n end\n end\n end\n end\n end\n return result\n end", "def check_event_trigger_there(triggers)\r\r\n x2 = $game_map.round_x_with_direction(@x, @direction)\r\r\n y2 = $game_map.round_y_with_direction(@y, @direction)\r\r\n start_map_event(x2, y2, triggers, true, interaction_rect)\r\r\n return if $game_map.any_event_starting?\r\r\n return unless $game_map.counter?(x2, y2)\r\r\n x3 = $game_map.round_x_with_direction(x2, @direction)\r\r\n y3 = $game_map.round_y_with_direction(y2, @direction)\r\r\n start_map_event(x3, y3, triggers, true, interaction_rect)\r\r\n end", "def check_event_trigger_there(triggers)\n # not started if already running\n return false if $game_system.map_interpreter.running?\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # calculate new coordinates\n nx = player.x + (player.direction == 6 ? 1 : player.direction == 4 ? -1 : 0)*pix\n ny = player.y + (player.direction == 2 ? 1 : player.direction == 8 ? -1 : 0)*pix\n # initialize result\n result = false\n # iterate through all events\n $game_map.events.each_value {|event|\n # if triggered by touch and trigger started the event\n if triggers.include?(event.trigger) &&\n event.check_event_trigger_at(nx, ny)\n # events were started\n result = true\n end}\n # if event was not started and counter\n if !result && $game_map.pixel_counter?(nx, ny)\n # change new coordinates\n nx += (player.direction == 6 ? 1 : player.direction == 4 ? -1 : 0)*pix\n ny += (player.direction == 2 ? 1 : player.direction == 8 ? -1 : 0)*pix\n # iterate through all events\n $game_map.events.each_value {|event|\n # if triggered by touch and trigger started the event\n if triggers.include?(event.trigger) &&\n event.check_event_trigger_at(nx, ny)\n # events were started\n result = true\n end}\n end\n # return result\n return result\n end", "def pressed?\n low?\n end", "def check_event_trigger_touch(x, y)\n return if $game_map.interpreter.running?\n if @trigger == 2 and $game_player.pos?(x, y)\n start if not jumping? and @priority_type == 1\n end\n end", "def check_event_trigger_touch_front\r\n x2 = $game_map.round_x_with_direction(@x, @direction)\r\n y2 = $game_map.round_y_with_direction(@y, @direction)\r\n check_event_trigger_touch(x2, y2)\r\n end", "def check_event_trigger_on_region_enter\n start if @trigger == 8 && trigger_ext.include?($game_player.region_id)\n end", "def check_follower_trigger_there(new_x, new_y)\n if @follower.x == new_x && @follower.y == new_y\n if @follower.is_a?(Game_Event)\n @follower.start\n else\n @follower.turn_toward_player\n $game_temp.common_event_id = Game_CommonEvent::FOLLOWER_SPEECH\n end\n return true\n end\n return false\n end", "def atb_press_valid\n if @selected == @active_battler\n #open menu actor\n actor_menu_open\n #@windows[Win_Help].show\n disable_cursor\n else\n #move cursor to active battler\n Sound.play_decision\n set_active_cursor\n end\n end", "def player_push_button(event)\n if ((event.x - 180)**2 + (event.y - 810)**2).abs <= 8100\n @player_playing = 0\n elsif ((event.x - 1180)**2 + (event.y - 810)**2).abs <= 8100\n @player_playing = 1\n \n else\n @player_playing = -1\n end\n end", "def taken?( player_input )\n position( player_input ) =~ /[XO]/ ? true : false\n end", "def active?\n return extender_active? if not in_battle?\n @event.for_battle? && @event.battle_trigger.call()\n end", "def check_event_trigger_here(triggers)\n return false\n end", "def can_trigged?(event)\n false\n end", "def check_event_trigger_here(triggers)\n result = false\n # If event is running\n if $game_system.map_interpreter.running?\n return result\n end\n # All event loops\n for event in $game_map.events.values\n # If event coordinates and triggers are consistent\n if event.x == @x and event.y == @y and triggers.include?(event.trigger)\n # If starting determinant is same position event (other than jumping)\n if not event.jumping? and event.over_trigger?\n event.start\n result = true\n end\n end\n end\n return result\n end", "def check_event_trigger_touch(x, y)\n return false if $game_system.map_interpreter.running?\n result = false\n z = @z\n\n $game_map.events.each_value do |event|\n next unless event.contact?(x, y, z) && [1, 2].include?(event.trigger)\n next if event.jumping? || event.over_trigger?\n event.start\n result = true\n end\n return result\n end", "def check_event_trigger_touch(x, y)\n # stop check if map interpreter is already running\n return false if $game_system.map_interpreter.running? || @trigger != 2\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # if player touched this event and not jumping and not over_trigger\n if !jumping? && !over_trigger? &&\n $BlizzABS.util.rect_intersection(Rect.new(x * pix, y * pix, pix, pix),\n Rect.new($game_player.x, $game_player.y, pix, pix))\n # start\n #raise @trigger.to_s\n start\n # started\n return true\n end\n # not started\n return false\n end", "def check_event_trigger_there(triggers)\n return false\n end", "def check_event_trigger_touch(x, y)\r\r\n return if $game_map.interpreter.running?\r\r\n if @trigger == 2 && $game_player.pos_rect?(x, y, $game_player.collision_rect)\r\r\n start if !jumping? && normal_priority?\r\r\n end\r\r\n end", "def check_event_trigger_touch(x, y)\n result = false\n # If event is running\n if $game_system.map_interpreter.running?\n return result\n end\n # All event loops\n for event in $game_map.events.values\n # If event coordinates and triggers are consistent\n if event.x == x and event.y == y and [1,2].include?(event.trigger)\n # If starting determinant is front event (other than jumping)\n if not event.jumping? and not event.over_trigger?\n event.start\n result = true\n end\n end\n end\n return result\n end", "def check_event_trigger_here(triggers)\n result = false\n return result\n end", "def check_event_trigger_touch_front\r\r\n d = @direction\r\r\n horz = (d - 1) % 3 - 1\r\r\n vert = 1 - ((d - 1) / 3)\r\r\n pixelstep = CXJ::FREE_MOVEMENT::PIXELS_PER_STEP / 32.0\r\r\n x2 = $game_map.round_x(x + horz * pixelstep)\r\r\n y2 = $game_map.round_y(y + vert * pixelstep)\r\r\n check_event_trigger_touch(x2, y2)\r\r\n end", "def event_running?\n get_scene.event_running?\n end", "def not_pressed?\n high?\n end", "def check_player_leave_event\n check_event_trigger_before([5])\n end", "def from_player?\n return flags.anybits?(FLAG_CAUGHT_BY_PLAYER)\n end", "def check_event_trigger_there(triggers)\n result = false\n return result\n end", "def update_encounter\r\n # Event determinant is via touch of same position event\r\n result = check_event_trigger_here([1,2])\r\n # If event which started does not exist\r\n if result == false\r\n # Disregard if debug mode is ON and ctrl key was pressed\r\n unless $DEBUG and Input.press?(Input::CTRL)\r\n # Encounter countdown\r\n if @encounter_count > 0\r\n @encounter_count -= 1\r\n end\r\n end\r\n end\r\n end", "def collide_with_events?(x, y)\r\n $game_map.events_xy_nt(x, y).any? do |event|\r\n event.normal_priority? || self.is_a?(Game_Event)\r\n end\r\n end", "def pbEventFacesPlayer?(event,player,distance)\n return false if distance<=0\n # Event can't reach player if no coordinates coincide\n return false if event.x!=player.x && event.y!=player.y\n deltaX = (event.direction == 6 ? 1 : event.direction == 4 ? -1 : 0)\n deltaY = (event.direction == 2 ? 1 : event.direction == 8 ? -1 : 0)\n # Check for existence of player\n curx=event.x\n cury=event.y\n found=false\n for i in 0...distance\n curx+=deltaX\n cury+=deltaY\n if player.x==curx && player.y==cury\n found=true\n break\n end\n end\n return found\nend", "def key_pressed?(key)\n SDL::Key.press?(key)\n end", "def check_common_event\r\n SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?\r\n end", "def pbEventFacesPlayer?(event,player,distance)\n return false if distance<=0\n # Event can't reach player if no coordinates coincide\n return false if event.x!=player.x && event.y!=player.y\n deltaX = (event.direction==6) ? 1 : (event.direction==4) ? -1 : 0\n deltaY = (event.direction==2) ? 1 : (event.direction==8) ? -1 : 0\n # Check for existence of player\n curx = event.x\n cury = event.y\n found = false\n for i in 0...distance\n curx += deltaX\n cury += deltaY\n if player.x==curx && player.y==cury\n found = true\n break\n end\n end\n return found\nend", "def did_player_win?\n if @players_1_turn\n did_mark_win?(PLAYERS_1_MARK)\n else\n did_mark_win?(PLAYERS_2_MARK)\n end\n end", "def show_menu_if_no_tb(x,y)\n return false if !@menu_ok_tb\n @menu_ok_tb = false\n (e=(map=$game_map).events[map.tbu_1st_xy(x,y)]).nil? ? true : false\n end", "def over?\n if controller.contains?(*controller.translate_absolute(x, y))\n # the event occurred within this component's local space\n @over = true\n end\n end", "def check_attack_condition?\n # attack button enabled and attack button is pressed\n return ($game_system.attack_button && Input.trigger?(Input::Attack))\n end", "def check_event_trigger_auto\n start if @trigger == 3\n end", "def prev_event?\n !@prev_event.blank?\n end", "def event?\n entry_type == :event\n end", "def playing?\n self.in_progress? or self.caught_up?\n end", "def from_side?\n dir1 = get_character(-1).direction\n dir2 = get_character(@event_id).prelock_direction\n diff = (dir1 - dir2).abs\n return diff == 2 || diff == 4\n end", "def game_over?\n true\n end", "def inputable?\r\n normal? && !auto_battle?\r\n end", "def first_is_trigger?(page)\n return false unless $game_map.events.has_key?(self.id)\n return false unless page || page.list || page.list[0]\n return false unless page.list[0].code == 355\n script = page.list[0].parameters[0] + \"\\n\"\n index = 1\n while page.list[index].code == 655\n script += page.list[index].parameters[0] + \"\\n\"\n index += 1\n end\n if script =~ /^\\s*(trigger|listener)/\n script = script.gsub(/S(V|S)\\[(\\d+)\\]/) { \"S#{$1}[#{@id}, #{$2}]\" }\n potential_trigger = eval(script)\n return potential_trigger if potential_trigger.is_a?(Proc)\n elsif script =~ /^\\s*(ignore_left)/\n script = script.gsub(/S(V|S)\\[(\\d+)\\]/) { \"S#{$1}[#{@id}, #{$2}]\" }\n potential_trigger = eval(script)\n return [potential_trigger, :ign] if potential_trigger.is_a?(Proc)\n end\n return false\n end", "def tb_party_event?\n pty = $game_party\n pty.members.each{|a| return true if a.name.eql?(@event.name)}\n return false\n end", "def trigger? key=:any\n return @data.include? :down if key == :any\n @data[key] == :down\n end", "def key_pressed?\n @declared_fields['keyPressed'].value(java_self)\n end", "def going?(event)\n attended_events.include?(event)\n end", "def check_player_region_enter_events\n $game_map.events.each_value do |event|\n event.check_event_trigger_on_region_enter\n end\n end", "def is_acting_player?\n\t\t\t@_iap ||= @state_hash['state']['acting_player']['id'] == @player_id\n\t\tend", "def is_acting_player?\n\t\t\t@_iap ||= @state_hash['state']['acting_player']['id'] == @player_id\n\t\tend", "def check_event_trigger_touch(x, y)\n # not started if already running\n return false if $game_system.map_interpreter.running?\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # initialize result\n result = false\n # iterate through all events\n $game_map.events.each_value {|event|\n # if triggered by touch and trigger started the event\n if Cache::TouchTrigger.include?(event.trigger) &&\n event.check_event_trigger_at(x, y)\n # events were started\n result = true\n end}\n # return result\n return result\n end", "def check_common_event_trigger_there(new_x, new_y, z, d)\n sys_tag = system_tag\n # Dive\n if terrain_tag == 6 && DIVE_TILE.include?(sys_tag)\n $game_temp.common_event_id = Game_CommonEvent::DIVE\n # Headbutt\n elsif $game_map.system_tag(new_x, new_y) == HeadButt\n $game_temp.common_event_id = Game_CommonEvent::HEADBUTT\n # Surf\n elsif $game_map.passable?(x, y, d, nil) && \n $game_map.passable?(new_x = @x + (d == 6 ? 1 : d == 4 ? -1 : 0), new_y = @y + (d == 2 ? 1 : d == 8 ? -1 : 0), 10 - d, self) && \n z <= 1\n sys_tag = $game_map.system_tag(new_x, new_y)\n $game_temp.common_event_id = Game_CommonEvent::SURF_ENTER if !@surfing && SurfTag.include?(sys_tag)\n end\n end", "def event?\n !! @event\n end", "def pbHeadbutt(event=nil)\n event = $game_player.pbFacingEvent(true)\n move = :HEADBUTT\n movefinder = $Trainer.get_pokemon_with_move(move)\n if !$DEBUG && !movefinder\n pbMessage(_INTL(\"A Pokémon could be in this tree. Maybe a Pokémon could shake it.\"))\n return false\n end\n if pbConfirmMessage(_INTL(\"A Pokémon could be in this tree. Would you like to use Headbutt?\"))\n speciesname = (movefinder) ? movefinder.name : $Trainer.name\n pbMessage(_INTL(\"{1} used {2}!\",speciesname,GameData::Move.get(move).name))\n pbHiddenMoveAnimation(movefinder)\n pbHeadbuttEffect(event)\n return true\n end\n return false\nend", "def event_passable_check?(new_x, new_y, z, game_map)\n game_map.events.each_value do |event|\n next unless event.contact?(new_x, new_y, z)\n next if event.through\n return false unless event.character_name.empty?\n end\n return true\n end", "def pressed?(key)\n @input[key].detect { |k| @game.button_down?(k) }\n end", "def playing?\n self.play_start != nil\n end", "def can_fight?\n @position && !dead?\n end", "def from_left?\n dir1 = get_character(-1).direction\n dir2 = get_character(@event_id).prelock_direction\n return ((10 - dir1) * 2) % 10 == dir2\n end", "def checkTrigger\n\t end", "def front_event_calling(common_event)\n event = $game_player.front_tile_event\n if event&.list\n @event_id = event.id if @event_id == 0\n i = 0\n i += 1 while FEC_SKIP_CODES.include?(event.list[i]&.code)\n return true if event.list[i] && event.list[i].code == 117 && event.list[i].parameters[0] == common_event\n end\n return false\n end", "def listen?\n @paused == false\n end", "def can_move?\n return false if @tb_event.nil?\n @tb_event.tb_unit.can_move?\n end", "def over?\n \t@game_over = true\n end", "def moving?\n $window.button_down?(Gosu::KbS) || $window.button_down?(Gosu::KbD) || $window.button_down?(Gosu::KbW) || $window.button_down?(Gosu::KbA)\n end", "def item_hotkeys?\n # find all triggered keys\n triggered = BlizzABS::Cache::Keys.find_all {|i|\n Input.trigger?(Input::Key[i.to_s]) &&\n $game_player.item_hotkeys[i] != 0}\n # no usage if usage invalid\n return false if triggered.size == 0\n # set as usable item\n $game_player.battler.item = $game_player.item_hotkeys[triggered[0]]\n # allow usage\n return true\n end", "def collide_with_events?(x, y)\r\r\n $game_map.events_xy_rect_nt(x, y, collision_rect).any? do |event|\r\r\n (event.normal_priority? || self.is_a?(Game_Event)) && event != self\r\r\n end\r\r\n end", "def collide_with_events?(x, y)\n $game_map.events_xy_nt(x, y).any? do |event|\n return true if event.page.event_block\n return false if event.through\n return event.priority_type == self.priority_type\n end\n end", "def cursor_movable?\n active && open?\n end", "def eventless?\n ! @event\n end", "def did_player_win\n (@purses[@current_player] != 6)\n end", "def over?\n self.player.points == self.board.total_points\n end", "def event_passable?(x, y)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # iterate trough all events\n self.events_only.each {|event|\n # if there's an event that's no enemy/actor/dropped item and not through\n if event.tile_id >= 0 && event.x == x / pix && event.y == y / pix &&\n !event.through\n # if obstacle bit is set\n if @passages[event.tile_id] & 0x0F == 0x0F\n # impassable tile in the given direction\n return false\n # if priority is 0\n elsif @priorities[event.tile_id] == 0\n # passable in the given direction\n return true\n end\n end}\n # passable\n return true\n end", "def waiting_event?\r\n return false unless @move_route_waiting\r\n # If we're waiting for a specific event\r\n if @move_route_waiting_id\r\n return true if @move_route_waiting_id == 0 && $game_player.move_route_forcing\r\n wanted_event = $game_map.events[@move_route_waiting_id]\r\n return true if wanted_event&.move_route_forcing || wanted_event&.path\r\n @move_route_waiting = false\r\n @move_route_waiting_id = nil\r\n return false\r\n end\r\n # Otherwise we're waiting for all event\r\n return true if $game_player.move_route_forcing\r\n return true if $game_map.events.any? { |_, event| event.move_route_forcing }\r\n @move_route_waiting = false\r\n return false\r\n end", "def event_check(x, y, d, self_event = nil)\n # get pixel movement rate and set bit\n pix, bit = $BlizzABS.pixel, (1 << (d / 2 - 1)) & 0x0F\n # iterate trough all events except self\n (self.events_only - [self_event]).each {|event|\n # if there's an event that's not through and has a graphic\n if event.character_name != \"\" && event.x == x / pix && \n event.y == y / pix && !event.through &&\n (!self_event.is_a?(Map_Battler) || event.tile_id >= 384)\n # if obstacle bit is set\n if @passages[event.tile_id] & bit != 0\n # get x and y of next tile\n case d\n when 2 then nx, ny = x / pix, (y + 1) / pix\n when 4 then nx, ny = (x - 1) / pix, y / pix\n when 6 then nx, ny = (x + 1) / pix, y / pix\n when 8 then nx, ny = x / pix, (y - 1) / pix\n else\n nx = ny = nil\n end\n # impassable if not on the same tile anymore\n return false if x / pix != nx || y / pix != ny\n # if obstacle bit is set in all directions\n elsif @passages[event.tile_id] & 0x0F == 0x0F\n # impassable in the given direction\n return false\n # if priority is 0\n elsif @priorities[event.tile_id] == 0\n # passable in the given direction\n return true\n # if event is not a tile and not through\n elsif !event.through\n # impassable in any direction\n return false\n end\n end}\n # passable\n return true\n end", "def trigger?(key)\n return @trigger[ key.is_a?(Symbol) ? KEY.get(key) : key ] \n end", "def onalg_player_has_moved(player,color, start_x, start_y, end_x, end_y)\r\n if player != @alg_player\r\n \r\n end\r\n end", "def press? key=:any\n return @data.include? :on if key == :any\n @data[key] != :off\n end", "def is_league_event?\n !self.fixture.nil?\n end", "def check_make_tbe_nil(x=$game_player.x,y=$game_player.y)\n e=(map=$game_map).events[map.tbu_1st_xy(x,y)]\n turn_off_flash_tbe\n @tb_event = e if e.nil? || e.tb_unit.battler.nil?\n @tb_event\n end", "def royal_flush?\n straight_flush? && @hand.include?('A')\n end", "def cursor_no_select\n if Input.trigger?(Input::B)\n check_area \n return true\n elsif Input.trigger?(Input::C) \n clear_tr_sprites\n if @ATB_Active\n atb_press_valid\n else#TEAM Mode\n team_mode_press_valid\n end\n return true\n end \n end", "def active?\r\n @event.parallel? && $game_switches[@event.switch_id]\r\n end", "def lead_player \n l1 = left(@on_move)\n if @played[l1] == nil \n return nil #\n end \n end", "def someone_won?\n !!winnning_marker\n end", "def game_paused? ; @game_paused end" ]
[ "0.7001514", "0.6990527", "0.6971675", "0.68726254", "0.6768065", "0.6698392", "0.6646353", "0.66405004", "0.66021943", "0.65949994", "0.65643847", "0.65324986", "0.65050185", "0.6500237", "0.63973325", "0.6389508", "0.6387996", "0.63854766", "0.6378297", "0.6371732", "0.63652694", "0.63418525", "0.63370466", "0.6334706", "0.633087", "0.6308415", "0.62957925", "0.6275102", "0.624689", "0.62347335", "0.62158", "0.6204619", "0.61750925", "0.6161003", "0.6119556", "0.61058575", "0.6098994", "0.6094446", "0.6092159", "0.60912156", "0.6083035", "0.6079475", "0.60529035", "0.6023105", "0.6020159", "0.6012766", "0.6009741", "0.600669", "0.6004933", "0.6002001", "0.59922516", "0.59810674", "0.5925237", "0.59124863", "0.5907746", "0.59007394", "0.589908", "0.58819586", "0.5881686", "0.58790034", "0.58719784", "0.583333", "0.58312964", "0.58312964", "0.58252704", "0.5819262", "0.5810486", "0.5807525", "0.58005935", "0.57993954", "0.57959676", "0.57897425", "0.5765768", "0.57528216", "0.5752461", "0.574614", "0.5744246", "0.5734813", "0.57341117", "0.5730504", "0.5707475", "0.5695759", "0.56949985", "0.5690723", "0.5687088", "0.5685962", "0.56854063", "0.5682584", "0.5681669", "0.56766313", "0.5676182", "0.5673353", "0.56724364", "0.56696177", "0.5669106", "0.5666103", "0.5660511", "0.5657086", "0.5653603", "0.56535906" ]
0.6252339
28
Check the common event call
def check_common_event_trigger_there(new_x, new_y, z, d) sys_tag = system_tag # Dive if terrain_tag == 6 && DIVE_TILE.include?(sys_tag) $game_temp.common_event_id = Game_CommonEvent::DIVE # Headbutt elsif $game_map.system_tag(new_x, new_y) == HeadButt $game_temp.common_event_id = Game_CommonEvent::HEADBUTT # Surf elsif $game_map.passable?(x, y, d, nil) && $game_map.passable?(new_x = @x + (d == 6 ? 1 : d == 4 ? -1 : 0), new_y = @y + (d == 2 ? 1 : d == 8 ? -1 : 0), 10 - d, self) && z <= 1 sys_tag = $game_map.system_tag(new_x, new_y) $game_temp.common_event_id = Game_CommonEvent::SURF_ENTER if !@surfing && SurfTag.include?(sys_tag) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def common_event_reserved?\n !@reserved_common_events.empty?\n end", "def check_common_event\r\n SceneManager.goto(Scene_Map) if $game_temp.common_event_reserved?\r\n end", "def common_event_reserved?\r\n @common_event_id > 0\r\n end", "def common_event_reserved?\n @common_event_id > 0\n end", "def event_calling(common_event, event_id)\n if (event = $game_map.events[event_id]) && event.list\n i = 0\n i += 1 while FEC_SKIP_CODES.include?(event.list[i]&.code)\n return true if event.list[i] && event.list[i].code == 117 && event.list[i].parameters[0] == common_event\n end\n return false\n end", "def setup_reserved_common_event\r\n if $game_temp.common_event_reserved?\r\n setup($game_temp.reserved_common_event.list)\r\n $game_temp.clear_common_event\r\n true\r\n else\r\n false\r\n end\r\n end", "def front_event_calling(common_event)\n event = $game_player.front_tile_event\n if event&.list\n @event_id = event.id if @event_id == 0\n i = 0\n i += 1 while FEC_SKIP_CODES.include?(event.list[i]&.code)\n return true if event.list[i] && event.list[i].code == 117 && event.list[i].parameters[0] == common_event\n end\n return false\n end", "def valid_event(event, args)\n true\n end", "def validate_event; end", "def update_global_common_events\n end", "def check_event_trigger_here(triggers)\n return false\n end", "def verify(event_data)\n true\n end", "def raise_event?( some_event)\n reserved_section_events = self.section.global_event_array\n reserved_section_events.include? some_event.event_name\n end", "def pbCommonEvent(id)\n return false if id<0\n ce = $data_common_events[id]\n return false if !ce\n celist = ce.list\n interp = Interpreter.new\n interp.setup(celist,0)\n begin\n Graphics.update\n Input.update\n interp.update\n pbUpdateSceneMap\n end while interp.running?\n return true\nend", "def check_event_trigger_there(triggers)\n return false\n end", "def pbCommonEvent(id)\n return false if id<0\n ce=$data_common_events[id]\n return false if !ce\n celist=ce.list\n interp=Interpreter.new\n interp.setup(celist,0)\n begin\n Graphics.update\n Input.update\n interp.update\n pbUpdateSceneMap\n end while interp.running?\n return true\nend", "def event_requirement; end", "def event?(event)\n event_names.include?(event.to_s)\n end", "def checkTrigger\n\t end", "def call_common_event(id)\n if $imported[\"TH_SceneInterpreter\"] == true\n @interpreter.setup($data_common_events[id].list)\n @phone_command.activate\n else\n dispose_phone_background\n @phone_command.dispose\n $game_temp.reserve_common_event(id)\n SceneManager.return\n end\n end", "def check_event_trigger_touch(x, y)\n return false\n end", "def check_event_trigger_here(triggers)\n result = false\n return result\n end", "def validate_event=(_arg0); end", "def event_dispatch_thread?\n super\n end", "def event_dispatch_thread?\n super\n end", "def check_event_trigger_touch(x, y)\r\n return false\r\n end", "def event?\n @events_mutex.synchronize do\n !@events.empty?\n end\n end", "def check_event_trigger_touch(x, y)\n result = false\n return result\n end", "def event_change\n\t\n\tend", "def check_event_trigger_there(triggers)\n result = false\n return result\n end", "def event; end", "def event; end", "def event; end", "def event_received(sequence)\n false # return true if we handled the event here\n end", "def call\n catch_event unless no_event_possible?\n end", "def is_expected(event)\n # TODO Implement this\n end", "def treat_event(event)\n case event.type\n when \"entry\"\n entry(event)\n when \"exit\"\n exit(event)\n when \"transfer\"\n transfer(event)\n end\n return true\n rescue OutOfRandomsError => e\n return false\n end", "def do_event_action\n if self.casetype == 'order' || self.casetype == 'abandoned_cart' || self.casetype == 'preorder'\n puts \"Case do_event_action start\"\n events = Event.where(casetype: self.casetype)\n if events.present?\n puts \"case do_event_action\"\n user = User.find_by_subdomain(Apartment::Tenant.current)\n events.each do |event|\n Services::EventAction.do_action(user, event, self)\n end\n end\n puts \"Case do_event_action finish\"\n end\n end", "def event?\n !! @event\n end", "def subscribe_event?( some_event)\n section_events = self.section.subscribed_global_event_array\n section_events.include? some_event.event_name\n end", "def check_emission_validity # :nodoc:\n \t super\n \trescue EventNotExecutable => e\n\t refine_emit_exception(e)\n \tend", "def check_emission_validity # :nodoc:\n \t super\n \trescue EventNotExecutable => e\n\t refine_emit_exception(e)\n \tend", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def events; end", "def has_event?(event_model)\n\t bound_events.has_key?(event_model)\n\tend", "def get_event_or_exit\n end", "def event_raised?(event_name, mode = :instance, *args)\n mc = event_raises[mode][event_name.to_s.to_sym] \n if mc\n vari = mc.find_argument_variations(args)\n result = vari.any? { |agv| agv == args }\n return result if result\n if args.size == 1 and args.last.is_a?(Hash)\n result = vari.any? do |agv|\n agv.args.last.is_a?(Hash) and args.last.all? { |k, v| agv.args.last[k] == v }\n end\n end\n @event_error = \"Event Arguments don't match for #{event_name}.\\n\\nYou expected:\\n#{args.join(\", \")}.\\n\\nI did find the following variations:\\n#{mc.args.collect {|ar| ar.args.join(', ') }.join(' and ')}\" unless result\n result\n else\n @event_error = \"Couldn't find an event with name #{event_name}\"\n return !!mc\n end\n end", "def _check_events(events)\n events.each do |evt|\n raise NanoMind::Errors::DSLError, \"Unknown event '#{evt}'\" unless\n NanoMind::Core::Layers::Events::EVENTS.include?(evt)\n end\n end", "def event?\n entry_type == :event\n end", "def validate\n notify_devs and return false if @client_id < 1 ||\n Event.sources.keys.exclude?(@event_source) ||\n Event.names.keys.exclude?(@event_name) ||\n @event_data.blank? ||\n @event_timestamp == 0 ||\n Event::NAME_CONFIG[@event_name.to_s][:inavlid_source].include?(@event_source)\n true\n end", "def check_call_validity # :nodoc:\n begin\n super\n rescue UnreachableEvent\n end\n\n if task.failed_to_start?\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} but the task has failed to start: #{task.failure_reason}\"\n elsif task.event(:stop).emitted?\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} but the task has finished. Task has been terminated by #{task.event(:stop).history.first.sources}.\"\n elsif task.finished? && !terminal?\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} but the task has finished. Task has been terminated by #{task.event(:stop).history.first.sources}.\"\n elsif task.pending? && symbol != :start\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} but the task has never been started\"\n elsif task.running? && symbol == :start\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{execution_engine.propagation_sources.to_a} but the task is already running. Task has been started by #{task.event(:start).history.first.sources}.\"\n end\n\n \trescue EventNotExecutable => e\n\t refine_call_exception(e)\n\tend", "def callwide_events()\n on :event => 'error', :next => '/error.json' # For fatal programming errors. Log some details so we can fix it\n on :event => 'hangup', :next => '/hangup.json' # When a user hangs or call is done. We will want to log some details.\nend", "def processEvent(eventName)\n\tend", "def event? eve\n @_events.include? eve\n end", "def event?\n type == :event_id\n end", "def event?\n type == :event_id\n end", "def valid_for_push?\n\t\t\t [:after_create].include? self.event.to_sym\n\t\t\tend", "def qualified_event; end", "def qualified_event; end", "def reserved_common_event\r\n $data_common_events[@common_event_id]\r\n end", "def can_trigged?(event)\n false\n end", "def define_event_helpers; end", "def check_call_validity # :nodoc:\n begin\n super\n rescue UnreachableEvent\n end\n\n if task.failed_to_start?\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{plan.engine.propagation_sources.to_a} but the task has failed to start: #{task.failure_reason}\"\n elsif task.event(:stop).happened?\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{plan.engine.propagation_sources.to_a} but the task has finished. Task has been terminated by #{task.event(:stop).history.first.sources}.\"\n elsif task.finished? && !terminal?\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{plan.engine.propagation_sources.to_a} but the task has finished. Task has been terminated by #{task.event(:stop).history.first.sources}.\"\n elsif task.pending? && symbol != :start\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{plan.engine.propagation_sources.to_a} but the task has never been started\"\n elsif task.running? && symbol == :start\n raise CommandFailed.new(nil, self), \n\t\t \"#{symbol}! called by #{plan.engine.propagation_sources.to_a} but the task is already running. Task has been started by #{task.event(:start).history.first.sources}.\"\n end\n\n \trescue EventNotExecutable => e\n\t refine_call_exception(e)\n\tend", "def event?(name)\n @events.keys.include?(name.to_sym)\n end", "def send_events; end", "def can_event?(step)\n model_events.include? step&.to_sym\n end", "def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end", "def has_interesting_events?\n has_structure_updates? || has_event_propagation_updates?\n end", "def eventless?\n ! @event\n end", "def has_any_event\n include InstanceMethods unless @published_events\n @published_events = :any_event_is_ok\n end", "def has_event?(event_model)\n bound_events.has_key?(event_model)\n end", "def valid_event?(event)\n return false unless event.livemode\n return false unless event.type == 'charge.succeeded'\n return false unless event.data.object.paid\n return false unless event.data.object.captured\n return false unless event.data.object.currency == 'usd'\n return false if event.data.object.refunded\n true\n end", "def events\n end", "def parallel_common_events\n rm_extender_pc.select {|e| e && !e.for_battle?}\n end", "def passed_test?(event)\n event['event'] == 'test' && event['status'] == 'pass'\n end", "def run_event(event, *args)\n unless @events.nil? || @events.empty? || @events[event].nil? || @events[event].empty?\n @events[event].each do |hook|\n if Hooks::is_hook_valid?(hook)\n begin\n hook.call args\n rescue\n end\n end\n end\n end\n true\n end", "def prev_event?\n !@prev_event.blank?\n end", "def is_event?\n self.object_type.downcase.to_s == \"event\"\n end", "def reserved_common_event\n $data_common_events[@reserved_common_events.shift]\n end", "def reserved_common_event\n $data_common_events[@common_event_id]\n end", "def check_event_trigger_auto\n start if @trigger == 3\n end", "def ensure_event_parameter?\n no_event_param_redirection unless !params[:event_id].nil? && !Event.find(params[:event_id]).nil?\n end", "def human_event; end", "def handler_check(event)\n if not @enabled\n event.respond \"Missing API Key\"\n false\n else\n true\n end\n end", "def use_event_attributes?\n !skip_actions && !skip_after && actions.all? && actions.length == 1 && first.machine.action_hook?\n end", "def event_supported?(event_type)\n SUPPORTED_EVENTS.include? event_type\n end", "def event?(state)\n @events.key?(state)\n end", "def performed?(event)\n @triggered.include?(event)\n end", "def performed?(event)\n @triggered.include?(event)\n end", "def send_events=(_arg0); end", "def validates_arity?(evt)\n emits?(evt) && emittable[evt.to_sym] > NO_CHECK_ARITY\n end", "def validate_event_selection\n\t\tunless self.event\n\t\t\tself.errors.add(:event, 'must be chosen.')\n\t\tend\n\tend", "def check_events\n temp = poll_response\n index = 0\n puts temp if $debug\n # begin\n if temp.has_key?(\"people\")\n temp[\"people\"].each do |user|\n unless @people_hash.has_key?(user[\"screenname\"])\n @people_hash[user[\"screenname\"]] = user\n end\n end\n end\n unless temp == {}\n # begin\n temp[\"events\"].each do |event|\n key = \"#{event['server_seqid']}#{event['type']}\"\n unless @hash[key] == event[\"server_gmt\"]\n # puts event\n @api.process(event, @people_hash[event['from']]||nil, key)\n @hash[key] = event[\"server_gmt\"]\n end\n\n end\n # rescue\n # puts \"*****\"\n #@log.debug temp[\"events\"]\n # puts \"*****\"\n # puts temp\n # end\n end\n # rescue Exception => e\n # puts e.message, e.backtrace\n # end\n\n end", "def responds_on?(buffy_context)\n return true unless event_action\n buffy_context.event_action == event_action ? true : false\n end" ]
[ "0.72238475", "0.7169871", "0.71307796", "0.7073174", "0.7018544", "0.65973693", "0.6570707", "0.6568004", "0.6531229", "0.6474965", "0.6459335", "0.641363", "0.63844293", "0.6358794", "0.63273466", "0.6326735", "0.6306446", "0.6302359", "0.6250972", "0.6243473", "0.617714", "0.6175483", "0.6174399", "0.61418205", "0.61418205", "0.6133221", "0.6128235", "0.61162704", "0.6107873", "0.60869515", "0.60764265", "0.60764265", "0.60764265", "0.6062094", "0.6060801", "0.6055459", "0.6055162", "0.60548186", "0.60533977", "0.60395736", "0.60211045", "0.60211045", "0.601645", "0.601645", "0.601645", "0.601645", "0.601645", "0.601645", "0.601645", "0.601645", "0.599318", "0.59795654", "0.59514457", "0.5943454", "0.5938514", "0.5930256", "0.59283036", "0.59190243", "0.59056085", "0.58917993", "0.58880687", "0.58880687", "0.5885338", "0.58841634", "0.58841634", "0.5863674", "0.5862589", "0.585674", "0.58471495", "0.5828062", "0.58216614", "0.5813827", "0.5802002", "0.5802002", "0.57970643", "0.5796053", "0.5796004", "0.5774167", "0.575835", "0.57574636", "0.5745304", "0.573462", "0.57295555", "0.57290447", "0.57213396", "0.572113", "0.57135195", "0.5713491", "0.5704406", "0.5686497", "0.567071", "0.5666214", "0.5658473", "0.5656747", "0.5656747", "0.56476766", "0.56465244", "0.5622981", "0.56218237", "0.56068975" ]
0.6283751
18
Check the follower common event call
def check_follower_trigger_there(new_x, new_y) if @follower.x == new_x && @follower.y == new_y if @follower.is_a?(Game_Event) @follower.start else @follower.turn_toward_player $game_temp.common_event_id = Game_CommonEvent::FOLLOWER_SPEECH end return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following? subject\n has_event? 'follow', subject\n end", "def follow\n\n end", "def followers?\n following?\n end", "def notify_followers_if_necessary\n if state == MERGE_STATE['merge']\n notify_followers(jingle.id, child_jingle.user.id)\n end\n end", "def followed_by?(follower)\n f = get_follow_for(follower)\n (f && !f.blocked?) ? true : false\n end", "def update_follower_event(last_follower, follower_event)\n last_follower_event = follower_event\n while last_follower_event&.follower\n last_follower_event.set_follower(nil) unless last_follower_event.follower.is_a?(Game_Event)\n last_follower_event = last_follower_event.follower\n end\n last_follower.set_follower(follower_event) if last_follower.follower != follower_event\n end", "def follower_dependent_event\n $PokemonGlobal.dependentEvents.each_with_index do |event,i|\n next if !event[8][/FollowerPkmn/]\n return @realEvents[i]\n end\n return nil\n end", "def needs_followup?\n followup_note_count && followup_note_count > 0\n end", "def follow_on_job?\n false\n end", "def user_is_not_following_themselves\r\n if follower_id == followed_user_id\r\n errors.add(:base, \"Users cannot follow themselves\")\r\n end\r\nend", "def check_followup fup\n if fup\n if ( fup.current_stage + 1 ).even?\n # OFFx: Trigger only on no signals in candidate beam\n trigger_followup(fup, nil, false) if signal_groups.count == 0 \n else\n # ONx: Trigger on highest confidence valid signal\n confidence = 0\n sig_grp_best = nil\n signal_groups.each do |sig_grp|\n real = sig_grp.is_real? \n if real && ( sig_grp.confidence > confidence )\n sig_grp_best = sig_grp\n confidence = sig_grp.confidence\n end\n end\n trigger_followup( fup, sig_grp_best, true ) if sig_grp_best\n end\n else\n # ON: Trigger on all valid signals\n signal_groups.each do |sig_grp|\n trigger_followup( Followup.new(), sig_grp, true ) if sig_grp.is_real?\n end\n end\n end", "def following?\n user.present?\n end", "def follows?(user)\n user.followers.include?(self)\n end", "def check_permission\n if followable_type == \"User\"\n user = User.find(followable_id)\n follower = User.find(follower_id)\n \n errors.add(I18n::t('errors.follow.self_follow')) if user == follower\n errors.add(I18n::t('errors.follow.already_following')) if follower.follows?(user)\n end\n end", "def following?(other_user)\n followeds.include?(other_user)\n end", "def prev_follow\n end", "def follow(target)\n link = self.user_follows.where(\"following_id = ?\",target.id).first\n if link == nil\n imperative_follow(target)\n end\n true\n end", "def followed_by?(follower)\n get_unblocked_followings.for_follower(follower).first.present?\n end", "def followed_by?(follower)\n self.followings.unblocked.for_follower(follower).first.present?\n end", "def do_not_follow_self\n if follower_id == followed_id\n errors.add(:do_not_follow_self, \"should not have yourself as a follower\")\n end\n end", "def follow?(user)\n followings_users.include?(user)\n end", "def ensure_follower_not_followed \n if follower_id == followed_id \n errors[:follower_id] << 'cannot follow yourself.'\n end\n\n end", "def followee?(other_user)\n followee_relationships.include?(other_user)\n end", "def follower\n config = create_or_find_config\n \n if ARGV.size == 0\n puts %(\\n You forgot to enter a screen name.\\n\\n Usage: twitter follower jnunemaker\\n)\n exit(0)\n end\n \n screen_name = ARGV.shift\n \n puts\n found = false\n Twitter::Base.new(config['email'], config['password']).followers.each do |u|\n if u.screen_name == screen_name\n puts \"#{u.name} (#{u.screen_name})\"\n puts \"#{u.status.text} at #{u.status.created_at}\" unless u.status.nil?\n found = true\n end\n end\n \n puts \"Sorry couldn't find a follower of yours with #{screen_name} as a screen name\" unless found\n end", "def following?(user)\n !can_follow?(user)\n end", "def follow_notification\n Notifications.follow_notification\n end", "def already_follow(follower_id, followee_id)\n if follow.follower_id == follower_id && follow.followee_id == folowee_id \n errors.add(:followee_id, \"you're already following this user\")\n end\n end", "def status_follow?()\n return true if (@status == TAC_PLUS_AUTHEN_STATUS_FOLLOW)\n return false\n end", "def follower?(id, follower_id, scope = Amico.default_scope_key)\n !Amico.redis.zscore(\"#{Amico.namespace}:#{Amico.followers_key}:#{scope}:#{id}\", follower_id).nil?\n end", "def has_following?\n\t self.following_count > 0\n\tend", "def followed_by?(other_user)\n followers.include?(other_user)\n end", "def followed_by?(follower)\n follower_ids.include?(follower.id)\n end", "def followed_by?(user)\n followers.include?(user)\n end", "def log_to_followers\n depositor.followers.select { |user|\n user.can?(:read, collection)\n }.each do |follower|\n follower.log_event(event)\n end\n end", "def followable_by?(user)\n return false if self.id == user.id #can't follow self\n return false if user.following?(self) #can't follow someone already following\n true #otherwise \n end", "def followed_by?(user)\n followers.include?(user)\n end", "def next_follow\n end", "def set_event_follower\n @event_follower = EventFollower.find(params[:id])\n end", "def following?(followed)\n followed_id = followed.is_a?(User) ? followed.id : followed\n fetch_followed_ids.include?(followed_id)\n end", "def check_request\n follow = Follow.where(following_id: params[:following_id], follower_id: params[:user_id]).first\n if follow.present?\n render json: {follow: follow, status: 'followed'}\n else\n render json: { status: 'none'}\n end\n end", "def following?(user)\n self.followings.include?(user)\n end", "def following?(user)\r\n self.followings.include?(user)\r\n end", "def has_follower?(actor)\n return true if actor == self\n !actor.contact_to!(self).blocked\n end", "def has_followers?\n\t self.followers_count > 0\n\tend", "def followed_by?(user)\n followers.exists?(user.id)\n end", "def follows?(followable)\n has_followable_link?(:followee, followable)\n end", "def followed_by?(user)\n extension_followers.where(user: user).any?\n end", "def follow(log)\r\n execute \"le follow #{log}\" do\r\n not_if \"le followed #{log}\"\r\n end\r\n end", "def followers\n @hot_topics = Topic.hot_topics(5)\n @interviewee = User.where(:nickname => params[:id]).first\n @is_same_user = @interviewee.is_same_user?(@current_user)\n \n @followers = @interviewee.followers\n @current_user.refresh_notifications(\"new_followers_count\")\n end", "def following?(other_user)\n\t following.include?(other_user)\n \tend", "def following?(tribute)\n following.include?(tribute)\n end", "def processEvent( client, user, t_event )\n#\t\tclient.room.say(\"Processing Event #{t_event}\")\n if user.id != client.user.id\n $botData['events'].each { |event|\n if event['event'] == t_event\n if event['delivery_method'].to_i == 1\n if event['include_name'].to_i == 0\n client.room.say(event['pre_text'] + event['post_text'])\n else\n client.room.say(event['pre_text'] + user.name + event['post_text'])\n end\n else\n if event['include_name'].to_i == 0\n user.say(event['pre_text'] + event['post_text'])\n else\n user.say(event['pre_text'] + user.name + event['post_text'])\n end\n end\n end\n }\n end\nend", "def followed?(model)\n model.follower_ids.include?(self.id)\n end", "def fan_base_following?(followed)\r\n fan_relationships.find_by_followed_id(followed)\r\n end", "def following?(user)\n\tself.followed_users.exists?(user.id)\nend", "def following?(other_user)\n following.include?(other_user)\n end", "def following? hacker\n following.include? hacker\n end", "def following? hacker\n following.include? hacker\n end", "def following?(user)\n Follow.exists?(followed_id: user.id, follower_id: self.id, active: true)\n # following_relationships.exists?(followed_id: user.id)\n end", "def following?(other_user)\n \tfollowing.include?(other_user)\n \tend", "def following?(other_user)\n \tfollowing.include?(other_user)\n \tend", "def status_follow!()\n @status = TAC_PLUS_AUTHEN_STATUS_FOLLOW\n end", "def can_follow?(followee)\n !Follow.exists?([\"user_id = ? AND follow_user_id = ?\", self.id, followee.id]) && self != followee\n end", "def followed_by?(followable)\n has_followable_link?(:follower, followable)\n end", "def front_event_calling(common_event)\n event = $game_player.front_tile_event\n if event&.list\n @event_id = event.id if @event_id == 0\n i = 0\n i += 1 while FEC_SKIP_CODES.include?(event.list[i]&.code)\n return true if event.list[i] && event.list[i].code == 117 && event.list[i].parameters[0] == common_event\n end\n return false\n end", "def isFollowable?\n isTwitter? || isCompany?\n end", "def update\n if(@check)\n @follower.update(event_params.except(:token))\n if follower.save\n render json: @follower, status: :ok, location: @follower\n else\n render json: @follower.errors, status: :unprocessable_entity\n end\n end\n end", "def following?(other_user)\n !follower_followships.find_by(followed_id: other_user.id).nil?\n end", "def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention_names.any?\n end", "def following?(other_user)\n #!active_relationships.find_by(followed_id: other_user.id).nil? or\n following.include?(other_user)\n end", "def following?(followable)\n following.include?(followable)\n end", "def follower(relationship)\n @follower = relationship.follower\n @followed = relationship.followed\n mail :to => @followed.email, :subject => \"New follower on EconBloggers\"\n end", "def following?(other_user)\n\t following.include?(other_user)\n\tend", "def send_notification\n self.target_followers.each do |target_follower|\n @user = User.find(target_follower.follower_id)\n Notification.create_notification(@user.profilable_id, @user.profilable_type, text = \"#{self.name} updated his/her profile\", \"Enterprise\") && reload unless target_follower == self || target_follower.nil?\n end\n end", "def following?(other_user)\n\t\t\tfollowing.include?(other_user)\n\t\tend", "def can_follow?(username)\n @original.nil? || username == @original || twitter.friendship?(username, @original)\n true\n end", "def follow(user)\n self.following << user\n ActionLog.log_other(self.id, \"follow\", user) \n end", "def following_profile?(profile)\n return favorites.streams.where(favable_id: profile.stream_ids).count > 0\n end", "def validate_user_following\n return if user.follow?(travel.user)\n return if user == travel.user\n\n errors.add(:user_id, :not_follower)\n end", "def going?(event)\n attended_events.include?(event)\n end", "def following?(tw_user)\n following.include?(tw_user)\n end", "def is_following_company?(company_id)\r\n return (JobSeekerFollowCompany.find(:first,:conditions=>[\"job_seeker_id = ? and company_id = ?\", self.id, company_id]).nil? ? false : true)\r\n end", "def following?(river)\n favorites.include?(river)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user) \n end", "def followers(action=nil)\n my.followers(action)\n end", "def following?(other_user)\nfollowing.include?(other_user)\nend", "def following?(user)\n following.include?(user)\n end", "def can_follow?(username)\n @original.nil? || username == @original || twitter.friendship?(username, @original)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def received_friend_requests\n self.followers.where(\"friend_status = 'PENDING'\")\n end", "def followers\n @client.followers.ids?\n end", "def following?( other_user )\n followings.include?( other_user )\n end", "def like_follow_live\n login_streaming\n @client_stream.filter(:track => \"#{@hashtbonjour}\") do |tweet|\n @client.favorite!(tweet)\n @client.follow(tweet.user)\n end\n end", "def followed?(uid)\n \tUser.find(uid).follows.find_by_following_id(self.id)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def notify_followers(community, current_user, update)\n followers.each do |follower|\n unless follower.id == current_user.id\n if update\n Notification.create(:notifiable_id => self.id, :notifiable_type => \"Listing\", :receiver_id => follower.id, :description => \"updated\")\n PersonMailer.new_update_to_followed_listing_notification(self, follower, community).deliver\n else\n Notification.create(:notifiable_id => comments.last.id, :notifiable_type => \"Comment\", :receiver_id => follower.id, :description => \"to_followed_listing\")\n PersonMailer.new_comment_to_followed_listing_notification(comments.last, follower, community).deliver\n end\n end\n end\n end", "def test_followship\n Capybara.current_driver = :webkit\n visit '/login'\n fill_in('name', :with => 'sample')\n fill_in('password', :with => 'password')\n click_on('login-submit')\n visit '/user/sample1'\n user_sample1 = User.find_by name: \"sample1\"\n #binding.pry\n #save_and_open_page\n\n if page.has_css?('.follow-btn')\n find('.follow-btn').click\n assert (user_sample1.followers.any? {|single| single.name == \"sample\" })\n elsif page.has_css?('.unfollow-btn')\n find('.unfollow-btn').click\n else\n assert false\n end\n end" ]
[ "0.68459976", "0.6474227", "0.64201474", "0.63934547", "0.62816536", "0.6272473", "0.62413573", "0.62138695", "0.6174677", "0.61198324", "0.61060584", "0.6092439", "0.60899925", "0.6089084", "0.607554", "0.606005", "0.6048661", "0.6039396", "0.60291326", "0.60284", "0.59965456", "0.598555", "0.5982907", "0.59728855", "0.59606236", "0.59554726", "0.59510386", "0.59139377", "0.59125155", "0.5903359", "0.5896135", "0.5893407", "0.58873737", "0.58861846", "0.5885728", "0.58684194", "0.5864347", "0.58553857", "0.58531934", "0.5850864", "0.5844677", "0.5835847", "0.5829524", "0.5815352", "0.57911605", "0.579033", "0.57657146", "0.5765381", "0.5764455", "0.5761626", "0.57590735", "0.57564646", "0.5753241", "0.575053", "0.5749656", "0.5744276", "0.5738317", "0.5738317", "0.5737384", "0.57359135", "0.57359135", "0.5734898", "0.5724423", "0.5722758", "0.5722117", "0.57201546", "0.57124954", "0.57061064", "0.57057106", "0.56977195", "0.56952953", "0.5695163", "0.56929004", "0.56859034", "0.56753474", "0.5672057", "0.5670633", "0.5668077", "0.5655191", "0.5644315", "0.56432945", "0.56427634", "0.5641828", "0.5636167", "0.563189", "0.5629993", "0.56282276", "0.56246674", "0.5621708", "0.5620993", "0.5619718", "0.5618546", "0.5616289", "0.56154454", "0.56095916", "0.56069213", "0.56069213", "0.56069213", "0.56066453", "0.55953497" ]
0.70777076
0
Check if the player touch an event and start it if so
def check_event_trigger_touch(x, y) return false if $game_system.map_interpreter.running? result = false z = @z $game_map.events.each_value do |event| next unless event.contact?(x, y, z) && [1, 2].include?(event.trigger) next if event.jumping? || event.over_trigger? event.start result = true end return result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_event_trigger_touch(x, y)\n return if $game_map.interpreter.running?\n if @trigger == 2 and $game_player.pos?(x, y)\n start if not jumping? and @priority_type == 1\n end\n end", "def check_event_trigger_touch(x, y)\r\r\n return if $game_map.interpreter.running?\r\r\n if @trigger == 2 && $game_player.pos_rect?(x, y, $game_player.collision_rect)\r\r\n start if !jumping? && normal_priority?\r\r\n end\r\r\n end", "def touch_began(touch); end", "def check_event_trigger_touch_front\r\n x2 = $game_map.round_x_with_direction(@x, @direction)\r\n y2 = $game_map.round_y_with_direction(@y, @direction)\r\n check_event_trigger_touch(x2, y2)\r\n end", "def start(event)\n return stop if IS_TOUCH && `#{event.touches}.length != 1`\n\n off if @pos_method\n\n @position = position(event)\n @target = event.target\n @start_position = @position\n @mouse_is_down = true\n\n @pos_method = @body.on! EVENTS[:move] do |evt| pos(evt) end\n @up_method = @body.on! EVENTS[:up] do |evt| up(evt) end\n\n request_animation_frame do move end\n\n pos(event) if @start_distance == 0\n end", "def touch?(player=@player)\n if (player.getCollisionMask.intersects_with?(getCollisionMask)) and player.status == :alive\n player.touched\n true\n else\n false\n end\n end", "def check_event_trigger_touch(x, y)\n # stop check if map interpreter is already running\n return false if $game_system.map_interpreter.running? || @trigger != 2\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # if player touched this event and not jumping and not over_trigger\n if !jumping? && !over_trigger? &&\n $BlizzABS.util.rect_intersection(Rect.new(x * pix, y * pix, pix, pix),\n Rect.new($game_player.x, $game_player.y, pix, pix))\n # start\n #raise @trigger.to_s\n start\n # started\n return true\n end\n # not started\n return false\n end", "def check_event_trigger_auto\n # if triggered by event touch\n if @trigger == 2\n # check player touch\n return check_event_trigger_at($game_player.x, $game_player.y)\n # if autorun\n elsif @trigger == 3\n # start\n start\n # started\n return true\n end\n # not started\n return false\n end", "def ccTouchBegan(touch, event)\n \n CGPoint location = touch.locationInView(touch.view)\n CGPoint convLoc = director.convertToGL(location)\n \n # If we reached game over, any touch returns to menu\n if isGameOver\n director.replace_scene(MenuScene.scene)\n return true\n end\n\n # If the back button was pressed, we exit\n if CGRectContainsPoint(backButton.boundingBox, convLoc)\n director.replace_scene(MenuScene.node)\n return true\n end\n\n # If we have only 0 or 1 gem in gemsTouched, track\n if gemsTouched.length < 2\n # Check each gem\n gemsInPlay.each do |aGem|\n # If the gem was touched AND the gem is idle,\n # return YES to track the touch\n if aGem.containsTouchLocation(convLoc) &&\n aGem.gemState == kGemIdle\n return true\n end\n end\n end\n\n # If we failed to find any good touch, return\n return false\nend", "def check_event_trigger_touch(x, y)\n result = false\n # If event is running\n if $game_system.map_interpreter.running?\n return result\n end\n # All event loops\n for event in $game_map.events.values\n # If event coordinates and triggers are consistent\n if event.x == x and event.y == y and [1,2].include?(event.trigger)\n # If starting determinant is front event (other than jumping)\n if not event.jumping? and not event.over_trigger?\n event.start\n result = true\n end\n end\n end\n return result\n end", "def check_event_trigger_touch(x, y)\n # not started if already running\n return false if $game_system.map_interpreter.running?\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # initialize result\n result = false\n # iterate through all events\n $game_map.events.each_value {|event|\n # if triggered by touch and trigger started the event\n if Cache::TouchTrigger.include?(event.trigger) &&\n event.check_event_trigger_at(x, y)\n # events were started\n result = true\n end}\n # return result\n return result\n end", "def check_event_trigger_touch(x, y)\r\n return false\r\n end", "def check_event_trigger_touch_front\r\r\n d = @direction\r\r\n horz = (d - 1) % 3 - 1\r\r\n vert = 1 - ((d - 1) / 3)\r\r\n pixelstep = CXJ::FREE_MOVEMENT::PIXELS_PER_STEP / 32.0\r\r\n x2 = $game_map.round_x(x + horz * pixelstep)\r\r\n y2 = $game_map.round_y(y + vert * pixelstep)\r\r\n check_event_trigger_touch(x2, y2)\r\r\n end", "def check_event_trigger_touch(x, y)\n return false\n end", "def start_map_event(x, y, triggers, normal, rect = collision_rect)\r\r\n return if $game_map.interpreter.running?\r\r\n $game_map.events_xy_rect(x, y, rect).each do |event|\r\r\n if event.trigger_in?(triggers) && event.normal_priority? == normal\r\r\n event.start unless event.is_touching?(self)\r\r\n event.add_touch(self)\r\r\n end\r\r\n end\r\r\n end", "def touch_ended(touch); end", "def check_event_trigger_touch(x, y)\n result = false\n return result\n end", "def check_batevent_trigger\n return if @active_battler == nil\n for event in $game_system.battle_events.values\n if [0,1,2].include?(event.trigger) #on player touch or event touch\n if event.at_xy_coord(@active_battler.x, @active_battler.y)\n if event.list.size > 0\n event.start unless event.starting\n return\n end\n end\n end\n end\n end", "def check_event_trigger_at(x, y)\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # if player touched this event and not jumping and not over_trigger\n if !jumping? && !over_trigger? && $BlizzABS.util.rect_intersection(\n Rect.new(@x * pix, @y * pix, pix, pix), Rect.new(x, y, pix, pix))\n # start\n start\n # started\n return true\n end\n # not started\n return false\n end", "def pos(event)\n @position = position(event)\n if diff.distance >= @start_distance.to_i && !@started\n @started = true\n trigger 'start', @target\n end\n event.stop\n end", "def touchesBegan touches, withEvent: _\n\n end", "def pressed?() sdl_event.press end", "def touch_begin_scene\n # Check to see if the touch is near a toy\n @truly_selected = close_toy(@current_point)\n\n # Check to see if the touch is near a LineStroke\n unless @truly_selected\n @truly_selected = @strokes.reverse.detect { |stroke| stroke.close_to?(@current_point) }\n end\n if @truly_selected\n @selected = @truly_selected\n @trash_button.enabled = true\n end\n end", "def touch_moved(touch); end", "def player_push_button(event)\n if ((event.x - 180)**2 + (event.y - 810)**2).abs <= 8100\n @player_playing = 0\n elsif ((event.x - 1180)**2 + (event.y - 810)**2).abs <= 8100\n @player_playing = 1\n \n else\n @player_playing = -1\n end\n end", "def start_event_thread\n return false if @event_thread\n @event_thread = Thread.new(&method(:event_thread_body))\n end", "def player_turn\n hit_loop(@player)\n end", "def attack\n @stage.attack! if $window.button_down?(Gosu::MsLeft)\n end", "def touchesBegan(touches, withEvent: event)\n\n #Get Touch coordinates\n touch = touches.anyObject\n point = touch.locationInView(self)\n\n #Check for Validity\n return unless valid_touch_location?(point)\n\n # Act Dependent on mode\n @current_point = point\n case @current_tool\n when :squiggle, :line, :circle\n @points = [@current_point]\n\n when :grab\n case @mode\n when :toys_only, :toy_selected\n touch_begin_toys_only\n when :scene\n touch_begin_scene\n when :create_new_toy\n if @selected.close_enough(@current_point)\n @drag = true\n end\n end\n end\n setNeedsDisplay\n end", "def start_falling(event)\n event.obfalling = 1\n event.move_speed = 4.5\n event.through = true\n event.fallbyjump.nil? ? event.move_away_from_player : event.fallbyjump = nil\n RPG::SE.new(FallSe,80).play \n @eve_fall.push(event) unless @eve_fall.include?(event)\n @eve_fall = @eve_fall.uniq \n @player_busy = event.picked = false if event.picked\n end", "def start_map_event(x, y, triggers, normal)\n return if $game_map.interpreter.running?\n $game_map.events_xy(x, y).each do |event|\n if event.trigger_in?(triggers) && event.normal_priority? == normal\n if event.event.name =~ /ETAGE <(\\d+)>/ && Etage::MAP.include?($game_map.map_id)\n etage = $1.to_i\n event.start if (etage-@etage_actuel).abs < 2\n else\n event.start\n end\n end\n end\n end", "def start(player)\n precondition do\n raise \"Player not provided.\" if player.nil?\n end\n @game.sync\n @game.start player\n end", "def start()\n while true\n @room = @room.play()\n end\n end", "def playGesture _obj, _args\n \"_obj playGesture _args;\" \n end", "def setup_starting_event\r\n # Refresh the event page when switch/variable was changed\r\n $game_map.refresh if $game_map.need_refresh\r\n # Start common event if required\r\n if $game_temp.common_event_id > 0\r\n setup($data_common_events[$game_temp.common_event_id].list, 0)\r\n $game_temp.common_event_id = 0\r\n return\r\n end\r\n # Try to start an event\r\n $game_map.events.each_value do |event|\r\n next unless event.starting\r\n if event.trigger < 3\r\n event.clear_starting\r\n event.lock\r\n end\r\n return setup(event.list, event.id)\r\n end\r\n # Try to start a common event\r\n $data_common_events.each do |common_event|\r\n next unless common_event&.trigger == 1 && $game_switches[common_event.switch_id]\r\n return setup(common_event.list, 0)\r\n end\r\n end", "def touchesBegan touches, withEvent: _\n root.present_scene_two\n end", "def update_encounter\r\n # Event determinant is via touch of same position event\r\n result = check_event_trigger_here([1,2])\r\n # If event which started does not exist\r\n if result == false\r\n # Disregard if debug mode is ON and ctrl key was pressed\r\n unless $DEBUG and Input.press?(Input::CTRL)\r\n # Encounter countdown\r\n if @encounter_count > 0\r\n @encounter_count -= 1\r\n end\r\n end\r\n end\r\n end", "def start_game\n\t\tself.game_is_started = true\n send_update\n end", "def check_event_trigger_auto\n start if @trigger == 3\n end", "def start_movement\n end", "def alpha_touch\n belay unless @alpha_touched or @beta_touched\n end", "def hitTest(point, withEvent:event)\n s = super\n if s == self && @userInteractionEnabled == false\n return nil\n end\n s\n end", "def process_x\n if current_item_enabled?\n Sound.play_ok\n super\n else\n Sound.play_buzzer\n end\n end", "def check_follower_trigger_there(new_x, new_y)\n if @follower.x == new_x && @follower.y == new_y\n if @follower.is_a?(Game_Event)\n @follower.start\n else\n @follower.turn_toward_player\n $game_temp.common_event_id = Game_CommonEvent::FOLLOWER_SPEECH\n end\n return true\n end\n return false\n end", "def on_player_toggle_sneak(evt)\n player = evt.player\n return unless %w[world world_nether].include?(player.location.world.name)\n\n #if player.name == 'ujm'\n # #location_around(add_loc(player.location, 0, 5, 0), 5).map(&:block).each {|b| b.type = Material::AIR if b.type != Material::AIR }\n # location_around_flat(loc_below(player.location), 5).map(&:block).each {|b| b.type = Material::GRASS if b.type != Material::AIR }\n # player.perform_command 'dynmap render'\n #end\n # Superjump\n name = player.name\n @crouching_counter ||= {}\n @crouching_counter[name] ||= 0\n @crouching_countingdown ||= false\n if evt.sneaking?\n # counting up\n @crouching_counter[name] += 1\n later sec(2.0) do\n @crouching_counter[name] -= 1\n end\n if @crouching_counter[name] == 4\n play_sound(add_loc(player.location, 0, 5, 0), Sound::BAT_TAKEOFF, 1.0, 0.0)\n # evt.player.send_message \"superjump!\"\n player.fall_distance = 0.0\n player.velocity = player.velocity.tap {|v| v.set_y jfloat(1.4) }\n end\n\n # map teleport\n if player.location.pitch == 90.0\n item = player.item_in_hand\n if item && item.type == Material::MAP\n map = Bukkit.get_map(item.data.data)\n loc = block2loc(map.world.get_highest_block_at(map.center_x, map.center_z))\n loc = add_loc(loc, 0, 3, 0)\n loc.pitch = 90.0\n loc.yaw = player.location.yaw\n loc.chunk.load\n\n animals = player.get_nearby_entities(2, 2, 2).select {|e|\n Player === e\n }\n move_livings = [player] + animals\n\n play_effect(player.location, Effect::ENDER_SIGNAL, nil)\n play_sound(player.location, Sound::ENDERMAN_TELEPORT , 1.0, 0.5)\n move_livings.each do |e|\n e.velocity = e.velocity.tap {|v| v.set_y 1.0 }\n end\n later sec(0.5) do\n move_livings.select(&:valid?).each do |e|\n e.teleport(loc)\n e.fall_distance = 0.0\n play_effect(player.location, Effect::ENDER_SIGNAL, nil)\n play_sound(loc, Sound::ENDERMAN_TELEPORT , 1.0, 0.5)\n end\n end\n end\n end\n\n ctf_sneaking(player) if @ctf_players.member?(player)\n end\n\n #player_update_speed(evt.player, snp: evt.sneaking?)\n\n #player = evt.player\n #if player.equipment.boots && HARD_BOOTS.include?(player.equipment.boots.type)\n # if !evt.player.on_ground? && evt.sneaking?\n # later 0 do\n # newloc = player.location\n # newloc.x = newloc.x.to_i.to_f - 0.5\n # newloc.z = newloc.z.to_i.to_f - 0.5\n # player.teleport newloc\n # play_effect(newloc, Effect::ENDER_SIGNAL)\n # player.velocity = Vector.new(0.0, -1.0, 0.0)\n # end\n # loc = (1..4).lazy.\n # map {|y| evt.player.location.clone.add(0, -y, 0) }.\n # find {|l| l.block.type != Material::AIR }\n # later sec(0.2) do\n # if loc && loc.block.type == Material::STONE\n # loc.block.break_naturally(ItemStack.new(Material::DIAMOND_PICKAXE))\n # end\n # end\n # end\n #end\n end", "def tap(x, y)\n # Touches appear to be lost during the first frame after navigation.\n # This waits a frame before sending the tap.\n # @see https://crbug.com/613219\n @_client.command(\n Protocol::Runtime.evaluate(\n expression: 'new Promise(x => requestAnimationFrame(() => requestAnimationFrame(x)))',\n await_promise: true\n )\n ).wait!\n\n touch_points = [{ x: x.round, y: y.round }]\n @_client.command(\n Protocol::Input.dispatch_touch_event(\n type: 'touchStart',\n touch_points: touch_points,\n modifiers: @_keyboard.modifiers\n )\n ).wait!\n @_client.command(\n Protocol::Input.dispatch_touch_event(\n type: 'touchEnd',\n touch_points: [],\n modifiers: @_keyboard.modifiers\n )\n ).wait!\n end", "def touch\n @repaint_required = true\n end", "def check_event_to_event_touch(x, y, triggers)\n events = $game_map.events_xy(x, y)\n canStart = trigger_in?(triggers)\n events.each do |event|\n return if event == self\n # start this event if the other event can trigger this event\n start if !@starting && canStart && (trigger_ext.empty? || trigger_ext.include?(event.id))\n next unless event.trigger_in?(triggers)\n \n # start the other event if this event can trigger the other event\n event.start if event.trigger_ext.empty? || event.trigger_ext.include?(@id)\n end\n end", "def pbLedge(xOffset,yOffset)\n if PBTerrain.isLedge?(Kernel.pbFacingTerrainTag)\n if Kernel.pbJumpToward(2,true)\n $scene.spriteset.addUserAnimation(DUST_ANIMATION_ID,$game_player.x,$game_player.y,true)\n $game_player.increase_steps\n $game_player.check_event_trigger_here([1,2])\n end\n return true\n end\n return false\nend", "def hook_action\n if tool_canuse?(HweaponId) and not @showing_hook\n unless character_at_playerpos?\n @hookshot.each do |hook| \n hook.direction = @direction\n hook.moveto(@x, @y)\n hook.char_steps = hook.index\n end\n @showing_hook = true\n RPG::SE.new(HookActionSe, 80).play\n @tool_anime = 30\n else\n Sound.play_buzzer\n end\n end\n end", "def pbLedge(xOffset,yOffset)\n if PBTerrain.isLedge?(Kernel.pbFacingTerrainTag)\n if Kernel.pbJumpToward(2,true)\n $scene.spriteset.addUserAnimation(DUST_ANIMATION_ID,$game_player.x,$game_player.y,true,1)\n $game_player.increase_steps\n $game_player.check_event_trigger_here([1,2])\n end\n return true\n end\n return false\nend", "def play_special player\n\t\t\tif @spec_action\n\t\t\t\t@spec_action.call player, self\n\t\t\tend\n\t\t\t\n\t\t\ttrue\n\t\tend", "def starting?; event(:start).pending? end", "def play\n @hungry = true\n #p \"play method called\" #print notification to console\n end", "def process_up\n Sound.play_cursor\n Input.update\n deactivate\n call_cancel_handler\n end", "def on_turn_start\n check_turn_start_effects\n end", "def startPlayback\n end", "def playing?\n self.play_start != nil\n end", "def update event\n if alive?\n hit! if @got_hit\n move_by(@movement_delta * event.milliseconds)\n end\n end", "def ccTouchesBegan(touches, withEvent:event)\n\n # Get any touch of the user\n touch = touches.anyObject\n\n # Because we are not using a UIView or anything related\n # we need to use a method to convert the touch position \n # coordinate space into the layer space\n touch_location = self.convertTouchToNodeSpace(touch)\n\n # Get the current position of the space ship\n current_location = @space_ship_sprite.position\n\n # Calculate the difference between the two points\n location_difference = CGPointMake(touch_location.x - current_location.x,\n touch_location.y - current_location.y)\n\n # We need to create a MoveBy action for the animated movement\n action = CCMoveBy.actionWithDuration(0.3, \n position:location_difference)\n\n # Execute the action in our Space Ship Sprite\n @space_ship_sprite.runAction(action)\n end", "def play(event)\n # Determine the path to the event mp3 and spawn mplayer to play it.\n file = File.expand_path(File.join(TRACK_BASE, \"#{event}.mp3\"))\n\n if (!File.exist?(file))\n puts \"No file to play: #{file}\"\n return false\n end\n\n # Load (play) the file after stopping any previous one\n stop()\n %x{#{echo()} loadfile \"#{file}\" > #{fifo()}} if running?\n system \"stty #{$app.old_stty}\" # restore stty settings\n end", "def tick!\n if target = acquire_target\n shoot_at(target)\n else\n scan_for_targets\n end\n end", "def check_event_trigger_on_region_enter\n start if @trigger == 8 && trigger_ext.include?($game_player.region_id)\n end", "def onalg_player_has_moved(player,color, start_x, start_y, end_x, end_y)\r\n if player != @alg_player\r\n \r\n end\r\n end", "def start\n\t\tif @game_over\n\t\t\traise Exception.new(\"GAME #{@id} IS ALREADY OVER\")\n\t\tend\n\t\tplayer_number = 1\n\t\tloop do\n\t\t\t@game_over = player_turn @players[player_number], player_number\n\t\t\tplayer_number = player_number % 2 + 1\n\t\t\tbreak if @game_over\n\t\tend\n\tend", "def touchesBegan touches, withEvent: _\n root.present_scene_three\n end", "def start\n return current_event if started?\n\n first_event = ready_events.first\n update!(current_event: first_event, started: true) if first_event\n\n current_event\n end", "def start\n Thread.new do\n loop do\n action, x, y = @monome.read\n toggle_led(x,y) if action == :keydown\n end\n end\n end", "def process_ok\n Sound.play_ok\n super\n end", "def check_event_trigger_there(triggers)\n # not started if already running\n return false if $game_system.map_interpreter.running?\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # calculate new coordinates\n nx = player.x + (player.direction == 6 ? 1 : player.direction == 4 ? -1 : 0)*pix\n ny = player.y + (player.direction == 2 ? 1 : player.direction == 8 ? -1 : 0)*pix\n # initialize result\n result = false\n # iterate through all events\n $game_map.events.each_value {|event|\n # if triggered by touch and trigger started the event\n if triggers.include?(event.trigger) &&\n event.check_event_trigger_at(nx, ny)\n # events were started\n result = true\n end}\n # if event was not started and counter\n if !result && $game_map.pixel_counter?(nx, ny)\n # change new coordinates\n nx += (player.direction == 6 ? 1 : player.direction == 4 ? -1 : 0)*pix\n ny += (player.direction == 2 ? 1 : player.direction == 8 ? -1 : 0)*pix\n # iterate through all events\n $game_map.events.each_value {|event|\n # if triggered by touch and trigger started the event\n if triggers.include?(event.trigger) &&\n event.check_event_trigger_at(nx, ny)\n # events were started\n result = true\n end}\n end\n # return result\n return result\n end", "def is_touching?(character)\r\r\n @touch_chars.include?(character)\r\r\n end", "def play\n synchronize do\n @starved = false\n @source.play\n end\n end", "def listen?\n @paused == false\n end", "def update event\n @image.fill :white\n enemy_in_range?\n attack! unless @target.nil?\n end", "def player_push(event)\n event.turn_away_from_player\n event.jump_back if event.check_com(\"JUMPBACK\") and\n event.pushable_busy.nil? and not event.jump_passable?(1, true)\n if event.passable?(event.x, event.y, @direction) and !event.moving?\n unless event.x == @x and event.y == @y\n event.move_away_from_player\n RPG::SE.new(PushSe,80).play\n end\n end\n end", "def started_playing(player_data)\n do_started_playing(self, player_data)\n end", "def event_running?\n get_scene.event_running?\n end", "def beginGameLoop\n @gameLoop.play\n end", "def update\n return false unless @active\n nu_x, nu_y = @x, @y\n if Input.repeat?(Input::RIGHT)\n nu_x += 1 \n elsif Input.repeat?(Input::LEFT)\n nu_x -= 1 \n elsif Input.repeat?(Input::DOWN)\n nu_y += 1 \n elsif Input.repeat?(Input::UP)\n nu_y -= 1 \n end\n #check if moved and not moved outside the map\n if (nu_x != @x or nu_y != @y) and $game_map.valid?(nu_x, nu_y)\n moveto( nu_x, nu_y)\n Sound.play_cursor\n return true\n end\n return false\n end", "def event_check(x, y, d, self_event = nil)\n # get pixel movement rate and set bit\n pix, bit = $BlizzABS.pixel, (1 << (d / 2 - 1)) & 0x0F\n # iterate trough all events except self\n (self.events_only - [self_event]).each {|event|\n # if there's an event that's not through and has a graphic\n if event.character_name != \"\" && event.x == x / pix && \n event.y == y / pix && !event.through &&\n (!self_event.is_a?(Map_Battler) || event.tile_id >= 384)\n # if obstacle bit is set\n if @passages[event.tile_id] & bit != 0\n # get x and y of next tile\n case d\n when 2 then nx, ny = x / pix, (y + 1) / pix\n when 4 then nx, ny = (x - 1) / pix, y / pix\n when 6 then nx, ny = (x + 1) / pix, y / pix\n when 8 then nx, ny = x / pix, (y - 1) / pix\n else\n nx = ny = nil\n end\n # impassable if not on the same tile anymore\n return false if x / pix != nx || y / pix != ny\n # if obstacle bit is set in all directions\n elsif @passages[event.tile_id] & 0x0F == 0x0F\n # impassable in the given direction\n return false\n # if priority is 0\n elsif @priorities[event.tile_id] == 0\n # passable in the given direction\n return true\n # if event is not a tile and not through\n elsif !event.through\n # impassable in any direction\n return false\n end\n end}\n # passable\n return true\n end", "def play\n\t\tgame_loop\n\tend", "def play_until_victory \n\tuntil victory == true \n\t\t first_player_plays\n\t\t second_player_plays\n\tend\n end", "def update\n @touch_event_list.each do |touch_event|\n touch_event.getPointerCount.times do |index|\n touch = Touch.new(touch_event. getPointerId(index), touch_event.getX(index), touch_event.getY(index))\n #Check is touch is inside the screen use, otherwise ignore it\n if(touch.x > 0 and touch.x < @max_x and touch.y > 0 and touch.y < @max_y)\n case touch_event.getAction\n when JavaImports::MotionEvent::ACTION_DOWN\n @window.touch_began(touch)\n when JavaImports::MotionEvent::ACTION_MOVE\n @window.touch_moved(touch)\n when JavaImports::MotionEvent::ACTION_UP\n @window.touch_ended(touch)\n end\n end\n end\n end \n \n @key_event_list_down.each do |key_event|\n @window.button_down key_event\n end\n \n @key_event_list_up.each do |key_event|\n @window.button_up key_event\n end \n\n end", "def on_start\n end", "def play\n # unless the game is over players take turns\n take_turn until game_over?\n\n #start a new game if the game is over\n new_game_or_quit\n end", "def handle_start\n loop until get_player_output.size > 1\n @state.handle_start\n end", "def on_play(track)\n end", "def inside(player)\n acttions.each { |action| action.inside(player) }\n end", "def touches()\n @view__.touches\n end", "def player_fire_bullet()\r\n # This makes sure that bullets are fired after certain intervals\r\n if Gosu.milliseconds > (@seconds_elapsed * COUNTER)\r\n @seconds_elapsed = Gosu.milliseconds\r\n @bullet_sound.bmp.play()\r\n # Generating a bullet object\r\n @bullets.push Bullet.new((@player.x+ 33), @player.y, 'good')\r\n end \r\n end", "def start_end_tb_ev\n return if !(e = $game_map.events[TM.end_ev_id])\n Era::AI.start_event(e.id)\n TM.done_starting_end_ev\n end", "def start!\n return false if started?\n\n raise PlayerNotSelected, 'Both player and opponent is required' if player.nil? || opponent.nil?\n\n update_columns(\n {\n status: Game::RUNNING,\n started_at: Time.zone.now\n }\n )\n\n true\n end", "def shoot\n @shooting = true\n end", "def on_input\n @movement.each do |entity|\n entity[:movement]= nil\n end\n\n @player[:action]= case @window.active_input\n when \"h\" then [:move, Vector[-1, 0]]\n when \"j\" then [:move, Vector[ 0, 1]]\n when \"k\" then [:move, Vector[ 0, -1]]\n when \"l\" then [:move, Vector[ 1, 0]]\n when \"y\" then [:move, Vector[-1, -1]]\n when \"b\" then [:move, Vector[-1, 1]]\n when \"u\" then [:move, Vector[ 1, -1]]\n when \"n\" then [:move, Vector[ 1, 1]]\n when \"g\" then [:draw_card]\n when \"f\" then [:play_weapon]\n when \"d\" then [:play_spell]\n when \"s\" then [:play_item]\n when \"a\" then [:replace_item]\n when \"q\" then throw(:game_end)\n else\n return\n end\n\n @ai_method.each do |entity|\n entity[:action] = self.send(entity[:ai_method], entity)\n end\n\n @action.each do |entity|\n action, *args = entity[:action]\n next if action.nil?\n\n self.send(action, entity, *args)\n entity[:action]= nil\n end\n\n @movement.each do |entity|\n next if entity[:movement].nil?\n\n oldpos = entity[:position]\n newpos = entity[:position] + entity[:movement]\n\n next if out_of_bounds?(newpos)\n\n entities_at_pos = @map[:index][newpos]\n obstructed = entities_at_pos.any? do |entity|\n entity[:obstructing] == true\n end\n next if obstructed\n\n b = entity[:position]\n m = entity[:movement] / 5.0\n points = 6.times.map { |t| (b + (m*t)) }\n\n entity[:position]= newpos\n entity[:movement]= nil\n entity[:tween_points]= points\n @map[:index][oldpos].delete(entity)\n @map[:index][newpos].push(entity)\n end\n\n @animating = true\n end", "def fire\n if Gosu::milliseconds - @prev_shot > 60\n self.shots.push(Shot.new(self.game,\"player_shot\",@gfx_shot,@x+8,@y,90,10)) unless @live_shots >= @shots_budget\n @prev_shot = Gosu::milliseconds\n end\n end", "def sleep_now?\n self.x_vel == 0 && self.y_vel == 0 && !should_fall?\n end", "def sleep_now?\n self.x_vel == 0 && self.y_vel == 0 && !should_fall?\n end", "def play\n @hungry = true\n end", "def play\n @hungry = true\n end", "def play\n @hungry = true\n end" ]
[ "0.7232688", "0.7051653", "0.6952872", "0.67571384", "0.67202485", "0.66883785", "0.66378367", "0.66156673", "0.6557029", "0.6439099", "0.63776046", "0.6367831", "0.6356335", "0.63454074", "0.6293763", "0.6194261", "0.60882723", "0.607761", "0.60332024", "0.58780277", "0.58687764", "0.5858806", "0.58145505", "0.57393634", "0.57318795", "0.56357133", "0.5623126", "0.5573667", "0.55574405", "0.5541849", "0.5530898", "0.54866064", "0.5486009", "0.54785496", "0.5477938", "0.54753864", "0.5469599", "0.54691255", "0.5463303", "0.54600155", "0.54478794", "0.5423155", "0.54107565", "0.5400952", "0.5383359", "0.5369871", "0.5354838", "0.534565", "0.53449124", "0.5343107", "0.53404725", "0.5323822", "0.53222156", "0.5296559", "0.529104", "0.5285315", "0.52798593", "0.5271116", "0.52635753", "0.5252457", "0.52452725", "0.52378386", "0.52251136", "0.52100605", "0.5202509", "0.51891446", "0.51862746", "0.51823175", "0.51764", "0.5165411", "0.5155716", "0.51364523", "0.5133662", "0.5131447", "0.51261526", "0.5114186", "0.50996083", "0.5099554", "0.5097092", "0.50872475", "0.50840825", "0.50751334", "0.5072421", "0.5068936", "0.5063505", "0.50605386", "0.5060354", "0.50359887", "0.5035138", "0.5033655", "0.5029474", "0.5021721", "0.50052583", "0.49941465", "0.4993897", "0.49934578", "0.49934578", "0.49897963", "0.49897963", "0.49897963" ]
0.63218766
14
Execute a contentEditable command
def edit(command, value=nil) command = command.gsub(/_./) { |i| i[1].upcase } focus if value `#{document}.native.execCommand(#{command}, false, #{value})` else `#{document}.native.execCommand(#{command}, false)` end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(content, editor: nil, command: nil)\n Editor.new(edit_command(editor, command), content: content).open\n end", "def commands\n\t\t\t{\n\t\t\t\t\"edit\" => \"A handy editor commmand\"\n\t\t\t}\n\t\tend", "def execEditorScript _obj, _args\n \"_obj execEditorScript _args;\" \n end", "def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end", "def execute_command(cmd, options = {})\n active_window.do_script(cmd, options)\n end", "def cmd_edit(*args)\n\t\t\tprint_line (\"Launching editor...\")\n\n\t\t\te = Rex::Compat.getenv(\"EDITOR\") || \"vi\"\n\n\t\t\tif (not active_module) or (not (path = active_module.file_path))\n\t\t\t\t$stderr.puts \"no active module selected\"\n\t\t\t\treturn nil\n\t\t\tend\n\n\t\t\tsystem(e + \" \" + path)\n\t\tend", "def control_textView_doCommandBySelector(control,textView,commandSelector)\n curr_row=@table.selectedRow\n case commandSelector.to_s\n when 'cancelOperation:'\n NSApp.stop(self)\n when 'moveUp:'\n @table.selectRow_byExtendingSelection(curr_row-1,false)\n true\n when 'moveDown:'\n @table.selectRow_byExtendingSelection(curr_row+1,false)\n true\n when 'insertNewline:'\n if curr_row!=-1\n open_file_in_editor(curr_row)\n elsif @filtered_files.size==1\n open_file_in_editor(0)\n else\n false\n end\n end\n end", "def execute_command(cmd, options = {})\n if options[:in]\n options[:in].write(:text => \"#{cmd}\")\n else\n active_window.write(:text => \"#{cmd}\")\n end\n end", "def edit_custom_command(command_name, owner_user_id, new_command_content)\n return false if new_command_content.length > custom_command_content_max_length\n commands = USER_CUSTOM_COMMANDS.where{Sequel.&({owner_user_id: owner_user_id}, {command_name: command_name})}\n return false if commands.count() <= 0\n\n commands.update(command_content: new_command_content)\n return true\n end", "def edit\n puts \"\\n******* edit *******\"\n end", "def command(command_text)\n @command_text = command_text\n end", "def execute_command command_text\r\n #TODO: really, what is point of this \"convenience\" method!?\r\n create_command( command_text ).execute\r\n end", "def editor_insert_character!\n Vedeu.bind(:_editor_insert_character_) do |name, character|\n Vedeu.documents.by_name(name).insert_character(character)\n end\n end", "def execute\n command = lines.map(&:to_s).join(\"\\n\")\n\n reset!\n\n clear\n\n Vedeu.trigger(:_command_, command)\n\n command\n end", "def cmd_after_replace(file, lineno, content, cmd)\n change_line(file, lineno, content)\n cmd\n end", "def edit\n p \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n p \"-----------------------\"\n super\n end", "def handle_text_insertion pos, text\n add_command InsertionCommand.new(pos, text)\n end", "def exec(command)\n @commands << %{write text \"#{command}\"}\n end", "def entering text, options = {}\n widget = find_widget options[:into]\n widget.insert_text text, widget.position\n process_events\nend", "def edit\n puts \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\"\n end", "def my_edit(args)\n path = args[0]\n return if editing_forbidden_files(path)\n\n system(\"#{ENV['EDITOR_PATH']} #{path}\")\n end", "def editable!\n editable(true)\n end", "def edit\n puts \"******* edit *******\"\n end", "def execute(command)\n end", "def exec cwd, cmd\n raise NotImplementedError.new(\n \"exec should be implemented to execute cmd on current window\")\n end", "def result_of_executing_the_commands\n @commands = \":set ft=ruby\r\" + @commands\n RobotVim::Runner.new.run(:input_file => @input, :commands => @commands)\nend", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def execute_command(command)\n end", "def execute_command(command)\n end", "def execute_command(command)\n %x{#{command}}\n end", "def execute_command(command)\n @stdin.puts command\n end", "def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend", "def run_cmd(cmd)\n\t\tconsole.run_single(cmd)\n\tend", "def do_run\n return unless @output\n\n @output_buffer = []\n @output.value = ''\n @editor.focus\n source = @editor.value.strip\n return unless source\n\n # Add additional code if available\n if @loaded && @current_item && @current_item.load_code\n source = \"#{@current_item.load_code}\\n#{source}\"\n end\n\n # Compile\n begin\n code = Opal.compile(source)\n rescue Exception => err\n log_error err\n end\n\n # Run\n eval_code code\n end", "def instruction (command)\n\t\t\t@actor.tell @actor.state.prompt + command\n\t\t\t@actor.perform command\n\t\tend", "def edit(comment)\n comment.gsub!(\"\\n\", \" \")\n self.p(:text=>comment).parent.parent.button(:text=>\"Edit\").click\n wait_for_ajax(2) #wait_until { self.textarea(:title=>\"Edit your comment\").present? }\n end", "def run_cmd(input); end", "def Com1\n @type = \"Texte\"\n @commande_window.deactivate\n if console_texte\n @x = 0\n @y = 0\n @commande_window.hide\n @window_command_command = Window_CommandTextSelect.new(@texte,@x,@y)\n @window_command_command.set_handler(:CT1, method(:ComText1))\n @window_command_command.set_handler(:CT2, method(:ComText2))\n @window_command_command.set_handler(:CT3, method(:ComText3))\n @window_command_command.set_handler(:cancel, method(:ComText4))\n @window_command_command.activate\n else\n @commande_window.activate\n end\n end", "def execute_hook(command); end", "def _rl_vi_textmod_command(c)\r\n return @vi_textmod[c]\r\n end", "def edit (filename, *data_and_options)\n data, options = *parse_data_and_options(data_and_options)\n editor =\n ENV.has_key?('VISUAL') ? ENV['VISUAL'] :\n ENV.has_key?('EDITOR') ? ENV['EDITOR'] : 'vi'\n\n file_stat = File.stat(filename)\n file_checksum = SHA1.file(filename)\n system(editor, filename, options)\n proc_status = $?\n\n if options[:noop]\n return true\n\n elsif proc_status.success?\n return nil if file_stat == File.stat(filename)\n return false if file_checksum == SHA1.file(filename)\n return true\n\n elsif proc_status.signaled?\n raise AdvFileUtils::CommandError.new(\"editor terminated on signal #{proc_status.termsig}\")\n\n else\n raise AdvFileUtils::CommandError.new(\"editor had non-zero exit code #{proc_status.exitstatus}\")\n end\n end", "def execute_custom_command(cmd, *args)\n return output_error(cmd) unless command_is_authorized?(cmd)\n\n args = %w[cd edit].include?(cmd) ? args : protected_args(args)\n send(\"my_#{cmd}\", args)\n end", "def edit\n @prompt = \"save\"\n %[<textarea name='settings' class='form' style='width: 100%; height: 30%;'>#{self.yaml.value || BASIC}</textarea><textarea name='editor' class='form' style='width: 100%; height: 70%;'>#{self.md.value || INDEX}</textarea>];\n end", "def performEdit(input)\n result = false\n modify = true\n base = 0\n need = @field_width\n temp = ''\n col = need - @field_edit - 1\n\n @field_win.wmove(0, base)\n @field_win.winnstr(temp, need)\n temp << ' '\n if CDK.isChar(input) # Replace the char at the cursor\n temp[col] = input.chr\n elsif input == Ncurses::KEY_BACKSPACE\n # delete the char before the cursor\n modify = CDK::SCALE.removeChar(temp, col - 1)\n elsif input == Ncurses::KEY_DC\n # delete the char at the cursor\n modify = CDK::SCALE.removeChar(temp, col)\n else\n modify = false\n end\n if modify &&\n ((value, test) = temp.scanf(self.SCAN_FMT)).size == 2 &&\n test == ' ' &&\n value >= @low && value <= @high\n self.setValue(value)\n result = true\n end\n\n return result\n end", "def edit(*args)\n open_with ENV['EDITOR'], *args\n end", "def editor_delete_character!\n Vedeu.bind(:_editor_delete_character_) do |name|\n Vedeu.documents.by_name(name).delete_character\n end\n end", "def do\n unless done\n @text = \"x #{text}\".strip\n @done = true\n end\n end", "def putch char\n @current_index ||= 0\n if @editable \n raise \"how is it editable here in combo\"\n super\n return 0\n else\n match = next_match(char)\n text match unless match.nil?\n fire_handler :ENTER_ROW, self\n end\n @modified = true\n fire_handler :CHANGE, self # 2008-12-09 14:51 ???\n 0\n end", "def run\r\n # Evaluate any launch params\r\n if ARGV.any?\r\n # Set data text to params joined by spaces\r\n @data_edit.set_text(ARGV.join ' ')\r\n end\r\n # Show main widget and execute application\r\n @main_widget.show\r\n self.exec\r\n end", "def exe(s)\n VIM.command s\nend", "def run_script(content)\n user_switch = \"\"\n\n unless @user == \"root\"\n user_switch = USER_SWITCH_COMMAND\n end\n\n wrapper = <<-EOF\n if [ -e /dev/fd/0 ]\n then\n #{user_switch} /bin/sh /dev/fd/0\n elif [ -e /dev/stdin ]\n then\n #{user_switch} /bin/sh /dev/stdin\n else\n echo \"Cannot find method of communicating with the shell via stdin\"\n exit 1\n fi\n EOF\n\n exec_ssh(wrapper, content)\n end", "def edit_text text\n # 2010-06-29 10:24 \n require 'fileutils'\n require 'tempfile'\n ed = ENV['EDITOR'] || \"vim\"\n temp = Tempfile.new \"tmp\"\n File.open(temp,\"w\"){ |f| f.write text }\n mtime = File.mtime(temp.path)\n #system(\"#{ed} #{temp.path}\")\n system(ed, temp.path)\n\n newmtime = File.mtime(temp.path)\n newstr = nil\n if mtime < newmtime\n # check timestamp, if updated ..\n newstr = File.read(temp)\n else\n #puts \"user quit without saving\"\n return nil\n end\n return newstr.chomp if newstr\n return nil\n end", "def execute\n\t\tdoCommandList.each do |commandItem|\n\t\t\tcommandItem.execute\n\t\tend\n\tend", "def command_content\n return @command_content\n end", "def edit(file)\n editor_command = find_editor\n unless editor_command\n message(\"Can not find $VISUAL, $EDITOR, vim, or vi on your path\")\n return\n end\n\n cmd = \"#{editor_command} #{file}\"\n @pm.debug(cmd)\n system(cmd)\n load(file)\n @loaded_file = file\n end", "def type_ck_editor(id, text)\n execute_script(\"CKEDITOR.instances['#{id}'].insertText('#{text}');\")\n end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def run_code(code)\n codemirror_send_keys(find('#scratchpad-editor-wrapper'), code)\n find_button('__papyros-run-code-btn', disabled: false).click\n end", "def on_input_ok\n @@text = @edit_window.text\n return_scene\n end", "def store_editable locator, variable_name\r\n command 'storeEditable', locator, variable_name\r\n end", "def edit!(filename)\n file_path = Path.new(filename)\n command \"edit! #{file_path}\"\n self\n end", "def do_command\n if @index == 0\n call_scene(SearchMethod)\n elsif @index == 1\n do_command1\n elsif display_message(ext_text(8997, 32), 2, ext_text(8997, 33), ext_text(8997, 34)) == 0\n $game_system.se_play($data_system.cancel_se)\n @running = false\n end\n end", "def formulate_command\n @command\n end", "def edit_file( path)\n\t\tVim::command(\"edit #{path}\")\n\tend", "def edit\n execute_external_command do\n editor = ENV['EDITOR'] || 'vim'\n unless in_zip?\n system %Q[#{editor} \"#{current_item.path}\"]\n else\n begin\n tmpdir, tmpfile_name = nil\n Zip::File.open(current_zip) do |zip|\n tmpdir = Dir.mktmpdir\n FileUtils.mkdir_p File.join(tmpdir, File.dirname(current_item.name))\n tmpfile_name = File.join(tmpdir, current_item.name)\n File.open(tmpfile_name, 'w') {|f| f.puts zip.file.read(current_item.name)}\n system %Q[#{editor} \"#{tmpfile_name}\"]\n zip.add(current_item.name, tmpfile_name) { true }\n end\n ls\n ensure\n FileUtils.remove_entry_secure tmpdir if tmpdir\n end\n end\n end\n end", "def cmd(cmd)\n puts cmd\n system cmd\n end", "def execute(command)\n @command = command\n self\n end", "def call_editor\n self.class.call_editor(@repo)\n end", "def edit( filename )\n\t\teditor = ENV['EDITOR'] || ENV['VISUAL'] || DEFAULT_EDITOR\n\t\tsystem editor, filename.to_s\n\t\tunless $?.success? || editor =~ /vim/i\n\t\t\traise \"Editor exited with an error status (%d)\" % [ $?.exitstatus ]\n\t\tend\n\tend", "def smart_edit(content_type=0,save_url)\n if content_type == 1\n render \"shared/wysihtml5_js\", {url: save_url}\n else\n render \"shared/autosave_js\", {url: save_url}\n end\n end", "def run_command\n do_on_interactive_process do |match|\n @logger.debug \"Read: #{match}\"\n exec_each_prompt match[1]\n end\n end", "def enter_command\n\t\tanswer = $screen.ask(\"command:\",$command_hist)\n\t\teval(answer)\n\t\t$screen.write_message(\"done\")\n\trescue\n\t\t$screen.write_message(\"Unknown command\")\n\tend", "def run_shell_command(line)\n TOPLEVEL_BINDING.eval('self').execute_shell_command_internal(line)\n end", "def run_action_edit(item)\n validate_item(item)\n run_action_create(item)\n end", "def ctrlSetText _obj, _args\n \"_obj ctrlSetText _args;\" \n end" ]
[ "0.67016417", "0.6207169", "0.6111128", "0.6016891", "0.6016891", "0.5993504", "0.5877074", "0.58044064", "0.57612485", "0.5753503", "0.569014", "0.5690111", "0.565304", "0.5607638", "0.55949473", "0.5586556", "0.55719775", "0.5546431", "0.5538674", "0.55344945", "0.55237323", "0.55058616", "0.54710424", "0.54415", "0.5440702", "0.54330117", "0.5399679", "0.5399679", "0.5399679", "0.5399679", "0.5399679", "0.5399679", "0.53837025", "0.53837025", "0.5378358", "0.5360002", "0.5351428", "0.5351428", "0.534949", "0.53494495", "0.5334093", "0.530316", "0.5300509", "0.5289433", "0.5286848", "0.5280962", "0.5267993", "0.5261738", "0.5249976", "0.524679", "0.52453434", "0.52419853", "0.5216072", "0.5215325", "0.52099794", "0.5204774", "0.51920503", "0.519115", "0.5184839", "0.518008", "0.5178614", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.517024", "0.5168601", "0.51674986", "0.516255", "0.5161195", "0.5149807", "0.51454353", "0.5141642", "0.51351494", "0.5111718", "0.5111076", "0.51079273", "0.5106598", "0.50949067", "0.5093939", "0.5091292", "0.50902337", "0.508979", "0.508822" ]
0.7324193
0
GET /reuniaos GET /reuniaos.json
def index if params[:q] !=nil @reuniaos = Reuniao.created_between(params[:q],params[:o]) else @reuniaos = Reuniao.buscaTitulo(params[:p]) #@pessoa = Pessoa.all end #@reuniaos=Reuniao.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @reuniaos } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :user], methods: [:valoracion])\n end", "def index\n @uchronias = Uchronia.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronias }\n end\n end", "def listar()\n @client.get(Route.new([ROTA_DID]))\n end", "def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end", "def index\n @restoras = Restora.all\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @preparatoria_o_universidad_de_origens = PreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @preparatoria_o_universidad_de_origens }\n end\n end", "def index\n seleccionarMenu(:rondas)\n @rondas = Ronda.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rondas }\n end\n end", "def index\n @ordenes = Orden.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ordenes }\n end\n end", "def index\n @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 show\n @rua = Rua.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rua }\n end\n end", "def index\n @ordens = Orden.all\n render json: @ordens\n end", "def show\n @remito = Remito.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @remito }\n end\n end", "def index\n @remuneracoes = Remuneracao.all\n end", "def index\n @tutorados = Tutorado.all\n\n render json: @tutorados, status: :ok\n end", "def index\n @universes = Universe.all.page(params[:page]).per(25)\n respond_to do |format|\n format.html\n format.json { render json: @universes }\n end\n end", "def show\n @uchronia = Uchronia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronia }\n end\n end", "def index\n @ruolos = Ruolo.all\n end", "def index\n @regrapontos = Regraponto.all\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end", "def index\n @urnas = Urna.all\n end", "def index\n @urnas = Urna.all\n end", "def index\n @regos = Rego.all\n end", "def index\n @municipio_de_la_preparatoria_o_universidad_de_origens = MunicipioDeLaPreparatoriaOUniversidadDeOrigen.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipio_de_la_preparatoria_o_universidad_de_origens }\n end\n end", "def show\n @relogio = Relogio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @relogio }\n end\n end", "def index\n @roupas = Roupa.all\n end", "def index\n @anuncios = Anuncio.all\n render json: @anuncios, status: :ok\n end", "def index\n @uchronists = Uchronist.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @uchronists }\n end\n end", "def index\n @rozmiars = Rozmiar.all\n end", "def index\n @ativo_outros = AtivoOutro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ativo_outros }\n end\n end", "def listRestaurants\n _restaurants = Restaurant.all\n render json: _restaurants\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\n @rutas = Ruta.all\n end", "def index\n @premios = Premio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @premios }\n end\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def index\n @relatorios = Relatorio.all.page(params[:page]).per(15)\n end", "def index\n @ultimo_grado_de_estudios = UltimoGradoDeEstudio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ultimo_grado_de_estudios }\n end\n end", "def index\n @prueba_jsons = PruebaJson.all\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end", "def index\n seleccionarMenu(:juzgados)\n @juzgados = Juzgado.order(:ciudad_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @juzgados }\n end\n end", "def index\n \n if current_user.tipo == 2\n @receita_medicas = ReceitaMedica.where(:medico_id => current_user.id)\n elsif current_user.tipo == 1\n @receita_medicas = ReceitaMedica.where(:paciente_id => current_user.id)\n elsif current_user.tipo == 3\n @receita_medicas = Venda.receitas_medicas(current_user.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @receita_medicas }\n end\n end", "def index\n @usuarios = Usuario.por_colegio(colegio.id).order(\"nombre\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usuarios }\n end\n end", "def index\n @ugroupes = Ugroupe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ugroupes }\n end\n end", "def request_rover_api\n\t\turl = \"https://api.nasa.gov/mars-photos/api/v1/rovers/#{@rover}/photos?sol=#{@sol}&api_key=#{@api_key}\"\n\t\trequest = Net::HTTP.get_response(URI.parse(url))\n\t\tresponse = JSON.parse(request.body)\n\n\t\tif response.key?('photos')\n\t\t\treturn response\n\t\tend\n\n\t\treturn response = []\n \tend", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def index\n @uzsers = Uzser.all\n end", "def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end", "def index\n @ramais = Ramal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ramais }\n end\n end", "def index\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalles = @recibo.renglon_recdetalles.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_recdetalles }\n end\n end", "def index\n @riyu_okunais = RiyuOkunai.all\n end", "def lista_estoque()\n @client.get(Route.new([ROTA_DID_ESTOQUE]))\n end", "def show\n render json: @lugar\n end", "def index\r\n @respuesta = Respuestum.all\r\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def show\n @agronomiaquimica = Agronomiaquimica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agronomiaquimica }\n end\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def get_todo_restaurants\n @profile = Profile.find(params[:id])\n @restaurants = @profile.todos\n\n render status: 200, json: @restaurants\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 @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 show\n seleccionarMenu(:rondas)\n @ronda = Ronda.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ronda }\n end\n end", "def show\n @recoleccion = Recoleccion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recoleccion }\n end\n end", "def index\n #@arquivos = Arquivo.all\n\n residencial = current_user.apartamento.residencial\n @arquivos = Arquivo\n .where(:residencial_id => residencial.id)\n .order(\"created_at\")\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arquivos }\n end\n end", "def index\n @reprogramaciones = Reprogramacion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reprogramaciones }\n end\n end", "def index\n @rodadas = Rodada.all\n end", "def index\n users = @fun.get_reposts.limit(5).reposters\n users.map! do |user|\n user = user.info_to_json\n user[:user_path] = user_path user[:login]\n user\n end\n render json: users\n end", "def index\n @acuerdos = Acuerdo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acuerdos }\n end\n end", "def index\n #para mostrar solo los post del usuario actual\n @posts = Post.where(usuario_id: current_usuario.id).all\n puts \"USUARIOOOO\"\n puts current_usuario.to_json\n\n #@posts = Post.all\n end", "def index\n @riesgos = Riesgo.all\n end", "def recolectores\n @personas = Persona.where(:empleados_id => 2).order(\"apellido ASC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @personas }\n end\n end", "def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def index\n @respuestas = Respuesta.all\n end", "def index\n @renomears = Renomear.all\n end", "def index\n @repuestos = Repuesto.all\n end", "def index\n @seguridad_usuarios = Seguridad::Usuario.order('usuario')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @seguridad_usuarios }\n end\n end", "def index\n @tipo_usuarios = TipoUsuario.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_usuarios }\n end\n end", "def show\n @respuesta = Respuesta.find(params[:id])\n\n render json: @respuesta\n end", "def index\n @recaudacions = Recaudacion.all\n end", "def show\n @ultimos_recibos = @usuario.recibos.order(data: :desc)\n end", "def show\n @reconocimiento = Reconocimiento.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reconocimiento }\n end\n end", "def show\n \trespond_with @rubro\n end", "def index\n if params[:usuario_producto]\n @usuario = Usuario.find(params[:usuario_id])\n render json: @usuario.productos\n else\n @productos = Producto.all\n render json: @productos\n end\n end", "def index\n residencial = current_user.apartamento.residencial\n #@eventos = Evento.joins(:user => [{:apartamento => :residencial}])\n #.where(:residenciais => {:id => residencial.id})\n #.order(\"created_at DESC\")\n\n @eventos = Evento\n .where(:residencial_id => residencial.id)\n .order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eventos }\n end\n end", "def index\n @arrendatarios = Arrendatario.all\n end", "def index\n @receitas = Receita.all\n @receitas = current_usuario.receitas.page(params[:page])\n end", "def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\n end\n end", "def index\n @lugars = Lugar.all\n\n render json: @lugars\n end", "def index\n\t\t#retornando a lista de nome\n\t\t#@restaurantes = Restaurante.order :nome\n\t\t#deixando paginando com kaminari\n @restaurantes = Restaurante.order(\"nome\").page(params['page']).per(3)\n\t\t#verificando qual formato foi solicitado para poder retorna ou html ou jsnon ou xml\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.xml {render xml: @restaurantes}\n\t\t\tformat.json {render json: @restaurantes}\n\t\tend\n\tend", "def index\n @omatsuris = Omatsuri.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @omatsuris }\n format.json { render :json => @omatsuris }\n end\n end", "def index\r\n @imobiliarias = Imobiliaria.all\r\n\r\n respond_to do |format|\r\n # format.html # index.html.erb\r\n format.json { render json: @imobiliarias }\r\n end\r\n end", "def index\n @recoleccions = Recoleccion.all\n end", "def show\n @repa = Repa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @repa }\n end\n end", "def index\n @ofertas = Oferta.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ofertas }\n end\n end", "def index\n @rameurs = Rameur.where(confirmation_token: nil).asc(\"prenom\").asc(\"nom\").paginate(page: params[:page], per_page: 5)\n\n respond_to do |format|\n format.html { @rameurs }\n format.json {\n render json: {\n current_page: @rameurs.current_page,\n per_page: @rameurs.per_page,\n total_entries: @rameurs.total_entries,\n entries: @rameurs\n }\n }\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 index\n @zorras = Zorra.all\n end", "def index\n @articulos = Articulo.where(\"tipo = 'articulo'\").order(\"created_at desc\") \n @noticias = Articulo.where(\"tipo = 'noticia' and mostrar_carrusel='1'\").order(\"created_at desc\").limit(3)\n @articulos = @articulos.page(params[:page]).per_page(5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @articulos }\n end\n end" ]
[ "0.66942984", "0.6679619", "0.6664429", "0.66605556", "0.66023844", "0.65374935", "0.65137815", "0.6484795", "0.64548063", "0.63460666", "0.6318742", "0.6283837", "0.62751997", "0.6229841", "0.62151563", "0.6205752", "0.61935174", "0.6166426", "0.6164358", "0.6151002", "0.6127417", "0.6119773", "0.6110691", "0.61060876", "0.61060876", "0.6094312", "0.60860884", "0.6073617", "0.60361594", "0.602835", "0.6022269", "0.6011629", "0.59822786", "0.59813166", "0.597245", "0.59626913", "0.5958501", "0.5948153", "0.5947242", "0.593544", "0.5931582", "0.5928614", "0.5928478", "0.5916238", "0.5915173", "0.59132063", "0.59121466", "0.59115005", "0.5901492", "0.5892378", "0.5883003", "0.5878645", "0.5876434", "0.586967", "0.58641714", "0.58574414", "0.58566725", "0.5854397", "0.5842144", "0.5834215", "0.5833961", "0.58184457", "0.5817295", "0.58145773", "0.5814551", "0.581207", "0.5803997", "0.58021295", "0.57999706", "0.57960474", "0.579422", "0.57907104", "0.5790429", "0.5782138", "0.5780571", "0.5780501", "0.5779864", "0.57716745", "0.5770377", "0.57703733", "0.57670873", "0.57653165", "0.576355", "0.57575625", "0.5756722", "0.57537466", "0.5750487", "0.5749837", "0.5744237", "0.5742262", "0.5741538", "0.57402647", "0.57389235", "0.5735786", "0.5734053", "0.5728907", "0.5728431", "0.5728127", "0.5721846", "0.5721149", "0.5721002" ]
0.0
-1