query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
=> Performs the actual delivery, in this case, execute SQL query.
def execute Services::Slog.debug({:message => "File write for #{@template[:identifier]}", :module => "FileTemplate", :task => "execute", :extra => {:template => @template[:identifier], :payload => @template[:payload]}}) case @template[:payload][:method] when 'create' begin @template.users.each do |user| File.open("data/users/#{user.id}/#{@template[:payload][:uri]}", "w+") { |file| file.write("\n") } response = { :status => "200", :message => "File created.", :id => @template[:payload][:uri]} unless @template[:payload][:content].nil? then File.open("data/users/#{user.id}/#{@template[:payload][:uri]}", "w+") { |file| file.write(@template[:payload][:content]) } end end rescue Exception => e Services::Slog.exception e response = { :status => "400", :message => "Method not is unsupported, #{e}" } end when 'append' begin @template.users.each do |user| unless @template[:payload][:content].nil? then File.open(Dir.pwd + "/data/users/#{user.id}/#{@template[:payload][:uri]}", "a+") { |file| file.write(@template[:payload][:content]) } end end response = { :status => "200", :message => "Content appended to file", :id => @template[:payload][:uri]} rescue Exception => e response = { :status => "403", :message => "Error processing file, #{e}" } Services::Slog.exception e end end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute\n # build the query string\n # run the query\n # return the results\n end", "def execute(sql)\n @db.send(:_execute, self, sql, :log=>false) \n end", "def fire\n PassiveRecord::Adapter.execute to_sql\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 execute\n\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 execute()\r\n\tend", "def execute\n end", "def execute\n end", "def execute\n end", "def execute\n end", "def execute()\n\n end", "def execute()\n\n end", "def execute; end", "def execute; end", "def execute(sql)\r\n\t\t@connection.Execute(sql)\r\n\tend", "def execute_query(sql, args)\n @db.log_connection_yield(sql, self, args){args ? async_exec(sql, args) : async_exec(sql)}\n end", "def execute\n end", "def execute(sql)\n @logger.debug(\"SQL: #{sql}\") if @logger\n retrieve_connection.query(sql)\n end", "def execute\n ActiveRecord::Base.connection.execute(source)\n end", "def run_query()\n return nil unless @query\n \n gres = @query.execute()\n if @filterClass \n fres = @filterClass.filter(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n elsif @filterBlock \n fres = @filterBlock.call(gres)\n res = fres.kind_of?(Array) ? fres.join(\"\\n\") : fres.to_s\n else\n res = fres.result_s\n end\n res\n end", "def execute sql\n db[sql]\n end", "def query(sql)\n if NB.neverblocking? && NB.reactor.running?\n send_query sql\n NB.wait(:read, IO.new(socket))\n get_result\n else\n super(sql)\n end\n end", "def execute *params\r\n sql = parse_args( *params )\r\n @driver.execute( sql )\r\n end", "def _execute(sql, name = nil)\n @connection.execute(sql)\n end", "def do_execute(sql, name = 'SQL')\n log(sql, name) { raw_connection_do(sql) }\n end", "def query(sql)\n if Fiber.respond_to? :current and Fiber.current[:neverblock]\t\t \n send_query sql\n @fiber = Fiber.current\t\t \n Fiber.yield \n else\t\t \n super(sql)\n end\t\t\n end", "def execute(sql, tx = nil)\n run(:_send_query, [sql], tx)\n end", "def perform\n\n _perform do\n\n sanitize_event_data\n\n create_purchase_log_entry\n\n get_user_from_ethereum\n\n update_purchase_attribute_in_pepo_campaigns\n\n send_purchase_confirmation_email\n\n end\n\n end", "def execute(sql)\n raise NotImplementedError, \"#execute should be overridden by adapters\"\n end", "def execute(*args)\n @db.execute(*args)\n end", "def execute(sql)\n @database_handle.execute(sql)\n end", "def execute(*)\n super\n end", "def execute!; end", "def perform\n # This will allow us to switch backend data structure for\n # searching pretty easily.\n perform_by_mysql\n end", "def send\n Sql.query(JacintheManagement::JACINTHE_MODE, @query)\n end", "def execute\n super()\n end", "def do\n execute flush\n end", "def execute_sql\n ActiveRecord::Base.connection.execute(@sql)\n end", "def execute(sql, args=nil)\n\t\t\t\t\targs = args.map{|v| @db.bound_variable_arg(v, self)} if args\n\t\t\t\t\tq = check_disconnect_errors{execute_query(sql, args)}\n\t\t\t\t\tbegin\n\t\t\t\t\t\tblock_given? ? yield(q) : q.cmd_tuples\n\t\t\t\t\tensure\n\t\t\t\t\t\tq.clear if q && q.respond_to?(:clear)\n\t\t\t\t\tend\n\t\t\t\tend", "def execute\n ds = DataSource.new(@dataSource, @@obj)\n if ds.nil?\n return nil\n else\n return ds.execute(self)\n end\n end", "def exec(sql)\n Logging.with_logged_query self, sql do\n raw_connection.exec sql\n end\n end", "def run_sql(sql_query)\n begin\n CONNECTION.execute(sql_query)\n rescue Exception => msg\n msg\n end\n end", "def execute(sql)\n log_info(sql)\n @pool.hold {|c| c.immediate(sql)}\n end", "def query(sql)\n database.execute2(sql)\n end", "def execute(sql, name = 'SQL')\n log(sql, name) do\n @connection.async_exec(sql)\n end\n end", "def execute!\n @context.backend.schedule { run }\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 execute\n raise \"Not Implemented\"\n end", "def runQuery(query, &block)\n raise \"Trying to run a query when not connected to inventory DB\" if not @connected\n begin\n debug \"SQL Query: '#{query}'\"\n reply=@my.query(query)\n # Check if the SQL result contains anything at all...\n # If so, then call the block of commands to process it\n if (reply.num_rows() > 0)\n reply.each() { |result|\n debug \"SQL Reply: '#{result.to_s}'\"\n yield(result)\n }\n else\n debug \"SQL Reply is EMPTY!\"\n end\n rescue MysqlError => e\n debug \"ERROR - SQL Error: '#{e}'\"\n end\n end", "def perform!\n super\n\n pipeline = Pipeline.new\n\n pipeline << mysql\n\n pipeline.run\n if pipeline.success?\n log!(:finished)\n else\n raise Error, \"Execution Failed!\\n\" + pipeline.error_messages\n end\n end", "def call\n execute(*self.class.executes, abort_on_failure: true)\n end", "def perform_query\n Rails.logger.info queries.to_sql\n queries\n end", "def execute(sql, name = nil) #:nodoc:\n log(sql, name) { @connection.exec sql }\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 execute(sql, name = nil, &block)\n log(sql, name) do\n @connection.query(sql, &block)\n end\n end", "def execute\n result = nil\n ActiveRecord::Base.connection_pool.with_connection do |con|\n result = con.execute(to_sql)\n end\n if @sql_returning.nil?\n nil\n else\n if @returning_flat\n result.values.map{|r| r.first}\n else\n result\n end\n end\n end", "def connection_execute_method\n :query\n end", "def connection_execute_method\n :query\n end", "def execute\n raise NotImplementedError.new('Must override')\n end", "def execute_send\n record_start_time\n queue_attempt\n end", "def execute\n adapter.enqueue klass, *args\n end", "def execute\n return false unless super\n ActiveRecord::Base.transaction do\n # Location Create\n location_params = @recipient_location.merge({name: @parcel_details[:recipient_name] })\n recipient_loc = create_parcel_destination_location(location_params)\n\n # Parcel Create\n parcel_params = @parcel_details.merge({destination_location_id: recipient_loc.id })\n parcel_object = create_parcel(parcel_params) if valid?\n if valid?\n # Mission Create\n mission_params = {\n drone_id: @drone.id,\n warehouse_id: @warehouse.id,\n parcel_id: parcel_object.id\n }\n @result = create_mission(mission_params)\n end\n raise ActiveRecord::Rollback unless valid?\n end\n valid?\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 execute\n return unless active\n process_outbound_messages\n end", "def execute\n Engine.instance.execute([self])[0]\n end", "def execute\r\n @Proxy.foreachDeliverable(@LstTargets) do |iDeliverable|\r\n @Proxy.visitDeliverable(iDeliverable, true) do |iVisitedDeliverable|\r\n buildDeliverable(iVisitedDeliverable)\r\n end\r\n end\r\n end", "def deliver(params={})\n puts \"**** Message#deliver\" if params[:verbose]\n#puts \"**** Message#deliver response_time_limit=#{self.response_time_limit}\"\n save! if self.new_record?\n deliver_email() if send_email\n deliver_sms(:sms_gateway=>params[:sms_gateway] || default_sms_gateway) if send_sms\n end", "def execute(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n q = check_disconnect_errors{execute_query(sql, args)}\n begin\n block_given? ? yield(q) : q.cmd_tuples\n ensure\n q.clear if q && q.respond_to?(:clear)\n end\n end", "def doDB\n \t\tbegin\n \t\t# Query the inventory\n \t\tinv = InventoryService.getInv(@@config)\n \t\tyield(inv)\n \t\trescue Exception => ex\n \t\terror = \"Inventory - Error connecting to the Inventory Database - '#{ex}''\"\n \t\traise HTTPStatus::InternalServerError, error\n \t\tend\n \t\tend", "def execute\n raise \"you need to define #execute\"\n end", "def execute\n raise NotImplementedError\n end", "def query(sql, args=nil)\n args = args.map{|v| @db.bound_variable_arg(v, self)} if args\n check_disconnect_errors{super}\n end", "def execute(sql)\n raise(ArgumentError, \"Bad sql parameter\") unless sql.kind_of?(String)\n\n client = ensure_connected\n\n Pod4.logger.debug(__FILE__){ \"execute: #{sql}\" }\n r = client.execute(sql)\n\n r.do\n r\n\n rescue => e\n handle_error(e)\n end", "def results\n send_query\n end", "def execute(params)\n http_helper.send_post_request(\"#{@url_prefix}/execute\", params)\n end", "def query; end", "def perform(query_id)\n query = Query.find(query_id)\n query.perform!\n end", "def run\n if @prepared_type == :insert\n fetch_rows(prepared_sql){|r| return r.values.first}\n else\n super\n end\n end", "def exec\n proxied_connection.exec\n end", "def run_sql(query)\n raw_run_sql(query)\n end", "def run_sql(sql_query)\n begin\n CONNECTION.execute(sql_query)\n rescue Exception => msg\n @errors << msg\n false\n end\n end", "def execute_remote(query)\n raise \"You must override `execute_remote' in your class\"\n end", "def execute(params = nil)\n params ||= @params\n request.uri = \"#{@db_name}\"\n request.params = params\n Couchdbtools.execute(request)\n end", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|c| _execute(c, sql, opts, &block)} \n end", "def execute(sql, opts={}, &block)\n super(@sproc_name, {:args=>@sproc_args, :sproc=>true}.merge(opts), &block)\n end", "def execute\n self.started\n self.execute_internal\n self.finished\n end", "def execute_query(query)\n ActiveRecord::Base.connection.execute(query.to_sql)\n end", "def run_sql(sql)\n\tdb = PG.connect(dbname: 'address_book', host: 'localhost')\n\tresult = db.exec(sql)\n\tdb.close\n\tresult\nend", "def run_sql(sql_query)\n\tconn = PG.connect(dbname: 'first_crud_app')\n\tresult = conn.exec(sql_query)\n\tconn.close\n\tresult\nend", "def query\n end", "def execute(query, params=nil)\n begin\n @store.execute(query, params)\n rescue SQLite3::Exception => exception\n raise \"SQLite exception: #{exception}\"\n end\n end", "def execute(query)\n TD::Api.client_execute(@td_client, query)\n end", "def perform(inquiry_id)\n inquiry = Inquiry.find_by(id: inquiry_id)\n sender = find_user(inquiry.sender_id)\n receiver = find_user(inquiry.receiver_id)\n apartment = find_apartment(inquiry.apartment_id)\n room = Room.create(name_for_student: \"#{apartment&.title} - #{receiver.username}\" , name_for_landlord: \"#{apartment&.title} - #{sender.username}\", inquiry: inquiry)\n message = Message.create(content: inquiry&.message, user_id: inquiry&.sender_id, room: room)\n InquiryMailer.send_inquiry(sender, receiver, inquiry).deliver_later\n end", "def execute_promotion\n begin\n self.product.promotions.where(send_post_registration_message: true).find_each do |promo|\n if self.created_at.to_date >= promo.start_on.to_date && self.created_at.to_date <= promo.end_on.to_date\n SiteMailer.delay.promo_post_registration(self, promo)\n end\n end\n rescue\n logger.debug \"problem executing a promotion\"\n end\n end", "def execute(sql, name = nil, _binds = [])\n log(sql, name) do\n @connection.do(sql)\n end\n end", "def run_sql(sql)\n db = PG.connect(dbname: 'goodfoodhunting')\n results = db.exec(sql)\n db.close\n results\nend", "def exec(sql, *bindvars, &block)\n ret = nil\n thread = Thread.new { ret = super }\n thread.join\n ret\n rescue Interrupt\n self.break\n raise\n end", "def call(*args)\n in_context do\n self.execute(*args)\n end\n end", "def run_sql(sql)\n #connect to the|db|\n conn = PG.connect(:dbname => 'rogbloll')\n\n\n #execute the db in the argument\n res = conn.exec(sql)\n\n #now close the db\n conn.close\n\n #now return the result of the query...\n res\n\n\n \n end", "def send()\n SQLQuery.new.add('reports', ['accused', 'accuser', 'reason'], [@accused, @accuser, @reason]).send\n end" ]
[ "0.6484707", "0.6457021", "0.6444935", "0.63843334", "0.6334572", "0.6324416", "0.6320572", "0.63105834", "0.63105834", "0.62771714", "0.62771714", "0.62713575", "0.62713575", "0.6256952", "0.6256952", "0.62532973", "0.618436", "0.61814773", "0.6164388", "0.61377543", "0.6123184", "0.6101796", "0.6101438", "0.60765845", "0.6068861", "0.6043389", "0.6023832", "0.60027784", "0.59932077", "0.59924376", "0.5990503", "0.59850025", "0.596135", "0.59054697", "0.5894046", "0.5882802", "0.5873369", "0.5872068", "0.58699024", "0.58506", "0.58477867", "0.58475745", "0.58374125", "0.58338916", "0.5797814", "0.578381", "0.5737028", "0.57304776", "0.57299584", "0.57199764", "0.5704733", "0.56947005", "0.5694454", "0.56892836", "0.5654099", "0.5653102", "0.56454575", "0.56331635", "0.56331635", "0.5624165", "0.5620064", "0.56182045", "0.55970097", "0.5575628", "0.55661756", "0.5556921", "0.55536234", "0.55535805", "0.55462426", "0.5545901", "0.55410135", "0.55296516", "0.55259395", "0.5523533", "0.55226827", "0.5510372", "0.5503431", "0.55021477", "0.5502121", "0.547178", "0.5471442", "0.54699504", "0.54699", "0.5466756", "0.5466348", "0.5465941", "0.54650706", "0.5454647", "0.545154", "0.5446757", "0.5444927", "0.544461", "0.54392076", "0.5438547", "0.54379636", "0.5435541", "0.54182345", "0.5416819", "0.54166317", "0.5410085", "0.54085493" ]
0.0
-1
handle_asynchronously :execute => Validates the server connection properties
def validate_properties true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_connection; end", "def wait_connection; end", "def validate\n case lock_config.type\n when :while_executing\n validate_server\n when :until_executing\n validate_client\n else\n validate_client\n validate_server\n end\n\n lock_config\n end", "def validate\n case lock_config.type\n when :while_executing\n validate_server\n when :until_executing\n validate_client\n else\n validate_client\n validate_server\n end\n\n lock_config\n end", "def asynchronous?() false end", "def execute_async?\n @execution_mode == :async\n end", "def asynchronous!\n @asynchronous = true\n end", "def db_async(env)\n event_machine do\n # get the DB connection\n pg = EMAsyncApp.conn\n\n # signal to the web server, Thin, that it's HTTP request will be\n # handled asynchronously. It will not block\n env['async.callback'].call([200, {}, [\"Hey from a DB ASync Rack app!!!!!!!\"]])\n\n # Make the non-blocking/async query, returns a EM::Deferrable\n df = pg.execute(query)\n\n # success callback\n df.callback { |result|\n logger.debug \"EMAsyncApp::db_async DB results = #{Array(result).inspect}\"\n }\n\n # error callback\n df.errback {|ex|\n logger.debug \"EMAsyncApp::db_async Exeption = #{ex.inspect}\"\n raise ex\n }\n\n end\n # returning this signals to the server we are sending an async\n # response\n Rack::Async::RESPONSE\n end", "def wait_connection=(_arg0); end", "def connection_status_done; end", "def status\n if @async_command_aborted\n PG::CONNECTION_BAD\n else\n super\n end\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 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 execute; end", "def execute; end", "def synchronous!\n @asynchronous = false\n end", "def connection_completed\n\tend", "def execute_async_script(script, *args); end", "def connection_status_crypt_wait_response; end", "def execute!; end", "def connection_completed\n end", "def valid?\n @conn.valid?\n end", "def sync\n self.disabled_reason = nil\n if valid?\n execute_sync\n true\n else\n false\n end\n end", "def execute_async(json_request, &block)\n if json_request.kind_of? Request then\n id, request = json_request.id, json_request\n else\n request = Request.new(json_request)\n id = request.id\n end\n @responses[id] = AsyncResponse.new(id, &block)\n\n logger.debug { request.type == \"connect\" ? \"execute_async: CONNECT [#{id}]\" : \"execute_async: RPC [#{id}]\\n#{request.to_s}\" }\n\n EM.next_tick {\n ws.send(request.to_wire)\n }\n id\n end", "def execute\n end", "def execute\n end", "def asynchronous?\n @asynchronous\n end", "def execute\n end", "def execute\n #log_on_error do\n synchronise_viewmodel_with_controller\n action.call\n refresh_view unless asynchronous?\n #end if can_execute?\n end", "def try!\r\n raise \"Invalid status: message must be in progress to try!\" unless [:in_progress].include? self.status\r\n\r\n new_status = self.execute\r\n if :retry == new_status\r\n if self.tries >= self.max_tries\r\n new_status = :fail\r\n logger.fatal \"AsyncCommand #{self.id} failed on #{self.max_tries} maximum tries\"\r\n else\r\n self.push_next_try_at\r\n end\r\n end\r\n self.status = new_status\r\n self.save!\r\n end", "def execute(async)\n f = Fiber.current\n begin\n conn = acquire(f)\n conn.acquired_for_connection_pool += 1\n yield conn\n ensure\n conn.acquired_for_connection_pool -= 1\n conn.run_postponed_queries if conn.acquired_for_connection_pool == 0\n release(f) if !async && conn.acquired_for_connection_pool == 0\n end\n end", "def execute\n\n end", "def is_async_on_grid_obj?\n grid_operation? and sons.any? { |s| s.name.start_with? \"async\" } and not name.start_with? \"get_result\"\n end", "def execute()\n\n end", "def execute()\n\n end", "def check_connection\n return\n check = HTTParty.get(\"#{@host}/api/process/check_connection?api_key=#{@api_key}\")\n if check.nil? || check[\"status\"][\"code\"] < 0\n @helper.terminate(\"Script was unable to establish connection with dFlow at #{@host}\")\n end\n end", "def wait_async\n @wait_async = true\n end", "def asynchronous?\n return false if (pending_value && pending_value[:value].blank?)\n true\n end", "def execute_async_script(script, *args)\n bridge.execute_async_script(script, *args)\n end", "def run\n validate\n setup\n before_sync\n sync\n after_sync\n rescue => e\n on_error(e)\n raise e\n end", "def async_result()\n #This is a stub, used for indexing\n end", "def connection_completed\n log_debug '[client-cnxn] Established server connection, sending request'\n send_request unless error?\n rescue\n fail(:RPC_ERROR, 'Connection error: %s' % $!.message) unless failed?\n end", "def call\n return if @closed\n error = check_result ::Libuv::Ext.async_send(handle)\n reject(error) if error\n end", "def async?\n false\n end", "def execute(timeout = nil, &block)\n result = nil\n \n if timeout.nil?\n @rwlock.read {\n result = yield @connection\n }\n else\n verify!\n @rwlock.read {\n # re-verify connectivity\n if !__connected?\n @taskbox.reset!\n raise Errors::ConnectionTerminated\n else\n result = __execute(timeout, &block)\n end\n }\n end\n \n result\n end", "def test_connection\n synchronize{|conn|}\n true\n end", "def execute\n end", "def execute\n end", "def execute(sql, name = 'SQL')\n log(sql, name) do\n @connection.async_exec(sql)\n end\n end", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|conn| check_database_errors{_execute(conn, sql, opts, &block)}}\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 check_execute\n unless executed?\n execute\n end\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def ensure_connection!\n fail \"Must have active connection\" unless connection\n end", "def synchronous?\n !@asynchronous\n end", "def attempt_connection\n @connection_future = Concurrent::Future.new do\n connection_method.call\n end\n connection_future.execute\n end", "def execute!(blocking_time_limit: nil)\n fail NotImplementedError\n end", "def connection_valid?\n if status.untested? or (changed? and (changes.keys & @@status_fields).empty?)\n begin\n test_connection\n status.success!\n rescue => e\n error_str = map_connection_exception_to_error(e)\n status.fail!(error_str)\n end\n end\n status.success?\n end", "def __execute(&block)\n self.instance_eval(&block)\n end", "def check_connection_state\n # Has the connection been established in the meantime? If yes, shut\n # down the work queues thread, all work will be done in this thread \n # from now on. \n if cached_connection_established?\n @work_queue.shutdown\n end\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 syncCallback(response)\n response = $parser.parse_payload(response)\n if response != nil\n puts response\n else\n errors = $parser.get_last_errors()\n errors.each { |error|\n eCode = error[\"error\"]\n if eCode == ErrorCode::QUEUED\n jobID = error[\"jobID\"]\n sleep(2)\n $client.get_job_status(jobID, method(:syncCallback))\n elsif eCode == ErrorCode::IN_PROGRESS\n jobID = error[\"jobID\"]\n sleep(5)\n $client.get_job_status(jobID, method(:syncCallback))\n else\n puts eCode\n puts error[\"detail\"]\n puts error[\"reason\"]\n end\n }\n end\nend", "def ensure_handle_is_valid\n\n end", "def execute\n enter_state(STATE_STARTED)\n @fiber = Fiber.current\n begin\n @value = do_execute\n rescue TimeoutError => e\n @exception = e\n rescue StandardError => e\n @exception = e\n end\n @cond.signal\n enter_state(STATE_FINISHED)\n end", "def connection! client_host, client_port, server_host, server_port\n rv = Wrapper.msc_process_connection \\\n txn_ptr,\n (strptr client_host), (Integer client_port),\n (strptr server_host), (Integer server_port)\n\n rv == 1 or raise Error, \"msc_process_connection failed for #{[client_host, client_port, server_host, server_port].inspect}\"\n\n intervention!\n end", "def do_execute\n raise StandardError, \"Not implemented!\"\n end", "def connected?; connection_state == :connected end", "def execute()\r\n\tend", "def execute(sql, opts=OPTS, &block)\n synchronize(opts[:server]){|c| _execute(c, sql, opts, &block)} \n end", "def def_ensure_insync?\n define_singleton_method(:insync?) { |is| rs_value.to_s == is.to_s }\n end", "def execute(callback)\n unlock(:server)\n\n runtime_lock.execute(callback) do\n yield\n end\n end", "def __execute__\n @result = @block[*@args]\n rescue Exception => e\n @result = e\n ensure\n # Prevent multiple executions\n def self.__execute__; nil; end\n end", "def rack_async(env)\n event_machine do\n # each new client connection will get this response\n env['async.callback'].call([200, {}, [\"Hey from a ASync Rack app!!!!!!!\"]])\n\n # and it will start a deferred job that will fire in 5 seconds\n EM.add_timer(5) do\n # puts \"yeehaaa going to DB!!!!!\"\n end\n end\n # returning this signals to the server we are sending an async\n # response\n Rack::Async::RESPONSE\n end", "def send_async(method, *arguments); end", "def execute\n raise \"Not Implemented\"\n end", "def valid_connection?\n @connection && @connection.valid?\n end", "def connection_check\n handle_action_exceptions(__method__) do\n check_connection\n end\n rescue RToolsHCKConnectionError => e\n if @json\n { 'result' => 'Failure', 'message' => e.message }\n else\n puts \"WARNING: #{e.message}\"\n false\n end\n end", "def sc_core_query_done(handle)\n __remote_control_command(\"scCoreQueryDone\", [handle,])\n end", "def execute(callback)\n callback.call if unlock(:server)\n yield\n end", "def rack_async(env)\n event_machine do\n # return from this Rack endpoint without blocking\n env['async.callback'].call([200, {}, [\"Hey from a ASync Rack app!!!!!!!\"]])\n\n # and it will start a deferred job that will fire in 5 seconds\n EM.add_timer(5) do\n logger.debug \"EMAsyncApp#rack_async: yeehaaa going to DB!!!!!\"\n end\n end\n # returning this signals to the server we are sending an async\n # response\n Rack::Async::RESPONSE\n end", "def connection_status_server; end", "def valid_raw_connection\n (@verified && @raw_connection) ||\n # `allow_retry: false`, to force verification: the block won't\n # raise, so a retry wouldn't help us get the valid connection we\n # need.\n with_raw_connection(allow_retry: false, materialize_transactions: false) { |conn| conn }\n end", "def handler\n raise \"Must override AsyncHandler#handler\"\n end", "def raw_connection; end", "def execute\n fail NotImplementedError\n end", "def execute_async(input_set = nil)\n if input_set == nil\n input_set = InputSet.new()\n end\n param_map = {\"source_id\" => TembooSession.get_identifier(),\n \"mode\" => \"async\",\n \"store_results\" => \"true\"}\n body = input_set.format_inputs()\n results = @session.post_request(get_path(), body, param_map)\n id = JSON.load(results.body())[\"id\"]\n execution = ChoreographyExecution.new(@session, id)\n return execution\n end", "def validate_server\n ServerValidator.validate(lock_config)\n end", "def execute(&block)\n block.call\n end", "def execute(&block)\n block.call\n end", "def isnonblocking\n\t\tfalse\n\tend", "def test_connection\n @connection.bind\n last_operation_result\n end", "def test_connection\n @connection.bind\n last_operation_result\n end", "def sync() end", "def sync() end", "def sync() end", "def perform\n\n handle_errors_and_exceptions do\n\n r = validate\n return r unless r.success?\n\n r = set_parts\n return r unless r.success?\n\n r = validate_token\n return r unless r.success?\n\n r = fetch_client\n return r unless r.success?\n\n r = validate_client_manager\n return r unless r.success?\n\n r = set_extended_cookie_value\n return r unless r.success?\n\n success_with_data(\n extended_cookie_value: @extended_cookie_value,\n manager_id: @manager_id,\n manager_device_id: @manager_device_id,\n manager_device: @manager_device,\n manager: @manager,\n client_id: @manager[:current_client_id],\n client: @client,\n client_manager: @client_manager\n )\n\n end\n\n end", "def pre_process\n Goliath::Connection::AsyncResponse\n end" ]
[ "0.60965", "0.60965", "0.5951227", "0.5951227", "0.58922195", "0.58428776", "0.58404356", "0.5826276", "0.5822596", "0.56954604", "0.56752837", "0.55837333", "0.5557472", "0.5419751", "0.5419751", "0.5412843", "0.5410829", "0.53987336", "0.5376315", "0.537118", "0.5314318", "0.5300856", "0.52965087", "0.527594", "0.52353543", "0.52353543", "0.523071", "0.52301985", "0.5229831", "0.52237874", "0.5211246", "0.5209416", "0.52011335", "0.5199905", "0.5199905", "0.5196453", "0.51806045", "0.51794773", "0.517234", "0.5143245", "0.51374274", "0.51312345", "0.5127237", "0.51140285", "0.51007825", "0.5086195", "0.5063163", "0.5063163", "0.5058063", "0.505422", "0.5051517", "0.5050721", "0.50311804", "0.50311804", "0.50311804", "0.50311804", "0.50311804", "0.50311804", "0.5024154", "0.5006381", "0.5006366", "0.5003115", "0.49949187", "0.49942094", "0.4962902", "0.49579048", "0.49483445", "0.49435094", "0.49428675", "0.49401855", "0.49394947", "0.49375266", "0.49289602", "0.4923635", "0.4923292", "0.4901521", "0.4899928", "0.48974583", "0.48947778", "0.48833346", "0.48764005", "0.48561516", "0.48545107", "0.48468187", "0.48443103", "0.4838795", "0.4833975", "0.48311284", "0.48311007", "0.48269516", "0.482199", "0.48211697", "0.48211697", "0.48135597", "0.4810839", "0.4810839", "0.4794928", "0.4794928", "0.4794928", "0.4793084", "0.47896677" ]
0.0
-1
Set a random variate as the arrival rate.
def with_arrival_rate(species, *args) @arrival_rate = RandomVariate.send(species, *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_rand()\n rdm = Random.new()\n @step = rdm.rand(1..10) * 100\n @rate = rdm.rand(1.2..3.0) \n end", "def random= rnd\n @sampling.random = rnd\n end", "def random= rnd \n @random = rnd\n @codon.random = rnd\n end", "def random= rnd \n @random = rnd\n @codon.random = rnd\n end", "def random= rnd \n @random = rnd\n @codon.random = rnd\n end", "def new_random\n @randomizer = Random.new if $options['respect_randomize'].value\n end", "def initialize\n @rate = 0.10\n end", "def random_float\n rand * rand(10)\n end", "def random_resilience_generator\n self.resilience = 10.times.sum{ Random.rand(1..13) } \n end", "def rate=(value)\n @rate = value\n end", "def set_random_number\n @lower = Number.find(params[:id]).lower_bound\n @upper = Number.find(params[:id]).upper_bound\n @random_number = rand(@lower..@upper)\n end", "def random_float\n %x{\n self.state++;\n return Opal.$$rand.rand(self.$rng);\n }\n end", "def gen_speed\n rand + 15.0\n end", "def change_rate(rate) #TODO: separate rate changes to be dependant on dates/reservations/blocks\n @rate = rate\n end", "def market_price_for_drug\n rand(500) + 10\n end", "def sleep_for(rate)\r\n -Math.log(1.0 - Random.rand) / rate\r\n end", "def set_rate(from, to, rate, opts = T.unsafe(nil)); end", "def set_rand()\n rdm = Random.new()\n push_hp(rdm.rand(0.2..10.0))\n push_mp(rdm.rand(0.2..10.0))\n push_sp(rdm.rand(0.2..10.0))\n push_str(rdm.rand(0.2..5.0))\n push_vit(rdm.rand(0.2..5.0))\n push_int(rdm.rand(0.2..5.0))\n push_mnd(rdm.rand(0.2..5.0))\n push_dex(rdm.rand(0.2..5.0))\n push_agi(rdm.rand(0.2..5.0))\n push_luk(rdm.rand(0.2..5.0))\n end", "def initialize\n srand\n end", "def random\n 1 + (10 * rand(0))\n end", "def initialize\n @rate = 0.90\n end", "def possibly_activate(time_elapsed)\n # If urgency is unset, which it shouldn't be, set it to zero.\n self.urgency = 0 unless self.urgency\n unless self.activated\n # Probability of activation is proportional to time elapsed multiplied\n # by 10 for each two points of urgency.\n # At current settings, the probability reaches 1 in ten seconds if the \n # urgency is 10, a hundred seconds if the urgency is 8, and so on.\n # About twelve days for urgency 0.\n self.activate if rand < time_elapsed *\n (10 ** (self.urgency/2.0)) / 1000000.0\n end\n end", "def set_update_rate(rate)\n rate = AMS.clamp(rate.to_i, 1, 100)\n Sketchup.active_model.set_attribute('MSPhysics', 'Update Rate', rate)\n sim = MSPhysics::Simulation.instance\n sim.set_update_rate(rate) if sim\n return rate\n end", "def srand(num=0) end", "def growFruit age\n\t\t@fruit_num += Random.rand(@age)\n\tend", "def get_rand range\n\t\t@random_number = rand(range)\n\tend", "def initialize\n @@count += 1\n @id = @@count\n @awake_percentage = rand(1..100) #range makes random number include first and last number\n end", "def rate(user_rate = nil)\n @user_rate = user_rate.nil? ? @user_rate : (user_rate.to_i.zero? ? rand(1..5) : user_rate if (0..5).cover?(user_rate.to_i))\n end", "def with_arrival_rate(species, *args)\n self.given_population do\n with_arrival_rate(species, *args)\n end\n end", "def rate(rate)\n @rated_times += 1\n @average_rating = (@average_rating + rate) / @rated_times\n end", "def update_rate=(rate)\n rate = AMS.clamp(rate.to_i, 1, 100)\n Sketchup.active_model.set_attribute('MSPhysics', 'Update Rate', rate)\n sim = MSPhysics::Simulation.instance\n sim.update_rate = rate if sim\n end", "def random\n new(one.random())\n end", "def random_point_change\n if (@count % 2 == 0)\n @random_points = rand(100)\n else\n @random_points = @random_points\n end\n end", "def random_spread(spread)\n spread.nonzero? ? (random(spread) - spread / 2.0) : 0.0\nend", "def price(date)\n rand(1..100)\n end", "def set_rate(address,rate)\n\t \tinjector = eval \"@injector_#{address}\"\n\t \tinjector.syringe.rate = rate\n\t \tcmd = injector.syringe.get_rate_cmd\n\t \tadd_to_queue(address,cmd)\n\t\treturn true\n\t end", "def rating\n if in_the_future\n return nil\n else\n #TODO replace this with actual rating\n return rand(1..5)\n end\n end", "def advance_mod\n self.advance ||= ((1.5 * rand + 3.to_f) *\n (reputation.to_f + rand(20)) / 1000).round(3)\n end", "def set_random_pick\n @random_pick = RandomPick.find(params[:id])\n end", "def rand_exp(rate)\n -Math.log(rand) / rate\n end", "def get_inflation_rate()\r\n #assume a inflation rate between 2% and 7%\r\n inflation_rate=(rand(7)*0.01)\r\n if inflation_rate > 0.02\r\n return inflation_rate\r\n else\r\n return 0.02\r\n end\r\nend", "def set_complete_randomization(probability)\n complete_rand_radio.click\n complete_rand_input.set probability\n save.click\n end", "def srand(seed)\n @prng = Mtwist.new(seed)\n end", "def initialize(rank=nil)\n @rank = rank || rand(400) + 600\n end", "def mine_fake(random)\n if @max_fake.zero?\n 0\n else\n fake = random.rand(@max_fake + 1)\n fake\n end\n end", "def change_run_yardage_by_team_traits(game)\n factor = @ttm.run_yardage_factor * 2 + 1 # 1 .. 41\n self.yardage += MathUtil.pick_from_decreasing_distribution( 1, 5) if rand * 100 < factor\n self.yardage += MathUtil.pick_from_decreasing_distribution(10, 20) if rand * 100 < factor / 10.0\n end", "def mutate!(random, rate, values, chromosome)\n chromosome.each_index do |i|\n chromosome[i] = random.rand(values) if random.rand <= rate\n end\nend", "def reset_rate\n @rate = 500\n end", "def mutate!(mutation_rate)\n\t\t@values.size.times do |i|\n\t\t\t@values[i] += (rand - 0.5) * 0.05 if rand < mutation_rate\n\t\tend\n\n\t\tself\n\tend", "def rating\n rand(40..140).to_s\n end", "def mutate\n @weights = (1..@size).map { Random.rand(-0.5..0.5) }\n end", "def change\n @x, @y = rand(25..575), 50\n @type = ['stamina', 'live', 'score', 'ammo'].sample\n window.world.bee.last_prize = Time.now.to_i\n end", "def initialize(position_variation = 1..100)\n @position = rand(position_variation)\n end", "def UpdateRate=(arg0)", "def UpdateRate=(arg0)", "def set_rental_rate\n @rental_rate = RentalRate.find(params[:id])\n end", "def rand\n warn \"STUB: rand in distribution.rb\"\n end", "def gen\n (x=rand)>0.5 ? x : (x < rand/2.0) ? 1.0 - x : x\nend", "def initialize(planets)\n @planets = planets\n #@age = rand(9999)\n end", "def rand\n return @location + @scale * rand_std_ratio_method\n end", "def rand(value=-1)\r\n if (value > 0) then old_rand(value)\r\n else self[Kernel.rand(length)] end\r\n end", "def random_cost\n rand(1..10)\nend", "def seed=(value)\n srand(value) if value.kind_of? Integer\n @seed = value\n end", "def var=(name)\n @var = if name == :random\n \"_#{rand(2000)}\"\n else\n name\n end\n end", "def rate(rate_value)\n @template.rate = rate_value\n end", "def random=(value)\n puts 'hello rick'\n end", "def random_age\n rand(20...200)\nend", "def generate_random()\n begin\n r = Kernel.rand()\n end while r == 0.0\n \n if use_flt?\n BigDecimal(r.to_s)\n else\n r\n end\n end", "def rep_range\n reps = nil\n if movement[:rep_range] == \"High\"\n reps = rand(30..50)\n elsif movement[:rep_range] == \"Moderate\"\n reps = rand(11..29)\n else\n reps = rand(3..10)\n end\n end", "def rand_point()\n \n end", "def random_duration\n min_duration + rand(max_duration - min_duration + 1)\n end", "def random_float\n Rubinius.primitive :randomizer_rand_float\n raise PrimitiveFailure, \"Randomizer#rand_float primitive failed\"\n end", "def random_float\n Rubinius.primitive :randomizer_rand_float\n raise PrimitiveFailure, \"Randomizer#rand_float primitive failed\"\n end", "def initialize(dice)\n @value = rand(dice) + 1\n end", "def set_PopulateRates(value)\n set_input(\"PopulateRates\", value)\n end", "def set_PopulateRates(value)\n set_input(\"PopulateRates\", value)\n end", "def rand\n Kernel.rand(self)\n end", "def random_restart\n @controllers.each{|sc| @current_offset[sc] = rand(@current_cycle_time || sc.cycle_time)}\n if @change_probability[:speed].nonzero?\n @coordinations.each do |coord|\n @current_speed[coord] = coord.default_speed + SPEED_CHANGE_OPTIONS_WITH_ZERO.rand\n end\n end\n full_evaluation # all coordinations change, must do full reevaluation\n end", "def kick\n rng.rand(value_range)\n end", "def rand_value\n return Kernel.const_get(JsonRander.random_type).new\n end", "def randomize_count()\n @rand_count\n end", "def rand(repeats=1)\n P.rand(self, repeats)\n end", "def randomized_ttl\n ttl * sample_range(ttl_randomization_scale)\n end", "def random_on_interval(min, max)\n min + @prng.rand(max - min)\n end", "def set_defaults\n self.rate ||= 0\n end", "def randomize(random = nil)\n random ||= Random.new\n self.rotate(random.rand(4)).flip(random.rand(2))\n end", "def set_rate from, to, rate\n if self.class.rates_careful\n set_rate_with_time(from, to, rate)\n else\n super\n end\n end", "def generate_attr(desired_value)\n min = desired_value - 2\n min = 0 if min < 0\n max = desired_value + 2\n max = 0 if max < 0\n rand(min..max)\n end", "def random_to_one\n return rand()\n end", "def random_to_one\n return rand()\n end", "def random_to_one\n return rand()\n end", "def random_to_one\n return rand()\n end", "def move_type_random\n case rand(6)\n when 0 then move_random\n when 1 then move_random\n when 2 then move_forward\n when 3 then move_forward\n when 4 then move_forward\n when 5 then @stop_count = 0\n end\n end", "def sample_rate=(value)\n if value == @defaults['sampleRate']\n @values.delete 'sampleRate' if @values.key? 'sampleRate'\n else\n @values['sampleRate'] = value\n end\n end", "def random_price\n (rand(0..100.0) * 100).floor/100.0\nend", "def calc_rand_range\n range = Damage_Settings::RANDOM_RANGE\n rand(range)-range/2\n end", "def get_random()\n \n end", "def get_random()\n \n end", "def change\n @last_change = if rand < @change_probability[:speed]\n change_speed; :speed\n else\n change_offset; :offset\n end\n end", "def mutate? (rate)\n\t\trand() < rate\n\tend" ]
[ "0.7482969", "0.6874706", "0.6385189", "0.6385189", "0.6219564", "0.5987749", "0.59391564", "0.5915967", "0.58853525", "0.5838061", "0.5833849", "0.5826422", "0.5779618", "0.57551825", "0.57127553", "0.5711869", "0.57027256", "0.56578696", "0.56396675", "0.5619194", "0.56014955", "0.5565799", "0.55634296", "0.5556166", "0.55508614", "0.5526681", "0.5526175", "0.55129534", "0.54824996", "0.54690295", "0.54583865", "0.54296833", "0.5429123", "0.5421746", "0.5379964", "0.5379437", "0.53788495", "0.5374647", "0.5369684", "0.53650814", "0.53643185", "0.53522265", "0.535105", "0.5349956", "0.5339625", "0.53301847", "0.53286", "0.53272176", "0.52895814", "0.5280895", "0.52699727", "0.5258436", "0.5255544", "0.5254558", "0.5254558", "0.5246414", "0.5243931", "0.52425617", "0.52324486", "0.52303916", "0.52277875", "0.5220289", "0.52139795", "0.5200876", "0.5199416", "0.5195342", "0.5183496", "0.5172568", "0.516718", "0.5154808", "0.51391363", "0.5139001", "0.5139001", "0.5137148", "0.5133206", "0.5133206", "0.51310253", "0.5130828", "0.5128839", "0.51280713", "0.51278174", "0.5122825", "0.51192373", "0.51164365", "0.51111394", "0.5110726", "0.5109856", "0.51047075", "0.5100093", "0.5100093", "0.5100093", "0.5100093", "0.5098333", "0.508972", "0.5085603", "0.5084688", "0.5073444", "0.5073444", "0.5070868", "0.5070577" ]
0.76901466
0
Have an item arrive from the population.
def arrive! raise(DSQ::PopulationError, "You can not produce an arrival while the Population is waiting.", caller) if waiting? @waiting = true return Item.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_up(item)\n @items.push(item) unless items_weight + item.weight > CAPACITY\n @equipped_weapon = item if item.is_a?(Weapon) \n if item.is_a?(BoxOfBolts) \n item.feed(self) if self.health <= 80\n end\n end", "def pick_up(item)\n return false if items_weight + item.weight > MAX_WEIGHT\n\n @equipped_weapon = item if item.is_a?(Weapon)\n @items << item\n end", "def pick_up(item)\n\n puts \"in pick_up item = #{item}\"\n puts \"equipped_weapon #{equipped_weapon}\"\n\n # binding.pry\n\n if (CAPACITY - items_weight) >= item.weight\n @items << item\n\n # binding.pry\n if item.class == PlasmaCannon || item.class == Laser\n # binding.pry\n self.equipped_weapon = item\n end\n\n true\n\n else\n false\n end\n\n end", "def arrive(agent)\n @agent = agent\n agent.x = @x\n agent.y = @y\n # agent.location = self\n if @agent == player && has_items?\n game.messages << \"You see #{@inventory} here.\"\n end\n end", "def activate\n if player.location.has_items?\n # set inventory index being considered for get\n @index = 0\n @item = player.location.inventory[@index]\n if player.inventory.can_fit?(@item)\n if player.location.inventory.size == 1 && @item.quantity == 1\n # a single item at the location so just get it\n player.get(@item)\n game.change_state(Map.new)\n else\n game.messages << \"Do you want to pick up #{@item}? Y/N\"\n end\n else\n game.messages << 'Your inventory is full.'\n game.change_state(Map.new)\n end\n else\n # no items at location\n game.change_state(Map.new)\n end\n end", "def next_item\n if (player.location.inventory.length > @index)\n @item = player.location.inventory[@index]\n game.messages << \"Do you want to pick up #{@item}? Y/N\"\n else\n game.change_state(Map.new)\n end\n end", "def pickup_item\n if status == :confirmed \n transaction do\n update(:status => :in_progress)\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'pickup_item',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.picked_up_item)\n end \n end\n self\n end", "def pick_up(item)\n expected_weight = items_weight + item.weight\n if expected_weight <= 250\n item.is_a?(Weapon) ? @equipped_weapon = item : items << item \n else\n return false\nend\nend", "def pick_up(item_name)\n if current_room.has_item(item_name)\n item = current_room.items.find { |thing| thing.name == item_name }\n @player.add_to_inventory(item)\n current_room.remove_one(item)\n else\n puts \"Sorry, that item is not in this room. Try again.\"\n end\n end", "def take_item(command)\n if @current_room.has_item?(command) # item isn't in current room\n self.new_current_item(command)\n # Remove from room and add to backpack\n @current_room.remove_item(command)\n @player.pick_up(command)\n puts \"\\nYou have picked up a #{@current_item.name}\"\n puts @current_item.collect_description + \"\\n\\n\"\n else\n puts \"This item isn't here\\n\"\n end\n end", "def on_item_ok\n return back_to_items if (item = @item_window.item).nil?\n $game_party.lose_item(item, 1)\n @unit_item_list.tb_unit.gain_item(item, 1)\n TactBattleManager.store_unit_item(@actor.id, item)\n back_to_items\n end", "def update_item\n self.item.update_complete\n end", "def take(item_name)\n if current_room.npc && current_room.npc.has_item(item_name)\n npc_item = item_to_take(item_name)\n @player.add_to_inventory(npc_item)\n # this just doesn't seem to remove the item from NPC inventory no matter what I do :(\n current_room.npc.remove_from_inventory(npc_item)\n else\n puts \"Sorry, that item isn't here.\"\n end\n end", "def get_item(user, item)\r\n position = user.get_position(item)\r\n x = user.show_item(position)\r\n self.add_item(x)\r\n user.give_away_item(position)\r\n end", "def fulfill\n\t\titems.each(&:fulfill)\n\t\tself.fulfilled_at = Time.now\n\tend", "def loot\r\n\t@@item_number += 1\r\n\t$items = @@item_number\r\n\treturn\r\n\tend", "def load_item_from_stock(order_item, stock_items)\n amount = order_item.waiting\n stock_items.each do |item|\n all = item.available\n next if all <= 0\n\n if amount <= all\n # This inventory item satisfies the amount, we're done.\n item.reserved += amount\n return create_item_from(order_item, item.code, item.expires_at, amount)\n else\n # Load all of this item and continue with the remaining amount.\n item.reserved += all\n create_item_from(order_item, item.code, item.expires_at, all)\n amount -= all\n end\n end\n end", "def fulfill_if_items_ready(metadata)\n if !reproduction_order?\n if available_events.include?(:fulfill) && all_items_ready?\n trigger(:fulfill, metadata)\n end\n end\n end", "def refill(item_name:, quantity:)\n total_items_quantity[item_name] += quantity\n items_running_low[item_name] = false\n end", "def add_to_inventory(item)\n @items << item\n equip(item)\n items_weight\n end", "def giveItem\n toLocation = Company.where(name: params[:recepCompany]).first.locations.where(address: params[:recepLocation]).first\n location = current_company.locations.where(id: params[:locationId]).first\n if(location.is_supplier === true)\n updatedItem = location.items.where(name: params[:name]).first\n toUpdatedItem = toLocation.items.where(name: params[:name]).first\n if(toUpdatedItem.present? && updatedItem.amount > params[:amount].to_i)\n updatedItem.increment!(:amount, -params[:amount].to_i)\n toUpdatedItem.increment!(:amount, params[:amount].to_i)\n elsif(updatedItem.amount > params[:amount].to_i)\n updatedItem.increment!(:amount, -params[:amount].to_i)\n item = Item.create(name: params[:name], amount:params[:amount].to_i, price: updatedItem.price, autoRestock: false, lastSupplier:location.id)\n toLocation.items << item\n end\n if(updatedItem.amount <= updatedItem.restockPoint)\n changeItemSupplier(updatedItem.id)\n end\n end\n end", "def backtrack(stack)\n item = super(stack)\n size = item[:booking]\n @bookings.push(size)\n @all_moves[@last_index_tried] += size\n item\n end", "def bringToLife\n @dead = false\n end", "def has_item?(item)\n return true if drops_item?(item)\n return true if can_steal_item?(item)\n false\n end", "def add_item(item)\n if @item\n log(\"Item is already equipped in EquipSlot.\")\n return\n end\n @item = item\n return\n end", "def activate_item(position)\r\n self.items.fetch(position).activate\r\n end", "def gather_item\n local_item = FoodItem.fetch_local_item @item_id\n return local_item unless local_item.nil?\n\n item_id = @item_id.split('-')\n remote_item = fetch_remote_item item_id[0], item_id[1]\n remote_item = FoodItem.new_item remote_item\n\n return remote_item unless remote_item.nil?\n\n nil # fallback\n end", "def take \n element = @root.level.maps.first.element_at @position\n \n unless element.is_a? Interactable \n say(\"I can't pick it up!\") \n return\n end\n @inventory << element \n @root.level.maps.first.game_objects.delete(element)\n @root.inventory_updated if defined? @root.inventory_updated\n end", "def consume_item(item)\n if item.is_a?(RPG::Item) and item.consumable\n lose_item(item, 1)\n end\n end", "def on_state_while(state_id, item = nil)\n end", "def item_add item\n\t\tret = super\n\t\titem.known! if (ret)\n\t\treturn ret\n\tend", "def complete!\n now = Time.current\n transaction do\n transfer_items.each do |item|\n source.present? && source.destock!(item, now, self)\n destination.present? && destination.restock!(item, now, self)\n end\n update completed_at: now\n end\n end", "def return_item\n items = self.see_purchases.map do |merchandise|\n {name: merchandise.name, merch_id: merchandise.id}\n end\n merch = TTY::Prompt.new.select(\"Here is a list of your purchases. What would you like to return?\",items)\n purchase = self.specific_purchase(merch)\n purchase.destroy \n puts \"your item has been refunded!\"\n restock = self.select_merchandise(merch)\n restock.update(inventory: restock.inventory + 1)\n end", "def consume_item(item)\n lose_item(item, 1, false, nil, nil, false) if item.is_a?(RPG::Item) && item.consumable\n end", "def on_item_ok\n @item = @item_window.item\n BattleManager.actor.input.set_item(@item.id)\n action = BattleManager.actor.input\n case @item.target_type[0]\n when :one\n select_target_selection\n when :all\n BattleManager.actor.input.set = SES::TargetManager.make_targets(action)\n when :rand\n targets, set = [], SES::TargetManager.make_targets(action)\n (@item.target_type[1][0] + rand(@item.target_type[1][1])).times do\n targets << set[rand(set.size)]\n end\n BattleManager.actor.input.set = set\n else\n @item_window.hide\n next_command\n end\n $game_party.last_item.object = @item\n end", "def any_items_ready?\n ready = false\n if items.blank?\n ready = true\n else\n items.each do |i|\n if !i.obsolete\n if i.digital_object\n ready = i.state_reached_for_order(:ready_at_use_location, self.id)\n else\n ready = i.state_reached_for_order(:ready_at_temporary_location, self.id)\n end\n end\n break if ready\n end\n end\n ready\n end", "def loot\r\n\t@@item_number += 1\r\n\tend", "def gain_item\n\t\titem = $data_items\n\t\t$game_party.gain_item(item[1], 1)\n\tend", "def inventory\n @game.state = BuyingState.new @game\n\n @game.state.handle\n end", "def make_item_action_result\n # Get item\n @item = $data_items[@active_battler.current_action.item_id]\n # If unable to use due to items running out\n unless $game_party.item_can_use?(@item.id)\n # Shift to step 1\n @phase4_step = 1\n return\n end\n # If consumable\n if @item.consumable\n # Decrease used item by 1\n $game_party.lose_item(@item.id, 1)\n end\n # Display item name on help window\n @help_window.set_text(@item.name, 1)\n # Set animation ID\n @animation1_id = @item.animation1_id\n @animation2_id = @item.animation2_id\n # Set common event ID\n @common_event_id = @item.common_event_id\n # Decide on target\n index = @active_battler.current_action.target_index\n target = $game_party.smooth_target_actor(index)\n # Set targeted battlers\n set_target_battlers(@item.scope)\n # Apply item effect\n for target in @target_battlers\n target.item_effect(@item)\n end\n end", "def beds_available(population)\n beds_available_locally(population) + beds_available_shared(population)\n end", "def gain_chest_item\n $game_party.gain_item(online_chest.item, 1)\n end", "def buy(item)\n raise_no_money! if item.price > pending_amount\n change = calc_change(pending_amount - item.price)\n transfer_pending_to_money\n remove_from_money change\n change\n end", "def make_item_action_result\r\n # Get item\r\n @item = $data_items[@active_battler.current_action.item_id]\r\n # If unable to use due to items running out\r\n unless $game_party.item_can_use?(@item.id)\r\n # Shift to step 1\r\n @phase4_step = 1\r\n return\r\n end\r\n # If consumable\r\n if @item.consumable\r\n # Decrease used item by 1\r\n $game_party.lose_item(@item.id, 1)\r\n end\r\n # Display item name on help window\r\n @help_window.set_text(@item.name, 1)\r\n # Set animation ID\r\n @animation1_id = @item.animation1_id\r\n @animation2_id = @item.animation2_id\r\n # Set common event ID\r\n @common_event_id = @item.common_event_id\r\n # Decide on target\r\n index = @active_battler.current_action.target_index\r\n target = $game_party.smooth_target_actor(index)\r\n # Set targeted battlers\r\n set_target_battlers(@item.scope)\r\n # Apply item effect\r\n for target in @target_battlers\r\n target.item_effect(@item)\r\n end\r\n end", "def update_item\r\n # If B button was pressed\r\n if Input.trigger?(Input::B)\r\n # Play cancel SE\r\n $game_system.se_play($data_system.cancel_se)\r\n # Switch to menu screen\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n # If C button was pressed\r\n if Input.trigger?(Input::C)\r\n # Get currently selected data on the item window\r\n @item = @item_window.item\r\n # If not a use item\r\n unless @item.is_a?(RPG::Item)\r\n # Play buzzer SE\r\n $game_system.se_play($data_system.buzzer_se)\r\n return\r\n end\r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # If effect scope is an ally\r\n\r\n puts \"User chose item #{ItemService.item_sym_of(id)}\"\r\n @pedestal.pedestal_item_id = id\r\n\t\t\t$game_party.gain_item(rmxp_item_id, -1)\r\n\r\n SetupEventService.new.setup!\r\n $scene = Scene_Map.new\r\n return\r\n end\r\n end", "def trade_item_with_party(new_item, old_item)\n return false if new_item && !$game_party.has_item?(new_item)\n temp = UI_MSG::ITEM\n UI_MSG.const_set(:ITEM, false)\n $game_party.gain_item(old_item, 1)\n $game_party.lose_item(new_item, 1)\n UI_MSG.const_set(:ITEM, temp)\n return true\n end", "def up_item \n order_op2(true, @item)\n end", "def eat\n inventory[:fish] -= @daily_appetite = 10\n\n if inventory[:fish] < 0\n @alive = false\n inventory[:fish] = 0\n end\n end", "def unit_item_ok\n return refresh_items if @unit_item_list.tb_unit.nil?\n @unit_item_list.activate\n return if (item = @unit_item_list.item).nil?\n @unit_item_list.tb_unit.lose_item(item, 1) \n TactBattleManager.rm_unit_item(@actor.id, item)\n $game_party.gain_item(item, 1)\n refresh_items\n end", "def process current_population\n @history << current_population.get_pop.clone\n end", "def buy_item(item)\r\n if !item.active || item.price > self.credits\r\n false\r\n else\r\n seller = item.owner\r\n price = item.price\r\n\r\n seller.give_credits(price)\r\n self.take_credits(price)\r\n seller.remove_item(item)\r\n self.add_item(item)\r\n item.active = false\r\n true\r\n end\r\n end", "def pickup(task, elapsed = 0)\n object = task.parameters[:object]\n # Find an unfilled carrying slot.\n self.inventory.values.each do |slot|\n if slot.is_a?(CarryingSlot) && slot.can_fit(object)\n $logger.info \"#{self.inspect} puts the #{object} in #{slot.class}\"\n slot.add_object(@world, object)\n # Tell the task we've picked up the object.\n task.parameters[:object_held] = true\n action_complete\n return object\n end\n end\n # No unfilled slots found; this is unlikely.\n task.job.blocked_workers << self if task.job\n incomplete_task\n end", "def in_zombies(item)\n here = true\n if @zombie_apocalypse_supplies.include?(item)\n puts \"#{item} is in the bag\"\n here\n else\n puts \"#{item} is not in the bag\"\n !here\n end\n end", "def trade_item_with_party(new_item, old_item)\n return false if new_item && !$game_party.has_item?(new_item)\n $game_party.force_gain_item(old_item, 1)\n $game_party.force_gain_item(new_item, -1)\n return true\n end", "def put_item_in_inventory(input)\n\n if find_item_by_id(input).canBePickedUp\n unless @inventory.include?(input)\n @inventory << input\n slow_type(\"\\nYou have picked up the #{find_item_by_id(input).name}.\")\n end\n\n else\n slow_type(\"You cannot pick up this item\")\n end\n end", "def unequip_item\n\t\tself.equiped = false\n\t\tself.save\n\tend", "def behavior_hungry\n @world.food.each do |food|\n if distance_from_point(food.position) < (food.quantity + ROID_SIZE*5)\n @delta -= self.position - food.position\n end \n if distance_from_point(food.position) <= food.quantity + 5\n eat food\n end \n end \n end", "def register_state_item(item)\n name = item.name\n if @state_items[name]\n raise \"Duplicate item name: #{name}! Failing!\"\n end\n @state_items[name] = item\n if item.zone?\n @zones.push(item)\n end\n if @finished_init\n send_notification(type: ::Demiurge::Notifications::NewItem, zone: item.zone_name, location: item.location_name, actor: name)\n end\n item\n end", "def enemy;\n @item;\n end", "def use_item_nontarget\n Sound.play_use_item\n $game_party.consume_item(@item)\n @item_window.draw_item(@item_window.index)\n @target_window.window_update($game_party.members)\n if $game_party.all_dead?\n $scene = Scene_Gameover.new\n elsif @item.common_event_id > 0\n $game_temp.common_event_id = @item.common_event_id\n $scene = Scene_Map.new\n end\n end", "def use_item_nontarget\n Sound.play_use_item\n $game_party.consume_item(@item)\n @item_window.draw_item(@item_window.index)\n @target_window.window_update($game_party.members)\n if $game_party.all_dead?\n $scene = Scene_Gameover.new\n elsif @item.common_event_id > 0\n $game_temp.common_event_id = @item.common_event_id\n $scene = Scene_Map.new\n end\n end", "def perform_item_scrapping( served_quantity) \n self.scrapped_quantity += served_quantity \n self.save \n \n self.mark_as_finished \n \n item.add_scrap_quantity( served_quantity ) \n \n return self\n end", "def perform_item_scrapping( served_quantity) \n self.scrapped_quantity += served_quantity \n self.save \n \n self.mark_as_finished \n \n item.add_scrap_quantity( served_quantity ) \n \n return self\n end", "def after_item(item)\n item\n end", "def _stack_add_item(pokemon: nil, item_id: 0, bag: nil)\n item_id = GameData::Item[item_id].id\n extend_data = ::PFM::ItemDescriptor.actions(item_id)\n if extend_data and extend_data[:action_to_push]\n @results << [1, [item_id, extend_data, pokemon.position]]\n bag.drop_item(item_id, 1)\n return true\n else\n return false\n end\n end", "def inventory_item_is_available\n \tif self.inventory_item.present? && self.inventory_item.is_available?(project.rental_delivery, project.rental_pickup) == false\n \t\terrors.add(:inventory_item, \"is not available within this project's duration\")\n \telsif self.inventory_item.blank?\n \t\tself.inventory_item = inventory_style.find_available(project.rental_delivery, project.rental_pickup)\n \t\terrors.add(:inventory_style, \"has no available items within this project's duration\") if self.inventory_item.blank?\n \tend\n end", "def unequip_item(item)\n pair = @outfit.detect { |type, value| value.name.casecmp(item.to_s).zero? }\n if pair\n # On a successful find, the \"detect\" method always returns\n # an array of length 2; thus, the following line should not fail.\n item = pair[1]\n item.unequip(self)\n add_item(item)\n else\n print NOT_EQUIPPED_ERROR\n end\n end", "def damage(item_damaged) #allow the item class to be use through the parameter\n until @current_time == @time || item_damaged.item_health == 0 || @tool_health == 0\n item_damaged.item_health -= 5\n @tool_health -= 10\n @current_time += 1\n end\n end", "def update_inventory\n self.order_items.each { |item| item.variant.add_pending_to_customer }\n end", "def gain_item(item, n, include_equip = false)\n number = item_number(item)\n case item\n when RPG::Item\n @items[item.id] = [[number + n, 0].max, 99].min\n when RPG::Weapon\n @weapons[item.id] = [[number + n, 0].max, 99].min\n when RPG::Armor\n @armors[item.id] = [[number + n, 0].max, 99].min\n end\n n += number\n if include_equip and n < 0\n for actor in members\n while n < 0 and actor.equips.include?(item)\n actor.discard_equip(item)\n n += 1\n end\n end\n end\n end", "def item_ok?\n return true if MAP_ITEM_ID == 0\n $game_party.has_item?($data_items[MAP_ITEM_ID])\n end", "def drop_item(item)\n #this will take an item from the hero's inventory and place it in the current room\n end", "def buy_item(name)\n change = @calculator.buy @items[name].last\n [@items[name].pop, change]\n end", "def get_item(item)\n return item.move(@inventory)\n end", "def return_item \n if status == :in_progress\n transaction do\n update(:status => :done)\n # Create newsfeed\n ::Yito::Model::Newsfeed::Newsfeed.create(category: 'booking',\n action: 'return_item',\n identifier: self.id.to_s,\n description: BookingDataSystem.r18n.t.returned_item)\n end \n end\n self\n end", "def has_this_item?(item_id)\n item_id.blank? ? true : self.delivered_items.map(&:item_id).include?(item_id)\n end", "def has_this_item?(item_id)\n item_id.blank? ? true : self.delivered_items.map(&:item_id).include?(item_id)\n end", "def given_population(&block)\n @populations.push(Population.new(&block))\n end", "def test_on\n assert_equal items(:sals, :panera, :starbucks), Item.on(Date.today)\n end", "def shipped\n order = Order.second\n items = LineItem.where(order_id: order.id)\n items.each do |item|\n order.line_items << item\n end\n OrderNotifier.shipped(order)\n end", "def assigned_agenda_item(agenda_item, author)\n Notifications.agenda_item_assigned(agenda_item, author).deliver_later\n end", "def unequip(item)\n return {:status => \"Item not equipped\"} unless item.equipped?\n\n perform(0) do |notifications|\n item.unequip!\n notifications[:status] = \"Unequipped #{item}\"\n end\n end", "def use_item_to_actors\n $game_party.members[0].item_apply(user, item)\n end", "def push(item); end", "def btc_arrived\n item = read\n item['active'] = 2\n item['assigned'] = Time.now.to_i\n @aws.put_item(table_name: 'zold-wallets', item: item)\n end", "def test_valid_when_updating_dropdead_on_in_future_with_past_dropdead_on\n @item = items(:overdue_unfinished_item)\n @item.dropdead_on = 1.day.from_now.to_date\n assert @item.valid?\n end", "def after_redeem() end", "def choice_a_battle\n use_item_in_battle\n end", "def load_item_from_infinite_stock(order_item)\n create_item_from(order_item, order_item.order.number)\n true\n end", "def attach_item(item)\r\n equal_item = self.check_for_equal_item(item.name,item.price,item.description)\r\n if equal_item == nil\r\n self.items << item\r\n item.owner = self\r\n item.deactivate\r\n else\r\n equal_item.quantity += item.quantity\r\n equal_item.deactivate\r\n item.delete\r\n end\r\n end", "def enter_pending; end", "def run\n\t\twhile !@collection.complete?\n\t\t\tbuyPack\n\t\tend\n\tend", "def use_item(item)\n battler.use_item(item)\n end", "def step\r\n crossover\r\n mutation\r\n # Compute selection order based on energy\r\n p = @population.map{ |i| [i, i[:energy] * (1 - @selection + rand * @selection) ] }\r\n # Select next generation: fitter individuals (lower energy number)\r\n # will be selected with higher propability \r\n @population = p.sort{ |a,b| a[1] <=> b[1] }[0..@size].map{|i, o| i}\r\n end", "def examine(item)\r\n \r\n end", "def test_simple_item_copy\n engine = Demiurge::DSL.engine_from_dsl_text([\"Goblin DSL\", DSL_TEXT])\n first_cave_item = engine.item_by_name(\"first moss cave\")\n refute_nil first_cave_item\n zone = engine.item_by_name(\"moss caves\")\n refute_nil zone\n second_cave_item = engine.instantiate_new_item(\"second moss cave\", first_cave_item)\n refute_nil engine.item_by_name(\"second moss cave\")\n assert [\"first moss cave\", \"second moss cave\"].all? { |name| zone.contents_names.include?(name) }\n\n 6.times do\n engine.advance_one_tick\n end\n\n assert_equal 2, second_cave_item.state[\"moss\"]\n assert_equal 2, first_cave_item.state[\"moss\"]\n end", "def add_item(item)\n item.item_number = @@item_number\n @@item_number += 1\n @grocery_item << item\n\n # starting the logic for finding out what type of item it is and if it will be\n # allowed to be taxed. < -- Continue here\n if @grocery_item.item_type == \"books\"\n\n end\n\n\n\nend", "def shipped\n corresponding_item = self.item.take\n current_inventory = corresponding_item.inventory_level\n corresponding_item.update_attribute(:inventory_level, (self.quantity + current_inventory)) unless previous.nil?\n self.update_attribute(:shipped_on, date.current.to_date)\n\n def item_exists_and_active?\n all_active_items = Item.active.all.map(&:id)\n if all_active_items.include?(self.item_id)\n return true\n end\n errors.add(:item_id, \"is not an active item at the chess store\")\n return false\n end\n\n def subtotal(date = nil)\n end\n\n def valid_quantity?\n if self.quantity >= 0\n return true\n end\n stock_quantity = self.item.inventory_level\n if (self.quantity* -1) > stock_quantity\n errors.add(:quantity, \"too much purchase quantity\")\n return false\n end\n return true\n end\nend", "def pickup(object)\n\t\t\tif object.parent == current_room\n\t\t\t\ttake(object)\n\t\t\t\tself.reload\n\t\t\telse\n\t\t\t\traise GreyGoo::Error, \"Can't take that object\"\n\t\t\tend\n\t\tend", "def offer_an_item(item)\r\n item.status = true\r\n end" ]
[ "0.64498615", "0.6302443", "0.6135156", "0.6074962", "0.60643816", "0.6026765", "0.5939954", "0.5905071", "0.58802426", "0.58473086", "0.56653774", "0.56487507", "0.5631647", "0.5574348", "0.5568417", "0.554843", "0.55342615", "0.5510227", "0.5491626", "0.54584455", "0.5454516", "0.5447531", "0.5421594", "0.54163605", "0.5408966", "0.5403865", "0.54006916", "0.5392936", "0.5385138", "0.5384334", "0.5372136", "0.536582", "0.5361012", "0.5357506", "0.5356649", "0.53385985", "0.531827", "0.5317118", "0.53066427", "0.52947795", "0.52934676", "0.52629304", "0.5261937", "0.52427495", "0.5237931", "0.523458", "0.5231919", "0.5230475", "0.5225223", "0.5209835", "0.5207461", "0.5191474", "0.51827025", "0.5181609", "0.51793694", "0.51759666", "0.51746637", "0.5173098", "0.5169592", "0.5157679", "0.5157679", "0.51552665", "0.51552665", "0.51539993", "0.5153171", "0.51512027", "0.51451313", "0.51433843", "0.51429933", "0.51354706", "0.5132193", "0.5129304", "0.5128525", "0.5120502", "0.51197064", "0.51173496", "0.51173496", "0.51151764", "0.5106312", "0.5104026", "0.50987434", "0.50974256", "0.5093649", "0.50883526", "0.50793576", "0.50774825", "0.5075283", "0.50726575", "0.5069832", "0.5067453", "0.50628424", "0.50569457", "0.5055866", "0.5055479", "0.5049956", "0.5045723", "0.5039904", "0.50349164", "0.50346524", "0.50329924" ]
0.7662382
0
logic for computer opponent turn
def opponent_turn #set variables game = Game.find(self.game_id) player = Player.find(game.players.last) draw_card = Card.where(player_id: -2).first opponent_cards = Card.where(player_id: self.id) possible_plays = [] colors = ["blue", "green", "red", "yellow"] #determine eligible cards in hand. opponent_cards.each do |card| if card.color == draw_card.color || card.number == draw_card.number || (card.card_action != nil && card.card_action == draw_card.card_action) possible_plays.push(card) end end #starts decision logic for card to play, otherwise draws a card and looks for possible plays if possible_plays.any? #discard current draw pile card draw_card.player_id = -1 draw_card.save #determines card to be played, sets card to be the new draw pile card selected_card = possible_plays.sample selected_card.player_id = -2 selected_card.save #determines if card has special action, and executes action if it does. if selected_card.card_action != nil if selected_card.card_action === "skip" || selected_card.card_action === "reverse" self.opponent_turn elsif selected_card.card_action === "draw" draw_two = Card.where(player_id: 0).sample(2) draw_two.each do |card| card.player_id = game.players.first.id card.save end self.opponent_turn elsif selected_card.card_action === "draw_four" draw_four = Card.where(player_id: 0).sample(4) draw_four.each do |card| card.player_id = player.id card.save end self.opponent_turn elsif selected_card.card_action === "wild_color" selected_card.color = colors.sample selected_card.save end else #switches current turn once card has been selected and played if game.current_turn = self.id game.current_turn = player.id game.save else game.current_turn = self.id game.save end end else #draws a card from the draw pile and repeats opponent_turn process. drawn_card = Card.where(player_id: 0).sample drawn_card.player_id = self.id drawn_card.save self.opponent_turn end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def comp_turn\n index = computer_index\n if valid_move?(index)\n move(index, current_player)\n display_board\n else\n comp_turn\n end\n end", "def take_turn(turn_value)\n turn = turn_value\n \n if turn.even? \n @player_human.move(@board)\n puts drawgrid \n is_a_human_win(@board) \n else\n @player_computer.move(@board)\n puts drawgrid \n is_a_computer_win(@board) \n end \n end", "def game_turns\n @turn_obj.play_turn(solution, mode, @computer_solve_obj) until @turn_obj.game_over(@turn_obj.results,mode)\n end", "def player_turn\n # if the board has more x's then it is the computer's turn\n if @board.count(@symbol) > @board.count(@computer_symbol)\n computer_turn\n else\n users_turn\n end\n end", "def process_player_turn\n\t\tself.current_player = \"Computer\"\n\t\tindicate_player_turn\n\t\tplayer_good_move= self.get_good_move\n\t\tchange_state(player_symbol, player_good_move)\n\t\tplayer_good_move\n\tend", "def determine_turn\n @player = if @player1_turn\n puts \"It is #{@player1}'s turn\"\n \"X\"\n\n else\n puts \"It is #{@player2}'s turn\"\n \"O\"\n\n end\n\n end", "def process_computer_turn\n \tself.current_player = @player\n \tputs \"My Move, playing #{computer_symbol}\"\n \tcomputer_move = self.get_computer_move\n \tchange_state(computer_symbol,computer_move)\n \tcomputer_move\n end", "def turn(player)\n puts \" C'est le tour de #{player.nom}\"\n\n#affichage du plateau\n @plateau.visuel\n\n#demande au joueur ce qu'il joue\n puts \"Ou veux tu placer ton pion?\"\n puts \"Info : Tapes de 1 à 9\"\n @choix = gets.chomp.to_i\n puts \"Tu as choisi la case #{@choix}\"\n\n#appel de la methode de modification de la valeur de la case\n @plateau.play(@choix, player, player.token)\n\n#affichage du tableau avec les modifications\n @plateau.visuel\n\n#verification de la victoire ou non \n @plateau.victory(player.win, player.token)\n puts player.win\n if player.win == false\n go\n elsif\n puts \"Le jeu est fini ! #{player.nom} à gagner\"\n end\n\n end", "def current_player(board)\nif turn_count(board) % 2 == 0\n \"X\"\nelsif turn_count(board) % 2 == 1\n \"O\"\n end\nend", "def change_turn\n if @player_to_move == \"w\"\n @player_to_move = \"b\"\n else\n @player_to_move = \"w\"\n end\n end", "def current_player(board)\n turns=turn_count(board)\n if(turns%2==0)\n \"X\"\n else\n \"O\"\n end\nend", "def turn\n puts \"#{@player_1.name}'s turn.\"\n puts \"Choose your case:\"\n print \">\"\n check_if_empty(@player_1)\n if win\n @board.print_board\n return true\n end\n @board.print_board\n puts \"#{@player_2.name}'s turn.\"\n puts \"Choose your case:\"\n print \">\"\n check_if_empty(@player_2)\n if win\n @board.print_board\n return true\n end\n @board.print_board\n end", "def current_player(board)\n if turn_count(board)&1==0 || turn_count(board) == 0;\n return \"X\"\n else\n return \"O\"\n end\nend", "def conduct\n # last_move = nil\n # winner = nil\n # until winner = (@cur_board.game_over? last_move) do\n # print_state\n\n # Handle different move-getting methods depending on turns\n # Actually mostly just handle board stuff\n\n # Actually both of them can just keep hitting try_move until it validates as being the right turn\n\n # last_move = move_piece\n \n # @turn = Board::opponent_of @turn\n # @turn_count += 1\n # end\n\n # until @game_over do\n # move_piece\n # end\n\n # end_game\n end", "def play\n #self.set_players # Only uncomment one of these two lines.\n self.set_computer_players # Uncomment this line to have two computer players\n until @board.winner?\n self.turn\n self.change_current_player\n end\n winner = (@current_player == @player1) ? @player2 : @player1\n puts \" #{winner.color.to_s.upcase} is the winner!!!!\"\n puts \"Thanks for playing.\"\n end", "def turnover\n puts \"---> Turnover\"\n change_of_possession\n end", "def current_player(board)\n turns = turn_count(board)\n if turns.odd?\n return \"O\"\n else\n return \"X\"\n end\nend", "def current_player\n turn_count \n if turn_count%2 != 0 \n \"O\"\n else\n \"X\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\" #even turn count == X\n end \n return \"O\" #odd turn count == O \nend", "def computer_vs_computer_game\n game = Game.new\n puts \"This game determines which of our AI Overlords wins Earth \"\n Game.new(Players::Computer.new('X'), Players::Computer.new('O')).play\n play_again?\n end", "def player_turn(player, board)\n check_the_case = false\n while check_the_case == false\n my_choice = 0\n while my_choice < 1 || my_choice > 9\n my_choice = player.call_player\n if my_choice < 1 || my_choice > 9\n p \"Ce n'est pas une commande valide!\"\n end\n end\n check_the_case = board.check_case_value(my_choice, player.number)\n end\n board.display_board\n if board.check_victory(my_choice) == true\n p \"#{player.name} a gagné!\"\n return true\n end\nend", "def play(board)\n #until the game is over # if method ends in a \"?\"\n #it could be used directly in an conditional statment becasue it always return trueth or falsely values..\n turn(board) until over?(board)\n\n if won?(board)\n #puts \"Congratulations #{current_player(board)}!\"\n puts \"Congratulations #{winner(board)}!\"\n\n elsif draw?(board) #the game was a draw\n puts \"Cat's Game!\"\n end\nend", "def turn\n puts \"Turn #{@board.count_turn + 1}, player #{get_current_player.name} choose:\"\n @board.play_turn\n end", "def other_turn\n\t\t@turn == \"x\" ? \"o\" : \"x\"\n\tend", "def turn(tictactoe)\n moves_avail = @tictactoe.open_squares(p1_moves(@tictactoe),p2_moves(@tictactoe))\n\n return \"Player 1\" if moves_avail.length.odd? && tictactoe.players[0].first_to_act == \"true\"\n return \"Player 2\" if moves_avail.length.even? && tictactoe.players[0].first_to_act == \"true\"\n return \"Player 2\" if moves_avail.length.odd? && tictactoe.players[0].first_to_act == \"false\"\n return \"Player 1\" if moves_avail.length.even? && tictactoe.players[0].first_to_act == \"false\"\n end", "def turn\n puts \"#{@current_player.name}\\'s turn. Choose your cell (1-9)\" \n choice = gets.chomp.to_i\n if choice > 9 || choice < 1\n puts \"Warning : number must be between 1 and 9\"\n elsif @current_player.move(choice) != false\n @winner = @current_player if @current_player.winner?\n @turn += 1\n switch_player\n end\n end", "def set_turn\n if @turn == :player && @cpu_hand.cards.any? { |c| @total + c.value <= 31 }\n @engine.delay_update 0.5\n @turn = :cpu\n elsif @turn == :cpu && @player_hand.cards.any? { |c| @total + c.value <= 31 }\n @turn = :player\n else\n check_all_cards\n end\n end", "def current_player(board)\n if turn_count(board).odd?\n \"O\"\n else\n \"X\"\n end\nend", "def current_player(board)\n if turn_count(board).even?\n \"X\"\n elsif turn_count(board).odd?\n \"O\"\n end\nend", "def game_with_two_players\n\t\t@current_turn = @player_one if @current_turn == false\n\t\tuntil check_or_checkmate(@current_turn) == \"CHECKMATE\"\n\t\t\tmove\n\t\t\tif @current_turn == @player_one\n\t\t\t\t@current_turn = @player_two\n\t\t\telsif @current_turn == @player_two\n\t\t\t\t@current_turn = @player_one\n\t\t\tend\n\t\t\tclear_screen\n\t\tend\n\tend", "def current_player(board)\nturn_count(board).even? ? \"X\":\"O\"\nend", "def turn\n victory = false\n while victory == false do\n player_place\n @board.show_board\n end\n end", "def turn_player\n input = get_user_input_and_check([\"h\",\"s\"])\n if input === \"h\"\n\n get_card_and_put_in_hand(\"player\")\n display_board_screen(\"hidden\")\n hand_total = calculate_hand_total_value(@hand_player)\n if check_if_over_21(hand_total)\n return \"over\"\n else\n turn_player\n end\n\n elsif input === \"s\"\n return \"stay\"\n end\nend", "def current_player(board)\n turns = turn_count(board) % 2\n if turns == 0\n return \"X\"\n else\n return \"O\"\nend\nend", "def whose_turn\n if @turn % 2 == 0\n return \"X\"\n end\n return \"O\"\n end", "def current_player(board)\n#player = \"X\"\nif (turn_count(board) % 2) == 0\n player = \"X\"\nelsif (turn_count(board) % 2) != 0\n player = \"O\"\nend\nend", "def turns\n while @board.game_check == false\n player_process(@player1_name,@player1_symbol,@turn)\n break if @board.game_check == true\n\n player_process(@player2_name,@player2_symbol,@turn)\n end\n @board.display\n print \"\\nDone \\n\"\n end", "def play(board)\n until over?(board)\n turn(board)\n #value=current_player(board)\n end\n if winner(board)==\"X\"\n puts \"Congratulations X!\"\n elsif winner(board)==\"O\"\n puts \"Congratulations O!\"\n else\n puts \"Cats Game!\"\n end\nend", "def current_player(board)\n current_turn = turn_count(board)\n if current_turn == 0 || current_turn % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n \"X\"\n elsif turn_count(board) % 2 == 1\n \"O\"\n end\nend", "def winner \n if won? \n turn_count.even? ? \"O\" : \"X\"\n end \n end", "def human_turn?\n @current_player != @computer_player\n end", "def current_player(board)\n if turn_count(board) % 2 ==0\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\r\n if (turn_count(board) + 1) %2 == 0\r\n \"O\"\r\n else\r\n \"X\"\r\n end\r\nend", "def play(board)\nnum_of_turns = 0\n until num_of_turns == 9 || over?(board) == true\n turn(board)\n num_of_turns += 1\n end\n if over?(board) == true && won?(board) == \"X\"\n puts \"Congratulations X!\"\n elsif\n over?(board) == true && won?(board) == \"O\"\n puts \"Congratulations O!\"\n elsif\n over?(board) == true && won?(board) != true\n puts \"Cats Game!\"\n else\n\n end\nend", "def player_turn(turn)\n get_player_input\n compare_guesses\n update_board(turn)\n system 'clear'\n display_board(turn)\n end", "def opponent\n (@player_num - 1).abs\n end", "def current_player(board)\n next_turn = turn_count(board)\n if next_turn % 2 == 0 \n return 'X'\n else \n return 'O'\n end\nend", "def current_player(board)\n if turn_count(board).even?\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n if turn_count(board).even?\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n if (turn_count(board) % 2 == 0)\n return \"X\"\n elsif !(turn_count(board) % 2 == 0)\n return \"O\"\n end\nend", "def change_turns\n (@current_player == @p1) ? @current_player = @p2 : @current_player = @p1\n end", "def current_player(board)\nturn_count(board).even? ? \"X\" : \"O\"\nend", "def turn\n marker = @turn_count.even? ? marker = \"X\" : marker = \"O\"\n move\n print \"Current board: \"\n show_board\n @player +=1\n end", "def switch_players\n @player1_turn = !@player1_turn\n end", "def current_player(board)\n turn_count(board)\n if turn_count(board).even?\n \"X\"\n else \n \"O\"\n end\nend", "def opponent\n @player == :human ? :computer : :human\n end", "def current_player\n if (turn_count % 2) == 0\n player = \"X\"\n elsif (turn_count % 2) != 0\n player = \"O\"\n end\nend", "def win\n winning_move(@computer_mark)\n end", "def current_player(board)\n current_pla = turn_count(board)\n if current_pla %2==0\n return \"X\"\n else\n return \"O\"\n end\n \nend", "def gameLogic(option)\n newOption = option.downcase \n playersChoice = newOption[0]\n computer = self.random\n \n p \"Computer Chose: #{computer}\"\n if playersChoice == computer[0]\n return 'tie'\n elsif playersChoice == 'r' && computer[0] == 'p'\n return false \n elsif playersChoice =='s' && computer[0] = 'r'\n return false\n elsif playersChoice == 'p' && computer[0] == 's'\n return false\n else\n return true\n end\n end", "def switch_player_turn(player_turn)\n case player_turn\n when \"O\"\n player_turn = \"X\"\n when \"X\"\n player_turn = \"O\"\n end\n return player_turn\n end", "def current_player\n if turn_count % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\nend", "def calculate_winner\n self.winner = case human.move <=> computer.move\n when 1\n human\n when -1\n computer\n when 0\n 'tie'\n end\n end", "def current_player(board)\n \n num_turns = turn_count(board)\n \n if num_turns % 2 == 0\n return \"X\"\n else\n return \"O\"\n end\n\nend", "def current_player #removed (board) argument\n turn_count % 2 == 0 ? \"X\" : \"O\" \nend", "def current_player(board)\n if turn_count(board).even?\n current_player = \"X\"\n else\n current_player = \"O\"\n end\nend", "def current_player(board)\n turn_count(board)\n if turn_count(board) % 2 == 0\n \"X\"\n else\n \"O\"\n end\nend", "def current_player(board)\n return turn_count(board).odd? ? \"O\" : \"X\"\n\nend", "def switch_player\n @current_player = if @current_player == @player_o\n @player_x\n else\n @player_o\n end\n\n @number_of_turns += 1\n end", "def computer_play_turn\n puts \"Turn #{@turn}:\"\n guess_result = @computer_ai.guess.compare_codes_standard(@mastermind_code)\n puts \"Computer's Guess \\t Feedback\"\n puts \"#{@computer_ai.guess} \\t #{guess_result}\"\n return true if guess_result.count('√') == 4\n\n # It was incorrect so eliminate codes as per the algorithm.\n @computer_ai.eliminate_codes(guess_result)\n @turn += 1\n false\n end", "def play()\n c=1\n p=\"X\"\n while !over?()\n turn()\n end\n if won?()\n puts \"Congratulations #{winner()}!\"\n elsif draw?()\n puts \"Cats Game!\"\n else\n end\nend", "def turn\n puts \"\"\n puts \" \" * 35 + \"c'est au tour à #{@current_player.name} de joué (1-9): \"\n puts \"\"\n print \" \" * 40 + \"> \"\n choice = gets.chomp.to_i\n if choice > 9 || choice < 1\n puts \"Tu te trompe de touche jeune apprentie\"\n elsif @current_player.move(choice) != false\n @winner = @current_player if @current_player.winner?\n @turn += 1\n switch_player\n end\n end", "def turn()\n puts \"Coins: #{@current_player.get_coin_count}\"\n @current_player.show_active_cards\n puts Action.show_all_actions.join \"\\n\"\n\n # If a player ahs more than 10 coins he must stage a coup\n if (@current_player.get_coin_count > 10)\n action_id = \"2\"\n else\n puts \"#{@current_player} what is your action\"\n action_id = gets.strip\n end\n\n current_action = Action.new(action_id)\n if current_action.requires_target\n target_player = nil\n while target_player == nil || target_player == @current_player\n puts \"Select a target\"\n target_id = gets.strip\n target_player = get_player_by_id(target_id)\n end\n current_action.set_target(target_player)\n end\n\n turn_over = false\n action_failed = false\n\n @@turn += 1\n\n puts \"#{@current_player} moves: #{current_action}\"\n\n if (current_action.can_be_challenged?)\n puts \"Enter Y to challenge\"\n challenge = gets.strip\n if challenge == 'Y'\n puts \"Challenger enter your id\"\n player_challenging_id = gets.strip\n\n if (challenge && player_challenging_id)\n if @current_player.has_claimed_action_character?(current_action)\n @player_challenging = get_player_by_id(player_challenging_id)\n @player_challenging.loses_influence\n @current_player.swap_influence(current_action, @deck)\n else\n @current_player.loses_influence\n action_failed = true\n end\n end\n end\n turn_over = true\n end\n\n if (!turn_over && current_action.can_be_countered?)\n puts \"Enter Y to counteract\"\n counteraction = gets.strip\n\n if counteraction == 'Y'\n puts \"Counteractor enter your id\"\n counteracting_player_id = gets.strip\n if counteracting_player_id\n @counteracting_player = get_player_by_id(counteracting_player_id)\n puts \"Current player enter Y to challenge this counteraction\"\n challenge_counteraction = gets.strip\n if challenge_counteraction\n if @counteracting_player.has_claimed_counteraction_character?(current_action)\n @current_player.loses_influence\n @counteracting_player.swap_influence(current_action, @deck)\n else\n @counteracting_player.loses_influence\n end\n turn_over = true\n else\n turn_over = true\n action_failed = true\n end\n end\n end\n end\n\n if !action_failed\n current_action.succeed(@current_player, current_action, @deck)\n end\n\n next_player()\n\n if is_game_over()\n puts \"game over\"\n puts \"#{get_winner} wins\"\n else\n turn()\n end\n\n end", "def current_player(board)\n count = turn_count(board)\n count.even? ? \"X\" : \"O\"\nend", "def current_player(board)\n if turn_count(board).even?\n return \"X\"\n else\n return \"O\"\n end\nend", "def current_player(board)\n if turn_count(board).even?\n return \"X\"\n else\n return \"O\"\n end\nend", "def game_on\n # Declare variable for player_1 and player_2 -> using .new\n player_1 = Player.new(\"Player 1\")\n player_2 = Player.new(\"Player 2\")\n\n # Declare a counter variable\n count = 0\n\n # Use a while loop to play game until one of the player has no live left\n while player_1.lives > 0 && player_2.lives > 0\n puts \"***** NEW TURN *****\"\n\n # Check if the counter is even?\n count.even? ? play_turn(player_1) : play_turn(player_2)\n\n # Display the results of player 1 and 2 \n display_player_1_result = \"P1: #{player_1.lives}/3 vs \"\n display_player_2_result = \"P2: #{player_2.lives}/3\"\n # Print out the output string\n puts display_player_1_result + display_player_2_result\n \n count += 1\n end\n\n # Find the winner\n winner = player_1.game_over? ? player_2 : player_1\n puts \"*********************\"\n # Print out the winner and his score\n puts \"#{winner.name} wins with a score of #{winner.lives}/3\"\n puts \"***** GAME OVER *****\"\n puts \"***** GOOD BYE *****\"\nend", "def current_player_turn\n turns % 2 == 0 ? 1 : 2\n end", "def take_turn\n valid_cells(@opponent_board).sample\n end", "def current_player(board)\n if (turn_count(board) % 2) == 0\n player = \"X\"\n elsif (turn_count(board) % 2) != 0\n player = \"O\"\n end\nend", "def current_player\n turn = turn_count\n if turn%2 == 0\n return \"X\"\n else\n return 'O'\n end\n end", "def change_turn\n @turn += 1\n @this_players_turn = @players.reject{|x| x == @this_players_turn}[0]\n take_turn(@this_players_turn)\n end", "def current_player(board)\n turn_count(board).odd? ? \"O\" : \"X\"\nend", "def current_player(board)\n turn_count(board).odd? ? \"O\" : \"X\"\nend", "def play(board)\n until over?(board)\n turn(board)\n end\nif won?(board)\n puts \"Congratulations #{winner(board)}!\"\nelsif draw?(board)\n puts 'Cats Game!'\nend\nend", "def current_player(board)\n if turn_count(board) % 2 == 0\n return \"X\"\n else \n return \"O\"\n end\nend", "def play_turn(board,joueur_actuel)\n # cette variable permet de verifier les disponibilité des cases .\n input_ko = true\n # [0] ... [ 8] ça défini les emplacement \n while input_ko\n print \"#{joueur_actuel.joueur_nom}, ton symbol est le '#{joueur_actuel.joueur_symbol}', quelle case souhaites-tu jouer ? \"\n case_to_play = gets.chomp.upcase\n\n case case_to_play\n when \"A1\"\n if board.list_boardcase[0].symbol == '.'\n board.list_boardcase[0].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"A2\"\n if board.list_boardcase[1].symbol == '.'\n board.list_boardcase[1].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"A3\"\n if board.list_boardcase[2].symbol == '.'\n board.list_boardcase[2].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"B1\"\n if board.list_boardcase[3].symbol == '.'\n board.list_boardcase[3].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"B2\"\n if board.list_boardcase[4].symbol == '.'\n board.list_boardcase[4].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"B3\"\n if board.list_boardcase[5].symbol == '.'\n board.list_boardcase[5].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"C1\" \n if board.list_boardcase[6].symbol == '.'\n board.list_boardcase[6].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"C2\"\n if board.list_boardcase[7].symbol == '.'\n board.list_boardcase[7].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n when \"C3\"\n if board.list_boardcase[8].symbol =='.'\n board.list_boardcase[8].symbol = joueur_actuel.joueur_symbol\n input_ko = false\n else\n puts \"Case déjà occupée. Réessayes avec la bonne case !\"\n end\n else \n puts \"erreur de case\"\n end\n end\n\tend", "def change_turn\n @turn = @turn >= 'X' ? 'O' : 'X'\n @turn_played += 1\n end", "def turn(player)\n if player == 'X'\n print \"\\nPlayer X turn >> \"\n @x_move = gets.chomp\n elsif player == 'O'\n print \"\\nPlayer O turn >> \"\n @o_move = gets.chomp\n end\n end", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend", "def current_player(board)\n turn_count(board).even? ? \"X\" : \"O\"\nend" ]
[ "0.73104227", "0.73022056", "0.72968125", "0.72750026", "0.7273715", "0.7207768", "0.7198235", "0.7098426", "0.70648116", "0.706345", "0.7059881", "0.70439935", "0.70095736", "0.7007997", "0.69978464", "0.6997129", "0.6993902", "0.69902956", "0.69716644", "0.6966897", "0.6962273", "0.6957614", "0.6955684", "0.6941728", "0.6922158", "0.69181234", "0.6911984", "0.6908186", "0.6905728", "0.6903837", "0.69005626", "0.6900404", "0.6900145", "0.6897117", "0.6893003", "0.6881883", "0.68780476", "0.6874751", "0.6873853", "0.6872894", "0.6866514", "0.68627644", "0.6856144", "0.6850488", "0.68410635", "0.68372005", "0.6830454", "0.68276554", "0.68198186", "0.68198186", "0.6813625", "0.6804491", "0.68026584", "0.6802216", "0.68016416", "0.68013656", "0.6799139", "0.67910665", "0.67804074", "0.6778288", "0.6772847", "0.67708266", "0.6770796", "0.6769784", "0.67648953", "0.6764292", "0.6763465", "0.6759455", "0.6759014", "0.6758503", "0.6756588", "0.6755372", "0.6754362", "0.6746241", "0.6744613", "0.67389625", "0.67389625", "0.67377585", "0.67367476", "0.67355764", "0.673553", "0.6731243", "0.6728026", "0.6727064", "0.6727064", "0.67261636", "0.67219615", "0.67208725", "0.6720143", "0.67185867", "0.6718551", "0.6718551", "0.6718551", "0.6718551", "0.6718551", "0.6718551", "0.6718551", "0.6718551", "0.6718551", "0.6718551" ]
0.6878854
36
FIXME: Does this have to be public only for testing?
def call if event.command? && command_aliases.include?(event.command) handle_command end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def implementation; end", "def implementation; end", "def probers; end", "def internal; end", "def schubert; end", "def spec; end", "def spec; end", "def refutal()\n end", "def custom; end", "def custom; end", "def used?; end", "def private_method\n end", "def internal?; end", "def identify; end", "def weber; end", "def from; end", "def from; end", "def from; end", "def from; end", "def isolated; end", "def isolated; end", "def implemented_in; end", "def wrapper; end", "def called_from; end", "def called_from; end", "def loc; end", "def loc; end", "def loc; end", "def who_we_are\r\n end", "def internship_passed; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def init; end", "def init; end", "def init; end", "def init; end", "def initialize\n\n end", "def initialize\n\n end", "def missing; end", "def overrides; end", "def tell()\n #This is a stub, used for indexing\n end", "def sitemaps; end", "def intensifier; end", "def reflector; end", "def reflector; end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def missing?; end", "def origin; end", "def origin; end", "def origin; end", "def strategy; end", "def extra; end", "def public_method; end", "def terpene; end", "def original_result; end", "def initialize() end", "def handle; end", "def real_name; end", "def formation; end", "def public; end", "def public; end", "def verdi; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def usable?; end", "def original; end", "def operations; end", "def operations; end", "def returns; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end", "def signature; end" ]
[ "0.8048059", "0.6682607", "0.6682607", "0.6682607", "0.6682607", "0.64419425", "0.64419425", "0.6383329", "0.6349201", "0.61786866", "0.61642635", "0.61642635", "0.61604035", "0.6029651", "0.6029651", "0.6011552", "0.6004158", "0.5971093", "0.5963488", "0.5958499", "0.59420544", "0.59420544", "0.59420544", "0.59420544", "0.58967257", "0.58967257", "0.58609325", "0.58505946", "0.5799172", "0.5799172", "0.578982", "0.578982", "0.578982", "0.5781161", "0.5765681", "0.5759903", "0.5759903", "0.5759903", "0.5759903", "0.5759903", "0.5759903", "0.5759903", "0.5759903", "0.5759903", "0.5759903", "0.5759903", "0.5739558", "0.5739558", "0.5739558", "0.5739558", "0.5728828", "0.5728828", "0.57273865", "0.5703908", "0.56769603", "0.56720805", "0.56593555", "0.5659052", "0.5659052", "0.5656829", "0.5656829", "0.5656829", "0.5656829", "0.5656829", "0.5656829", "0.5656829", "0.5656829", "0.5656829", "0.5656829", "0.56557757", "0.5651009", "0.5651009", "0.5651009", "0.5648121", "0.5641662", "0.5633949", "0.562624", "0.5624272", "0.5622733", "0.56115556", "0.5606546", "0.5600021", "0.55971223", "0.55971223", "0.55809844", "0.5576383", "0.5576383", "0.5576383", "0.5569089", "0.55686915", "0.55620563", "0.55620563", "0.5561714", "0.55595607", "0.55595607", "0.55595607", "0.55595607", "0.55595607", "0.55595607", "0.55595607", "0.55595607" ]
0.0
-1
Send an email after the app has been redeployed
def redeploy setup_email @@to_emails @subject = "[#{Rails.env.titleize}] BestDebates redeployed (#{Time.now.to_s})" @body = @subject end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email(email)\n email.deliver_now\n end", "def email_notification\n return unless app.emailable? && should_email?\n Mailer.err_notification(self).deliver_now\n rescue => e\n HoptoadNotifier.notify(e)\n end", "def notify\n @greeting = \"Just a test\"\n mail(to: \"cneumann@marsmonitoring.com\") #.deliver_later\n end", "def send_email_changed_notification; end", "def weekly_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_welcome_email\n #if Rails.env.production?\n if email.present?\n if followed_by >= 0\n # to send emails in delayed jobs use\n # UserMailer.instauser_welcome_email(id).delay.deliver!\n UserMailer.instauser_welcome_email(self.id).deliver\n else\n UserMailer.instauser_reject_email(self.id).deliver!\n end\n end\n #end\n end", "def send_activation_or_reset_mail\n end", "def product_sold\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_email\n AlertNotifier.delay.email_back_office_announcement(self)\n end", "def admin_notify\n UserMailer.signup_notification(self).deliver_later!(wait: 1.minute)\n end", "def sendmail\n puts \"send mail \"\n puts @manifest.code \n\n @company = @manifest.company\n\n ActionCorreo.st_email(@manifest).deliver_now \n end", "def send_welcome_email\n UserMailer.welcome_message(self).deliver_later\n end", "def send_email\n AlertNotifier.delay.email_zero_inventory(self)\n end", "def send_signup_user_email\n #if Rails.env.production?\n UsersMailer.signup_email(self).deliver\n #end\n end", "def send_email_changed_notification?; end", "def weekly\n @greeting = \"Hello\"\n mail subject: args[:subject], to: args[:emails]\n mail to: \"to@example.org\"\n end", "def notify_email\n begin\n QuoteMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send quote email notification. #{e.message}\")\n end\n end", "def send_email_confirmation\n SiteMailer.delay.confirm_product_registration(self)\n end", "def product_back_in_inventory\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def daily_gratitude\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_mail_to_admin\n \tNotification.send_mail_to_admin(self).deliver!\n end", "def thanks(application)\n load_resources(application)\n @title = 'New Hire'\n mail( subject: 'Application Received', to: @application.email, track_opens: 'true' )\n end", "def do_email\n @manifest = Manifest.find(params[:id])\n @email = params[:email]\n \n Notifier.manifest(@email, @manifest).deliver\n \n flash[:notice] = \"El documento ha sido enviado con exito .\"\n redirect_to \"/manifests/#{@manifest.id}\"\n end", "def shipped\n @greeting = \"Hi\"\n\n mail to: \"tariq.sulehir@khaleef.com\"\n end", "def send_one_week_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end", "def send_activation_notification\n deliver_activation_email(:activation, :subject => (MaSA[:welcome_subject] || \"Welcome\" ))\n end", "def email_on_update\n ProductMailerMailer.email_on_update\n end", "def send_confirmation_email\n BetaMailer.send_beta_confirmation_email(self).deliver_later\n end", "def resend_mail\n if step_active? && merchant_session_active?\n # send an email verification mail to merchant\n @merchant = Merchant.find(session[:temporary_merchant_id])# get merchant details \n MerchantsMailer.registration_email(@merchant).deliver_later\n render 'new'\n return\n else\n redirect_to root_path\n return\n end\n end", "def send_post_registration_email\n IdealsMailer.account_registered(self).deliver_now\n end", "def event_mail\n NoticePlannerMailer.delay.notice_planner_email('lumi.xperia@gmail.com', 'test', 'cron-test', 'https://yahoo.co.jp')\n end", "def notify\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def host_confirmation\n \t#binding.pry\n \tSendMailToHost.host_confirmation(self).deliver!\n end", "def send_admin_mail\n AdministratorMailer.new_user_waiting_for_approval(self).deliver_now\n end", "def issued\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def updated\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def resend_activation_email\n create_activation_digest\n save\n send_activation_email\n end", "def send_admin_email\n AdminMailer.new_user_waiting_for_approval.deliver\n end", "def tutor_reserved_notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def deliver_email\n error = \"We forgot to define #{type}#deliver_email.\\n\"\n # Failing to send email should not throw an error in production\n return warn(error) if Rails.env.production?\n\n raise(error)\n end", "def notification\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def welcome_send\n UserMailer.welcome_email(self).deliver_now\n end", "def purchase_email\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_email\n Kernel.const_defined?(:MobileInfo) and\n System.ntpd_wait(60) do\n MobileInfo.send_email\n end\n end", "def ssl_was_revoked(email, app_name)\n @app_name = app_name\n mail to: email\n end", "def notify\n ReminderMailer.notify\n end", "def test_email\n @brother.post_notification(\n \"Email testing. \",\n \"This email serves solely to ascertain that ADP Dashboard emails can reach your email address. \",\n root_url\n )\n\n redirect_to root_url, flash: { notice: \"Test email sent to #{@brother.email}. \" }\n end", "def notify_manager(request)\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end", "def send_signup_email(job_application)\n @job_application = job_application\n mail( :to => 'apply@refunction.ca',\n :subject => 'Job Application Received' )\n end", "def send_signup_notification\n deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || \"Please Activate Your Account\") )\n end", "def after_update_challenge\n send_email_after_canceled_reactive\n send_email_after_change_start_date\n end", "def send_verification_email\n update!(email_status: \"sent\", email_verification_token: SecureRandom.uuid)\n JobMailer.confirm_email(self).deliver!\n end", "def send_day_before_reservation_reminder(email)\n @email = email\n mail(to: email, subject: 'Your Pet Boarding Reservation Reminder [RCN]')\n end", "def in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def payment_upcoming\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def email_changed_notification\n if self.email_changed? and (self.email != self.temp)\n self.token = self.class.make_token\n setup_email\n @subject = \"Email address verification\"\n @body = \"Please click this link to verify this email address: \\n#{SITE_URL}/change/#{token}\"\n \n Pony.mail(\n :subject => @subject, \n :body => @body\n )\n self.temp = self.email\n self.email = self.email_was\n end\n end", "def send_reminder\r\n\t\tif Date.today == expiration_date - 1\r\n\t\t\tReminderMailer.food_reminder_msg(@user).deliver\r\n \t\tflash[:notice] = \"#{@user.username} has been notified by email.\" \r\n \tend\r\n end", "def application_sended(application)\n @application = application\n mail to: \"to@example.org\"\n end", "def notify_host\n OrganisationMailer.notify_host\n end", "def notify_error(error)\n @error = error\n\n mail to: \"admin@example.org\", subject: \"Depot App Error\"\n end", "def notify_mail\n @greeting = \"Hi\"\n\n mail to: \"mitsuimasayoshi@gmail.com\", subject: \"[Localgarage]Printer_URL\"\n end", "def send_email\n true\n end", "def reconfirm_notification(user)\n setup_email(user)\n subject 'Confirm new email'\n\n body :user => user, :host => FROM_HOST\n end", "def reset_email\n # User reset email sent.\n end", "def daily_reading\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def activation_needed_email(vendor)\n @vendor = vendor\n @url = \"http://127.0.0.1:3000/vendors/#{vendor.activation_token}/activate\"\n mail(:to => vendor.email,\n :subject => \"Baitalhikma.co.jp - Please activate your vendor account\")\n end", "def rails_send_email(action)\n email = rails_create_email(action)\n email.public_send(rails_mailer_deliver_method)\n end", "def new_notification\n mail(to: \"rhammett@ycp.edu\", subject: 'New Notification', sent_on: Time.now)\n end", "def notify_subscriber\n @greeting = \"Hi\"\n mail to: \"thanhquang1988@gmail.com\"\n end", "def order_in_progress\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_to_revision profile\n @profile = profile\n\n mail to: Rails.application.secrets.admins_emails\n end", "def deliver_mail\n @invitation.deliver_mail\n track 'Invitation Deliver Mail', @invitation\n redirect_to account_invitations_path, notice: 'Invitation email has been sent.'\n end", "def send_welcome_email\n UserMailer.welcome(self).deliver_now\n end", "def send_email!\n UserMailer.event_ticket_notification(user, self).deliver_now\n end", "def welcome_email\n # User welcome email sent.\n end", "def perform(email)\n CompletionMailer.notify_admin_completion(email).deliver_now\n end", "def activation_success_email(vendor)\n @vendor = vendor\n @url = \"http://127.0.0.1:3000/login\"\n mail(:to => vendor.email,\n :subject => \"Baitalhikma.co.jp - Your account is now activated\")\n end", "def notify_email\n begin\n InsuranceLeadMailer.send_email(self).deliver\n rescue => e\n Rails.logger.error(\"Unable to send insurnace lead notification. #{e.message}\")\n end\n end", "def send_newsletter_email\n UserMailer.newsletter_confirmation(self).deliver_later\n end", "def welcome_email\n UserMailer.with(user: @user).welcome_email.deliver_later\n end", "def trigger_email(data)\n data.dig(:options, :mailer).send(\"#{data[:trigger]}_email\", data[:instance]).deliver_now\n end", "def send_email\n # There is a deliver_later method which we could use\n InvoiceMailer.email_invoice(self).deliver_now\n self.sent_by_email = true\n self.save\n end", "def resend_confirmation_email\n WEPAY.call('/user/resend_confirmation', self.wepay_access_token, {\n email_message: 'Thank you for signing up with WeCrowd. In order to process payments, you will need to confirm your email address and set a secure payment password. Click the \"confirm\" button below to begin.'\n })\n end", "def completed\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def application_request\n\t\tPony.mail(to: params[:email], from: \"bradwflint@gmail.com\", subject: \"Email application\", body: \"Here is the rental application!\", :attachments => {\"rentalapp.pdf\" => File.read(Rails.root.to_s + \"/public/rentalapp.pdf\")} )\n\t # Pony.mail(to: \"bradwflint@gmail.com\", from: \"bradwflint@gmail.com\", subject: \"Email application\", body: \"Here is the rental application!\", :attachments => {\"rentalapp.pdf\" => File.read(Rails.root.to_s + \"/public/rentalapp.pdf\")} )\n\t\tredirect_to properties_apply_path\n\tend", "def email(cdn, e)\n data = JSON.load REDIS[cdn]\n link = \"http://logserver.flocasts.com/#{cdn.to_sym.object_id}\"\n\n tox = data['server_admins']\n from = 'flocast.bordercollie@gmail.com'\n subj = '[ERROR] ' + cdn\n text = [link, \"\\n\", e.message, e.class, e.backtrace].join \"\\n\"\n\n Gmail.new from, 'flocastayo' do |gmail|\n gmail.deliver do\n to tox\n subject subj\n text_part { body text }\n end\n end\nend", "def home_added\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def send_update_email(artifact)\n @artifact = artifact\n list = []\n @artifact.project.users.each do |apu|\n list << apu.email\n end\n mail( :to => list,\n :subject => 'There is an update in your user area.' )\n end", "def test_scheduled_email(recipient)\n @fullname = recipient.fullname\n @email = recipient.email\n @password = recipient.password\n @company_name = \"A&S Designs\"\n @support_email = \"support@codingsherpa.com\"\n @url = \"http://zdesign.codingsherpa.com\"\n \n logger.info \"AppLog: test_Scheudled_email \" + recipient.fullname\n \n mail(:to => recipient.email,\n :subject => \"Scheduled email from \" + @company_name + \"!\")\n end", "def error_occured(error)\n @error = error\n\n mail to: \"jamesreading473@gmail.com\", subject: 'Error occured in depot app'\n end", "def tick \n mailer.messages.each do |request| \n response = mailer.new_message(:to => request.from, \n :from => settings.service.default_sender)\n \n begin\n apps.each do |app|\n app.call(:request => request, \n :response => response, \n :settings => settings,\n :logger => logger)\n end\n rescue StandardError => e\n logger.info(\"FAIL\") { e.to_s }\n logger.debug(\"FAIL\") { \"#{e.inspect}\\n\"+e.backtrace.join(\"\\n \") }\n\n if settings.service.raise_exceptions\n raise\n else\n next\n end\n end\n\n response.deliver\n end\n rescue Exception => e\n logger.fatal(\"Caught exception: #{e}\\n\\n#{e.backtrace.join(\"\\n\")}\")\n raise\n end", "def email_user\n Mailer.deliver_nesstar_catalogs_processed(datasets, user_id, base_host) if EMAIL_ENABLED && User.find(user_id).person.send_notifications?\n end", "def welcome_email\n # NewsletterMailer.welcome_email.deliver\n mail(:to => \"rajakuraemas@gmail.com\", :subject => \"Welcome to My Awesome Site\")\n end", "def send_confirmation_email\n\t\tRentersConfirmationJob.perform_later self\n OwnersConfirmationJob.perform_later self\n\tend", "def notify_devs\n ApplicationMailer.notify(\n data: @failed_logs,\n body: {manager_id: @manager_id},\n subject: 'Exception in PostTestEconomySetupJob'\n ).deliver if @failed_logs.present?\n end", "def activation_success_email user, application_id\n @user = User.find user\n @application = @user.used_applications.find application_id\n @url = application_url(@application)\n mail(:to => @user.email,\n :subject => \"You have been added to #{@application.application_name}\")\n end", "def send_signup_email\n mail( :to => 'davidbliu@gmail.com',\n :subject => 'Thanks for signing up for our amazing app' ).deliver\n end", "def activation\n @greeting = \"Hi\"\n\n mail :to => \"john@synapticmishap.co.uk\"\n end", "def approve\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\"\n end", "def reset_email(user)\n @user = user\n @greeting = 'hello' \n #@url = 'http://localhost:3000/reset/<%= @user.code %>'\n mail to: @user.email, subject: \"Change your RAILS credentials\"\n end" ]
[ "0.69222033", "0.69193697", "0.6883864", "0.67806935", "0.6772746", "0.67186886", "0.6695353", "0.6639254", "0.66225237", "0.6608702", "0.65947366", "0.65700966", "0.6558848", "0.6553054", "0.65474105", "0.6541321", "0.6539925", "0.6535232", "0.65346843", "0.6533135", "0.6517065", "0.6494598", "0.64904976", "0.64893883", "0.6464718", "0.6459255", "0.6459125", "0.6458665", "0.6458061", "0.64484096", "0.64297503", "0.6427234", "0.64271533", "0.64256406", "0.642382", "0.64174515", "0.64148647", "0.64063776", "0.64063114", "0.63879323", "0.63587517", "0.63522905", "0.6351573", "0.6346551", "0.6344297", "0.6344219", "0.63424605", "0.6340292", "0.6335828", "0.633522", "0.63243383", "0.63214934", "0.63188124", "0.6309743", "0.6307776", "0.6304591", "0.62957543", "0.6288528", "0.6283574", "0.6268807", "0.6268573", "0.6267828", "0.6264319", "0.6239149", "0.6238432", "0.62367684", "0.62355393", "0.6233424", "0.6232729", "0.6230147", "0.62299097", "0.622622", "0.62181425", "0.6214894", "0.6214575", "0.620977", "0.62060475", "0.61970836", "0.6193396", "0.61899793", "0.618981", "0.6186327", "0.617937", "0.6175302", "0.61737585", "0.6172047", "0.616971", "0.61609936", "0.6158123", "0.6155843", "0.6155119", "0.61544895", "0.6154465", "0.6150886", "0.6150547", "0.6148293", "0.6146891", "0.6146778", "0.6141825", "0.6133824" ]
0.815746
0
Reccomendation Engine call this method to get reccomened events for a user
def reccomend_me event_list = score_events.keys event_list.first 5 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def get_events\n # events created by this user\n @my_events = User.find(current_user.id).event_attendants.where('owner = 1')\n\n # events this user has joined\n @joined_events = User.find(current_user.id).event_attendants.where('attendee_status = 3 and owner IS NULL')\n \n # events this user is invited to\n @invited_to_events = User.find(current_user.id).event_attendants.where('attendee_status = 0')\n\n @maybe_events = User.find(current_user.id).event_attendants.where('attendee_status = 2')\n end", "def events(user)\n get(:standard, {:method => \"user.getEvents\", :user => user})\n end", "def received_events(user, options={})\n get(\"/users/#{user}/received_events\", options, 3)\n end", "def user_events(user, options={})\n get(\"/users/#{user}/events\", options, 3)\n end", "def user_events(user_id=self.username, options={})\n response = connection.get do |req|\n req.url \"/users/#{user_id}/events\", options\n end\n response.body.activity\n end", "def events_for_user (user_id)\n events_users.includes(:event).where(\"events_users.user_id=?\",user_id)\n end", "def received_events(user, options = {})\n paginate \"#{User.path user}/received_events\", options\n end", "def recommended_events(options={})\n get(:session, {:method => \"user.getRecommendedEvents\"}.merge(options))\n end", "def events_for_authenticated_user page\n events = api_client.received_events(authenticated_user, page: page)\n filter_events events\n end", "def get_events\n if @user.uuid.present?\n @events = @user.events.active_events.page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n elsif @user.uuid == \"guest\"\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: @user.tenant_id)\n render json: @events\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def index\n @created_events = current_user.created_events\n @invited_events = current_user.invited_events\n @attending_events = current_user.attending_events\n end", "def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend", "def get_all_attended_events\n events_id = Attendance.where(:user_id => self).map{ |attendence| attendence.event.id}\n Event.where(:id => events_id).where_first_meeting_starts_in_past\n end", "def my_events\n @events = []\n Event.all.each do |event|\n if (event.creator == current_user.id)\n @events << event\n end\n end\n end", "def user_events\n @user_events ||= users.map { |u| u.events }.flatten\n end", "def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def reminders\n @events = @user.events.where('finish_date >= ?', Time.now).paginate(:page => params[:page])\n #@events = @even.find(:all, :conditions=> ['finish_date >= ?', Time.now])\n #@events = @user.events.paginate(:page =>params[:page])\n end", "def events_user_is_attending\n events = Attendance.where(:user_uid => self.uid)\n event_ids = events.pluck(:event_id)\n return Event.where(:id => event_ids)\nend", "def show\n @user = User.find(params[:id])\n @events = Event.all\n\n @my_events = @events.select do |event|\n event.date >= DateTime.now && event.creator_id == @user.id\n end\n\n @my_attending_events = UserEvent.joins(:event).where(\"user_id == :user AND events.date >= :current_event_date\",\n {user: @user.id, current_event_date: DateTime.now})\n\n # All the current events you are involved in\n @all_current_events = @my_events + user_events(@my_attending_events)\n\n @my_past_events = @events.select do |event|\n event.date < DateTime.now && event.creator_id == @user.id\n end\n\n @past_attending_events = UserEvent.joins(:event).where(\"user_id == :user AND events.date < :current_event_date\",\n {user: @user.id, current_event_date: DateTime.now})\n\n @all_past_events = @my_past_events + user_events(@past_attending_events)\n end", "def getEventNotifications(u, e)\n @result = []\n @ns = Notification.all\n @ns.each do |n|\n if u == nil\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i\n @result.push(n)\n end\n else\n if (n.notification_type == 3 || n.notification_type == 4) && n.sender_id == e.to_i && n.user_id == u.to_i\n @result.push(n)\n end\n end\n end\n return @result\n end", "def events_about_users opts = {:limit => 4 }\n # FIXME: TO nooisy for your own items.. neeeds better filtering, for\n # example, removingn events about items conceerning actions I took\n #events = %w(user.follow.user user.update.item.* user.comment.* user.add.item)\n events = %w(user.follow.user user.comment.* )\n current_user.events_where(events).last(opts[:limit])\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 events\n event.user.events.where(:timestamp => beginning...ending)\n end", "def events(count: 150, startId: nil)\n data = get '', resource: 'userEvent', count: count, startId: startId\n data.userEvents\n end", "def receiver\n ep = received_event_parameters\n ep.user if ep\n end", "def fGetSubscribedEventsFrom(email)\n @users.getSubscribedEventsFrom(email)\n end", "def index\n @events = current_user.events\n end", "def index\n @events = current_user.events\n end", "def index\n @user = current_user\n @events = @user.events.all\n end", "def show\n @events_ordered = Event.order('startdate ASC')\n joined_event = []\n event_user = []\n if params[\"from\"]==\"myevents\"\n act = Active.where(user_id: current_user.id)\n act.each do |active|\n joined = @events_ordered.find(active.event_id)\n if joined.user_id != current_user.id\n joined_event << joined\n end\n end\n\n event_user = @events_ordered.where(user_id: current_user.id)\n ev = joined_event + event_user\n @user_events = ev.paginate(page: params[:page], per_page: 5)\n else\n @user_events = @user.events.paginate(page: params[:page], per_page: 5)\n end\n end", "def index\n if params[:u]\n @events = User.find(params[:u]).events\n else\n @events = Event.all\n end\n end", "def index\n @events = current_user.account.events\n end", "def index\n @organizing_future_events = get_user_organizing_future_events\n @attending_future_events = get_user_attending_future_events\n @nearby_events = get_upcoming_nearby_events_within_radius(5)\n end", "def getCurrentEventsForUser\n events_currentUser = current_user.getEventsAttending\n gon.user_id = current_user.id\n\n respond_to do |format|\n format.json {render :json => {:events_currentUser => events_currentUser}}\n end\n end", "def fetch_events\n params = {'calendarId' => CONFIG[:cal_id], \n 'orderBy' => 'startTime',\n #'timeMax' => Time.utc(CONFIG[:year].to_i + 1, 4, 1).iso8601, \n #'timeMin' => Time.utc(CONFIG[:year].to_i, 4, 1).iso8601,\n 'singleEvents' => 'True'}\n \n result = @client.execute(:api_method => @cal.events.list, :parameters => params)\n\n @events_list = []\n result.data.items.each do |item|\n @events_list << item\n end\n end", "def load_events\r\n @events = Event.find(:all, \r\n :conditions => [\"user_id = \"\\\r\n \"#{session[:user_id]} and (begins >= CURRENT_DATE()\"\\\r\n \"or ends >= CURRENT_DATE())\"] ,\r\n :order => 'begins ASC')\r\n end", "def fetch\n @start_time ||= (Time.current - 1.minute).to_i * 1000\n $mw_log.debug \"Catching Events since [#{@start_time}]\"\n\n new_events = @alerts_client.list_events(\"startTime\" => @start_time, \"tags\" => \"miq.event_type|*\", \"thin\" => true)\n @start_time = new_events.max_by(&:ctime).ctime + 1 unless new_events.empty? # add 1 ms to avoid dups with GTE filter\n new_events\n rescue => err\n $mw_log.info \"Error capturing events #{err}\"\n []\n end", "def index\n @events = current_user.super_user ? Event.all : current_user.events\n end", "def received_public_events(user, options = {})\n paginate \"#{User.path user}/received_events/public\", options\n end", "def show\n @created_events = @user.events\n @invited_events = @user.invited_events\n @past_events = @user.attended_events.past_events\n @upcoming_events = @user.attended_events.upcoming_events\n end", "def events\n @events ||= user_events.concat(org_events).uniq\n end", "def show\n @user = User.find(params[:id])\n @events = Event.where(creator_id: @user.id).all\n @past_events = @events.past\n @future_events = @events.upcoming\n @previous_events = @user.attended_events.past\n @upcomming_events = @user.attended_events.upcoming\n end", "def index\n @events = Event.where( \"user_id = ?\", current_user.id )\n end", "def index\n @events = Event.where(user_id: current_user.id)\n end", "def user_events(user, options = {})\n paginate \"#{User.path user}/events\", options\n end", "def currentuser\n\n @events = Event.where(user_id: current_user).order('created_at DESC')\n\tend", "def index\n user = self.current_user && User.find_by_id(self.current_user.id)\n @events = nil\n if user\n @events = user.events \n else\n @events = Event.find(:all)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "def event_reminder_to_chef(evt)\n @evt = evt\n @chef = User.find_by_id(@evt.user_id)\n @guests = @evt.signups.where('confirmation_status in (?)', 'Attending')\n @comments = @evt.messages.where(\"public_flag = ?\", 1).group(\"messagechain_id\", \"order_id\", \"message_content\", \"sender_id\").sort{|a,b| b[:messagechain_id] <=> a[:messagechain_id]}\n if @guests.sum(:guest_count) > 0\n @paid_communal = @guests.where(\"own_group_flag = 0\")\n @own_table = @guests.where(\"own_group_flag = 1\")\n mail(:to => @chef.email, :subject => \"Your upcoming event on Local Yum\", :from => \"\\\"Local Yum\\\" <alert@localyum.me>\")\n end\n end", "def get_events\n # conditions = \"starttime >= '#{Time.at(params['start'].to_i).to_formatted_s(:db)}' AND endtime <= '#{Time.at(params['end'].to_i).to_formatted_s(:db)}'\"\n conditions = \"starttime >= '#{params['start'].to_time}' AND endtime <= '#{(params['end']+\" 23:59:59\").to_time}'\"\n if @profile\n @events = @profile.events.where conditions\n else\n conditions += \" AND profile_type = '#{event_params[:profile_type]}'\"\n @events = Event.where conditions\n end\n\n events = []\n @events.each do |event|\n events << {:id => event.id, :title => event.title, :description => event.description || \"Some cool description here...\", :start => \"#{event.starttime.iso8601}\", :end => \"#{event.endtime.iso8601}\", :allDay => event.all_day, :recurring => (event.event_series_id) ? true : false}\n end\n set_profile\n render :text => events.to_json\n end", "def index\n if current_user && current_user.is_admin? && params_user_id\n @events = User.find(params_user_id).events.where(is_validated:true)\n elsif params_user_id && params_user_id.to_i == current_user.id\n @events = current_user.events.where(is_validated:true)\n elsif params_user_id && params_user_id.to_i != current_user.id \n redirect_to root_path\n else\n @events= Event.where(is_validated:true)\n end\n end", "def get_rg_events(starttime, endtime, channels, rg_name )\n @uri += build_filter += \" and resourceGroupName eq '#{rg_name}'\"\n end", "def upcoming_events(order_by: self.class::START_OLDEST_FIRST,\n status: self.class::ALL)\n EventbriteSDK::ResourceList.new(\n url_base: \"#{path}/events\",\n object_class: EventbriteSDK::Event,\n key: 'events',\n query: {\n order_by: order_by,\n status: status\n }\n )\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 related_events\n find_related_frbr_objects( :is_related_to, :which_events?) \n end", "def get_events\t\t\t\n @task = UserEvent.where(\"user_id\"=>current_user.id)\n events = []\n @task.each do |task|\n events << {:id => task.id, :title => task.title, :start => DateTime.parse(task.start.to_s).strftime(\"%Y-%m-%d\"), :end => DateTime.parse(task.end.to_s).strftime(\"%Y-%m-%d\") }\n end\n render :text => events.to_json \n end", "def user_events(user_events_array)\n \tuser_events_array.map do |user_event|\n \t\tuser_event.event\n \tend\n end", "def audio_events(user)\n user = Access::Validate.user(user, false)\n AudioEvent\n .where('(audio_events.creator_id = ? OR audio_events.updater_id = ?)', user.id, user.id)\n .order('audio_events.updated_at DESC')\n end", "def index\n current_user_id = current_user.nil? ? nil : current_user.id\n @main_events = MainEvent.where(user_id: current_user_id)\n @my_events = Event.any_in(user_ids: [current_user_id]).all if current_user_id\n @registered_events = current_user.registered_main_events.to_a\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @main_events }\n end\n end", "def upcoming_events\n events = []\n if participant?\n participant.upcoming_events.each { |e| events << e }\n else\n events << \"Pregnancy Screener\"\n end\n events\n end", "def events\n data.events\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def index\n @events = Event.last_events(current_user, 3)\n end", "def awaiting_admin_events\n candidate_events.select(&:awaiting_admin?)\n end", "def event\r\n @event\r\n @comments\r\n @replies \r\n end", "def index\n # geting user events\n set_events(@user)\n # geting all events for each patient\n @patients.each { |patient| @events += set_events(patient) }\n @events.sort_by { |start_time| start_time[:start_time]}\n # getting all pending requests\n set_pending_requests(@user)\n end", "def completed_awaiting_events\n candidate.awaiting_admin_events\n end", "def index\n @events = Event.all\n\n # Past Events that you and your friends held\n # 4 events with seed file and user 9\n @past_events = @events.select do |event|\n event.date < DateTime.now\n end\n\n # Current Events that you created\n @my_events = @events.select do |event|\n event.date >= DateTime.now && event.creator_id == current_user.id\n end\n\n # Current Events that you are attending\n @attending_events = UserEvent.joins(:event).where(\"user_id == :current_user AND events.date >= :current_event_date\",\n {current_user: current_user.id, current_event_date: DateTime.now})\n\n # All the current events you are involved in\n # 4 events with seed file and user 9\n @all_attending_events = @my_events + user_events(@attending_events)\n\n # Friend made events show all events not created by you\n @friend_made_events = @events.select do |event|\n event.date >= DateTime.now && event.creator_id != current_user.id\n end\n\n # Events made by your friends, where you are not attending\n # 3 events with seed file and user 9\n @friend_events = @friend_made_events - user_events(@attending_events)\n end", "def join\n @event = Event.find(params[:event_id])\n if (params[:type] == \"invite\")\n @uids = params[:uids]\n @uid_array = []\n @uid_array = @uids.split(\",\")\n\n @motlee_users = []\n @non_motlee_users = []\n\n @uid_array.each do |uid|\n motlee_user = User.where(:uid => uid).first\n\n if motlee_user.nil?\n token = params[:access_token]\n event_id = params[:event_id]\n Resque.enqueue(ProcessNewUserInvite, token, event_id, uid) \n else\n # User is already a part of Motlee\n # Add user to array of Motlee users\n @motlee_users << uid\n \n # Now we check to see if the user has already been added to the event\n @attendee = Attendee.where(\"user_id = ? AND event_id = ?\", motlee_user.id, params[:event_id]).first\n if @attendee.nil?\n # If user has not been added, create new Attendee object\n @attendee = Attendee.create(:user_id => motlee_user.id, :event_id => params[:event_id], :rsvp_status => 1)\n if (motlee_user.id != current_user.id)\n Resque.enqueue(AddEventNotification, motlee_user.id, params[:event_id], current_user.id)\n end\n end\n end\n end \n else\n @attendee = Attendee.create(:user_id => current_user.id, :event_id => @event.id, :rsvp_status => 1)\n end\n # Render a response so the devices are happy\n @event.update_attributes(:updated_at => Time.now)\n render :json => @event.as_json({:methods => [:owner, :attendee_count], \n :include => {:photos => {:include => {:comments => {}, :likes => {}}}, \n :people_attending => {:only => [:id, :uid, :name, :sign_in_count]}}})\n end", "def recommendations\n @user.community.events.upcoming.where(:owner_type => \"Feed\").map do |e|\n EventRecommendation.new(e)\n end\n end", "def events\n collection(\"events\")\n end", "def reporte entrena, inicio, final\n entrenador = User.find(entrena)\n equipos = entrenador.equipos\n\n @events = []\n equipos.each do |equipo|\n\n equipo.eventos.each do |event|\n\n if (event.fecha >= inicio) && (event.fecha <= final)\n @events << event\n end\n\n end\n end\n return @events\n end", "def index\n if token_and_options(request)\n access_key = AccessKey.find_by_access_token(token_and_options(request))\n @user = User.find_by_id(access_key.user_id) \n p \"@user: \" + @user.to_yaml\n \n \n @events = []\n @past_events = []\n user_events = @user.events.includes([:movies, :users])\n \n user_events.each do |event| \n if event.event_date >= Date.today\n @events << event \n \n event_users = []\n all_confirmed = true\n all_voted = true\n votes_count = 0\n votes_user_count = 0\n all_declined = true\n accepted_count = 0\n \n friends_map ={} \n event.users.each do |friend_user| \n friends_map[friend_user.id] = []\n event_user = nil\n \n if event.rating_phase == \"wait_users\"\n event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id).limit(1).first \n p \"EVENT USER:_ \" +friend_user.id.to_s + \" ACCEPTED:\" +event_user.accept.to_yaml + \"\\n\"\n if friend_user.id == @user.id && event_user.waiting?\n p \"ME - NOT ACCEPT!\"\n all_confirmed = false\n event.event_status = \"confirm\"\n all_declined = false \n elsif friend_user.id == @user.id && event_user.declined? \n event.event_status = \"declined\" \n elsif event_user.waiting?\n all_declined = false\n all_confirmed = false\n elsif friend_user.id != @user.id && event_user.accepted?\n accepted_count = accepted_count + 1\n all_declined = false\n elsif event_user.accepted?\n accepted_count = accepted_count + 1\n end\n else\n all_declined = false \n end\n \n if event.rating_phase == \"starting\"\n if event_user.nil?\n event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id).limit(1).first \n end \n if event.one_to_five?\n if event_user.accepted? && event_user.num_votes != event.num_votes_per_user\n if friend_user.id == @user.id \n event.event_status = \"vote\" \n end \n all_voted = false \n accepted_count = accepted_count + 1\n elsif event_user.accepted? && event_user.num_votes == event.num_votes_per_user \n votes_user_count = votes_user_count + 1\n votes_count = votes_count + event_user.num_votes \n accepted_count = accepted_count + 1\n end\n elsif event.one_to_ten?\n if event_user.accepted? \n accepted_count = accepted_count + 1\n event_user_votes = EventUserVote.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id)\n if !event_user_votes.nil?\n score = 0\n event_user_votes.each do |vote|\n score = score + vote.score\n end\n if score < 2\n if friend_user.id == @user.id \n event.event_status = \"vote\" \n end \n all_voted = false\n else\n votes_user_count = votes_user_count + 1\n end\n else \n if friend_user.id == @user.id \n event.event_status = \"vote\" \n end \n all_voted = false\n end \n end \n end\n end\n \n if friend_user.id != @user.id \n auth = Authorization.find_by_user_id_and_provider(friend_user.id, \"facebook\")\n if event_user.nil?\n event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id).limit(1).first \n end \n \n friend = Friend.where(\"user_id = ? AND friend_id = ?\", friend_user.id, @user.id).limit(1).first \n if friend.nil?\n friend_json = {id: friend_user.id, :name => friend_user.name, :username => friend_user.username, :fb_uid => auth.uid, :event_accepted => event_user.accept, :confirmed => false, :request => false} \n \n puts \"NOT FRIEND: \" + friend_user.name + \" accept? \" + event_user.accept.to_s\n else\n if friend.friend_confirm == true\n puts \"IS FRIEND: \" + friend_user.name + \" accept? \" + event_user.accept.to_s\n friend_json = {id: friend_user.id, :name => friend_user.name, :username => friend_user.username, :fb_uid => auth.uid, :event_accepted => event_user.accept, :confirmed => true, :request => false} \n else\n puts \"IS REQUEST \" + friend_user.name + \" accept? \" + event_user.accept.to_s\n friend_json = {id: friend_user.id, :name => friend_user.name, :username => friend_user.username, :fb_uid => auth.uid, :event_accepted => event_user.accept, :confirmed => false, :request => true} \n end\n end\n event_users << friend_json \n end\n end\n event.friends = event_users\n \n puts \"PHASE: \"+ event.id.to_s+ \", \"+ event.rating_phase.to_s + \" event.finished:\" + event.finished.to_s + \"system_ \" + event.rating_system.to_s\n if event.starting? && event.voting? \n voting_percent = (votes_user_count * 100) / accepted_count\n print \"PERCENT: \" + voting_percent.to_s\n if event.one_to_five?\n votes_percent = votes_count * 100 / (accepted_count * event.num_votes_per_user) \n print \"VOTES PERCENT: \" + votes_percent.to_s\n end\n end \n \n seconds_diff = (event.created_at - DateTime.now).to_i.abs\n minutes_diff = seconds_diff / 60\n puts \"ITME LIMT : \" + event.time_limit.to_s + \" m diff: \" + minutes_diff.to_s\n \n if event.finished == true\n event_movie = EventMovie.where(\"event_id = ? AND winner = true\", event.id).limit(1).first\n movie = EventMovie.where(\"event_id = ? AND winner = true\", event.id).limit(1).first \n event.event_status = \"winner\" \n p \"WINNER: \" + movie.to_yaml + \"\\n\" \n event.winner_movie = event_movie.movie_id\n elsif all_declined == true \n event.event_status = \"failed\" \n elsif all_confirmed == false && event.event_status != \"confirm\" && event.event_status != \"declined\"\n p \"WAITING\" \n \n if minutes_diff > event.time_limit\n if event.user_id == @user.id \n puts \" TIME LIMIT AFTER \" \n event.event_status = \"start_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n else \n event.event_status = \"waiting_others\"\n end\n \n elsif event.voting? && event.starting? && event.event_status != \"vote\" && all_voted == false && event.minimum_voting_percent < 100 &&\n event.minimum_voting_percent <= voting_percent && ((event.one_to_five? && event.minimum_voting_percent <= votes_percent) || event.one_to_ten?)\n puts \" VOTING MINUM<100: \" + voting_percent.to_s\n \n if minutes_diff > event.time_limit\n puts \" NEXT ROUND ANYWAYS! \" \n \n votingFinished(event, friends_map, @user, true)\n event.time_limit = event.time_limit + 30\n event.save\n else \n event.event_status = \"waiting_others\"\n end \n elsif event.voting? && event.starting? && all_voted == false && event.event_status != \"vote\"\n if minutes_diff > event.time_limit\n if event.user_id == @user.id \n event.event_status = \"continue_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n else\n p \"WAITING\"\n event.event_status = \"waiting_others\"\n end \n end\n \n if event.finished == false && event.rating_phase == \"knockout_match\"\n knockouts = EventKnockout.where(\"event_id = ? AND round = ? AND finished = false\", event.id, event.knockout_phase).order('id ASC')\n print \"knockouts: \" + knockouts.to_yaml \n @knockout_match = []\n knockouts.each do |event_knockout|\n knockout_user = KnockoutUser.where(\"event_knockout_id = ? AND user_id = ? \", event_knockout.id, @user.id).limit(1).first\n if knockout_user.nil? \n knockout_json = {id: event_knockout.id, :movie_id_1 => event_knockout.movie_id_1, :movie_id_2 => event_knockout.movie_id_2, :round => knockouts.count} \n event.knockout_matches = knockout_json\n event.event_status = \"knockout_choose\" \n break\n end \n end \n \n if event.knockout_matches.nil?\n if minutes_diff > event.time_limit\n if event.minimum_voting_percent < 100 && !knockouts.empty?\n current_knockout = knockouts.first\n knockout_users_count = KnockoutUser.where(\"event_knockout_id = ? \", current_knockout.id).count\n event_user_count = EventUser.where(\"event_id = ? AND accept = true\", event.id).count \n voting_percent = (knockout_users_count * 100) / event_user_count\n if event.minimum_voting_percent <= voting_percent\n continueKnockout(event, friends_map, @user, true)\n event.time_limit = event.time_limit + 15\n event.save\n else\n if event.user_id == @user.id \n event.event_status = \"continue_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n end\n else \n if event.user_id == @user.id \n event.event_status = \"continue_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n end\n else\n event.event_status = \"waiting_others\" \n end\n end \n end \n \n my_event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, @user.id).limit(1).first \n if my_event_user.declined? \n event.event_status = \"declined\" \n end \n\n puts \" EVENT \" + event.id.to_s + \" status: \" + event.event_status.to_s \n else\n @past_events << event \n end\n end \n \n respond_with build_events_json(@events) \n else\n render :events => { :info => \"Error\" }, :status => 403\n end \n end", "def events\n @events ||= {\n upcoming: format(current_user.upcoming_events),\n invitations: format(current_user.invitations)\n }\n end", "def events\n data[\"events\"]\n end", "def get_events(trace: false, &block)\n r = dropbox_query(query: '2/team_log/get_events', trace: trace)\n r['events'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team_log/get_events/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['events'].each(&block)\n end\n end", "def index\n @user_events = UserEvent.all\n end", "def index\n @user_events = UserEvent.all\n end", "def index\n @user_events = UserEvent.all\n end", "def index\n if params[:user_id]\n @events = User.find(params[:user_id]).events\n else\n @events = Event.all\n end\n @events = @events.order(start_time: :desc)\n .where(\"start_time > ?\", DateTime.now)\n .limit(params[:count])\n .includes(:non_profit)\n .reverse\n end", "def read_event\n self.class.select(\"READ_EVENT(#{self.id})\").all\n end", "def getEventL(e)\n @cuid = isSignedIn ? current_user.id : nil\n @e = Event.find_by(id: e)\n @b1 = isadmin\n @b2 = @b1 || (@cuid == @e.user_id)\n \n @html = eventEnded(e) ? '<p class=\"summary\">This event has ended.<br>Average Rating: ' + getAvgStarRating(e) + '</p>' : \"\"\n @html += '<h2>' + @e.name + '</h2>' +\n '<div class=\"event-l\">' +\n '<div class=\"col-xs-12 col-md-4\">' +\n '<p class=\"image\">'\n @html += @e.avatar.attached? ? '<image src=\"' + url_for(@e.avatar).to_s + '\">' : image_tag(\"eph.png\")\n @html += '</p>' +\n '</div>' +\n '<div class=\"col-xs-12 col-md-4\">' +\n '<p class=\"name\">' + @e.description + '</p>' +\n '<p>' + @e.date.to_s + ' ' + @e.time.strftime(\"%I:%M %p\").to_s + '</p>' +\n '<p>' + @e.address.to_s + '</p>' +\n ((coordsSet(@cuid, \"u\") && coordsSet(e, \"e\")) ? '<p>Distance: ' + userDist(@cuid, e).to_s + ' km</p>'.html_safe : \"\") +\n (isadmin ? '<p>{' + @e.lat.to_s + \", \" + @e.lng.to_s + '}</p>' : \"\") +\n '<p>Public: ' + (!@e.private ? \"Yes\" : \"No\") + '</p>' +\n '<p>Organised By: ' + (link_to getName(@cuid, @e.user_id), '/users/' + @e.user_id.to_s) + '</p>' +\n '<p>'\n if @b1 || (@b2 && !eventEnded(e)) #show event buttons\n @html += '<a class=\"btn btn-warning\" href=\"' + edit_event_path(@e) + '\">Edit</a>' +\n (link_to 'Delete', @e, method: :delete, :role=>\"button\", :class => \"btn btn-danger\", data: { confirm: 'Are you sure?' })\n end\n @html += '<a class=\"btn btn-info\" href=\"javascript: history.go(-1)\">Back</a>' +\n '</p>' +\n '</div>' +\n '<div class=\"col-xs-12 col-md-4\">' +\n '<div id=\"map-container\">' +\n '<div id=\"map\"></div>' +\n '</div>' +\n (javascript_pack_tag 'mapPoint') +\n '</div>' +\n '<div class=\"clear\"></div>' +\n '</div>'\n return @html.html_safe\n end", "def my_asists\n @events = []\n Attend.all.each do |attend|\n if (attend.userID == current_user.id)\n @events << Event.find(attend.eventID)\n end\n end\n end", "def index\n @event = Event.where(\"user_id = ?\", current_user.id)\n end", "def fetch_events(calendar_id)\n response = service.list_events(calendar_id,\n max_results: 5,\n single_events: true,\n order_by: \"startTime\",\n time_min: Time.now.iso8601,\n time_max: Date.today.+(1).to_time.iso8601)\n\n # filter out any declined events – they normally represent a clash or room release\n response.items.reject { |event|\n next if event.attendees.nil?\n event.attendees.all? { |attendee| attendee.response_status == \"declined\" }\n }\n end", "def load_completed_events\r\n @completed_events = Event.find(:all, \r\n :conditions => [\"user_id = \"\\\r\n \"#{session[:user_id]} and ends < CURRENT_DATE()\"] ,\r\n :order => 'begins ASC')\r\n end", "def load_private_events\r\n email = User.find(session[:user_id]).email\r\n @events = PrivateEvent.find_by_sql(\"select * from private_events as pe where pe.id in (select distinct pe.id from private_events as pe left join private_invites as pi on pe.id = pi.private_event_id where ((pi.email = '#{email}') or (pe.user_id = '#{session[:user_id]}')) and ((begins >= CURRENT_DATE() or ends >= CURRENT_DATE())))\") \r\n \r\n end", "def poll\n rate_limiting do\n body = @client.get('/events',\n params: params,\n options: @options).body\n @sync = body['sync']\n @events += body.fetch('data', []).map do |event_data|\n Event.new(event_data, client: @client)\n end\n end\n end", "def show\r\n #1st you retrieve the user thanks to params[:user_id]\r\n user = User.find(params[:user_id])\r\n #2nd you retrieve the event thanks to params[:id]\r\n @event = user.events.find(params[:id])\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @event }\r\n end\r\n end", "def events\n @even = @user.created_events.order('created_at DESC')\n @events = @even.paginate(:page => params[:page])\n end", "def index\n Chronic.time_class = Time.zone\n @start_time = Chronic.parse(params[:date1])\n @end_time = Chronic.parse(params[:date2])\n if @start_time.present? && @end_time.present?\n @events = Event.occurring_between(@start_time, @end_time).order(created_at: :desc).distinct\n elsif @start_time.present?\n @events = Event.happened_after(@start_time).order(created_at: :desc).distinct\n elsif @end_time.present?\n @events = Event.happened_before(@end_time).order(created_at: :desc).distinct\n else\n @events = Event.all.order(created_at: :desc)\n # @events = @signed_in.events.unread\n end\n \n \n # @q = Event.includes(:eventable).ransack(params[:q]) \n # if params[:q].present?\n # @events = @q.result(distinct: true).paginate(page: params[:page], per_page: 5)\n # else\n # @events = Event.none\n # end\n if company_admin_signed_in?\n render 'company/events/index'\n end\n \n \n skip_authorization\n end", "def show\n @user = User.new\n @response = HTTParty.get(\"https://www.eventbriteapi.com/v3/events/#{@event.event_id}/attendees/?token=R3MLTYFWNHNDB53GOBCP\")\n @response1 = HTTParty.get(\"https://www.eventbriteapi.com/v3/events/#{@event.event_id}/?token=R3MLTYFWNHNDB53GOBCP\")\n @peeps = @response['attendees']\n @event_name = @response1['name']['text']\n end", "def past_events(user, options={})\n get(:standard, {:method => \"user.getPastEvents\", :user => user}.merge(options))\n end", "def index\n @events_to_me = Event.joins('LEFT OUTER JOIN events_users ON events_users.event_id = events.id').where(\"events_users.user_id=?\", current_user.id)\n @events_from_me = Event.where(creator: current_user)\n\n @events = @events_to_me + @events_from_me\n end", "def all_events(start, finish, include_assignments = false, child = nil) # last param used in student & teacher\r\n tracks = school.current_term.tracks\r\n (universal_events(start, finish, tracks) + \r\n Event.where([\"invitable_type = 'Staff' AND invitable_id = ? AND date BETWEEN ? AND ?\", school_id, start, finish]) + \r\n Event.where([\"invitable_type = 'Teachers' AND creator_id = ? AND date BETWEEN ? AND ?\", id, start, finish])).sort_by{|event|event.date} \r\n #(audience_type == Group && groups.map(&:id).include?(audience_id)\r\n end", "def index\n @integrations = current_user.integrations\n @events = Event.by_user_limit current_user\n end", "def owned_events\n events\n end", "def events\n end", "def events\n # FIXME this logic belongs in the Event model. stop leaking AR outside of the model\n @events ||= Event.includes(:upcoming_observances).where(\"observances.start_on >= ?\", Date.current).references(:observances)\n end", "def index\n @events = []\n Event.all.each do |event|\n if (event.creator != current_user.id)\n @events << event\n end\n end\n end" ]
[ "0.74442786", "0.7333088", "0.7140724", "0.7032516", "0.6814834", "0.66587687", "0.6624568", "0.66055655", "0.6588455", "0.65193635", "0.6412673", "0.6395039", "0.6389037", "0.6338103", "0.6305406", "0.62867707", "0.62426466", "0.6239953", "0.622422", "0.62102956", "0.6206227", "0.6175606", "0.613997", "0.61187613", "0.61182463", "0.6079195", "0.607716", "0.60639507", "0.6062209", "0.6062209", "0.6049302", "0.6020625", "0.6005966", "0.5991224", "0.5987355", "0.59849614", "0.59618205", "0.59608144", "0.59375304", "0.59372777", "0.5934778", "0.5924797", "0.5922793", "0.5920837", "0.59188473", "0.5912936", "0.58969265", "0.58953637", "0.5890754", "0.5887203", "0.5881317", "0.58801824", "0.58614266", "0.58492184", "0.58487654", "0.5836213", "0.58305657", "0.5828465", "0.5819801", "0.58176494", "0.5808017", "0.57981646", "0.5779952", "0.57775384", "0.577491", "0.57721823", "0.5768241", "0.57661057", "0.5760296", "0.57533675", "0.575303", "0.572435", "0.5721831", "0.57045543", "0.57040787", "0.5701033", "0.5697425", "0.56940866", "0.56940866", "0.56940866", "0.5693079", "0.5672865", "0.5665619", "0.5664997", "0.56625915", "0.5661303", "0.5653448", "0.5652897", "0.5649653", "0.56468195", "0.56421316", "0.5626797", "0.5626244", "0.5625941", "0.5614619", "0.56017655", "0.56011957", "0.5584035", "0.5583077", "0.5576051", "0.5575385" ]
0.0
-1
These methods check a users favourites against events
def score_assign(hash_item, event_attribute) score = 0 if hash_item[0] == event_attribute score = 3 elsif hash_item[1] == event_attribute score = 2 elsif hash_item[2] == event_attribute score = 1 else score = 0 end return score end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def favorited? subject\n has_event? 'favorite', subject\n end", "def favorite_check user, img\n user.favorites.each do |fav|\n if fav.image_id == img.id\n return true\n end\n end\n\n return false\n end", "def favorite_check\n @check = @fav_list.include?(@selected_activity.last)\n \n end", "def has_fav?(game_id)\n\t FavouriteGame.where(:user_id => self.id, :game_id => game_id).empty?\n end", "def user_favourites(current_user, product)\n Favourite.where(user_id: current_user, product_id: product) > 0\n end", "def favored?(user_id)\n return self.favorites.exists?(user_id: user_id)\n end", "def favourite_for(user)\n favourites.find_by_user_id user\n end", "def favorited_by?(user)\n favorites.where(user_id: user.id).exists?\n end", "def favorited?(user, coffeeshop)\n coffeeshop.users.each do |coffeeshop_user|\n return true if coffeeshop_user == user\n end\n return false\n end", "def is_fav?(user)\n user.favs.find_by(post_id: self.id)\n end", "def favourites\n\t\t\t\t@user = User.find_by(:facebook_id => params[:id_facebook])\n\t\t\t\t@favourites = Favourite.where(\"user_id = #{@user.id}\")\n\t\t\tend", "def user_has_favorite(image_id)\n if self.favorites.find_by(image_id: image_id)\n return true \n else \n return false\n end\n end", "def already_favourite?(user_id, place_id)\n not where(:user_id => user_id, :place_id => place_id).empty?\n end", "def is_favorite_of user\n\t fave = get_favorite_for user\n\t fave ? true : false\n\tend", "def has_favorite?(vanue_or_venue_id)\n v_id = (vanue_or_venue_id.kind_of?(Venue)) ? vanue_or_venue_id.id : vanue_or_venue_id\n self.favorites.select {|f| f.favorite_id == v_id }.size > 0\n end", "def favourited_items\n self.favourites.each do |f|\n f.favouritable\n end\n end", "def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end", "def user_favorite_moves\n FavoriteMove.all.select do |fav|\n fav.user == self \n end \n end", "def favorite_for(user)\n favs.find_by(user_id: user)\n end", "def favorited?(test_image)\n favorites.where(image_id: test_image.id).any?\n end", "def favorited_by?(user)\n Favorite.where('object_id = ? AND object_type = ? AND user_id = ?', self.id, self.class.to_s, user.id).count > 0\n end", "def users_favorite?(user)\n votes.any? { |v| v.user_id == user.id && v.favorite }\n end", "def has_faved?(favable)\n if favable.is_a?(Journal)\n return favorites.journals.pluck(:favable_id).include?(favable.id)\n elsif favable.is_a?(Submission)\n return favorites.submissions.pluck(:favable_id).include?(favable.id)\n elsif favable.is_a?(Stream)\n return favorites.streams.pluck(:favable_id).include?(favable.id)\n end\n end", "def favoring?(article)\n favorites.include?(article)\n end", "def favorite?\n\t is_favorite_of User.current_user\n\tend", "def list_favourites(user_id)\n @favourites_store.where(user_id)\n end", "def favorited_tweet?(tweet)\n favorite_tweets.include? tweet\n end", "def show\n @favorite_exists = Favorite.where(post: @post, user: current_user) == [] ? false : true\n\n end", "def has_favourited_post?(post_id)\n Favourite.where(:post_id => post_id, :user_id => self.id).any?\n end", "def favorited?(wallpaper)\n self.favorites.find_by_wallpaper_id(wallpaper.id)\n end", "def test_new_favourite_and_remove_favourite\n \n user = User.getByUsername(\"Adam\")\n bookmark = Bookmark.getAll[0]\n \n result = Favourite.newFavourite(bookmark.bookmarkId, user.userId)\n \n assert_equal true, result\n \n favourites = Favourite.getByUserId(user.userId)\n \n favourite = favourites[0]\n \n assert_equal \"amazon\", favourite.title\n assert_equal bookmark.bookmarkId, favourite.bookmarkId\n \n resultTwo = Favourite.removeFavourite(bookmark.bookmarkId, user.userId)\n \n assert_equal true, resultTwo\n \n end", "def has_favorited(link_id)\n return self.favorites.include? link_id\n end", "def check_favorite username, password, slideshow_id\n do_request 'check_favorite', username: username, password: password, slideshow_id: slideshow_id\n end", "def favorite\n\t\t@venues = []\n\n\t\tuser = User.find(current_user.id)\n\t\tuser_fav = user.favorite_venue_ids\n\t\t\tuser_fav.each do |venue_id|\n\t\t\t\tvenue = Venue.find(venue_id)\n\t\t\t\t@venues << venue\n\t\t\tend\n\n\tend", "def is_favorite? (user_id)\n\t\tself.favorite_opportunities.find_by user_id: user_id\n\tend", "def favourites\n\t\tfavourites = Partay.get('http://shoponline.tescolotus.com/api/v1/favorites/by-category?page=1&sortby=Relevance&issecure=False', :headers => {'Content-Type' => 'application/json','language' => 'en-GB', 'region' => 'TH', 'userId' => access_token, 'Host' => 'r.tesco.com.my'})\n\t\tfavourites_counter = JSON(favourites)\n\t\tself.favourite_count(JSON(favourites_counter)[\"pageInformation\"][\"totalCount\"])\n\t\tif fav_count >= 1\n\t\t\tputs \"Your favourites count is:#{fav_count}\"\n\t\telse\n\t\t\traise \"There are no products in your favourites list.\"\n\t\tend\n\tend", "def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end", "def if_guest_fav_song_played(room)\n room_song_title_list =room.title_of_songs()\n guest_fav_song_list = room.guests_fav_song_list()\n for song in guest_fav_song_list\n room_song_title_list.find{|room_song| room_song =\"song\"}\n return \"whoo!\"\n end\n end", "def favoriter?\n true\n end", "def my_favorites\n\tend", "def favorite?(movie)\n favorite = favorites.find_by(movie_id: movie.id)\n if favorite.nil?\n return false\n else\n return true\n end\n #favorites.include?(movie)\n end", "def is_favorite?\n\t favorite?\n\tend", "def favorites(action=nil)\n my.favorites(action)\n end", "def favourite_action (thing, current_user)\n if thing.favourited_by_user?(current_user.id)\n unless (f = thing.favourite_by_user(current_user)).nil?\n (link_to image_tag(icon_filename_for(:favourite)) + content_tag(\n :span, \" Unfavourite\"),\n favourite_path(f),\n :method => :delete,\n :style => \"text-decoration:none\")\n\n end\n else\n link_to image_tag(icon_filename_for(:favourite)) + content_tag(\n :span, \" Favourite\"),\n favourites_url(:favouritable_type => thing.class.name, :favouritable_id => thing.id),\n :method => :post,\n :style => \"text-decoration:none\"\n end\n end", "def ensure_not_referenced_by_any_favourite\n if favourites.empty?\n return true\n else\n errors.add(:base, 'Favourites present')\n return false\n end\n end", "def show\n @userID = (current_user.blank?) ? 0 : current_user.id\n @isUserFavourite = Favourite.where(user_id: @userID, movie_id: @movie.id).count > 0 ? true : false\n end", "def showFavorites\n if current_user\n @favorites = Favorite.where(user_id: current_user.id)\n else\n redirect_to '/'\n end\n end", "def all_favorited options = {}\n return all_favorites(options).collect{ |f| f.favoritable }\n end", "def is_favoritable?\n true\n end", "def has_favourite_recipe?(user_id, yummly_id)\n return self.user_favourite_recipes.has_user_favourites_for_recipe?(user_id, yummly_id)\n end", "def favorite?\n @favorite\n end", "def favorited\r\n Favorite.find(:all, :conditions => {:favorable_type => self.class.to_s, :favorable_id => self.id})\r\n end", "def get_user_favorites(id, &block)\n\n end", "def get_favorite_for user\n\t user.favorites.find_by_page_id(self)\n end", "def has_favourite_shop?(shop_id)\n return self.user_favourite_shops.find_by(shop_id: shop_id)\n end", "def is_watching\n faved_favorites = favorites.streams\n profile_ids = faved_favorites.collect { |favorite| favorite.favable.profile_id }.uniq\n watches = []\n profile_ids.each do |profile_id|\n fave = faved_favorites.find { |favorite| profile_id == favorite.favable.profile_id }\n watches << Watch.new(profile: fave.profile, created_at: fave.created_at, watched_profile: fave.favable.profile)\n end\n return watches\n end", "def has_favorite( favorite_obj )\n favorite = get_favorite( favorite_obj )\n if favorite.nil?\n favorite = Favorite.create( :user_id => self.id,\n :favorable_type => favorite_obj.class.to_s, \n :favorable_id => favorite_obj.id )\n end\n favorite\n end", "def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def has_favorite?( favorite_obj )\n favorite = get_favorite( favorite_obj )\n favorite ? self.favorites.exists?( favorite.id ) : false\n end", "def favorites\n if params[:id]\n if params[:id].to_i.to_s == params[:id]\n\t@user = User.find(params[:id])\n else\n\t@user = User.find(:first, :conditions => [\"username=?\", params[:id]])\n end\n else\n @user = @current_user\n end\n\n @beu = @user.following_by_type('Beu')\n end", "def get_favs(favsArr)\n favEventArr = Event.order(:date).where(id: favsArr)\n return favEventArr if favEventArr.length > 0\n return []\n end", "def favorite?\n @favorite\n end", "def favorite?\n @favorite\n end", "def favourite\n if session[:user_id] == nil\n render json: {code: 401}\n else\n url_id = params[:id]\n url = Url.find_by(id: url_id)\n current_user = User.find_by(id: session[:user_id])\n if current_user.urls.exists?(url_id)\n current_user.urls.delete(url)\n favourite = false\n else\n current_user.urls << url\n favourite = true\n end\n users = url.users\n render json: {code: 200, favourite: favourite, users: users}\n end\n end", "def favorites\n files = []\n session[:user].favorite_files.each do |file|\n files.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: files, success: true }\n end", "def index\n if user_signed_in?\n @favorites = current_user.favorites\n\n end\n end", "def favorite_tweets\n logger.debug { \"#{__method__} is called twitter_user_id=#{id}\" }\n tweets = []\n tweets = InMemory::FavoriteTweet.find_by(uid) if InMemory.enabled? && InMemory.cache_alive?(created_at)\n tweets = Efs::FavoriteTweet.where(uid: uid) if tweets.blank? && Efs::Tweet.cache_alive?(created_at)\n tweets = ::S3::FavoriteTweet.where(uid: uid) if tweets.blank?\n tweets.map { |tweet| ::TwitterDB::Favorite.new(uid: uid, screen_name: screen_name, raw_attrs_text: tweet.raw_attrs_text) }\n end", "def favorite\n type = params[:type] # get the type from the url (fav/unfav)\n ass = params[:controller] # get the current controller name\n clazz = params[:controller].classify.constantize # get the controllers class in with big upper letter\n obj = clazz.find_by tiss_id: params[:tiss_id] # find the object with the tiss_id\n obj = clazz.create tiss_id: params[:tiss_id] if obj.nil? # create if not exists\n alreadyfav = current_user.send(ass).exists?(obj.id) # is it already fav?\n if type == 'favorite' && !alreadyfav # if not already fav and we want to fav\n current_user.send(ass) << obj # fav it\n flash[:success] = \"Favorite successful\" # success msg\n elsif type == 'unfavorite' && alreadyfav # else\n current_user.send(ass).delete(obj) # unfav\n flash[:success] = \"Unfavorite successful\" # success msg\n else\n flash[:danger] = \"Nothing happened\" # nothing happened msg\n end\n redirect_back fallback_location: root_path # return\n end", "def favourites\n @bottom_bar_header = \"Favourites\"\n @favourited_links = Link.joins(:favourites).where( favourites: { user_id: current_user } )\n end", "def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def user_has_not_favourited_work\n errors.add('You cannot favourite a work twice.') unless Favourite.find_by(user_id: self.user_id, work_id: self.work_id).nil?\n end", "def users_favorite?(naming, user)\n lookup_naming(naming).users_favorite?(user)\n end", "def invited?(event)\n\t\tattended_events.include?(event)\n\tend", "def favorite\n \t\t\tbyebug\n \ttype = params[:type]\n \t@recipe = current_user.recipes.find(params[:id])\n \tif type == \"favorite\"\n \t\tif FavoriteRecipe.where(:recipe_id => @recipe.id).present?\n\t\t\t\tredirect_to recipe_path(@recipe), notice: \"Already favorited #{@recipe.name}\"\n \t\telse\n \t\t\tcurrent_user.favorites << @recipe\n \t\t\tredirect_to recipe_path(@recipe), notice: \"You favorited #{@recipe.name}\"\n \t\tend\n \t\t#redirect_to :back, notice: 'You favorited #{@recipe.name}'\n\n \telsif type == \"unfavorite\"\n \t\tcurrent_user.favorites.delete(@recipe)\n \t\tredirect_to recipe_path(@recipe), notice: \"You Unfavorited #{@recipe.name}\"\n \t\t#redirect_to :back, notice: 'Unfavorited #{@recipe.name}'\n\n \telse\n \t# Type missing, nothing happens\n \t\tredirect_to recipe_path(@recipe), notice: \"Issue with favorite!\"\n \tend\n \t\tend", "def add_to_favorites\n \tif user_signed_in?\n \t\t@user = current_user\n \t\t@user.favorite_listings << params[:listing_id] unless @user.favorite_listings.include?(params[:listing_id])\n \t\t@user.save\n \t\t\n \t\trender :nothing => true\n \tend\n end", "def fetch_episodes_for_playlist(user)\n all_episodes_array = []\n favorites_on_array = Favorite.where(user_id: user.id, playlist_on_off: \"on\")\n favorites_on_array.each do |favorite_instance|\n all_episodes_array += fetch_episodes_by_id(favorite_instance.show_id)\n end\n add_playlist_to_table(all_episodes_array, user)\nend", "def add_to_favorites(new_fav)\n @fav_list << new_fav \n end", "def following?(river)\n favorites.include?(river)\n end", "def index\n if token_and_options(request)\n access_key = AccessKey.find_by_access_token(token_and_options(request))\n @user = User.find_by_id(access_key.user_id) \n p \"@user: \" + @user.to_yaml\n \n \n @events = []\n @past_events = []\n user_events = @user.events.includes([:movies, :users])\n \n user_events.each do |event| \n if event.event_date >= Date.today\n @events << event \n \n event_users = []\n all_confirmed = true\n all_voted = true\n votes_count = 0\n votes_user_count = 0\n all_declined = true\n accepted_count = 0\n \n friends_map ={} \n event.users.each do |friend_user| \n friends_map[friend_user.id] = []\n event_user = nil\n \n if event.rating_phase == \"wait_users\"\n event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id).limit(1).first \n p \"EVENT USER:_ \" +friend_user.id.to_s + \" ACCEPTED:\" +event_user.accept.to_yaml + \"\\n\"\n if friend_user.id == @user.id && event_user.waiting?\n p \"ME - NOT ACCEPT!\"\n all_confirmed = false\n event.event_status = \"confirm\"\n all_declined = false \n elsif friend_user.id == @user.id && event_user.declined? \n event.event_status = \"declined\" \n elsif event_user.waiting?\n all_declined = false\n all_confirmed = false\n elsif friend_user.id != @user.id && event_user.accepted?\n accepted_count = accepted_count + 1\n all_declined = false\n elsif event_user.accepted?\n accepted_count = accepted_count + 1\n end\n else\n all_declined = false \n end\n \n if event.rating_phase == \"starting\"\n if event_user.nil?\n event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id).limit(1).first \n end \n if event.one_to_five?\n if event_user.accepted? && event_user.num_votes != event.num_votes_per_user\n if friend_user.id == @user.id \n event.event_status = \"vote\" \n end \n all_voted = false \n accepted_count = accepted_count + 1\n elsif event_user.accepted? && event_user.num_votes == event.num_votes_per_user \n votes_user_count = votes_user_count + 1\n votes_count = votes_count + event_user.num_votes \n accepted_count = accepted_count + 1\n end\n elsif event.one_to_ten?\n if event_user.accepted? \n accepted_count = accepted_count + 1\n event_user_votes = EventUserVote.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id)\n if !event_user_votes.nil?\n score = 0\n event_user_votes.each do |vote|\n score = score + vote.score\n end\n if score < 2\n if friend_user.id == @user.id \n event.event_status = \"vote\" \n end \n all_voted = false\n else\n votes_user_count = votes_user_count + 1\n end\n else \n if friend_user.id == @user.id \n event.event_status = \"vote\" \n end \n all_voted = false\n end \n end \n end\n end\n \n if friend_user.id != @user.id \n auth = Authorization.find_by_user_id_and_provider(friend_user.id, \"facebook\")\n if event_user.nil?\n event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, friend_user.id).limit(1).first \n end \n \n friend = Friend.where(\"user_id = ? AND friend_id = ?\", friend_user.id, @user.id).limit(1).first \n if friend.nil?\n friend_json = {id: friend_user.id, :name => friend_user.name, :username => friend_user.username, :fb_uid => auth.uid, :event_accepted => event_user.accept, :confirmed => false, :request => false} \n \n puts \"NOT FRIEND: \" + friend_user.name + \" accept? \" + event_user.accept.to_s\n else\n if friend.friend_confirm == true\n puts \"IS FRIEND: \" + friend_user.name + \" accept? \" + event_user.accept.to_s\n friend_json = {id: friend_user.id, :name => friend_user.name, :username => friend_user.username, :fb_uid => auth.uid, :event_accepted => event_user.accept, :confirmed => true, :request => false} \n else\n puts \"IS REQUEST \" + friend_user.name + \" accept? \" + event_user.accept.to_s\n friend_json = {id: friend_user.id, :name => friend_user.name, :username => friend_user.username, :fb_uid => auth.uid, :event_accepted => event_user.accept, :confirmed => false, :request => true} \n end\n end\n event_users << friend_json \n end\n end\n event.friends = event_users\n \n puts \"PHASE: \"+ event.id.to_s+ \", \"+ event.rating_phase.to_s + \" event.finished:\" + event.finished.to_s + \"system_ \" + event.rating_system.to_s\n if event.starting? && event.voting? \n voting_percent = (votes_user_count * 100) / accepted_count\n print \"PERCENT: \" + voting_percent.to_s\n if event.one_to_five?\n votes_percent = votes_count * 100 / (accepted_count * event.num_votes_per_user) \n print \"VOTES PERCENT: \" + votes_percent.to_s\n end\n end \n \n seconds_diff = (event.created_at - DateTime.now).to_i.abs\n minutes_diff = seconds_diff / 60\n puts \"ITME LIMT : \" + event.time_limit.to_s + \" m diff: \" + minutes_diff.to_s\n \n if event.finished == true\n event_movie = EventMovie.where(\"event_id = ? AND winner = true\", event.id).limit(1).first\n movie = EventMovie.where(\"event_id = ? AND winner = true\", event.id).limit(1).first \n event.event_status = \"winner\" \n p \"WINNER: \" + movie.to_yaml + \"\\n\" \n event.winner_movie = event_movie.movie_id\n elsif all_declined == true \n event.event_status = \"failed\" \n elsif all_confirmed == false && event.event_status != \"confirm\" && event.event_status != \"declined\"\n p \"WAITING\" \n \n if minutes_diff > event.time_limit\n if event.user_id == @user.id \n puts \" TIME LIMIT AFTER \" \n event.event_status = \"start_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n else \n event.event_status = \"waiting_others\"\n end\n \n elsif event.voting? && event.starting? && event.event_status != \"vote\" && all_voted == false && event.minimum_voting_percent < 100 &&\n event.minimum_voting_percent <= voting_percent && ((event.one_to_five? && event.minimum_voting_percent <= votes_percent) || event.one_to_ten?)\n puts \" VOTING MINUM<100: \" + voting_percent.to_s\n \n if minutes_diff > event.time_limit\n puts \" NEXT ROUND ANYWAYS! \" \n \n votingFinished(event, friends_map, @user, true)\n event.time_limit = event.time_limit + 30\n event.save\n else \n event.event_status = \"waiting_others\"\n end \n elsif event.voting? && event.starting? && all_voted == false && event.event_status != \"vote\"\n if minutes_diff > event.time_limit\n if event.user_id == @user.id \n event.event_status = \"continue_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n else\n p \"WAITING\"\n event.event_status = \"waiting_others\"\n end \n end\n \n if event.finished == false && event.rating_phase == \"knockout_match\"\n knockouts = EventKnockout.where(\"event_id = ? AND round = ? AND finished = false\", event.id, event.knockout_phase).order('id ASC')\n print \"knockouts: \" + knockouts.to_yaml \n @knockout_match = []\n knockouts.each do |event_knockout|\n knockout_user = KnockoutUser.where(\"event_knockout_id = ? AND user_id = ? \", event_knockout.id, @user.id).limit(1).first\n if knockout_user.nil? \n knockout_json = {id: event_knockout.id, :movie_id_1 => event_knockout.movie_id_1, :movie_id_2 => event_knockout.movie_id_2, :round => knockouts.count} \n event.knockout_matches = knockout_json\n event.event_status = \"knockout_choose\" \n break\n end \n end \n \n if event.knockout_matches.nil?\n if minutes_diff > event.time_limit\n if event.minimum_voting_percent < 100 && !knockouts.empty?\n current_knockout = knockouts.first\n knockout_users_count = KnockoutUser.where(\"event_knockout_id = ? \", current_knockout.id).count\n event_user_count = EventUser.where(\"event_id = ? AND accept = true\", event.id).count \n voting_percent = (knockout_users_count * 100) / event_user_count\n if event.minimum_voting_percent <= voting_percent\n continueKnockout(event, friends_map, @user, true)\n event.time_limit = event.time_limit + 15\n event.save\n else\n if event.user_id == @user.id \n event.event_status = \"continue_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n end\n else \n if event.user_id == @user.id \n event.event_status = \"continue_without_all\"\n else\n event.event_status = \"waiting_others\" \n end\n end\n else\n event.event_status = \"waiting_others\" \n end\n end \n end \n \n my_event_user = EventUser.where(\"event_id = ? AND user_id = ?\", event.id, @user.id).limit(1).first \n if my_event_user.declined? \n event.event_status = \"declined\" \n end \n\n puts \" EVENT \" + event.id.to_s + \" status: \" + event.event_status.to_s \n else\n @past_events << event \n end\n end \n \n respond_with build_events_json(@events) \n else\n render :events => { :info => \"Error\" }, :status => 403\n end \n end", "def show\n\n @favoritepet_exists = Favoritepet.where(petprofile: @petprofile, user: current_user) == [] ? false : true\n end", "def acts_as_favoriter(*args)\n has_many :favorites, :class_name => \"ActsAsFavorite::Favorite\", :as => :favoriter\n\n # Models have the favoriter ability?\n def self.favoriter?\n true\n end\n\n class_eval do\n include ActsAsFavorite::Extenders::Favoriter\n # Models have the favoriter ability?\n def favoriter?\n true\n end\n end\n\n end", "def favoriter?\n false\n end", "def index\n # @favorites = Favorite.all\n if user_signed_in?\n @favorites = current_user.favorites\n else\n redirect_to new_user_session_path\n end\n end", "def favorites\n @lists = current_user.favorites\n respond_with(@lists)\n end", "def is_fav_food(person, test_food)\n fav_snacks = person[:favourites][:snacks]\n for snack in fav_snacks\n if snack == test_food\n return true\n end\n end\n return false\nend", "def get_user_favorites username_for\n do_request 'get_user_favorites', username_for: username_for\n end", "def show\n @favorite = current_user.favorites.find_by(session_login_id: @session_login.id)\n end", "def notify_watchers(comment_id)\n comment = Comment.find comment_id\n\n article_id = comment.article_id\n favs = Favorite.where(favorable_id: article_id)\n uid = comment.user_id\n ids = []\n favs.each do |f|\n i = f.user_id\n next if uid == i or i == 0\n ids << i\n f.updated_at = Time.now()\n f.save!\n end\n end", "def following_stream?(stream)\n return favorites.streams.pluck(:favable_id).include?(stream.id)\n end", "def favorite(client)\n\tensemble = client.search(\"#bonjour_monde\", result_type: \"recent\").take(25)\n#\tensemble.each do |tweet|\n\t\tclient.favorite(ensemble)\n#\tend\nend", "def favorite\n type = params[:type]\n if type == 'favorite'\n current_user.favorites << @puppy\n redirect_to :back, notice: \"You favorited #{@puppy.name}\"\n\n elsif type == 'unfavorite'\n current_user.favorites.delete(@puppy)\n redirect_to :back, notice: \"Unfavorited #{@puppy.name}\"\n\n else\n # Type missing, nothing happens\n redirect_to :back, notice: 'Nothing happened.'\n end\n end", "def mark_as_favourite\n id = params[:id].to_i\n unless session[:favourite_song].include?(id)\n session[:favourite_song] << id \n end\n redirect_to \"/song/index\"\n end", "def favorites(screen_name)\n url = 'https://api.twitter.com/1.1/favorites/list.json?count=2&screen_name=' + screen_name\n request(@agent, @token, url)\n end", "def check_wishlist(item)\n #Query wish lists to see if the criteria matches\n @wish_list = search_wishlist(item)\n @notify_list = Array.new\n @wish_list.each do |wish_list_item|\n if @notify_list.size == 0\n @notify_list.push wish_list_item\n else \n @inList = false\n #Checks to see if the user of the wish list is already in the notificaiton list \n @notify_list.each do|notify_list_item| \n \t\tif notify_list_item.user_id == wish_list_item.user_id\n\t\t\t\t\t\t\t@inList = true \n\t\t\t\t\t\t\tbreak \n end \n end \n if @inList == false \n\t\t\t\t\t@notify_list.push wish_list_item \n end\n end\t\n end\n alert_user(item, @notify_list)\n end", "def check_for_favorite_locations\n if self.previous_travel_node && self.previous_travel_node.title.present?\n FavoriteLocation.create_from_travel_node(self.user, self.previous_travel_node)\n end\n if self.current_travel_node && self.current_travel_node.title.present?\n FavoriteLocation.create_from_travel_node(self.user, self.current_travel_node)\n end\n #if self.next_travel_node && self.next_travel_node.title.present?\n # FavoriteLocation.create_from_travel_node(self.user, self.next_travel_node)\n #end\n end", "def index\n @favorites = user.favorites\n end", "def favorite\n type = params[:type]\n if type == \"favorite\"\n current_user.favorites << @recipe\n redirect_to :back, notice: 'Je hebt met succes dit recept toegevoegd aan jouw favorieten'\n\n elsif type == \"unfavorite\"\n current_user.favorites.delete(@recipe)\n redirect_to :back, alert: 'Je hebt met succes dit recept verwijderd aan jouw favorieten'\n\n else\n # Type missing, nothing happens\n redirect_to :back, notice: 'Nothing happened.'\n end\n end", "def likes_to_eat(person, food)\n\n for x in person[:favourites][:snacks]\n if x == food\n return true\n end\n end\n return false\nend", "def set_favourite\n if user_signed_in?\n @favourite = Favourite.where(user_id: current_user.id, product_id: set_product()).first\n end\n end", "def show\n @snippet.snippet_content = CodeRay.scan(@snippet.snippet_content, :ruby).div(:line_numbers => :table)\n\n @snippetuser = User.find_by(email: session[:current_user_email])\n @hasFavorite = @snippetuser.favorites.find_by(snippet_id: @snippet.id)\n puts \"Getting user favorite\"\n puts @hasFavorite.blank?\n end", "def favorite_movies\n Enceladus::MovieCollection.new(\"account/#{id}/favorite/movies\", { session_id: session_id }) if authenticated?\n end" ]
[ "0.73230517", "0.7102202", "0.70043004", "0.6876272", "0.6835686", "0.6784405", "0.6717347", "0.6671581", "0.66344184", "0.6633944", "0.6630775", "0.66226006", "0.66087705", "0.6602614", "0.65947956", "0.6567841", "0.6550224", "0.6512397", "0.65115446", "0.64876044", "0.64866674", "0.6482391", "0.64734775", "0.6391853", "0.63917947", "0.6338207", "0.62803864", "0.62723213", "0.6249519", "0.6240624", "0.6215038", "0.618442", "0.61702704", "0.6169636", "0.6162258", "0.61557317", "0.6149814", "0.614263", "0.6126378", "0.61224544", "0.6119913", "0.6093835", "0.6063319", "0.6041784", "0.60179627", "0.60099596", "0.60078883", "0.60031044", "0.59871906", "0.59727573", "0.595981", "0.5955496", "0.595286", "0.59478104", "0.59476686", "0.5945851", "0.59415334", "0.592402", "0.5922648", "0.59123534", "0.58999443", "0.5861509", "0.5861509", "0.5852929", "0.5851852", "0.5844659", "0.5837448", "0.5832358", "0.5830925", "0.58223623", "0.5816949", "0.58161175", "0.5798032", "0.579784", "0.57673603", "0.57656574", "0.57606494", "0.57581806", "0.5748829", "0.5705684", "0.5702011", "0.569764", "0.5695608", "0.5686998", "0.5686441", "0.56792516", "0.5675841", "0.56666666", "0.56659734", "0.56584144", "0.5658094", "0.56506497", "0.5650438", "0.5640565", "0.56362295", "0.56324005", "0.5629034", "0.56266725", "0.56157726", "0.5612899", "0.5605114" ]
0.0
-1
These methods determin a users favourites
def get_positive_reviews all_reviews = Review.where(user_id: self.id) all_reviews.select{|review|review.rating > Review.rating_range.max/2 } return all_reviews end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def favourite_for(user)\n favourites.find_by_user_id user\n end", "def favourites\n\t\t\t\t@user = User.find_by(:facebook_id => params[:id_facebook])\n\t\t\t\t@favourites = Favourite.where(\"user_id = #{@user.id}\")\n\t\t\tend", "def favorite_for(user)\n favs.find_by(user_id: user)\n end", "def favourited_items\n self.favourites.each do |f|\n f.favouritable\n end\n end", "def favorites\n if params[:id]\n if params[:id].to_i.to_s == params[:id]\n\t@user = User.find(params[:id])\n else\n\t@user = User.find(:first, :conditions => [\"username=?\", params[:id]])\n end\n else\n @user = @current_user\n end\n\n @beu = @user.following_by_type('Beu')\n end", "def list_favourites(user_id)\n @favourites_store.where(user_id)\n end", "def get_favorite_for user\n\t user.favorites.find_by_page_id(self)\n end", "def favourites\n @bottom_bar_header = \"Favourites\"\n @favourited_links = Link.joins(:favourites).where( favourites: { user_id: current_user } )\n end", "def get_user_favorites username_for\n do_request 'get_user_favorites', username_for: username_for\n end", "def user_favourites(current_user, product)\n Favourite.where(user_id: current_user, product_id: product) > 0\n end", "def favorites(action=nil)\n my.favorites(action)\n end", "def favorites(user = nil, params = {})\n args = [user, params]\n get path_from_args('favorites', args), params_from_args(args)\n end", "def showFavorites\n if current_user\n @favorites = Favorite.where(user_id: current_user.id)\n else\n redirect_to '/'\n end\n end", "def index\n @favorites = user.favorites\n end", "def favourites\n curr_user = User.find(current_user.id)\n fav_posts = curr_user.destring(curr_user)\n fav_users = curr_user.destring_user(curr_user)\n @top_posts = []\n @top_users = []\n fav_posts.each do |n|\n post = Post.find(n)\n @top_posts << post\n end\n fav_users.each do |n|\n user = User.find(n)\n @top_users << user\n end\n render :favourites\n end", "def favourites\n\t\tfavourites = Partay.get('http://shoponline.tescolotus.com/api/v1/favorites/by-category?page=1&sortby=Relevance&issecure=False', :headers => {'Content-Type' => 'application/json','language' => 'en-GB', 'region' => 'TH', 'userId' => access_token, 'Host' => 'r.tesco.com.my'})\n\t\tfavourites_counter = JSON(favourites)\n\t\tself.favourite_count(JSON(favourites_counter)[\"pageInformation\"][\"totalCount\"])\n\t\tif fav_count >= 1\n\t\t\tputs \"Your favourites count is:#{fav_count}\"\n\t\telse\n\t\t\traise \"There are no products in your favourites list.\"\n\t\tend\n\tend", "def index\n if user_signed_in?\n @favorites = current_user.favorites\n\n end\n end", "def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end", "def favorites\n @lists = current_user.favorites\n respond_with(@lists)\n end", "def my_favorites\n\tend", "def favorited\r\n Favorite.find(:all, :conditions => {:favorable_type => self.class.to_s, :favorable_id => self.id})\r\n end", "def all_favorited options = {}\n return all_favorites(options).collect{ |f| f.favoritable }\n end", "def favorites\n files = []\n session[:user].favorite_files.each do |file|\n files.push(file.description(session[:user])) if file.folder || (!file.folder && file.uploaded)\n end\n @result = { files: files, success: true }\n end", "def is_favorite_of user\n\t fave = get_favorite_for user\n\t fave ? true : false\n\tend", "def favorites(options={})\n self.class.parse_questions(request(singular(user_id) + \"/favorites\", options))\n end", "def show\n @favorite = current_user.favorites.find_by(session_login_id: @session_login.id)\n end", "def index\n # @favorites = Favorite.all\n if user_signed_in?\n @favorites = current_user.favorites\n else\n redirect_to new_user_session_path\n end\n end", "def get_user_favorites(id, &block)\n\n end", "def favorited_items\n User.first.favorites.map {|fi| fi.product}\n end", "def favored?(user_id)\n return self.favorites.exists?(user_id: user_id)\n end", "def favorited_by?(user)\n favorites.where(user_id: user.id).exists?\n end", "def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n favorite_array = Favorite.where(user_id:current_user.id)\n \n favorite_array.each do |favorite|\n puts Brewery.find(favorite.brewery_id).name\n puts Brewery.find(favorite.brewery_id).street\n puts Brewery.find(favorite.brewery_id).city\n puts Brewery.find(favorite.brewery_id).state\n end \n # current_user.favorites\n end", "def index\n if !current_user.favorites.blank?\n return current_user.favorites\n else\n render json: { errors: \"No favorites for current user\" }, status: :not_found\n end\n end", "def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def favorite_check user, img\n user.favorites.each do |fav|\n if fav.image_id == img.id\n return true\n end\n end\n\n return false\n end", "def favourite\n if session[:user_id] == nil\n render json: {code: 401}\n else\n url_id = params[:id]\n url = Url.find_by(id: url_id)\n current_user = User.find_by(id: session[:user_id])\n if current_user.urls.exists?(url_id)\n current_user.urls.delete(url)\n favourite = false\n else\n current_user.urls << url\n favourite = true\n end\n users = url.users\n render json: {code: 200, favourite: favourite, users: users}\n end\n end", "def is_fav?(user)\n user.favs.find_by(post_id: self.id)\n end", "def favorite\n type = params[:type] # get the type from the url (fav/unfav)\n ass = params[:controller] # get the current controller name\n clazz = params[:controller].classify.constantize # get the controllers class in with big upper letter\n obj = clazz.find_by tiss_id: params[:tiss_id] # find the object with the tiss_id\n obj = clazz.create tiss_id: params[:tiss_id] if obj.nil? # create if not exists\n alreadyfav = current_user.send(ass).exists?(obj.id) # is it already fav?\n if type == 'favorite' && !alreadyfav # if not already fav and we want to fav\n current_user.send(ass) << obj # fav it\n flash[:success] = \"Favorite successful\" # success msg\n elsif type == 'unfavorite' && alreadyfav # else\n current_user.send(ass).delete(obj) # unfav\n flash[:success] = \"Unfavorite successful\" # success msg\n else\n flash[:danger] = \"Nothing happened\" # nothing happened msg\n end\n redirect_back fallback_location: root_path # return\n end", "def favorite?\n\t is_favorite_of User.current_user\n\tend", "def favorites\n @favorites ||= Favorite.by_tweet_id.key(id)\n end", "def index\n @user_scheme_favorites = UserSchemeFavorite.all\n end", "def show\n @favorites = Favorite.all\n end", "def user_favorite_moves\n FavoriteMove.all.select do |fav|\n fav.user == self \n end \n end", "def favorited_by?(user)\n Favorite.where('object_id = ? AND object_type = ? AND user_id = ?', self.id, self.class.to_s, user.id).count > 0\n end", "def index \n @favorites = Favorite.all\n @users = User.all\n end", "def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end", "def favourite_action (thing, current_user)\n if thing.favourited_by_user?(current_user.id)\n unless (f = thing.favourite_by_user(current_user)).nil?\n (link_to image_tag(icon_filename_for(:favourite)) + content_tag(\n :span, \" Unfavourite\"),\n favourite_path(f),\n :method => :delete,\n :style => \"text-decoration:none\")\n\n end\n else\n link_to image_tag(icon_filename_for(:favourite)) + content_tag(\n :span, \" Favourite\"),\n favourites_url(:favouritable_type => thing.class.name, :favouritable_id => thing.id),\n :method => :post,\n :style => \"text-decoration:none\"\n end\n end", "def display_favorites\n if @alive == true\n favorites_header\n else\n offline_header\n end\n if @fav_list.length == 0\n puts \"You have no favourites!!!\".center(@header_length).yellow\n else\n puts @fav_list.uniq\n end\n line_divider\n favorites_menu\n end", "def favorites(screen_name)\n url = 'https://api.twitter.com/1.1/favorites/list.json?count=2&screen_name=' + screen_name\n request(@agent, @token, url)\n end", "def show\n @favorite_exists = Favorite.where(post: @post, user: current_user) == [] ? false : true\n\n end", "def favorite_foods\n get(\"/user/#{@user_id}/foods/log/favorite.json\")\n end", "def all\n @favourites = Favourite.get_all(@user.id, 'Product').page(params[:page]).per(10)\n end", "def view_favorites\n #current_user will call favorites method to see the list of favorites table in database\n \n current_user.breweries.each do |brewery|\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n puts brewery.name\n puts brewery.street\n puts brewery.city\n puts brewery.state\n puts brewery.phone\n puts \"*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*:*.*\"\n end \n end", "def favorite\n\t\t@venues = []\n\n\t\tuser = User.find(current_user.id)\n\t\tuser_fav = user.favorite_venue_ids\n\t\t\tuser_fav.each do |venue_id|\n\t\t\t\tvenue = Venue.find(venue_id)\n\t\t\t\t@venues << venue\n\t\t\tend\n\n\tend", "def favourite\n resource_id = params[:resource_id]\n resource = Resource.find(resource_id)\n # No previous favourites\n if current_user.favourite_resources.nil?\n current_user.favourite_resources = resource_id + ','\n else\n favourites = current_user.favourite_resources.split(',')\n # If resource already favourited, remove from favourites\n if favourites.include?(resource_id)\n favourites.delete(resource_id)\n current_user.favourite_resources = favourites.join(',')\n if current_user.save\n flash[:success] = \"Removed #{resource.title} from favourites.\"\n redirect_to Subject.find(resource.subject_id) and return\n else\n flash[:success] = \"Failed to remove #{resource.title} from favourites.\"\n redirect_to Subject.find(resource.subject_id) and return\n end\n else\n # If last character does not equal ',' append a ','\n if current_user.favourite_resources[current_user.favourite_resources.length - 1] != ','\n current_user.favourite_resources << ','\n end\n # Append new favourited resource\n current_user.favourite_resources << resource_id + ','\n end\n end\n if current_user.save\n flash[:success] = \"Added #{resource.title} to favourites to user page.\"\n redirect_to Subject.find(resource.subject_id)\n else\n flash[:success] = \"Failed to add #{resource.title} to favourites to user page.\"\n redirect_to Subject.find(resource.subject_id)\n end\n end", "def set_favorite\n @favorite = current_user.favorites.find(params[:id])\n end", "def show_favorites\n authenticate_rem\n follower = @current_user || User.find_by_id(params[:user_id])\n render json: follower.favorite_products.map(&:simple_info.with(follower)), status: :ok\n end", "def index\n @favorites = current_user.favorites\n respond_with(@favorites)\n end", "def users_favorite?(user)\n votes.any? { |v| v.user_id == user.id && v.favorite }\n end", "def toggle_favorite_for user\n\t fave = user.favorites.find_by_page_id(self)\n\t if fave\n\t fave.destroy\n\t else\n\t fave = add_favorite(:created_by => user)\n\t end\n\t fave\n\tend", "def set_favourite\n if user_signed_in?\n @favourite = Favourite.where(user_id: current_user.id, product_id: set_product()).first\n end\n end", "def favorite(category, user)\n shows_by_category = user.shows.group_by({|show| show.send(category.downcase + \"_id\")})\n category_count = shows_by_category.each { |k,v| shows_by_category[k] = v.count}\n if category_count.empty?\n \"None.\"\n else\n Object.const_get(category).find(category_count.max_by{|k,v| v}[0]).name\n end\nend", "def favorite_check\n @check = @fav_list.include?(@selected_activity.last)\n \n end", "def user_has_favorite(image_id)\n if self.favorites.find_by(image_id: image_id)\n return true \n else \n return false\n end\n end", "def index\n authorize! :index, Spree::Favorite\n @favorites = spree_current_user.favorites\n respond_to do |format|\n format.html\n format.json { render json: @favorites }\n end\n end", "def favorites\n return unless public?\n\n if @favorites.nil?\n favorites_data = @xml_data['stats']['favorites']\n\n @favorites = {}\n @favorites[:campaign] = favorites_data['campaign']\n @favorites[:campaign_percentage] = favorites_data['campaignpct'].to_i\n @favorites[:character] = favorites_data['character']\n @favorites[:character_percentage] = favorites_data['characterpct'].to_i\n @favorites[:level1_weapon] = favorites_data['weapon1']\n @favorites[:level1_weapon_percentage] = favorites_data['weapon1pct'].to_i\n @favorites[:level2_weapon] = favorites_data['weapon2']\n @favorites[:level2_weapon_percentage] = favorites_data['weapon2pct'].to_i\n end\n\n @favorites\n end", "def favoriter?\n true\n end", "def get_favorites\n authenticate_rem\n follower = @current_user || User.find_by_id(params[:user_id])\n render json: Product.order(created_at: :desc).limit(20).map(&:simple_info.with(follower)),\n status: :ok\n end", "def show\n @favorite = current_user.favorites.find_by(recipe_id: @recipe.id)\n end", "def index\n @favorites = current_user.favorites\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @favorites }\n end\n end", "def favorites(options = nil)\n def uri_suffix(opts); opts && opts[:page] ? \"?page=#{opts[:page]}\" : \"\"; end\n uri = '/favorites.json' + uri_suffix(options)\n response = http_connect {|conn|\tcreate_http_get_request(uri) }\n bless_models(Twitter::Status.unmarshal(response.body))\n end", "def favorite?\n @favorite\n end", "def is_favorite?\n\t favorite?\n\tend", "def show\n @userID = (current_user.blank?) ? 0 : current_user.id\n @isUserFavourite = Favourite.where(user_id: @userID, movie_id: @movie.id).count > 0 ? true : false\n end", "def index\n @favoritens = Favoriten.all\n end", "def index\n @favourites = Favourite.all\n end", "def favorited?(user, coffeeshop)\n coffeeshop.users.each do |coffeeshop_user|\n return true if coffeeshop_user == user\n end\n return false\n end", "def index\n @favorite_theses = FavoriteThese.order(params[:sort]).where(user_id: session[:user_id]).all\n end", "def my_list\n @user = get_current_user\n if @user\n favorites = UserGame.where(user_id: @user.id).map {|fav| fav.game.game_id }\n render json: favorites\n else\n render json: {\n error: \"Favorite Games Currently Unaccessible\",\n status: 400\n }, status: 400\n end\n end", "def favorite\n \t\t\tbyebug\n \ttype = params[:type]\n \t@recipe = current_user.recipes.find(params[:id])\n \tif type == \"favorite\"\n \t\tif FavoriteRecipe.where(:recipe_id => @recipe.id).present?\n\t\t\t\tredirect_to recipe_path(@recipe), notice: \"Already favorited #{@recipe.name}\"\n \t\telse\n \t\t\tcurrent_user.favorites << @recipe\n \t\t\tredirect_to recipe_path(@recipe), notice: \"You favorited #{@recipe.name}\"\n \t\tend\n \t\t#redirect_to :back, notice: 'You favorited #{@recipe.name}'\n\n \telsif type == \"unfavorite\"\n \t\tcurrent_user.favorites.delete(@recipe)\n \t\tredirect_to recipe_path(@recipe), notice: \"You Unfavorited #{@recipe.name}\"\n \t\t#redirect_to :back, notice: 'Unfavorited #{@recipe.name}'\n\n \telse\n \t# Type missing, nothing happens\n \t\tredirect_to recipe_path(@recipe), notice: \"Issue with favorite!\"\n \tend\n \t\tend", "def get_favorites\n @user = User.find(self.id)\n return Shop.where(id: \n { :$in => @user.favorite_places })\n .each { |shop| pp \"#{shop.picture}, #{shop.name}, #{shop.email}, #{shop.city}, #{shop.location}\"}\n end", "def toggle_favorite\n\t toggle_favorite_for User.current_user\n\tend", "def index\n @favourites = Favourite.all\n end", "def index\n @favourites = Favourite.all\n end", "def index\n @favourites = Favourite.all\n end", "def index\n @favourites = Favourite.all\n end", "def index\n @favor_users = FavorUser.all\n end", "def index\n @favorites = Favorite.all\n end", "def index\n @favorites = Favorite.all\n end", "def index\n @favorites = Favorite.all\n end", "def toggle_fav\n @property = Property.find(params[:id])\n current_usertemp.favorited?(@property) ? current_usertemp.unfavorite(@property) : current_usertemp.favorite(@property)\n end", "def has_fav?(game_id)\n\t FavouriteGame.where(:user_id => self.id, :game_id => game_id).empty?\n end", "def get_favorite favoritable, options = {}\n if options.key?(:multiple_scopes) == false\n options[:parameter] = favoritable\n validate_scopes __method__, options\n elsif options[:multiple_scopes] == true\n results = {}\n options[:scope].each do |scope|\n results[scope] = favorites.unblocked.send(scope + '_list').for_favoritable(favoritable).first\n end\n return results\n else\n return favorites.unblocked.send(options[:scope] + '_list').for_favoritable(favoritable).first\n end\n end", "def index\n @favorite_tweets = FavoriteTweet.where(:user => session[:user_id])\n end", "def favorite?\n @favorite\n end", "def favorite?\n @favorite\n end", "def index\n @favorites = current_user.favorites\n render json: Api::V1::WatchableSerializer.new(@favorites.map(&:favoritable)).serialized_json\n end", "def toggle_favorite\n return if current_user.nil?\n\n if current_user.favorite?(params[:university_id])\n current_user.remove_favorite(params[:university_id])\n else\n current_user.add_favorite(params[:university_id])\n end\n\n flash[:success] = 'Favorites list updated!'\n redirect_to request.referer || root_url\n end", "def list_fav\r\n users = User.all \r\n users.each do |user|\r\n puts \"#{user}\"\r\n user.snacks.each do |snack|\r\n puts \"- #{snack}\"\r\n end\r\n end\r\nend", "def favorite\n\t\tclient = Client.find(params[:client_id])\n\t\tfavorite = Favorite.new(client_id: params[:client_id])\n\t\tcurrent_user.customer.favorites ||= []\n\t\tcurrent_user.customer.favorites << favorite\n\t\tredirect_to root_path, notice: \"Company added to favorites\"\n\tend", "def has_faved?(favable)\n if favable.is_a?(Journal)\n return favorites.journals.pluck(:favable_id).include?(favable.id)\n elsif favable.is_a?(Submission)\n return favorites.submissions.pluck(:favable_id).include?(favable.id)\n elsif favable.is_a?(Stream)\n return favorites.streams.pluck(:favable_id).include?(favable.id)\n end\n end" ]
[ "0.8291975", "0.8196138", "0.7981185", "0.78090817", "0.7680613", "0.76201487", "0.7603004", "0.7586964", "0.75681126", "0.75540704", "0.7491768", "0.7450617", "0.74397266", "0.7421324", "0.7392482", "0.7365073", "0.7341544", "0.7306291", "0.7289223", "0.7289153", "0.7270413", "0.72623545", "0.72514516", "0.7239863", "0.7223746", "0.72174424", "0.71991104", "0.71894634", "0.7149634", "0.7141866", "0.71278495", "0.71036774", "0.71031666", "0.7101266", "0.70820767", "0.7074198", "0.707408", "0.7069494", "0.7034617", "0.703386", "0.7023127", "0.70217806", "0.7018656", "0.7012453", "0.7010383", "0.6996759", "0.69939274", "0.69325316", "0.6926968", "0.6916061", "0.6902512", "0.6896934", "0.68945765", "0.6885549", "0.68854874", "0.68783337", "0.6850456", "0.68463445", "0.683444", "0.6834436", "0.68249154", "0.68076545", "0.6806019", "0.67945814", "0.6784469", "0.6770292", "0.67657024", "0.6763845", "0.67627376", "0.6757066", "0.67471063", "0.67424613", "0.6736337", "0.6735413", "0.6735123", "0.6728965", "0.6717404", "0.6714438", "0.66844547", "0.6678416", "0.6663422", "0.6653638", "0.6652907", "0.6652907", "0.6652907", "0.6652907", "0.6646624", "0.66459996", "0.66459996", "0.66459996", "0.6644748", "0.6644687", "0.6634861", "0.6633986", "0.66335195", "0.66335195", "0.6632201", "0.6628243", "0.6626091", "0.6626007", "0.6617978" ]
0.0
-1
GET /setquestionlinks GET /setquestionlinks.json
def index @setquestionlinks = Setquestionlink.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_setquestionlink\n @setquestionlink = Setquestionlink.find(params[:id])\n end", "def setquestionlink_params\n params.require(:setquestionlink).permit(:set_id, :question_id, :follower_id)\n end", "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def linking\n result = @test.link_questions(test_params)\n if result\n return render json: { message: 'Error: Question was not created succesfully', error: true }\n else\n return render json: { message: 'Question was created succesfully', error: false }\n end\n end", "def links\n json_hyperschema[\"links\"] || []\n end", "def links=(value)\n @links = value\n end", "def links=(value)\n @links = value\n end", "def links=(value)\n @links = value\n end", "def create\n @setquestionlink = Setquestionlink.new(setquestionlink_params)\n\n respond_to do |format|\n if @setquestionlink.save\n format.html { redirect_to @setquestionlink, notice: 'Setquestionlink was successfully created.' }\n format.json { render action: 'show', status: :created, location: @setquestionlink }\n else\n format.html { render action: 'new' }\n format.json { render json: @setquestionlink.errors, status: :unprocessable_entity }\n end\n end\n end", "def links=(new_links)\n @links = new_links\n end", "def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end", "def links\n each_link.to_set\n end", "def show\n @link = @question.links.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @link }\n end\n end", "def linked_resources=(value)\n @linked_resources = value\n end", "def set_quicklink\n @quicklink = Quicklink.find(params[:id])\n end", "def links\n metadata[:links] || Set.new\n end", "def links\n data['links']\n end", "def index\n render json: @links\n end", "def get_next_set\n hash,url = perform_next_page_request\n Questions.new hash,url\n end", "def set_questionset\n @questionset = Questionset.find(params[:id])\n end", "def links\n @data[\"_links\"]\n end", "def index\n @quicklinks = Quicklink.all\n end", "def set_question_set\n @question_set = QuestionSet.find(params[:id])\n end", "def set_question_set\n @question_set = QuestionSet.find(params[:id])\n end", "def set_question_set\n @question_set = QuestionSet.find(params[:id])\n end", "def set_question_list\n @question_list = QuestionList.find(params[:id])\n end", "def index\n @recommended_links = RecommendedLink.all\n\n render json: @recommended_links\n end", "def show\n @article_link = @study_set.link.url\n\n respond_to do |format|\n format.html\n format.json { render json: { :part_of_set => json_params_for(@study_set.entries.joins(:study_records).where(\"study_records.due < ?\", Time.now)), \n :extra_answers => @extra_answers } }\n end\n end", "def list_hyperlink_submission(response_map_id, question_id)\n assignment = Assignment.find(@id)\n curr_round = assignment.try(:num_review_rounds)\n curr_response = Response.where(map_id: response_map_id, round: curr_round).first\n answer_with_link = Answer.where(response_id: curr_response.id, question_id: question_id).first if curr_response\n comments = answer_with_link.try(:comments)\n html = ''\n html += display_hyperlink_in_peer_review_question(comments) if comments.present? and comments.start_with?('http')\n html.html_safe\n end", "def index\n links = all_links\n render json: { success: true, links: links }\n end", "def links=(links_array)\n @links = links_array\n normalize!\n end", "def destroy\n @setquestionlink.destroy\n respond_to do |format|\n format.html { redirect_to setquestionlinks_url }\n format.json { head :no_content }\n end\n end", "def links\n response = Clever.request :get, url\n response[:links]\n end", "def index\n @questionsets = Questionset.all\n end", "def questions_list \n #render json: {status: 200, questions: Quiz.all, msg: \"Success.\"}\n render json: {status: 200, questions: Quiz.all.map{|que| [id: que.id, question: que.question, options: [que.opt1,que.opt2,que.opt3,que.opt4], answer: que.answer]}.flatten, msg: \"Success.\"}\n end", "def update\n respond_to do |format|\n if @setquestionlink.update(setquestionlink_params)\n format.html { redirect_to @setquestionlink, notice: 'Setquestionlink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @setquestionlink.errors, status: :unprocessable_entity }\n end\n end\n end", "def links\n @links ||= []\n @links\n end", "def index\n @pending_recommended_links = PendingRecommendedLink.all\n\n render json: @pending_recommended_links\n end", "def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end", "def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end", "def create\n respond_to do |format|\n if @question.save\n @question_link = QuizQuestion.create!(:qtype => params[:qtype], :qid => @question.id, :quizid => params[:quizid], :points => params[:points])\n @question_link.save\n @question.update(:questionid => @question_link.id)\n @quiz = Quiz.find_by_id(params[:quizid])\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_responses\n\t\t@responses = Response.where(question_id: params[:id] ) rescue nil\n\tend", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def links\n @links.values\n end", "def links\n @user = User.find(params[:id])\n render json: {status: 'SUCCESS', message: 'List all Links in User', data: @user.links},status: :ok\n end", "def answer_buttons\n render json: @current_user.answer_buttons\n end", "def json_print_links(json, reset = true)\n if @json_links && @json_links.any?\n json.links do\n @json_links.each do |k, v|\n json.set! k, v\n end\n end\n @json_links = {} if reset\n end\n end", "def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\n end\n end", "def set_helpful_link\n @helpful_link = HelpfulLink.find(params[:id])\n end", "def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end", "def set_survey_question_relationship\n @survey_question_relationship = SurveyQuestionRelationship.find(params[:id])\n end", "def linked\n request('linked')\n end", "def new\n @question_set = QuestionSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_set }\n end\n end", "def handle_links(json) end", "def quiz_questions\n @questions = set_quiz.questions\n end", "def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end", "def read_links()\n\t\tlinks = linkr.read_array()\n\t\t###binding.pry\n\t\t#@initial_queue = links\n\t\t###binding.pry\n\t\tlinks\n\n\tend", "def vdoc_links\n return @link_set if defined? @link_set\n \n @link_set = Set.new\n pages.each {|page| @link_set << page.display_name }\n @link_set\n end", "def links\n return @links\n end", "def links\n return @links\n end", "def links\n return @links\n end", "def set_question\n @question = Question.includes(:answers).find(params[:id])\n end", "def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend", "def show\n @question = current_node.questions.find(params[:id])\n @question.viewed!(request.remote_ip)\n @answers = (@question.answers.page params[:page]).order_by(current_order)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def links()\n return @links\n end", "def links; end", "def links; end", "def links=(pb_links)\n @links.clear\n\n case pb_links\n when Hash\n pb_links.each do |k, v|\n raise TypeError.new unless k.is_a?(String)\n\n if v.is_a?(Array)\n @links[k] += v\n else\n @links[k] << v\n end\n end\n\n when Array, Protobuf::Field::FieldArray\n pb_links.each do |pb_link|\n @links[pb_link.tag] << @key.get_linked(pb_link.bucket, pb_link.key, {:safely => true})\n end\n else\n raise TypeError.new\n end\n\n return(@links)\n end", "def questions_url\n view_context.questions_url\n end", "def links(arg = nil)\n set_or_return(:links, arg, kind_of: Array)\n end", "def index\n render json: @test_module.test_questions, status: :ok\n end", "def answers\n request('answers')\n end", "def index\n @destination_linksets = DestinationLinkset.all\n end", "def set_question_response\n @question_response = QuestionResponse.find(params[:id])\n end", "def set_answer_list\n @answer_list = AnswerList.find(params[:id])\n end", "def index\n @link_resources = LinkResource.where(lab: @lab)\n end", "def show\n @resources_and_link = ResourcesAndLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resources_and_link }\n end\n end", "def set_question\n @question = Discovery::Question.find(params[:id])\n end", "def questions=(value)\n @questions = value\n end", "def answer_list\n answers = Quiz.where(id: params[:ids]).map{|quiz| [quiz.id => quiz.answer]}\n render json: {status: 200, answers: answers.flatten, msg: \"Success.\"}\n end", "def create_links\n end", "def create_links\n end", "def links\n if params[:links]\n titles = params[:links][:title]\n url = params[:links][:url]\n s = titles.zip(url)\n @external_links = []\n if (params[:label] == \"Classrooms\" || params[:label] == \"Subjects\") \n if params[:label] == \"Subjects\"\n label = \"Subjects\"\n else\n label = \"Classrooms\"\n end\n s.each do |f|\n a = f.flatten\n if ( a[1] != \"\") && (a[3] != \"\")\n @external_links << @current_school.external_links.create({:classroom_id => @classroom.id, :label => label,\n :title => a[1], :url => a[3] })\n end\n end\n else\n s.each do |f|\n a = f.flatten\n if ( a[1] != \"\") && (a[3] != \"\")\n @external_links << @current_school.external_links.create({:title => a[1], :label => params[:label], :url => a[3] })\n end\n end\n end\n end\n end", "def index\n render status: :ok, json: @simple_question_alternatives\n end", "def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end", "def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end", "def links\n @links ||= lambda do \n raw_links.map do |link|\n hash = {}\n link.keys.each do |key|\n hash[key] = link[key]\n end\n hash\n end\n end.call\n end", "def links(object=nil)\n options[:links] ||= []\n options[:links] << object if object\n options[:links]\n end", "def set_question_answer\n @question_answer = QuestionAnswer.find(params[:id])\n end", "def links\n typed_set(entities, Occi::Core::Link)\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_answer\n @answer = Answer.find(params[:id])\n @question = @answer.question\n end", "def my_links\n end", "def links\n @mandate_links ||= Links.new(@links)\n end", "def set_question\n @question = Question.find(params[\"question_id\"])\n end", "def show\n render_json @question\n end", "def set_question\n @question = Question.find(params[:id])\n end", "def links\n\n @user=current_user\n @links=Link.user_links(current_user.id)\n\n end", "def set_destination_linkset\n @destination_linkset = DestinationLinkset.find(params[:id])\n end", "def get_next_set\n hash,url = perform_next_page_request\n Answers.new hash,url\n end" ]
[ "0.69735473", "0.6266377", "0.6213912", "0.602999", "0.5992899", "0.59813577", "0.59813577", "0.59813577", "0.58711857", "0.5832766", "0.58084995", "0.57767934", "0.5749406", "0.57004195", "0.55756235", "0.55699885", "0.55546534", "0.55438536", "0.5517849", "0.5510561", "0.5506132", "0.54919386", "0.5465832", "0.5465832", "0.5465832", "0.5456438", "0.54437894", "0.5428182", "0.5420309", "0.54025716", "0.5402306", "0.5382527", "0.53718257", "0.5368803", "0.53455055", "0.5335926", "0.5307849", "0.53024966", "0.5289304", "0.52883154", "0.5257168", "0.52540445", "0.5246061", "0.5241289", "0.5241056", "0.52170175", "0.5214186", "0.5200646", "0.5193623", "0.517798", "0.5174627", "0.5153641", "0.51505876", "0.5144831", "0.51341194", "0.5131426", "0.51233643", "0.5119842", "0.5118407", "0.5118407", "0.5118407", "0.51136905", "0.51089054", "0.5108178", "0.5105342", "0.5105213", "0.5105213", "0.51031625", "0.509687", "0.5095141", "0.50907797", "0.50907296", "0.50904024", "0.5089871", "0.50676006", "0.50578225", "0.5048263", "0.5047652", "0.5029294", "0.5027506", "0.5025152", "0.5025152", "0.5024163", "0.5019352", "0.5018986", "0.501399", "0.50091153", "0.5007521", "0.500342", "0.49974945", "0.49918488", "0.49912798", "0.4989886", "0.49846524", "0.49786374", "0.49763456", "0.49726185", "0.4965057", "0.49635604", "0.49633163" ]
0.70140237
0
GET /setquestionlinks/1 GET /setquestionlinks/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @setquestionlinks = Setquestionlink.all\n end", "def set_setquestionlink\n @setquestionlink = Setquestionlink.find(params[:id])\n end", "def show\n @link = @question.links.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @link }\n end\n end", "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def links\n json_hyperschema[\"links\"] || []\n end", "def show\n @article_link = @study_set.link.url\n\n respond_to do |format|\n format.html\n format.json { render json: { :part_of_set => json_params_for(@study_set.entries.joins(:study_records).where(\"study_records.due < ?\", Time.now)), \n :extra_answers => @extra_answers } }\n end\n end", "def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end", "def index\n render json: @links\n end", "def linking\n result = @test.link_questions(test_params)\n if result\n return render json: { message: 'Error: Question was not created succesfully', error: true }\n else\n return render json: { message: 'Question was created succesfully', error: false }\n end\n end", "def setquestionlink_params\n params.require(:setquestionlink).permit(:set_id, :question_id, :follower_id)\n end", "def create\n @setquestionlink = Setquestionlink.new(setquestionlink_params)\n\n respond_to do |format|\n if @setquestionlink.save\n format.html { redirect_to @setquestionlink, notice: 'Setquestionlink was successfully created.' }\n format.json { render action: 'show', status: :created, location: @setquestionlink }\n else\n format.html { render action: 'new' }\n format.json { render json: @setquestionlink.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @recommended_links = RecommendedLink.all\n\n render json: @recommended_links\n end", "def index\n @quicklinks = Quicklink.all\n end", "def show\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionset }\n end\n end", "def index\n links = all_links\n render json: { success: true, links: links }\n end", "def links\n data['links']\n end", "def index\n @pending_recommended_links = PendingRecommendedLink.all\n\n render json: @pending_recommended_links\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def show\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_set }\n end\n end", "def get_next_set\n hash,url = perform_next_page_request\n Questions.new hash,url\n end", "def set_quicklink\n @quicklink = Quicklink.find(params[:id])\n end", "def show\n @resources_and_link = ResourcesAndLink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resources_and_link }\n end\n end", "def links=(value)\n @links = value\n end", "def links=(value)\n @links = value\n end", "def links=(value)\n @links = value\n end", "def new\n @questionset = Questionset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionset }\n end\n end", "def index\n @link_resources = LinkResource.where(lab: @lab)\n end", "def destroy\n @setquestionlink.destroy\n respond_to do |format|\n format.html { redirect_to setquestionlinks_url }\n format.json { head :no_content }\n end\n end", "def linked_resources=(value)\n @linked_resources = value\n end", "def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end", "def list_hyperlink_submission(response_map_id, question_id)\n assignment = Assignment.find(@id)\n curr_round = assignment.try(:num_review_rounds)\n curr_response = Response.where(map_id: response_map_id, round: curr_round).first\n answer_with_link = Answer.where(response_id: curr_response.id, question_id: question_id).first if curr_response\n comments = answer_with_link.try(:comments)\n html = ''\n html += display_hyperlink_in_peer_review_question(comments) if comments.present? and comments.start_with?('http')\n html.html_safe\n end", "def show\n @question = current_node.questions.find(params[:id])\n @question.viewed!(request.remote_ip)\n @answers = (@question.answers.page params[:page]).order_by(current_order)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question }\n end\n end", "def links\n each_link.to_set\n end", "def new\n @question_set = QuestionSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_set }\n end\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def links\n @data[\"_links\"]\n end", "def links\n metadata[:links] || Set.new\n end", "def links\n response = Clever.request :get, url\n response[:links]\n end", "def linked\n request('linked')\n end", "def index\n @questionsets = Questionset.all\n end", "def new\n @link = Link.new\n @links_a=ManRsc.all\n @links_b=@links_a\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end", "def index\n render json: @test_module.test_questions, status: :ok\n end", "def json_print_links(json, reset = true)\n if @json_links && @json_links.any?\n json.links do\n @json_links.each do |k, v|\n json.set! k, v\n end\n end\n @json_links = {} if reset\n end\n end", "def show\n render_json @question\n end", "def index\n @links = Link.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @links }\n end\n end", "def links\n @links ||= []\n @links\n end", "def links\n @user = User.find(params[:id])\n render json: {status: 'SUCCESS', message: 'List all Links in User', data: @user.links},status: :ok\n end", "def index\n render status: :ok, json: @simple_question_alternatives\n end", "def links\n @links.values\n end", "def handle_links(json) end", "def new\n @answer_set = AnswerSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer_set }\n end\n end", "def index\n @destination_linksets = DestinationLinkset.all\n end", "def get_questions\n items = get_items\n make_response(HttpStatus::OK, make_result_list(items))\nend", "def set_helpful_link\n @helpful_link = HelpfulLink.find(params[:id])\n end", "def index\n @links = current_user.links.desc :created_at\n @title = 'Shared By You'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @links }\n end\n end", "def set_questionset\n @questionset = Questionset.find(params[:id])\n end", "def get_questions(number)\n @questions_array = get_from_url(@questions_conn, QUESTIONS_OBTAINTION_KEY, {size: number})\n end", "def get_next_set\n hash,url = perform_next_page_request\n Answers.new hash,url\n end", "def set_question_list\n @question_list = QuestionList.find(params[:id])\n end", "def show\n if @v1_question\n render json: @v1_question\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end", "def questions_list \n #render json: {status: 200, questions: Quiz.all, msg: \"Success.\"}\n render json: {status: 200, questions: Quiz.all.map{|que| [id: que.id, question: que.question, options: [que.opt1,que.opt2,que.opt3,que.opt4], answer: que.answer]}.flatten, msg: \"Success.\"}\n end", "def show\n @link = Link.find(params[:id])\n paginate_all_links\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @link }\n end\n end", "def new\n @knowledge_points = KnowledgePoint.all\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @question }\n end\n end", "def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end", "def links()\n return @links\n end", "def set_api_v1_question\n @api_v1_question = Api::V1::Question.find(params[:id])\n end", "def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end", "def create\n respond_to do |format|\n if @question.save\n @question_link = QuizQuestion.create!(:qtype => params[:qtype], :qid => @question.id, :quizid => params[:quizid], :points => params[:points])\n @question_link.save\n @question.update(:questionid => @question_link.id)\n @quiz = Quiz.find_by_id(params[:quizid])\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @resources_and_link = ResourcesAndLink.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resources_and_link }\n end\n end", "def links\n return @links\n end", "def links\n return @links\n end", "def links\n return @links\n end", "def index\n @references = Reference.all\n\n render json: @references\n end", "def index\n @shortlinks = Shortlink.all\n end", "def update\n respond_to do |format|\n if @setquestionlink.update(setquestionlink_params)\n format.html { redirect_to @setquestionlink, notice: 'Setquestionlink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @setquestionlink.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @question_categories = QuestionCategory.with_questions()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_categories }\n end\n end", "def index\n @survey_questions = SurveyQuestion.all\n render json: @survey_questions.to_json(include: {\n answer_options: {\n include: {\n chosen_answers: {}\n } \n }\n })\n end", "def index\n @question_options = QuestionOption.find_all_by_question_id(@question.id)\n\n respond_to do |format|\n format.json { render :json => @question_options.to_json }\n format.xml { render :xml => @question_options.to_xml }\n end\n end", "def show\n @tasklink = Tasklink.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tasklink }\n end\n end", "def set_question\n @question = Question.includes(:answers).find(params[:id])\n end", "def set_question_set\n @question_set = QuestionSet.find(params[:id])\n end", "def set_question_set\n @question_set = QuestionSet.find(params[:id])\n end", "def set_question_set\n @question_set = QuestionSet.find(params[:id])\n end", "def read_links()\n\t\tlinks = linkr.read_array()\n\t\t###binding.pry\n\t\t#@initial_queue = links\n\t\t###binding.pry\n\t\tlinks\n\n\tend", "def index\n @title = \"Survey Question Categories\"\n @survey_question_categories = SurveyQuestionCategory.all\n\n respond_to do |format|\n format.js { @set_id = params[:id] }\n end\n end", "def set_survey_question_relationship\n @survey_question_relationship = SurveyQuestionRelationship.find(params[:id])\n end", "def index\n @social_media_links = SocialMediaLink.all\n\n render json: @social_media_links\n end", "def index\n @url_links = UrlLink.all\n end", "def set_question\n @question = Discovery::Question.find(params[:id])\n end", "def links; end", "def links; end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def index\n @links = Link.all\n end", "def questions\n # Get a list of questionnaires that belong to instances of the current race\n if @course\n questionnaire_ids = @course.questionnaire_ids\n elsif @instance\n questionnaire_ids = @instance.questionnaire_ids\n else\n questionnaire_ids = []\n end\n\n # Collect question_ids that are used in those questionnaires\n question_ids = Set.new\n Questionnaire.where(:id => questionnaire_ids).find_each do |questionnaire|\n question_ids.merge(questionnaire.question_ids)\n end\n\n @questions = Question.find(question_ids.to_a)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @questions.to_json }\n end\n end", "def new\n # pismo_grab_meta_data\n paginate_all_links\n @link = Link.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @link }\n end\n end" ]
[ "0.7166114", "0.6863481", "0.628137", "0.62547857", "0.61867523", "0.60610974", "0.6055582", "0.598421", "0.59757656", "0.59519494", "0.59046316", "0.58382237", "0.5787392", "0.5782397", "0.57762593", "0.57317454", "0.5722005", "0.56735", "0.5667848", "0.5666463", "0.5651339", "0.5633217", "0.55994767", "0.55994767", "0.55994767", "0.5587932", "0.5582257", "0.5579771", "0.55579895", "0.5556896", "0.5554994", "0.5542878", "0.5529068", "0.5518619", "0.5504859", "0.5500152", "0.5483469", "0.5470833", "0.54525316", "0.54158527", "0.5413011", "0.53757864", "0.5366018", "0.5363617", "0.5360894", "0.53572255", "0.53485733", "0.534075", "0.5322084", "0.530827", "0.5284308", "0.5273213", "0.5267971", "0.5266067", "0.5264989", "0.5264121", "0.52632874", "0.5258872", "0.5258448", "0.52571744", "0.5255366", "0.5251419", "0.52500844", "0.5247157", "0.52387375", "0.5238234", "0.52243084", "0.52228117", "0.522", "0.52189726", "0.52189726", "0.52189726", "0.52143294", "0.52140754", "0.5213525", "0.52032214", "0.5201499", "0.520082", "0.5199147", "0.519839", "0.5198259", "0.5198259", "0.5198259", "0.51939523", "0.5188206", "0.5179645", "0.5177633", "0.5170493", "0.51692796", "0.51617825", "0.51617825", "0.514821", "0.514821", "0.514821", "0.514821", "0.514821", "0.514821", "0.514821", "0.514821", "0.51409507", "0.5136619" ]
0.0
-1
POST /setquestionlinks POST /setquestionlinks.json
def create @setquestionlink = Setquestionlink.new(setquestionlink_params) respond_to do |format| if @setquestionlink.save format.html { redirect_to @setquestionlink, notice: 'Setquestionlink was successfully created.' } format.json { render action: 'show', status: :created, location: @setquestionlink } else format.html { render action: 'new' } format.json { render json: @setquestionlink.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_setquestionlink\n @setquestionlink = Setquestionlink.find(params[:id])\n end", "def setquestionlink_params\n params.require(:setquestionlink).permit(:set_id, :question_id, :follower_id)\n end", "def linking\n result = @test.link_questions(test_params)\n if result\n return render json: { message: 'Error: Question was not created succesfully', error: true }\n else\n return render json: { message: 'Question was created succesfully', error: false }\n end\n end", "def create\n respond_to do |format|\n if @question.save\n @question_link = QuizQuestion.create!(:qtype => params[:qtype], :qid => @question.id, :quizid => params[:quizid], :points => params[:points])\n @question_link.save\n @question.update(:questionid => @question_link.id)\n @quiz = Quiz.find_by_id(params[:quizid])\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully created.' }\n format.json { render :show, status: :created, location: @question }\n else\n format.html { render :new }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @setquestionlinks = Setquestionlink.all\n end", "def create\n @link = @question.links.new(params[:link])\n @link.user_id = current_user.id\n\n respond_to do |format|\n if @link.save\n flash[:notice] = 'link was successfully created.'\n format.html { redirect_to(@question) }\n format.xml { render :xml => @link, :status => :created, :location => @link }\n else\n format.html { redirect_to @question }\n flash[:notice] = 'Link must start with \"http://\"'\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end", "def links=(new_links)\n @links = new_links\n end", "def create\n # puts params\n questions = JSON.parse(params[:questions])\n q_hash = questions[\"questions\"]\n @assignment = Assignment.new\n @assignment.course_id = params[:course_id]\n @assignment.type = \"Homework\"\n @assignment.start_date = params[:start_date]\n @assignment.end_date = params[:end_date]\n @assignment.name = params[:name]\n # Following is the question hash\n q_hash.each do |key, value|\n a_hash = key[\"answers\"]\n question = key[\"question\"]\n puts question\n new_question = Question.new\n new_question.description = question\n new_question.type = \"MultipleChoice\"\n # Answer hash\n a_hash.each do |k,v|\n puts k[\"is_correct\"]\n puts k[\"description\"]\n new_answer = Answer.new\n new_answer.description = k[\"description\"]\n new_answer.is_correct = k[\"is_correct\"]\n new_question.association(:answers).add_to_target(new_answer)\n end\n @assignment.association(:questions).add_to_target(new_question)\n end\n \n if @assignment.save\n render :show, status: :created, location: @assignment\n else\n render json: @assignment.errors, status: :unprocessable_entity\n end\n end", "def create\n @quiz = Quiz.find(params[:quiz_id])\n @question = Question.new(question_params) \n #respond_to do |format|\n if @question.save\n link_quiz_question(@quiz, @question)\n #format.json { render :show, status: :created, location: @question }\n else\n redirect_to quizzes_path\n flash[:notice] = 'Falha em criar pergunta'\n #format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n #end\n end", "def links=(links_array)\n @links = links_array\n normalize!\n end", "def links=(value)\n @links = value\n end", "def links=(value)\n @links = value\n end", "def links=(value)\n @links = value\n end", "def create_links\n end", "def create_links\n end", "def update\n respond_to do |format|\n if @setquestionlink.update(setquestionlink_params)\n format.html { redirect_to @setquestionlink, notice: 'Setquestionlink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @setquestionlink.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @quicklink = Quicklink.new(quicklink_params)\n\n respond_to do |format|\n if @quicklink.save\n format.html { redirect_to @quicklink, notice: 'Quicklink was successfully created.' }\n format.json { render action: 'show', status: :created, location: @quicklink }\n else\n format.html { render action: 'new' }\n format.json { render json: @quicklink.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_links\n return if @links.nil?\n\n if @links.empty?\n Rentlinx.client.unpost_links_for(self)\n else\n Rentlinx.client.post_links(@links)\n end\n end", "def create\n @q = Q.find(params[:q_id])\n \n #temp_content = a(params[:qmail_content])\n @qmail = @q.qmails.create(:content =>params[:qmail_content],:user_id => current_user.id)\n @quest = @q.quest\n current_user.qmails << @qmail\n @qmail.add_questid(@quest.id)#must for telling pg_search about the quest if of qmail\n @qmail.add_qid(@q.id)#must for telling pg_search about the q if of qmail\n #links vm code here\n # doc = Nokogiri::HTML(markdown.render(@qmail.content))\n # doc.xpath('//a[@href]').each do |l|\n # @link = @quest.links.create(:body => l['href'])\n # end\n respond_to do |format|\n \n format.html { redirect_to q_path(@q)}\n format.js \n end\n # new_qmail_notify(@qmail)\n end", "def links\n json_hyperschema[\"links\"] || []\n end", "def destroy\n @setquestionlink.destroy\n respond_to do |format|\n format.html { redirect_to setquestionlinks_url }\n format.json { head :no_content }\n end\n end", "def link_data\n params.permit(links: [:url])\n .require(:links)\n .values\n end", "def create\n @question = Question.new(params[:question])\n params[:knowledge_point_ids].each do |knowledge_point_id|\n @knowledge_point = KnowledgePoint.find_by_id(knowledge_point_id)\n @question.knowledge_points << @knowledge_point\n end\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to @question, :notice => 'Question was successfully created.' }\n format.json { render :json => @question, :status => :created, :location => @question }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_quicklink\n @quicklink = Quicklink.find(params[:id])\n end", "def links=(pb_links)\n @links.clear\n\n case pb_links\n when Hash\n pb_links.each do |k, v|\n raise TypeError.new unless k.is_a?(String)\n\n if v.is_a?(Array)\n @links[k] += v\n else\n @links[k] << v\n end\n end\n\n when Array, Protobuf::Field::FieldArray\n pb_links.each do |pb_link|\n @links[pb_link.tag] << @key.get_linked(pb_link.bucket, pb_link.key, {:safely => true})\n end\n else\n raise TypeError.new\n end\n\n return(@links)\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @link.save\n render json: @link, status: :created, location: @link\n else\n render json: @link.errors, status: :unprocessable_entity\n end\n end", "def linked_resources=(value)\n @linked_resources = value\n end", "def set_survey_question_relationship\n @survey_question_relationship = SurveyQuestionRelationship.find(params[:id])\n end", "def create_links(settings_list, jira_client)\n @settings_list.links.each do |linktype, target|\n link = jira_client.Issuelink.build\n if (target['direction'] == 'inward')\n link.save({\n :type => {:name => linktype},\n :inwardIssue => {:key => target['ticket']},\n :outwardIssue => {:key => @issue.key},\n })\n else\n link.save({\n :type => {:name => linktype},\n :inwardIssue => {:key => @issue.key},\n :outwardIssue => {:key => target['ticket']},\n })\n end\n end\n end", "def list_hyperlink_submission(response_map_id, question_id)\n assignment = Assignment.find(@id)\n curr_round = assignment.try(:num_review_rounds)\n curr_response = Response.where(map_id: response_map_id, round: curr_round).first\n answer_with_link = Answer.where(response_id: curr_response.id, question_id: question_id).first if curr_response\n comments = answer_with_link.try(:comments)\n html = ''\n html += display_hyperlink_in_peer_review_question(comments) if comments.present? and comments.start_with?('http')\n html.html_safe\n end", "def set_linkpost\n @linkpost = Linkpost.find(params[:id])\n end", "def update_form_questions\n updated_qs = []\n if params[:form][:linked_questions]\n new_qs_hash = {}\n params[:form][:linked_questions].each { |q| new_qs_hash[q[:question_id]] = q }\n # Be aware, wrapping this loop in a transaction improves performance by batching all the updates to be committed at once\n FormQuestion.transaction do\n @form.form_questions.each do |q|\n if new_qs_hash.include? q.question_id\n updated_qs << update_form_question(q, new_qs_hash.delete(q.question_id))\n else\n q.destroy!\n end\n end\n end\n # any new form question still in this hash needs to be created\n new_qs_hash.each do |_id, q|\n updated_qs << FormQuestion.new(question_id: q[:question_id], response_set_id: q[:response_set_id],\\\n position: q[:position], program_var: q[:program_var])\n end\n end\n updated_qs\n end", "def create\n @check_link = CheckLink.new()\n\n @check_link.get_all_links(check_link_params['checked_url'])\n respond_to do |format|\n if @check_link.save\n format.html { redirect_to @check_link, notice: 'Check link was successfully created.' }\n format.json { render :show, status: :created, location: @check_link }\n else\n format.html { render :new }\n format.json { render json: @check_link.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_question_params\n params.require(:test_question).permit(answers_attributes: [:id, :content])\n end", "def faq_ref_params\n params.require(:faq).permit({reference: [:id, :youtube_url, :web_url, :image => []]})\n end", "def set_questionnaire\n questionnaire_reference.reference = \"Questionnaire/#{DEFAULT_QUESTIONNAIRE_ID}\"\n end", "def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end", "def create\n @resources_and_link = ResourcesAndLink.new(params[:resources_and_link])\n\n respond_to do |format|\n if @resources_and_link.save\n format.html { redirect_to @resources_and_link, notice: 'Resources and link was successfully created.' }\n format.json { render json: @resources_and_link, status: :created, location: @resources_and_link }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resources_and_link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = current_user.links.new link_params\n create_and_respond(@link)\n end", "def create\n @recommended_link = RecommendedLink.new(recommended_link_params)\n\n if @recommended_link.save\n render json: @recommended_link, status: :created, location: @recommended_link\n else\n render json: @recommended_link.errors, status: :unprocessable_entity\n end\n end", "def create_lti_quicklink(org_unit_id, lti_link_id)\n path = \"/d2l/api/le/#{$le_ver}/lti/quicklink/#{org_unit_id}/#{lti_link_id}\"\n _post(path, {})\nend", "def create\n @question = Question.new(question_params)\n link_response_sets(params)\n\n if @question.all_versions.count >= 1\n if @question.not_owned_or_in_group?(current_user) || @question.prev_not_owned_or_in_group?(current_user)\n render(json: @question.errors, status: :unauthorized) && return\n elsif @question.all_versions.last.status == 'draft'\n render(json: @question.errors, status: :unprocessable_entity) && return\n end\n @question.version = @question.most_recent + 1\n end\n assign_author\n if @question.save\n render :show, status: :created, location: @question\n else\n # @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end", "def set_helpful_link\n @helpful_link = HelpfulLink.find(params[:id])\n end", "def save_related\n if self.links.present?\n self.links.each do | link |\n link.parent_type = :action_item\n link.parent_key = self.key\n link.save!\n end\n end\n end", "def set_answers!(params)\n SurveyQuestion.with_question.find_all_by_survey_id(survey_id).each do |question| # iterate through all survey questions\n if params[question.id.to_s].blank? # if the question hasn't been answered\n remove_answer(question.id)\n else\n set_answer(question, params[question.id.to_s]) # save the answer\n end\n end\n save\n end", "def manage_question(body)\n upload_questions(JSON.parse(body)['questions'])\n get_questions\nend", "def create\n @link = current_user.links.build(link_params)\n \n @link.num = 2\n @link.user_name = current_user.nickname\n @link.description = current_user.description\n @link.description_permission = current_user.description_permission\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: '투표안건이 성공적으로 작성되었습니다.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = current_user.links.build(link_params)\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to @link, notice: 'Review was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pending_recommended_link = PendingRecommendedLink.new(pending_recommended_link_params)\n\n if @pending_recommended_link.save\n render json: @pending_recommended_link, status: :created\n else\n render json: @pending_recommended_link.errors, status: :unprocessable_entity\n end\n end", "def survey_params\n params.require(:survey).permit(:title, :author_id, :description, :link ,questions_attributes: [:id, :order_number, :question_type, :text, :required, :obliterate, answers_attributes: [:id, :text, :taker_id]] )\n end", "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n @survey = Survey.new(json)\n respond_to do |format|\n if @survey.save\n format.html { redirect_to @survey, notice: 'Survey was successfully created.' }\n format.json { render json: @survey, status: :created, location: @survey }\n else\n format.html { render action: \"new\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def question_params\n params.require(:question).permit(:content, :response_type_id, :parent_id, :category_id, :groups,\n :version_independent_id, :description, :other_allowed, :subcategory_id,\n concepts_attributes: [:id, :value, :display_name, :code_system],\n data_collection_methods: [])\n end", "def save_all_links selected_surveys\n if params[:scripts] != nil\n params[:scripts].each do |script_id|\n link = Link.new\n link.subject = @archive\n link.object = Script.find(script_id)\n link.predicate = \"link\"\n link.user = current_user\n link.save\n end\n end\n #automatically link from the selected datasets/surveys\n selected_surveys.each do |survey_id|\n link = Link.new\n link.subject = @archive\n link.object = Survey.find(survey_id)\n link.predicate = \"link\"\n link.user = current_user\n link.save\n end\n if params[:data_extracts] != nil\n params[:data_extracts].each do |extract_id|\n link = Link.new\n link.subject = @archive\n link.object = Csvarchive.find(extract_id)\n link.predicate = \"link\"\n link.user = current_user\n link.save\n end\n end\n if params[:publications] != nil\n # all_scripts_array = Array.new\n params[:publications].each do |publication_id|\n link = Link.new\n link.subject = @archive\n link.object = Publication.find(publication_id)\n link.predicate = \"link\"\n link.user = current_user\n link.save\n end\n end\n end", "def handle_links(json) end", "def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", :api_key => 'testapikey',\r\n :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response :created\r\n link = JSON.parse(response.body)\r\n check_new_link(link) \r\n end", "def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end", "def create\n @question = Question.new(question_params)\n @question.answers.build(params[:question][:answer])\n\n # Creating associations for themes and levels\n asked_themes = params[:question][:theme_list].reject { |c| c.empty? }\n asked_levels = params[:question][:level_list].reject { |c| c.empty? }\n @question.theme_list.add(asked_themes)\n @question.level_list.add(asked_levels)\n\n\n respond_to do |format|\n if @question.save\n format.html { redirect_to questions_path, notice: 'Question was successfully created.' }\n format.json { render action: 'show', status: :created, location: questions_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @destination_linkset = DestinationLinkset.new(destination_linkset_params)\n\n respond_to do |format|\n if @destination_linkset.save\n format.html { redirect_to @destination_linkset, notice: 'Destination linkset was successfully created.' }\n format.json { render :show, status: :created, location: @destination_linkset }\n else\n format.html { render :new }\n format.json { render json: @destination_linkset.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #render :json => params[:quiz_answer]\n #return\n @quiz=Quiz.find(params[:quiz_id])\n\n\n @quiz_answer = QuizAnswer.new(quiz_answer_params)\n\n @question=Question.find(params[:quiz_answer][:question_id])\n #render :json => @quiz.questions\n #return\n\n @next_question = (@quiz.questions.map(&:id) - current_user.quiz_answers.map(&:question_id) - [@question.id])\n #render :json => @quiz.questions\n #return\n\n\n respond_to do |format|\n if @quiz_answer.save\n\n #puts \"check next question #{@next_question}\"\n if @next_question == []\n current_user.current_route = \"/my_dashboard\"\n current_user.save!\n #redirect_to snazzmeup_path,:alert=>\"Successfully given quiz response\"\n redirect_to quiz_review_path(@quiz.id), :alert=>\"Successfully given quiz response\"\n return\n else\n @next_question = @next_question[0]\n current_user.current_route = \"/take_test/#{@quiz.id}/#{@next_question}\"\n current_user.save!\n end\n\n format.html { redirect_to take_test_path(@quiz.id,@next_question)}\n format.json { render action: 'show', status: :created, location: @quiz_answer }\n\n else\n format.html { redirect_to take_test_path(@quiz.id, @question.id), notice: 'Howdy!! You need to select one option.' }\n format.json { render json: @quiz_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_a_question\n q = ShortQuestion.create({\n :text => params[:text],\n :belongs_to_topic => params[:topic],\n :by => params[:by] || \"admin\",\n :by_id => params[:by_id]\n })\n params[:answers].each do |ans|\n a = q.short_answers.create({\n :text => ans.text,\n :choice_num => ans.choice \n })\n end\n $r.hset(\"question:#{q.id}:answers\", :num_choices, params[:answers].length)\n # Not setting the value of the answers to 0, as any increment will take care of initializing those keys\n end", "def create\n @quiz = current_user.quizzes.build(quiz_params)\n\n @quiz.questions.each do |q|\n if q.question_type == \"free_answer\"\n q.answers = []\n end\n end\n\n puts @quiz.questions\n\n respond_to do |format|\n if @quiz.save\n format.html { redirect_to current_user, notice: 'Quiz was successfully created.' }\n format.json { render :show, status: :created, location: @quiz }\n else\n format.html { render :new }\n format.json { render json: @quiz.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_question_answer\n @question_answer = QuestionAnswer.find(params[:id])\n end", "def set_destination_linkset\n @destination_linkset = DestinationLinkset.find(params[:id])\n end", "def create\n @question_option = QuestionOption.new(params[:question_option])\n @question_option.question = @question\n\n respond_to do |format|\n if @question_option.save\n format.json { head :created, :location => question_option_url(@questionnaire, @page, @question, @question_option, :format => 'json') }\n format.xml { head :created, :location => question_option_url(@questionnaire, @page, @question, @question_option, :format => 'xml') }\n else\n format.json { render :json => @question_option.errors.to_json }\n format.xml { render :xml => @question_option.errors.to_xml }\n end\n end\n end", "def helpful_link_params\n params.require(:helpful_link).permit(:url, :name)\n end", "def link!\n self.linkbutton = true\n self.save\n self.linkbutton\n end", "def create\n @quiz = Quiz.new(quiz_params)\n questions_arr.each do |i|\n question = Question.new(question_params(i))\n choices_arr(i).each do |j|\n choice = Choice.new(choice_params(j))\n choice.save\n question.choices << choice\n end\n @quiz.questions << question\n end\n\n if @quiz.save\n User.find(params[:user_id]).quizzes << @quiz\n render json: @quiz, status: :created, location: @quiz\n else\n render json: @quiz.errors, status: :unprocessable_entity\n end\n end", "def create\n @link = Link.new(params[:link])\n\n respond_to do |format|\n if @link.save\n @response = { url: \"#{request.protocol}#{request.host_with_port}/#{Link.encode(@link.id)}\" }\n format.json { render json: @response, status: :created, location: @link }\n else\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_questionset\n @questionset = Questionset.find(params[:id])\n end", "def answer_params\n params.require(:answer).permit(:task_id, :link, :attachment)\n end", "def json_print_links(json, reset = true)\n if @json_links && @json_links.any?\n json.links do\n @json_links.each do |k, v|\n json.set! k, v\n end\n end\n @json_links = {} if reset\n end\n end", "def create\n @quick_answer = QuickAnswer.new(params[:quick_answer])\n @quick_answer.quick_question_id = params[:quick_question_id]\n @quick_answer.user_id = params[:user_id]\n @quick_answer.save\n \n respond_to do |format|\n if @quick_answer.save\n format.html { redirect_to :back }\n format.json { render json: @quick_answer, status: :created, location: @quick_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quick_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_question\n frm.link(:id=>\"editform:addQlink\").click\n SelectQuestionType.new(@browser)\n end", "def response_params\n params.require(:response).permit(:user, :questionnaire_id, answers_attributes: [:id, :content, :question_id])\n end", "def links\n if params[:links]\n titles = params[:links][:title]\n url = params[:links][:url]\n s = titles.zip(url)\n @external_links = []\n if (params[:label] == \"Classrooms\" || params[:label] == \"Subjects\") \n if params[:label] == \"Subjects\"\n label = \"Subjects\"\n else\n label = \"Classrooms\"\n end\n s.each do |f|\n a = f.flatten\n if ( a[1] != \"\") && (a[3] != \"\")\n @external_links << @current_school.external_links.create({:classroom_id => @classroom.id, :label => label,\n :title => a[1], :url => a[3] })\n end\n end\n else\n s.each do |f|\n a = f.flatten\n if ( a[1] != \"\") && (a[3] != \"\")\n @external_links << @current_school.external_links.create({:title => a[1], :label => params[:label], :url => a[3] })\n end\n end\n end\n end\n end", "def set_question_list\n @question_list = QuestionList.find(params[:id])\n end", "def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully created.\" }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def questionnaire_params\n params.require(:questionnaire).permit(:title, { question_ids: [] })\n end", "def questionnaire_params\n params.require(:questionnaire).permit(\n :title,\n :description,\n options: {},\n questions_attributes:\n [:id,\n :question_text,\n :correct_answer,\n :_destroy,\n question_answers_attributes:\n [:id,\n :is_correct_flag,\n :answer_text,\n :_destroy\n ]\n ])\n end", "def create\n @study_set = StudySet.new(user_id: current_user.id, link_id: params[:study_set][:link_id])\n @study_set.entries << Entry.find(params[:study_set][:entry_id])\n\n respond_to do |format|\n if @study_set.save\n if params.has_key? 'save-return'\n format.html { redirect_to current_user, notice: 'Study set was successfully created.' }\n else\n format.html { redirect_to @study_set, notice: 'Study set was successfully created.' }\n format.json { render json: @study_set.entries }\n end\n else\n format.html { render :new }\n format.json { render json: @study_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_link = TestLink.new(test_link_params)\n\n if @test_link.save\n render :show, status: :created, location: @test_link\n else\n render json: @test_link.errors, status: :unprocessable_entity\n end\n end", "def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def create\n @link_resource = LinkResource.new(link_resource_params)\n\n respond_to do |format|\n if @link_resource.save\n format.html { redirect_to @lab, notice: 'Link resource was successfully created.' }\n format.json { render action: 'show', status: :created, location: @link_resource }\n else\n format.html { render action: 'new' }\n format.json { render json: @link_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionset = Questionset.new(params[:questionset])\n\n respond_to do |format|\n if @questionset.save\n format.html { redirect_to @questionset, notice: 'Questionset was successfully created.' }\n format.json { render json: @questionset, status: :created, location: @questionset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def question_params\n params.require(:question).permit(:title, topic_ids: [], answers_attributes: [:id, :content, :is_correct])\n end", "def set_post\n @question = Question.find(params[:id])\n end", "def create\n @link = Link.new(link_params)\n\n respond_to do |format|\n if @link.save\n if @link.shortened.nil? or @link.shortened.empty?\n @link.assign_unique_shortened_string\n @link.save\n end\n current_user.links << @link\n current_user.save\n\n format.html { redirect_to @link, notice: 'Link was successfully created.' }\n format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionset = Questionset.new(questionset_params)\n\n respond_to do |format|\n if @questionset.save\n format.html { redirect_to @questionset, notice: 'Questionset was successfully created.' }\n format.json { render :show, status: :created, location: @questionset }\n else\n format.html { render :new }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def quicklink_params\n params.require(:quicklink).permit(:icon, :name, :url, :active, :important)\n end", "def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end", "def create\n @answers = params[:user_answers]\n @answers.each do |key, value|\n UserAnswer.create(:user_id => current_user.id, :survey_question_id => key.to_i, :text => value)\n end\n redirect_to :root\n end", "def question_params\n params.require(:question).permit(:question_title, :quiz_id, choices_attributes: [])\n end", "def create_question\n question_hash = Adapter.quiz_api(difficulty) #use adapter method, with difficulty passes into the url as a variable, to gnerate a new list of questions.\n new_question = Question.new #make a new question instance\n new_question.save #save now so we can store the question's id in the answer by calling self.id\n new_question.content = question_hash['question'] #adding all necessary column data to this question object/row\n new_question.create_answers(question_hash)\n new_question.quiz_id = self.id\n new_question.save #send the newly created question to the database\n end", "def question_params\n params.require(:question).permit(:title, :body, :answer, :tag_list, :slug)\n end", "def create\n @b_answer = @b_question.b_answers.build(b_answer_params)\n\n respond_to do |format|\n if @b_answer.save\n format.html { redirect_to b_question_path(@b_question) }\n format.json { render action: 'show', status: :created, location: @b_answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @b_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_question_set\n @question_set = QuestionSet.find(params[:id])\n end", "def set_question_set\n @question_set = QuestionSet.find(params[:id])\n end", "def set_question_set\n @question_set = QuestionSet.find(params[:id])\n end", "def create\n @link = Link.new(link_params)\n @link.active = true # make link active by default\n @link.admin_id = SecureRandom.uuid\n\n respond_to do |format|\n if @link.save\n format.html { redirect_to link_admin_path(@link.admin_id), notice: \"Link was successfully created.\" }\n # format.json { render :show, status: :created, location: @link }\n else\n format.html { render :new, status: :unprocessable_entity }\n # format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.67572373", "0.6736333", "0.63254124", "0.61655813", "0.60271597", "0.595839", "0.589026", "0.5860594", "0.57420707", "0.5684831", "0.5682414", "0.5682414", "0.5682414", "0.5622895", "0.5622895", "0.5491111", "0.54285145", "0.54269165", "0.5355125", "0.535366", "0.52777493", "0.5276651", "0.52748024", "0.52602154", "0.5258602", "0.52484316", "0.5237894", "0.52141625", "0.5194199", "0.51859546", "0.51849276", "0.5176371", "0.51688206", "0.51605123", "0.5151577", "0.5143867", "0.5143308", "0.5141883", "0.51335055", "0.5129534", "0.51272565", "0.5113705", "0.5111255", "0.510996", "0.5108032", "0.5102248", "0.5080219", "0.5078862", "0.5073779", "0.50634277", "0.50578195", "0.50569844", "0.5049786", "0.50427675", "0.5034592", "0.5023508", "0.50213885", "0.50197214", "0.5018069", "0.5015464", "0.50041425", "0.50021565", "0.4989768", "0.49869236", "0.49779198", "0.49764362", "0.49715626", "0.4970702", "0.4964957", "0.4964785", "0.4961642", "0.4954229", "0.4951121", "0.4945244", "0.4945213", "0.49420327", "0.49419656", "0.49392736", "0.4935222", "0.49297306", "0.4929241", "0.49287063", "0.49284917", "0.4925016", "0.49229965", "0.4919673", "0.49173447", "0.49160504", "0.49160114", "0.49138317", "0.4908191", "0.48971203", "0.48966902", "0.48946923", "0.48843792", "0.48769122", "0.4875529", "0.4875529", "0.4875529", "0.48686182" ]
0.67061853
2
PATCH/PUT /setquestionlinks/1 PATCH/PUT /setquestionlinks/1.json
def update respond_to do |format| if @setquestionlink.update(setquestionlink_params) format.html { redirect_to @setquestionlink, notice: 'Setquestionlink was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @setquestionlink.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @question.update(question_params)\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @question_link.update(:points => params[:points])\n @quiz = Quiz.find_by_id(@question_link.quizid)\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end", "def set_setquestionlink\n @setquestionlink = Setquestionlink.find(params[:id])\n end", "def setquestionlink_params\n params.require(:setquestionlink).permit(:set_id, :question_id, :follower_id)\n end", "def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quicklink.update(quicklink_params)\n format.html { redirect_to @quicklink, notice: 'Quicklink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quicklink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questionset = Questionset.find(params[:id])\n\n respond_to do |format|\n if @questionset.update_attributes(params[:questionset])\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end", "def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\n end\n end", "def update\n @question_set = QuestionSet.find(params[:id])\n\n respond_to do |format|\n if @question_set.update_attributes(params[:question_set])\n format.html { redirect_to @question_set, notice: 'Question set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @v1_question.update(v1_question_params)\n render json: @v1_question, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @link_resource.update(link_resource_params)\n format.html { redirect_to @lab, notice: 'Link resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @link_resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end", "def update\n @resources_and_link = ResourcesAndLink.find(params[:id])\n\n respond_to do |format|\n if @resources_and_link.update_attributes(params[:resources_and_link])\n format.html { redirect_to @resources_and_link, notice: 'Resources and link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resources_and_link.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @questionset.update(questionset_params)\n format.html { redirect_to @questionset, notice: 'Questionset was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionset }\n else\n format.html { render :edit }\n format.json { render json: @questionset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @b_question.update(b_question_params)\n format.html { redirect_to @b_question }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @b_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_and_respond(@link, link_params)\n end", "def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end", "def update_question_content\n question_params = params.require(:question).permit(:id, :content)\n\n render json: Question.update_question_content(question_params)\n end", "def update\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.where(:id => params[:id], :problem_set_id => params[:problem_set_id]).first\n @answers = Answer.where(:question_id => @question.id)\n\n ans = [:answer1, :answer2, :answer3, :answer4]\n respond_to do |format|\n if @question.update_attributes(params[:question])\n \n @answers.each_with_index do |a, i|\n a.answer = params[ans[i]][:answer]\n a.correct = params[ans[i]][:correct]\n a.save\n end\n\n if @answers.size < 4 and params[ans[@answers.size]][:answer] != \"\"\n for i in @answers.size..4\n if params[ans[i]][:answer] != \"\"\n a = Answer.new(params[ans[i-1]])\n a.question_id = @question.id\n a.save\n end\n end\n end\n format.html { redirect_to(edit_problem_set_question_path(@problem_set.id, @question.count), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def patch options\n rest_request({ method: :patch }.merge(options))\n end", "def update\n @pending_recommended_link = PendingRecommendedLink.find(params[:id])\n\n if @pending_recommended_link.update(pending_recommended_link_params)\n head :no_content\n else\n render json: @pending_recommended_link.errors, status: :unprocessable_entity\n end\n end", "def update\n @time_series_question = @time_series.questions.find(params[:id])\n\n respond_to do |format|\n if @time_series_question.update_attributes(params[:time_series_question])\n format.html { redirect_to time_series_question_path(@owner, @time_series, @time_series_question), flash: {success: t('app.msgs.success_updated', :obj => t('mongoid.models.time_series_question.one'))} }\n format.json { head :no_content }\n else\n @datasets = @time_series.datasets.sorted\n\n # get the list of questions for each dataset in the time series that are not already in the time series\n @questions = {}\n\n @datasets.each do |dataset|\n # get the dataset question\n # - if it does not exist, build it\n dataset_question = @time_series_question.dataset_questions.by_dataset_id(dataset.dataset_id)\n dataset_question = @time_series_question.dataset_questions.build(dataset_id: dataset.dataset_id) if dataset_question.nil?\n\n @questions[dataset_question.dataset_id.to_s] = []\n # get all other questions not being used for this dataset\n not_in_use = dataset_question.dataset.questions.for_analysis_not_in_codes(@time_series.questions.codes_for_dataset(dataset_question.dataset_id)).to_a\n if not_in_use.present?\n @questions[dataset_question.dataset_id.to_s] << not_in_use\n end\n # get question for this dataset\n in_use = dataset_question.dataset.questions.with_code(dataset_question.code)\n if in_use.present?\n @questions[dataset_question.dataset_id.to_s] << in_use\n end\n @questions[dataset_question.dataset_id.to_s].flatten!.sort_by!{|x| x.original_code} if @questions[dataset_question.dataset_id.to_s].present?\n\n end\n\n\n add_common_options\n\n format.html { render action: \"edit\" }\n format.json { render json: @time_series_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_form_questions\n updated_qs = []\n if params[:form][:linked_questions]\n new_qs_hash = {}\n params[:form][:linked_questions].each { |q| new_qs_hash[q[:question_id]] = q }\n # Be aware, wrapping this loop in a transaction improves performance by batching all the updates to be committed at once\n FormQuestion.transaction do\n @form.form_questions.each do |q|\n if new_qs_hash.include? q.question_id\n updated_qs << update_form_question(q, new_qs_hash.delete(q.question_id))\n else\n q.destroy!\n end\n end\n end\n # any new form question still in this hash needs to be created\n new_qs_hash.each do |_id, q|\n updated_qs << FormQuestion.new(question_id: q[:question_id], response_set_id: q[:response_set_id],\\\n position: q[:position], program_var: q[:program_var])\n end\n end\n updated_qs\n end", "def update\n\n if params[:tags].nil?\n @question.tags = []\n else\n @question.tags = Tag.find(params[:tags])\n end\n\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to admin_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to :planner, notice: 'Question was successfully updated.' }\n format.json { respond_with_bip(@question) }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if (@question.question_type.short_text? || @question.question_type.open_ended_text?)\n path = survey_path(params[:survey_id])\n else\n path = survey_question_path(params[:survey_id],@question.id)\n end\n format.html { redirect_to path, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_question = TestQuestion.find(params[:id])\n\n respond_to do |format|\n if @test_question.update_attributes(params[:test_question])\n format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @test_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @link = Link.find(params[:id])\n paginate_all_links\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to root_url+\"#show-links\", notice: 'Link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.json { render :json => 'Question updated OK' }\n format.xml { head :ok }\n else\n format.json { render :json => @question.errors }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_question.update(api_v1_question_params)\n format.html { redirect_to @api_v1_question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_question }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @page = Page.find(params[:id])\n questions = @presenter.all_questions_for_page(params[:id])\n questions.post(params[:answers], @answer_sheet)\n \n questions.save\n \n @elements = questions.elements\n \n # Save references\n if params[:reference].present?\n params[:reference].each do |id, values|\n ref = @answer_sheet.reference_sheets.find(id)\n # if the email address has changed, we have to trash the old reference answers\n ref.attributes = values\n ref.save(:validate => false)\n end\n end\n @presenter.active_page = nil\n @answer_sheet.touch\n respond_to do |format|\n format.js\n #format.html\n end\n end", "def update\n @recommended_link = RecommendedLink.find(params[:id])\n\n if @recommended_link.update(recommended_link_params)\n head :no_content\n else\n render json: @recommended_link.errors, status: :unprocessable_entity\n end\n end", "def update\n @need_help = NeedHelp.find(params[:id])\n\n respond_to do |format|\n if @need_help.update_attributes(params[:need_help])\n format.json {head :no_content}\n else\n format.json {render json: @need_help.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tasklink = Tasklink.find(params[:id])\n\n respond_to do |format|\n if @tasklink.update_attributes(params[:tasklink])\n format.html { redirect_to @tasklink, notice: 'Tasklink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tasklink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questions = Question.all\n @categories = [\"Learning from Labs\", \"Lab Instructor\", \"Lab Space and Equipment\", \"Time Required to Complete Labs\", \"Lecture Section Instructor\"]\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully submitted.' }\n format.json { render :show, status: :ok, location: @survey }\n\n # Update 'completed' attribute to true\n submission = Survey.find_by(survey_ID: @survey.survey_ID)\n submission.update(status: true)\n\n # Increment 'completed' attribute for section\n @section = Section.find_by(class_num: @survey.class_num)\n @section.update(completed: @section.completed + 1)\n\n\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n qp = question_params\n if qp[:question_type] == \"vignette\" or qp[:question_type] == \"nonchoice\"\n qp[:answer] = \"\"\n end\n\n respond_to do |format|\n if @question.update(qp)\n format.html { redirect_to paper_questions_path(question_params[:paper_id],question_params[:id]), notice: '題目已被成功編輯' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { redirect_to edit_paper_question_path, notice: '上傳檔案大小不可超過500KB' }\n format.json { render json: paper_questions_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n #@question = Question.find(params[:id])\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: t('alert.question.update_success', default: 'Question was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n question = Question.find(params[:id])\n authorize question\n\n new_version = question.template.generate_version?\n\n old_question_ids = {}\n if new_version\n # get a map from option number to id\n old_number_to_id = {}\n question.question_options.each do |opt|\n old_number_to_id[opt.number] = opt.id\n end\n\n # get a map from question versionable id to old id\n question.template.questions.each do |q|\n old_question_ids[q.versionable_id] = q.id\n end\n end\n\n question = get_modifiable(question)\n\n question_id_map = {}\n if new_version\n # params now out of sync (after versioning) with the question_options\n # so when we do the question.update it'll mess up\n # need to remap params to keep them consistent\n old_to_new_opts = {}\n question.question_options.each do |opt|\n old_id = old_number_to_id[opt.number]\n old_to_new_opts[old_id.to_s] = opt.id.to_s\n end\n\n question.template.questions.each do |q|\n question_id_map[old_question_ids[q.versionable_id].to_s] = q.id.to_s\n end\n end\n\n # rewrite the question_option ids so they match the new\n # version of the question\n # and also rewrite the remove_data question ids\n attrs = question_params\n attrs = update_option_ids(attrs, old_to_new_opts) if new_version && !attrs['question_options_attributes'].nil?\n\n # Need to reattach the incoming annotation's and question_options to the\n # modifiable (versioned) question\n attrs = transfer_associations(attrs, question) if new_version\n\n # If the user unchecked all of the themes set the association to an empty array\n # add check for number present to ensure this is not just an annotation\n attrs[:theme_ids] = [] if attrs[:theme_ids].blank? && attrs[:number].present?\n if question.update(attrs)\n if question.update_conditions(sanitize_hash(params['conditions']),\n old_to_new_opts, question_id_map)\n flash.now[:notice] = success_message(question, _('updated'))\n end\n else\n flash.now[:alert] = flash.now[:alert] = failure_message(question, _('update'))\n end\n if question.section.phase.template.customization_of.present?\n redirect_to org_admin_template_phase_path(\n template_id: question.section.phase.template.id,\n id: question.section.phase.id,\n section: question.section.id\n )\n else\n redirect_to edit_org_admin_template_phase_path(\n template_id: question.section.phase.template.id,\n id: question.section.phase.id,\n section: question.section.id\n )\n end\n end", "def update\n respond_to do |format|\n if @question_learned.update(question_learned_params)\n format.html { redirect_to @question_learned, notice: 'Question learned was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_learned.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n kick and return if not is_god?\n @puzzle = Puzzle.find(params[:id])\n @puzzle.linked_puzzles.clear\n link_ids = extract_link_ids(params)\n link_ids.each do |lid|\n @puzzle.linked_puzzles << Puzzle.find(lid)\n end\n\n respond_to do |format|\n if @puzzle.update_attributes(params[:puzzle])\n format.html { redirect_to @puzzle, notice: 'Puzzle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @puzzle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to quiz_path(@question.subsection_id), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def 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 @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_single_poll(id,polls__question__,opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n :polls__question__,\n :polls__description__,\n \n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n raise \"polls__question__ is required\" if polls__question__.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id,\n :polls__question__ => polls__question__\n )\n\n # resource path\n path = path_replace(\"/v1/polls/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_params(options, query_param_keys)\n if opts[:next_page]\n pagination_params = page_params_load(:put, path)\n query_params.merge! pagination_params if pagination_params\n end\n response = mixed_request(:put, path, query_params, form_params, headers)\n page_params_store(:put, path)\n response\n \n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to new_question_path, notice: 'questions was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @simple_question_alternative.update(simple_question_alternative_params)\n render status: :ok, json: @simple_question_alternative\n else\n self.send(:edit)\n end\n end", "def update\n # before_action :set_question\n #before_action :set_tag\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: \"更新しました\" }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "def update\n @faq.update(faqs_params)\n json_response(@faq)\n end", "def update\n @question = Question.find(params[:question_id])\n\n if !@question\n redirect_to :controller => :questions, :action => \"show\", :id => params[:question_id]\n end\n @tags = @question.tags.order(:id)\n @tag = @question.tags.build\n @taggings = Tagging.where(:tag_id => @tags.collect{|x| x.id},:question_id => params[:id]).order(:tag_id)\n @answer = @question.answers.find(params[:id])\n @user = @answer.user\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n # make other answers wrong\n if params[:answer][:correct]\n @question.answers.each do |a|\n if a != @answer\n a.correct = false\n a.save\n end\n end\n end\n format.html { render :template => 'questions/show', :answer_id=>@answer.id, :user_id=>@user.id,:question_id => @question.id, notice: 'Answer was successfully updated.'}\n #format.json { head :no_content }\n #redirect_to question_url(@question_id)\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'My question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to @link, :notice => 'Ссылка была успешно обновлена' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @link.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @question_option = QuestionOption.find(params[:id])\n check_forged_path\n\n respond_to do |format|\n if @question_option.update_attributes(params[:question_option])\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.json { render :json => @question_option.errors.to_json }\n format.xml { render :xml => @question_option.errors.to_xml }\n end\n end\n end", "def update\n respond_to do |format|\n if @shortlink.update(shortlink_params)\n format.html { redirect_to shortlinks_path, notice: 'Shortlink was successfully updated.' }\n format.json { render :show, status: :ok, location: @shortlink }\n else\n format.html { render :edit }\n format.json { render json: @shortlink.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question.course, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cc_question = CcQuestion.find(params[:id])\n\n #we need the parent id to set next_sib\n params[:cc_question][:cc_all_attributes][:next_sib] += \"_\"\n params[:cc_question][:cc_all_attributes][:next_sib] += params[:cc_question][:cc_all_attributes][:parent_id] \n\n respond_to do |format|\n if @cc_question.update_attributes(params[:cc_question])\n format.html { redirect_to(@cc_question, :notice => 'Question component was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cc_question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n knowledge = Knowledge.first(:idurl => (knowledge_idurl = params[:knowledge_idurl]))\n quizze = Quizze.first(:idurl => (quizze_idurl = params[:quizze_idurl]))\n quizze.question_idurls = params[:select_question_idurls]\n quizze.product_idurls = params[:select_product_idurls]\n quizze.save\n redirect_to(\"/quizzes/#{knowledge_idurl}/#{quizze_idurl}\")\n end", "def update\n respond_to do |format|\n if @admin_academy_question.update(admin_academy_question_params)\n format.html { redirect_to @admin_academy_question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_academy_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(data, options={})\n @hal_client.patch(href, data, options).tap do\n reset\n end\n end", "def update\n @survey_question.update(survey_question_params)\n @survey_question = SurveyQuestion.new\n @survey_questions = SurveyQuestion.all \n # respond_to do |format|\n # if @survey_question.update(survey_question_params)\n # format.html { redirect_to @survey_question, notice: 'Survey question was successfully updated.' }\n # format.json { render :show, status: :ok, location: @survey_question }\n # else\n # format.html { render :edit }\n # format.json { render json: @survey_question.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @talk = Talk.find(params[:id])\n if params[:add_link]\n unless params[:talk][:talklinks_attributes].blank?\n for attribute in params[:talk][:talklinks_attributes]\n @talk.talklinks.build(attribute.last.except(:_destroy)) unless attribute.last.has_key?(:id)\n end\n end\n @talk.talklinks.build\n render :action => 'edit'\n elsif params[:remove_link]\n removed_links = params[:talk][:talklinks_attributes].collect { |i, att| att[:id] if (att[:id] && att[:_destroy].to_i == 1) }\n Talklink.delete(removed_links)\n flash[:notice] = \"Links removed.\"\n for attribute in params[:talk][:talklinks_attributes]\n @talk.talklinks.build(attribute.last.except(:_destroy)) if (!attribute.last.has_key?(:id) && attribute.last[:_destroy].to_i == 0)\n end\n render :action => 'edit'\n else\n respond_to do |format|\n if @talk.update_attributes(params[:talk])\n format.html { redirect_to @talk, notice: 'Talk was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @talk.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to links_path}\n format.json { render :show, status: :ok, location: @link }\n else\n format.html { render :edit }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_question\n\t\t\tquizzes = current_instructor.quizzes\n\t\t\t@found = 0\n\t\t\tquizzes.each do |quiz|\n\t\t\t\tif(quiz.questions.exists?(:id => params[:question_id]))\n\t\t\t\t\t@found = @found + 1\n\t\t\t\tend \n\t\t\tend\n\t\t\tif (@found > 0)\n\t\t\t\tquestion = Question.find(params[:question_id])\n\t\t\t\tif (question.update(question_params))\n\t\t\t\t\trender json: { success: true, data: { :question => question }, info:{} }, status: 200\n\t\t\t\telse\n\t\t\t\t\trender json: { error: question.errors }, status: 422 \n\t\t\t\tend\t\n\t\t\telse\n\t\t\t\trender json: { error:\"Question is not found\" }, status: 422\n\t\t\tend\n\t\tend", "def update\n @poll_question = PollQuestion.find(params[:id])\n\n respond_to do |format|\n if @poll_question.update_attributes(params[:poll_question])\n format.html { redirect_to @poll_question, notice: 'Poll question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_api_v1_question\n @api_v1_question = Api::V1::Question.find(params[:id])\n end", "def update\n @questions_option = QuestionsOption.find(params[:id])\n\n respond_to do |format|\n if @questions_option.update_attributes(params[:questions_option])\n format.html { redirect_to @questions_option, notice: 'Questions option was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questions_option.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_question\n @question = Question.find(params[:id])\n @question.update(params[:question])\n redirect \"/questions/#{@question.id}\"\n end", "def update\n\n @poll.type_poll_id = params[:type_poll_id]\n respond_to do |format|\n\n if @poll.update(descripcion: poll_params[:descripcion], type_poll_id: params[:type_poll_id])\n @questions= params[:questions]\n if (@questions)\n @question_polls = QuestionPoll.where(poll_id: @poll.id)\n @question_polls.each do |question_poll|\n question_poll.destroy\n end\n @questions.each do |question_id|\n QuestionPoll.create(poll_id: @poll.id, question_id: question_id)\n end\n else\n @collections = Collection.all\n format.html { render '/postulates/chequeo', notice: 'Debe seleccionar por lo menos un recaudo' }\n end\n format.html { redirect_to '/polls' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n\n end\n\n end", "def update\n @answer.update(answer_params)\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def update\n @useful_link = UsefulLink.find(params[:id])\n\n respond_to do |format|\n if @useful_link.update_attributes(params[:useful_link])\n format.html { redirect_to @useful_link, notice: 'Useful link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @useful_link.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n \t# update tags\n \t@question.tag_with(params[:question][:tag_list])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def make_modification\n cur_resp = ResponseSet.where(:user_id => current_user, :access_code => params[:protocol_id]).first\n mod = ResponseSet.create(:user_id=>current_user.id,\n :survey_id => params[:survey_id])\n mod.parent_id = params[:protocol_id]\n mod.save\n resp_set_id = cur_resp.id\n responses = Response.where(:response_set_id => resp_set_id)\n responses.each do |resp| \n answer_attributes = Answer.find(resp.answer_id).attributes\n answer_attributes.delete(\"id\")\n answer_attributes.delete(\"api_id\")\n answer_attributes.delete(\"created_at\")\n answer_attributes.delete(\"updated_at\")\n new_answer = Answer.new(answer_attributes)\n new_answer.save\n resp_attributes = resp.attributes\n resp_attributes.delete(\"id\")\n resp_attributes.delete(\"api_id\")\n resp_attributes.delete(\"created_at\")\n resp_attributes.delete(\"updated_at\")\n resp_attributes[:answer_id] = new_answer.id\n resp_attributes[:response_set_id] = mod.id\n new_resp = Response.new(resp_attributes)\n new_resp.save\n end\n redirect_to :back\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to [@category, @question], notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @base_question = BaseQuestion.find(params[:id])\n\n respond_to do |format|\n if @base_question.update_attributes(params[:base_question])\n format.html { redirect_to @base_question, notice: 'Base question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @base_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_question.update(test_question_params)\n format.html { redirect_to @test_question, notice: 'Test question was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_question }\n else\n format.html { render :edit }\n format.json { render json: @test_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey_question = SurveyQuestion.find(params[:id])\n\n respond_to do |format|\n if @survey_question.update_attributes(params[:survey_question])\n format.html { redirect_to survey_questions_path(@survey_question.survey_id),\n notice: 'Survey question was successfully updated.' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @survey_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'DNS was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @link.update(link_params)\n format.html { redirect_to @link.pot, flash: {success: 'Link wurde aktualisiert.'} }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(question_params)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.post.update(embedded_post_params)\n format.js { head :no_content }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Neo4j::Transaction.run do\n @q_resource = QResource.find(params[:id])\n @q_resource.update_attributes!(params[:q_resource])\n respond_to do |format|\n if @q_resource.update_attributes(params[:q_resource])\n format.html { redirect_to @q_resource, :notice => 'Q resource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @q_resource.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n @survey_choice = Survey::Choice.find(params[:id])\n\n respond_to do |format|\n if @survey_choice.update_attributes(params[:survey_choice])\n format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_choice.errors, status: :unprocessable_entity }\n5 end\n end\n end", "def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @link = Link.find(params[:id])\n\n respond_to do |format|\n if @link.update_attributes(params[:link])\n format.html { redirect_to @link, notice: 'Link was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @link.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.650731", "0.64011365", "0.6293118", "0.6172139", "0.6054418", "0.59332246", "0.58732957", "0.5834798", "0.58216316", "0.5812505", "0.579367", "0.5769157", "0.576753", "0.574778", "0.5744626", "0.5710741", "0.5659557", "0.56441414", "0.56336343", "0.56285787", "0.5614193", "0.5591537", "0.5591537", "0.55858487", "0.55844885", "0.55551916", "0.5542018", "0.55371135", "0.55343753", "0.55250245", "0.55188066", "0.5517199", "0.55135965", "0.54764646", "0.5473734", "0.5466336", "0.54630697", "0.5456605", "0.54472023", "0.5446152", "0.54250973", "0.5405428", "0.54030675", "0.5402528", "0.53978753", "0.5395868", "0.53905", "0.53867096", "0.5385485", "0.5382304", "0.5377277", "0.53767633", "0.53742474", "0.5372276", "0.5353134", "0.5348444", "0.53482074", "0.53482074", "0.53482074", "0.53482074", "0.53482074", "0.5345808", "0.534451", "0.53438544", "0.5342304", "0.53421265", "0.53392804", "0.5336826", "0.53327185", "0.5332669", "0.53319496", "0.53308517", "0.5325646", "0.53207517", "0.531793", "0.5308279", "0.53000003", "0.52987605", "0.5297754", "0.52944076", "0.52938735", "0.5290904", "0.5287142", "0.52840877", "0.5273156", "0.5271273", "0.5267578", "0.5267544", "0.5266052", "0.5266052", "0.5266052", "0.52639663", "0.5263787", "0.52542937", "0.5252466", "0.52505887", "0.5248864", "0.52411556", "0.52406615", "0.52406615" ]
0.69223136
0
DELETE /setquestionlinks/1 DELETE /setquestionlinks/1.json
def destroy @setquestionlink.destroy respond_to do |format| format.html { redirect_to setquestionlinks_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @questionset = Questionset.find(params[:id])\n @questionset.destroy\n\n respond_to do |format|\n format.html { redirect_to questionsets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_link = QuizQuestion.find_by_id(@question.questionid)\n @quiz = Quiz.find_by_id(@question_link.quizid)\n @question_link.destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_quiz_path(@quiz), notice: 'Quiz multiple choice question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_set = QuestionSet.find(params[:id])\n @question_set.destroy\n\n respond_to do |format|\n format.html { redirect_to question_sets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n#status_url(Status.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:user_id => current_user)\n #@protocol = user_id.find_by_survey_id(protocol.access_code)\n #@p = ResponseSet.where(:question_id => @title_questions).first.string_value\n p= ResponseSet.where(:access_code => params[:id])\n p.first.destroy\n \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 @b_question.destroy\n respond_to do |format|\n format.html { redirect_to questions_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @quicklink.destroy\n respond_to do |format|\n format.html { redirect_to quicklinks_url }\n format.json { head :no_content }\n end\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @questionset.destroy\n respond_to do |format|\n format.html { redirect_to questionsets_url, notice: 'Questionset was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionable = @question.questionable\n @question.destroy\n respond_to do |format|\n format.html\n format.json { head :no_content }\n end\n end", "def destroy\n @test_question = TestQuestion.find(params[:id])\n @test_question.destroy\n\n respond_to do |format|\n format.html { redirect_to test_questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @question.destroy\n \n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'DNS was successfully removed.' }\n format.json { head :no_content }\n \nend\n end", "def destroy\n @examquestion.destroy\n respond_to do |format|\n format.html { redirect_to examquestions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted question successfully'}, status: :ok\n else\n render json: get_errors, status: :unprocessable_entity\n end\n\n end", "def delete_questions\n response = Request.delete_request(URL_QUESTION)\n if response.success?\n redirect '/upload-csv'\n end\nend", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to admin_questions_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @link_resource.destroy\n respond_to do |format|\n format.html { redirect_to @lab }\n format.json { head :no_content }\n end\n end", "def destroy\n #@question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_learned.destroy\n respond_to do |format|\n format.html { redirect_to question_question_learneds_path(@question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_url(params[:survey_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n head :no_content\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answer_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n\tend", "def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @survey_question_item = SurveyQuestionItem.find(params[:id])\n @survey_question_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_question_items_url }\n format.json { head :no_content }\n end\n end", "def delete_questions\n items = get_items\n\n\n keys = []\n items.map do |item|\n keys << {\n 'Question' => item['Question'],\n 'Answer' => item['Answer'].to_i\n }\n end\n\n keys.each do |key|\n DYNAMODB.delete_item({\n table_name: TABLE_NAME,\n key: key\n })\n end\n\n make_response(HttpStatus::OK, {meesage: 'questions deleted'})\nend", "def destroy\n\n @m_answer.destroy\n respond_to do |format|\n format.html { redirect_to m_question_path(@m_question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n\n head :no_content\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\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 destroy\n @questionnaire = Questionnaire.find(params[:id])\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 destroy\n @b_answer.destroy\n @b_question = BQuestion.find(params[:b_question_id])\n respond_to do |format|\n format.html { redirect_to b_question_path(@b_question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to quiz_path(@question.subsection_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @base_question = BaseQuestion.find(params[:id])\n @base_question.destroy\n\n respond_to do |format|\n format.html { redirect_to base_questions_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n destroy_and_respond(@link)\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy \n Link.connection.execute(\"delete from links where id in (#{params[:id].join(',')})\") unless params[:id].blank?\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @resources_and_link = ResourcesAndLink.find(params[:id])\n @resources_and_link.destroy\n\n respond_to do |format|\n format.html { redirect_to resources_and_links_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end", "def destroy\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n @multiple_choice_question.destroy\n\n respond_to do |format|\n format.html { redirect_to multiple_choice_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.active = !@question.active\n\n questions_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, questions_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully deleted\"\n redirect_to questions_path\n end", "def destroy\n @survey_question = SurveyQuestion.find(params[:id])\n @survey_question.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_questions_url }\n # format.json { head :no_content }\n end\n end", "def deletepublish\n @question = Publishquiz.find(:all, :conditions=>\"question_id=\"+params[:question]+\" and quiz_id=\"+session[:quizid])\n @question[0].destroy\n\n respond_to do |format|\n format.html { redirect_to(questions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @question_response = QuestionResponse.find(params[:id])\n @question_response.destroy\n\n respond_to do |format|\n format.html { redirect_to question_responses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rnaseq = Rnaseq.find(params[:id])\n @rnaseq.destroy\n\n respond_to do |format|\n format.html { redirect_to rnaseqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_question = MyQuestion.find(params[:id])\n @my_question.destroy\n\n respond_to do |format|\n format.html { redirect_to my_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: '투표안건이 성공적으로 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @qa = Qa.find(params[:id])\n @qa.destroy\n\n respond_to do |format|\n format.html { redirect_to qas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_option = QuestionOption.find(params[:id])\n check_forged_path\n @question_option.destroy\n\n respond_to do |format|\n format.json { head :ok }\n format.xml { head :ok }\n end\n end", "def destroy\n\t\t#@answer.destroy\n\t\t#respond_to do |format|\n\t\t#\tformat.html { redirect_to answers_url }\n\t\t#\tformat.json { head :no_content }\n\t\t#end\n\n\tend", "def destroy\n @attempt_question.destroy\n respond_to do |format|\n format.html { redirect_to attempt_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @parent_question.destroy\n respond_to do |format|\n format.html { redirect_to parent_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @jakeslink = Jakeslink.find(params[:id])\n @jakeslink.destroy\n\n respond_to do |format|\n format.html { redirect_to jakeslinks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @v1_answer.destroy\n end", "def destroy\n @tasklink = Tasklink.find(params[:id])\n @tasklink.destroy\n\n respond_to do |format|\n format.html { redirect_to tasklinks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @storylink = Storylink.find(params[:id])\n @storylink.destroy\n\n respond_to do |format|\n format.html { redirect_to storylinks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_answer = ClientAnswer.find(params[:id])\n @client_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to client_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questions_option = QuestionsOption.find(params[:id])\n @questions_option.destroy\n\n respond_to do |format|\n format.html { redirect_to questions_options_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @exam_set.destroy\n respond_to do |format|\n format.html { redirect_to exam_sets_url, notice: 'Exam set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @question = Question.find(params[:question_id])\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @question }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to paper_questions_path, notice: '題目已被成功刪除' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to category_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_question.destroy\n respond_to do |format|\n format.html { redirect_to test_questions_url, notice: 'Test question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_question.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url, notice: 'Question was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_type = QuestionType.find(params[:id])\n @question_type.destroy\n\n respond_to do |format|\n format.html { redirect_to question_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_question\n question_params = params.permit(:id, :form_id, :question_type_id)\n\n render json: Question.delete_question(question_params)\n end", "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @question.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'La pregunta ha sido eliminada!' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz_answer.destroy\n respond_to do |format|\n format.html { redirect_to quiz_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # before_action :set_question\n @question.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: \"質問を削除しました\" }\n format.json { head :no_content }\n end\n end" ]
[ "0.6963999", "0.6888334", "0.68757546", "0.6780139", "0.67669904", "0.67380655", "0.6661244", "0.6661244", "0.6659347", "0.6642675", "0.6605192", "0.66041017", "0.6569903", "0.65624434", "0.65621936", "0.65567404", "0.6549401", "0.65439034", "0.6537834", "0.65244365", "0.6522293", "0.65130234", "0.65040475", "0.65040475", "0.65040475", "0.65040475", "0.65040475", "0.65040475", "0.64981717", "0.64847606", "0.64844716", "0.6479632", "0.64681375", "0.6457758", "0.6449405", "0.6443346", "0.6440669", "0.6439844", "0.6437185", "0.64371365", "0.64371365", "0.64306796", "0.6418687", "0.64179677", "0.6413553", "0.6413052", "0.6410293", "0.64052176", "0.64049727", "0.64049727", "0.64049727", "0.64049727", "0.64049727", "0.64049727", "0.64047325", "0.6404459", "0.6404423", "0.6403715", "0.6403715", "0.64001596", "0.6395401", "0.6394554", "0.63944376", "0.63930786", "0.63896453", "0.6388816", "0.63746804", "0.6373119", "0.6373119", "0.6367501", "0.63674974", "0.63528526", "0.6347111", "0.6342492", "0.6335076", "0.63321793", "0.6330861", "0.6329807", "0.63178414", "0.6307247", "0.6302058", "0.62927496", "0.62917805", "0.628562", "0.6285337", "0.62853277", "0.62841356", "0.62823045", "0.62820315", "0.62820315", "0.62772745", "0.6276506", "0.62760043", "0.62732846", "0.6271042", "0.627021", "0.62667793", "0.6264076", "0.6261453", "0.6261427" ]
0.77665687
0
Use callbacks to share common setup or constraints between actions.
def set_setquestionlink @setquestionlink = Setquestionlink.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 setquestionlink_params params.require(:setquestionlink).permit(:set_id, :question_id, :follower_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
Set the response status code and header
def redirect_to(url) raise DoubleRenderError if already_built_response? res.header['location'] = url res.status = 302 @already_built_response = true session.store_session(res) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status(code)\n @response.status = code\n end", "def send_headers response_code\n end", "def status(code)\n response.status = code\n end", "def set_status_code\n if self.status_code.nil?\n self.status_code = \"200\"\n end\n end", "def response_status(kind)\n response.headers['status'] = kind.to_s\n end", "def http_response_code(status = nil)\n if status\n @status = status\n else\n @status\n end\n end", "def status code=nil\n @response.status = code if code\n @response.status\n end", "def write_status(response)\n response.setStatus(@status.to_i)\n end", "def respond_with(status_code)\n response.status = status_code\n response.write \"\"\n nil\n end", "def set_http_code(h_c)\n if h_c.nil?\n @http_code = 200\n else\n @http_code = h_c.to_i\n end\n end", "def respond_with(status_code)\n response.status = status_code\n response.write ''\n nil\n end", "def set_status(status)\n if status.kind_of?(Symbol)\n status = Merb::ControllerExceptions::STATUS_CODES[status]\n status || raise(\"Can't find a response code with that name\")\n end\n @_status = status\n end", "def set_response(response, body, status = 200)\n raise NotImplementedError\n end", "def set_response(response, body, status = 200)\n raise NotImplementedError\n end", "def status(value = nil)\n\t\t\tresponse.status ||= 200\n\t\t\tresponse.headers['X-Cascade'] = 'pass' if value == 404\n\t\t\tvalue ? response.status = value : response.status\n\t\tend", "def send_by_code request, response, code, headers = {}\n\t\t\t\tbegin\n\t\t\t\t\tresponse.status = code\n\t\t\t\t\theaders.each {|k, v| response[k] = v}\n\t\t\t\t\treturn ErrorCtrl.new(request, response).index\n\t\t\t\trescue => e\n\t\t\t\t\tPlezi.error e\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend", "def setup_status_and_body\n @status, @body = @response.status, @response.body # TODO: Need to status.to_i?\n end", "def set_header name, value\n response_object.header name, value\n end", "def headers\n { 'Status' => ActionController::Base::DEFAULT_RENDER_STATUS_CODE }\n end", "def set_error(status)\n error_response = Rack::Response.new\n error_response.status = status\n @error_response = error_response.finish {yield}\n end", "def report_response_status\n status = parsed_content.response_status\n request.update_attributes(status: status)\n end", "def flex_error_handling\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(422)\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(201)\n end", "def ok; @status = 200 end", "def ok; @status = 200 end", "def set_status(code)\n new(\n status: code\n )\n end", "def status_code\n @response.status\n end", "def response_headers! http_status_code = 200, http_with_version = 'HTTP 1.1', header_hash\n errors = header_hash.each_with_object [] do |(key, val), errors|\n key = key.to_s; val = val.to_s\n rv = Wrapper.msc_add_n_response_header txn_ptr, (strptr key), key.bytesize, (strptr val), val.bytesize\n rv == 1 or errors << \"msc_add_n_response_header failed adding #{[key,val].inspect}\"\n end\n\n raise Error, errors if errors.any?\n\n rv = Wrapper.msc_process_response_headers txn_ptr, (Integer http_status_code), (strptr http_with_version)\n rv == 1 or raise \"msc_process_response_headers failed\"\n\n intervention!\n end", "def send_status( status )\n self.status = ::Rack::Utils.status_code( status )\n self.write ::Rack::Utils::HTTP_STATUS_CODES[ self.status ]\n end", "def response code=nil, body=nil, headers=nil\n args = [code, body, headers].compact\n\n headers = {'Content-Type' => DEFAULT_CONTENT_TYPE}\n code = 200\n body = \"\"\n\n args.each do |arg|\n case arg\n when Hash then headers.merge!(arg)\n when String then body = arg\n when Integer then code = arg\n end\n end\n\n [code, headers, body]\n end", "def give_X(response, status, mime_type, msg)\n\theaders = response.headers\n\tresponse.status =status\n\tresponse.body = [msg]\n\tresponse.headers[\"Content-Type\"] = mime_type\n\tresponse.headers[CONTENT_LENGTH] = response.body.join.length.to_s\n end", "def downstream_resp=(status_headers_body)\n @status, @headers, @body = status_headers_body\n end", "def headers=(new_headers)\n @_response ||= ActionDispatch::Response.new\n @_response.headers.replace(new_headers)\n end", "def status(value=nil)\n response.status = value if value\n response.status\n end", "def status(code, message)\n self.status = code\n self.body = message\n end", "def status(code, message)\n self.status = code\n self.body = message\n end", "def render_header\n response_header = \"#{@version} #{@status} #{@reason}#{CRLF}\"\n\n unless @headers.empty?\n response_header << @headers.map do |header, value|\n \"#{header}: #{value}\"\n end.join(CRLF) << CRLF\n end\n\n response_header << CRLF\n end", "def status_code(val = nil)\n if val\n @j_del.setStatusCode(val)\n self\n else\n @j_del.getStatusCode\n end\n end", "def status_code; end", "def headers\n @headers.merge({ \"Status\" => @status })\n end", "def status_code\n response_value(:code)\n end", "def response_code; end", "def response_code; end", "def response_code; end", "def response_code; end", "def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end", "def fill_header(response); end", "def parse_response_line\n if @headers.first =~ /\\AHTTP\\/1\\.[01] ([\\d]{3})/\n @status = $1.to_i\n else\n set_deferred_status :failed, {\n :status => 0 # crappy way of signifying an unrecognized response. TODO, find a better way to do this.\n }\n close_connection\n end\n end", "def prepare_status_response( request, status_info )\n\t\tstatus_code, message = status_info.values_at( :status, :message )\n\t\tself.log.info \"Non-OK response: %d (%s)\" % [ status_code, message ]\n\n\t\trequest.notes[:status_info] = status_info\n\t\tresponse = request.response\n\t\tresponse.reset\n\t\tresponse.status = status_code\n\n\t\t# Some status codes allow explanatory text to be returned; some forbid it. Append the\n\t\t# message for those that allow one.\n\t\tunless request.verb == :HEAD || response.bodiless?\n\t\t\tself.log.debug \"Writing plain-text response body: %p\" % [ message ]\n\t\t\tresponse.content_type = 'text/plain'\n\t\t\tresponse.puts( message )\n\t\tend\n\n\t\t# Now assign any headers to the response that are part of the status\n\t\tif status_info.key?( :headers )\n\t\t\tstatus_info[:headers].each do |hdr, value|\n\t\t\t\tresponse.headers[ hdr ] = value\n\t\t\tend\n\t\tend\n\n\t\treturn response\n\tend", "def set_status(status_code, fetch = false)\n case status_code\n when /1../\n @status = :running\n when \"200\"\n @status = :completed\n fetch_result if fetch\n when /4../\n @status = :error\n end\n end", "def index\n head params[:response_status]\n end", "def ok_status_code\n _undefined\n end", "def set_redirect_error_status(status)\n end", "def update!(**args)\n @response_status_code = args[:response_status_code] if args.key?(:response_status_code)\n end", "def prepare_response(status, headers, body)\n status_reason_phrase = STATUS_REASON_PHRASES[status]\n header_lines = headers.map { |key, value| \"#{key}: #{value}\" }\n <<~EOF\n HTTP/1.1 #{status} #{status_reason_phrase}\n #{header_lines.join(\"\\n\")}\n\n #{body}\n EOF\n end", "def error(code=500, body = nil)\n unless code.is_a?(Integer)\n body = code\n code = 500\n end\n\n response.status = code\n response.body = body if body\n halt\n end", "def respond status:, headers: {}, body: ''\n @stream.respond status: status, headers: headers, body: body\n end", "def status(stat)\n @headers << \"HTTP/1.1 #{stat}\\r\\n\"\n @accepted = true\n end", "def add_response_header(key, value)\n new(\n response_headers: ConnSupport::Headers.add(\n response_headers, key, value\n )\n )\n end", "def set_result\n raw.data.status_code = raw.statusCode\n raw.data.status_text = raw.statusText\n @result = raw.data\n end", "def status_code\n wrapper.status_code.to_i\n end", "def http_status\n self[:status_code]\n end", "def set_response(response, result, status = 200)\n response.status = status\n unless result.is_a?(File)\n response.write result\n else\n response[\"Content-Length\"] = result.stat.size.to_s\n response.body = RackFile.new(result)\n end\n end", "def page_status\n @status = \"OK\"\n @status = \"ERR\" if self.response_code > 399\n end", "def initialize\n @headers = {}\n @trace = []\n self.code = 200\n self.redirect = false \n end", "def update_response(processed)\n case processed\n when Integer then response.status = processed\n when String,NilClass then response.body << processed.to_s\n when Array\n response.status = processed[0].to_i\n if response.respond_to?(:headers=)\n response.headers = processed[1]\n else\n processed[1].each do |key, value|\n response[key] = value\n end\n end\n response.body = processed[2].respond_to?(:each) ? processed[2] : [processed[2]]\n when Hash\n response.status = processed[:status].to_i if processed.key?(:status)\n response.headers.update(processed[:headers]) if processed.key?(:headers)\n response.body = processed[:body].respond_to?(:each) ? processed[:body] : [processed[:body]] if processed.key?(:body)\n end\n end", "def http_response(response)\n status_code, headers, body = response\n http_response = status_line(status_code)\n DefaultResponseHeaders.merge(headers).each do |k,v|\n http_response << \"#{k}: #{v}\\r\\n\"\n end\n http_response << \"\\r\\n\"\n body.each do |s|\n http_response << s\n end\n http_response\n end", "def set_status( statuscode )\n\t\t\tself.log.warn \"Unknown status code %d\" unless CLOSING_STATUS_DESC.key?( statuscode )\n\t\t\tstatus_msg = \"%d %s\" % [ statuscode, CLOSING_STATUS_DESC[statuscode] ]\n\n\t\t\tself.payload.truncate( 0 )\n\t\t\tself.payload.puts( status_msg )\n\t\tend", "def http_status_line(code = 200)\n \"#{HTTP_VERSION} #{code} #{Shelf::Utils::HTTP_STATUS_CODES[code]}\"\n end", "def header_set(name, value)\n return dup_without_response.header_set(name, value) if response\n\n name = name.to_s\n if value.nil?\n @headers.delete name\n return self\n end\n\n @headers[name] = value.to_s\n self\n end", "def http_status(hs=nil)\n @_http_status = hs unless hs.nil?\n @_http_status\n end", "def status_code\n STATUS_CODE\n end", "def header(str)\n # {{{\n if @output_started\n raise \"HTTP-Headers are already send. You can't change them after output has started!\"\n end\n unless @output_allowed\n raise \"You just can set headers inside of a Rweb::out-block\"\n end\n if str.is_a?Array\n str.each do | value |\n self.header(value)\n end\n\n elsif str.split(/\\n/).length > 1\n str.split(/\\n/).each do | value |\n self.header(value)\n end\n\n elsif str.is_a? String\n str.gsub!(/\\r/, \"\")\n\n if (str =~ /^HTTP\\/1\\.[01] [0-9]{3} ?.*$/) == 0\n pattern = /^HTTP\\/1.[01] ([0-9]{3}) ?(.*)$/\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n elsif (str =~ /^status: [0-9]{3} ?.*$/i) == 0\n pattern = /^status: ([0-9]{3}) ?(.*)$/i\n\n result = pattern.match(str)\n self.setstatus(result[0], result[1])\n else\n a = str.split(/: ?/, 2)\n\n @header[a[0].downcase] = a[1]\n end\n end\n # }}}\n end", "def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end", "def response\n [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup ]\n end", "def initialize(status_code, headers={}, body='')\n @status_code = status_code.to_i\n @headers = headers\n @body = body\n end", "def status(value)\n phpcall :header, \"HTTP/1.1 #{frucnatra_http_statuses[value]}\"\n end", "def initialize\n @headers = HeaderHash.new\n @trace = []\n self.code = 200\n self.redirect = false\n end", "def get_http_response_code\n raise 'To be implemented in child classes'\n end", "def set_http_response(response, skip_body=false)\n @data[:response][:instance] = HTTPResponse.new(\n response.code,\n skip_body ? nil : response.body,\n response.to_hash,\n response\n )\n nil\n end", "def write_headers(response)\n @headers.each do |key, value|\n case key\n when /^Content-Type$/i\n response.setContentType(value.to_s)\n when /^Content-Length$/i\n length = value.to_i\n # setContentLength(int) ... addHeader must be used for large files (>2GB)\n response.setContentLength(length) if ! chunked? && length < 2_147_483_648\n else\n # servlet container auto handle chunking when response is flushed \n # (and Content-Length headers has not been set) :\n next if key == TRANSFER_ENCODING && skip_encoding_header?(value)\n # NOTE: effectively the same as `v.split(\"\\n\").each` which is what\n # rack handler does to guard against response splitting attacks !\n # https://github.com/jruby/jruby-rack/issues/81\n if value.respond_to?(:each_line)\n value.each_line { |val| response.addHeader(key.to_s, val.chomp(\"\\n\")) }\n elsif value.respond_to?(:each)\n value.each { |val| response.addHeader(key.to_s, val.chomp(\"\\n\")) }\n else\n case value\n when Numeric\n response.addIntHeader(key.to_s, value.to_i)\n when Time\n response.addDateHeader(key.to_s, value.to_i * 1000)\n else\n response.addHeader(key.to_s, value.to_s)\n end\n end\n end\n end\n end", "def response_to_status(response)\n response ? :success : :error\n end", "def json_error_response\n # status must be assigned, ||= will often return 200\n self.status = 401\n self.content_type = \"application/json\"\n # have to include format_json here because custom error app\n # doesn't seem to call render json: as normal\n # so pretty param is ignored\n self.response_body = format_json(\n { errors: [{ status: status, detail: i18n_message }] },\n {} # options hash normally handled by render block\n )\n end", "def update_visit_response(status)\n if request.xhr?\n head :status => status\n else\n respond_to do |format|\n # send 'em back to where they came from\n format.html { redirect_to request.headers['HTTP_REFERER'] }\n end\n end\n end", "def status\n @status ||= raw_response['responseHeader']['status']\n end", "def put(_status, headers, env)\n check_precondition!(env)\n\n if exists?\n update(env['rack.input'], env['CONTENT_TYPE'])\n headers = update_headers(headers)\n [200, headers, self]\n else\n create(env['rack.input'], env['CONTENT_TYPE'])\n [201, update_headers(headers), self]\n end\n end", "def getStatusCode\n @_statusCode\n end", "def respond(status_code, body = nil, **headers)\n # Log response\n log = \"RESPONSE [#{ status_code }] #{ body }\"\n Yake.logger&.send(status_code.to_i >= 400 ? :error : :info, log)\n\n # Set headers\n content_length = (body&.bytesize || 0).to_s\n to_s_downcase = -> (key) { key.to_s.downcase }\n headers = {\n 'content-length' => content_length,\n **(@headers || {}),\n **headers,\n }.transform_keys(&to_s_downcase).compact\n\n # Send response\n { statusCode: status_code, headers: headers, body: body }.compact\n end", "def processresponse(httpresponse)\n\n @responsecode = httpresponse.code\n case httpresponse.code\n when 201 # success condition\n @response = httpresponse.headers[:location]\n when 200 # success condition\n @response = httpresponse.headers[:location]\n\n end\n\n end", "def set_error(error_code, msg, status_code=nil)\n return if @error\n @error = {:code => error_code, :message => msg} \n @status_code = status_code || 500\n end", "def error!(status, message)\n response.status = status\n response[\"Content-Type\"] = \"application/json\"\n response.write({error: message}.to_json)\n request.halt\n end", "def code\n @http_response.code.to_i\n end", "def render_error( status_code )\n\n respond_to do |format|\n\n format.html { render( action: status_code, status: status_code )}\n format.all { head( status_code )}\n\n end\n\n @error_sent = true\n\n true # return something so we can chain things\n\n end", "def status_code\n @parser.status_code\n end", "def head(status, additional_headers = {})\n @response_status = status\n response_headers.merge!(additional_headers)\n response_headers.merge!({\"Access-Control-Allow-Origin\": ENV[\"ACCESS_CONTROL_ALLOW_ORIGIN\"]})\n end", "def throw(code)\n status(*Http::Status.for_code(code))\n super :halt\n end", "def hit_status(env)\n env&.response_headers&.fetch(@http_header, nil) ||\n env&.request_headers&.fetch(@http_header, nil)\n end", "def status_error\n @status = 500\n end", "def add_response_header(name, type, description)\n name = name.to_s\n check_duplicate(name, 'Response header')\n @response_headers[name] = SwaggerResponseHeader.new(name, type, description)\n end", "def add_headers; end", "def status\n head :ok\n end", "def status\n head :ok\n end" ]
[ "0.794432", "0.78250635", "0.78158605", "0.757165", "0.74761254", "0.73475385", "0.7225574", "0.7152764", "0.71213555", "0.70445", "0.6923586", "0.6883578", "0.68797094", "0.68797094", "0.687684", "0.68444437", "0.678412", "0.6782564", "0.6771085", "0.6747486", "0.67410016", "0.67410016", "0.6716454", "0.6716454", "0.6714426", "0.6536794", "0.65323335", "0.6526737", "0.64911133", "0.64798373", "0.6477403", "0.64520526", "0.6445438", "0.643101", "0.643101", "0.64280444", "0.64021456", "0.6384643", "0.63749105", "0.6373129", "0.6361735", "0.6361735", "0.6361735", "0.6361735", "0.6349169", "0.6305716", "0.6297084", "0.6288668", "0.62847036", "0.6283818", "0.6281522", "0.628102", "0.6273195", "0.6261495", "0.6257526", "0.6246483", "0.62404644", "0.62202144", "0.6219443", "0.6211866", "0.6210467", "0.6206887", "0.6204738", "0.6202401", "0.6190686", "0.6186212", "0.6184355", "0.61812913", "0.61777604", "0.61486214", "0.6122018", "0.6105089", "0.6103174", "0.6103174", "0.6079447", "0.60788506", "0.60786307", "0.60626024", "0.60476136", "0.6039038", "0.6027417", "0.60095006", "0.6008609", "0.5964368", "0.59524024", "0.5949451", "0.59359485", "0.5925512", "0.5914793", "0.5906869", "0.59060925", "0.58870137", "0.58711183", "0.58701426", "0.586893", "0.5866952", "0.5866841", "0.5854485", "0.58520186", "0.58388066", "0.58388066" ]
0.0
-1
Populate the response with content. Set the response's content type to the given type. Raise an error if the developer tries to double render.
def render_content(content, content_type) raise DoubleRenderError if already_built_response? res['Content-Type'] = content_type res.body = [content] @already_built_response = true session.store_session(res) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_content(content, type)\n if already_built_response?\n raise\n else\n res.content_type = type\n res.body = content\n end\n @already_built_response = true\n @session.store_session(res) if @session\n @flash.store_flash(res) if @flash\n end", "def render_content(content, type)\n raise Exception.new(\"Already Rendered Response\") if already_built_response?\n @response.body = content\n @response['Content-Type'] = type\n @session.store_session(@response) if @session\n @flash.store_flash(@response) if @flash\n @already_built_response = true\n end", "def render_content(content, content_type)\n raise \"Already built response!\" if already_built_response?\n @res.body = content\n @res.content_type = content_type\n @already_built_response = true\n session.store_session(@res)\n flash.store_flash(@res)\n end", "def render_content(content, content_type)\n raise if already_built_response?\n @res.content_type = content_type\n @res.body = content\n @already_built_response = true\n @session.store_session(@res)\n end", "def render_content(content, type)\n raise \"already built response\" if already_built_response?\n self.session.store_session(@res)\n self.flash.store_flash(@res)\n @res.content_type = type\n @res.body = content\n @already_built_response = true\n end", "def render_content(content, content_type = 'text/html')\n if self.already_built_response?\n raise \"Double render error!\"\n else\n @res.write(content)\n @res['Content-Type'] = content_type\n @already_built_response = true\n nil\n end\n end", "def render_content(content, content_type)\n unless already_built_response?\n @res.content_type = content_type\n @res.body = content\n @already_built_response = true\n else\n fail\n end\n session.store_session(res)\n end", "def render_content(content, content_type)\n if already_built_response?\n raise \"double render\"\n else\n res['Content-Type'] = content_type\n res.write(content)\n store_flash_and_session(res)\n @already_built_response = true\n end\n end", "def render_content( content, content_type )\n prepare_response do\n res.content_type = content_type\n res.write( content )\n end\n end", "def render_content(content, type)\n #response = HTTPResponse.new(content_type: type, body: content)\n self.res.body, self.res.content_type = content, type\n session.store_session(self.res)\n\n if already_rendered?\n raise \"Can't render/redirect twice\"\n end\n\n #following might be wrong b/c of no setter\n @already_built_response = true\n nil\n #response\n end", "def render_content(content, type)\n check_already_rendered\n session.store_session(response)\n response.content_type = type\n response.body = content\n @already_rendered = true\n end", "def render_content(content, content_type)\n raise 'Already responded' if already_built_response?\n \n res['Content-Type'] = content_type\n res.write(content)\n @already_built_response = true\n session.store_session(res)\n end", "def render_content(content, content_type)\n raise \"Already delivered response\" if self.already_built_response?\n res['Content-Type'] = content_type\n res.write(content)\n @already_built_response = true\n self.session.store_session(res)\n self.flash.store_flash(res)\n end", "def render_content(body, content_type)\n @res.content_type = content_type\n @res.body = body\n @already_built_response = true\n session.store_session(@res)\n end", "def render_content(content, content_type)\n raise \"double render error\" if constructed_response?\n\n @response.write(content)\n @response['Content-Type'] = content_type\n\n @constructed_response = true\n\n session.store_session(@response)\n\n nil\n end", "def render_content(content, content_type)\n if !already_built_response?\n @res.body = content\n @res.content_type = content_type\n @already_built_response = true\n else\n raise \"exception\"\n end\n session.store_session(res)\n # storing the flash will fail the last spec\n flash.store_flash(res)\n end", "def render_content(content, content_type)\n raise \"Double Render Error\" if already_built_response?\n\n # set content_type attribute in header equiv to set_header\n @res['Content-type'] = content_type\n\n # sets body\n @res.write(content)\n @already_built_response = true\n\n # sets cookie in response (as cookie for client to save)\n # just keep on adding stuff to the response (until res.finish is called in server)\n session.store_session(@res)\n end", "def render(*args) #:nodoc:\n raise ::AbstractController::DoubleRenderError if self.response_body\n super\n self.content_type ||= rendered_format.to_s\n self.response_body\n end", "def fixup_response_content_type( response )\n\n\t\t# Make the error for returning something other than a Response object a little\n\t\t# nicer.\n\t\tunless response.respond_to?( :content_type )\n\t\t\tself.log.error \"expected response (%p, a %p) to respond to #content_type\" %\n\t\t\t\t[ response, response.class ]\n\t\t\tfinish_with( HTTP::SERVER_ERROR, \"malformed response\" )\n\t\tend\n\n\t\trestype = response.content_type\n\n\t\tif !restype\n\t\t\tif (( default = self.class.default_type ))\n\t\t\t\tself.log.debug \"Setting content type of the response to the default: %p\" %\n\t\t\t\t\t[ default ]\n\t\t\t\tresponse.content_type = default\n\t\t\telse\n\t\t\t\tself.log.debug \"No default content type\"\n\t\t\tend\n\t\telse\n\t\t\tself.log.debug \"Content type already set: %p\" % [ restype ]\n\t\tend\n\tend", "def render_content(content, content_type=\"text/html\")\n if already_built_response?\n raise \"DoubleRenderError\" \n else \n @res['Content-Type'] = content_type\n @res.write(content) \n session.store_session(res)\n @already_built_response = true \n \n end \n \n end", "def render_content(content, content_type, cached=false)\n raise \"Already built response!\" if already_built_response?\n @res['Content-Type'] = content_type\n if cached\n @res['Cache-Control'] = \"public; max-age=31536000\"\n @res['Expires'] = (Time.now + 1.year).httpdate\n end\n @res.write(content)\n finalize_response(:render)\n end", "def render_content(content, content_type)\n raise \"double render error\" if @already_built_response\n\n res.write(content)\n res['Content-Type'] = content_type\n\n @already_built_response = true\n\n @session.store_session(res)\n nil\n end", "def content_type! type = nil, charset = nil\n __e__.explicit_charset = charset if charset\n charset ||= (content_type = response['Content-Type']) &&\n content_type.scan(%r[.*;\\s?charset=(.*)]i).flatten.first\n type && (Symbol === type) && (type = '.' << type.to_s)\n content_type = type ?\n (type =~ /\\A\\./ ? '' << mime_type(type) : type.split(';').first) : 'text/html'\n content_type << '; charset=' << charset if charset\n response['Content-Type'] = content_type\n end", "def set_content_type(response, format)\n raise NotImplementedError\n end", "def set_content_type(response, format)\n raise NotImplementedError\n end", "def render_content(content, content_type)\n count = 0\n \n res = Rack::Response.new()\n\n @res.write(content)\n res[\"Content-Type\"] = content_type\n\n if @res.write \n count+= 1\n end\n\n if count > 1\n return @already_built_response = raise \"Double render error\"\n end\n\n end", "def set_content_type\n response.headers[\"Content-Type\"] = \"text/html; charset=#{Comatose.config.content_type}\" unless Comatose.config.content_type.nil?\n end", "def set_content_type\n response.headers[\"Content-Type\"] = \"text/html; charset=#{Comatose.config.content_type}\" unless Comatose.config.content_type.nil? or response.headers['Status'] == '404 Not Found'\n end", "def default_render\n response.content_type.blank? ? respond_to(:html) : super \n end", "def set_content_type raw_type\n response_object.mime_raw raw_type\n end", "def content_type!(ext)\n case ext.downcase\n when 'haml'; t = 'text/html'\n when 'erb'; t = 'text/html'\n# I believe all the rest are determined accurately by the Rack::Mime.mime_type call in the else clause below.\n# when 'html'; t = 'text/html'\n# when 'js'; t = 'text/javascript'\n# when 'css'; t = 'text/css'\n# when 'png'; t = 'image/png'\n# when 'gif'; t = 'image/gif'\n# when 'jpg'; t = 'image/jpeg'\n# when 'jpeg'; t = 'image/jpeg'\n else t = Rack::Mime.mime_type('.' + ext, 'text/plain')\n end\n #puts(\"----#{ext}:\" + t.inspect) # dbg\n (self.response[:headers]['Content-Type'] = t) if t\n end", "def render(*args, &block)\n options = _normalize_render(*args, &block)\n rendered_body = render_to_body(options)\n if options[:html]\n _set_html_content_type\n else\n _set_rendered_content_type rendered_format\n end\n _set_vary_header\n self.response_body = rendered_body\n end", "def handle\n @response.response_code = response_code\n @response.content = view\n @response.layout = set_layout\n @response.output_format = @request.path_info.split(\".\").last\n end", "def content_type=(ctype)\n @response_headers[\"Content-Type\"] = ctype\n end", "def content_type\n self.class.response_content_type\n end", "def set_content_type\n case params['format']\n when 'xml'\n response.headers['Content-Type'] = \"application/xml; charset=utf-8\"\n when 'json', 'csv'\n response.headers['Content-Type'] = \"application/json; charset=utf-8\"\n else\n raise \"Unexpected format!\"\n end\n end", "def respond_to\n env['HTTP_ACCEPT'] ||= 'text/html'\n Rack::RespondTo.env = env\n\n super { |format|\n yield(format).tap do |response|\n type = Rack::RespondTo::Helpers.match(Rack::RespondTo.media_types, format).first\n content_type(type) if type\n end\n }\n end", "def content_type\n @response['content-type'].nil? ? 'text/plain' : @response['content-type']\n end", "def content_types(*content_types)\n Sinatra::RPC::Serializer.register self, content_types\n @response_content_type = content_types.compact.first\n end", "def content_type\n @meta_content_type || response['content-type']\n end", "def content_type\n @meta_content_type || response['content-type']\n end", "def content_type\n @content_type ||= @response_impl.entity.content_type.value\n end", "def respond_with_content_type(*args, &block)\n options = args.extract_options!\n options.merge!(:content_type => args.first)\n RespondWithMatcher.new(options, &block).spec(self)\n end", "def render(*args, &block)\n options = args.last.is_a?(Hash) ? args.pop : {}\n @response.status = options.delete(:status) || 200\n layout = @layouts[options.delete(:layout) || :default]\n assigns = { :request => request, :response => response, :params => params, :session => session }\n @content = args.last.is_a?(String) ? args.last : Markaby::Builder.new(assigns, self, &(block || @views[args.last])).to_s\n @content = Markaby::Builder.new(assigns, self, &layout).to_s if layout\n @response.headers.merge!(options)\n @response.body = @content\n end", "def content_type(type=nil, params={})\n return @_content_type unless type\n super(type, params)\n @_content_type = type\n end", "def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend", "def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend", "def content_type(type)\n @headers << \"Content-Type: #{type}\\r\\n\"\n @content_type = true\n end", "def render(*args, &block)\n\t options = _normalize_render(*args, &block)\n\t self.response_body = render_to_body(options)\n\t _process_format(rendered_format, options) if rendered_format\n\t self.response_body\n\t end", "def content_type=(content_type); end", "def parse_response(response)\n if response['content-type']\n [ response['content-type'].gsub(/\\s*;.*$/,''), response.body ]\n else\n raise _(\"No content type in http response; cannot parse\")\n end\n end", "def content_type=( type )\n\t\treturn self.headers[ :content_type ] = type\n\tend", "def content\n try(content_type)\n end", "def content_type(type)\n @response.content_type == type\n end", "def content_type=(type)\n @content_type = type\n end", "def content_type_switch\n\t\t@old_content_type = params[:old_content_type]\n\t\t@content_type = params[:content_type];\n\t\tif @old_content_type != @content_type\n\t\t\t@content = render_to_string :partial=>'convert_content',\n\t\t\t\t:locals=>{:content=>params[:content],\n\t\t\t\t\t:from_type=>@old_content_type,\n\t\t\t\t\t:to_type=>@content_type}\n\t\telse\n\t\t\t@content = params[:content]\n\t\tend\n\t\t@page = Page.new(:content=>@content, :content_type=>@content_type)\n\t\t#render :layout=>false\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.js { render :layout=>false }\n\t\t\tformat.xml { render :xml=>@page.to_xml }\n\t\tend\n\tend", "def parse_response(response)\n if response['content-type']\n [ response['content-type'].gsub(/\\s*;.*$/,''), uncompress_body(response) ]\n else\n raise _(\"No content type in http response; cannot parse\")\n end\n end", "def call(request)\r\n response = super(request)\r\n \r\n if not response.nil? and response.headers['Content-Type']=='text/html'\r\n response.data = ERB.new(response.data +\r\n File.open(@template, \"rb\").readlines.join).result(binding)\r\n end\r\n \r\n response\r\n end", "def content_type=(value)\n raise ArgumentError, \"content_type must be set to :data or :header, was: #{value.inspect}\" unless [:data, :header].include?(value)\n @content_type = value\n end", "def response_content_type_with_charset(request, config)\n content_type_with_charset(\n response_content_type(request, config),\n config.default_charset || Action::DEFAULT_CHARSET\n )\n end", "def set_content_type(content_type)\n set_header 'Content-Type', content_type\n end", "def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end", "def content_type(type=nil, params={})\n type.nil? ? @_content_type : super(type, params)\n end", "def content_type\n return blank_type if @headers.nil?\n \n # if no content type is supplied return and empty string instead of nil\n Page.content_type_sanitize( @headers['content-type'] ) \n end", "def render_content(content, content_type)\n super(content, content_type)\n @session.store_session(@res)\n end", "def content_type\n response&.response&.content_type\n end", "def content_type\n self[:content_type] == 'haml' ? 'text/html' : self[:content_type]\n end", "def content_type=(type)\n\t\t\tif type.index(C_slash)\n\t\t\t\t@content_type = type\n\t\t\telse\n\t\t\t\t@content_type = MIME::Types.type_for(type).first || BINARY_TYPE\n\t\t\tend\n\t\tend", "def set_content_type\n format = settings[:format] = params[:format].to_sym\n content_type content_types[format]\n end", "def set_response_body(content)\n new(\n response_body: content.respond_to?(:each) ? content : [content]\n )\n end", "def content_type=(value)\n @content_type = value\n end", "def as(content_type)\n headers['Content-Type'] = content_type\n accepts(content_type)\n end", "def respond(object, types)\n types << json\n types.each { |type|\n case type\n when json\n content_type :json, :charset => 'utf-8'\n halt object.to_json\n when yaml\n content_type :yaml, :charset => 'utf-8'\n halt object.to_yaml\n when text\n require 'pp'\n content_type :text, :charset => 'utf-8'\n halt object.pretty_inspect\n end\n }\n end", "def render(*args, &block)\n super(*args, &block)\n opts = args.first\n if opts.has_key?(:text) && opts[:text].present?\n self.response_body = opts[:text]\n elsif opts.has_key?(:nothing) && opts[:nothing]\n self.response_body = \" \"\n else\n raise UnsupportedOperationError\n end\n end", "def create_content_type(content_type)\n self.output_resource_op content_type\n\n response = self.post :content_types, content_type.to_params, nil, true\n\n self.apply_response(content_type, response)\n\n # status = self.response_to_status(response)\n\n self.output_resource_op_status content_type, :success\n rescue Exception => e\n self.output_resource_op_status content_type, :error, e.message\n end", "def response_content_type\n @response_headers[\"Content-Type\"]\n end", "def set_content_type(ctype)\n headers[\"Content-Type\"] = \"#{ctype};charset=#{Response.charset}\"\n end", "def content_type\n response.content_type\n end", "def content_type=(content_type); @message_impl.setContentType content_type; end", "def content_type ctype=nil\n @content_type = ctype if ctype\n @content_type ||=\n \"#{self.class.media_type}/#{self.class.api_name}+#{@env['kiwi.format']}\"\n end", "def content_type\n raise NotImplementedError\n end", "def content_type=(identifier)\n @content_type = nil\n headers['Content-Type'] = MediaTypeIdentifier.load(identifier).to_s\n end", "def content_type\n @response_headers[\"Content-Type\"]\n end", "def as(content_type)\n @content_type = content_type\n @accepts = content_type\n self\n end", "def content_type\n @content_type ||= request.content_type\n end", "def format_response(response, args = { })\n supported_types = %w(application/json application/xml text/xml)\n case request.preferred_type(supported_types)\n when 'application/json'\n content_type :json\n _response = (response.is_a?(Hash) || response.is_a?(Array)) ? JSON.generate(response) : response\n #when 'application/xml', 'text/xml'\n # content_type :xml\n # _response = XmlSimple.xml_out(response, { :root_name => 'response' })\n else\n content_type :json\n _response = (response.is_a?(Hash) || response.is_a?(Array)) ? JSON.generate(response) : response\n end\n _response\n end", "def render(options = {}, extra_options = {}, &block)\n if atom = options[:atom]\n response.content_type ||= Mime::ATOM\n render_for_text(atom.respond_to?(:to_atom) ? atom.to_atom.to_xml : atom.to_xml, options[:status])\n else\n super\n end\n end", "def validate_content_type!(response)\n return unless media_type\n\n response_content_type = response.content_type\n expected_content_type = Praxis::MediaTypeIdentifier.load(media_type.identifier)\n\n unless expected_content_type.match(response_content_type)\n raise Exceptions::Validation.new(\n \"Bad Content-Type header. #{response_content_type}\" +\n \" is incompatible with #{expected_content_type} as described in response: #{self.name}\"\n )\n end\n end", "def content_type\n ((response.headers.values_at('content-type', 'Content-Type').compact.first || '').split(';').first || '').strip\n end", "def apply_response(content_type, response)\n return if content_type.nil? || response.nil?\n\n content_type._id = response['id']\n content_type.klass_name = response['klass_name']\n\n response['entries_custom_fields'].each do |remote_field|\n field = content_type.find_field(remote_field['name'])\n _id = remote_field['id']\n\n if field.nil?\n if self.force?\n content_type.fields << Locomotive::Mounter::Models::ContentField.new(_id: _id, _destroy: true)\n end\n else\n field._id = _id\n end\n end\n end", "def finish(*args, &block)\n self['Content-Type'] ||= 'text/html;charset=utf-8'\n @block = block if block\n if [204, 205, 304].include?(status.to_i)\n header.delete \"Content-Type\"\n header.delete \"Content-Length\"\n close\n [status.to_i, header, []]\n else\n [status.to_i, header, body]\n end\n end", "def render_response\n response.headers['Content-Type'] = 'charset=utf-8'\n @resp = server.encode_response(@resp)\n return render_xml_response if is_xml_request?\n case @resp.code\n when OpenID::Server::HTTP_OK\n render :text => @resp.body, :status => 200\n when OpenID::Server::HTTP_REDIRECT\n redirect_to @resp.redirect_url\n else\n render :text => @resp.body, :status => 400\n end \n end", "def retrieve_response_from_mimes(mimes, &block)\n responder = ActionController::MimeResponds::Responder.new(self)\n mimes = collect_mimes_from_class_level if mimes.empty?\n mimes.each { |mime| responder.send(mime) }\n block.call(responder) if block_given?\n\n if format = responder.negotiate_mime\n self.response.template.template_format = format.to_sym\n self.response.content_type = format.to_s\n self.formats = [ format.to_sym ]\n responder.response_for(format) || proc { default_render }\n else\n head :not_acceptable\n nil\n end\n end", "def content_type\n ::MIME::Types.type_for(name).first.try(:content_type) || 'text/html'\n end", "def parse_response\n if @http_response.body && @http_response.respond_to?(:headers) && @http_response.headers['Content-Type']\n if @http_response.headers['Content-Type'].include?('xml')\n parse_xml_response\n elsif @http_response.headers['Content-Type'].include?('json')\n parse_json_response\n end\n else\n parse_unknown_response\n end\n end", "def format_response\n status_code = @response['status_code'] ||= 500\n template = @response['template'] ||= 'upload'\n if @@request.media_type == 'application/json'\n headers = {'Content-Type' => 'application/json'}\n body = JSON.dump(@response)\n elsif @response['media_type'] == 'application/plain'\n headers = {'Content-Type' => 'text/html'}\n body = @response['message']\n else\n headers = {'Content-Type' => 'text/html'}\n body = File.read('./app/views/header.erb')\n body << File.read(\"./app/views/#{template}.erb\")\n body << File.read('./app/views/footer.erb')\n body = ERB.new(body).result(binding)\n end\n output = []\n if body\n output << body\n end\n if output.empty?\n output << 'There was no response.'\n end\n [status_code, headers, output]\n end", "def formatted_response(content_type, fallback: :none, **options)\n body = build_payload(**options)\n\n # TODO: Maybe make a helper to register these types?\n to_format = content_type.to_sym == :jsonapi ? \"to_json\" : \"to_#{content_type.to_sym}\"\n\n if content_type && body.respond_to?(to_format)\n formatted_body = body.public_send(to_format)\n format = content_type\n else\n case fallback.to_sym\n when :json\n formatted_body = body.to_json\n # FIXME: This won't work without Rails\n format = fallback\n when :none\n return nil\n else\n raise ArgumentError, \"unknown fallback=#{fallback}\"\n end\n end\n\n [status_code, formatted_body, format]\n end", "def content_type(type, params={})\n type = Rack::File::MIME_TYPES[type.to_s] if type.kind_of?(Symbol)\n fail \"Invalid or undefined media_type: #{type}\" if type.nil?\n if params.any?\n params = params.collect { |kv| \"%s=%s\" % kv }.join(', ')\n type = [ type, params ].join(\";\")\n end\n response.header['Content-Type'] = type\n end", "def getContent (type='chuck norris')\n getHtmlResult(type)\n end", "def render(*args) #:nodoc:\n raise ::AbstractController::DoubleRenderError if response_body\n super\n end" ]
[ "0.8146179", "0.7987508", "0.785869", "0.77699715", "0.76790184", "0.76619387", "0.7649412", "0.7580971", "0.75760704", "0.7572346", "0.7454495", "0.74275774", "0.7408022", "0.740662", "0.7404474", "0.7379969", "0.73241127", "0.7267427", "0.72407204", "0.71585613", "0.7132146", "0.712012", "0.7028308", "0.70275176", "0.70275176", "0.6937888", "0.6885516", "0.686226", "0.68374574", "0.67883164", "0.6645223", "0.66035265", "0.6565992", "0.65433764", "0.6482479", "0.64070827", "0.640595", "0.63858014", "0.6367805", "0.6361079", "0.6361079", "0.6335312", "0.6321586", "0.6288278", "0.6283652", "0.6243493", "0.6243493", "0.6228837", "0.6217684", "0.61902136", "0.61771876", "0.6158945", "0.61365205", "0.61364424", "0.61278397", "0.61067486", "0.6072115", "0.6047155", "0.5999357", "0.59766483", "0.59649444", "0.59508264", "0.59508264", "0.5939833", "0.59347653", "0.5932004", "0.59292746", "0.59262407", "0.59240705", "0.5915284", "0.59008735", "0.58898854", "0.5844303", "0.58434606", "0.5814398", "0.5812512", "0.5809911", "0.5799032", "0.57956755", "0.5791905", "0.5790788", "0.5769235", "0.57630527", "0.57619333", "0.5736284", "0.5731892", "0.5722708", "0.5718506", "0.56981975", "0.5694179", "0.56859595", "0.5685302", "0.5682508", "0.5681506", "0.5672783", "0.56671995", "0.56605864", "0.56588775", "0.56437397", "0.5642679" ]
0.7687297
4
use ERB and binding to evaluate templates pass the rendered html to render_content
def render(template_name) body_string = '' File.open("./app/views/#{controller_name}/#{template_name}.html.erb", 'r') do |f| f.each_line do |line| body_string += line end end content = ERB.new(body_string).result(binding) render_content(content, 'text/html') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render(template_content, hash)\n # create a new binding class\n cls = Class.new do\n hash.each do |key, value|\n define_method key.to_sym do\n value\n end\n end\n # expose binding\n define_method :bind do\n binding\n end\n end\n ERB.new(template_content).result(cls.new.bind)\n end", "def render(template)\n b = binding\n code = ERB.new template\n code.result b\n end", "def render\n ERB.new(load_resource(template)).result(bound.get_binding)\n end", "def erb(template) render template end", "def rendered_content\n ERB.new(template).result(binding)\n end", "def erb( content )\n puts \" Running embedded Ruby (erb) code/helpers...\"\n \n content = ERB.new( content ).result( binding() )\n content\n end", "def erb(content)\n ERB.new(content).result(binding)\nend", "def render_erb\n require 'erb'\n\n renderer = ERB.new(template_content, trim_mode: '-')\n renderer.filename = @template_file\n renderer.result(binding)\n end", "def render_with_binding(binding)\n ERB.new(read, nil, '<>').result(binding)\n end", "def render_template(template)\n doc = ERB.new(template, 0, \"%<>\")\n # doc.run(self.send(:binding))\n doc.result(self.send(:binding))\n end", "def erb_render( yml )\n # b = binding\n ERB.new( yml ).result binding \n end", "def evaluate_erb; end", "def render_template(template, context={})\n Erubis::Eruby.new(template).evaluate(context)\n end", "def render(erb)\n erb.result(binding)\n end", "def render(binding)\n @template.render(binding)\n end", "def render\n ERB.new(@template, nil, '-').result(binding)\n end", "def render\n erb_page = ERB.new(content).result(binding)\n Kramdown::Document.new(erb_page).to_html.html_safe\n end", "def _erb(templ, _binding)\n return ERB.new(templ, nil, \"<>\").result(_binding)\n end", "def render_output(html_title, html_body, erb_template)\n # assign i_vars referenced in template file\n @title = html_title\n @body = html_body\n\n erb = ERB.new(erb_template)\n erb.result(binding)\n end", "def thru_erb aBinding = Kernel.binding\n ERB.new(self).result(aBinding)\n end", "def process_template(tmpl, vars)\n require \"erb\"\n\n ERB\n .new(tmpl, trim_mode: \"%\")\n .public_send(vars.is_a?(Binding) ? :result : :result_with_hash, vars)\n end", "def evaluate_template(template_name,bind)\n template_dir = File.expand_path('./scripts',File.dirname(__FILE__))\n template = File.read(File.expand_path(\"./#{template_name}\",template_dir))\n ERB.new(template, nil, '-').result(bind)\nend", "def evaluate_template(template_name,bind)\n template_dir = File.expand_path('./scripts',File.dirname(__FILE__))\n template = File.read(File.expand_path(\"./#{template_name}\",template_dir))\n ERB.new(template, nil, '-').result(bind)\nend", "def convert(content, convertible)\n return content if convertible.data[:template_engine].to_s != \"erb\"\n\n erb_view = Bridgetown::ERBView.new(convertible)\n\n erb_renderer = Tilt::ErubiTemplate.new(\n convertible.path,\n line_start(convertible),\n outvar: \"@_erbout\",\n bufval: \"Bridgetown::OutputBuffer.new\",\n engine_class: ERBEngine\n ) { content }\n\n if convertible.is_a?(Bridgetown::Layout)\n erb_renderer.render(erb_view) do\n convertible.current_document_output.html_safe\n end\n else\n erb_renderer.render(erb_view)\n end\n end", "def render(source)\n ERB.new(source, nil, '-').result(binding)\n end", "def render_text(template_text, options)\n ERB.new(template_text, 0, '%<>').result(binding)\n end", "def erb(vars = {})\n ERBResolve.new(vars).resolve(self)\n end", "def erb(vars = {})\n ERBResolve.new(vars).resolve(self)\n end", "def render(context = Erubis::Context.new)\n # Read template data\n template_filename = \"#{@template}.rhtml\"\n begin\n template = File.read(template_filename)\n rescue Errno::ENOENT\n raise ScriptError.new(\"Template #{template_filename} does not exist!\")\n end\n\n # Prepare template and variables\n eruby = Erubis::Eruby.new template\n \n # Perform templating\n begin\n result = eruby.evaluate context\n rescue\n raise TemplateError.new(\"Encountered error processing template #{template_filename}.\", $!)\n end\n\n # Output result\n output result \n end", "def do_render\n Mustache.render(template, self)\n end", "def render_partial(partial, content)\n template = ERB.new(File.read partial)\n content_binding = binding_from_hash(content)\n template.result(content_binding).html_safe\n end", "def render\n return @template.result(@binding._binding)\n end", "def render(template_name)\n #Use controller and template names to construct paths to template files.\n\n\n #Use File.read to read the template file.\n\n #Create a new ERB template from the contents.\n \n #Evaluate the ERB template, using binding to capture the controller's instance variables.\n\n #Pass the result to #render_content with a content_type of text/html.\n\n \n end", "def render_plain\n template_content\n end", "def render()\n # WARNING! NO NEED TO UNDERSTAND THIS\n self.action = calling_method = caller[0].split(\"`\").pop.gsub(\"'\", \"\")\n template = File.read(view_filename)\n eruby = Erubis::Eruby.new(template)\n eruby.result(binding())\n end", "def erb!(vars = {})\n ERBResolve.new(vars).resolve!(self)\n end", "def erb!(vars = {})\n ERBResolve.new(vars).resolve!(self)\n end", "def erb!(vars = {})\n ERBResolve.new(vars).resolve!(self)\n end", "def content\n ERB.new(load, nil, '-').result(binding)\n end", "def render\n content = output_capture(@block) do\n instance_exec( *@args, &@block )\n end\n content_wrapped = output_capture() { wrap( content ) }\n output_concat content_wrapped\n end", "def render\n Node.new.instance_eval(template)\n end", "def evaluate_dynamic_content(filename, value)\n ruby_content = \"\"\n begin\n # non greedy matching of dynamic code\n value.gsub!(/<%=((.|\\n)*?)%>/) do |match|\n if match =~ /<%=((.|\\n)*?)%>/\n ruby_content = $1.strip\n p = Proc.new {}\n eval(ruby_content, p.binding, filename)\n else\n match\n end\n end\n rescue Exception => e\n raise e, \"error evaluating dynamic content '#{ruby_content}': #{e.message}\", e.backtrace\n end\n value\n end", "def render_content(format)\n begin\n ERB.new( File.open( template_path_for(format) ).read, nil, '%<>' ).result(self.get_binding)\n rescue TemplateUndefined\n ''\n end\n end", "def evaluate(tmap)\n raise \"Template was not loaded: #{@template}\" if !@loadOK\n \n @tmap = tmap\n tsub = ERB.new(@template).result(binding) \n tsub\n end", "def render\n ERB.new(File.read(TEMPLATE), 0, \">\").result(binding)\n end", "def render\n content\n end", "def render(template_name, view_handler, locals, &content)\n self.kramdown_source.render(template_name)\n end", "def convert(content, convertible)\n erb_view = Bridgetown::ERBView.new(convertible)\n\n erb_renderer = Tilt::ERBTemplate.new(trim: \"<>-\", outvar: \"@_erbout\") { content }\n\n if convertible.is_a?(Bridgetown::Layout)\n erb_renderer.render(erb_view) do\n convertible.current_document_output\n end\n else\n erb_renderer.render(erb_view)\n end\n end", "def render(template_name)\n contents = File.read(\"views/#{self.class.to_s.underscore}/#{template_name}.html.erb\")\n template = ERB.new(contents)\n # ivars = self.instance_variables\n new_content = template.result(binding)\n render_content(new_content, \"text/html\")\n end", "def render_template klass, *args\t\t\n\t\t\tbegin\n\t\t\t\tparams = args[0] || {}\n\t\t\t\t\n\t\t\t\tresource = params[:resource] || TEMPLATE_EXTENSION\n\t\t\t\t\n\t\t\t\tinput = if custom_template\n\t\t\t\t\tcustom_template.call(klass, resource) || klass[resource]\n\t\t\t\telse\n\t\t\t\t\tklass[resource]\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Preprocessing\n\t\t\t\tif params[:preprocessing]\n\t\t\t\t\tinput.gsub!(/\\$\\{.+?\\}/) do |term| \n\t\t\t\t\t\tidentifier = term.slice(2 .. term.size-2)\n \"<%= #{identifier}.to_html if #{identifier}%>\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t# Binding\n\t\t\t\tbind = params[:binding] || binding\n\t\t\t\t\n\t\t\t\t# Process Template\n\t\t\t\thtml = WGUIERuby.new(input).result(bind)\n\t\t\t\t\n\t\t\t\tvalidate(html, klass) if $debug\n\t\t\t\t\n\t\t\t\treturn html \n\t\t\trescue Exception => e\n\t\t\t\tlog.error \"Error by rendering template '#{resource}' for '#{klass.name}' Class!\"\n\t\t\t\traise e\n\t\t\tend\n\t\tend", "def render(exp)\n renderer.process(exp)\n end", "def render(obj = Object.new, locals = {})\n output = template.result(obj.instance_eval {binding})\n end", "def capture_html(*args, &block) \n if self.respond_to?(:is_haml?) && is_haml?\n block_is_haml?(block) ? capture_haml(*args, &block) : block.call\n elsif erb_buffer?\n result_text = capture_block(*args, &block)\n result_text.present? ? result_text : (block_given? && block.call(*args))\n else # theres no template to capture, invoke the block directly\n block.call(*args)\n end\n end", "def render(obj = Object.new, locals = {})\n output = template.result(obj.instance_eval { binding })\n (view == 'document' || view == 'embedded') ? output.gsub(BLANK_LINES_PATTERN, '').gsub(LINE_FEED_ENTITY, \"\\n\") : output\n end", "def render(template_name)\n template_content = File.read(template_path(template_name))\n template = ERB.new(template_content)\n response_body = template.result(get_binding)\n render_content(response_body, 'text/html')\n end", "def render\n template = ERB.new File.new(@template_path).read, nil, \"%\"\n template.result(binding)\n end", "def render(filename, content)\n if renderer = renderer_for(filename)\n renderer.call content\n else\n content\n end\n end", "def evaluate(scope, locals, &block)\n @scope = scope\n template = hb_render_template locals, &block\n \"#{hb_template_var} = #{hb_template_js template};\\n\".tap do |text|\n text += \"#{self.class.template_partial_method}('#{hb_partial_path}', #{hb_template_var});\" if hb_partial?\n end\n end", "def render(obj, template = obj.template_name)\n file = \"templates/#{template}.erb\"\n eruby = Erubis::Eruby.new File.read(file), filename: File.basename(file)\n context = SimpleDelegator.new(obj)\n context.extend Helpers\n context.extend TemplateHelpers\n eruby.evaluate(context)\n end", "def render\n content\n end", "def render\n content\n end", "def render\n content\n end", "def render_and_evaluate(options = {})\n render(options)\n evaluate\n end", "def render\n @formatted_content.each &:render\n end", "def evaluate(scope, locals, &block)\n Tilt.new(eval(data)).render(scope, locals, &block)\n end", "def execute _binding = get_binding\n foo = 'local_erbout'\n erb = ERB.new compile, nil, nil, 'local_erbout'\n erb.result _binding\n end", "def render_in(view_context, &block)\n self.class.compile\n @view_context = view_context\n @view_renderer ||= view_context.view_renderer\n @lookup_context ||= view_context.lookup_context\n @view_flow ||= view_context.view_flow\n @virtual_path ||= virtual_path\n @variant = @lookup_context.variants.first\n old_current_template = @current_template\n @current_template = self\n\n # Pass self as a block parameter\n @content = render_block(view_context, &block) if block_given?\n validate!\n\n send(self.class.call_method_name(@variant))\n ensure\n @current_template = old_current_template\n end", "def my_render_erb erb, opts = {}\n if (path = erb_path_for(erb)).nil?\n log_error \"If you use #my_render_erb within a dynamically defined dep, you have to give the full path to the erb template.\"\n elsif !File.exists?(path) && !opts[:optional]\n log_error \"Couldn't find erb to render at #{path}.\"\n elsif File.exists?(path)\n # require 'erb'\n debug ERB.new(IO.read(path)).result(binding)\n shell(\"cat > #{opts[:to]}\",\n :input => ERB.new(IO.read(path)).result(binding),\n :sudo => opts[:sudo]\n ) do |result|\n if result\n log \"Rendered #{opts[:to]}.\"\n sudo \"chmod #{opts[:perms]} '#{opts[:to]}'\" unless opts[:perms].nil?\n else\n log_error \"Couldn't render #{opts[:to]}.\"\n end\n end\n end\nend", "def evaluate\n super\n content\n end", "def render (workitem)\n\n eval_template workitem\n end", "def render(pathname)\n @partial_templates ||= {}\n ::ERB.new(File.read(pathname)).result(binding)\n end", "def render(*partial_path)\n template_path = full_path(*partial_path)\n\n code = File.read(template_path)\n\n @output = eval(code, binding, template_path.to_s)\n end", "def render(template_name)\n if already_built_response? \n raise \"DoubleRenderError\"\n else \n controller_name = self.class.to_s.underscore \n dir = File.join(\"views\",controller_name, \"#{template_name}.html.erb\")\n # debugger\n content = File.read(dir).split(\"\\n\")\n content.map! do | statement | \n start_point = /<%/ =~ statement\n # debugger\n if start_point.nil? \n statement\n else \n front_part = statement[0...start_point]\n # returning = \n # start_point += statement[start_point+2] == \"=\" ? 2 : 1\n end_point = /%>/ =~ statement \n end_point += 1\n rear_part = statement[end_point+2..-1]\n front_part.to_s + ERB.new(statement[start_point..end_point]).result(binding) + rear_part.to_s\n end \n end \n render_content(content)\n end \n end", "def template_content\n if respond_to? :contents and contents\n contents.elements.map do |item|\n if item.content.respond_to? :template\n item.content.template.renderable.template.render\n else\n ::Alongslide::render item.text_value, plain: true\n end\n end\n end\n end", "def render_template(context, options); end", "def render(template_name)\n template = ERB.new(File.read(\"views/#{self.class.to_s.underscore}/#{template_name}.html.erb\"))\n bindings = binding()\n render_content(template.result(bindings), \"text/html\")\n end", "def convert\n erb = ERB.new(File.readlines(template_file).join)\n File.open(File.basename(content_file, File.extname(content_file)) + '.html', 'w') do |f|\n f << erb.result(get_binding)\n end\n end", "def render_template(template, context)\n begin\n eruby = Erubis::Eruby.new(template)\n output = eruby.evaluate(context)\n rescue Object => e\n raise TemplateError.new(e, template, context)\n end\n Tempfile.open(\"chef-rendered-template\") do |tempfile|\n tempfile.print(output)\n tempfile.close\n yield tempfile\n end\n end", "def render\n context = Context.new(location) # prime context/scope\n result = content\n\n filters.each do |filter|\n if filter == 'html' # TODO: +next+ if html format and html filter ?\n engine = Tilt[format]\n else\n engine = Tilt[filter]\n end\n raise \"unknown filter #{filter}\" unless engine\n result = Dir.chdir(location) do\n engine.new{result}.render(context)\n end\n end\n @result = result\n end", "def render(file_path, local_variables = {})\n absolute_path = File.expand_path file_path, base_path\n absolute_path += FILE_EXTENSION unless absolute_path.end_with?(FILE_EXTENSION)\n file_content = File.read absolute_path\n erb = ERB.new file_content\n erb.result create_binding(base_path, local_variables)\n end", "def _render_template(options); end", "def _render_template(options); end", "def erb(template_path, vars)\n template = File.read(template_path)\n ERB.new(template).result(OpenStruct.new(vars).instance_eval { binding })\n end", "def render(template_name)\n #Open template, put content into string-content\n cntrl_name = self.class.to_s.underscore\n\n erb_temp = File.read(\"views/#{cntrl_name}/#{template_name}.html.erb\")\n content = ERB.new(erb_temp).result(binding)\n\n render_content(content , 'text/html')\n end", "def erb(filename, locals={}, layout=nil)\n b = binding\n use_template = template(filename, locals)\n locals = locals\n if layout\n layout = File.expand_path(\"../views/#{layout}.erb\",__FILE__)\n content = File.read(layout)\n ERB.new(content).result(b)\n else\n use_template\n end\n end", "def render(text)\n return Mustache.render(text, self)\n end", "def render(*args, &block)\n captured = helpers.capture do\n helpers.concat(helpers.render(*args, &block))\n helpers.output_buffer.to_s\n end\n rawtext(captured)\n end", "def render_erb(template, scope = {})\n\tt = \"#{ROOT}/templates/#{template}.erb\"\n\tb = binding\n\tscope.each{ |key, value| b.local_variable_set(key.to_sym, value) }\n\treturn ERB.new(File.read(t), nil, \"-\").result(b)\nend", "def render_variable(context); end", "def render_erb\n end", "def render\n source = IO.read \"#{Pv.root}/lib/templates/story.txt.erb\"\n template = ERB.new(source)\n template.result(binding)\n end", "def render(path)\n template = ERB.new(File.read(File.expand_path(path)), trim_mode: '-')\n template.result(binding)\n end", "def assemble_markup\n\n design_renderer = liquid_for(@design.markup)\n view_renderer = liquid_for(@view_template.markup)\n params = node_template_data.merge(global_template_data)\n\n # Render the view template.\n rendered_view = view_renderer.render(params, :filters => liquid_filters)\n\n # Render the design and merge in the view.\n design_renderer.render(params.merge('content' => rendered_view), :filters => liquid_filters)\n\n end", "def render_erb_template(filename)\n template = File.read(filename)\n result = ERB.new(template).result(binding)\n end", "def evaluate\n str = (Babylon.cached_views && Babylon.cached_views[@view_template]) ? Babylon.cached_views[@view_template] : File.read(@view_template)\n xml = Nokogiri::XML::Builder.new do\n instance_eval(str)\n end\n return xml.doc.children #we return the doc's children (to avoid the instruct)\n end", "def make_render exp, in_view = false\n render_type, value, rest = find_render_type exp, in_view\n rest = process rest\n result = Sexp.new(:render, render_type, value, rest)\n result.line(exp.line)\n result\n end", "def call(request)\r\n response = super(request)\r\n \r\n if not response.nil? and response.headers['Content-Type']=='text/html'\r\n response.data = ERB.new(response.data +\r\n File.open(@template, \"rb\").readlines.join).result(binding)\r\n end\r\n \r\n response\r\n end", "def render_erb(fname)\n ERB.new(\n File.read(\"src/#{fname}.erb\")\n ).result(binding)\nend", "def render_with(**locals)\n render_with_template(locals: locals)\n end", "def send_exploit_html(cli, template, headers={})\n html = ''\n if template.class == Array\n html = ERB.new(template[0]).result(template[1])\n else\n html = ERB.new(template).result\n end\n send_response(cli, html, headers)\n end", "def render(*data)\n data.map do |datum|\n if bind\n erb.result(bind)\n else\n Entry.new(self, datum, colorize).render(erb)\n end\n end.join(separator)\n end" ]
[ "0.7646404", "0.76125425", "0.7591347", "0.7374052", "0.73263925", "0.7276289", "0.7255913", "0.7232309", "0.71527356", "0.71158195", "0.7076924", "0.6994016", "0.68743503", "0.68199754", "0.6756906", "0.67545015", "0.67199045", "0.6633789", "0.6626088", "0.6587733", "0.6557414", "0.65499383", "0.65499383", "0.6512496", "0.6491329", "0.6480993", "0.64478195", "0.64478195", "0.6445583", "0.6442941", "0.6435254", "0.64330685", "0.6431623", "0.64284384", "0.6406631", "0.6389626", "0.6389626", "0.6389626", "0.6353828", "0.63306355", "0.6321088", "0.62890995", "0.628038", "0.6273486", "0.62607473", "0.62412655", "0.62304974", "0.62289405", "0.62153316", "0.62068367", "0.6199719", "0.61857074", "0.6184702", "0.6176605", "0.61752236", "0.61566037", "0.61542773", "0.6148844", "0.6145452", "0.6114037", "0.6114037", "0.6114037", "0.6101116", "0.6095089", "0.6092468", "0.6084569", "0.60656655", "0.6056438", "0.6055953", "0.60554117", "0.60433763", "0.60429794", "0.6036321", "0.60122234", "0.60105914", "0.60011667", "0.5998612", "0.5997552", "0.5990815", "0.5988353", "0.5975685", "0.5975685", "0.5961185", "0.59517586", "0.5936993", "0.593366", "0.5930106", "0.5929523", "0.5916194", "0.5900458", "0.5898417", "0.589474", "0.5894369", "0.58722115", "0.58690125", "0.5866008", "0.58646196", "0.58602303", "0.5853781", "0.58508676", "0.5849647" ]
0.0
-1
method exposing a `Session` object
def session @session ||= Puffs::Session.new(req) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def session; @session; end", "def session; @session; end", "def session; @session; end", "def session; end", "def session; end", "def session; end", "def session; end", "def session\n end", "def set_session\n \n end", "def session() request.session end", "def session\n Session.instance\n end", "def expose_session_to_models\n $_SESSION = session\n end", "def session\n self\n end", "def session #:nodoc:\n @session ||= Session.new\n end", "def session\n object.session\n end", "def session=(_arg0); end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session\n @session ||= Session.new( req )\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def save_session(session)\n \n end", "def session\n @session ||= {}\n end", "def session\n @session ||= OpenStruct.new\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(@req)\n end", "def session\n @session ||= Session.new(req)\n end", "def session ; request.session ; end", "def session\n @session ||= Session.new(request)\n end", "def session\r\n @session ||= {}\r\n end", "def open_session; end", "def session\n @session ||= Session.new(@request)\n @session\n end", "def session\n @session ||= options[:session] || {} \n end", "def session\n @session ||= Session.new(@request)\n end", "def session\n @session ||= establish_connection\n end", "def session\n # lazy assign so session persists for entire controller life\n @session ||= Session.new(@req)\n end", "def session(options={}, &block)\n self.class.session self, &block\n end", "def create_session\n raise NotImplementedError\n end", "def extend_session\n class << session\n include Rango::Session\n end\n end", "def session\n @context.session\n end", "def initialize(session); end", "def session\n @session_proxy ||= Class.new do\n attr_reader :session\n\n def initialize session = {}\n @session = session\n end\n\n def [] key\n session[key]\n end\n\n def []= key, val\n return if readonly?\n session[key] = val\n end\n\n def delete key\n return if readonly?\n session.delete key\n end\n\n # makes sessions readonly\n #\n # @example prohibit writing for all actions\n # before do\n # session.readonly!\n # end\n #\n # @example prohibit writing only for :render and :display actions\n # before :render, :display do\n # session.readonly!\n # end\n def readonly!\n @readonly = true\n end\n\n def readonly?\n @readonly\n end\n\n def method_missing *args\n session.send *args\n end\n\n end.new @ctrl.env['rack.session']\n end", "def initialize(session)\n @session = session\n end", "def initialize(session)\n @session = session\n end", "def initialize(session)\n @session = session\n end", "def set_session\n @session = Session.find(params[:session_id])\n end", "def method_missing(method, *args)\n @session.send(method, *args)\n end", "def session\n\t\t\t\t@session ||= response.session\n\t\t\tend", "def session\n session = Session.new(self)\n yield(session)\n transaction { session.commit! }\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def get_session(env, sid)\n raise '#get_session needs to be implemented.'\n end", "def _session\n\t\t\tThread.current[SESSION]\n\t\tend", "def set_session\r\n @session = Session.find(params[:id])\r\n end", "def get_session(env, sid)\n raise '#get_session not implemented.'\n end", "def session\n @connection.request('session-get') do |resp|\n if resp == :connection_error\n yield :connection_error\n else\n yield Session.new(resp)\n end\n end\n end", "def initialize(session)\n self.session = session\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def session\n @req.session\n end", "def method_missing(sym, *args, &block)\n if @session.respond_to?(sym)\n @session.send(sym, *args, &block)\n else\n super(sym, *args, &block)\n end\n end", "def session(session_id)\n @session_id = session_id\n end", "def session\n Session.wrap(Cproton.pn_link_session(@impl))\n end", "def find_session(env, sid); end", "def set_session\n @session = current_session\n end", "def session\n @controller.session\n end", "def set_session\n @session = BatchConnect::Session.find(params[:id])\n end", "def session\n @session ||= Session.new(req)\n# Implement a method ControllerBase#session which constructs a\n# session from the request. Lazily assign this in to an ivar,\n# (@session; use ||=) that can be returned on subsequent calls to\n# #session.\n# Make sure that the #redirect_to and #render_content methods call\n# Session#store_session so that the session information is stored in the\n# cookie after the response is built.\n end", "def set_session\n @session = Session.find(params[:id])\n end", "def new\n @session = Session.new\n end", "def user_session\n\t\t@user_session ||= UserSession.new(session)\n\tend", "def session\n @session ||= @app.config[:session_from_rack_env].call(@env)\n end", "def setup\n @current_session = new_session\n end", "def hibernate_session # :nodoc:\n @hibernate_session\n end", "def new\n @session = Session.new\n end", "def set_session(env, sid, session, options)\n raise '#set_session not implemented.'\n end", "def user_session\n @user_session ||= UserSession.find\n end", "def session\n\t\t\trequest.session\n\t\tend", "def store_session(res)\n end" ]
[ "0.8364511", "0.8364511", "0.8364511", "0.8179335", "0.8179335", "0.8179335", "0.8179335", "0.8128919", "0.77721834", "0.7755513", "0.7718514", "0.7702571", "0.7700292", "0.7694374", "0.7663696", "0.7596194", "0.7523161", "0.7523161", "0.7523161", "0.7523161", "0.7523161", "0.7518992", "0.75167346", "0.75167346", "0.75167346", "0.751587", "0.750347", "0.7499246", "0.7485717", "0.7485717", "0.74788886", "0.74206", "0.7379025", "0.7369274", "0.731342", "0.7294449", "0.72277594", "0.7226138", "0.7221434", "0.72137254", "0.7193859", "0.7167211", "0.7163761", "0.71380204", "0.70872957", "0.70759404", "0.70673287", "0.70673287", "0.70673287", "0.7037518", "0.7034676", "0.70256007", "0.6993223", "0.6981771", "0.6981771", "0.6981771", "0.6981771", "0.6974445", "0.6933462", "0.6920123", "0.6917149", "0.69162107", "0.6870757", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6841591", "0.6838981", "0.6831793", "0.6804899", "0.68035924", "0.67825", "0.67821366", "0.677734", "0.6764819", "0.6757129", "0.6744153", "0.6715359", "0.66968364", "0.66961634", "0.6679489", "0.6670222", "0.666334", "0.6625784", "0.6621683", "0.662105", "0.66074723" ]
0.7221985
38
use this with the router to call action_name (:index, :show, :create...)
def invoke_action(name) send(name) render(name) unless already_built_response? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def invoke_action(name)\n end", "def index\r\n list\r\n render_action 'list'\r\n end", "def route_index; end", "def index\n list\n render_action 'list'\n end", "def method_for_action(action_name); end", "def action\n \"index\"\n end", "def invoke_action(name)\n # used for self-reflection in views\n @action = name\n\n send(name)\n end", "def invoke_action(name)\n check_authenticity_token unless req.request_method == 'GET'\n self.send(name)\n self.render(name.to_s) unless already_built_response?\n end", "def action\n end", "def execute(*args)\n\n # Verify if the controller answers to the @action_name value\n raise WebFlowError, \"The action step #{@action_name} is not defined in your controller.\" unless args[0].respond_to? lookup_method_to_call(@action_name)\n \n # The controller defines a method with the same name as @action_name.\n # Kewl! A 'someone else problem' !!!\n args[0].send( lookup_method_to_call( @action_name ) )\n \n end", "def actions\n ['index', 'show', 'new', 'create', 'edit', 'update', 'destroy']\n end", "def action\n end", "def actions; end", "def action_name\n name = self.request.route_obj.instance_variable_get('@named').to_s\n name.gsub!(/^#{controller_name}_?/, '')\n name = 'index' if name == ''\n name\n end", "def invoke_action(name)\n self.send(name)\n render(name.to_s) unless already_built_response?\n end", "def index\n render :action => 'view'\n end", "def action_name; end", "def route_for(name, *args); end", "def action\n args.first\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def run(req, res)\n #@action = :index\n #@method = :get\n #@pattern = /^\\/users$/\n #@class = DummyController\n \n @params = req.path\n #route_params = @params\n ControllerBase.new(req, res, @params).invoke_action(@method, @pattern, @class, @action)\n end", "def index\n list\n #render :action => 'list'\n\n end", "def invoke_action(name)\n # debugger\n self.send(name)\n render(name.to_s) unless already_built_response?\n end", "def action args = {}\n\t\tend", "def invoke_action(name)\n self.send(name)\n render unless self.already_built_response?\n\n end", "def invoke_action(name)\n self.send(name)\n #Rails Magic: Default calls render on appropriate method even if the programmer doesn't :\n render(name) unless already_rendered?\n end", "def action_missing(name, *args)\n if name == action_name\n perform\n else\n raise AbstractController::ActionNotFound\n end\n end", "def run(req, res)\n @params = req.params\n controller_class.send(action_name)\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def index\n list\n render :action => 'list'\n end", "def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n end", "def invoke_action(name)\n self.send(name)\n render(name) unless already_built_response?\n end", "def action\n if action_name == 'advanced_search'\n :post\n else\n :get\n end\n end", "def action\n action_name.to_sym\n end", "def index\n list\n render :action => 'list'\n # show\n # render :action => 'show'\n # render('list')\n end", "def index\n list #call the action\n render('list') #render the correct template not 'index'\n end", "def perform(action)\n case action\n when :index, :new then get action\n when :show, :edit then get action, id: 1\n when :update then put :update, id: 1\n when :create then post :create\n when :destroy then delete :destroy, id: 1\n end\n end", "def invoke_action(name)\n send(name)\n render(name) unless already_built_response?\n end", "def action(name)\n nil\n end", "def lookup_action; end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def action(name)\n action_method = \"action_#{name}\"\n return Actions.send(action_method) if Actions.respond_to?(action_method)\n nil\n end", "def dispatch_action(req)\n controller = ROUTE_TO_CONTROLLER[req.path_info]\n raise Heartcheck::Errors::RoutingError if controller.nil?\n\n Logger.info \"Start [#{controller}] from #{req.ip} at #{Time.now}\"\n\n controller.new.index.tap do |_|\n Logger.info \"End [#{controller}]\\n\"\n end\n end", "def index\n @my_actions = MyAction.all\n end", "def invoke_action(path)\n controller(path).send(action_name)\n end", "def _dispatch\n case @options[:action]\n when :init\n _init\n when :add\n fail 'No url given (-u option)' if @options[:url].empty?\n fail 'No name given (-n option)' if @options[:name].empty?\n _add\n when :delete\n fail 'No id given (-i option)' if @options[:id].nil?\n _delete\n when :list\n _list\n else\n fail \"Unknown action #{@options[:action]}\"\n end\n end", "def perform(action)\n @action_name = action\n begin\n self.send(@action_name)\n rescue\n Skates.logger.error {\n \"#{$!}:\\n#{$!.backtrace.join(\"\\n\")}\"\n }\n end\n self.render\n end", "def index\n render action:\"new\"\n end", "def index; redirect_to :action => 'list'; end", "def index\n \n redirect_to ( :action => \"list\")\n end", "def method_missing(method_name, *args)\n action_method_name = _resolve_action_method_name(method_name)\n if action_method_name.nil?\n super\n else\n send(action_method_name, *args)\n end\n end", "def action(*args,&block)\n name, options = _parse_name_and_options(args)\n command.action({:name=>name}.merge(options),&block)\n end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def run(req, res)\n controller = controller_class.new(req, res, route_params(req))\n controller.invoke_action(action_name)\n end", "def route\n #TODO\n end" ]
[ "0.734207", "0.734207", "0.7341121", "0.7079497", "0.70227414", "0.696795", "0.6943637", "0.6920887", "0.69136906", "0.6890334", "0.68671626", "0.6824139", "0.6813997", "0.6774912", "0.67631173", "0.6758284", "0.67041564", "0.6686834", "0.6681827", "0.6678034", "0.665475", "0.66500854", "0.66500854", "0.66500854", "0.66500854", "0.66500854", "0.6641654", "0.664045", "0.66402036", "0.663344", "0.6619336", "0.66144526", "0.65956104", "0.6594935", "0.6571212", "0.6571212", "0.6571212", "0.6571212", "0.6571212", "0.6571212", "0.6571212", "0.6560247", "0.6560247", "0.65439177", "0.65363085", "0.651634", "0.6514689", "0.6500492", "0.64877355", "0.64705765", "0.6469784", "0.64565706", "0.64565706", "0.64565706", "0.6423583", "0.6415081", "0.6414786", "0.64137095", "0.6408895", "0.6392654", "0.63900316", "0.6388664", "0.6385173", "0.6375508", "0.6370885", "0.6369523", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6368402", "0.6362316", "0.63608617" ]
0.6446989
54
This augments the time_ago_in_words method adding the word. Usage: time_ago_in_words_with_word(object.created_at)
def time_ago_in_words_with_word(date, word = "ago") "#{time_ago_in_words(date)} #{word}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_ago_in_words(from_time, options = T.unsafe(nil)); end", "def time_ago_in_words(from_time, options = {})\n distance_of_time_in_words(from_time, Time.now, options)\n end", "def decorated_time_ago_in_words(a_datetime, options = {})\n options = {\n :suffix => ' ago',\n :suppress_1 => false,\n :text_only => false\n }.merge(options)\n ts = ((presenter_attrs.view_context.time_ago_in_words(a_datetime).gsub('about ', '') + options[:suffix]) rescue 'N/A')\n ts = ts.gsub(/^1\\s+/, '') if options[:suppress_1]\n if options[:text_only]\n ts\n else\n presenter_attrs.view_context.content_tag(:span, ts, :title => a_datetime.to_s(:full_date_and_time))\n end\n end", "def nice_time_ago_in_words(time)\n case\n when !time then ''\n when time < 7.days.ago then time.strftime(\"%b %d, %Y\")\n when time < 60.seconds.ago then time_ago_in_words(time) + \" ago\"\n else\n \"Seconds ago\"\n end\n end", "def kase_type_posted_time_ago_in_words(kase)\n \"%{type} posted %{time} ago\" % {:type => kase.class.human_name, \n :time=> time_ago_in_words_span_tag(kase.created_at)}\n end", "def time_ago\n \"#{time_ago_in_words(self.created_at)} ago\"\n end", "def time_ago_in_words(from_time, include_seconds = false)\n distance_of_time_in_words(from_time, Time.now, include_seconds)\n end", "def relative_word_time(time)\n now = Time.now\n if time - now > 0\n 'in ' + distance_of_time_in_words(time, now)\n elsif now - time > 7.days\n 'on ' + l(time, format: :short)\n else\n distance_of_time_in_words(time, now) + ' ago'\n end\n end", "def time_ago_in_words(from_time, include_seconds = false)\n distance_of_time_in_words(from_time, Time.now, include_seconds)\n end", "def time_ago_in_words(from_time, include_seconds = false)\n distance_of_time_in_words(from_time, Time.now, include_seconds)\n end", "def time_ago_in_words(from_time, include_seconds=false)\n distance_of_time_in_words(from_time, Time.zone.now, include_seconds)\n end", "def decorated_time_from_now_in_words(a_datetime, options = {})\n options = {\n :prefix => 'in ',\n :suppress_1 => false,\n :text_only => false\n }.merge(options)\n ts = (\n (\n options[:prefix] + presenter_attrs.view_context.time_ago_in_words(a_datetime).gsub('about ', '')\n ) rescue 'N/A'\n )\n ts = ts.gsub(/^1\\s+/, '') if options[:suppress_1]\n if options[:text_only]\n ts\n else\n presenter_attrs.view_context.content_tag(:span, ts, :title => a_datetime.to_s(:full_date_and_time))\n end\n end", "def time_ago_in_words(once_upon_a)\n dt = Time.now.to_f - once_upon_a.to_f\n\n words = nil\n\n TIME_INTERVALS.each do |pair|\n mag, term = pair.first, pair.last\n if dt >= mag\n units = Integer(dt / mag)\n words = \"%d %s%s\" % [units, term, units > 1 ? 's' : '']\n break\n end\n end\n\n if words\n words\n else\n once_upon_a.strftime(\"%Y-%m-%d\")\n end\n end", "def time_ago_in_words(from_time, include_seconds = false)\n distance_of_time_in_words(from_time, Time.now, include_seconds)\n end", "def person_posted_kase_time_ago_in_words(kase)\n message = case kase\n when Problem then \"%{name} reported this problem %{time} ago\".t\n when Question then \"%{name} asked this question %{time} ago\".t\n when Praise then \"%{name} gave praise %{time} ago\".t\n when Idea then \"%{name} shared this idea %{time} ago\".t\n else \"%{name} posted %{time} ago\".t\n end\n message % {\n :name => link_to(kase.person.username_or_name, person_path(kase.person)),\n :time => time_ago_in_words_span_tag(kase.created_at)\n }\n end", "def time_ago\n I18n.t('activities.attributes.time_ago', :distance => distance_of_time_in_words_to_now(self.created_at))\n end", "def date_duration_in_words(date)\n if date > DateTime.now\n t('datetime.distance_in_words.in') + ' ' + (distance_of_time_in_words DateTime.current, date)\n else\n t('datetime.distance_in_words.ago')\n end\n end", "def set_time_difference(time)\n time_difference = time_ago_in_words(time)\n time_difference += ' ago'\n end", "def add_word(word)\n \n end", "def time_ago_in_words_or_date(date,options={})\n return nil unless date\n if (Time.now-date)/60/60/24 < 7\n time_ago_in_words(date) + \" ago\"\n elsif date.year == Time.now.year\n options[:short] ? date.strftime(\"%m/%d %I:%M%p\") : date.to_s(:short)\n else\n options[:short] ? date.strftime(\"%m/%d/%y\") : date.to_s(:medium)\n end\n end", "def in_words(t)\n # to get the number of minutes subtract out days\n # Then calculate hours and subtract those out to get minutes.\n s = []\n days = t.round(4).to_i\n s << \"#{ days } day(s)\" unless days == 0\n \n remainder = t - days\n minutes = remainder * 1440.0 # number of minutes in a day\n hours = (minutes / 60.0).round.to_i\n s << \"#{ hours } hours\" unless hours == 0\n \n # round to 2 decimal places and call it\n minutes = (minutes - hours * 60).round\n s << \"#{ minutes } minutes\" unless minutes == 0\n \n if s.empty?\n s << \"now\"\n else\n s << \"ago\"\n end\n \n s.join(\" \")\n end", "def arabic_time_ago_in_words(from_time, include_seconds = false)\n arabic_distance_of_time_in_words(from_time, Time.now, include_seconds)\n end", "def person_member_status_since_in_words(person, options={})\n \"%{member} since %{time} ago\".t % {\n :member => link_to(person.current_state_t.titleize, {}),\n :time => time_ago_in_words(person.partner? ? person.partner_at || person.created_at : person.created_at)\n }\n end", "def since_updated(time)\n return \"\" if time.blank?\n time_ago = time_ago_in_words(time) << t('time_ago')\n time_ago\n end", "def running_time(word, word_times)\n t = Time.now\n word.reverse * word_times\n t2 = Time.now\n running_time = t2 - t\nend", "def nice_time_ago(date)\n !date.nil? ? time_ago_in_words(date) : 'n/a'\n end", "def add(word)\n change_wordlist(@words + [ Word.new(word) ] )\n end", "def <<(word)\n @words << word\n end", "def <<(word)\n @words << word\n end", "def <<(word)\n @words << word\n end", "def add_word(word)\r\n \r\n end", "def kase_activity_in_words(kase)\n \"last active %{time} ago\".t % {:time => \"\"}\n end", "def add(word)\n end", "def story_time_ago(story_date)\n distance_in_days = (((Time.now - story_date).abs)/1.days).to_i\n distance_in_days > 7 ? story_date.strftime('%b. %e, %Y') : distance_in_days < 1 ? \"Today\" : \"#{time_ago_in_words(story_date) } ago\"\n end", "def post_time(time)\n\t\tif (Time.now - time) > 2600000\n\t\t\ttime.strftime \"on %b %d, %Y\"\n\t\telse\n\t\t\ttime_ago_in_words(time) + \" ago\"\n\t\tend\n\tend", "def post_time(time)\n\t\tif (Time.now - time) > 2600000\n\t\t\ttime.strftime \"on %b %d, %Y\"\n\t\telse\n\t\t\ttime_ago_in_words(time) + \" ago\"\n\t\tend\n\tend", "def timely time\n return \"#{time_ago_in_words(time)} ago\" if time > 30.days.ago\n \"#{time.strftime(\"%B %Y\")}\"\n end", "def time_ago(time)\n content_tag(:abbr, I18n.t('helpers.time_ago', :time => time_ago_in_words(time)), :title => I18n.l(time.localtime, :format => :long), :class => 'time-ago grey')\n end", "def <<(obj)\n @words << obj\n end", "def after_create(word)\n expire_cache_for(word)\n end", "def add_words(new_words)\n new_words.each do |word|\n add(word)\n end\n end", "def add(word)\n @words[@words.size] = word\n end", "def friendly_time( time )\r\n return '-' if time.blank?\r\n \r\n if ( Time.now - time < 1.week )\r\n return time_ago_in_words( time ) + \" ago\"\r\n else\r\n return time.to_s( :short )\r\n end\r\n end", "def add(word)\n Hunspell.Hunspell_add(self,word.to_s)\n end", "def add_word(word)\n @word_counts[word] ||= 0\n current_count = @word_counts[word] += 1\n @total_word_count += 1\n # If this word is new for this Group, it might be new for the entire Groupie\n @groupie.add_word(word) if current_count == 1\n nil\n end", "def how_long_ago(post)\n if post.created_at > Time.now.beginning_of_day\n \"Posted \" + time_ago_in_words(post.created_at) + \" ago\"\n else\n \"Posted on \" + post.created_at.strftime(\"%b %d, %Y\")\n end\n end", "def date_age_in_words(date)\n (distance_of_time_in_words DateTime.current, date)\n end", "def concatenate_words(sentence)\nend", "def add(word, w)\n if word != \"\" \n cur = self\n word.downcase.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n cur.kids[modified_char] = SpellingTrie.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here.add(w)\n end\n end", "def add_word(word)\n sym = word.to_sym\n wdup = word.dup\n for i in 0...word.length\n wdup[i] = 0\n @steps[wdup] << sym\n wdup[i] = word[i]\n end\n @words[word] = sym # for allow_shorter and each_word\n end", "def add(word)\n return if word.nil? || word.strip == ''\n\n @words.push(word)\n end", "def interesting_words(sentence, stop_word_array=['a', 'the', 'on'])\n # TODO\nend", "def add_word word #Function shovels individual strings into the dictionary array\n @dictionary << word\n end", "def shortened_tweet_truncator(tweet) \n if word_substitutor(tweet).length > 140 \n word_substitutor(tweet)[0...137] + \"...\"\n else \n tweet\n end \nend", "def shortened_tweet_truncator(tweet)\n if word_substituter(tweet).length > 140\n word_substituter(tweet)[0..136] + '...'\n else\n tweet\n end\nend", "def shortened_tweet_truncator(tweet)\n if word_substituter(tweet).length <= 140\n word_substituter(tweet)\n else\n word_substituter(tweet)[0..136] << \"...\" \n end\nend", "def add_tag_to_word(word, *args)\n http_method = :post\n path = '/word/{word}/tag'\n path.sub!('{word}', word.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end", "def add word\n super word.clone\n end", "def timeago(time, options = {})\n start_date = options.delete(:start_date) || Time.new\n date_format = options.delete(:date_format) || :default\n delta_minutes = (start_date.to_i - time.to_i).floor / 60\n if delta_minutes.abs <= (8724*60) # eight weeks-- Iím lazy to count days for longer than that\n distance = distance_of_time_in_words(delta_minutes);\n if delta_minutes < 0\n \"#{distance} from now\"\n else\n \"#{distance} ago\"\n end\n else\n return \"on #{system_date.to_formatted_s(date_format)}\"\n end\n end", "def create\n if params[:format]==nil\n user=current_user\n else\n user= current_user\n deny_access if user.nil?\n end\n if params[:word].nil?\n return\n end\n userid = params[:user_id]\n single_word = params[:word][:word].strip()\n old_word = Word.find_by_word_and_user_id(single_word, userid)\n if old_word==nil\n @word = Word.create({:word=>single_word, :user_id => userid})\n @word.translate!\n operation_success=@word.save\n @word.add_tag_by_name('unfamiliar')\n else\n @word = old_word\n operation_success=@word.update_attribute(:updated_at, Time.now)\n @word.save\n end\n\n if operation_success\n respond_to do |format|\n format.json { render :json => @word, :status => :created }\n format.html { redirect_to(user_path(@word.user).to_s) }\n end\n end\n end", "def add_word(word)\n sorted_word = word.lsort\n @data[sorted_word] ||= []\n @data[sorted_word] << word\n if (@max_word_size==nil) || (word.size > @max_word_size)\n @max_word_size = word.size\n end\n end", "def comment_title_in_words(comment, options={})\n \"%{name} added a %{type} %{time} ago\".t % {\n :name => link_to(h(comment.sender.username_or_name), person_path(comment.sender),\n options[:pcard] ? {:class => \"pcard\", :rel => member_path([@tier, comment.sender], :pcard)} : {}),\n :type => comment.class.human_name,\n :time => time_ago_in_words_span_tag(comment.created_at)\n }\n end", "def duration_in_words(started_at, finished_at)\n # difference in seconds\n diff = (finished_at - started_at).to_i\n\n hours = hours_part(diff)\n minutes = minutes_part(diff)\n seconds = seconds_part(diff)\n\n time_pieces = []\n\n time_pieces << I18n.t(:'datetime.distance_in_words.hours_exact', :count => hours) if hours > 0\n time_pieces << I18n.t(:'datetime.distance_in_words.minutes_exact', :count => minutes) if hours > 0 || minutes > 0\n time_pieces << I18n.t(:'datetime.distance_in_words.seconds_exact', :count => seconds)\n\n time_pieces.to_sentence\n end", "def timeago_fuzzy(time, options = {})\n start_date = options.delete(:start_date) || Time.new\n date_format = options.delete(:date_format) || :default\n delta_minutes = (start_date.to_i - time.to_i).floor / 60\n if delta_minutes.abs <= (8760*60) # 365 days\n distance = time_distance_in_words(delta_minutes);\n if delta_minutes < 0\n \"#{distance} from now\"\n else\n \"#{distance} ago\"\n end\n else\n return \"more than 1 year ago\"\n end\n end", "def timeago(time, options = {})\n start_date = options.delete(:start_date) || Time.new\n date_format = options.delete(:date_format) || :default\n delta_minutes = (start_date.to_i - time.to_i).floor / 60\n if delta_minutes.abs <= (8724*60) # eight weeks… I’m lazy to count days for longer than that\n distance = distance_of_time_in_words(delta_minutes);\n if delta_minutes < 0\n \"#{distance} from now\"\n else\n \"#{distance} ago\"\n end\n else\n return \"on #{system_date.to_formatted_s(date_format)}\"\n end\n end", "def add_word(word)\n chars = word.chars\n current = @root\n\n chars.each do |c|\n current = add_character(c, current)\n current.word_count += 1\n end\n current.is_word = true\n end", "def on_words_beg(token)\n log \"WORDS_BEG: '#{token}'\"\n super(token)\n end", "def whisper_words(words)\n\nend", "def timeago(time, options = {})\n start_date = options.delete(:start_date) || Time.new\n date_format = options.delete(:date_format) || :default\n delta_minutes = (start_date.to_i - time.to_i).floor / 60\n #if delta_minutes.abs <= (8724*60) # eight weeks… I’m lazy to count days for longer than that\n distance = distance_of_time_in_words(delta_minutes);\n if delta_minutes < 0\n \"#{distance} from now\"\n else\n \"#{distance} ago\"\n end\n #else\n # return \"on #{system_date.to_formatted_s(date_format)}\"\n #end\n end", "def word_date()\n #Find date action was completed (from database using date_completed function)\n date_string = self.date_completed\n #Return if date does not exist\n return if date_string == nil\n date_string = self.date_completed\n #Parse date into DATETIME format\n date = DateTime.parse(date_string)\n #if the action has not been completed return string anouncing when the action\n #will occur. Logic needed to check if the date is upcoming or overdue.\n if @completed == 'f'\n if date.to_date > Date.today\n return \"DUE: #{date.strftime(\"%B %e, %Y\")}\"\n elsif date.to_date == Date.today\n return \"DUE Today\"\n elsif date.to_date < Date.today\n return \"OVERDUE: #{date.strftime(\"%B %e, %Y\")}\"\n end\n #if action has already been completed, return the date completed.\n else\n return \"#{date.strftime(\"%B %e, %Y\")}\"\n end\n end", "def decorate_word(word)\n word_multiplier = 1\n\n # Word looks something like:\n # { word: \"ha\", indices: [[0, 0], [0, 1]] }\n # Return the word's score, while also checking for any word multipliers.\n score = word[\"indices\"].reduce(0) do |word_value, index|\n y, x = index\n\n this_letter = self.as_two_dimensional_array[y][x]\n\n # Is there a bigger word multiplier?\n if this_letter.word_multiplier > word_multiplier\n word_multiplier = this_letter.word_multiplier\n end\n\n # Return the value of the decorated letter at this index.\n word_value += this_letter.value\n end\n\n word.merge(\n base_score: score,\n multiplier: word_multiplier,\n score: score * word_multiplier\n )\n end", "def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n tweet = word_substituter(tweet)\n end\n tweet\nend", "def selective_tweet_shortener (tweet)\n if(tweet.length > 140)\n word_substituter(tweet)\n else\n tweet\n end\n\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def selective_tweet_shortener(tweet)\n tweet.length > 140 ? word_substituter(tweet) : tweet\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n tweet\n end\nend", "def add_word(word, definition)\r\n @word << {Word: word, Definition: definition}\r\n # puts \"This is @word: #{@word}\"\r\n end", "def timeago(time, options = {})\n options[:class] ||= \"timeago\"\n return unless time\n\n tag.time(time.to_s, options.merge(datetime: time.getutc.iso8601))\n end", "def word_yeller(sentence)\n\n\nend", "def time_running_in_words(run)\n distance_of_time_in_words(0, run.time_running, include_seconds: true)\n end", "def add_word(new_word, categories)\r\n categories.each do |category|\r\n fandom = fetch_fandom(category)\r\n fandom << new_word unless fandom.include? new_word\r\n end\r\n end", "def selective_tweet_shortener(tweet)\nif tweet.length > 140\nword_substituter(tweet)\nelse tweet\nend\nend", "def shortened_tweet_truncator(tweet)\n if tweet.length < 140\n tweet\n else\n word_substituter(tweet)[0...140]\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140\n word_substituter(tweet)\n else\n return tweet\n end\nend", "def timeago(time, options = {})\n options[:class] ||= \"timeago\"\n content_tag(\n :time,\n time.to_s,\n options.merge(datetime: time.getutc.iso8601)\n ) if time\n end", "def create_title(word)\n\tcurrent = word\n\tword_num = 1 # begin word number at one\n\ttitle = \"\" # title begins as empty\n\ttitle += word # add current word\n\twhile word_num !=20 # while we have less than 20 words...\n\t\t\tif ($bigrams.has_key?(current)) # if the word exists in the bigram\n\t\t\t\tif (mcw(current) == nil)\n\t\t\t\t\t# do nothing and exit\n\t\t\t\t\tword_num = 20\n\t\t\t\telse\n\t\t\t\t\taddition = mcw(current) # thing to add is mcw\n\t\t\t\t\ttitle += \" \" # add space for readability\n\t\t\t\t\ttitle += addition # add addition to the title\n\t\t\t\t\tcurrent = addition # set current to the new wordtitle += addition # add the mcw\n\t\t\t\t\tword_num += 1 # increment by one and then go throuh\n\t\t\t\tend\n\t\t\telse word_num = 20 # otherwise, we exit\n\t\t\tend\n\t\tend\n\t\treturn title\nend", "def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)\n from_time = from_time.to_time if from_time.respond_to?(:to_time)\n to_time = to_time.to_time if to_time.respond_to?(:to_time)\n distance_in_minutes = (((to_time - from_time).abs)/60).round\n \n case distance_in_minutes\n when 0..1 then (distance_in_minutes==0) ? 'a few seconds ago' : '1 minute ago'\n when 2..59 then \"#{distance_in_minutes} minutes ago\"\n when 60..90 then \"1 hour ago\"\n when 90..1440 then \"#{(distance_in_minutes.to_f / 60.0).round} hours ago\"\n when 1440..2160 then '1 day ago' # 1 day to 1.5 days\n when 2160..2880 then \"#{(distance_in_minutes.to_f / 1440.0).round} days ago\" # 1.5 days to 2 days\n else from_time.strftime(\"%b %e, %Y %l:%M%p\").gsub(/([AP]M)/) { |x| x.downcase }\n end\n end", "def push(word)\n if self.word_counts.size < 10\n self.word_counts = ( self.word_counts << word )\n else # 10 words already\n unless least_common_word.nil?\n if word[:count] > least_common_word[:count]\n delete_least_common\n self.word_counts = ( self.word_counts << word )\n end\n end\n end\n # @word_counts.sort <- don't want to take the performance hit for large pages\n end", "def selective_tweet_shortener(tweet)\n # tweets.each do |tweet|\n new_tweet = \"\"\n if tweet.length > 140\n new_tweet = word_substituter(tweet)\n else\n new_tweet= tweet\n end\n # end\n new_tweet\nend", "def selective_tweet_shortener(tweet)\n\n if tweet.length <= 140\n tweet\n else\n word_substituter(tweet)\n end\nend", "def selective_tweet_shortener(tweet)\n if tweet.length > 140 \n word_substituter(tweet)\n #\"...\"\n else\n tweet\n end\nend", "def scream(word)\n words = words + \"!!!!\"\nend", "def get_my_words\n # Words associated with online harassment\n trigger_words = [\"rape\",\"murder\",\"nigger\",\"slut\",\"whore\",\"bitch\",\"cunt\",\"kill\",\"die\",\"testword\"]\n my_words = Word.where(user_id: self.id)\n my_words.each do |word|\n trigger_words << word.word\n end\n return trigger_words\n end", "def distance_of_time_in_words(from_time, to_time = 0, include_seconds = false)\n from_time = from_time.to_time if from_time.respond_to?(:to_time)\n to_time = to_time.to_time if to_time.respond_to?(:to_time)\n distance_in_minutes = (((to_time - from_time).abs)/60).round\n\n case distance_in_minutes\n when 0..1 then (distance_in_minutes==0) ? 'a few seconds ago' : '1 minute ago'\n when 2..59 then \"#{distance_in_minutes} minutes ago\"\n when 60..90 then \"1 hour ago\"\n when 90..1440 then \"#{(distance_in_minutes.to_f/60.0).round} hours ago\"\n when 1440..2160 then '1 day ago' # 1 day to 1.5 days\n when 2160..2880 then \"#{(distance_in_minutes.to_f / 1440.0).round} days ago\" # 1.5 days to 2 days\n else from_time.strftime(\"%b %e, %Y %l:%M%p\").gsub(/([AP]M)/) { |x| x.downcase }\n end\n end", "def word_substituter(tweet)\n short_tweet = tweet.split.map do |word|\n if dictionary.keys.include?(word)\n dictionary[word]\n else\n word\n end\n end\n short_tweet.join(\" \")\nend", "def shortened_tweet_truncator(tweet)\n\n if tweet.length <= 140\n tweet\n else\n word_substituter(tweet)[0..136] + \"...\"\n end\nend", "def word_break(word)\n if word.length > 10\n content_tag :abbr, truncate(word, :length => 10), :title => word\n else\n word\n end\n end" ]
[ "0.6873405", "0.6716613", "0.6665151", "0.64654344", "0.6441428", "0.6214084", "0.6205446", "0.619888", "0.6182077", "0.6182077", "0.6179274", "0.61708957", "0.6169517", "0.61432236", "0.605542", "0.60362446", "0.6005615", "0.59549993", "0.59066886", "0.5905385", "0.5843815", "0.58317727", "0.5751394", "0.5694307", "0.5682848", "0.5671547", "0.5667586", "0.5664979", "0.563767", "0.563767", "0.56006926", "0.5575591", "0.55671597", "0.554045", "0.55178016", "0.55178016", "0.5507605", "0.5492348", "0.5469904", "0.5425835", "0.5375385", "0.53526735", "0.5347859", "0.5344221", "0.53052944", "0.53042334", "0.53009987", "0.52814096", "0.52709174", "0.52597946", "0.51805335", "0.51707965", "0.5161645", "0.51186144", "0.51184136", "0.50888175", "0.50715315", "0.5062585", "0.5058751", "0.50477004", "0.5037819", "0.50341827", "0.50298727", "0.502281", "0.50208473", "0.5018228", "0.50169444", "0.50159276", "0.50104165", "0.4999478", "0.49947694", "0.4992843", "0.49907368", "0.49836043", "0.49836043", "0.49836043", "0.49836043", "0.49753648", "0.49732614", "0.49726328", "0.49487615", "0.4945174", "0.4940183", "0.49223578", "0.49169397", "0.49122512", "0.49035954", "0.49015662", "0.49011967", "0.48921695", "0.48895514", "0.48881242", "0.48847255", "0.4882806", "0.48768204", "0.4854196", "0.48507652", "0.4848227", "0.4842555", "0.48287693" ]
0.84902066
0
GET /lists GET /lists.json
def index @lists = List.includes(:items).not_deleted end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_lists\n response = rest(\"get\", \"lists\")\n\n return response[\"lists\"]\n end", "def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end", "def index\n @lists = current_user.lists\n #@lists = List.all\n render json: @lists\n end", "def index\n @lists = List.all\n render json: @lists\n end", "def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end", "def get_lists(user)\n get(\"/#{user}/lists.json\")\n end", "def lists\n client.get_lists\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def lists\n response = get 'lists'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def index\n @lists = current_project.lists\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n @lists = List.all\n @list = List.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def getLists()\n url = \"https://api.nytimes.com/svc/books/v3/lists/names.json\"\n params = {}\n self.request(url, params)\n end", "def index\n json_response(@board.lists)\n end", "def lists(params = {})\n @api.get(\"#{@api.path}/User/Lists\", params: params)\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n @list = List.find(params[:list_id])\n @items = @list.items\n\n respond_with @items\n end", "def list\n get('/')\n end", "def index\n\t\tu = User.find_by(:id => session[:user_id]) \n\t\tif u \n\t\t\t@lists = u.lists.order('id asc')\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html do\n\t\t\t\trender 'index'\n\t\t\tend\n\t\t\tformat.json do\n\t\t\t\trender :json => @lists, :except => [:id, :user_id], :include => :locations\n\t\t\tend\n\t\tend\n\tend", "def list(id)\n get(\"lists/#{id}\").list\n end", "def show\n @list = current_project.lists.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n\n # Set Filter defaults\n\n if params[ :my_lists ].nil? &&\n params[ :public_lists ].nil? then\n\n params[ :my_lists ] = true\n\n end\n\n if params[ :lang ].nil?\n\n params[ :lang ] = Hash[ Language.all.map { |l| [l.id.to_s, \"1\"] } ]\n\n end\n\n if params[ :sortBy ].nil?\n\n params[ :sortBy ] = 'name'\n params[ :dir ] = 'asc'\n\n end\n\n @lists = List.filter( params, current_user ).page( params[:page] || 1 )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def index\n @lists = List.inactive.paginate(page: params[:page], per_page: PER_PAGE)\n\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, items: @lists } }\n end\n end", "def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end", "def list\n get()\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def index\n @lists = @user.lists\n end", "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end", "def get_lists()\n lists = api_request(\"list\")\n return lists.split(\"\\n\")\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @todo_lists = TodoList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todo_lists }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @lists = current_user.lists\n end", "def index\n @lists = current_user.lists\n end", "def index\n @listes = Liste.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listes }\n end\n end", "def index\n @lists = List.all\n\n end", "def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end", "def lists(options = { :filter => :open })\n return @lists if @lists\n @lists = Client.get(\"/boards/#{id}/lists\", options).json_into(List)\n end", "def get_lists_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_lists ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 50\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling ListsApi.get_lists, must be smaller than or equal to 50.'\n end\n\n if @api_client.config.client_side_validation && opts[:'sort'] && !['asc', 'desc'].include?(opts[:'sort'])\n fail ArgumentError, 'invalid value for \"sort\", must be one of asc, desc'\n end\n # resource path\n local_var_path = '/contacts/lists'\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetLists')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_lists\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_items_list(page_id = current_page_id, list_id = current_list_id)\n request \"page/#{page_id}/lists/#{list_id}/items/list\"\n end", "def list(*args)\n fail \"Unacceptable HTTP Method #{request.env['REQUEST_METHOD']} for list\" unless request.get?\n {:action => 'list',\n :args => args}\n end", "def index\n @lists = List.find(:all)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @lists }\n end\n end", "def index\n @lists = current_user.lists.all\n end", "def index\n @lists = current_user.lists.includes(:tasks)\n @list_feeds = current_user.list_feeds.eager_build\n respond_with(@lists)\n end", "def index\n @todos = @list.todos\n render json: @todos\n end", "def index\n @lists = current.user.list\n end", "def lists(uid, params={})\n response = @client.get \"#{@path}/#{uid}/lists\", params\n PaginateResource.new \"#{@path}\", @client, response, Textmagic::REST::List\n end", "def list\n call(:get, path)\n end", "def show\n\t\t@list = List.find_by(id: params[:id])\n\t\t@locations = Location.where(list_id: params[:id]).order('id asc')\n\t\tsession[:list_id]= params[:id]\n\n\t\trespond_to do |format|\n\t\t\tformat.html do\n\t\t\t\trender 'show'\n\t\t\tend\n\t\t\tformat.json do\n\t\t\t\trender :json => @list, :except => [:id, :user_id], :include => :locations\n\t\t\tend\n\t\tend\n\tend", "def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def show\n @list = List.find(params[:id])\n respond_with(@list)\n end", "def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end", "def index\n lists = if params[:filter]\n filter_type = params[:filter]\n case filter_type\n when \"promoted\"\n lists = List.where(promoted: true).recent.page params[:page]\n end\n elsif params[:query]\n List.search(params)\n end\n\n render :json => lists\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def list\n render json: User.all\n end", "def index\n @menu_lists = MenuList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @menu_lists }\n end\n end", "def get_lists(options={})\n visibility = options[:visibility]\n list_type = options[:list_type]\n folder_id = options[:folder_id]\n include_all_lists = options[:include_all_lists]\n include_tags = options[:include_tags]\n\n raise ArgumentError, \"visibility option is required\" unless visibility\n raise ArgumentError, \"list_type option is required\" unless list_type\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.GetLists do\n xml.VISIBILITY visibility\n xml.LIST_TYPE list_type\n xml.FOLDER_ID folder_id if folder_id.present?\n xml.INCLUDE_ALL_LISTS 'true' if include_all_lists.present?\n xml.INCLUDE_TAGS 'true' if include_tags.present?\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['LIST']\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, item: @list } }\n end\n end", "def lists\n @lists = response[\"lists\"]\n if @lists and @lists[\"groups\"]\n @lists[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::List.new(client, item)}\n end\n end\n @lists\n end", "def index(list_name, site_path = '', fields = [])\n url = computed_web_api_url(site_path)\n url = \"#{url}lists/GetByTitle('#{odata_escape_single_quote(list_name)}')/items\"\n url += \"?$select=#{fields.join(\",\")}\" if fields\n\n process_url( uri_escape(url), fields )\n end", "def get_list(id)\n record \"/todos/list/#{id}\"\n end", "def index\n # @playlists = Playlist.all\n # @playlists = @playlists.page(params[:page] || 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { playlists: @playlists } }\n end\n end", "def index\n paginate json: @user.playlists.all\n end", "def get_all_lists_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ListsApi.get_all_lists ...\"\n end\n # resource path\n local_var_path = \"/lists/\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BBOAuth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_all_lists\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @lists = @organization.lists.all\n end", "def index\n @stopword_lists = StopwordList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @stopword_lists }\n end\n end", "def index\n @watch_lists = WatchList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_lists }\n end\n end", "def index\n @todos = @list.todos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todos }\n end\n end", "def index\n @list_items = @list.list_items\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def new\n @list = current_user.lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def getPlaylists\n\t\tuserid = current_user.uid\n\t\tplaylists = GetPlaylistMetadataFromSpotify.build.call(session[\"devise.spotify_data\"])\n\t\tPlaylist.sync_playlists(playlists, userid)\n\t\trender json: playlists\n\tend", "def lists\n load_user_lists\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end", "def index\n @lists = @board.lists\n render json: @lists.as_json(include: [cards: {methods: [:user_ids]}])\n end", "def lists\n Resources::Lists.new(self)\n end", "def index\n @purchase_lists = PurchaseList.all\n render json: @purchase_lists\n end", "def index\n @task_lists = @project.task_lists.all\n\n respond_with @task_lists\n end", "def lists_get(opts = {})\n data, _status_code, _headers = lists_get_with_http_info(opts)\n data\n end", "def json_respond(list) \n respond_to do |format|\n format.json{ render :json => list }\n end\n end", "def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end", "def show\n render json: @list_item\n end", "def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\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\t\t@list = current_user.lists.find(params[:list_id])\n @todos = @list.todos\n end", "def get_list(list_name)\n @lib.get_list(list_name)\n end", "def lists(client_id)\n response = Client_GetLists(\"ClientID\" => client_id)\n return [] if response.empty?\n unless response[\"Code\"].to_i != 0\n response[\"List\"].collect{|l| List.new(l[\"ListID\"].to_i, l[\"Name\"])}\n else\n raise response[\"Code\"] + \" - \" + response[\"Message\"]\n end\n end", "def index\n @gift_lists = GiftList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gift_lists }\n end\n end" ]
[ "0.80919707", "0.7942851", "0.78779286", "0.7858385", "0.7814817", "0.77347493", "0.7703373", "0.7641295", "0.76274574", "0.74937147", "0.7423371", "0.7332808", "0.72778344", "0.7242392", "0.7241362", "0.72268915", "0.7203747", "0.72001815", "0.71932775", "0.7186917", "0.7130836", "0.71253383", "0.70629144", "0.70447356", "0.7025918", "0.70195216", "0.6973325", "0.6973325", "0.69357663", "0.6904329", "0.68711054", "0.684713", "0.684713", "0.68437874", "0.68437874", "0.68437874", "0.68437874", "0.6835432", "0.6815128", "0.6815128", "0.6815128", "0.6815128", "0.67745984", "0.67745984", "0.6760982", "0.6759822", "0.67532444", "0.6747614", "0.67241824", "0.67086494", "0.6693621", "0.6681883", "0.6679688", "0.6678214", "0.6670427", "0.6645213", "0.6644987", "0.66361666", "0.6616846", "0.660567", "0.65950716", "0.6591903", "0.6591125", "0.6581196", "0.6575769", "0.6567372", "0.6565359", "0.6560058", "0.6555089", "0.65296566", "0.65271676", "0.6526771", "0.6519607", "0.65128195", "0.65090376", "0.65075266", "0.6504224", "0.6496956", "0.64953285", "0.64920837", "0.64793426", "0.647624", "0.6468003", "0.64583284", "0.64366126", "0.64300245", "0.6419721", "0.64189875", "0.6413323", "0.6411056", "0.63979554", "0.63953817", "0.639378", "0.6384926", "0.638284", "0.6374929", "0.6373842", "0.6367347", "0.63644445", "0.63492745", "0.6335372" ]
0.0
-1
GET /lists/1 GET /lists/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end", "def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def show\n @list = current_project.lists.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @lists = List.all\n render json: @lists\n end", "def index\n @lists = current_user.lists\n #@lists = List.all\n render json: @lists\n end", "def index\n @lists = current_project.lists\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def index\n @lists = List.all\n @list = List.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @list = List.find(params[:list_id])\n @items = @list.items\n\n respond_with @items\n end", "def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end", "def list(id)\n get(\"lists/#{id}\").list\n end", "def get_lists\n response = rest(\"get\", \"lists\")\n\n return response[\"lists\"]\n end", "def show\n @list = List.find(params[:id])\n respond_with(@list)\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, item: @list } }\n end\n end", "def get_lists(user)\n get(\"/#{user}/lists.json\")\n end", "def index\n json_response(@board.lists)\n end", "def show\n\t\t@list = List.find_by(id: params[:id])\n\t\t@locations = Location.where(list_id: params[:id]).order('id asc')\n\t\tsession[:list_id]= params[:id]\n\n\t\trespond_to do |format|\n\t\t\tformat.html do\n\t\t\t\trender 'show'\n\t\t\tend\n\t\t\tformat.json do\n\t\t\t\trender :json => @list, :except => [:id, :user_id], :include => :locations\n\t\t\tend\n\t\tend\n\tend", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def get_list(id)\n record \"/todos/list/#{id}\"\n end", "def list\n get('/')\n end", "def show\n @list = List.find(params[:id])\n end", "def new\n @list = current_user.lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def list\n get()\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @lists = List.all\n end", "def index\n @todo_lists = TodoList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todo_lists }\n end\n end", "def index\n @lists = @user.lists\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n\n if !@list.public && @list.user != current_user\n\n format.html { redirect_to lists_url, alert: \"You cannot view that list\" }\n format.json { head :no_content, status: :unauthorized }\n\n else\n format.html # show.html.erb\n format.json { render json: @list }\n end\n\n end\n end", "def show\n @list = List.find(params[:id])\n end", "def show\n @list = List.find(params[:id])\n end", "def lists\n client.get_lists\n end", "def index\n\t\tu = User.find_by(:id => session[:user_id]) \n\t\tif u \n\t\t\t@lists = u.lists.order('id asc')\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html do\n\t\t\t\trender 'index'\n\t\t\tend\n\t\t\tformat.json do\n\t\t\t\trender :json => @lists, :except => [:id, :user_id], :include => :locations\n\t\t\tend\n\t\tend\n\tend", "def index\n @list_items = @list.list_items\n end", "def index\n @lists = List.inactive.paginate(page: params[:page], per_page: PER_PAGE)\n\n respond_to do |format|\n format.html\n format.json { render json: { status: 200, items: @lists } }\n end\n end", "def index\n @todos = @list.todos\n render json: @todos\n end", "def index\n @lists = List.all\n\n end", "def index(list_name, site_path = '', fields = [])\n url = computed_web_api_url(site_path)\n url = \"#{url}lists/GetByTitle('#{odata_escape_single_quote(list_name)}')/items\"\n url += \"?$select=#{fields.join(\",\")}\" if fields\n\n process_url( uri_escape(url), fields )\n end", "def index\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @list_items }\n end\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n\n # Set Filter defaults\n\n if params[ :my_lists ].nil? &&\n params[ :public_lists ].nil? then\n\n params[ :my_lists ] = true\n\n end\n\n if params[ :lang ].nil?\n\n params[ :lang ] = Hash[ Language.all.map { |l| [l.id.to_s, \"1\"] } ]\n\n end\n\n if params[ :sortBy ].nil?\n\n params[ :sortBy ] = 'name'\n params[ :dir ] = 'asc'\n\n end\n\n @lists = List.filter( params, current_user ).page( params[:page] || 1 )\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def set_list\n @list = @lists.find(params[:id])\n end", "def new\n @list = List.find(params[:id])\n @todolist = @list.todolists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todolist }\n end\n end", "def show\n render json: @list_item\n end", "def find_list\n @list = List.find(params[:id])\n end", "def show\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @twitter_list }\n end\n end", "def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end", "def index\n @listes = Liste.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listes }\n end\n end", "def show\n @lista = Lista.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lista }\n end\n end", "def show\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@todo_list }\n end\n end", "def lists\n response = get 'lists'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def show\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo_list }\n end\n end", "def find_list\n @list = current_user.lists.find params[:id]\n end", "def index\n\t\t@list = current_user.lists.find(params[:list_id])\n @todos = @list.todos\n end", "def index\n @lists = List.find(:all)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @lists }\n end\n end", "def index\n @lists = current_user.lists\n end", "def index\n @lists = current_user.lists\n end", "def show\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "def index\n @todos = @list.todos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @todos }\n end\n end", "def new\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list_item }\n end\n end", "def getLists()\n url = \"https://api.nytimes.com/svc/books/v3/lists/names.json\"\n params = {}\n self.request(url, params)\n end", "def show\n @liste = Liste.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @liste }\n end\n end", "def show\n @list_to_do = ListToDo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_to_do }\n end\n end", "def index\n @lists = current_user.lists.all\n end", "def list_items_list(page_id = current_page_id, list_id = current_list_id)\n request \"page/#{page_id}/lists/#{list_id}/items/list\"\n end", "def show\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @list_item }\n end\n end", "def show\n if user_signed_in?\n @list = List.includes( listeds: [:listable] ).find(params[:id])\n render layout: 'layouts/twoColumn'\n else\n respond_to do |format|\n format.html { redirect_to management_lists_path(:user), notice: 'You must have an account to manage lists' }\n format.json { head :no_content }\n end\n end\n end", "def load_list(index)\n list = session[:lists][index] if index && session[:lists][index]\n return list if list\n\n session[:error] = \"The specified list was not found.\"\n redirect \"/lists\"\nend", "def new\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def new\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def new\n @list = List.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @api_v1_shopping_lists = ShoppingList.all\n end", "def index\n @lists = current_user.lists.includes(:tasks)\n @list_feeds = current_user.list_feeds.eager_build\n respond_with(@lists)\n end", "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end", "def index\n @watch_lists = WatchList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @watch_lists }\n end\n end", "def index\n # @playlists = Playlist.all\n # @playlists = @playlists.page(params[:page] || 1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: { playlists: @playlists } }\n end\n end", "def new\n @list = List.find(params[:list_id])\n @item = @list.items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item }\n end\n end", "def find_list(id)\n check_token\n response = self.class.get(\"/lists/#{id}\", headers: headers)\n check_and_raise_errors(response)\n Todoable::List.build_from_response(response.parsed_response)\n end", "def list\n session[:list_type_id] = ListType.find(:first).id if session[:list_type_id] == nil\n @list_items = ListItem.find_all_by_user_id_and_list_type_id(\n session[:user_id], \n session[:list_type_id],\n :order => \"position\") \n if @list_items.size > 0\n @list_item = @list_items.first\n session[:list_item_id] = @list_items.first.id\n else\n session[:list_item_id] = nil\n end\n end", "def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end", "def list(*args)\n fail \"Unacceptable HTTP Method #{request.env['REQUEST_METHOD']} for list\" unless request.get?\n {:action => 'list',\n :args => args}\n end", "def index\n @lists = current.user.list\n end", "def index\n @lists = @organization.lists.all\n end", "def index\n @list_items = ListItem.all\n end", "def index\n @list_items = ListItem.all\n end", "def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def lists(params = {})\n @api.get(\"#{@api.path}/User/Lists\", params: params)\n end", "def update\n @list = current_user.lists.find(params[:id])\n @list.update_attributes(params[:list])\n respond_with(@list, :location => my_list_url(@list))\n end", "def set_list\n @list = List.find(params[:id])\n end", "def set_list\n @list = List.find(params[:id])\n end", "def set_list\n @list = List.find(params[:id])\n end", "def set_list\n @list = List.find(params[:id])\n end", "def get_list_with_http_info(list_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ListsApi.get_list ...'\n end\n # verify the required parameter 'list_id' is set\n if @api_client.config.client_side_validation && list_id.nil?\n fail ArgumentError, \"Missing the required parameter 'list_id' when calling ListsApi.get_list\"\n end\n # resource path\n local_var_path = '/contacts/lists/{listId}'.sub('{' + 'listId' + '}', list_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api-key', 'partner-key']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'GetExtendedList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ListsApi#get_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_items(projectid, todolistid)\n get(\"projects/#{projectid}/todolists/#{todolistid}.json\")\n end" ]
[ "0.8099958", "0.7619997", "0.761726", "0.75235164", "0.7344148", "0.73051035", "0.7288008", "0.72827184", "0.7276825", "0.7225588", "0.7191228", "0.7191228", "0.7191228", "0.7191228", "0.7183411", "0.70508593", "0.6998307", "0.6960058", "0.69095707", "0.68436193", "0.6841866", "0.67955124", "0.67922306", "0.6774321", "0.67737085", "0.6734134", "0.664782", "0.6647463", "0.66375834", "0.6630131", "0.6630131", "0.6630131", "0.6630131", "0.66300124", "0.66281736", "0.66249853", "0.66238487", "0.66238487", "0.6621678", "0.6603326", "0.660235", "0.6601921", "0.65946436", "0.65865445", "0.65834713", "0.65676236", "0.6559905", "0.6558541", "0.6549538", "0.6542037", "0.65368164", "0.65343475", "0.65328705", "0.65298444", "0.6515015", "0.6510506", "0.6503932", "0.65003896", "0.6499364", "0.6499053", "0.6472925", "0.64679897", "0.6461007", "0.6461007", "0.64265645", "0.6422106", "0.6402482", "0.63712454", "0.6362532", "0.6361672", "0.6358802", "0.6357442", "0.6341598", "0.63413155", "0.6324848", "0.6323907", "0.6323907", "0.6323907", "0.631288", "0.6303218", "0.6298898", "0.6286327", "0.62848", "0.62724787", "0.6268944", "0.62524766", "0.6252309", "0.62500846", "0.6243134", "0.6241051", "0.62410396", "0.62410396", "0.62342525", "0.62282234", "0.62280446", "0.6216349", "0.6216349", "0.6216349", "0.6216349", "0.62126356", "0.618848" ]
0.0
-1
POST /lists POST /lists.json
def create @list = List.new(list_params) respond_to do |format| if @list.save @lists = List.not_deleted format.js else format.js { render json: @list.errors} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end", "def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end", "def create\n @list = List.create!(list_params)\n json_response(@list, :created)\n end", "def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end", "def create\n @list = @user.lists.create(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n nested = params[:list].delete(:list_items_attributes)\n\n @list = List.new( params[:list] )\n @list.user = current_user\n\n records = nested.collect do |_, fields| \n\n ListItem.new( { \"list\" => @list }.merge( fields ) ) if !item_blank?( fields )\n\n end.compact\n\n respond_to do |format|\n if @list.save && records.map( &:save ).all?\n\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n\n else\n\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def create\n @list = current_user.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n list = List.find(params[:list_id])\n @list_item = list.list_items.new(list_items_params)\n @list_item.save ? json_response(@list_item) : json_response(@list_item.errors, status = :not_acceptable)\n end", "def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = current_user.lists.new(new_list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to my_list_path(@list), notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: my_list_path(@list) }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = current_user.lists.build(params[:list])\n respond_to do |format|\n format.js\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Nice Work- List Created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n @list.user = current_user\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_post(api_key, access_token, list, body, opts = {})\n list_post_with_http_info(api_key, access_token, list, body, opts)\n return nil\n end", "def create\n @list = current_user.lists.build(params[:list])\n @list.user = current_user\n @user = @list.user\n respond_to do |format|\n if @list.save\n \n format.html { redirect_to root_path, notice: 'List was successfully created!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n @feed_items = []\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(name)\n Iterable.request(conf, '/lists').post(name: name)\n end", "def create_list(name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.post(\n '/lists', body: list.post_body, headers: headers\n )\n check_and_raise_errors(response)\n attributes = response.parsed_response.merge!('items' => [])\n Todoable::List.build_from_response(attributes)\n end", "def create\n @list = @project.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@project, @list], notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render layout: 'form', action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @saved_list = SavedList.new(saved_list_params)\n\n respond_to do |format|\n if @saved_list.save\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully created.\" }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Funcionario adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def create_list(project_id, list)\n record \"/projects/#{project_id}/todos/create_list\", list\n end", "def create\n\n # Create new saved list table entry\n @saved_list = SavedList.new\n\n # Store attributes\n @saved_list.login_id = params[:login_id]\n @saved_list.list_name = params[:list_name]\n @saved_list.saved_user_list = true\n @saved_list.date_saved = params[:date_saved]\n\n # Save the saved list\n respond_to do |format|\n if @saved_list.save\n\n # Create new user saved list entries for all users in list\n @user_ids = params[\"user_ids\"]\n @user_ids.each do |user_id|\n SavedListUser.create(saved_list_id: @saved_list.id, user_id: user_id)\n end\n\n format.html { redirect_to @saved_list, notice: 'Saved list was successfully created.' }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = current_user.lists.find params[:list_id]\n @item = @list.items.build(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully created.' }\n #format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n #format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:title, \n :description, \n :list_type_id, \n :list_type,\n list_items_attributes: [:item, :id, :_destroy]\n )\n end", "def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save(list_params)\n if(cookies[:list].blank?)\n cookies[:list]=\"\"\n end\n cookies[:list]=cookies[:list]+\",#{@list.id}\"\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n \n else\n @lists=set_lists\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def create\n @listitem = Listitem.new(listitem_params)\n\n if @todolist.listitems << @listitem\n render :show, status: :created, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend", "def create\n @twitter_list = TwitterList.new(params[:twitter_list])\n\n respond_to do |format|\n if @twitter_list.save\n format.html { redirect_to @twitter_list, notice: 'Twitter list was successfully created.' }\n format.json { render json: @twitter_list, status: :created, location: @twitter_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @twitter_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = @organization.lists.build(list_params.merge(creator: authed_user))\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: [@list.organization, @list] }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @lists = List.all\n @list = List.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def create\n @list = List.new(list_params)\n # formatがhtmlで指定されていたら@listにリダイレクト、jsonで指定されていたらshowにリダイレクト?\n # 通常時ではHTML形式(いつもウェブサイト上で見る形)で結果を取得したいけど、明示的にJSON形式やXML形式を指定した場合は\n # JSON形式やXML形式で返すようにするメソッドらしい\n # 今回の運用ではhtmlの方しか使わない\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def create\n ListItem.transaction do\n item = Item.new(item_params)\n item.save\n\n @list_item = ListItem.new(list_item_params)\n @list_item.item_id = item.id\n @list_item.list_id = params[:list_id]\n\n\n if @list_item.save\n render json: @list_item, status: :created\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n @list = List.new(list_params)\n if @list.save\n \t#flash notice on successful creation of a list\n \tflash[:notice] = \"List successfully added!\"\n redirect_to lists_path(@list)\n else\n render :new\n flash[:alert] = \"ERROR :(\"\n end\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def create\n @list = List.new(params[:list])\n if @list.save\n redirect_to @list, :notice =>\"List successfully created.\"\n else\n flash[:error] = \"Your list could not be saved.\"\n render :action => \"new\"\n end\n end", "def list_params\n params.require(:list).permit(:todo)\n end", "def list_params\n params.require(:list).permit(:name, :description)\n end", "def create\n @task_list = TaskList.new(task_list_params)\n\n if @task_list.save\n render json: @task_list, status: :created, location: @task_list\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def new\n @list = List.new\n\n @list.list_items.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def update_list(user, list, options={})\n post(\"/#{user}/lists/#{list}.json\", options)\n end", "def list_params\n params.require(:list).permit(:title, :description)\n end", "def create\n @list = current_user.lists.build(params[:list])\n location = @list.save ? my_list_url(@list.id) : new_my_list_url\n respond_with(@list, :location => location )\n end", "def create\n @todo_list = TodoList.new(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to @todo_list, :notice=>\"Todo list was successfully created.\" }\n format.json { render :json=>@todo_list, :status=>:created, :location=>@todo_list }\n else\n format.html { render :action=>\"new\" }\n format.json { render :json=>@todo_list.errors, :status=>:unprocessable_entry }\n end\n end\n end", "def create\n @list = List.new(params[:list])\n @list.feeds_by_id = ''\n @list.user_id = current_user.id\n \n @lists = current_user.lists\n @feeds = current_user.feeds\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to(@list, :notice => 'List was successfully created.') }\n format.xml { render :xml => @list, :status => :created, :location => @list }\n format.js {render :layout => false}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @list.errors, :status => :unprocessable_entity }\n format.js {render :layout => false}\n end\n end\n end", "def create\n @task_list = TaskList.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n @task_lists = TaskList.all\n format.html { render :index, notice: 'Task list was successfully created.' }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html { render :new }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@list = List.new(list_params)\n\t\t@list.save\n\t\t\tredirect_to '/tasks'\n\tend", "def list_params\n params.require(:list).permit(:name,:amount,:body,:status,:group_id, :list )\n end", "def new\n @list = List.find(params[:id])\n @todolist = @list.todolists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todolist }\n end\n end", "def create\n\n @list_item = @list.list_items.create!(list_item_params)\n #@list_item = @list.list_items.create!(params[:list_item])\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to list_path(@list), notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end", "def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end", "def create\n @ml_list = Ml::List.new(ml_list_params)\n authorize! :create, @ml_list\n\n respond_to do |format|\n if @ml_list.save\n format.html { redirect_to @ml_list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @ml_list }\n else\n\n format.html { render :new }\n format.json { render json: @ml_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n if @list.save\n respond_successfully(I18n.t('integral.backend.lists.notification.creation_success'), backend_list_path(@list))\n else\n respond_failure(I18n.t('integral.backend.lists.notification.creation_failure'), :new)\n end\n end", "def create\n @tags = Tag.all\n @list_item = @list.list_items.new(list_item_params)\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to list_path(@list), notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @model_list = ModelList.new(model_list_params)\n\n respond_to do |format|\n if @model_list.save\n format.html { redirect_to @model_list, notice: 'Model list was successfully created.' }\n format.json { render :show, status: :created, location: @model_list }\n else\n format.html { render :new }\n format.json { render json: @model_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(params[:list])\n @list.user = current_user\n if @list.save\n user_session.select_list @list\n flash[:notice] = 'Lista criada com sucesso!'\n redirect_to edit_list_nomes_path\n else\n flash[:notice] = 'Não foi possível uma nova lista!'\n render :action => \"new\"\n end\n end", "def create\n @list = List.new(list_params)\n if @list.save\n return redirect_to list_url(@list)\n else\n flash[:error] = \"U is broken yo\"\n return render :new\n end\n end", "def list_params\n params.require(:list).permit(:title, :category_id, :body)\n end", "def create\n @list = Blog::List.new(list_params)\n\n respond_to do |format|\n if @list.save\n ActionCable.server.broadcast \"board\",\n { commit: 'addList', \n payload: render_to_string(:show, formats: [:json]) }\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @list = current_user.lists.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list }\n end\n end", "def list_params\n params.require(:list).permit(:name, :permalink, :description, :picurl)\n end", "def create\n\n @list = List.find(params[:list_id])\n @comment = Comment.where(list_id: @list.id).new(comment_params)\n @comment.user = @current_user\n\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors, status: :unprocessable_entity\n end\n \n end", "def create\n @list = List.new(params[:list])\n Grade.all.each do |g|\n @list.posts.build(gname: g.name, tname: g.teacher_name)\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_list = TaskList.new(params[:task_list])\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'Task list was successfully created.' }\n format.json { render json: @task_list, status: :created, location: @task_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @task_list = Task::List.new(task_list_params)\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @task_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.js { render :new, status: :unprocessable_entity }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def list_params\n params.require(:list).permit(:name, :date, :family_id)\n end", "def create\n @lista = Lista.new(params[:lista])\n\n respond_to do |format|\n if @lista.save\n format.html { redirect_to @lista, notice: 'Lista was successfully created.' }\n format.json { render json: @lista, status: :created, location: @lista }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lista.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:title, :description, :slug)\n end", "def list_params\n params.permit(:list_name)\n end", "def create_list(name, source, opt_in_type)\n endpoint = \"/api/v1/list/create/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end", "def create\n @todo_list = TodoList.new(params[:todo_list])\n\n respond_to do |format|\n if @todo_list.save\n format.html { redirect_to @todo_list, notice: 'Todo list was successfully created.' }\n format.json { render json: @todo_list, status: :created, location: @todo_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_list(name)\n Wunderlist::List.new(name, false, self).save\n end", "def list_params\n params.require(:list).permit(:user_id, :name, :privacy, :status, :description, \n user:[:name, :id], task:[:id, :list_id, :title, :note, :completed])\n end", "def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to club_path(@list.club_id), notice: 'List was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end", "def create\n @todoslist = Todoslist.new(todoslist_params)\n\n respond_to do |format|\n if @todoslist.save\n format.html { redirect_to @todoslist, notice: \"Todoslist was successfully created.\" }\n format.json { render :show, status: :created, location: @todoslist }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @todoslist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@list = List.new(list_params)\n @list = current_user.lists.create(list_params)\n if params[:campsite_id] && @list.listeds.find_by_campsite_id(params[:campsite_id]).blank?\n campsite = Campsite.find(params[:campsite_id])\n @listed = campsite.listeds.create(list:@list.id, user_id:current_user.id)\n #@listed = Listed.new()\n #@listed.list_id = @list.id\n #@listed.user_id = current_user.id\n #@listed.save\n end\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to management_lists_path, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list_item }\n end\n end", "def create\n # @task_list = TaskList.new(params[:task_list])\n\n respond_to do |format|\n if @task_list.save\n format.html { redirect_to @task_list, notice: 'Task list was successfully created.' }\n format.json { render json: @task_list, status: :created, location: @task_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_list(params)\n MailManager::List.create(params)\n end", "def create\n @list_item = ListItem.new(list_item_params)\n\n respond_to do |format|\n if @list_item.save\n format.html { redirect_to @list_item, notice: 'List item was successfully created.' }\n format.json { render :show, status: :created, location: @list_item }\n else\n format.html { render :new }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:title, :description, :is_deleted)\n end", "def add_post(api_key, access_token, list, body, opts = {})\n data, _status_code, _headers = add_post_with_http_info(api_key, access_token, list, body, opts)\n return data\n end", "def create\n @lista = Lista.new(lista_params)\n\n respond_to do |format|\n if @lista.save\n format.html { redirect_to @lista, notice: 'Lista was successfully created.' }\n format.json { render action: 'show', status: :created, location: @lista }\n else\n format.html { render action: 'new' }\n format.json { render json: @lista.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_params\n params.require(:list).permit(:name, :user_id, :position)\n end", "def create\n list = current_user.lists.build(params[:list])\n list.current_users << current_user\n\n if list.save\n flash[:notice] = t('messages.list.success.create', title: list.title)\n redirect_to list_experts_url(list)\n else\n flash[:alert] = t('messages.list.errors.create')\n redirect_to lists_url\n end\n end", "def list_params\n params.require(:list).permit(:name, :position)\n end", "def create_todo_item(name, list_id)\n data = {\n item: {\n name: name\n }\n }\n rest(\"post\", \"lists/#{list_id}/items\", data)\n end", "def list_params\n params.require(:list).permit(:title, :position)\n end" ]
[ "0.7744856", "0.7644541", "0.76097417", "0.74585795", "0.72567004", "0.71968704", "0.7191225", "0.7155085", "0.7108538", "0.70642173", "0.7063542", "0.7063542", "0.7029331", "0.7013641", "0.69427305", "0.69293773", "0.68952435", "0.68616366", "0.6841231", "0.67964596", "0.679132", "0.67798823", "0.6775282", "0.67568296", "0.6755146", "0.6739162", "0.6724885", "0.669875", "0.66985923", "0.66944593", "0.66586375", "0.66586375", "0.66586375", "0.6654024", "0.6641378", "0.66368884", "0.66308945", "0.6629695", "0.6626051", "0.662361", "0.6621519", "0.662094", "0.66125464", "0.65958536", "0.6580576", "0.65761405", "0.6564436", "0.65635926", "0.6556275", "0.6552358", "0.6551375", "0.6547072", "0.6546383", "0.6538667", "0.6522907", "0.6516226", "0.65112454", "0.6506644", "0.64972687", "0.64915645", "0.6486749", "0.6485955", "0.64855814", "0.6470067", "0.64681727", "0.64635897", "0.64635754", "0.6462675", "0.64536023", "0.644971", "0.64394313", "0.6433141", "0.6426378", "0.642414", "0.64195186", "0.6417403", "0.6412674", "0.6411683", "0.641107", "0.63999176", "0.6394347", "0.63905144", "0.6382425", "0.6372378", "0.6370327", "0.6368802", "0.63609797", "0.63576424", "0.63576204", "0.6348585", "0.63290465", "0.6326838", "0.6315875", "0.63155717", "0.6314002", "0.6292331", "0.6281695", "0.62805134", "0.6278035", "0.62771875" ]
0.670565
27
PATCH/PUT /lists/1 PATCH/PUT /lists/1.json
def update respond_to do |format| if @list.update(list_params) @lists = List.not_deleted format.js else format.js { render json: @list.errors } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end", "def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end", "def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = current_user.lists.find(params[:id])\n @list.update_attributes(params[:list])\n respond_with(@list, :location => my_list_url(@list))\n end", "def update_list(list_id:, name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.patch(\n \"/lists/#{list_id}\",\n body: list.post_body,\n headers: headers,\n format: :text\n )\n check_and_raise_errors(response)\n # This endpoint returns a plaintext body: \"<new name> updated\", so\n # while I'd like to return a List with ListItems, that would require\n # first looking up the list which isn't ideal. So we'll return true, ask\n # todoable to fix this endpoint, and make developers keep track of the\n # name change\n true\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(existing_list_params)\n format.html { redirect_to my_list_path(@list), notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: my_list_path(@list) }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @list\n\n if @list.update(list_params)\n json_response(@list.decorate, :ok)\n else\n json_response(@list.errors, :unprocessable_entity)\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to management_lists_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(user, list, options={})\n post(\"/#{user}/lists/#{list}.json\", options)\n end", "def update\n @list = List.find(params[:id])\n\n nested = params[:list].delete( :list_items_attributes )\n\n new_items = []\n\n if nested then\n nested.each do |i, r|\n\n if !r.key?( \"id\" )\n\n new_items << ListItem.new( { \"list\" => @list }.merge( r ) ) if !item_blank?( r )\n\n nested.delete( i )\n\n else\n\n r[ \"_destroy\" ] = \"true\" if item_blank?( r )\n\n end\n\n end\n end\n\n respond_to do |format|\n if @list.update_attributes( params[ :list ] ) && \n @list.update_attributes( list_items_attributes: (nested || {}) ) &&\n new_items.map( &:save ).all? then\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n\n else\n\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def update\n \n @list_item = ListItem.find(params[:id])\n\n if @list_item.update(list_item_params)\n head :no_content\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @list.update(_list_params)\n format.html { redirect_to @list, notice: \"List was successfully updated.\" }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = @project.lists.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to [@project, @list], notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'The List was updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: blog_list_path(@list) }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'Changes and Additions Successful.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: [@list.organization, @list] }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n @list.user = current_user\n @user = @list.user\n\n respond_to do |format|\n if @list.update_attributes(params[:todo])\n format.html { redirect_to root_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listed.update(listed_params)\n format.html { redirect_to session[:previous_url], notice: 'List item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n format.html { redirect_to @todo_list, :notice=>\"Todo list was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@todo_list.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end", "def update(options = {})\n self.merge!(Vermonster::Client.connection.put(\"lists/#{self[\"id\"]}\", \"{\\\"list\\\": #{options.to_json}}\").body)\n end", "def update\n @list.update_attributes list_params\n end", "def update\n\t\t@list = List.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @list.update_attributes(params[:list])\n\t\t\t\tformat.html\t{ redirect_to(root_url) }\n\t\t\t\tformat.xml\t{ head :ok }\n\t\t\telse\n\t\t\t\tformat.html\t{ render :action => \"edit\" }\n\t\t\t\tformat.xml\t{ render :xml => @list.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update_list\n current_path = '/api/v1/update'\n @conn.get(current_path)\n end", "def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n format.html { redirect_to @todo_list, notice: 'Todo list was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n list_attributes = params[:list] || params[:check_list]\n \n if @list.update(list_attributes)\n flash[:notice] = t(:list_saved)\n redirect_to @list\n else\n render :action => 'edit'\n end\n end", "def update\n \t@list = current_user.lists.find params[:list_id]\n @item = @list.items.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully updated.' }\n #format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n #format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list.id)\n url = build_url(url)\n payload = list.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n\n else\n format.html { render :edit }\n\n end\n end\n end", "def update\n respond_to do |format|\n if @todoit_list.update(todoit_list_params)\n format.html { redirect_to @todoit_list, notice: 'Todoit list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @todoit_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @task_list = TaskList.find(params[:id])\n\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.html { redirect_to @task_list, notice: 'Task list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @saved_list.update(saved_list_params)\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully updated.\" }\n format.json { render :show, status: :ok, location: @saved_list }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n flash[:notice] = '修改成功!'\n format.html { redirect_to action: \"index_admin\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n list = List.find_by_title(params[:task][:list_title])\n task_params = Task.format_params(params[:task][:title], params[:task][:description], list.id)\n respond_to do |format|\n if @task.update(task_params)\n format.html { redirect_to lists_url, notice: \"Task was successfully updated.\" }\n format.json { render :show, status: :ok, location: @task }\n else\n format.html { render :edit }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_list.update(task_list_params)\n @task_lists = TaskList.all\n format.html { render :index, notice: 'Task list was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_list }\n else\n format.html { render :edit }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @set_list.update(set_list_params)\n format.html { redirect_to @set_list, notice: 'Set list was successfully updated.' }\n format.json { render :show, status: :ok, location: @set_list }\n else\n format.html { render :edit }\n format.json { render json: @set_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task_list = TaskList.find(params[:id])\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.html { redirect_to @task_list, notice: 'Task list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task_list = TaskList.find(params[:id])\n\n if @task_list.update(task_list_params)\n head :no_content\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @todo_list.update(todo_list_params)\n format.html { redirect_to work_todo_list_path, notice: 'Todo list was successfully updated.' }\n format.json { render :show, status: :ok, location: work_todo_list_path }\n else\n format.html { render :edit }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @listitem.update(listitem_params)\n render :show, status: :ok, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend", "def update\n @list_to_do = ListToDo.find(params[:id])\n\n respond_to do |format|\n if @list_to_do.update_attributes(params[:list_to_do])\n format.html { redirect_to new_list_to_do_path, notice: 'List to do was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list_to_do.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @list_items = args[:list_items] if args.key?(:list_items)\n end", "def update\n respond_to do |format|\n if @todo_list.update(todo_list_params)\n format.html { redirect_to root_path, notice: 'Todo list was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo_list }\n else\n format.html { render :edit }\n format.json { render json: @todo_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listtodo.update(listtodo_params)\n format.html { redirect_to @listtodo, notice: 'Listtodo was successfully updated.' }\n format.json { render :show, status: :ok, location: @listtodo }\n else\n format.html { render :edit }\n format.json { render json: @listtodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to list_path(@list), notice: 'List item was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_item }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @model_list.update(model_list_params)\n format.html { redirect_to @model_list, notice: 'Model list was successfully updated.' }\n format.json { render :show, status: :ok, location: @model_list }\n else\n format.html { render :edit }\n format.json { render json: @model_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to @list, notice: 'List item was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_item }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @job_list = JobList.find(params[:id])\n\n respond_to do |format|\n if @job_list.update_attributes(params[:job_list])\n format.html { redirect_to @job_list, notice: 'Job list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @job_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to list_todo_path(@list, @todo), notice: 'Todo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @todolists.update(todolist_params)\n format.html { redirect_to @todolists, notice: 'Task was successfully updated.' }\n format.json { render :show, status: :ok, location: @todolists }\n else\n format.html { render :edit }\n format.json { render json: @todolists.errors, status: :unprocessable_entity }\n end\n end\nend", "def update\n respond_to do |format|\n if @todolist.update(todolist_params)\n format.html { redirect_to @todolist, notice: 'Todolist was successfully updated.' }\n format.json { render :show, status: :ok, location: @todolist }\n else\n format.html { render :edit }\n format.json { render json: @todolist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @item_list.update(item_list_params)\n format.html { redirect_to @item_list, notice: 'Item list was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_list }\n else\n format.html { render :edit }\n format.json { render json: @item_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n self.init\n authorize! :read, @list\n authorize! :update, @task\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @list, notice: I18n.t('tasks.update_success') }\n format.json { render json: [] }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:list_id])\n @list_item = @list.list_items.find(params[:id])\n\n if @list_item.update_attributes(params[:list_item])\n flash[:success] = \"List item was successfully updated.\"\n redirect_to list_path(@list) \n else\n flash[:errror] = \"Unable to update item.\"\n redirect_to edit_list_list_item_path(@list, @list_item)\n end\n end", "def update\n respond_to do |format|\n if @todoslist.update(todoslist_params)\n format.html { redirect_to @todoslist, notice: \"Todoslist was successfully updated.\" }\n format.json { render :show, status: :ok, location: @todoslist }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @todoslist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_list.update(task_list_params)\n format.html { redirect_to @task_list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_list }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list.entity, notice: 'La Liste de propositions pour la semaine ' + @list.date.to_time.strftime(\"%W\") + ' a été modifiée avec succès.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n @show_list = true\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { render @list }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @adventure.errors, :status => :unprocessable_entity }\n end\n end\n end", "def editList\n\t\t@list = List.find(params[:id])\n\tend", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to @list_item, notice: 'List item was successfully updated.' }\n format.json { render :show, status: :ok, location: @list_item }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n if @get_restaurant_list.update(params[:get_restaurant_list])\n head :no_content\n else\n render json: @get_restaurant_list.errors, status: :unprocessable_entity\n end\n end", "def update\n prepare_form\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'Os dados do funcionario foram atualizados com sucesso.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @email_list.update(email_list_params)\n format.html { redirect_to @email_list, notice: 'Email list was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_list }\n else\n format.html { render :edit }\n format.json { render json: @email_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thing_list = ThingList.find(params[:id])\n\n respond_to do |format|\n if @thing_list.update_attributes(params[:thing_list])\n format.html { redirect_to(@thing_list, :notice => 'Thing list was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @thing_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @list.update(list_params)\n respond_successfully(I18n.t('integral.backend.lists.notification.edit_success'), backend_list_path(@list))\n else\n respond_failure(I18n.t('integral.backend.lists.notification.edit_failure'), :show)\n end\n end", "def update\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n if @invite_list.update_attributes(params[:invite_list])\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item.update_attributes(item_params)\n @items = List.find(item_params[:list_id]).items.order(\"id ASC\")\n @list_id = @item.list.id\n end", "def update\n authorize! :update, @ml_list\n respond_to do |format|\n if @ml_list.update(ml_list_params)\n format.html { redirect_to @ml_list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @ml_list }\n else\n format.html { render :edit }\n format.json { render json: @ml_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @twitter_list = TwitterList.find(params[:id])\n\n respond_to do |format|\n if @twitter_list.update_attributes(params[:twitter_list])\n format.html { redirect_to @twitter_list, notice: 'Twitter list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @twitter_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_shopping_list.update(api_v1_shopping_list_params)\n format.html { redirect_to @api_v1_shopping_list, notice: 'Shopping list was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_shopping_list }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_shopping_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id:, name:)\n list = client.update_list(id: id, name: name)\n\n Todoable::List.new(list)\n end", "def update!(**args)\n @list_options = args[:list_options] if args.key?(:list_options)\n end", "def update\n respond_to do |format|\n if @setlist.update(setlist_params)\n format.html { redirect_to @setlist, notice: \"Setlist was successfully updated.\" }\n format.json { render :show, status: :ok, location: @setlist }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @setlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list= List.find(params[:id])\n if @list.update(list_params)\n \tflash[:notice] = \"List successfully updated!\"\n redirect_to list_path(@list)\n else\n render :edit\n flash[:alert] = \"ERROR :(\"\n end\n end", "def rename_list(list_id, name)\n path = \"lists/#{list_id}\"\n params = { list: { name: name }}\n request(path, params, :put )\n \n # output full list again\n show_list(list_id)\n end", "def update\n @task = current_user.lists.find(params[:list_id]).tasks.find(params[:id])\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.js\n else\n render :js => \"TODO_IT.UI.show_alert('Something went wrong.')\"\n end\n end\n end", "def update\n @lista = Lista.find(params[:id])\n\n respond_to do |format|\n if @lista.update_attributes(params[:lista])\n format.html { redirect_to @lista, notice: 'Lista was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lista.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mylist = Mylist.find(params[:id])\n\n respond_to do |format|\n if @mylist.update_attributes(params[:mylist])\n format.html { redirect_to(@mylist, :notice => 'Mylist was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mylist.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list_item.update(list_item_params)\n format.html { redirect_to @list_item, notice: 'List item was successfully updated.' }\n format.json { render json: @list_item, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @list_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo_list = TodoList.find(params[:id])\n\n respond_to do |format|\n if @todo_list.update_attributes(params[:todo_list])\n flash[:notice] = 'TodoList was successfully updated.'\n format.html { redirect_to(@todo_list) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @todo_list.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @recipe_list.update(recipe_list_params)\n format.html { redirect_to @recipe_list, notice: 'Recipe list was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_list }\n else\n format.html { render :edit }\n format.json { render json: @recipe_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_todo.update(api_v1_todo_params)\n format.json { render json: @api_v1_todo, status: :ok }\n else\n format.json { render json: @api_v1_todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @watch_list = WatchList.find(params[:id])\n\n respond_to do |format|\n if @watch_list.update_attributes(params[:watch_list])\n format.html { redirect_to @watch_list, notice: 'Watch list was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @watch_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service_list.update(service_list_params)\n format.html { redirect_to @service_list, notice: 'Service list was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_list }\n else\n format.html { render :edit }\n format.json { render json: @service_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(item_name, item_list, quantity)\n add_list(item_name, item_list, quantity)\nend", "def list_update_params\n\t\tparams.require(:list).permit(:description, :deadline, :completion_status, :userID)\n\tend", "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end" ]
[ "0.76281315", "0.72378355", "0.7139185", "0.7117268", "0.7117268", "0.71083647", "0.7101187", "0.7068508", "0.7049937", "0.7049937", "0.7041945", "0.70404303", "0.70156926", "0.7011639", "0.6980567", "0.69750524", "0.69516975", "0.69339174", "0.6919702", "0.6919702", "0.6919702", "0.6919702", "0.6919702", "0.69145536", "0.6912947", "0.68350947", "0.682105", "0.6787094", "0.67824894", "0.6782198", "0.67761636", "0.6768389", "0.67554367", "0.6722699", "0.6709261", "0.67035586", "0.66876274", "0.6686445", "0.6682764", "0.6665839", "0.6616854", "0.6616269", "0.66145897", "0.6600003", "0.6593793", "0.65898263", "0.6579344", "0.65681195", "0.6563026", "0.6559827", "0.6557999", "0.65548444", "0.65478724", "0.6543636", "0.6539148", "0.65262836", "0.6521081", "0.6509826", "0.6506484", "0.64747256", "0.6471821", "0.6465064", "0.64618945", "0.64551103", "0.6454904", "0.6445199", "0.64384425", "0.6435901", "0.6434531", "0.64343756", "0.64103043", "0.6408725", "0.6406476", "0.63995355", "0.6390548", "0.6387025", "0.6382565", "0.63798577", "0.63774496", "0.6374096", "0.6371348", "0.6366756", "0.6350753", "0.6349005", "0.6325152", "0.6321086", "0.63195467", "0.6318409", "0.63118327", "0.6296469", "0.62911433", "0.6276939", "0.6276125", "0.62527525", "0.62485015", "0.62359875", "0.6234443", "0.6219632", "0.6214435", "0.62101805" ]
0.64220107
70
Use callbacks to share common setup or constraints between actions.
def set_list @list = List.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 list_params params.require(:list).permit(:title, :description, :is_deleted) 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
The original purpose of this method is to split paragraphs, but our formatter only works on paragraphs that have been presplit. Therefore, we just need to wrap the fragments in a singleelement array (representing a single paragraph) and return them.
def array_paragraphs fragments [fragments] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commontator_split_paragraphs(text)\n return [] if text.blank?\n\n text.to_str.gsub(/\\r\\n?/, \"\\n\").gsub(/>\\s*</, \">\\n<\").split(/\\s*\\n\\s*/).reject(&:blank?)\n end", "def split_paragraphs(input)\n return input.split(/\\n[ ]*\\n+/)\n end", "def paragraphs\n raw_content['blocks'].map { |x| x['text'] }\n rescue StandardError\n []\n end", "def paragraphs\n result = []\n paragraph = []\n loop do\n if eof?\n result << paragraph.join(NL)\n return result\n elsif current_line.empty?\n if paragraph.empty?\n # No action\n else\n result << paragraph.join(NL)\n paragraph = []\n end\n else\n paragraph << current_line\n end\n move_on\n end\n end", "def split_in_paragraphs(mode)\n paragraphs.each(&:destroy) # delete paragraphs (should delete associated opinions)\n pattern = case mode\n when \"br\" then /<br \\/>|<br\\/>|<br>/\n when \"p_br\" then /<br \\/>|<br\\/>|<br>|<p>|<\\/p>/\n when \"p\" then /<p>|<\\/p>/\n end\n if pattern\n content.split(pattern).each_with_index do |paragraph_content, counter|\n paragraph_content = cleanup_paragraphs(paragraph_content)\n if paragraph_content != \"\"\n self.paragraphs.create(:ranking_number => counter, :content => paragraph_content, :review_id => self.id)\n end\n end\n else\n # 1 paragraph == whole content\n self.paragraphs.create(:ranking_number => 0, :content => cleanup_paragraphs(content))\n end \n end", "def paragraphs(range = nil)\n if range\n truncated = split(\"\\n\")[range].join(\"\\n\")\n truncated += '...' if truncated.length < length\n truncated\n else\n split(\"\\n\")\n end\n end", "def parse_paragraph; end", "def each_paragraph(contents)\n contents.split(\"\\n\\n\").each_with_index do |paragraph, id|\n yield id, paragraph\n end\nend", "def to_paragraphs(body)\n without_line_breaks = ignore_unnecessary_line_breaks body\n paragraphs = split_body_to_paragraphs without_line_breaks\n paragraphs = remove_blank_spaces paragraphs\n end", "def rdoc_paragraphs(rdoc_text)\n paragraphs, current = [], \"\"\n rdoc_text.each_line do |s|\n if s.strip.empty?\n unless current.strip.empty?\n paragraphs << current \n end\n current = \"\"\n else\n current << s\n end\n end\n unless current.strip.empty?\n paragraphs << current \n end\n paragraphs\n end", "def paragraphs(range=nil)\n unless range\n self.split(\"\\n\")\n else\n truncated = self.split(\"\\n\")[range].join(\"\\n\")\n truncated += \"...\" if (truncated.length < self.length)\n truncated\n end\n end", "def form_paragraphs( str, rs )\n\t\t\t@log.debug \" Forming paragraphs\"\n\t\t\tgrafs = str.\n\t\t\t\tsub( /\\A\\n+/, '' ).\n\t\t\t\tsub( /\\n+\\z/, '' ).\n\t\t\t\tsplit( /\\n{2,}/ )\n\n\t\t\trval = grafs.collect {|graf|\n\n\t\t\t\t# Unhashify HTML blocks if this is a placeholder\n\t\t\t\tif rs.html_blocks.key?( graf )\n\t\t\t\t\trs.html_blocks[ graf ]\n\n\t\t\t\t# no output if this is block separater\n\t\t\t\telsif graf == '~' then\n\t\t\t\t\t''\n\n\t\t\t\t# Otherwise, wrap in <p> tags\n\t\t\t\telse\n\t\t\t\t\tapply_span_transforms(graf, rs).\n\t\t\t\t\t\tsub( /^[ ]*/, '<p>' ) + '</p>'\n\t\t\t\tend\n\t\t\t}.join( \"\\n\\n\" )\n\n\t\t\t@log.debug \" Formed paragraphs: %p\" % rval\n\t\t\treturn rval\n\t\tend", "def add_paragraphs\n lines = seperate_lines\n max_index = lines.size - 1\n (1..(max_index)).each do |index|\n previous_line = lines[index -1]\n current_line = lines[index]\n next_line = lines[index + 1]\n if current_line[0] != (\"#\" || \"\\n\" || \"</p>\")\n if previous_line[0] == \"\\n\"\n lines.insert(index, \"<p>\\n\")\n elsif next_line[0] == \"\\n\"\n lines.insert(index + 1, \"\\n</p>\")\n elsif next_line == nil\n lines << \"\\n</p>\"\n else\n lines\n end\n end\n end\n @doc = lines.join\n end", "def accept_paragraph paragraph\n parts = paragraph.parts.chunk do |part|\n String === part\n end.map do |string, chunk|\n string ? chunk.join.rstrip : chunk\n end.flatten\n\n paragraph.parts.replace parts\n end", "def paragraph parts\n parts = parts.map do |part|\n if \"\\n\" == part then\n RDoc::Markup::HardBreak.new\n else\n part\n end\n end if break_on_newline?\n\n RDoc::Markup::Paragraph.new(*parts)\n end", "def split_paragraphs_largebreak(text)\n return [] if text.blank?\n text.to_str.gsub(/\\r\\n?/, \"\\n\").split(/\\n\\n/).map! do |t|\n t.gsub!(/(^\\n|[^\\n]\\n)(?=[^\\n])/, '\\1<br />') || t\n end\n end", "def add_paragraphs_to_text(text)\n\n # get rid of spaces and newlines-before/after-paragraphs and linebreaks\n # this enables us to avoid converting newlines into paras/breaks where we already have them\n source = text.gsub(/\\s*(<p[^>]*>)\\s*/, '\\1') # replace all whitespace before/after <p>\n source.gsub!(/\\s*(<\\/p>)\\s*/, '\\1') # replace all whitespace before/after </p>\n source.gsub!(/\\s*(<br\\s*?\\/?>)\\s*/, '<br />') # replace all whitespace before/after <br> \n\n # do we have a paragraph to start and end\n source = '<p>' + source unless source.match(/^<p/)\n source = source + \"</p>\" unless source.match(/<\\/p>$/)\n \n # If we have three newlines, assume user wants a blank line\n source.gsub!(/\\n\\s*?\\n\\s*?\\n/, \"\\n\\n&nbsp;\\n\\n\")\n\n # Convert double newlines into single paragraph break\n source.gsub!(/\\n+\\s*?\\n+/, '</p><p>')\n\n # Convert single newlines into br tags\n source.gsub!(/\\n/, '<br />')\n \n # convert double br tags into p tags\n source.gsub!(/<br\\s*?\\/?>\\s*<br\\s*?\\/?>/, '</p><p>')\n \n # if we have closed inline tags that cross a <p> tag, reopen them \n # at the start of each paragraph before the end\n HTML_TAGS_TO_REOPEN.each do |tag| \n source.gsub!(/(<#{tag}>)(.*?)(<\\/#{tag}>)/) { $1 + reopen_tags($2, tag) + $3 }\n end\n \n # reopen paragraph tags that cross a <div> tag\n source.gsub!(/(<p[^>]*>)(.*?)(<\\/p>)/) { $1 + reopen_tags($2, \"p\", \"div\") + $3 }\n \n # swap order of paragraphs around divs\n source.gsub!(/(<p[^>]*>)(<div[^>]*>)/, '\\2\\1')\n\n # Parse in Nokogiri\n parsed = Nokogiri::HTML.parse(source)\n parsed.encoding = 'UTF-8'\n \n # Get out the nice well-formed XHTML\n source = parsed.css(\"body\").to_xhtml\n \n # trash empty paragraphs and leading spaces\n source.gsub!(/\\s*<p[^>]*>\\s*<\\/p>\\s*/, \"\")\n source.gsub!(/^\\s*/, '')\n \n # get rid of the newlines-before/after-paragraphs inserted by to_xhtml,\n # so that when this is loaded up by strip_html_breaks in textarea fields,\n # \n source.gsub!(/\\s*(<p[^>]*>)\\s*/, '\\1')\n source.gsub!(/\\s*(<\\/p>)\\s*/, '\\1')\n \n # trash the body tag\n source.gsub!(/<\\/?body>\\s*/, '')\n \n # return the text\n source\n end", "def processSection1(section)\n string = '';\n buffer_array = [];\n text = section.inner_html;\n text.split('<br>').each do |info|\n data = info.split(':')[1].strip().delete(','); #Extract data leaving out tags\n string += ',';\n string += data;\n end\n return string;\nend", "def parse(input)\n norm = self.class.normalize(input)\n paragraphs = split_paragraphs(input)\n result = []\n for paragraph in paragraphs do\n result << parse_paragraph(paragraph)\n end \n return result\n end", "def output_paragraphs\n if @number <= self.class.total_included_paragraphs\n PARAGRAPHS[0, @number].join(\"\\n\\n\")\n else\n repeat = (@number / self.class.total_included_paragraphs.to_f).ceil\n (PARAGRAPHS * repeat)[0, @number].join(\"\\n\\n\")\n end\n end", "def to_html\n paragraphs.map(&:to_html).join('\\n')\n end", "def to_html\n paragraphs.map(&:to_html).join(\"\\n\")\n end", "def split_sentences\n #break text first by paragraph then into chunks delimited by a period\n #but these are not quite sentences yet\n chunks = (self.split(/\\n+/).map { |p| \"#{p}\\n\".split(/\\.(?:[^\\w])/) }).flatten.compact\n \n #if a sentence is split at Mr.|Ms.|Dr.|Mrs. \n #then recombine it with its remaining part and nil it to delete later\n tmp=''\n sentences = chunks.map { |c|\n ss = (tmp != '')? \"#{tmp}. #{c}\" : c\n if c.match(/(?:Dr|Mr|Ms|Mrs)$/) #what about John F. Kennedy ([A-Z])\n tmp = ss\n ss=nil\n else\n tmp = ''\n end\n ss\n } \n sentences.compact #delete nil elements\n end", "def better_format(text, html_options = {}, options = {})\n wrapper_tag = options.fetch(:wrapper_tag, :p)\n\n text = sanitize(text) if options.fetch(:sanitize, true)\n paragraphs = split_paragraphs(text)\n\n if paragraphs.empty?\n content_tag(wrapper_tag, nil, html_options)\n else\n paragraphs.map { |paragraph|\n # paragraph = \"<br />\" if paragraph.empty? || paragraph =~ /\\A\\s+\\z/ \n paragraph.gsub!(/(?:^\\s)|\\G\\s/m, \"&nbsp;\") if !(paragraph[0..4]==\"<pre>\" && paragraph[-6..-1]==\"</pre>\")\n content_tag(wrapper_tag, paragraph, html_options, options[:sanitize])\n }.join(\"\\n\\n\").html_safe\n end\n end", "def parse_paragraph document, par, env\n paragraph = Paragraph.new(par)\n\n if env == nil\n is_indented, env = BasicFormatting::indented(paragraph, @creator)\n if !is_indented\n # ---- first remarks, so later HTML expansion does not break off\n BasicFormatting::remarks(paragraph, @creator)\n # ---- next urls, as we don't want expansion and to allow '[' expansion later\n UrlFormatting::markup(paragraph, @creator)\n # ---- parse \\ruby{} and evaluate\n Ruby::parse(paragraph)\n # ---- expand bullets and lists\n ListFormatting::markup(paragraph, @creator)\n # ---- expand functions TeX style \n Functions::expand(paragraph, document)\n # ---- create titles from wiki type markup\n Headers::markup(document, paragraph, proc {|titlenumber,level,buf| @creator.title(titlenumber,level,buf) } )\n # ---- standard wiki style markup (bold, italics etc.)\n BasicFormatting::markup(paragraph, @creator)\n # ---- some markup when in Draft mode\n DraftModeFormatting::markup(paragraph, @creator)\n # ---- special markup, for example highlighting FIXME\n KeywordFormatting::markup(paragraph, @creator) \n end\n end\n return paragraph, env\n end", "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "def to_s\n paragraphs.map(&:to_s).join(\"\\n\")\n end", "def parse_and_add_text(text, delimiter = \"||\", justification = :left, custom_line_height = nil, indent = 0)\n text = text.to_pdf_octals\n text = text.pdf_symbol_fontize(:prefix => \"||%%symbol||\", :suffix => \"||%%default||\")\n text.gsub!(\"<br>\", \"||%%newline\")\n text.gsub!(\"</p>\", \"||%%newline\")\n text.gsub!(\"<p>\", \"\")\n text.gsub!(\"<sup>\", \"||%%sup||\")\n text.gsub!(\"</sup>\", \"||%%default||\")\n text.gsub!(\"<sub>\", \"||%%sub||\")\n text.gsub!(\"</sub>\", \"||%%default||\")\n text.gsub!(\"<em>\", \"<i>\")\n text.gsub!(\"</em>\", \"</i>\")\n text.gsub!(\"<strong>\", \"<b>\")\n text.gsub!(\"</strong>\", \"</b>\")\n text_arr = text.split(delimiter)\n # puts text_arr\n add_parsed_array(text_arr, justification, custom_line_height, indent)\n end", "def test_the_whole_process\n #changed to return array when i removed splitter and joiner between paragraph and header classes\n pm = ParagraphMarker.new\n assert_equal [\"#Some\", \"<p>of\\nThese</p>\", \"#should\", \"<p>get</p>\", \"#tagged\"], pm.mark_paragraphs(\"#Some\\n\\nof\\nThese\\n\\n#should\\n\\nget\\n\\n#tagged\")\n end", "def to_sentences(paragraph)\n\n#---------------- Step 1: Break up paragraph into pieces based on punctuation. \n\n\told_sentences = paragraph.split(/(?<=\\.\"|\\.\\)|\\.)(?<!\\.\\s\\.|\\.\\s\\.\"|\\.\\s\\.\\))\\s(?!\\.)|(?<=\\.\\s\\.\\s\\.\\s\\.\"|\\.\\s\\.\\s\\.\\s\\.\\)|\\.\\s\\.\\s\\.\\s\\.)\\s/)\n\t\t\t\t\t\t\t\t\t\t# splits on space in two cases: 1. if preceded by exactly one dot, possibly followed by ) or \"\n\t\t\t\t\t\t\t\t\t\t# 2. if preceded by four dots, possibly followed by ) or \" \n\t\t\t\t\t\t\t\t\t\t# (exactly one dot before SPLIT no dot after) OR (four dots before SPLIT)\n\n\t\n#---------------- Step 2: Re-join some pieces so that embedded quotes and parenthetical remarks aren't broken.\n\n \tnew_sentences = []\n\told_count = 0\t\t\t\t\t\t# position in old array built in Step 1\n\tnew_count = 0\t\t\t\t\t\t# position in new array built now in Step 2\n\t\t\n\twhile old_count < old_sentences.length\n\t\t\t\t\t\t\t\t\t\t# each step in outer while loop adds a new element to new_sentences\n\t\tskip = 0\t\t\t\t\t\t# skip keeps track of how many elements of old_sentences are used\n\t\tnew_sentences[new_count] = old_sentences[old_count]\n\n\t\twhile old_count + skip < old_sentences.length and (new_sentences[new_count].count('\"')%2 == 1 or new_sentences[new_count].count('(') != new_sentences[new_count].count(')'))\n\t\t\t\t\t\t\t\t\t\t# each step in inner while loop checks last element of new_sentences for mismatched quotes or parentheses, ...\t\t\t\t\t\t\t\t\t\t\n\n\t\t\tif new_sentences[new_count].count(')') > new_sentences[new_count].count('(')\n\t\t\t\told_sentences[old_count] = old_sentences[old_count].sub!(/\\)/, \"\")\n\t\t\t\tbreak\n\t\t\tend\t\t\t\t\t\t\t# ... if there's a mismatched right parenthesis, deletes it, ...\n\n\t\t\tif old_count + skip + 1 == old_sentences.length and (new_sentences[new_count].count('(') > new_sentences[new_count].count(')'))\n\t\t\t\told_sentences[old_count] = old_sentences[old_count].sub!(/\\(/, \"\")\n\t\t\t\tskip = -1\n\t\t\t\tnew_count -= 1\n\t\t\t\tbreak\t\t\t\t\t# ... if there's a mismatched left parenthesis or quote,\n\t\t\tend\t\t\t\t\t\t\t# joins next element of old_sentences to current new_sentence, unless\n\t\t\t\t\t\t\t\t\t\t# reach end of paragraph with mismatch; then deletes mismatched ( or ',\n\t\t\t\t\t\t\t\t\t\t# not joining subsequent elements of old_sentences to current new_sentence.\n\t\t\tskip += 1\n\t\t\tnew_sentences[new_count] = new_sentences[new_count] + \" \" + old_sentences[old_count + skip]\t\t\t\n\t\tend\n\n\t\tnew_count += 1\t\t\n\t\told_count += skip + 1\n\tend\n\n\n#---------------- Step 3: Make sure each piece starts and ends with a single quote.\n\n\tsentences_with_quotes = []\n\tnew_sentences.each do |x|\n\t\tx = x.chomp\n\t\tx = \"'\"+x if x[0] != \"'\"\n\t\tx = x+\"'\" if x[x.length-1] != \"'\"\n\t\tsentences_with_quotes << x\n\tend\n\n\treturn sentences_with_quotes\n\nend", "def paragraph_from_words( words )\n result = Array.new\n words.each do | word |\n result << word\n end\n result.join( \" \" )\n end", "def article_paragraphs(article)\n source = article.file_descriptor.read\n body = source.split(\"---\\n\", 3).last\n\n body.split(/\\n{2,}/).select { |paragraph| paragraph !~ /^#/ }\n end", "def included_paragraphs_joined\n PARAGRAPHS.join(\"\\n\\n\")\n end", "def paragraphs\n @node.xpath('w:p').map {|p_node| Containers::Paragraph.new(p_node) }\n end", "def to_s\n paragraphs.map(&:text).join('')\n end", "def paragraphs(\n word_count: rand(DEFAULT_WORD_COUNT_RANGE),\n sentence_count: rand(DEFAULT_SENTENCE_COUNT_RANGE),\n paragraph_count: rand(DEFAULT_PARAGRAPH_COUNT_RANGE),\n fillers: dictionnary.fillers,\n seperator: DEFAULT_PARAGRAPH_SEPARATOR\n )\n paragraph_count = 0 if paragraph_count.negative?\n paragraphs = []\n paragraph_count.times do\n p = paragraph(word_count: word_count, sentence_count: sentence_count, fillers: fillers)\n paragraphs << p unless p.empty?\n end\n paragraphs.join(seperator)\n end", "def wrapped_by_paragraph; end", "def split_frontmatter(text)\n text.split(\"---\\n\").reject(&:empty?)\n end", "def source\n strings = self.content.split(PAGE_BREAK_SPLITTER)\n if Kotoba.config.support_sections\n strings.collect! do |string|\n sections = string.split(SECTION_SEPARATOR)\n sections.reject do |section|\n section.empty? || contains_only_line_breaks?(section)\n end\n end.flatten!\n end\n strings\n end", "def show\n @foobar = Foobar.find(params[:id])\n \n @paragraphbuilder = @foobar.content.split(\"\\r\\n\")\n \n @paragraphbuilder.each do |paragraph|\n puts paragraph\n end \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foobar }\n \n \n end\n end", "def wrap_paragraph(par)\n [\"\\n\\n\"] + par + [\"\\n\\n\"]\n end", "def paragraphs\n @paragraphs ||= Array(@grpc.paragraphs).map do |b|\n Paragraph.from_grpc b\n end\n end", "def paragraphs_of( path, *args )\n return [] unless test(?f, path)\n\n title = String === args.first ? args.shift : nil\n paragraphs = File.read(path).delete(\"\\r\").split(%r/\\n\\n+/)\n\n if title.nil? then\n title = '.+'\n single_section = false\n else\n title = Regexp.escape(title)\n single_section = true\n end\n\n start_rgxp = [%r/\\A[=#]+\\s*#{title}/i, %r/\\A#{title}\\n[=-]+\\s*\\Z/i]\n end_rgxp = [%r/\\A[=#]+/i, %r/\\A.+\\n[=-]+\\s*\\Z/i]\n\n result = []\n matching = false\n rgxp = start_rgxp\n\n paragraphs.each do |p|\n if rgxp.any? { |r| p =~ r }\n if matching && single_section\n break\n end\n matching = true\n rgxp = end_rgxp\n next\n end\n\n if matching\n result << p\n end\n end\n\n args.empty? ? result : result.values_at(*args)\n end", "def find_chunks(text)\n meta_info = text.scan(CHUNK_REGEXP)\n returning(chunks = []) do\n split = text.split(CHUNK_REGEXP)\n split.shift\n split.each_with_index do |lines, idx| \n chunks << PrettyDiff::Chunk.new(meta_info[idx], lines)\n end\n end\n end", "def cell_paragraphs(cell)\n cell.paragraphs\n .map(&:text) # Extract the text from each paragraph\n .map(&:strip) # Remove leading/trailing spaces from text\n .reject(&:empty?) # Throw away blank paragraphs\n end", "def paragraphize(input)\n \"#{input.lstrip.rstrip.gsub(/\\n\\n/, '</p><p>').gsub(/\\n/, '')}\"\n end", "def accept_paragraph paragraph\n tt_sections(paragraph.text)\n end", "def chunks\n self.comment.split(\"\\n\")\n end", "def paragraphs_of path, *paragraphs\n File.read_utf(path).delete(\"\\r\").split(/\\n\\n+/).values_at(*paragraphs)\n end", "def processSection0(section)\n string = '';\n buffer_array = [];\n text = section.inner_html;\n text.split('<br>').each do |info|\n buffer_array << info.strip().delete(',');\n end\n string += buffer_array.join(\",\");\n return string;\nend", "def wrap_with_paragraphs(env, nodes); end", "def processSection2(section)\n string = '';\n text = section.inner_html\n text = text.delete('<p>').strip().delete('\\/').delete(','); #clean up string\n string += ',';\n string += text;\n return string;\nend", "def normalize\n parts = []\n\n newlines = 0\n\n @parts.each do |part|\n case part\n when /^\\s*\\n/ then\n newlines += 1\n parts << part if newlines == 1\n else\n newlines = 0\n parts << part\n end\n end\n\n parts.pop if parts.last =~ /\\A\\r?\\n\\z/\n\n @parts = parts\n end", "def simple_format(text)\r\n text.gsub!(/(\\r\\n|\\n|\\r)/, \"\\n\") # lets make them newlines crossplatform\r\n text.gsub!(/\\n\\n+/, \"\\n\\n\") # zap dupes\r\n text.gsub!(/\\n\\n/, '</p>\\0<p>') # turn two newlines into paragraph\r\n text.gsub!(/([^\\n])(\\n)([^\\n])/, '\\1\\2<br />\\3') # turn single newline into <br />\r\n\r\n #MGS- don't want everything wrapped in a <p> tag\r\n #content_tag(\"p\", text)\r\n return text\r\n end", "def process_full_text(text)\n frag = Nokogiri::HTML::DocumentFragment.parse text.to_html\n clean_text = Nokogiri::HTML::DocumentFragment.parse \"\"\n\n frag.traverse do |node|\n # skip empty <br> elements\n next if node.nil? || node.name == \"br\"\n\n # Construct a new <p> with extracted text\n if node.text?\n new_p = Nokogiri::XML::Node.new(\"p\", clean_text)\n new_p.content = node.text.strip\n clean_text << new_p\n end\n end\n clean_text.to_html\n end", "def paragraph(p,f)\n\t\n\t# Replaces everything that has <b>, </b>, etc.\n\tvalue = p.gsub(/<b>|<\\/b>|<a>|<\\/a>/, \"\")\n \tarr = value.split(/</)\n\n \t# Gets rid of anything else from .* to > \n \t# and fixes spaces between numbers\n\tarr.each {|x| x.gsub!(/.*>\\d*/, \"\"); \n\t\tx.gsub!(/\\&\\#\\d*\\;/, \" \"); }\n \t\n \tarr.each {|x|\n \t\tif x == arr[0] && x != \"\"\n \t\t\tf.write(\"\\t\" + x)\n\t \telsif x != \"\" && x != \"[\" && x != \"]\"\n\t \t\tf.write(x)\n \t\tend\n \t}\n \tf.write(\"\\n\")\nend", "def prepare_markdown(text)\n parsed = []\n uses_item_markers = (text =~ /^[-*]/)\n\n text.each_line do |line|\n line.rstrip!\n # Convert headline markers.\n line.sub!(/^(#+)/, @headline)\n\n # Add item markers for those who used plaintext and didn't add them;\n # add headline markers for those who defined different sections and\n # didn't add them.\n if line =~ /^([A-Za-z0-9])/\n line = uses_item_markers ? \"#{@headline} #{line}\" : \"- #{line}\"\n end\n\n # Fixup item markers missing a space.\n line.sub!(/^[-*]([^ ])/, '- \\1')\n parsed << line unless line.empty?\n end\n parsed.join(\"\\n\")\n end", "def yaml_split\n body = @node.body.gsub(\"\\r\", \"\")\n ary = body.split(/\\n\\.\\.\\.\\n|\\n---\\n/,2)\n ary[1] = ary[1].lstrip\n ary\n end", "def split(parts); end", "def _ParagraphDelimiter\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_BlockDelimiter)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_PreformattedCommandHead)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_LineBlock)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_Newpage)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HeadedStart)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_ParagraphDelimiter unless _tmp\n return _tmp\n end", "def split_lines\n text.split(/\\n/)\n end", "def all_page_part_content\n parts.map(&:body).join \" \"\n end", "def split_by_delimiter(delimiter = self.class.parsing_delimiter)\n return '' if body.nil? || body.empty?\n lines = body.split(\"\\n\")\n delim_line = last_line = found_empty = nil\n \n lines.each_with_index do |line, i|\n next if delim_line\n delim_line = i if line.include?(delimiter)\n end\n \n while !last_line && delim_line.to_i > 0\n delim_line = delim_line - 1\n if found_empty\n last_line = delim_line if lines[delim_line].strip.size > 0\n else\n found_empty = true if lines[delim_line].strip.size.zero?\n end\n end\n \n if last_line\n lines[0..delim_line] * \"\\n\"\n elsif delim_line.nil?\n body.strip\n else\n ''\n end\n end", "def paragraphs(number: T.unsafe(nil), supplemental: T.unsafe(nil)); end", "def split(position)\n end", "def split(position)\n end", "def split; end", "def insert_multiple_lines(text_array)\r\n # Hold paragraphs to be inserted into, corresponding to the index of the strings in the text array\r\n paragraphs = []\r\n paragraph = self.parent_paragraph\r\n # Remove text from paragraph\r\n paragraph.blank!\r\n paragraphs << paragraph\r\n for i in 0...(text_array.size - 1)\r\n # Copy previous paragraph\r\n new_p = paragraphs[i].copy\r\n # Insert as sibling of previous paragraph\r\n new_p.insert_after(paragraphs[i])\r\n paragraphs << new_p\r\n end\r\n\r\n # Insert text into corresponding newly created paragraphs\r\n paragraphs.each_index do |index|\r\n paragraphs[index].text = text_array[index]\r\n end\r\n end", "def split_sentences\n sentences = self.plain_text.split(\".\")\n while sentences.include?(\" \") do\n sentences = check_for_blanks_in_arr(sentences)\n end\n sentences\n end", "def split_definition(raw_def)\r\n # TODO: your implementation here\r\n i = 0\r\n while (i < raw_def.size)\r\n raw_def[i].gsub! /\\s\\n/, \"\\n\"\r\n raw_def[i].gsub! /\\n+/, \"\\n\"\r\n raw_def[i].gsub! /\\t/, ''\r\n i += 1\r\n end\r\n x = 0\r\n newArr = []\r\n mod_def = []\r\n until x >= raw_def.size do\r\n if (raw_def[x][0] == \"\\n\")\r\n mod_def[x] = raw_def[x][1..-1]\r\n else\r\n mod_def[x] = raw_def[x]\r\n end\r\n newArr[x] = mod_def[x].split(/\\t?\\s?;\\s?\\n?/)\r\n x += 1\r\n end\r\n\r\n j = 0\r\n while (j < newArr.size)\r\n newArr[j].unshift(newArr[j][0][0..newArr[j][0].index(\">\")].gsub(/\\s*/, \"\"))\r\n if newArr[j][0] == \"<blank>\"\r\n newArr[j][1] = \"\";\r\n else\r\n newArr[j][1] = newArr[j][1][newArr[j][1].index(\">\") + 2..-1]\r\n end\r\n j += 1\r\n end\r\n\r\n k = 0\r\n while (k < newArr.size)\r\n l = 0\r\n while (l < newArr[k].size)\r\n newArr[k][l].gsub! /\\n+/, ' '\r\n l += 1\r\n end\r\n k += 1\r\n end\r\n\r\n return newArr\r\nend", "def find_chunks(text)\n meta_info = text.scan(CHUNK_REGEXP)\n chunks = []\n chunks.tap do\n split = text.split(CHUNK_REGEXP)\n split.shift\n split.each_with_index do |lines, idx| \n chunks << MailDiff::Chunk.new(self, meta_info[idx], lines)\n end\n end\n end", "def split_on_sentences(speaker, string)\n aa = []\n end_index = 0\n start_index = nil\n text_length = string.length\n while true\n if end_index < text_length\n start_index = end_index\n end_index = string.index(%r{\\.|\\?|!}, end_index)\n end_index ||= text_length\n aa << string[start_index...end_index.next].strip\n end_index += 1\n end\n break unless end_index < text_length\n end\n batch_subs(speaker, aa)\n end", "def extract_block_from_paragraph!(element)\n p = element.parent\n return unless node_name?(p, 'p')\n children_after = p.children[p.children.index(element) + 1..-1]\n remove_leading_blanks! children_after\n # Move the element out of and after the paragraph\n p.add_next_sibling element\n # Move all the elements after the onebox to a new paragraph\n unless children_after.empty?\n new_p = Nokogiri::XML::Node.new 'p', doc\n element.add_next_sibling new_p\n children_after.each { |child| new_p.add_child child }\n end\n # The original paragraph might have been split just after a <br> or whitespace, remove them if so:\n remove_leading_blanks! p.children.reverse\n p.remove if p.children.empty?\n end", "def parse_page( pl_ratio = 36.0/18.0 )\n \n # initializations\n lines = 0\n page = []\n eof = false\n \n # looping through buffer until page is full\n while (lines_per_page - lines) > 0 && !eof\n buffer_line = self.buffer.shift \n if buffer_line.nil? # EOF reached, stop while loop \n eof = true\n else # add content to page until full \n word_count = buffer_line.split.size\n number_lines = (word_count/words_per_line).round\n number_lines = number_lines - 1 + pl_ratio # account for paragraph padding\n \n if (lines + number_lines) <= lines_per_page\n # add the whole buffer_line to the page\n lines += number_lines\n page << buffer_line\n else\n # add only part of the buffer_line to the page\n # unshift the rest back into the buffer \n remainder = lines_per_page - lines - 1 # addition line is for rounding and pl_ration adjustment\n remainder = (remainder * words_per_line).to_i\n from_beginning = word_count - remainder \n if from_beginning > 0\n keeper = buffer_line.match(/^([\\w|'|\"]*\\W?){#{from_beginning}}/).to_s # first X number of words\n page << keeper\n remainder = buffer_line.sub( keeper, '' )\n self.buffer.unshift( remainder ) # add remainder to the buffer \n end \n lines = lines_per_page # satisfy conditions for end of page\n end \n end \n end \n page \n end", "def parse\n @parts = []\n\n sect = text.split(/^\\-\\-\\-/)\n\n if sect.size == 1\n @header = {}\n @parts << Part.new(sect[0]) #, *[@stencil, @default].compact.flatten)\n else\n sect.shift if sect.first.strip.empty?\n\n head = sect.shift\n head = YAML::load(head)\n parse_header(head)\n\n sect.each do |body|\n index = body.index(\"\\n\")\n formats = body[0...index].strip\n formats = formats.split(/\\s+/) if String===formats\n #formats = @default if formats.empty?\n #formats.unshift(@stencil) if @stencil\n text = body[index+1..-1]\n @parts << Part.new(text, *formats)\n end\n end\n end", "def split_for_height(text)\n if @wrap == :word then return text.split(/\\s/)\n else return text.split(//) end\n end", "def each_paragraph\n paragraphs.each { |p| yield(p) }\n end", "def each_paragraph\n paragraphs.each { |p| yield(p) }\n end", "def get_paragraph\n wo = self.words_from_markov_data\n\n self.paragraph_from_words(wo).strip\n end", "def paragraph value\n content = cut_off(value).join(' ').rstrip\n contents = @inline_parser.parse content\n\n RDoc::Markup::Paragraph.new(*contents)\nend", "def segments\n message.split(%r(\\n\\n(?=[<>])))\n end", "def accept_paragraph paragraph\n @res << \"\\n<p>\"\n text = paragraph.text @hard_break\n text = text.gsub(/\\r?\\n/, ' ')\n @res << to_html(text)\n @res << \"</p>\\n\"\n end", "def extract_pages_to_text\n reader.pages.each do |page|\n raw_extracted_pages << page.text.split(\"\\n\")\n end\n end", "def paragraphs(total, opts={ })\n default_opts = { start_sep: \"\", end_sep: line_break * 2 }\n merged_opts = default_opts.merge(opts)\n @resource.paragraphs(total, merged_opts)\n end", "def paragraphs(total)\n (1..interpret_value(total)).map do\n sentences(3..8).capitalize\n end.join(\"\\n\\n\")\n end", "def to_html_fragment\n to_markdown_slices.map do |tagged_markdown|\n tagged_markdown.to_html\n end.join(\"\\n\\n\")\n end", "def list\n @element.content.map do |paragraph_element|\n line_item = paragraph_element.content.map do |text_element|\n text_exporter.new(text_element).export\n end.join\n\n \"<li>#{line_item}</li>\"\n end.join\n end", "def paragraph_under_cursor_pos\n if @lines[ @last_row ] =~ /^\\s*$/\n return [\n [ @last_row, 0 ],\n [ @last_row, @lines[ @last_row ].length - 1 ]\n ]\n end\n\n upper_boundary = 0\n lower_boundary = @lines.size - 1\n\n @last_row.downto( 0 ) do |i|\n line = @lines[ i ]\n if line =~ /^\\s*$/\n upper_boundary = i + 1\n break\n end\n end\n\n @last_row.upto( @lines.size - 1 ) do |i|\n line = @lines[ i ]\n if line =~ /^\\s*$/\n lower_boundary = i - 1\n break\n end\n end\n\n [\n [ upper_boundary, 0 ],\n [ lower_boundary, @lines[ lower_boundary ].length - 1 ]\n ]\n end", "def lines\n text.split(/(?<=[\\n\\f])/)\n end", "def paginate!\n @paras.each do |para|\n new_para= @pages.last.push_para(para)\n unless new_para.nil?\n new_paras= [new_para]\n if new_para.split_state == :whole\n while @pages.last.paras.last.keep_with_next? new_paras.first\n new_paras.unshift(@pages.last.paras.pop)\n if @pages.last.paras.empty?\n raise \"pagination error: string of keep-with-nexts larger \" \\\n \"than one page; occured at:\\n #{para}\"\n end\n end\n end\n new_page= Page.new(self, @pages.size + 1)\n new_paras.each do |p|\n new_page_para= new_page.push_para(p)\n if new_page_para\n raise \"pagination error: string of keep-with-nexts larger than \" \\\n \"one page:\\n #{new_page_para}\"\n end\n end\n first_para= new_page.paras.first\n if first_para.is_a?(CharacterCue) && first_para.split_state == :widow\n @pages.last.push_para(More.new(self), true)\n end\n @pages << new_page\n end\n end\n @pages\n end", "def content\n lines = super.lines.to_a\n fixed = []\n current_line = 0\n offset = 0\n formatted_lines = markup.lines.to_a\n lines.each_with_index do |line, index|\n formatted_line = formatted_lines[index + offset]\n if line.strip == \"\" and (formatted_line and formatted_lines[index + offset].strip != \"\")\n offset -= 1\n else\n fixed << line\n end\n end\n lines = fixed.join(\"\")\n lines\n end", "def paragraphs_of( path, *paragraphs )\n title = String === paragraphs.first ? paragraphs.shift : nil\n ary = File.read(path).delete(\"\\r\").split(/\\n\\n+/)\n\n result = if title\n tmp, matching = [], false\n rgxp = %r/^=+\\s*#{Regexp.escape(title)}/i\n paragraphs << (0..-1) if paragraphs.empty?\n\n ary.each do |val|\n if val =~ rgxp\n break if matching\n matching = true\n rgxp = %r/^=+/i\n elsif matching\n tmp << val\n end\n end\n tmp\n else ary end\n\n result.values_at(*paragraphs)\nend", "def split_into_flow\n res = []\n current_attr = 0\n\n str_len = @str.length\n\n # skip leading invisible text\n i = 0\n i += 1 while i < str_len and @str[i].chr == \"\\0\"\n start_pos = i\n\n # then scan the string, chunking it on attribute changes\n while i < str_len\n new_attr = @attrs[i]\n if new_attr != current_attr\n if i > start_pos\n res << copy_string(start_pos, i)\n start_pos = i\n end\n\n res << change_attribute(current_attr, new_attr)\n current_attr = new_attr\n\n if (current_attr & @attributes.regexp_handling) != 0 then\n i += 1 while\n i < str_len and (@attrs[i] & @attributes.regexp_handling) != 0\n\n res << RDoc::Markup::RegexpHandling.new(current_attr,\n copy_string(start_pos, i))\n start_pos = i\n next\n end\n end\n\n # move on, skipping any invisible characters\n begin\n i += 1\n end while i < str_len and @str[i].chr == \"\\0\"\n end\n\n # tidy up trailing text\n if start_pos < str_len\n res << copy_string(start_pos, str_len)\n end\n\n # and reset to all attributes off\n res << change_attribute(current_attr, 0) if current_attr != 0\n\n res\n end", "def remove_paragraph_tags mytext\n mytext.sub!(/^<p>\\s*<\\/p>/,\"\")\n mytext.sub!(/(<br>)*<p>\\s*<\\/p>$/,\"\")\n mytext.sub!(/^<p>/,'')\n mytext.sub!(/<\\/p>?/,'')\n return mytext\n end", "def paragraphs_of( path, *paragraphs )\n title = String === paragraphs.first ? paragraphs.shift : nil\n ary = File.read(path).delete(\"\\r\").split(/\\n\\n+/)\n\n result = if title\n tmp, matching = [], false\n rgxp = %r/^=+\\s*#{Regexp.escape(title)}/i\n paragraphs << (0..-1) if paragraphs.empty?\n\n ary.each do |val|\n if val =~ rgxp\n break if matching\n matching = true\n rgxp = %r/^=+/i\n elsif matching\n tmp << val\n end\n end\n tmp\n else ary end\n\n result.values_at(*paragraphs)\nend", "def yaml_split\n data[0].gsub!(\"\\r\", \"\")\n ary = data[0].split(/\\n\\.\\.\\.\\n|\\n---\\n/,2)\n ary[1] = ary[1].lstrip\n ary\n end", "def parse\n #use regex to split\n arr = @html_string.scan(TAGS_AND_TEXT).flatten\n\n #remove nil values and return\n arr.compact!\n\n #remove white spaces\n arr.map! { |s| s.strip}\n end", "def split_document_pptx(input_file, opts = {})\n data, _status_code, _headers = split_document_pptx_with_http_info(input_file, opts)\n data\n end", "def get_tokens(lines)\n tokens = []\n chunk = \"\"\n\n lines.each do |line|\n case line\n when /^[#\\+\\-]+.*$/ # Headers\n unless chunk == \"\"\n tokens += [chunk.strip]\n chunk = \"\"\n end\n\n tokens += [line.strip]\n when /^\\s*$/ # Ends or Starts of paragraphs\n unless chunk == \"\"\n tokens += [chunk.strip]\n chunk = \"\"\n end\n else #Paragraphs\n chunk += line.strip + \" \"\n end\n end\n\n tokens += [chunk.strip] unless chunk == \"\"\n tokens\nend", "def parse_text\n text.split(\"\\n\").map { |r| r.scan(/.../) } \n end" ]
[ "0.73228526", "0.69568443", "0.68156433", "0.66130614", "0.66045976", "0.6547042", "0.6535568", "0.6340202", "0.631831", "0.63062954", "0.6305194", "0.62608624", "0.6233127", "0.62245244", "0.62051034", "0.60753375", "0.60259336", "0.5894058", "0.58859515", "0.5849876", "0.5845598", "0.5842239", "0.58386374", "0.5825461", "0.5818355", "0.57986236", "0.57986236", "0.57616836", "0.57425576", "0.5740553", "0.5714437", "0.57052946", "0.56923133", "0.5657135", "0.56523395", "0.5652293", "0.56281364", "0.56065166", "0.559453", "0.5579812", "0.5571129", "0.55687356", "0.55683", "0.55647767", "0.55597645", "0.5545972", "0.55124795", "0.5508483", "0.54907423", "0.5480053", "0.5459849", "0.5455766", "0.54540384", "0.54487467", "0.54473126", "0.5439344", "0.54358816", "0.5418389", "0.5414713", "0.5412821", "0.540975", "0.5388814", "0.5376439", "0.53718495", "0.53647256", "0.53647256", "0.5342286", "0.5331261", "0.5328862", "0.5328464", "0.5316438", "0.5304249", "0.53014827", "0.52992857", "0.5295462", "0.52878684", "0.5274484", "0.5274484", "0.5274351", "0.52698654", "0.52676105", "0.5263392", "0.52491176", "0.5237194", "0.52271533", "0.5223871", "0.52177936", "0.52143097", "0.5194687", "0.51676786", "0.5163615", "0.5149293", "0.5146933", "0.5142207", "0.51413804", "0.51410246", "0.51246154", "0.5119959", "0.5118233", "0.51170903" ]
0.76590174
0
This overrides the Objectmethod method to return the mocked method when the mocked method is being requested. For methods that aren't being tested, this method returns a proc that will raise an error when called. This is to assure that only the mocked grpc method is being called.
def method(symbol) return @mock_method if symbol == @expected_symbol # The requested method is not being tested, raise if it called. proc do raise "The method #{symbol} was unexpectedly called during the " \ "test for #{@expected_symbol}." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_grpc_method(grpc_method_object)\n owner = grpc_method_object.owner\n\n return VALUE_UNKNOWN unless owner.instance_variable_defined?(:@rpc_descs)\n\n method, = owner.rpc_descs.find do |k, _|\n ::GRPC::GenericService.underscore(k.to_s) == grpc_method_object.name.to_s\n end\n\n return VALUE_UNKNOWN if method.nil?\n\n method.to_s\n end", "def mock_facade_method(object, message, ret_val: nil)\n expect(object).to receive(message).and_return(ret_val)\n end", "def instance_call(method_name)\n Scenario::Orchestrator.new(self, @mock_instance_double, :instance, method_name)\n end", "def stub_call(method:, message: :any, response:)\n savon.expects(method).with(message: message).returns(response)\n end", "def class_call(method_name)\n Scenario::Orchestrator.new(self, @mock_class_double, :class, method_name)\n end", "def remote_call name, args\n m = public_method(name)\n if m && m.owner == self.class\n m.call(*args)\n else\n raise NoMethodError, \"method #{name} is not found\"\n end\n rescue NameError\n raise NoMethodError, \"method #{name} is not found\"\n end", "def flexmock_invoke_original(object, method, *args, &block)\n object.instance_variable_get(:@flexmock_proxy).proxy.flexmock_invoke_original(method, args, &block)\n end", "def flexmock_invoke_original(object, method, *args, &block)\n object.instance_variable_get(:@flexmock_proxy).proxy.flexmock_invoke_original(method, args, &block)\n end", "def verify_stubbed_calls; end", "def flexmock_invoke_original(method, args)\n method_proc = @method_definitions[method]\n method_proc.call(*args)\n end", "def internal_deliver(mode, method_name, return_type, *args, &b) \n exp = expectations.find(method_name, mode, *args)\n# exp = expectations.find(method_name.underscore, mode, *args) unless exp\n bl = record_call(method_name, mode, exp, *args, &b)\n is_value_type = return_type && return_type != System::Void.to_clr_type && return_type.is_value_type \n res = nil\n if exp\n block = exp.block || b\n res = instance.__send__(method_name, *args, &block) if exp.super_before?\n exp.event_recorder do |ev_nm, ev_ar, ev_h|\n recorder.record_event_raise ev_nm, mode, *ev_ar, &ev_h if ev_nm\n end if recorder && exp\n res = exp.execute *args, &bl\n res = instance.__send__(method_name, *args, &block) if !exp.super_before? and exp.call_super?\n end\n res ||= System::Activator.create_instance(return_type) if is_value_type \n res\n end", "def stubbing(object, method_name)\n @stubs[object.object_id][method_name]\n end", "def stub_ar_method(object, method, return_value, params = {})\n if params.blank?\n object.stub!(method).and_return(return_value ? false : true)\n else\n object.stub!(method).with(hash_including(params)).and_return(return_value ? false : true)\n end\n end", "def some_method(message)\n # Write your own code here to build request and parse response\n request = ProtobufRubyExample::Proto::RequestPb.new(id: rand(100), message: message)\n\n response = @rpc_stub.some_method(request)\n\n return response.status\n end", "def refute_called(object, method_name, message = nil, &block)\n assert_called(object, method_name, message, times: 0, &block)\n end", "def internal_deliver(mode, method_name, return_type, *args, &b) \n res = nil \n is_value_type = return_type && return_type != System::Void.to_clr_type && return_type.is_value_type\n exp = expectations.find(method_name, mode, *args)\n# exp = expectations.find(method_name.underscore, mode, *args) unless exp\n exp.event_recorder do |ev_nm, ev_ar, ev_h|\n recorder.record_event_raise ev_nm, mode, *ev_ar, &ev_h if ev_nm\n end if recorder && exp\n bl = record_call(method_name, mode, exp, *args, &b)\n res = exp.execute *args, &bl if exp\n res ||= System::Activator.create_instance(return_type) if is_value_type \n res\n end", "def stub_implementation; end", "def stub_twilio_request\n allow_any_instance_of(TwilioService).to receive(:send_message)\nend", "def wrapped_request(rpc_method, request)\n request = request_class(rpc_method).new(request) if request.is_a?(Hash)\n\n ::Protobuf::Socketrpc::Request.new(\n :service_name => subject_service.to_s,\n :method_name => rpc_method.to_s,\n :request_proto => request.encode,\n :caller => 'protobuf-rspec'\n )\n end", "def remote_call(meth, *args)\r\n loc = meth\r\n loc = get_proc(loc) if loc.kind_of? String\r\n loc = Ragweed::Ptr.new loc\r\n raise \"bad proc name\" if loc.null?\r\n t = Trampoline.new(self, loc)\r\n t.call *args\r\n end", "def expected_method; end", "def test_Method_InstanceMethods_to_proc\n\t\tpass\n\tend", "def stubbed?\n raise NotImplementedError\n end", "def stub_instance_method(klass, name, val_or_callable, &block)\n if defined?(::Minitest::Moar::Stubbing)\n instance_stub klass, name, val_or_callable, &block\n elsif defined?(::Minitest::StubAnyInstance)\n klass.stub_any_instance(name, val_or_callable, &block)\n else\n begin\n new_name = \"__minitest_stub_instance_method__#{name}\"\n owns_method = instance_method(name).owner == klass\n klass.class_eval do\n alias_method new_name, name if owns_method\n\n define_method(name) do |*args|\n if val_or_callable.respond_to?(:call)\n instance_exec(*args, &val_or_callable)\n else\n val_or_callable\n end\n end\n end\n\n yield\n ensure\n klass.class_eval do\n remove_method name\n if owns_method\n alias_method name, new_name\n remove_method new_name\n end\n end\n end\n end\n end", "def method_missing(methodSymbol, *params)\n # get the remote method name\n remoteMethod = methodSymbol.to_s.gsub(\"_\", \".\")\n if methodSymbol.to_s.match(/cached_(.*)/)\n log_debug \"** RFACEBOOK(GEM) - DEPRECATION NOTICE - cached methods are deprecated, making a raw call without caching.\"\n tokens.shift\n end\n \n # there can only be one parameter, a Hash, for remote methods\n unless (params.size == 1 and params.first.is_a?(Hash))\n log_debug \"** RFACEBOOK(GEM) - when you call a remote Facebook method\"\n end\n \n # make the remote method call\n return remote_call(remoteMethod, params.first) \n end", "def rpc_send(method_name, *args, &block)\n return yield if rpc_in_server_mode? || rpc_enabled?\n begin\n rpc_client << [method_name, args]\n response = rpc_client.read\n rescue => e\n #FIXME: error handling as an error occured at the transport layer\n end\n if response.erred?\n #will have response.message = {:em => 'error msg', :eb => ['error backtrace'], :om => 'original message'}\n end\n response.message\n end", "def stub_for method_name\n @stubs[method_name] ||= new_stub_for(method_name)\n end", "def rest_method(name, options = { default_result: '...' })\n # @!method promise_[name]\n # @return [Promise] on success the .then block will receive the result of the RPC call as arg\n # on failure the .fail block will receive the HTTP response object as arg\n define_method(\"promise_#{name}\") do |*args|\n name_args = self.class._name_args(name, *args)\n @fetch_states[name_args] = 'i'\n @rest_methods[name] = {}.merge!(options) unless @rest_methods.has_key?(name)\n @rest_methods[name_args] = { result: options[:default_result] } unless @rest_methods.has_key?(name_args) && @rest_methods[name_args].has_key?(:result)\n raise \"#{self.class.to_s}[_no_id_].#{name}, can't execute instance rest_method without id!\" unless self.id\n self.class._promise_get_or_patch(\"#{resource_base_uri}/#{self.id}/methods/#{name}.json?timestamp=#{`Date.now() + Math.random()`}\", *args).then do |response_json|\n @rest_methods[name_args][:result] = response_json[:result] # result is parsed json\n @fetch_states[name_args] = 'f'\n _notify_observers\n @rest_methods[name_args][:result]\n end.fail do |response|\n error_message = \"#{self.class.to_s}[#{self.id}].#{name}, a rest_method, failed to execute!\"\n `console.error(error_message)`\n response\n end\n end\n # @!method [name]\n # @return result either the default_result ass specified in the options or the real result if the RPC call already finished\n define_method(name) do |*args|\n _register_observer\n name_args = self.class._name_args(name, *args)\n @rest_methods[name] = {}.merge!(options) unless @rest_methods.has_key?(name)\n @rest_methods[name_args] = { result: options[:default_result] } unless @rest_methods.has_key?(name_args) && @rest_methods[name_args].has_key?(:result)\n unless @fetch_states.has_key?(name_args) && 'fi'.include?(@fetch_states[name_args])\n self.send(\"promise_#{name}\", *args)\n end\n @rest_methods[name_args][:result]\n end\n # @!method update_[name] mark internal structures so that the method is called again once it is requested again\n # @return nil\n define_method(\"update_#{name}\") do |*args|\n @fetch_states[self.class._name_args(name, *args)] = 'u'\n nil\n end\n end", "def method_missing(method, *args, &block)\n __proxy_result__.send(method, *args, &block)\n end", "def have_received(expected_method_name)\n HaveReceived.new(expected_method_name)\n end", "def method_missing(meth, *args, &block)\n if not @impl.nil? and @impl.respond_to?(meth)\n return @impl.send(meth.to_s, *args, &block)\n end\n # :nocov:\n return super\n # :nocov:\n end", "def stub_method(object, method, &block) #:nodoc:\n unless @stubbed_methods.include?([object, method])\n @stubbed_methods << [object, method]\n add_hook(object, method, &block)\n end\n end", "def define_proxy_method(method_name)\n if method_name.to_s =~ /=$/\n eval_line = __LINE__ + 1\n sclass.class_eval %{\n def #{method_name}(*args, &block)\n @flexmock_proxy.mock.__send__(:#{method_name}, *args, &block) \n end\n }, __FILE__, eval_line\n else\n eval_line = __LINE__ + 1\n sclass.class_eval %{\n def #{method_name}(*args, &block)\n @flexmock_proxy.mock.#{method_name}(*args, &block) \n end\n }, __FILE__, eval_line\n make_rcov_recognize_the_above_eval_is_covered = true\n end\n end", "def proc_method\n\tproc_a = proc { |x| return x }\n\tproc_a.call(@expected_proc_return)\n\t\"unexpected proc return\"\nend", "def test_errors_from_handled_requests_are_noticed\n desc = basic_grpc_desc\n def desc.trace_with_newrelic?; true; end # force a true response from this method\n def desc.process_distributed_tracing_headers(ac); end # noop this DT method (tested elsewhere)\n def desc.metadata_for_call(call); NewRelic::EMPTY_HASH; end # canned. test metadata_for_call elsewhere\n raised_error = RuntimeError.new\n new_transaction_called = false\n NewRelic::Agent::Transaction.stub(:start_new_transaction, proc { new_transaction_called = true; transaction }) do\n received_error = nil\n notice_stub = proc { |e| received_error = e }\n NewRelic::Agent.stub(:notice_error, notice_stub) do\n assert_raises(RuntimeError) do\n result = desc.handle_with_tracing(nil, nil, method, nil) { raise raised_error }\n end\n\n assert_equal raised_error, received_error\n assert new_transaction_called\n end\n end\n end", "def stub_member_call(source, target)\n _env_change\n @env.patch_op [:stub_member, target, source]\n end", "def define_proxy_method(method_name)\n if method_name.to_s =~ /=$/\n eval_line = __LINE__ + 1\n target_class_eval %{\n def #{method_name}(*args, &block)\n instance_variable_get('@flexmock_proxy').\n mock.__send__(:#{method_name}, *args, &block)\n end\n }, __FILE__, eval_line\n else\n eval_line = __LINE__ + 1\n target_class_eval %{\n def #{method_name}(*args, &block)\n instance_variable_get('@flexmock_proxy').\n mock.#{method_name}(*args, &block)\n end\n }, __FILE__, eval_line\n _ = true # make rcov recognize the above eval is covered\n end\n end", "def method_object\n @method_object ||= get_method_or_raise(args.empty? ? nil : args.join(\" \"), @method_target,\n :super => opts[:super],\n :instance => opts.present?(:'instance-methods') && !opts.present?(:'methods'),\n :methods => opts.present?(:'methods') && !opts.present?(:'instance-methods')\n )\n end", "def verify\n if @count > 0\n flunk \"mocked method %p not called %d time(s)\" %\n [@meth, @count]\n end\n self\n end", "def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end", "def new_stub_for method_name\n response = Response.new(Http::Request.new, Http::Response.new)\n response.request_type = method_name\n response.request_options = {}\n send(\"simulate_#{method_name}_response\", response)\n response.signal_success\n response\n end", "def method_missing (method, *args, &block)\n __proxy_result__.send(method, *args, &block)\n end", "def method_missing(sym, *args, &block)\n begin\n retval = Cspice_wrapper.send sym, *args, &block\n rescue NoMethodError\n super\n end\n\n if Cspice_wrapper.failed_c\n #The CSPICE method just called reported an error. Translate it into an RSpice exception\n short = get_error_message :short\n long = get_error_message :long\n traceback = get_error_message :traceback\n explain = get_error_message :explain\n\n # Reset the error state so subsequent CSPICE calls do not immediately fail\n Cspice_wrapper.reset_c()\n\n raise CSpiceError.new(short, long, traceback, explain)\n end\n\n retval\n end", "def call_rpc(method, args)\n method = sanitize_parameters(method)\n args = sanitize_parameters(args)\n resp = @rpc.call(\"#{@service}.#{method}\", args)\n\n return true if resp == 'OK'\n return resp\n end", "def call(method, *args)\n self.class.rpc_execute(method, *args)\n end", "def invoke(optional_destination, rpc_method, *args)\n # TODO\n end", "def send_without_checking(method, *args)\n @mock_redis.send(method, *args)\n @real_redis.send(method, *args)\n end", "def __proxy_result__\n @proxy_result = @method_call.call unless defined?(@proxy_result)\n @proxy_result\n end", "def invoked_method()\n obj = get_receiver_object\n if obj.nil?\n Undef\n else\n begin\n obj.method(@name)\n rescue NameError\n Undef\n end\n end\n end", "def discovered_method(rpc_name, api, version=nil)\n if !rpc_name.kind_of?(String) && !rpc_name.kind_of?(Symbol)\n raise TypeError,\n \"Expected String or Symbol, got #{rpc_name.class}.\"\n end\n rpc_name = rpc_name.to_s\n api = api.to_s\n version = version || 'v1'\n service = self.discovered_api(api, version)\n if service.to_h[rpc_name]\n return service.to_h[rpc_name]\n else\n return nil\n end\n end", "def fake_exec_api(agent, operation, params)\n call = Call.new(agent, operation, params)\n stub = API.stubs.shift\n assert stub, \"Unexpected API call (no response stub set)\\n#{call}\"\n assert stub.test(call), \"Stub didn't match API call:\\n#{call}\"\n\n res = stub.response\n res = res.to_json_response if res.kind_of? CommandResponse\n logger.debug res\n return res\n end", "def method_missing(msg, *args, &block)\n puts \"#{self.class}#method_missing(#{msg})\" \n proc = self.singleton_class.resolve_dynamic_method(msg) || self.class.resolve_dynamic_method(msg)\n\n begin\n if !proc.nil?\n args.unshift self \n res = if block.nil?\n proc.call(*args)\n else\n proc.call(*args, &block)\n end\n return res\n elsif msg != :method_missing! && self.respond_to?(:method_missing!)\n puts \"\\tdelgating to method_missing!\"\n return method_missing!(msg, *args, &block)\n else\n return super(msg, *args, &block)\n # TODO - report RM bug for when block is empty\n end\n rescue NoMethodError => ex\n new_ex = NoMethodError.new(\"undefined method \\`#{msg}' for #{self.inspect}:#{self.class}\")\n new_ex.set_backtrace ex.backtrace\n raise new_ex\n end\n end", "def should_receive(*args)\n ContainerHelper.parse_should_args(@mock, args) do |sym|\n unless @methods_proxied.include?(sym)\n hide_existing_method(sym)\n end\n ex = @mock.should_receive(sym)\n ex.mock = self\n ex\n end\n end", "def stub_for method_name\n @stubs ||= {}\n @stubs[method_name] ||= new_stub_for(method_name)\n end", "def callee\n @method\n end", "def flexmock_call_original(object, method, *args, &block)\n Test.warn \"#flexmock_call_original is deprecated, use #flexmock_invoke_original instead\"\n flexmock_invoke_original(object, method, *args, &block)\n end", "def flexmock_call_original(object, method, *args, &block)\n Test.warn \"#flexmock_call_original is deprecated, use #flexmock_invoke_original instead\"\n flexmock_invoke_original(object, method, *args, &block)\n end", "def test_do_not_call_finish_on_an_absent_segment\n desc = basic_grpc_desc\n def desc.trace_with_newrelic?; true; end # force a true response from this method\n def desc.process_distributed_tracing_headers(ac); end # noop this DT method (tested elsewhere)\n def desc.metadata_for_call(call); NewRelic::EMPTY_HASH; end # canned. test metadata_for_call elsewhere\n # force finishable to be nil\n NewRelic::Agent::Tracer.stub(:start_transaction_or_segment, nil) do\n result = desc.handle_with_tracing(nil, nil, method, nil) { return_value }\n\n assert_equal return_value, result\n # MiniTest does not have a wont_raise, but this test would fail if\n # finishable called #finish when nil\n end\n end" ]
[ "0.64457124", "0.6171477", "0.60373497", "0.5810495", "0.5791451", "0.5789105", "0.57454157", "0.57454157", "0.57354605", "0.5730633", "0.5715325", "0.56850415", "0.5657544", "0.5643667", "0.5631561", "0.5602212", "0.5585709", "0.55815446", "0.55812424", "0.5562895", "0.55435914", "0.55416965", "0.55008197", "0.5500516", "0.5495587", "0.54891247", "0.5478413", "0.54707474", "0.54636836", "0.5453149", "0.544334", "0.543913", "0.5433804", "0.542181", "0.5399909", "0.5381317", "0.5371715", "0.5370059", "0.5369929", "0.5369365", "0.5369365", "0.53671557", "0.5366931", "0.536637", "0.53603864", "0.53587514", "0.5351337", "0.53345484", "0.53215414", "0.5313208", "0.5311984", "0.5311464", "0.53035724", "0.5302753", "0.5300398", "0.529411", "0.529411", "0.52874213" ]
0.6131511
33
check if sim start cmd for :go is not empty and does not raise anything
def test_start_simulation_manager_cmd_pass record = mock 'record' do stubs(:sm_uuid).returns('sm_uuid') stubs(:absolute_log_path).returns('some.log') end configuration = mock 'configuration' do stubs(:simulation_manager_version).returns(:go) end Rails.stubs(:configuration).returns(configuration) refute_empty ShellBasedInfrastructure.start_simulation_manager_cmd(record).to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def no_command?\n exit_code == 127\n end", "def check_mandatory!\n if options.work_dir.nil?\n kill \"missing file operand\"\n end\n if options.contents_template.nil?\n kill \"could not find contents template\"\n end\n end", "def gui?; !ENV.fetch('OVJ_VM_GUI', '').empty?; end", "def gui?; !ENV.fetch('OVJ_VM_GUI', '').empty?; end", "def command_given?\n !@command.empty?\n end", "def no_command?\n @no_command\n end", "def validate_argv\n if ARGV.empty? then\n ARGV << \"start\"\n else\n if not %w{start stop restart zap status}.include? ARGV.first then\n $stderr.puts \"ERROR: invalid command '#{ARGV.first}'\"\n $stderr.puts\n $stderr.puts @opt_parser.help()\n exit 1\n end\n end\n end", "def command?(name)\n !which(name).nil?\n end", "def exit_ok?\n current_project.load_agents.empty?\n end", "def launchctl?\n launchctl.present?\n end", "def launchctl?\n launchctl.present?\n end", "def precheck\n if !BinarySolo.dir_valid?\n puts \"this is not a binary_solo directoy => better run $ binarysolo init\".colorize(:red)\n false\n elsif !BinarySolo.config_valid?\n puts \"your config is invalid - but I dont have any details for you (yet)\".colorize(:red)\n false\n else\n true\n end\nend", "def first_run?\n not File.exists? '/boot/config/.boxcar'\n end", "def start?\r\n start\r\n end", "def check_command_existence(cmd_name)\n\tret = `type #{cmd_name} 1>/dev/null 2>/dev/null`\n\treturn $?.exitstatus == 0 ? true : false\nend", "def gui?\n !ENV.fetch('GUI', '').empty?\nend", "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 disabled_main_command?\r\n # If Continue is Selected\r\n if @command_window.command == SDK::Scene_Commands::Scene_Title::Continue\r\n return true unless @continue_enabled\r\n end\r\n return false\r\n end", "def command?(name)\n !which(name).nil?\n end", "def start?\n @opts[:start]\n end", "def disabled_main_command?\r\n return false\r\n end", "def disabled_main_command?\r\n return false\r\n end", "def cd_into_test?\n !File.exist?(\"app\") && File.exist?(\"test\") &&\n (File.exist?(\"main.tf\") || File.exist?(\"main.rb\"))\n end", "def no_script?\n return false unless $ARGV.empty?\n\n print_error(\"You must specify a program to debug\")\n true\n end", "def command?(name)\n !which(name).nil?\nend", "def check_for_executable; end", "def match?(cmd)\n (cmd =~ /#{inst}\\s/) != nil\n end", "def check_if_user_gave_input\n\n if ARGV.empty? == true\n puts \" Saisir une recherche après le fichier .rb\"\n abort.google_search\n else ARGV\n\n end\n end", "def isok(input)\n # make sure that the input does not contain system ''\n ! input.downcase.include? 'system'\n end", "def valid_command?(cmd)\n cmd.scan(/^(PLACE|MOVE|LEFT|RIGHT|REPORT|EXIT)(.*)/i).any?\n end", "def valid_command?(val)\n system_command?(val) || pry_command?(val)\n end", "def valid_command_path?(path)\n File.exist?(path) && File.executable?(path)\n end", "def cmd_succeeds(cmd)\n system_cmd(cmd).should be true\n end", "def one_word_command\n switch = cmd.switch ? cmd.switch.downcase : nil\n switch == \"pass\" || switch == \"reload\" || switch == \"evade\"\n end", "def system_check(cmd)\n success = system cmd\n raise \"Error running '#{cmd}'\" unless success \nend", "def help_start?\n @show_help =~ /start/i\n end", "def running?\n ck_valid\n kvm = File.basename(SysConf.value_for :kvm_bin)\n cmdline =~ /#{kvm}/\n end", "def command_found; end", "def execute_cmd_single(cmd,service,connection)\n\n\t\t\tconnection.inform(\"send #{cmd[:cmd].inspect} to #{service.name}\")\n\n\t\t\twant={\n\t\t\t\t:start\t\t=>\t:up,\n\t\t\t\t:stop\t\t\t=>\t:down,\n\t\t\t\t:restart\t=>\t:restart,\n\t\t\t\t:ignore\t\t=>\t:ignore\n\t\t\t}[cmd[:cmd]]\n\t\t\tif(want)\n\t\t\t\tLog::debug(\"sending #{want} to #{service.name}\")\n\t\t\t\tservice.set_want_state(want)\n\t\t\tend\n\t\t\t\n\t\t\twait=cmd[:wait]\n\t\t\treturn(false) if(!wait)\n\t\t\tstart_time=Time.now\n\t\t\t\n\t\t\t# wait for service manager to tick at least once\n\t\t\tticks=ServiceMgr.instance.tick_count\n\t\t\tsleep(0.5) while(ServiceMgr.instance.tick_count == ticks)\n\n\t\t\treturn(true) if(want == :ignore)\n\t\t\t\n\n\t\t\t# wait for process to be in desired state\n\t\t\twhile(service.current_state != service.want_state || service.want_state == :restart)\n\t\t\t\tsleep(0.5)\n\t\t\t\t\n\t\t\t\t# timeout?\n\t\t\t\tif((Time.now - start_time) >= wait)\n\t\t\t\t\tconnection.inform(\"timed out waiting for #{service.name}\")\n\t\t\t\t\treturn(false)\n\t\t\t\tend\n\t\t\tend\n\t\t\t\n\t\t\ttrue\n\t\tend", "def run_cmd cmd\n msg { \"{@Darn, you can't run commands yet.\\n\\n#{location.long_appearance}\" }\n end", "def check_no_extra_args!\n if @argv.length > 0\n Braid::Command.handle_error(\n Braid::BraidError.new('Extra argument(s) passed to command.'))\n end\n end", "def is_running\n !`/etc/init.d/minecraft status`.include?('not')\nend", "def command?(name)\n __getobj__.present?(name)\n end", "def sim_is_running?\n not sim_pid.nil?\n end", "def testNoAction\n executeMaster( [ '--process', 'DummyProcess', '--user', 'DummyUser' ],\n :Repository => 'Dummy/MasterServerInstalledWithDummySender',\n :AddRegressionProcesses => true,\n :AddRegressionSenders => true\n ) do |iError|\n assert_equal(nil, $Variables[:DummySenderCalls])\n end\n end", "def check_usage\n unless ARGV.length == 1\n puts \"Forma de uso: restaura.rb paginaweb\"\n exit\n end\nend", "def environmentOK?()\n\tcommandsMissing = []\n\tNEEDED_COMMANDS.each{ |command|\n\t\tif !which(command)\n\t\t\tcommandsMissing.push(command)\n\t\tend\n\t}\n\tif commandsMissing.size > 0\n\tputs \"You are missing following programs:\\n\"\n\tcommandsMissing.each { |command|\n\t\tputs \"\\t#{command}\\n\"\n\t}\n\treturn false\n\tend\n\treturn true\nend", "def badstart\n abort \"Use: \" + $PROGRAM_NAME + \" <login>\"\nend", "def commandline\n ui == \"commandline\"\n end", "def exec_exixts?(name)\n `which #{name}`.start_with?('/')\n end", "def programChecker(cmd)\n if which(cmd).nil?\n abort(\"EXITING: Please install #{cmd} before continuing\")\n end\nend", "def validrptDotsCommand?\n\tif @commands.size < 3\n\t\treturn false \n\telsif @commands[1].size <=0\n\t\treturn false\n\telsif @commands[2].size <=0\n\t\treturn false\n\tend \n\t\treturn true \nend", "def test_non_null_exit_ignored\n run = Cute::Execute[\"ls\",\"/zoefkzoifjauifhiagier\"].run!()\n assert_nothing_raised do\n run.wait({})\n end\n assert_equal(2,run.status.exitstatus)\n end", "def can_start?\n true\n end", "def started?\n @continue\n end", "def root_command?\n parents.empty?\n end", "def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\n end", "def go_source?\n with_configured_gopath { Licensed::Shell.success?(\"go\", \"doc\") }\n end", "def test_not_run?(test_case)\n test_case[:exec_status] == 'n'\n end", "def special_command?(command)\n command =~ /^(?:exit|end)/\n end", "def system_check(cmd)\n puts \"=> '#{cmd}'\"\n success = system cmd\n raise \"Error running '#{cmd}'\" unless success \nend", "def main_commands_enabled\n $game_party.exists\n end", "def main_commands_enabled\n $game_party.exists\n end", "def main_commands_enabled\n $game_party.exists\n end", "def can_process_cmd?\n settings.queue.empty?\n end", "def arguments_valid?\n true if @commands.length > 0\n end", "def has_commands\n @commands.length > 0\n end", "def setup_args_valid?(argsArr)\r\n if nil==argsArr[0] or argsArr[0]==\"\"\r\n return \"Bot token cannot be empty or nil.\"\r\n elsif nil==argsArr[1] or argsArr[1]==\"\"\r\n return \"Bot clientId cannot be empty or nil.\"\r\n elsif nil==argsArr[2]\r\n return \"Bot command prefix cannot be nil.\"\r\n end\r\n\r\n return nil\r\n end", "def check_if_user_gave_input\n abort(\"mkdiruby: missing input\") if ARGV.empty?\n abort(\"mkdiruby: input contains more than one argument\") if ARGV.count > 1\nend", "def isnt_an_action_command?(cmd)\n !!(/^(get|find|is|assert|element|setImplicitWaitTimeout|setScriptTimeout|newSession).*/.match(cmd))\n end", "def command_start; end", "def command_start; end", "def command_start; end", "def ask_for_start\n puts \"Do you want to start the game? y/n\"\n user_input = Info.get_user_input\n if user_input.downcase == \"y\"\n start_game\n elsif user_input.downcase == \"n\"\n puts \"You said no :(\"\n else\n exit_app\n end\n end", "def check_that_no_text_run_is_active\n if @rt_run_context.inside_a_run\n raise \"Unexpected run! #{ @rt_run_context.inspect }\"\n end\n end", "def ensure_any_args\n if ARGV.size == 0\n $stderr.puts \"ERROR: Must provide the name of a koan\"\n exit -1\n end\nend", "def run_app_not_exist?(host_path)\n\t\t\tif v.app_not_exist?(host_path)\n\t\t\t\t$stdout.puts Rainbow(\"Success: No pre-existig app at '#{host_path}'\").green\n\t\t\telse\n\t\t\t\texit 1\n\t\t\tend\n\t\tend", "def validrptHivCommand?\n\tif @commands.size < 2\n\t\treturn false \n\telsif @commands[1].size <=0\n\t\treturn false\n\telsif @commands[2].size <=0\n\t\treturn false\n\telsif @commands[3].size <=0\n\t\treturn false\n\tend \n\t\treturn true \nend", "def is_command_line_arg_empty(arg)\n arg.nil? or arg.empty?\nend", "def movement_cmd?(cmd)\n\t \tret = false\n\t \treq = cmd[:request].split(\" \")\n\t \tif [\"E2\",\"I3\"].include?(req[0])\n\t \t\tret = true\n\t \tend\n\t \treturn ret\n\t end", "def run_cmd(cmd)\n puts blue(cmd)\n raise unless system cmd\n end", "def ok(command)\n end", "def requireCMD(cmdName, extraHelp = nil)\n\n if(cmdName.start_with? \"./\" or File.exists? cmdName)\n # Skip relative paths\n return\n end\n\n if which(cmdName) != nil\n # Command found\n return\n end\n\n # Windows specific checks\n if OS.windows?\n # There are a bunch of inbuilt stuff that aren't files so ignore them here\n case cmdName\n when \"call\"\n return\n when \"start\"\n return\n when \"mklink\"\n return\n end\n end\n\n # Print current search path\n puts \"\"\n info \"The following paths were searched for \" +\n pathExtsAsArray.map{|i| \"'#{cmdName}#{i}'\"}.join(' or ') + \" but it wasn't found:\"\n\n pathAsArray.each{|p|\n puts p\n }\n \n onError \"Required program / tool '#{cmdName}' is not installed or missing from path.\\n\" +\n \"Please install it and make sure it is in path, then try again. \" +\n \"(path is printed above for reference)\" + (\n if extraHelp then \" \" + extraHelp else \"\" end) \n \nend", "def send_request?\n case ARGV[0]\n when \"--no-request\"\n return false\n end\n return true\nend", "def isExecutable(cmd)\n\treturn File.executable? cmd\nend", "def check_process_not_running(name)\n procs = get_procs_by_name(name)\n procs.should be_empty\n end", "def refute_have_run(cmd, configuration, msg = nil)\n msg ||= \"Expected configuration to not run #{cmd}, but did\"\n assert_nil configuration.runs[cmd], msg\n end", "def command_exists?\n File.exists? self.command_file\n end", "def should_run?\n raise NoMethodError\n end", "def should_run?\n raise NoMethodError\n end", "def should_run?\n raise NoMethodError\n end", "def command?(cmd)\n !!system(cmd, out: ::File::NULL, err: ::File::NULL)\n end", "def invalid_command\n puts \"Please enter a valid command\"\nend", "def invalid_command\n puts \"Please enter a valid command\"\nend", "def has_option(opt)\n\n # Create a simple test file\n f = Tempfile.new(['test_has_option', @extension]);\n f.puts 'int main() { }'\n f.flush\n\n#FIXME: /dev/null not portable\n cmd = [ @path, opt, '-o /dev/null', '-c', f.path ].join(' ') + Platform.dev_null\n Platform.execute cmd\n end", "def check_quit(cmd)\r\n if cmd == \"q\" || cmd == \"quit\"\r\n puts \"Thank you for your coming.\"\r\n puts \"Hope to see you again soon!\"\r\n return true\r\n end\r\n return false\r\nend", "def badstart\n puts \"Use: \" + $PROGRAM_NAME + \" <group>\"\n abort \"Ex: \" + $PROGRAM_NAME + \" infra\"\nend", "def validrptTbCommand?\n\tif @commands.size < 3\n\t\treturn false \n\telsif @commands[1].size <=0\n\t\treturn false\n\telsif @commands[2].size <=0\n\t\treturn false\n\tend \n\t\treturn true \nend", "def test_missing_command\n ChildProcess.exec({}, 'nosuch') do |child|\n assert !child.wait.success?\n end\n end", "def start\n\n player_loc = 0\n\n game_start = \"start\"\n\n #begin the game\n Mechanics.show_title()\n\n while true\n command = Mechanics.prompt()\n \n if command == \"help\"\n Mechanics.show_help()\n elsif command == \"start\"\n Mechanics.start_game(player_loc)\n elsif command == \"quit\"\n exit(0)\n elsif command.include? 'move'\n direction = Mechanics.check_direction(player_loc, Mechanics.parse_input(command))\n if direction != false\n player_loc = direction\n Mechanics.show_room(player_loc)\n else\n puts \"You can't seem to move that way.\"\n end\n else\n puts \"I don't know what you mean.\"\n end\n end\nend", "def gui_enabled?\n !ENV.fetch('GUI', '').empty?\nend" ]
[ "0.6099718", "0.60924816", "0.6087318", "0.6087318", "0.6025161", "0.6014837", "0.5957551", "0.5918315", "0.5908224", "0.5871625", "0.5871625", "0.5831465", "0.58070993", "0.58023465", "0.57863414", "0.57767653", "0.5760262", "0.5750627", "0.5748957", "0.57487154", "0.5740913", "0.5740913", "0.57121634", "0.5668243", "0.5663882", "0.56503683", "0.5645636", "0.5635132", "0.5603163", "0.5601076", "0.55932796", "0.55689776", "0.555661", "0.55556905", "0.554554", "0.55402875", "0.55334884", "0.5530021", "0.55186677", "0.5518023", "0.5499266", "0.54973674", "0.54898506", "0.5487937", "0.54822963", "0.5478454", "0.5464766", "0.54578316", "0.54562664", "0.5455788", "0.5450275", "0.54482776", "0.5444378", "0.5404992", "0.54046196", "0.54015934", "0.5390065", "0.5362441", "0.5351619", "0.5350536", "0.5346285", "0.53411794", "0.53411794", "0.53411794", "0.5338817", "0.5337508", "0.5336766", "0.5327369", "0.53262544", "0.5325058", "0.53238755", "0.53238755", "0.53238755", "0.53157777", "0.53118163", "0.53080744", "0.53068465", "0.53056717", "0.5293975", "0.52841425", "0.5284098", "0.52783996", "0.5273324", "0.5272779", "0.52668214", "0.52645725", "0.52626854", "0.5250298", "0.5242093", "0.5242093", "0.5242093", "0.5240982", "0.5239523", "0.5239523", "0.523703", "0.5235798", "0.5234883", "0.52303565", "0.52283615", "0.5227104", "0.5221646" ]
0.0
-1
GET /fights GET /fights.json
def index @fights = Fight.all respond_to do |format| format.html # index.html.erb format.json { render json: @fights.to_json( :include => { :field_initial => { :only => [:name] }, :field_actual => { :only => [:name] }, :category => { :only => [:name] }, :competitor_blue => { :only => [:last_name, :lot_number] }, :competitor_red => { :only => [:last_name, :lot_number] }, :competitor_winner => { :only => [:last_name, :lot_number] }, :previous_fight_blue => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } }, :previous_fight_red => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } } } ) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def index\n @sights = Sight.all\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def number_of_fights\n BoxingSchedules::Fight.all\n end", "def show\n render json: @dice\n end", "def index\n @dices = Dice.all\n\n render json: @dices\n end", "def index\n @nights = Night.all\n end", "def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end", "def index\n @sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: @sightings\n end", "def index\n @lights = Light.all\n\n render json: @lights\n end", "def index\n @flights = Flight.all\n render json: @flights\n end", "def show\n animal = Animal.find(params[:id])\n #return all the sightings for the animal\n render json: animal.to_json(include: :sightings)\nend", "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 index\n @fighters = Fighter.all\n end", "def index\n @fighters = Fighter.all\n end", "def index\n @fighters = Fighter.all\n end", "def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\n end\n end", "def index\n @result_fights = ResultFight.where(user_id: current_user.id)\n end", "def fights\n Fight.where('fighter_left_id = ? OR fighter_right_id = ?', id, id)\n end", "def index\n render json: WeatherDatum.all\n end", "def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end", "def index\n @deadlift_data_points = DeadliftDataPoint.where(\"user_id = '#{current_user.id}'\")\n @max_deadlift = (@deadlift_data_points.map {|point| point['weight']}).max || 0\n @last_max_deadlift = (@deadlift_data_points == []) ? 0 : @deadlift_data_points.last['weight']\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deadlift_data_points }\n end\n end", "def show\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie_sighting }\n end\n end", "def index\n @weights = current_user.weights.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weights }\n end\n end", "def flights\n result = Search.search_flights(params)\n if result\n # The search gave us something so we can return it\n render json: result\n else\n # Something went wrong, return a 500 error with no body\n render status: 500, json: nil\n end\n end", "def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end", "def show\n @flat_happening = FlatHappening.find(params[:id])\n\n render json: @flat_happening\n end", "def show\n @sighting = Sighting.find(params[:id])\n if @sighting\n render json: @sighting, status: :ok\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def show\n @daily_statistic = DailyStatistic.find(params[:id])\n\n render json: @daily_statistic\n end", "def sightings\n evaluate! if @sightings.nil?\n\n return JSON.dump(@sightings)\n end", "def show\n @days_since_visit = DaysSinceVisit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @days_since_visit }\n end\n end", "def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end", "def index\n waiver_picks_decorator = WaiverPicksDecorator.new(\n @fpl_team.waiver_picks.where(round_id: (params[:round_id] || Round.current_round.id))\n )\n\n render json: { waiver_picks: waiver_picks_decorator.all_data }\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def index\n @flaws = Flaw.order(\"date DESC, created_at DESC\").page( params[:page] ).per(10)\n \n @flaw = Flaw.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flaws }\n end\n end", "def weather\n # empty array dates is still fine, not a reason for 400 (happens for venues without courts)\n render json: {} and return if params.dig(:dates).blank?\n\n forecast = WeatherForecaster.call(venue, [*params.require(:dates)])\n json = forecast.transform_values do |value|\n value ? value.slice(*%w(icon temperature)) : nil\n end\n render json: json\n end", "def index\n @flightstats = Flightstat.all\n end", "def index\n\t\t@flights = Flight.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @flights }\n\t\tend\n\tend", "def scheduled_fights_scraper\n BoxingSchedules::Scraper.scrape_scheduled_fights\n end", "def msau\n render json: get_msau(@visits)\n end", "def show\n @sighting = Sighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sighting }\n end\n end", "def show\n @fight = Fight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fight.to_json( :include => { :field_initial => { :only => [:name] }, :field_actual => { :only => [:name] }, :category => { :only => [:name] }, :competitor_blue => { :only => [:last_name, :lot_number] }, :competitor_red => { :only => [:last_name, :lot_number] }, :competitor_winner => { :only => [:last_name, :lot_number] }, :previous_fight_blue => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } }, :previous_fight_red => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } } } ) }\n\n end\n end", "def show\n render json: @sighting\n end", "def index\n @draws = Draw.paginate(:page => params[:page], :per_page => 50)\n @winning_draws = Draw.where(:selection => \"WINNER\")\n @draw = Draw.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @draws }\n end\n end", "def show\n render json: @wellist\n end", "def flights(params={})\n perform_get('/flights.xml', params)\n end", "def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end", "def show\n @wager = Wager.find(params[:id])\n\n render json: @wager\n end", "def index\n @buddyfights = Buddyfight.all\n end", "def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end", "def index\n #Moving this to the application controller because this isn't called by a partial rendering.\n #@zombie_sightings = ZombieSighting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.js\n format.json { render json: @zombie_sightings }\n end\n end", "def days\n @trainings = Training.all\n @activities = Activity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trainings }\n end\n end", "def index\n @wfeats = Wfeat.all\n end", "def total\n url = \"https://api.justgiving.com/#{Rails.application.secrets.justgiving_api_key}/v1/fundraising/pages/thebteam-cardiff\"\n begin\n response = RestClient.get \"https://api.justgiving.com/#{Rails.application.secrets.justgiving_api_key}/v1/fundraising/pages/thebteam-cardiff\"\n if response.code == 200\n @total = JSON.parse response.body\n end\n rescue => e\n logger.error \"Mole Total: #{e.message} - #{url}\"\n @total = { grandTotalRaisedExcludingGiftAid: \"Sorry, JustGiving is unavailable at this time.\" }\n end\n\n respond_to do |format|\n format.html # total.html.erb\n format.json { render json: @total, callback: params[:callback] }\n format.xml { render xml: @total }\n end\n end", "def index\n @forecast_wsizes = ForecastWsize.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @forecast_wsizes }\n end\n end", "def index\n @weddings = Wedding.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weddings }\n end\n end", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def show\n animal = Animal.find(params[:id])\n render json: animal.as_json(include: :sightings) \n end", "def index\n @twentyeights = Twentyeight.all\n end", "def weekIndex\n render json: Restaurant.restaurantsWeek\n end", "def index\n @flights = Flight.all\n\n respond_to do |format|\n format.html \n format.json { render json: @flights, :include => [:airplane, :reservations, :users, :seats] }\n end\n end", "def index\n @days = @trip.days.order(trip_day: :asc)\n render json: @days, include: [:activities]\n end", "def index\n @nfl_weathers = NflWeather.all\n end", "def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def show\n @wine = Wine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def dates\n render json: @standings\n end", "def index\n \n if params[:fly_id]\n @passes = Fly.find(params[:fly_id]).passes\n elsif params[:client_id]\n @passes = Client.find(params[:client_id]).passes\n else\n @passes = Pass.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @passes }\n end\n end", "def index\n @weights = current_user.weights\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weights }\n end\n end", "def index\n @walls = Wall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @walls }\n end\n end", "def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end", "def sights()\n sql = \"SELECT * FROM sights WHERE city_id = $1\"\n values = [@id]\n sights = SqlRunner.run(sql, values)\n return sights.map {|sight|Sight.new(sight)}\n end", "def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend", "def index\n @stories = Story.all\n render json: @stories, root: false\n end", "def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n format.ext_json { render :json => find_dungeons.to_ext_json(:class => Dungeon, :count => Dungeon.count(options_from_search(Dungeon))) }\n end\n end", "def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end", "def index\n @winning_numbers = WinningNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winning_numbers }\n end\n end", "def show\n @fight = Fight.find(params[:id])\n @fighters = [@fight.fighter_one, @fight.fighter_two]\n @pick = Pick.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fight }\n end\n end", "def index\n @visits = Visit.all\n render json: { \"count\": @visits.count, \"all_visits\": @visits }\n #render json: {\"all_visits\": @visits} \n end", "def index\n @weight_logs = current_user.weight_logs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weight_logs }\n end\n end", "def index\n @passes = Pass.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @passes }\n end\n end", "def index\n if params[:q]\n url = \"http://api.worldweatheronline.com/premium/v1/tz.ashx?q=#{params[:q]}&format=json&key=2c46659bd90a41a0bcf132257162410\"\n @json = ActiveSupport::JSON.decode(open(url).read)\n else\n end\n end", "def new\n @fight = Fight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fight }\n end\n end", "def index \n fans = Fan.all \n render json: fans \n end", "def show\n @house = House.includes(:watchings).find(params[:id])\n render json: { house: @house, watchings_count: @house.watchings.size }\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 show\n @flight = Flight.find(params[:id])\n render json: @flight\n end", "def index\n @squat_data_points = SquatDataPoint.where(\"user_id = '#{current_user.id}'\")\n @max_squat = (@squat_data_points.map {|point| point['weight']}).max || 0\n @last_max_squat = (@squat_data_points == []) ? 0 : @squat_data_points.last['weight']\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @squat_data_points }\n end\n end", "def show\n render json: @light\n end", "def index\n @stats = Stat.all\n\n render json: {data:\n @stats.map {|stat|\n days = range_to_days(stat)\n {\n total_seconds: stat.total_seconds,\n human_readable_total: humanize(stat.total_seconds),\n daily_average: stat.daily_average,\n human_readable_daily_average: humanize(stat.daily_average),\n range: stat.range,\n holidays: stat.holidays,\n days_including_holidays: days,\n days_minus_holidays: days - stat.holidays,\n status: stat.status,\n is_already_updating: stat.is_already_updating,\n is_stuck: stat.is_stuck,\n is_up_to_date: stat.is_up_to_date,\n timeout: stat.timeout,\n editors: stat.editors.map {|e|\n {\n name: e.name,\n total_seconds: e.total_seconds,\n percent: e.percent\n }\n }\n }\n }}\n end", "def index\n puts \"user: #{@current_user.json_hash[:id]}\"\n hosted_dinners = []\n attended_dinners = []\n @hosted_dinners = @current_user.hosted_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n hosted_dinners << dinner.all_info\n end\n @attended_dinners = @current_user.attended_dinners.where('starts_at >= ?', \"#{Time.now}\").order(starts_at: :asc).each do |dinner|\n attended_dinners << dinner.all_info\n end\n render json: {\n hosting: hosted_dinners,\n attending: attended_dinners\n }\n end", "def index\n render json: Story.all\n end", "def index\n @wigs = Wig.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wigs }\n end\n end", "def index\n @twenties = Twenty.all\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 @twentyfours = Twentyfour.all\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def index\n\n require 'net/http'\n require 'json'\n\n @measures = Measure.all.order(\"created_at DESC\")\n weatherData\n\n end", "def show\n @farm = Farm.find(params[:id])\n @herds = Herd.where(:farm_id => @farm.id)\n respond_to do |format|\n format.html # index.html.erbb\n format.json { render :json => @farm }\n end\n end" ]
[ "0.6651269", "0.65643734", "0.63894165", "0.63314337", "0.62656564", "0.625256", "0.6227823", "0.6223828", "0.616158", "0.61259735", "0.6120008", "0.60488063", "0.6023225", "0.60102725", "0.59912914", "0.59912914", "0.59912914", "0.59901905", "0.59883356", "0.5947745", "0.5920216", "0.591778", "0.5916422", "0.5912624", "0.5890791", "0.58717793", "0.5868998", "0.58588696", "0.5833427", "0.58212477", "0.5816709", "0.58145815", "0.5810338", "0.5801299", "0.579888", "0.57984555", "0.5796078", "0.5795533", "0.57850766", "0.57843333", "0.5782193", "0.57792497", "0.57726955", "0.57561123", "0.5739745", "0.5735422", "0.5726031", "0.57174563", "0.57162476", "0.57159966", "0.57000923", "0.56994873", "0.5697958", "0.5687445", "0.5685882", "0.5685097", "0.5684863", "0.5682586", "0.5672314", "0.567209", "0.5669172", "0.5667268", "0.5665138", "0.56609446", "0.56451565", "0.5641661", "0.5641055", "0.56276494", "0.5625961", "0.5610791", "0.5603879", "0.56008846", "0.559585", "0.55946726", "0.55924684", "0.5588519", "0.5580434", "0.5576515", "0.55763423", "0.55717045", "0.5559555", "0.55471575", "0.5544429", "0.55432844", "0.55432165", "0.5543005", "0.5539061", "0.5537221", "0.5529148", "0.5528689", "0.5528624", "0.5526479", "0.5525226", "0.5525173", "0.5519863", "0.55186164", "0.55177355", "0.55052245", "0.5504724", "0.55037177" ]
0.7035565
0
GET /fights/1 GET /fights/1.json
def show @fight = Fight.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @fight.to_json( :include => { :field_initial => { :only => [:name] }, :field_actual => { :only => [:name] }, :category => { :only => [:name] }, :competitor_blue => { :only => [:last_name, :lot_number] }, :competitor_red => { :only => [:last_name, :lot_number] }, :competitor_winner => { :only => [:last_name, :lot_number] }, :previous_fight_blue => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } }, :previous_fight_red => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } } } ) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fights = Fight.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fights.to_json( :include => { :field_initial => { :only => [:name] }, :field_actual => { :only => [:name] }, :category => { :only => [:name] }, :competitor_blue => { :only => [:last_name, :lot_number] }, :competitor_red => { :only => [:last_name, :lot_number] }, :competitor_winner => { :only => [:last_name, :lot_number] }, :previous_fight_blue => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } }, :previous_fight_red => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } } } ) }\n end\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def index\n @flights = Flight.all\n render json: @flights\n end", "def show\n @flat_happening = FlatHappening.find(params[:id])\n\n render json: @flat_happening\n end", "def show\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @zombie_sighting }\n end\n end", "def show\n @flight = Flight.find(params[:id])\n render json: @flight\n end", "def flights\n trip = Trip.where('id = ?', params[:id]).take\n if !trip.nil\n respond_with( trip.flights )\n else\n render :json => { error: 404 }, :status => 404\n end\n end", "def index\n @lights = Light.all\n\n render json: @lights\n end", "def show\n animal = Animal.find(params[:id])\n #return all the sightings for the animal\n render json: animal.to_json(include: :sightings)\nend", "def show\n render json: @dice\n end", "def index\n @sights = Sight.all\n end", "def index\n @flaws = Flaw.order(\"date DESC, created_at DESC\").page( params[:page] ).per(10)\n \n @flaw = Flaw.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flaws }\n end\n end", "def show\n @daily_statistic = DailyStatistic.find(params[:id])\n\n render json: @daily_statistic\n end", "def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end", "def show\n @wager = Wager.find(params[:id])\n\n render json: @wager\n end", "def index\n @dices = Dice.all\n\n render json: @dices\n end", "def show\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forest }\n end\n end", "def show\n render json: Festival.build_for(params[:id]).to_json\n end", "def show\n @wine = Wine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end", "def show\n @farm = Farm.find(params[:id])\n @herds = Herd.where(:farm_id => @farm.id)\n respond_to do |format|\n format.html # index.html.erbb\n format.json { render :json => @farm }\n end\n end", "def show\n @sighting = Sighting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sighting }\n end\n end", "def index\n @nights = Night.all\n end", "def show\n @days_since_visit = DaysSinceVisit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @days_since_visit }\n end\n end", "def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\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 @fighters = Fighter.all\n end", "def index\n @fighters = Fighter.all\n end", "def index\n @fighters = Fighter.all\n end", "def show\n @sighting = Sighting.find(params[:id])\n if @sighting\n render json: @sighting, status: :ok\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end", "def index\n render json: WeatherDatum.all\n end", "def show\n @fight = Fight.find(params[:id])\n @fighters = [@fight.fighter_one, @fight.fighter_two]\n @pick = Pick.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fight }\n end\n end", "def index\n\t\t@flights = Flight.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @flights }\n\t\tend\n\tend", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def new\n @fight = Fight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fight }\n end\n end", "def show\n @daylight = Daylight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @daylight }\n end\n end", "def show\n @flaw = Flaw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flaw }\n end\n end", "def index\n @flightstats = Flightstat.all\n end", "def flights(params={})\n perform_get('/flights.xml', params)\n end", "def show\n animal = Animal.find(params[:id])\n render json: animal.as_json(include: :sightings) \n end", "def show\n @skydatum = Skydatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @skydatum }\n end\n end", "def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end", "def show\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @flight }\n end\n end", "def show\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @therapist }\n end\n end", "def flights\n result = Search.search_flights(params)\n if result\n # The search gave us something so we can return it\n render json: result\n else\n # Something went wrong, return a 500 error with no body\n render status: 500, json: nil\n end\n end", "def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end", "def show\n render json: @sighting\n end", "def weekIndex\n render json: Restaurant.restaurantsWeek\n end", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def show\n @weather = Weather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather }\n end\n end", "def show\n @weather = Weather.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather }\n end\n end", "def route\n hitch = Hitch.find(params[:hitch_id])\n render json: hitch.geojson\n end", "def new\n @fight = Fight.new\n @fighters = Fighter.order('first_name desc')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fight }\n end\n end", "def show\n @hot_water_demand = HotWaterDemand.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hot_water_demand }\n end\n end", "def number_of_fights\n BoxingSchedules::Fight.all\n end", "def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @traffic }\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 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 show\n @witness = Witness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @witness }\n end\n end", "def show\n @weight = Weight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weight }\n end\n end", "def show\n render json: @wellist\n end", "def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\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 weather\n # empty array dates is still fine, not a reason for 400 (happens for venues without courts)\n render json: {} and return if params.dig(:dates).blank?\n\n forecast = WeatherForecaster.call(venue, [*params.require(:dates)])\n json = forecast.transform_values do |value|\n value ? value.slice(*%w(icon temperature)) : nil\n end\n render json: json\n end", "def show\n story = Story.find(params[:id])\n render json: story\n end", "def fresh_stories\n get_data(\"stories/fresh\")\n end", "def show\n render \"api/v1/bounties/show\"\n end", "def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend", "def index\n @sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: @sightings\n end", "def index\n @flights = Flight.all\n\n respond_to do |format|\n format.html \n format.json { render json: @flights, :include => [:airplane, :reservations, :users, :seats] }\n end\n end", "def show\n render json: @light\n end", "def index\n session[:admin] = true\n @badges = Badge.order('approved_at desc,id')\n @fri_count = Badge.select { |b| b.friday? }.size\n @sat_count = Badge.select { |b| b.saturday? }.size\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @badges }\n end\n end", "def index\n @weddings = Wedding.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weddings }\n end\n end", "def show\n @grumble = Grumble.find(params[:id])\n render status: 200, json: @grumble.to_json\n end", "def index \n fans = Fan.all \n render json: fans \n end", "def index\n @heights = Height.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @heights }\n end\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def index\n @factions = Faction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @factions }\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 show\n @hot_water_distribution = HotWaterDistribution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hot_water_distribution }\n end\n end", "def index\n @walls = Wall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @walls }\n end\n end", "def show\n @fortune = Fortune.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fortune }\n end\n end", "def show\n @foodhamper = Foodhamper.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foodhamper }\n end\n end", "def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end", "def show\n\t\t@flight = Flight.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @flight }\n\t\tend\n\tend", "def get_featured\n render json: Event.where(is_featured: true), status: :ok\n end", "def show\n @monster = Monster.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monster }\n end\n end", "def index\n @draws = Draw.paginate(:page => params[:page], :per_page => 50)\n @winning_draws = Draw.where(:selection => \"WINNER\")\n @draw = Draw.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @draws }\n end\n end", "def show\n @fight = Fight.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fight }\n end\n end", "def showByLocation\n location_id=params[:location_id]\n loc=Location.find_by(location_id:location_id)\n if loc!=nil\n @weathers=loc.weathers.where(\"date=?\",params[:date])\n @weathers_currently = Parser.currentWeather params[:location_id]\n if @weathers==nil\n @weathers=[]\n end\n else\n @weathers=[]\n @weathers_currently={}\n end\n\n respond_to do |format|\n format.html\n format.json #json format is implemented in *.json.erb file\n end\n end", "def index\n render json: Story.all\n end", "def index\n @result_fights = ResultFight.where(user_id: current_user.id)\n end", "def index\n @nfl_weathers = NflWeather.all\n end", "def show\n @forecast_wsize = ForecastWsize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @forecast_wsize }\n end\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 @nightclub = Nightclub.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nightclub }\n end\n end", "def show\n sighting = Sighting.find(params[:id])\n #render json: sighting.to_json(:include => {:bird => {:only =>[:name, :species]}, :location => {:only =>[:latitude, :longitude]}}, :except => [:updated_at])\n end", "def state_beers\n render json: BreweryDb::ShowBeers.new('state', params[:state]).results\n end" ]
[ "0.70095485", "0.6533609", "0.65071505", "0.6401412", "0.63334215", "0.6271122", "0.62679684", "0.6233991", "0.62037486", "0.619952", "0.6173076", "0.61530405", "0.61510235", "0.6127835", "0.6112146", "0.6088976", "0.6088542", "0.60851306", "0.6060658", "0.6056948", "0.6046213", "0.60361034", "0.6032989", "0.6031154", "0.60202456", "0.60180426", "0.6015075", "0.60111475", "0.60111475", "0.60111475", "0.6008656", "0.6007411", "0.59865427", "0.5965974", "0.59534395", "0.5942026", "0.59370834", "0.59350806", "0.5934618", "0.5930007", "0.5920075", "0.5915695", "0.59084827", "0.58903825", "0.58898985", "0.58808196", "0.5873165", "0.58717966", "0.5871085", "0.58708155", "0.5868004", "0.58618957", "0.58618957", "0.58523864", "0.58521116", "0.5845329", "0.5836797", "0.5836202", "0.5835238", "0.5829702", "0.58294404", "0.5824609", "0.5821901", "0.581569", "0.58132017", "0.58099806", "0.58062506", "0.5803225", "0.5802425", "0.57970244", "0.57950145", "0.57877856", "0.57870936", "0.5781608", "0.57713497", "0.5769476", "0.5767775", "0.5764721", "0.57595485", "0.57588965", "0.57581484", "0.5744061", "0.57368934", "0.5732621", "0.5729657", "0.57284284", "0.57272327", "0.5723127", "0.57195824", "0.57146156", "0.5698753", "0.56984687", "0.569596", "0.5693554", "0.56931436", "0.56919223", "0.5685644", "0.5678353", "0.5673006", "0.56708556" ]
0.6052971
20
GET /fights/new GET /fights/new.json
def new @fight = Fight.new respond_to do |format| format.html # new.html.erb format.json { render json: @fight } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @monkey = Monkey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monkey }\n end\n end", "def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end", "def new\n @wine = Wine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wine }\n end\n end", "def new\n @flight = Flight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flight }\n end\n end", "def new\n @flower = Flower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flower }\n end\n end", "def new\n @zombie_sighting = ZombieSighting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zombie_sighting }\n end\n end", "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end", "def new\n @witness = Witness.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @witness }\n end\n end", "def new\n @nightclub = Nightclub.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nightclub }\n end\n end", "def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end", "def new\n @wall = Wall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wall }\n end\n end", "def new\n @wall = Wall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wall }\n end\n end", "def new\n @flaw = Flaw.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @flaw }\n end\n end", "def new\n @traffic = Traffic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @traffic }\n end\n end", "def new\n @fridge = Fridge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fridge }\n end\n end", "def new\n @wanted = Wanted.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wanted }\n end\n end", "def new\n @fight = Fight.new\n @fighters = Fighter.order('first_name desc')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fight }\n end\n end", "def new\n @week = Week.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @week }\n end\n end", "def new\n @week = Week.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @week }\n end\n end", "def new\n @tower = Tower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tower }\n end\n end", "def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end", "def new\n @weather = Weather.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end", "def new\n @weather = Weather.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weather }\n end\n end", "def new\n @kitchen = Kitchen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kitchen }\n end\n end", "def new\n @witch = Witch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @witch }\n end\n end", "def new\n @monel = Monel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monel }\n end\n end", "def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end", "def new\n @holding = Holding.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @holding }\n end\n end", "def new\n @week = Week.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @week }\n end\n end", "def new\n @days_since_visit = DaysSinceVisit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @days_since_visit }\n end\n end", "def new\n @lift = Lift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lift }\n end\n end", "def new\n @goat = Goat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goat }\n end\n end", "def new\n @monster = Monster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monster }\n end\n end", "def new\n @green = Green.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @green }\n end\n end", "def new\n @hotel_stay = HotelStay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hotel_stay }\n end\n end", "def new\n @story = Story.new\n\t\t@title = \"Nowy news\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @winner = Winner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @winner }\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n end", "def new\n @therapist = Therapist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @therapist }\n end\n end", "def new\n @staffer = Staffer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @staffer }\n end\n end", "def new\n @fortune = Fortune.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fortune }\n end\n end", "def new\n @dayoff = Dayoff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dayoff }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end", "def new\n @neighborhood = Neighborhood.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @neighborhood }\n end\n end", "def new\n @hot_water_demand = HotWaterDemand.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hot_water_demand }\n end\n end", "def new\n @fwlist = Fwlist.new\n \t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fwlist }\n end\n end", "def new\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\n \n @sleep = json_hash\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @farm }\n end\n end", "def new\n @skydatum = Skydatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @skydatum }\n end\n end", "def new\n @feat = @person.feats.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @feat }\n end\n end", "def new\n @foil = Foil.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foil }\n end\n end", "def new\n @wedding = Wedding.new\n @services = Service.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wedding }\n end\n end", "def new\n @page = 'newdoll'\n @doll = current_user.dolls.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @doll }\n end\n end", "def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @story }\n end\n end", "def new\n @interesting = Interesting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interesting }\n end\n end", "def new\n @thing = Thing.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @thing }\n end\n end", "def new\n @visit = Visit.new\n\n respond_to do |format|\n format.json { render json: @visit }\n end\n end", "def new\n @lunchplan = Lunchplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lunchplan }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @meal }\n end\n end", "def new\n @title = t('view.trust_funds.new_title')\n @trust_fund = TrustFund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trust_fund }\n end\n end", "def new\n @farm = Farm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @farm }\n end\n end", "def new\n @beat = Beat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beat }\n end\n end", "def new\n @faction = Faction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @faction }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stat }\n end\n end", "def new\n @fight = Fight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fight }\n end\n end", "def new\n @interested = Interested.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interested }\n end\n end", "def new\n @sighting = Sighting.new\n\t@types = Type.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sighting }\n end\n end", "def new\n @food = Food.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food }\n end\n end", "def new\n @seed = Seed.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @seed }\n end\n end", "def new\n @tweetsandwich = Tweetsandwich.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tweetsandwich }\n end\n end", "def new\n @stalking = Stalking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stalking }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @trail = Trail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trail }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @story = Story.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @story }\n end\n end", "def new\n @fixturestat = Fixturestat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fixturestat }\n end\n end", "def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end", "def new\n @feature = Feature.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feature }\n end\n end", "def new\n @monit = Monit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monit }\n end\n end", "def new\n @interest = Interest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @interest }\n end\n end", "def new\n @where_to_stay = WhereToStay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @where_to_stay }\n end\n end", "def new\n @badge = Badge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @badge }\n end\n end", "def new\n @hotel = Hotel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hotel }\n end\n end", "def new\n @foodhamper = Foodhamper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foodhamper }\n end\n end", "def new\n add_breadcrumb :new\n @visit = Visit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @visit }\n end\n end", "def new\n @stat = Stat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @stat }\n end\n end", "def new\n @newspage = Newspage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspage }\n end\n end", "def new\n @have = Have.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @have }\n end\n end", "def new\n @pokeparty = Pokeparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def new\n @daylight = Daylight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @daylight }\n end\n end" ]
[ "0.7030712", "0.7021597", "0.6974574", "0.6974574", "0.69495076", "0.69316745", "0.6917321", "0.6896696", "0.68397576", "0.68370587", "0.6789301", "0.6782575", "0.6782575", "0.67797285", "0.6779193", "0.67569363", "0.6754984", "0.6748451", "0.67399144", "0.67399144", "0.67363507", "0.6726024", "0.6726024", "0.6716895", "0.6716786", "0.6712586", "0.66919625", "0.6688868", "0.6688868", "0.66872793", "0.66856486", "0.6676786", "0.6673158", "0.6666019", "0.66592634", "0.6652945", "0.6651879", "0.66487455", "0.6641307", "0.66376895", "0.66367745", "0.6633149", "0.6633104", "0.66308546", "0.66308546", "0.66300106", "0.6626299", "0.6624824", "0.66162986", "0.66162986", "0.6615819", "0.66147053", "0.66116834", "0.6610907", "0.6610365", "0.6610008", "0.66099477", "0.6605103", "0.6596702", "0.6596702", "0.6596702", "0.6596702", "0.6591575", "0.65866864", "0.658457", "0.65816766", "0.65799654", "0.657527", "0.65703267", "0.6568736", "0.6566777", "0.6566388", "0.6565055", "0.65626204", "0.6562159", "0.65618217", "0.65607893", "0.656019", "0.65592444", "0.6556251", "0.6556251", "0.65501493", "0.65501493", "0.65501493", "0.65501493", "0.65496016", "0.65490675", "0.65490675", "0.6548177", "0.6546636", "0.6542205", "0.65421987", "0.6542177", "0.6540895", "0.6538499", "0.6534778", "0.6534244", "0.6532816", "0.653121", "0.6529903" ]
0.7278106
0
POST /fights POST /fights.json
def create @fight = Fight.new(params[:fight]) respond_to do |format| if @fight.save format.html { redirect_to @fight, notice: 'Fight was successfully created.' } format.json { render json: @fight, status: :created, location: @fight } else format.html { render action: "new" } format.json { render json: @fight.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n \t@fight = current_user.fights.new(fights_params)\n \t@fight.save\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def index\n @fights = Fight.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fights.to_json( :include => { :field_initial => { :only => [:name] }, :field_actual => { :only => [:name] }, :category => { :only => [:name] }, :competitor_blue => { :only => [:last_name, :lot_number] }, :competitor_red => { :only => [:last_name, :lot_number] }, :competitor_winner => { :only => [:last_name, :lot_number] }, :previous_fight_blue => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } }, :previous_fight_red => { :only => [:id, :number], :include => { :field_initial => { :only => [:name] } } } } ) }\n end\n end", "def create\n @sight = Sight.new(sight_params)\n\n respond_to do |format|\n if @sight.save\n format.html { redirect_to @sight, notice: 'Sight was successfully created.' }\n format.json { render :show, status: :created, location: @sight }\n else\n format.html { render :new }\n format.json { render json: @sight.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sight = Sight.new(sight_params)\n\n respond_to do |format|\n if @sight.save\n format.html { redirect_to @sight, notice: 'Sight was successfully created.' }\n format.json { render :show, status: :created, location: @sight }\n else\n format.html { render :new }\n format.json { render json: @sight.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sighting = Sighting.new(sighting_params)\n\n if @sighting.save\n render json: @sighting, status: :created, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def fights_params\n params.require(:fight).permit('opponent_1_name', 'opponent_1_strength', 'opponent_1_life', 'opponent_1_adv', 'opponent_2_name', 'opponent_2_strength', 'opponent_2_life', 'opponent_2_adv', 'opponent_3_name', 'opponent_3_strength', 'opponent_3_life', 'opponent_3_adv', 'opponent_4_name', 'opponent_4_strength', 'opponent_4_life', 'opponent_4_adv', 'opponent_5_name', 'opponent_5_strength', 'opponent_5_life', 'opponent_5_adv')\n end", "def create\n @fight = Fight.new(fight_params)\n respond_to do |format|\n if @fight.save\n format.html { redirect_to @fight, notice: 'Fight was successfully created.' }\n format.json { render :show, status: :created, location: @fight }\n else\n format.html { render :new }\n format.json { render json: @fight.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wager = Wager.new(params[:wager])\n\n if @wager.save\n render json: @wager, status: :created, location: @wager\n else\n render json: @wager.errors, status: :unprocessable_entity\n end\n end", "def create\n sighting = Sighting.create(sighting_params)\n if sighting.valid?\n render json: sighting\n else\n render json: sighting.errors\n end\n end", "def create\n @twentyeight = Twentyeight.new(twentyeight_params)\n\n respond_to do |format|\n if @twentyeight.save\n format.html { redirect_to @twentyeight, notice: 'Twentyeight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @twentyeight }\n else\n format.html { render action: 'new' }\n format.json { render json: @twentyeight.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wfeat = Wfeat.new(wfeat_params)\n\n respond_to do |format|\n if @wfeat.save\n format.html { redirect_to @wfeat, notice: 'Wfeat was successfully created.' }\n format.json { render :show, status: :created, location: @wfeat }\n else\n format.html { render :new }\n format.json { render json: @wfeat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dice = Dice.new(dice_params)\n\n if @dice.save\n render json: @dice, status: :created, location: @dice\n else\n render json: @dice.errors, status: :unprocessable_entity\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def create\n @fighter = Fighter.new(fighter_params)\n respond_to do |format|\n if @fighter.save\n format.html { redirect_to @fighter, notice: \"Fighter was successfully created.\" }\n format.json { render :show, status: :created, location: @fighter }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fighter.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @fight = Fight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fight }\n end\n end", "def create\n @dinner = Dinner.new(dinner_params)\n @dinner.seats_available = @dinner.seats\n @dinner.host = current_user\n current_user.n_hosted += 1\n respond_to do |format|\n if current_user.save and @dinner.save\n format.html { redirect_to @dinner, notice: 'Supper successfully created.' }\n format.json { render :show, status: :created, location: @dinner }\n else\n format.html { render :new }\n format.json { render json: @dinner.errors, status: :unprocessable_entity }\n logger.error @dinner.errors.full_messages\n end\n end\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def create\n @days_since_visit = DaysSinceVisit.new(params[:days_since_visit])\n\n respond_to do |format|\n if @days_since_visit.save\n format.html { redirect_to @days_since_visit, :notice => 'Days since visit was successfully created.' }\n format.json { render :json => @days_since_visit, :status => :created, :location => @days_since_visit }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @days_since_visit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\n \n description = params[:description]\n \n timestamp = params[:timestamp]\n total_sleep_seconds = params[:total_sleep]\n deep_sleep_seconds = params[:deep]\n light_sleep_seconds = params[:light]\n awake_seconds = params[:awake]\n \n if timestamp.nil? || total_sleep_seconds.nil?\n \n puts 'timestamp is nil or total_sleep_seconds is nil :('\n \n else\n \n total_sleep = total_sleep_seconds / 60.0\n deep = deep_sleep_seconds / 60.0\n light = light_sleep_seconds / 60.0\n awake = awake_seconds / 60.0\n \n post_to_twitter = false\n post_to_facebook = false\n \n # FellAsleepAt is formatted: August 23, 2013 at 11:01PM\n # Convert to Runkeeper's preferred format: Sat, 1 Jan 2011 00:00:00\n timestamp_datetime = DateTime.parse(timestamp)\n formatted_timestamp = timestamp_datetime.strftime(\"%a, %d %b %Y %H:%M:%S\")\n \n json_hash['timestamp'] = formatted_timestamp\n json_hash['total_sleep'] = deep\n json_hash['deep'] = deep\n json_hash['light'] = light\n json_hash['awake'] = awake\n json_hash['post_to_twitter'] = post_to_twitter\n json_hash['post_to_facebook'] = post_to_facebook\n \n url = 'https://api.runkeeper.com/sleep'\n \n uri = URI.parse(url)\n \n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri)\n request[\"Authorization\"] = \"Bearer \" + RUNKEEPER_ACCESS_TOKEN\n request[\"Content-Type\"] = \"application/vnd.com.runkeeper.NewSleep+json\"\n request.body = json_hash.to_json\n \n response = http.request(request)\n \n puts response.body\n \n end\n \n @sleep = json_hash\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n \n end", "def create\n @fight = Fight.new(params[:fight])\n\n respond_to do |format|\n if @fight.save\n format.html { redirect_to(@fight, :notice => 'Fight was successfully created.') }\n format.xml { render :xml => @fight, :status => :created, :location => @fight }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fight.errors, :status => :unprocessable_entity }\n end\n end\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 @wine = Wine.new(params[:wine])\n\n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render json: @wine, status: :created, location: @wine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wine = Wine.new(params[:wine])\n\n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render json: @wine, status: :created, location: @wine }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sighting = Sighting.new(params[:sighting])\n\n respond_to do |format|\n if @sighting.save\n format.html { redirect_to \"/static_pages/home\", notice: 'Sighting was successfully created.' }\n format.json { render json: @sighting, status: :created, location: @sighting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sighting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_weight = TestWeight.new(params[:test_weight])\n\n respond_to do |format|\n if @test_weight.save\n format.html { redirect_to @test_weight, notice: 'Test weight was successfully created.' }\n format.json { render json: @test_weight, status: :created, location: @test_weight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_weight.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @won_count = WonCount.new(won_count_params)\n\n respond_to do |format|\n if @won_count.save\n format.html { redirect_to @won_count, notice: 'Won count was successfully created.' }\n format.json { render :show, status: :created, location: @won_count }\n else\n format.html { render :new }\n format.json { render json: @won_count.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @twenty = Twenty.new(twenty_params)\n\n respond_to do |format|\n if @twenty.save\n format.html { redirect_to @twenty, notice: 'Twenty was successfully created.' }\n format.json { render action: 'show', status: :created, location: @twenty }\n else\n format.html { render action: 'new' }\n format.json { render json: @twenty.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wod = Wod.new(wod_params)\n\n if @wod.save\n render json: @wod, status: :created\n else\n render json: @wod.errors, status: :unprocessable_entity\n end\n end", "def create\n @wine = Wine.new(wine_params)\n \n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render :show, status: :created, location: @wine }\n else\n format.html { render :new }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wine = Wine.new(wine_params)\n\n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render :show, status: :created, location: @wine }\n else\n format.html { render :new }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @zombie_sighting = ZombieSighting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zombie_sighting }\n end\n end", "def index\n @sights = Sight.all\n end", "def create\n @zombie_sighting = ZombieSighting.new(lat: params[:lat],\n lng: params[:lng])\n\n respond_to do |format|\n if @zombie_sighting.save\n format.html { redirect_to action: \"index\", notice: 'Zombie sighting was successfully created.' }\n format.json { render json: @zombie_sighting, status: :created, location: @zombie_sighting }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zombie_sighting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @hot_water_demand = HotWaterDemand.new(params[:hot_water_demand])\n\n respond_to do |format|\n if @hot_water_demand.save\n format.html { redirect_to @hot_water_demand, notice: 'Hot water demand was successfully created.' }\n format.json { render json: @hot_water_demand, status: :created, location: @hot_water_demand }\n else\n format.html { render action: \"new\" }\n format.json { render json: @hot_water_demand.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @witness = Witness.new(params[:witness])\n\n respond_to do |format|\n if @witness.save\n #format.html { redirect_to action: \"index\" }\n format.json { render json: @witness, status: :created, location: @witness }\n else\n #format.html { render action: \"new\" }\n format.json { render json: @witness.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wine = Wine.new(wine_params)\n\n respond_to do |format|\n if @wine.save\n format.html { redirect_to @wine, notice: 'Wine was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wine }\n else\n format.html { render action: 'new' }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @flight = Flight.new(params[:flight])\n\n if @flight.save\n render json: @flight, status: :created, location: @flight\n else\n render json: @flight.errors, status: :unprocessable_entity\n end\n end", "def create\n @night = Night.new(night_params)\n @night.user = current_user\n\n respond_to do |format|\n if @night.save\n format.html { redirect_to root_path, notice: 'Sua noite foi registrada!' }\n format.json { render :show, status: :created, location: root_path }\n else\n format.html { render :new }\n format.json { render json: @night.errors, status: :unprocessable_entity }\n end\n end\n end", "def freight_params\n params.require(:freight).permit(:airport_id, :inspectedon, :carrier, :brmtype_id, :ctnpresented, :ctnreleased, :start_time, :finish_time, :importer, :exporter, :permit, :noncompliance, :avatar, :comment)\n end", "def create\n # @alert_message = \"Meter Maid is around.\"\n @sighting = current_user.sightings.build(sighting_params)\n # @sighting.notify\n respond_to do |format|\n\n # send_message(\"+17049955069\", @alert_message)\n\n if @sighting.save\n\n format.html { redirect_to @sighting, notice: 'Sighting was successfully created.' }\n format.json { render :show, status: :created, location: @sighting }\n\n ################################################################\n @sighting.alert_users(InterestLocation.all)\n \n # users = @sighting.target_users(post_array, locations)\n # @sighting.send_email(users)\n ################################################################\n else\n format.html { render :new }\n format.json { render json: @sighting.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def create\n @wind = Wind.new(wind_params)\n\n respond_to do |format|\n if @wind.save\n format.html { redirect_to @wind, notice: 'Wind was successfully created.' }\n format.json { render :show, status: :created, location: @wind }\n else\n format.html { render :new }\n format.json { render json: @wind.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create\n @sewage_farm = SewageFarm.new(sewage_farm_params)\n\n respond_to do |format|\n if @sewage_farm.save\n format.html { redirect_to @sewage_farm, notice: 'Sewage farm was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sewage_farm }\n else\n format.html { render action: 'new' }\n format.json { render json: @sewage_farm.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end", "def create\n @dow = Dow.new(dow_params)\n\n respond_to do |format|\n if @dow.save\n format.html { redirect_to @dow, notice: 'Dow was successfully created.' }\n format.json { render :show, status: :created, location: @dow }\n else\n format.html { render :new }\n format.json { render json: @dow.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @forest = Forest.new(params[:forest])\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render json: @forest, status: :created, location: @forest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sleep_datum = SleepDatum.new(sleep_datum_params)\n\n respond_to do |format|\n if @sleep_datum.save\n format.html { redirect_to @sleep_datum, notice: 'Sleep datum was successfully created.' }\n format.json { render :show, status: :created, location: @sleep_datum }\n else\n format.html { render :new }\n format.json { render json: @sleep_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @flaws = Flaw.order(\"date DESC, created_at DESC\").page( params[:page] ).per(10)\n \n @flaw = Flaw.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @flaws }\n end\n end", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "def create\n @wizytum = Wizytum.new(wizytum_params)\n\n respond_to do |format|\n if @wizytum.save\n format.html { redirect_to @wizytum, notice: 'Wizytum was successfully created.' }\n format.json { render :show, status: :created, location: @wizytum }\n else\n format.html { render :new }\n format.json { render json: @wizytum.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @fight = Fight.new\n @fighters = Fighter.order('first_name desc')\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fight }\n end\n end", "def create\n dive = Dive.new(dive_params)\n if dive.save\n render json: dive\n else\n render json: {message: dive.errors}, status: 400\n end\n end", "def create\n @weight = Weight.new(weight_params)\n @tournament = Tournament.find(weight_params[:tournament_id])\n respond_to do |format|\n if @weight.save\n format.html { redirect_to @tournament, notice: 'Weight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @weight }\n else\n format.html { render action: 'new' }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end", "def sightings\n evaluate! if @sightings.nil?\n\n return JSON.dump(@sightings)\n end", "def create(params)\n post_url = url\n LightspeedCall.make('POST') { HTTParty.post(post_url, body: params.to_json, headers: {Authorization: \"Bearer #{LightspeedApi::OauthGrant.token}\", 'Accept' => 'application/json', 'Content-Type' => 'application/json' }) }\n end", "def create\n @filament_count = FilamentCount.new(filament_count_params)\n\n respond_to do |format|\n if @filament_count.save\n format.html { redirect_to @filament_count, notice: 'Filament count was successfully created.' }\n format.json { render :show, status: :created, location: @filament_count }\n else\n format.html { render :new }\n format.json { render json: @filament_count.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @freight_bill = FreightBill.new(freight_bill_params)\n\n respond_to do |format|\n if @freight_bill.save\n format.html { redirect_to @freight_bill, notice: 'Freight bill was successfully created.' }\n format.json { render :show, status: :created, location: @freight_bill }\n else\n format.html { render :new }\n format.json { render json: @freight_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dinner = Dinner.new(dinner_params)\n @dinner.host_id = @current_user.json_hash[:id]\n if @dinner.valid?\n @dinner.save\n render json: @dinner.all_info\n else\n puts @dinner.errors.messages.inspect\n render status: :bad_request, json: {\n errors: @dinner.errors.messages\n }\n end\n end", "def create\n @weigh_in = WeighIn.new(weigh_in_params)\n\n respond_to do |format|\n if @weigh_in.save\n format.html { redirect_to @weigh_in, notice: 'Weigh in was successfully created.' }\n format.json { render :show, status: :created, location: @weigh_in }\n else\n format.html { render :new }\n format.json { render json: @weigh_in.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @datebodydatum = Datebodydatum.new(datebodydatum_params)\n @datebodydatum.weight = @datebodydatum.weight.round(1)\n respond_to do |format|\n if @datebodydatum.save\n format.html { redirect_to datebodydatum_url(@datebodydatum, :date_search => params[:date_search]), notice: 'Datebodydatum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @datebodydatum }\n else\n format.html { render action: 'new' }\n format.json { render json: @datebodydatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wrestler = Wrestler.new(wrestler_params)\n @school = School.find(wrestler_params[:school_id])\n @weights = @school.tournament.weights\n respond_to do |format|\n if @wrestler.save\n if session[:return_path]\n format.html { redirect_to session.delete(:return_path), notice: 'Wrestler was successfully created.' }\n else\n format.html { redirect_to @school, notice: 'Wrestler was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wrestler }\n end\n else\n format.html { render action: 'new' }\n format.json { render json: @wrestler.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n party = []\n (1..6).each do |p_number|\n level = params[:dungeon_instance][\"hero#{p_number}_level\"].to_i\n party << level if level > 0\n end\n\n dungeon = Dungeon.new\n dungeon.generate( params[:dungeon_instance][:size].to_i, party,\n encounters_difficulty: params[:dungeon_instance][:difficulty].to_sym )\n # p dungeon.to_json\n\n @dungeon_instance = DungeonInstance.new( dungeon_instance_params.merge( dungeon_data: dungeon.to_json ) )\n\n respond_to do |format|\n if current_user.dungeon_instances << @dungeon_instance\n format.html { redirect_to dungeon_instance_play_path( @dungeon_instance ), notice: 'Dungeon instance was successfully created.' }\n else\n format.html { redirect_to dungeon_instances_path, error: 'Dungeon instance was successfully created.' }\n end\n end\n end", "def index\n @sightings = Sighting.where(date: params[:start_date]..params[:end_date])\n render json: @sightings\n end", "def create\n @weight = Weight.new(weight_params)\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to @weight, notice: 'Weight was successfully created.' }\n format.json { render :show, status: :created, location: @weight }\n else\n format.html { render :new }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end", "def scheduled_fights_scraper\n BoxingSchedules::Scraper.scrape_scheduled_fights\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 @weight = current_user.weights.new(params[:weight])\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to weight_path(@weight), notice: 'Weight was successfully created.' }\n format.json { render json: @weight, status: :created, location: @weight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @witness_salon = WitnessSalon.new(witness_salon_params)\n\n respond_to do |format|\n if @witness_salon.save\n format.html { redirect_to @witness_salon, notice: 'Witness salon was successfully created.' }\n format.json { render :show, status: :created, location: @witness_salon }\n else\n format.html { render :new }\n format.json { render json: @witness_salon.errors, status: :unprocessable_entity }\n end\n end\n end", "def msau\n render json: get_msau(@visits)\n end", "def create\n @freind = Freind.new(freind_params)\n\n respond_to do |format|\n if @freind.save\n format.html { redirect_to @freind, notice: \"Freind was successfully created.\" }\n format.json { render :show, status: :created, location: @freind }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @freind.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_billedhistories(to_hash)\n end", "def index\n @deadlift_data_points = DeadliftDataPoint.where(\"user_id = '#{current_user.id}'\")\n @max_deadlift = (@deadlift_data_points.map {|point| point['weight']}).max || 0\n @last_max_deadlift = (@deadlift_data_points == []) ? 0 : @deadlift_data_points.last['weight']\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deadlift_data_points }\n end\n end", "def create\n @flower = Flower.new(params[:flower])\n\n respond_to do |format|\n if @flower.save\n format.html { redirect_to @flower, notice: 'Flower was successfully created.' }\n format.json { render json: @flower, status: :created, location: @flower }\n else\n format.html { render action: \"new\" }\n format.json { render json: @flower.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @buddyfight = Buddyfight.new(buddyfight_params)\n\n respond_to do |format|\n if @buddyfight.save\n format.html { redirect_to @buddyfight, notice: 'Buddyfight was successfully created.' }\n format.json { render :show, status: :created, location: @buddyfight }\n else\n format.html { render :new }\n format.json { render json: @buddyfight.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mood_datum = MoodDatum.new(mood_datum_params)\n \n respond_to do |format|\n if @mood_datum.save \n params['significant_events'].each do |key,value| \n PatientSignificantEvent.create(:patient_id =>@mood_datum.user_id ,:doctor_id => @mood_datum.doctor_id ,:mood_data_id =>@mood_datum.id ,:comments => value )\n end \n format.html { redirect_to new_mood_datum_path(:patient => current_user.id), notice: 'Mood datum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mood_datum }\n else\n format.html { render action: 'new' }\n format.json { render json: @mood_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if user_signed_in?\n else\n redirect_to root_path\n end\n @weight = Weight.new(weight_params)\n @tournament = Tournament.find(weight_params[:tournament_id])\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to @tournament, notice: 'Weight was successfully created.' }\n format.json { render action: 'show', status: :created, location: @weight }\n else\n format.html { render action: 'new' }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @showdown = Showdown.new(showdown_params)\n if params.has_key?(:contestant)\n contestants = []\n params[:contestant].each_with_index do |contestant, index|\n if Contestant.where(name: contestant).count > 0\n contestants << Contestant.where(name: contestant).first\n else\n contestant = Contestant.create(name: contestant)\n contestant.portrait_url = JSON.parse(params[\"portrait#{index + 1}\"])[0]['url']\n if contestant.save\n contestants << contestant\n end\n end\n end\n if params.has_key?(:stats)\n params[:stats].each do |index, stat_row|\n stat = Stat.create(showdown: @showdown, description: stat_row[:description])\n ContestantStat.create(stat: stat, value: stat_row[:contestant1], contestant: contestants.first)\n ContestantStat.create(stat: stat, value: stat_row[:contestant2], contestant: contestants.last)\n end\n end\n @showdown.contestants = contestants\n end\n\n respond_to do |format|\n if @showdown.save\n format.html { redirect_to @showdown, notice: 'Showdown was successfully created.' }\n format.json { render :show, status: :created, location: @showdown }\n else\n format.html { render :new }\n format.json { render json: @showdown.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@fighter = Fighter.new(fighter_params)\n \n # create fighter under the curent users fighters - we may want to undo this\n # for the future so they we can display a list of all the fighters\n @fighter = current_user.fighters.build(fighter_params)\n\n\n respond_to do |format|\n if @fighter.save\n format.html { redirect_to @fighter, notice: \"Fighter was successfully created.\" }\n format.json { render :show, status: :created, location: @fighter }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fighter.errors, status: :unprocessable_entity }\n end\n end\n end", "def sight_params\n params.require(:sight).permit(:name, :image, :details, :likes, :state_id)\n end", "def create\n @friday = Friday.new(friday_params)\n\n respond_to do |format|\n if @friday.save\n format.html { redirect_to @friday, notice: \"Friday was successfully created.\" }\n format.json { render :show, status: :created, location: @friday }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @friday.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @days_since_visit = DaysSinceVisit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @days_since_visit }\n end\n end", "def create\n @wedding = Wedding.new(params[:wedding])\n\n respond_to do |format|\n if @wedding.save\n format.html { redirect_to inhabitants_path }\n format.json { render inhabitants_path }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wedding.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @eaten = Eaten.new(eaten_params)\n\n respond_to do |format|\n if @eaten.save\n format.html { redirect_to @eaten, notice: 'Eaten was successfully created.' }\n format.json { render :show, status: :created, location: @eaten }\n else\n format.html { render :new }\n format.json { render json: @eaten.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @forest = Forest.new(forest_params)\n\n respond_to do |format|\n if @forest.save\n format.html { redirect_to @forest, notice: 'Forest was successfully created.' }\n format.json { render action: 'show', status: :created, location: @forest }\n else\n format.html { render action: 'new' }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kf_diary = Kf::Diary.new(params[:kf_diary])\n\n respond_to do |format|\n if @kf_diary.save\n format.html { redirect_to kf_diaries_url({:page => params[:page]}), notice: 'Diary was successfully created.' }\n format.json { render json: @kf_diary, status: :created, location: @kf_diary }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_diary.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @skydatum = Skydatum.new(params[:skydatum])\n\n respond_to do |format|\n if @skydatum.save\n format.html { redirect_to @skydatum, notice: 'Skydatum was successfully created.' }\n format.json { render json: @skydatum, status: :created, location: @skydatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @skydatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def number_of_fights\n BoxingSchedules::Fight.all\n end", "def create\n @wellist = Wellist.new(wellist_params)\n\n if @wellist.save\n render json: @wellist, status: :created, location: @wellist\n else\n render json: @wellist.errors, status: :unprocessable_entity\n end\n end", "def create\n @flightstat = Flightstat.new(flightstat_params)\n\n respond_to do |format|\n if @flightstat.save\n format.html { redirect_to @flightstat, notice: 'Flightstat was successfully created.' }\n format.json { render :show, status: :created, location: @flightstat }\n else\n format.html { render :new }\n format.json { render json: @flightstat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end", "def create\n @bathroom = Bathroom.new(bathroom_params.except(:stalls))\n num_stalls = bathroom_params[:stalls].to_i\n\n respond_to do |format|\n if @bathroom.save\n (0..(num_stalls - 1)).each do |i|\n Stall.new({ bathroom_id: @bathroom.id, state: false, number: @bathroom.stalls.count }).save\n end\n format.html { redirect_to @bathroom, notice: 'Bathroom was successfully created.' }\n format.json { render :show, status: :created, location: @bathroom }\n else\n format.html { render :new }\n format.json { render json: @bathroom.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n \n #timestamp={{FellAsleepAt}}&total_sleep={{TotalTimeSleptInSeconds}}&deep={{TimeInDeepSleepSeconds}}&light={{TimeInLightSleepSeconds}}&awake={{TimeAwakeSeconds}}\n \n json_hash = Hash.new\n \n @sleep = json_hash\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sleep }\n end\n end", "def create\n @flat_happening = FlatHappening.where(:namespaced_id => params[:flat_happening][:namespaced_id]).first_or_initialize(params[:flat_happening])\n # @happening = Happening.where(:source => params[:happening][:source], :meta => params[:happening][:meta]).first_or_initialize(create_params)\n\n if @flat_happening.save\n render json: @flat_happening, status: :created\n # , location: @flat_happening\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end", "def create\n @weight = current_user.weights.new(params[:weight])\n\n respond_to do |format|\n if @weight.save\n format.html { redirect_to body_weight_path(@weight), notice: 'Weight was successfully created.' }\n format.json { render json: @weight, status: :created, location: @weight }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @weight_trainning = WeightTrainning.new(weight_trainning_params)\n\n respond_to do |format|\n if @weight_trainning.save\n format.html { redirect_to @weight_trainning, notice: 'Weight trainning was successfully created.' }\n format.json { render action: 'show', status: :created, location: @weight_trainning }\n else\n format.html { render action: 'new' }\n format.json { render json: @weight_trainning.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @weight_point = WeightPoint.new(weight: params[:weight_point][:weight], date: Date.strptime(params[:weight_point][:date], \"%m/%d/%Y\"))\n @weight_point.user_id = current_user.id\n\n respond_to do |format|\n if @weight_point.save\n flash[:success] = 'Weight point was successfully created.' \n format.html { redirect_to action:\"index\" }\n format.json { render action: 'show', status: :created, location: @weight_point }\n else\n format.html { render action: 'new' }\n format.json { render json: @weight_point.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n waiver_picks_decorator = WaiverPicksDecorator.new(\n @fpl_team.waiver_picks.where(round_id: (params[:round_id] || Round.current_round.id))\n )\n\n render json: { waiver_picks: waiver_picks_decorator.all_data }\n end" ]
[ "0.6211402", "0.5950801", "0.5901964", "0.5782905", "0.5782905", "0.57813686", "0.57232535", "0.56772625", "0.55970687", "0.55663216", "0.55048555", "0.54854095", "0.5468592", "0.5458998", "0.5438364", "0.54374874", "0.5434274", "0.5370728", "0.5363863", "0.5355054", "0.52754617", "0.5273391", "0.5233707", "0.5233707", "0.5227517", "0.5216002", "0.5201367", "0.5193972", "0.51755977", "0.5172808", "0.51529396", "0.5152867", "0.51516616", "0.51493496", "0.51483035", "0.51320547", "0.51319504", "0.5130562", "0.51279", "0.5126919", "0.5116608", "0.5114831", "0.511354", "0.5107559", "0.5090983", "0.5088225", "0.50864136", "0.508634", "0.50852937", "0.50816345", "0.5076423", "0.50723636", "0.5066163", "0.50635546", "0.50546765", "0.50545466", "0.5053558", "0.5052549", "0.5050527", "0.50482744", "0.5044734", "0.5038622", "0.5031672", "0.5027744", "0.5021812", "0.50179005", "0.5016158", "0.50154775", "0.50114626", "0.5010533", "0.50095093", "0.5000182", "0.4998515", "0.49915972", "0.49888718", "0.49875858", "0.49816102", "0.49778336", "0.49756262", "0.49727896", "0.49725896", "0.49724504", "0.49714082", "0.49697983", "0.4964945", "0.49619696", "0.49572557", "0.49430573", "0.4942368", "0.49390307", "0.49379143", "0.49378031", "0.4930129", "0.49289367", "0.4926671", "0.4924399", "0.49242836", "0.49140793", "0.49127683" ]
0.5726397
7
PUT /fights/1 PUT /fights/1.json
def update @fight = Fight.find(params[:id]) secret = '9f8urg90$u3#92u8rh_gu(rfhi8rj*fih' begin client = SocketIO.connect("http://localhost:8190") do after_start do obj = { :secret => secret, :action => 'fight', :info => { :status => 'changed' } } emit("tournament-ruby", obj) disconnect end end rescue end respond_to do |format| if @fight.update_attributes(params[:fight]) format.html { redirect_to @fight, notice: 'Fight was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @fight.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @night.update(night_params)\n format.html { redirect_to @night, notice: 'Night was successfully updated.' }\n format.json { render :show, status: :ok, location: @night }\n else\n format.html { render :edit }\n format.json { render json: @night.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wing.update(wing_params)\n @wing.floors.each { |f| f.touch }\n format.html { redirect_to @wing, notice: t('.update_ok', item: @wing.name) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sight.update(sight_params)\n format.html { redirect_to @sight, notice: 'Sight was successfully updated.' }\n format.json { render :show, status: :ok, location: @sight }\n else\n format.html { render :edit }\n format.json { render json: @sight.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sight.update(sight_params)\n format.html { redirect_to @sight, notice: 'Sight was successfully updated.' }\n format.json { render :show, status: :ok, location: @sight }\n else\n format.html { render :edit }\n format.json { render json: @sight.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fight = Fight.find(params[:id])\n\n respond_to do |format|\n if @fight.update_attributes(params[:fight])\n format.html { redirect_to @fight, notice: 'Fight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fight.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @sighting.update(sighting_params)\n render json: @sighting, status: :ok, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def update\n @zombie_sighting = ZombieSighting.find(params[:id])\n\n respond_to do |format|\n if @zombie_sighting.update_attributes(params[:zombie_sighting])\n format.html { redirect_to @zombie_sighting, notice: 'Zombie sighting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @zombie_sighting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n woof = Woof.find params[:id]\n woof.update woof_params\n redirect_to root_path\n end", "def update\n @flight = Flight.find(params[:id])\n\n if @flight.update(params[:flight])\n head :no_content\n else\n render json: @flight.errors, status: :unprocessable_entity\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 update\n @flower = Flower.find(params[:id])\n\n respond_to do |format|\n if @flower.update_attributes(params[:flower])\n format.html { redirect_to @flower, notice: 'Flower was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @flat_happening = FlatHappening.find(params[:id])\n\n if @flat_happening.update_attributes(params[:flat_happening])\n head :no_content\n else\n render json: @flat_happening.errors, status: :unprocessable_entity\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'FOAF was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @foaf.interests.clear\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n #@foaf.update(Interest.find(i))\n end\n \n end\n\n respond_to do |format|\n if @foaf.update(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n format.html { redirect_to @foaf, notice: 'Foaf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @sighting.update(sighting_params)\n render json: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def update\n @story = Story.find(params[:id])\n @story.update_attributes(params[:story])\n respond_with @story\n end", "def update\n @forest = Forest.find(params[:id])\n\n respond_to do |format|\n if @forest.update_attributes(params[:forest])\n format.html { redirect_to @forest, notice: 'Forest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def update\n respond_to do |format|\n if @story.update(story_params)\n format.json { render json: @story, root: false, status: :ok, location: @story }\n else\n format.json { render json: @story.errors, root: false, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sighting = Sighting.find(params[:id])\n\n respond_to do |format|\n if @sighting.update_attributes(params[:sighting])\n format.html { redirect_to @sighting, notice: 'Sighting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sighting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fight = Fight.find(params[:id])\n\n respond_to do |format|\n if @fight.update_attributes(params[:fight])\n format.html { redirect_to(@fight, :notice => 'Fight was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fight.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wine = Wine.find(params[:id])\n\n respond_to do |format|\n if @wine.update_attributes(params[:wine])\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wfeat.update(wfeat_params)\n format.html { redirect_to @wfeat, notice: 'Wfeat was successfully updated.' }\n format.json { render :show, status: :ok, location: @wfeat }\n else\n format.html { render :edit }\n format.json { render json: @wfeat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fridge = Fridge.find(params[:id])\n\n respond_to do |format|\n if @fridge.update_attributes(params[:fridge])\n format.html { redirect_to @fridge, notice: 'Fridge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fridge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wine = Wine.find(params[:id])\n\n respond_to do |format|\n if @wine.update_attributes(params[:wine])\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n sighting = Sighting.find(params[:id])\n sighting.update(sighting_params)\n \n # if sighting was valid and found then return the json\n if sighting.valid?\n render json: sighting\n else\n render json: sighting.errors\n end\n end", "def update\n @feat = @person.feats.find(params[:id])\n level_old = @person.level\n\n if params[:feat][:completed] == '1'\n @feat.complete\n else\n @feat.uncomplete\n end\n sign = params[:feat][:completed] == '1' ? '+': '-'\n \n has_leveled = @person.level > level_old\n\n respond_to do |format|\n format.json { render :json => {\n :xpGained => \"#{sign}#{@feat.xp}\",\n :xpTotal => @person.xp,\n :next_level_ratio => @person.next_level_ratio,\n :extra_life => @person.level_to_string,\n :has_leveled => has_leveled,\n :completed => @feat.completed,\n :streak => @feat.calculate_streak}}\n \n end\n\n end", "def update\n @star_war = StarWar.find(params[:id])\n @star_war.update!(wins: @star_war.wins + 1)\n redirect_to fights_path\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 begin\n Twitter.user_timeline(params[:foodtruck][:handle])\n foodtruck = Foodtruck.find(params[:id])\n foodtruck.update_attributes(params[:foodtruck])\n redirect_to '/foodtrucks'\n rescue\n redirect_to \"/foodtrucks/#{params[:id]}\"\n end\n end", "def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end", "def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end", "def update\n @dice = Dice.find(params[:id])\n\n if @dice.update(dice_params)\n head :no_content\n else\n render json: @dice.errors, status: :unprocessable_entity\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 @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @farm = Farm.find(params[:id])\n\n respond_to do |format|\n if @farm.update_attributes(params[:farm])\n format.html { redirect_to @farm, notice: 'Farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @farm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @flower.update(flower_params)\n format.html { redirect_to @flower, notice: 'Flower was successfully updated.' }\n format.json { render :show, status: :ok, location: @flower }\n else\n format.html { render :edit }\n format.json { render json: @flower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @flower.update(flower_params)\n format.html { redirect_to @flower, notice: 'Flower was successfully updated.' }\n format.json { render :show, status: :ok, location: @flower }\n else\n format.html { render :edit }\n format.json { render json: @flower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stinsfo.update(stinsfo_params)\n format.html { redirect_to @stinsfo, notice: 'Stinsfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @stinsfo }\n else\n format.html { render :edit }\n format.json { render json: @stinsfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sewage_farm.update(sewage_farm_params)\n format.html { redirect_to @sewage_farm, notice: 'Sewage farm was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sewage_farm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def update\n respond_to do |format|\n if @fight.update(fight_params)\n format.html { redirect_to @fight, notice: 'Fight was successfully updated.' }\n format.json { render :show, status: :ok, location: @fight }\n else\n format.html { render :edit }\n format.json { render json: @fight.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_api_v1_sighting\n @api_v1_sighting = Api::V1::Sighting.find(params[:id])\n end", "def update\n respond_to do |format|\n if @house.update(factor_params)\n format.html { redirect_to @house, notice: 'Factor was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @house.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @farm.update(farm_params)\n render :show, status: :ok, location: api_farm_url(@farm)\n else\n render json: @farm.errors, status: :unprocessable_entity\n end\n end", "def update\n @nightclub = Nightclub.find(params[:id])\n\n respond_to do |format|\n if @nightclub.update_attributes(params[:nightclub])\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shelf.update(shelf_params)\n format.html { redirect_to house_shelves_path(params[:house_id]), notice: 'Shelf was successfully created.' } \n format.json { render :show, status: :ok, location: @shelf }\n else\n format.html { render :edit }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @twenty.update(twenty_params)\n format.html { redirect_to @twenty, notice: 'Twenty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @twenty.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 update\n @therapist = Therapist.find(params[:id])\n\n respond_to do |format|\n if @therapist.update_attributes(params[:therapist])\n format.html { redirect_to @therapist, notice: 'Therapist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @therapist.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stoff.update(stoff_params)\n format.html { redirect_to @stoff }\n format.json { render :show, status: :ok, location: @stoff }\n else\n format.html { render :edit }\n format.json { render json: @stoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @hot_water_demand = HotWaterDemand.find(params[:id])\n\n respond_to do |format|\n if @hot_water_demand.update_attributes(params[:hot_water_demand])\n format.html { redirect_to @hot_water_demand, notice: 'Hot water demand was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hot_water_demand.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 update\n put :update\n end", "def update\n @metric = Metric.find(params[:id])\n\n if @metric.update(params[:metric])\n head :no_content\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @forest.update(forest_params)\n format.html { redirect_to @forest, notice: 'Forest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @forest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n if @flight.update_attributes(params[:flight])\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n check_current_user\n\n normalize_wine_data\n\n respond_to do |format|\n if @wine.update(wine_params)\n format.html { redirect_to root_path }\n format.json { render :show, status: :ok, location: @wine }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @flight = Flight.find(params[:id])\n\n respond_to do |format|\n if @flight.update_attributes(params[:flight])\n format.html { redirect_to @flight, notice: 'Flight was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flight.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n \n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Zmiany zostały zapisane.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wine.update(wine_params)\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @snowfall.update(snowfall_params)\n format.html { redirect_to @snowfall, notice: 'Snowfall was successfully updated.' }\n format.json { render :show, status: :ok, location: @snowfall }\n else\n format.html { render :edit }\n format.json { render json: @snowfall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stalkee.update(stalkee_params)\n format.html { redirect_to @stalkee, notice: 'Stalkee was successfully updated.' }\n format.json { render :show, status: :ok, location: @stalkee }\n else\n format.html { render :edit }\n format.json { render json: @stalkee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n @round = Round.find(params[:id])\n @fight = Fight.find(@round.fight_id)\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @fight, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nightclub.update(nightclub_params)\n format.html { redirect_to @nightclub, notice: 'Nightclub was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nightclub.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @twentyeight.update(twentyeight_params)\n format.html { redirect_to @twentyeight, notice: 'Twentyeight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @twentyeight.errors, status: :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @dow.update(dow_params)\n format.html { redirect_to @dow, notice: 'Dow was successfully updated.' }\n format.json { render :show, status: :ok, location: @dow }\n else\n format.html { render :edit }\n format.json { render json: @dow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def create\n \t@fight = current_user.fights.new(fights_params)\n \t@fight.save\n end", "def update\n @festival = Festival.find(params[:id])\n\n respond_to do |format|\n if @festival.update_attributes(params[:festival])\n format.html { redirect_to @festival, notice: 'Festival was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @festival.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tower = Tower.find(params[:id])\n\n respond_to do |format|\n if @tower.update_attributes(params[:tower])\n format.html { redirect_to @tower, :notice => 'Tower was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tower.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tournament = Tournament.find(@weight.tournament_id)\n respond_to do |format|\n if @weight.update(weight_params)\n format.html { redirect_to @tournament, notice: 'Weight was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @weight.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @thirtyfife.update(thirtyfife_params)\n format.html { redirect_to @thirtyfife, notice: 'Thirtyfive was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @thirtyfife.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n #@story = Story.friendly.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wager = Wager.find(params[:id])\n\n if @wager.update(params[:wager])\n head :no_content\n else\n render json: @wager.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @flaw.update(flaw_params)\n format.html { redirect_to @flaw, notice: 'Flaw was successfully updated.' }\n format.json { render :show, status: :ok, location: @flaw }\n else\n format.html { render :edit }\n format.json { render json: @flaw.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sighting.update(sighting_params)\n format.html { redirect_to @sighting, notice: 'Sighting was successfully updated.' }\n format.json { render :show, status: :ok, location: @sighting }\n else\n format.html { render :edit }\n format.json { render json: @sighting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wine.update(wine_params)\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { render :show, status: :ok, location: @wine }\n else\n format.html { render :edit }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wine.update(wine_params)\n format.html { redirect_to @wine, notice: 'Wine was successfully updated.' }\n format.json { render :show, status: :ok, location: @wine }\n else\n format.html { render :edit }\n format.json { render json: @wine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sour.update(sour_params)\n format.html { redirect_to swits_path, notice: 'sour <3.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @fixture = Fixture.find(params[:id])\n\n\t@fixture.winningteam.points = @fixture.winningteam.points + 3\n\t@fixture.winningteam.save\n respond_to do |format|\n if @fixture.update_attributes(params[:fixture])\n format.html { redirect_to @fixture, notice: 'Fixture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fixture.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wine = Wine.find(params[:id])\n\n if @wine.update_attributes(params[:wine])\n redirect_to @wine, notice: 'Wine was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "def update\n if @story.update(story_params)\n head :no_content\n else\n render json: @story.errors, status: :unprocessable_entity\n end\n end", "def update\n @visit = Visit.find(params[:id])\n\n respond_to do |format|\n if @visit.update_attributes(params[:visit])\n format.json { head :no_content }\n else\n format.json { render json: @visit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @favorite_flyer = FavoriteFlyer.find(params[:id])\n\n respond_to do |format|\n if @favorite_flyer.update_attributes(params[:favorite_flyer])\n format.html { redirect_to @favorite_flyer, notice: 'Favorite flyer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @favorite_flyer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @feature = Feature.find(params[:id])\n\n respond_to do |format|\n if @feature.update_attributes(params[:feature])\n if @feature.is_published\n @feature.create_activity :update, owner: current_user\n end \n format.html { redirect_to(\"/admin\", {notice: 'Feature was successfully updated.'}) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, :notice => 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @story.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @shelf = Shelf.find(params[:id])\n\n respond_to do |format|\n if @shelf.update_attributes(params[:shelf])\n flash[:notice] = 'Shelf was successfully updated.'\n format.html { redirect_to(@shelf) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shelf.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update \n sneaker = find_sneaker\n # update! exceptions will be handled by the rescue_from ActiveRecord::RecordInvalid code\n sneaker.update(sneaker_params)\n render json: sneaker\n end", "def update\n if @wod.update(wod_params)\n render json: @wod\n else\n render json: @wod.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @friday.update(friday_params)\n format.html { redirect_to @friday, notice: \"Friday was successfully updated.\" }\n format.json { render :show, status: :ok, location: @friday }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @friday.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @story = Story.find(params[:id])\n\n respond_to do |format|\n if @story.update_attributes(params[:story])\n format.html { redirect_to @story, notice: 'Story was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @story.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6134244", "0.6085238", "0.6036257", "0.60358", "0.60113335", "0.59941125", "0.5949152", "0.59457344", "0.59446096", "0.594367", "0.592413", "0.5893067", "0.5877779", "0.584548", "0.5828102", "0.580922", "0.57866484", "0.5784725", "0.57731503", "0.5772634", "0.57618284", "0.57306117", "0.57276326", "0.5727559", "0.5721993", "0.5717798", "0.5713816", "0.57001334", "0.56980693", "0.56666446", "0.5660319", "0.5659805", "0.56561106", "0.5649652", "0.5641464", "0.5641464", "0.5641464", "0.5621742", "0.5621742", "0.56129193", "0.5611998", "0.5611414", "0.5607212", "0.56017125", "0.5589796", "0.558867", "0.5580451", "0.5572148", "0.5571051", "0.55628437", "0.5560007", "0.55393404", "0.5532987", "0.5531164", "0.55300486", "0.5529641", "0.5526627", "0.55264956", "0.5520558", "0.55201364", "0.5517093", "0.5513873", "0.55113494", "0.55111593", "0.55108815", "0.55095357", "0.5496277", "0.54897", "0.54856545", "0.5484984", "0.54815096", "0.5480662", "0.54806113", "0.54765874", "0.54729617", "0.54725474", "0.54714155", "0.5470106", "0.5464653", "0.5459885", "0.5458851", "0.5457367", "0.5457367", "0.54552954", "0.54552954", "0.54522747", "0.54450077", "0.5442904", "0.5440797", "0.54403734", "0.5432138", "0.54276925", "0.5418507", "0.5416084", "0.54152095", "0.5410902", "0.54108125", "0.5407912", "0.5405692", "0.5405692" ]
0.5670569
29
DELETE /fights/1 DELETE /fights/1.json
def destroy @fight = Fight.find(params[:id]) @fight.destroy respond_to do |format| format.html { redirect_to fights_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def destroy\n @zombie_sighting = ZombieSighting.find(params[:id])\n @zombie_sighting.destroy\n\n respond_to do |format|\n format.html { redirect_to zombie_sightings_url }\n format.json { head :ok }\n end\n end", "def destroy\n @night.destroy\n respond_to do |format|\n format.html { redirect_to nights_url, notice: 'Night was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def destroy\n @forest = Forest.find(params[:id])\n @forest.destroy\n\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fight = Fight.find(params[:id])\n @fight.destroy\n\n respond_to do |format|\n format.html { redirect_to(fights_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sight.destroy\n respond_to do |format|\n format.html { redirect_to sights_url, notice: 'Sight was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sight.destroy\n respond_to do |format|\n format.html { redirect_to sights_url, notice: 'Sight was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @fight.destroy\n respond_to do |format|\n format.html { redirect_to fights_url, notice: 'Fight was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @forest.destroy\n respond_to do |format|\n format.html { redirect_to forests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end", "def delete_story_version(id)\n @client.raw('delete', \"/content/story-versions/#{id}\")\n end", "def destroy\n @twentyfour.destroy\n respond_to do |format|\n format.html { redirect_to twentyfours_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 @flower = Flower.find(params[:id])\n @flower.destroy\n\n respond_to do |format|\n format.html { redirect_to flowers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @four.destroy\n respond_to do |format|\n format.html { redirect_to fours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :ok }\n end\n end", "def destroy\n @nightclub = Nightclub.find(params[:id])\n @nightclub.destroy\n\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @thirtyeight.destroy\n respond_to do |format|\n format.html { redirect_to thirtyeights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thirtyfife.destroy\n respond_to do |format|\n format.html { redirect_to thirtyfives_url }\n format.json { head :no_content }\n end\n end", "def DeleteView id\n \n APICall(path: \"views/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @twentyeight.destroy\n respond_to do |format|\n format.html { redirect_to twentyeights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @therapist = Therapist.find(params[:id])\n @therapist.destroy\n\n respond_to do |format|\n format.html { redirect_to therapists_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 delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @fridge = Fridge.find(params[:id])\n @fridge.destroy\n\n respond_to do |format|\n format.html { redirect_to fridges_url }\n format.json { head :no_content }\n end\n end", "def delete() #DELETE film1.delete (removes 1 film)\n sql = \"DELETE FROM films WHERE id = $1;\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "def destroy\n @dow.destroy\n respond_to do |format|\n format.html { redirect_to dows_url, notice: 'Dow was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @story.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @hot_water_demand = HotWaterDemand.find(params[:id])\n @hot_water_demand.destroy\n\n respond_to do |format|\n format.html { redirect_to hot_water_demands_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @weather = Weather.find(params[:id])\n @weather.destroy\n\n respond_to do |format|\n format.html { redirect_to weathers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @weather = Weather.find(params[:id])\n @weather.destroy\n\n respond_to do |format|\n format.html { redirect_to weathers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @weather = Weather.find(params[:id])\n @weather.destroy\n\n respond_to do |format|\n format.html { redirect_to weathers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wine = Wine.find(params[:id])\n @wine.destroy\n\n respond_to do |format|\n format.html { redirect_to wines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sighting = Sighting.find(params[:id])\n @sighting.destroy\n\n respond_to do |format|\n format.html { redirect_to sightings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wine.destroy\n respond_to do |format|\n format.html { redirect_to wines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wine.destroy\n respond_to do |format|\n format.html { redirect_to wines_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wine = Wine.find(params[:id])\n @wine.destroy\n\n respond_to do |format|\n format.html { redirect_to wines_url }\n format.json { head :ok }\n end\n end", "def destroy\n @flight = Flight.find(params[:id])\n @flight.destroy\n\n head :no_content\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @tdwg_level_four.destroy\n respond_to do |format|\n format.html { redirect_to tdwg_level_fours_url }\n format.json { head :no_content }\n end\n end", "def delete_story(id)\n @client.raw('delete', \"/content/stories/#{id}\")\n end", "def destroy\n @monkey = Monkey.find(params[:id])\n @monkey.destroy\n\n respond_to do |format|\n format.html { redirect_to monkeys_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @festival = Festival.find(params[:id])\n @festival.destroy\n\n respond_to do |format|\n format.html { redirect_to festivals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @twenty.destroy\n respond_to do |format|\n format.html { redirect_to twenties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_weight = TestWeight.find(params[:id])\n @test_weight.destroy\n\n respond_to do |format|\n format.html { redirect_to test_weights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @floor = Floor.find(params[:id])\n @floor.destroy\n\n respond_to do |format|\n format.html { redirect_to floors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @skydatum = Skydatum.find(params[:id])\n @skydatum.destroy\n\n respond_to do |format|\n format.html { redirect_to skydata_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flat_happening = FlatHappening.find(params[:id])\n @flat_happening.destroy\n\n head :no_content\n end", "def destroy\n @wash = Wash.find(params[:id])\n @wash.destroy\n\n respond_to do |format|\n format.html { redirect_to washes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @father = Father.find(params[:id])\n @father.destroy\n\n respond_to do |format|\n format.html { redirect_to fathers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @datashows = Datashow.find(params[:id])\n @datashows.destroy\n\n respond_to do |format|\n format.html { redirect_to(datashows_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flight.destroy\n respond_to do |format|\n format.html { redirect_to flights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @floor.destroy\n respond_to do |format|\n format.html { redirect_to floors_url, notice: I18n.t('floors.destroy') }\n format.json { head :no_content }\n end\n end", "def destroy\n @wfeat.destroy\n respond_to do |format|\n format.html { redirect_to wfeats_url, notice: 'Wfeat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fire = Fire.find(params[:id])\n @fire.destroy\n\n respond_to do |format|\n format.html { redirect_to fires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @traffic = Traffic.find(params[:id])\n @traffic.destroy\n\n respond_to do |format|\n format.html { redirect_to traffics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hoge = Hoge.find(params[:id])\n @hoge.destroy\n\n respond_to do |format|\n format.html { redirect_to hoges_url }\n format.json { head :ok }\n end\n end", "def destroy\n @fixturestat = Fixturestat.find(params[:id])\n @fixturestat.destroy\n\n respond_to do |format|\n format.html { redirect_to fixturestats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daylight = Daylight.find(params[:id])\n @daylight.destroy\n\n respond_to do |format|\n format.html { redirect_to daylights_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @stay_night.destroy\n respond_to do |format|\n format.html { redirect_to stay_nights_url }\n format.json { head :no_content }\n format.js\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medium_trial = MediumTrial.find(params[:id])\n @medium_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_trials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @monster = Monster.find(params[:id])\n @monster.destroy\n\n respond_to do |format|\n format.html { redirect_to monsters_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 @foodlog = Foodlog.find(params[:id])\n @foodlog.destroy\n\n respond_to do |format|\n format.html { redirect_to foodlogs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @feat = @person.feats.find(params[:id])\n @feat.destroy\n\n respond_to do |format|\n format.html { redirect_to(person_feats_url(@person)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\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 destroy\n @flaw = Flaw.find(params[:id])\n @flaw.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_flaws_url }\n format.json { head :no_content }\n end\n end", "def delete\n api_client.delete(url)\n end", "def destroy\n @moonwalk.destroy\n respond_to do |format|\n format.html { redirect_to moonwalks_url }\n format.json { head :no_content }\n end\n end", "def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end", "def destroy\n @witness = Witness.find(params[:id])\n @witness.destroy\n render :json => { success: true, witness: @witness }\n end", "def destroy\n @house = House.find(params[:id])\n @house.destroy\n\n respond_to do |format|\n format.html { redirect_to gigs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fourteen.destroy\n respond_to do |format|\n format.html { redirect_to fourteens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @flightstat.destroy\n respond_to do |format|\n format.html { redirect_to flightstats_url, notice: 'Flightstat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @yourstory = Yourstory.find(params[:id])\n @yourstory.destroy\n\n respond_to do |format|\n format.html { redirect_to yourstories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cow.destroy\n respond_to do |format|\n format.html { redirect_to kine_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @thermostat.destroy\n respond_to do |format|\n format.html { redirect_to thermostats_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.67872876", "0.663105", "0.66075027", "0.6560254", "0.655833", "0.6547218", "0.6525059", "0.647082", "0.647082", "0.64679986", "0.6448931", "0.64354324", "0.6430899", "0.63960874", "0.6367838", "0.6362299", "0.6353046", "0.63466626", "0.6343381", "0.6334513", "0.63334584", "0.63289607", "0.63196206", "0.6308018", "0.6305342", "0.63035214", "0.6296651", "0.62889117", "0.62873816", "0.62847143", "0.6279058", "0.6278662", "0.6270637", "0.6255901", "0.6255451", "0.62534857", "0.62534857", "0.62534857", "0.62525153", "0.62503356", "0.6248537", "0.6248537", "0.62453324", "0.62411386", "0.6240594", "0.62387604", "0.6238445", "0.6238372", "0.6233137", "0.62316024", "0.6228611", "0.6228187", "0.62279725", "0.62270385", "0.62253916", "0.62225497", "0.62185305", "0.6216349", "0.6216349", "0.6216349", "0.62113637", "0.62088", "0.62061787", "0.6200333", "0.6195383", "0.6194581", "0.6188186", "0.6187333", "0.6186743", "0.6186743", "0.6178322", "0.61746806", "0.6172894", "0.61716247", "0.6159279", "0.6157519", "0.61567086", "0.6152948", "0.6152933", "0.61523676", "0.6151991", "0.6151393", "0.61503494", "0.6144892", "0.6143145", "0.613855", "0.6137243", "0.6136416", "0.61354893", "0.61346895", "0.6133575", "0.61335325", "0.6132216", "0.6132216", "0.6132216", "0.6132216", "0.61289287", "0.6128117", "0.6126841" ]
0.67727333
2
has_many :toppings has_many :ingredients
def name object.pizza.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ingredients\n RecipeIngrediant.all.select do |recing|\n recing.recipe == self\n end\n #map to ing\n\n end", "def recipe_ingredients\n RecipeIngredient.all.select{|ingredient| ingredient.recipe == self}\n end", "def ingredients\n recipes = RecipeIngredient.all.select { |recipeing| recipeing.recipe == self}\n recipes.collect {|recipeing| recipeing.ingredient}\n end", "def ingredients\n recipe_ingredients.map {|recipe_ingredient| recipe_ingredient.ing}\n end", "def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end", "def ingredients\n RecipeIngredient.all.select { |ri| ri.recipe == self }.map { |ri| ri.ingredient }\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |ri|\n ri.recipe == self\n end\n end", "def ingredients\n recipe_ingredients.map do |r|\n r.ingredient\n end\n end", "def ingredients\n Ingredient.all.select do |ingredient_instance|\n ingredient_instance.makes == self\n end\n end", "def ingredient_related_product(ingredient)\n @products = Productitem.where(:ingredient_id => ingredient.id).map {|x| [x.product_id]}\n @products = @products.uniq\n end", "def recipe_ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end\n end", "def ingredients\n recipeingredient.map {|ri| ri.ingredient}\n end", "def ingredients\n # self.recipe_ingredients\n recipe_ingredients.map do |r_i|\n r_i.ingredient\n end\n end", "def ingredients\n RecipeIngredient.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "def add_ingredients(ingredients)\n RecipeIngredient.new(ingredients, self)\nend", "def ingredients_association(salad)\n IngredientsAssociation.find_by(salad_id: salad.id, ingredient_id: self.id)\n end", "def ingredients\n RecipeIngredient.all.map do |reci_ingred|\n reci_ingred.ingredient_O if reci_ingred.recipe_O == self\n end.compact\n end", "def create\n @ingredient = Ingredient.new(ingredient_params)\n @ingredient.recipe = Recipe.find(ingredient_params[:recipe])\n @ingredient.recipe.ingredients << @ingredient\n save_relations\n \n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully added.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def ingredient_recipes\n self.doses.map { |d| d.recipe }.uniq\n end", "def add_ingredients(ingredients)\n ingredients.each { |i| RecipeIngredient.new(self, i) }\n end", "def ingredients\n RecipeIngredient.all.select do |recipe_ingre|\n recipe_ingre.recipe == self\n end.map {|recipe_ingre| recipe_ingre.ingredient}\n end", "def ingredients\n my_recipe_ingredients = RecipeIngredient.all.select do |recipeingredient|\n recipeingredient.recipe == self\n end\n my_recipe_ingredients.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end.uniq\n end", "def recipe_instances\n recipe_ingredients.map { |ri| ri.recipe }\n end", "def ingredients\n self.dessert_ingredients.map {|di| di.ingredient}\n end", "def associate_ingredients_to_recipes\n Recipe.all.each do |recipe|\n 5.times do\n recipe.ingredients << Ingredient.all.sample\n end\n \n recipe.ingredients = recipe.ingredients.uniq\n \n while recipe.ingredients.count < 5\n recipe.ingredients << Ingredient.all.sample\n recipe.ingredients = recipe.ingredients.uniq\n end\n end\nend", "def add_ingredients(ingre)\n ingre.each {|ingre| RecipeIngredient.new(self, ingre)}\n end", "def add_ingredients(ing_array)\n ing_array.each do |ing|\n RecipeIngredient.new(self, ing)\n end\n end", "def ingredients\n RecipeIngredients.all.select do |recipe_ingredient|\n recipe_ingredient.recipe == self\n end.map do |recipe_ingredient|\n recipe_ingredient.ingredient\n end\n end", "def add_ingredients(ing_array)\n ing_array.each {|ingredient| RecipeIngredient.new(self, ingredient)}\n end", "def add_ingredient(ingredient)\n @ingredients.push(ingredient)\n end", "def ingredients_helper\n RecipeIngredient.all.select {|instance| instance.recipe == self}\n end", "def add_ingredients(ingredients)\n ingredients.map do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end \n end", "def add_ingredientusers(ingredients)\n ingredients.each {|ingredient| IngredientUser.create(user_id: self.id, ingredient_id: ingredient.id)}\n end", "def add_ingredient_to_recipe quantity, measure, food_item_name, recipe \n food_item = FoodItem.new(:name => food_item_name, :price => nil)\n ingredient = Ingredient.new(:food_item => food_item, :quantity => quantity, :measure => measure, :recipe_id => recipe.id)\n recipe.ingredients << ingredient\n end", "def ingpizza_params\n params.require(:ingpizza).permit(:ingredient_id, :pizza_id)\n end", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n if self.ingredients.count(ingredient) == 0\n RecipeIngredient.new(self, ingredient)\n end\n end\n end", "def ingredient_names\n self.ingredients.map do |ing|\n ing.name\n end\n end", "def ingredients\n desserts.map do |dessert|\n dessert.ingredients\n end.flatten\n end", "def add_ingredient(ingredient)\n\t\t@ingredients.push(ingredient)\n\tend", "def add_ingredients(ingredients)\n ingredients.each do |ingredient|\n RecipeIngredient.new(self, ingredient)\n end\n end", "def index\n @post_ingredients = @post.post_ingredients\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :recipe_ids => [])\n end", "def shopping_list\n self.ingredients.map {|i| i.name}.uniq\n end", "def index\n @ingredients = Ingredient.all\n end", "def index\n @ingredients = Ingredient.all\n end", "def create\n @pizza = Pizza.new(pizza_params)\n\n @pizza.user_id = current_user.id\n\n params[:topping_ids].each do |tid|\n topping = Topping.find_by_id(tid)\n @pizza.toppings << topping\n end\n\n respond_to do |format|\n if @pizza.save\n format.html { redirect_to @pizza, notice: 'Pizza was successfully created.' }\n format.json { render action: 'show', status: :created, location: @pizza }\n else\n format.html { render action: 'new' }\n format.json { render json: @pizza.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_ingredients(recipe, count: 2)\n (1..count).map do |i|\n create :ingredient, recipe_id: recipe.id\n end\n end", "def ingredient_logic(ingredient)\n if all_ingredients.include?(ingredient)\n new_recipe_ingredient = ingredient_instance(ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n else\n new_recipe_ingredient = Ingredient.create(name: ingredient)\n Recipe.last.ingredients << new_recipe_ingredient\n end\n end", "def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n @ingredient_item = Item.find(@ingredient.item_id)\n end", "def build_empty_ingredients\n 10.times { recipe_ingredients.build.build_ingredient }\n end", "def create\n @beverage = Beverage.new(params[:beverage])\n params[:ingredient].each{|ingr|\n @beverage.ingredients << Ingredient.find_by_name(ingr)\n } unless params[:ingredient].blank?\n\n\n respond_to do |format|\n if @beverage.save\n format.html { redirect_to @beverage, notice: 'Beverage was successfully created.' }\n format.json { render json: @beverage, status: :created, location: @beverage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @beverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def ingredient_params\n params.require(:ingredient).permit(:Item, :Prep)\n end", "def ingredient_params\n params.require(:ingredient).permit(:item_id, :qty, :recipe_id).merge({recipe_id: @recipe.id})\n end", "def ingredient\n if self.respond_to?(ingredient_column)\n self.send(ingredient_column)\n end\n end", "def create_ingredient(recipe_id, ingredients)\n\t\t\t\tdestroy_ingredients = RecipeIngredient.where(recipe_id: recipe_id)\n\t\t\t\tif !destroy_ingredients.blank? \n\t\t\t\t\tdestroy_ingredients.delete_all \n\t\t\t\tend\n\t\t\t\tingredients.each do |recipe_ingredient|\n\t\t\t\t\tingredient = RecipeIngredient.new\n\t\t\t\t\tingredient.recipe_id = recipe_id\n\t\t\t\t\tingredient.ingredient = recipe_ingredient\n\t\t\t\t\tingredient.save!\n\t\t\t\tend\n\t\t\tend", "def create\n @ingredient = Ingredient.find(params[:id])\n \n @supplier.ingredients << @ingredient\n redirect_to supplier_path(@supplier)\n end", "def ingredients\n rec_ing_arr = RecipeIngredient.all.select do |recipe_ingredient_ob|\n #binding.pry\n recipe_ingredient_ob.recipe == self\n end\n rec_ing_arr.map do |recipe_ob|\n recipe_ob.ingredient\n end\nend", "def assure_unique_ingredients\n self.ingredients.uniq!\n end", "def allergens_ingredients\r\n Allergen.all.select {|allergen| allergen.ingredient == self}\r\n end", "def ingredients_attributes=(ingredients_hash)\n ingredients_hash.each do |i|\n ingredient = Ingredient.find_or_create_by(name: i[:name], quantity: i[:quantity])\n self.ingredients << ingredient\n end\nend", "def add_ingredients(ingredient_arr)\n ingredient_arr.each do |ingredient|\n @ingredients << ingredient\n end\n @ingredients\n end", "def index\n @ingredient_recipes = IngredientRecipe.all\n end", "def ingredient_recipe_params\n params.require(:ingredient_recipe).permit(:ingredient_id, :recipe_id)\n end", "def get_ingredients_names\n self.ingredients.map{|ingredient| ingredient.name}\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :amount, :recipe_id)\n end", "def ingredients\n a = Array.new\n self.steps.each do |step|\n step.ingredients.each do |ing|\n a << ing\n end\n end\n a\n end", "def create\n @recipe = Recipe.new(recipe_params)\n if params['ingredients']\n params['ingredients'].each do |ingredient_name|\n @recipe.ingredients << Ingredient.find_by(name: ingredient_name)\n end\n end\n\n @recipe.save \n redirect_to recipes_path\n end", "def allergens\n self.ingredients.each do |ingredient|\n Allergen.all.each do |alergy|\n alergy.ingredient == ingredient\n end\n end\n end", "def list_all_giveable_ingredients\n ingredient_count_hash = {}\n self.owned_ingredients.each do |owned_ingredient|\n ingredient_count_hash[owned_ingredient.ingredient_id] = owned_ingredient.giveable_count\n end\n ingredient_count_hash\n end", "def add_ingredients(ingredients_arr)\n ingredients_arr.each do |ingredient|\n RecipeIngredient.new(ingredient,self)\n end\n end", "def index\n @recipeingredients = Recipeingredient.all\n end", "def ingredients_by_recipe\n recipe = Recipe.find(params[:id])\n render json: recipe.ingredients\n end", "def show\n @ingredients = Ingredient.all\n end", "def add_ingredients(ingredients_array)\n # ingredients_array[0] = RecipeIngredient.new(name, ingredients_array[0], self)\n ingredients_array.each do |ingredient|\n RecipeIngredient.new(ingredient.name, ingredient, self)\n end\n end", "def index\n @ingredients_nutrients = IngredientsNutrient.all\n end", "def add_ingredient_by_name(new_ingredient)\n #self.ingredients < Ingredient.find_ingredient_by_name(new_ingredient)\n end", "def ingredient_params\n params.require(:ingredient).permit(:recipe_id, :piece_kind, :parent_id)\n end", "def index\n @recipe_ingredients = RecipeIngredient.all\n end", "def index\n @ingredientes = Ingrediente.all\n end", "def index\n @ingredientes = Ingrediente.all\n end", "def recipes\n # @recipe.all.select {|recipe| recipe.all = self}\n recipecards.map {|recipecard| recipecard.recipe}\n end", "def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end", "def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end", "def with_ingredients(ingredients = nil)\n unless ingredients.nil?\n self.recipe_data.ingredients = ingredients\n self\n end\n end", "def index\n @ingredient_lists = IngredientList.all\n end", "def ingredient\n return nil if essence.nil?\n essence.ingredient\n end", "def set_post_ingredient\n @post_ingredient = @post.post_ingredients.find(params[:id])\n end", "def add_ingredients(ingredients_array)\n\t\tRecipeIngredient.new(ingredients_array, self)\n\tend", "def index\n @ingredient_suggestions = IngredientSuggestion.all.order('item ASC')\n @ingredients = @ingredient_suggestions.select(:id, :item)\n end", "def ingredient_name\n return ingredient.name\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :category_id, :unit_item, :shrinkage, baseproducts_attributes:[:_destroy, :id, :ingredient_id, :purchase_date, :unit_weight, :total_weight, :unit_count, :total_price, :unit_price, :price_per, :ingredient_id, :vendor_id])\n end", "def recipeIngredient_params\n params.require(:recipeIngredient).permit(:recipe_id, :ingredient_id, :amount_of_ingredient)\n end", "def ingredient_params\n params.require(:ingredient).permit(:name, :description, :tags)\n end", "def recipe_params\n params.require(:recipe).permit(\n :title, \n :description, \n :instructions, \n :ingredient_count, \n ingredient_ids: [],\n ingredients_attributes: [\n :name, \n :description, \n recipe_ingredients_attributes: [\n :quantity\n ]\n ]\n \n )\n end", "def by_ingredient\n # If ingredient exists, find recipes that use it\n if Ingredient.exists?(params[:id])\n ingredient = Ingredient.find(params[:id])\n recipes = Recipe.recipes_of_ingredient(params[:id])\n else\n recipes = Recipe.all\n end\n\n # Render json\n render json: {recipes: recipes}, status: 200 \n end", "def pizza_params\n params.require(:pizza).permit(:id, :name, :description, topping_ids: [])\n end", "def inline_ingredients\n ingredients.to_a.map(&:name).join(' ')\n end", "def set_ingredient\n @ingredient = Ingredient.find(params[:id])\n end", "def index\n @recipe_ingredients_units = RecipeIngredientsUnit.all\n end", "def add_ingredients(arr_of_ingredient_ids)\n arr_of_ingredient_ids.each do |id|\n RecipeIngredient.find_or_create_by(\n recipe_id: self.id,\n ingredient_id: id\n )\n end\n end" ]
[ "0.67954785", "0.6722225", "0.6694667", "0.66650546", "0.6654405", "0.6651302", "0.66500986", "0.66500986", "0.6647862", "0.66351056", "0.66241735", "0.66158843", "0.66080177", "0.6574358", "0.6501355", "0.649157", "0.6479837", "0.6477694", "0.6473498", "0.64070636", "0.64031994", "0.6384308", "0.6378601", "0.6368133", "0.6347518", "0.6306732", "0.62840086", "0.62783694", "0.62642753", "0.62324655", "0.6212361", "0.6193229", "0.6178593", "0.6167423", "0.6144024", "0.61286306", "0.6109343", "0.61062276", "0.61031973", "0.60932183", "0.6087425", "0.60324717", "0.60194886", "0.59754926", "0.59552413", "0.59552413", "0.59513366", "0.59464943", "0.5938646", "0.5937125", "0.5922873", "0.59199023", "0.5918528", "0.5914781", "0.59088594", "0.58990884", "0.5885798", "0.5875306", "0.5874923", "0.5852588", "0.58309215", "0.5830094", "0.58195466", "0.5817879", "0.5815865", "0.5814089", "0.58115023", "0.5810497", "0.5805868", "0.5804646", "0.5800296", "0.5795827", "0.5778138", "0.57719123", "0.5758284", "0.57560486", "0.5752096", "0.5747925", "0.57419825", "0.5737537", "0.5737537", "0.5730308", "0.5724", "0.5724", "0.57224977", "0.5721377", "0.57142586", "0.5698947", "0.5696354", "0.56803393", "0.5676433", "0.5637182", "0.56311464", "0.5629214", "0.5621768", "0.5612613", "0.5611516", "0.5605771", "0.5604774", "0.56034446", "0.56000143" ]
0.0
-1
GET /boat_cover_image_names/1 GET /boat_cover_image_names/1.xml
def show @boat_cover_image_name = BoatCoverImageName.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @boat_cover_image_name } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @boat_cover_image_name = BoatCoverImageName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boat_cover_image_name }\n end\n end", "def index\n @images = @owner.images\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "def image_name\n ovf.xpath(\"//*[local-name()='References']/*[local-name()='File']\")[0].attribute(\"href\").value\n end", "def parsePhotoRequestReponseXMl\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n doc = Nokogiri::XML.parse(File.open(file)) { |xml| xml.noblanks }\n project = doc.root.child\n project.children.each { |shotGrp|\n if shotGrp.name == 'ShotGroup'\n puts shotGrp.name #puts node.children.first.name\n puts 'SalsifyID: ' + shotGrp['SalsifyID']\n puts 'ShotGroupStatus: ' + shotGrp['ShotGroupStatus']\n puts '------------'\n shotGrp.children.each { |image|\n puts image.name\n puts image.values\n puts '-----------'\n image.children.each { |sample|\n puts sample.name\n puts sample.values\n puts '##########'\n }\n }\n end\n }\n end\n end", "def get_image1(doc, image)\n x = doc.xpath(image).to_s\n end", "def index\n @image_sets = ImageSet.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @image_sets }\n end\n end", "def get_image(image_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Compute::Slicehost::GetImage.new,\n :path => \"images/#{image_id}.xml\"\n )\n end", "def images\n IbmCloudRest.get \"#{@uri}/images\"\n end", "def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "def show\n @moto_cover_image_uid = MotoCoverImageUid.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @moto_cover_image_uid }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @welcome_images }\n end\n end", "def index\n @images = @user.images.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end", "def imageNameFromUrl(url,idx)\n ImageFinder.nameForImageFromUrl(url,@start_idx,idx)\n end", "def index\n\t\t@pictures = @boat.pictures\n\tend", "def destroy\n @boat_cover_image_name = BoatCoverImageName.find(params[:id])\n @boat_cover_image_name.destroy\n\n respond_to do |format|\n format.html { redirect_to(boat_cover_image_names_url) }\n format.xml { head :ok }\n end\n end", "def print_each_photo(api_key, tag)\n # Build the URI\n uri = \"http://www.flickr.com/services/rest?method=flickr.photos.search\" +\n \"&api_key=#{api_key}&tags=#{tag}\"\n\n # Make the HTTP request and get the entity-body.\n response = open(uri).read\n\n # Parse the entity-body as an XML document.\n doc = REXML::Document.new(response)\n\n # For each photo found...\n REXML::XPath.each(doc, '//photo') do |photo| \n # ...generate and print its URI\n puts small_photo_uri(photo) if photo\n end\nend", "def get_imageinfo(files,props = :imageinfo)\n result=Array.new\n \n iiprop=CGI.escape(\"timestamp|user|url|dimensions|comment\")\n doc=Nokogiri::XML(open(\"http://commons.wikipedia.org/w/api.php?format=xml&action=query&prop=#{props.to_s}&titles=#{files}&iiprop=#{iiprop}\"))\n\n xp=\"//api/query/pages/page/imageinfo/ii\"\n xp=\"//api/query/pages/page/globalusage/gu\" if props==:globalusage\n\n ctr=0\n element=doc.xpath(xp).each do |element| \n img=Hash.new\n element.attributes.each do |a|\n img[a[0].to_sym]=element.get_attribute(a[0])\n end \n result << img\n \n @stockpile[\"#{@imagelist[ctr]}\"]=Hash.new unless @stockpile[\"#{@imagelist[ctr]}\"]\n @stockpile[\"#{@imagelist[ctr]}\"][props]=img\n ctr=ctr+1\n end\n result\n end", "def show\n @content_title = 'Tag your friends and beers!'\n @image = Image.find(params[:id], :include => [ :tag_images ])\n @tag_images = @image.tag_images\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @tag_images.to_xml }\n end\n end", "def index\n @crops = @image.crops.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @crops }\n end\n end", "def ScrapPkmn(p1, p2, outdir)\n\tFileUtils.mkpath(outdir);\n\n\tpageURL = \"http://pokemon.alexonsager.net/#{p1}/#{p2}\";\n\timgURL = \"http://images.alexonsager.net/pokemon/fused/#{p2}/#{p2}.#{p1}.png\";\n\toutName = \"#{outdir}/#{p1}_#{p2}_name.txt\";\n\toutImg = \"#{outdir}/#{p1}_#{p2}.png\";\n\n\tdoc = Nokogiri::HTML(open(pageURL));\n\tname = doc.xpath('//*[@id=\"pk_name\"]');\n\n\tFile.write(outName, \"#{name[0].content()}\\n\");\n\t`curl #{imgURL} > \"#{outImg}\"`\nend", "def index\n @imagens = Imagen.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @imagens }\n end\n end", "def image_name\n ovf.elements['//References/File'].attributes['ovf:href']\n end", "def named_image(name)\n card = named(name)\n return card['image_uris']['normal']\n end", "def fetch_cover(response, file_name)\n res = response.to_h\n response_url = res['RESPONSE']['ALBUM']['URL']\n title = res['RESPONSE']['ALBUM']['TITLE']\n file_name = file_name || \"#{title}-cover.jpg\"\n\n APIRequest.get_file(response_url, filename)\n end", "def show\n @image_set = ImageSet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_set }\n end\n end", "def images artist\n url = \"http://developer.echonest.com/api/v4/artist/images?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json&results=#{RESULTS}&start=0&license=unknown\"\n result = parseURL url\n result[\"response\"][\"images\"]\nend", "def get_image2(doc, image)\n x = doc.xpath(image).first.to_s\n end", "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "def show\n\n @observation = Observation.find(params[:id])\n @coral = Coral.find(params[:coral_id])\n\n @files = Dir.glob(\"app/assets/images/tagged_outlines_thumbs/*\")\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end", "def list_books(api_object)\n puts \"Current Books:\"\n doc = Nokogiri::XML.parse api_object.read\n names = doc.xpath('books/book/title').collect {|e| e.text }\n puts names.join(\", \")\n puts \"\"\nend", "def index\n # show the categories for a image\n flash[:notice] = \"Image has (#{@categories.size}) categories.\"\n respond_to do |format|\n format.html # index.html\n format.xml { render :xml => @categories }\n end\n end", "def index\n @images = Image.where(\"article is not null or thumbnail is not null\").order(\"id desc\").page(params[:page]).per(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @console_images }\n end\n end", "def show\n @image = @account.images.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "def index\n @remote_image_contents = RemoteImageContent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @remote_image_contents }\n end\n end", "def index\n @project_images = ProjectImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @project_images }\n end\n end", "def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pictures }\n end\n end", "def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @welcome_image }\n end\n end", "def show\n @bwimage = Bwimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bwimage }\n end\n end", "def show\n @album = Album.find(params[:id]) \n @album_images = Image.where(:album_id => @album.id).order(\"mark DESC\").page(params[:page])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @post.to_xml(:include => :images) }\n format.json { render :json => @post.to_json(:include => :images) }\n end\n end", "def wiki_image_data(image)\n RestClient.get(image['image_url'], :accept => image['image_content_type'])\n end", "def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end", "def index\n @photo_sets = PhotoSet.find(:all, :order => 'title')\n \n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @photo_sets.to_xml }\n end\n end", "def show\n @img_info = ImgInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @img_info }\n end\n end", "def index\n @images = @owner.images\n end", "def image_names\n images.map { |i| i.name }.join(\"|\")\n end", "def index\n if current_user.is_admin\n @images = Image.masters.find(:all)\n else\n @images = Image.this_user(current_user).masters.find(:all)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "def grab_the_images\n get_the_url = RestClient.get(@url)\n doc = Nokogiri::HTML(get_the_url)\n images = doc.search('img').map{ |img| img['src'] }\n images\n end", "def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @imagem }\n end\n end", "def show\n @imagem = @evento.imagems.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @imagem }\n end\n end", "def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end", "def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end", "def index\n @market_segment_images = @market_segment_imageable.market_segment_images\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def query_b2(client)\n\n urls = []\n results = client.query(\"select photo from imageuploader\")\n\n results.each do |result|\n file = result[\"photo\"]\n\n url = b2_generate_file_url(file)\n urls.push(url)\n end\n\n return urls\n\nend", "def show_images\r\n images = Document.new(self).get_images\r\n puts \"There are #{images.length} images\"\r\n index = 1\r\n images.each do |l|\r\n puts \"image: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" src: #{l.src}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end", "def show\n # maybe I need to uncomment this:\n # @image = Image.find(params[:id]) \n # add_breadcrumb @image, image_path(@image) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def show\n # maybe I need to uncomment this:\n # @image = Image.find(params[:id]) \n # add_breadcrumb @image, image_path(@image) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end", "def get_images(tag)\n\tpageThumb = get_page(\"#{URL_MOTARU}/categories/view/name/#{tag}\")\n\treturn pageThumb.search(\"//div[@id='categoryWallpapersList']//img[@class='wallpaperThumb']\")\nend", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "def show\n @image = @user.images.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "def get_xmlinfo\n def do_xmlget(imagepath)\n xmlinfo = %x{imagex info --xml #{imagepath}}\n @xmlinfo = REXML::Document.new xmlinfo\n return @xmlinfo\n end\n if defined?(@xmlinfo) then return @xmlinfo else @xmlinfo = nil end\n search = File.join(@path, 'sources/install.wim')\n wimage = Dir.glob(search, File::FNM_CASEFOLD)\n if wimage.length > 0\n return do_xmlget(wimage.first)\n end\n search = File.join(@path, 'sources/boot.wim')\n bimage = Dir.glob(search, File::FNM_CASEFOLD)\n if bimage.length > 0\n return do_xmlget(bimage.first)\n end\n @xmlinfo\n end", "def index\n @avatar_twitters = AvatarTwitter.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @avatar_twitters }\n end\n end", "def pull_image(value)\n user_hash = pull_records(value)\n id = user_hash[0][\"id\"]\n image_name = user_hash[0][\"image\"]\n image = \"images/uploads/#{id}/#{image_name}\"\nend", "def show\n @names = @campaign.tags.pluck(:description, :name).uniq\n @values = @campaign.values_for_tag(params[:name] ? params[:name] : 'title')\n\n if params[:tags]\n @images = @campaign.search(params[:tags])\n else\n @images = @campaign.images.includes(:tags)\n end\n\n render partial: 'images' if request.xhr?\n end", "def scrap_the_images\n url = RestClient.get(@url)\n parsed_result = Nokogiri::HTML(url)\n images = parsed_result.search('img').map { |img| img['src'] }\n images\n end", "def show\n\n # Get random gif from Giphy (http://giphy.com)\n response = HTTParty.get('http://api.giphy.com/v1/gifs/search?' +\n 'q=' + @boolio.val.to_s +\n '&api_key=dc6zaTOxFJmzC' + # provided for public beta testing via (https://github.com/Giphy/GiphyAPI#public-beta-key)\n '&limit=1' + # only want 1\n '&offset=' + rand(30).to_s + # pull from the top 10 most relevant images\n '&rating=pg' + # afraid if this is any higher\n '&fmt=json' # seems to return JSON anyway, but just in case\n )\n\n if response.code == 200\n\n # conver to JSON\n json = JSON.parse response.body, object_class: OpenStruct\n\n # set image from returned results\n @image = json.data[0].images if json.data.count > 0\n end\n\n end", "def create\n @boat_cover_image_name = BoatCoverImageName.new(params[:boat_cover_image_name])\n\n respond_to do |format|\n if @boat_cover_image_name.save\n format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully created.') }\n format.xml { render :xml => @boat_cover_image_name, :status => :created, :location => @boat_cover_image_name }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @boat_cover_image_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @images_index = ImagesIndex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @images_index }\n end\n end", "def show\n @title = params[:group_name]\n @bp_pic_names = []\n @bp_pic_group = BpPicGroup.find(params[:id])\n @bp_pic_group_details = BpPicGroupDetail.find(:all, :conditions => [\"deleted = 0 and bp_pic_group_id = ? \", params[:id]])\n @bp_pic_group_details.each do |bp_pic_group_detail|\n bp_pic = BpPic.find(bp_pic_group_detail.bp_pic_id)\n business_partner = BusinessPartner.find(bp_pic.business_partner_id)\n @bp_pic_names.push([business_partner.business_partner_name, bp_pic.bp_pic_name, business_partner.id, bp_pic.id])\n end\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp_pic_group }\n end\n end", "def show\n if params.has_key?(:page)\n @images = Kaminari.paginate_array(@image_label_set.images).page(params[:page])\n else\n @images = Kaminari.paginate_array(@image_label_set.images).page(1)\n end\n end", "def get_image_backlinks(title, list_redirects = nil, thru_redir = false, limit = @query_limit_default)\n params = {\n list: 'imageusage',\n iutitle: title,\n iulimit: get_limited(limit)\n }\n params[:iufilterredir] = list_redirects.nil? ? 'all' : list_redirects\n params[:iuredirect] = '1' if thru_redir\n\n query_ary(params, 'imageusage', 'title')\n end", "def extract_badgeimages()\n@badgeimages_array = []\n file = File.open('app/assets/post.html')\n doc = Nokogiri::HTML(file)\n doc.search('.mb_div a img').map do |element|\n image_url = 'http://www.boyscouttrail.com' + element['src']\n @badgeimages_array << image_url\n end\n return @badgeimages_array\nend", "def index\n @bowls = Bowl.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bowls }\n end\n end", "def parse_photo_request_reponse_xml\n logger.debug('PARSING FILES.')\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n begin\n doc = Nokogiri::XML.parse(File.open(file)) { |xml| xml.noblanks }\n parse_xml(doc)\n rescue StandardError? => e\n logger.debug('Error is processing file ' + file + ' ' + e.message)\n next\n end\n end\n puts salsify_ids_map\n logger.debug('PARSING COMPLETED.')\n end", "def show\n @console_image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @console_image }\n end\n end", "def show\n @map_image = MapImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @map_image }\n end\n end", "def index\n @image_gallery_groups = ImageGalleryGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @image_gallery_groups }\n end\n end", "def banner\n if(@all_images.nil?)\n @all_images = Image.all\n end\n\n if(!@all_images.empty?)\n for img in @all_images\n if(img.picture_file_name == \"Company_Logo.png\")\n @imagelogo = img.picture.url\n end\n if(img.picture_file_name == \"Company_Banner.png\")\n @imagebanner = img.picture.url\n end\n end\n end\n end", "def getStockImage(link)\n dog_page = HTTParty.get(link, :verify => false)\n parsed_dog_page = Nokogiri::HTML(dog_page)\n\n info_table = parsed_dog_page.css(\".biota\")[0]\n \n image = info_table.css(\"img\")[0]\n pic = image != nil ? \"https:#{image['src']}\" : nil\nend", "def list\n @api.get(\"#{@api.path}/Images\")\n end", "def index\n @images = Image.all\n @categories = Category.all.sort_by(&:name)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @images }\n end\n end", "def show\n @manufacturer_partner = ManufacturerPartner.find(params[:id])\n @logos = SiteElement.where(\"name LIKE '%logo_inconcert_%'\").order(:name)\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @manufacturer_partner }\n format.json { render json: @manufacturer_partner }\n end\n end", "def getimage\n if @artist.images.empty?\n @image = \"image1.jpg\"\n else\n @image = @artist.images.first[\"url\"]\n end\n end", "def images; end", "def images\n if @images.nil?\n @images = []\n image_nodes = FeedTools::XmlHelper.combine_xpaths_all(\n self.channel_node, [\n \"image\",\n \"logo\",\n \"apple-wallpapers:image\",\n \"imageUrl\"\n ]\n )\n unless image_nodes.blank?\n for image_node in image_nodes\n image = FeedTools::Image.new\n image.href = FeedTools::XmlHelper.try_xpaths(image_node, [\n \"url/text()\",\n \"@rdf:resource\",\n \"@href\",\n \"text()\"\n ], :select_result_value => true)\n if image.href.nil? && image_node.base_uri != nil\n image.href = \"\"\n end\n begin\n if !(image.href =~ /^file:/) &&\n !FeedTools::UriHelper.is_uri?(image.href)\n image.href = FeedTools::UriHelper.resolve_relative_uri(\n image.href, [image_node.base_uri, self.base_uri])\n end\n rescue\n end\n if self.configurations[:url_normalization_enabled]\n image.href = FeedTools::UriHelper.normalize_url(image.href)\n end \n image.href.strip! unless image.href.nil?\n next if image.href.blank?\n image.title = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"title/text()\"], :select_result_value => true)\n image.title.strip! unless image.title.nil?\n image.description = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"description/text()\"], :select_result_value => true)\n image.description.strip! unless image.description.nil?\n image.link = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"link/text()\"], :select_result_value => true)\n image.link.strip! unless image.link.nil?\n image.height = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"height/text()\"], :select_result_value => true).to_i\n image.height = nil if image.height <= 0\n image.width = FeedTools::XmlHelper.try_xpaths(image_node,\n [\"width/text()\"], :select_result_value => true).to_i\n image.width = nil if image.width <= 0\n image.style = FeedTools::XmlHelper.try_xpaths(image_node, [\n \"style/text()\",\n \"@style\"\n ], :select_result_value => true)\n image.style.strip! unless image.style.nil?\n image.style.downcase! unless image.style.nil?\n @images << image unless image.href.nil?\n end\n end\n for link_object in self.links\n if link_object.type != nil && link_object.type =~ /^image/\n image = FeedTools::Image.new\n image.href = link_object.href\n image.title = link_object.title\n @images << image unless image.href.nil?\n end\n end\n end\n return @images\n end", "def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.xml { render :xml => @image }\n end\n end", "def get_img_names()\n if not File.exists?(@folder)\n Dir.mkdir(@folder)\n puts \"#{@folder} Directory Created\"\n end\n\t \n @files = Array.new\n img = @page.css('img')\n img.each do |i|\n nodes = i[\"src\"].split(\"/\")\n @files.push(@folder + \"/\" + nodes[nodes.length - 1])\n end\n end", "def index\n @goods = Good.where(user: current_user.building.users)\n respond_to do |format|\n format.html\n format.json do\n render json: {\n goods: @goods.map{|g|g.attributes.merge(image: url_for(g.user.profile.pic), ownerId: g.user.id)}\n }\n end\n end\n end", "def show\n @pictures = TaxiSevice.find(params[:id]).taxi_images\n end", "def index\n @animal_images = AnimalImage.all\n end", "def index\n @imgs = Img.order(created_at: :desc).limit(20)\n end", "def get_search_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end", "def images\n end", "def index\n# @photos = Photo.all\n @photos = Photo.find(:all, :select => 'id, name, thumbnail')\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end", "def index\n @item_photos = ItemPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @item_photos }\n end\n end" ]
[ "0.61741", "0.6130531", "0.608153", "0.5915386", "0.5885076", "0.58273035", "0.57866883", "0.5785827", "0.5710268", "0.57056856", "0.5697743", "0.5679736", "0.5677093", "0.56736875", "0.56021994", "0.55927217", "0.55758494", "0.55662775", "0.556135", "0.55586725", "0.5551429", "0.55511296", "0.5515619", "0.55145496", "0.550179", "0.550004", "0.5490096", "0.5482824", "0.5479998", "0.54677314", "0.54648215", "0.5462815", "0.54625875", "0.5461552", "0.5452527", "0.54450643", "0.5439371", "0.5435578", "0.5432323", "0.54321957", "0.5417085", "0.5411958", "0.54095787", "0.5409259", "0.54092354", "0.53851527", "0.5384993", "0.53769904", "0.5349826", "0.53436446", "0.53431815", "0.53396577", "0.5336837", "0.5335381", "0.53336126", "0.5332008", "0.532269", "0.5322007", "0.5322007", "0.532188", "0.53192097", "0.53192097", "0.53192097", "0.531719", "0.5310502", "0.53059167", "0.52978396", "0.5290239", "0.5289436", "0.5289097", "0.5283751", "0.52810746", "0.52805287", "0.52767646", "0.5270997", "0.5267093", "0.5264701", "0.52619135", "0.52618295", "0.5261151", "0.5258002", "0.5253956", "0.52537096", "0.5248502", "0.5235089", "0.5227085", "0.52226156", "0.5221717", "0.52209514", "0.52166337", "0.5216218", "0.52132535", "0.52109516", "0.5200714", "0.519517", "0.51899403", "0.5188678", "0.5186445", "0.5186321", "0.5185393" ]
0.70808667
0
GET /boat_cover_image_names/new GET /boat_cover_image_names/new.xml
def new @boat_cover_image_name = BoatCoverImageName.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @boat_cover_image_name } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @boat_cover_image_name = BoatCoverImageName.new(params[:boat_cover_image_name])\n\n respond_to do |format|\n if @boat_cover_image_name.save\n format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully created.') }\n format.xml { render :xml => @boat_cover_image_name, :status => :created, :location => @boat_cover_image_name }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @boat_cover_image_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @image = @owner.images.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @console_image }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @welcome_image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image }\n end\n end", "def new\n @img_info = ImgInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @img_info }\n end\n end", "def new\n @img = Img.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @img }\n end\n end", "def new\n @image = Image.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image }\n end\n end", "def new\n @image_set = ImageSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_set }\n end\n end", "def new\n @image_path = ImagePath.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_path }\n end\n end", "def new\n @bwimage = Bwimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bwimage }\n end\n end", "def new\n @moto_cover_image_uid = MotoCoverImageUid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_cover_image_uid }\n end\n end", "def new\n @photo = @imageable.photos.new\n resource, id = request.path.split('/')[1, 2]\n @name = case resource\n when \"leagues\"\n @imageable.league_name\n when \"teams\"\n @imageable.team_name\n when \"players\"\n @imageable.first_name + ' ' + @imageable.last_name\n else\n nil\n end\n\n end", "def new\n @uploaded_image = UpdatedImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uploaded_image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image }\n end\n end", "def new\n @images_index = ImagesIndex.new nil\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @images_index }\n end\n end", "def new\n @blurbs = Blurb.find(:all) \n @blurb = Blurb.new\n @blurb.name = params[:name]\n @blurb.content = Blurb.fetch_default(@blurb.name)\n @page_title = t('blurbs.new.title', :blurb_name => @blurb.name)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @blurb }\n end\n end", "def new\n @project_image = ProjectImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @project_image }\n end\n end", "def new\n @jpeg_folder = JpegFolder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @jpeg_folder }\n end\n end", "def new\n @pic = Pic.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pic }\n end\n end", "def show\n @boat_cover_image_name = BoatCoverImageName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boat_cover_image_name }\n end\n end", "def new\n @map_image = MapImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_image }\n end\n end", "def new\n @nspirefile = Nspirefile.new\n @categories = get_categories\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nspirefile }\n end\n end", "def new\n @imagem = @evento.imagems.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @imagem }\n end\n end", "def new\n @dynamic_image = DynamicImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dynamic_image }\n end\n end", "def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @picture }\n end\n end", "def new\n @picture = Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @picture }\n end\n end", "def new\n @album = Album.new\n @images = Image.all(:conditions => {:album_id => nil})\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end", "def new\n @image_gallery_image = @image_gallery_group.images.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_gallery_image }\n end\n end", "def new\n @image = Image.new(:user => current_user)\n if params[:image_shell_id] && params[:request_id]\n @image.image_shell = ImageShell.find(params[:image_shell_id])\n @image.description = @image.image_shell.description\n @image.request = Request.find(params[:request_id]) \n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image }\n end\n end", "def new\n @image_dataset = ImageDataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_dataset }\n end\n end", "def new\n @image_dataset = ImageDataset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_dataset }\n end\n end", "def new\n @photo = @allbum.photos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photo }\n end\n end", "def new\n @image = @user.images.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image }\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 @gallery_image = @project.gallery_images.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gallery_image }\n end\n end", "def new\n @picture = Picture.new\n\n respond_to do |wants|\n wants.html # new.html.erb\n wants.xml { render :xml => @picture }\n end\n end", "def new\n @user_image = UserImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_image }\n end\n end", "def new\n @good = Good.new\n\n @good.fuimage = Fuimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @good }\n end\n end", "def new\n @photo_set = PhotoSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo_set }\n end\n end", "def new\n @image_url = ImageUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_url }\n end\n end", "def new\n @image = Image.where(\"id is not ?\",nil)\n\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @image }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end", "def new\n @crop = Crop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crop }\n end\n end", "def new\n @image_bank = ImageBank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_bank }\n end\n end", "def new\n @bgimage = Bgimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @bgimage }\n end\n end", "def create\n @new_boat = Boat.create(\n name: params[:boat][:name],\n maxcontainers: params[:boat][:maxcontainers],\n company_id: params[:boat][:company_id],\n location: params[:boat][:location],\n image: params[:boat][:image]\n )\n\n\n\n if @new_boat\n redirect_to url_for(:controller => :boats, :action => :index)\n else\n redirect_to url_for(:controller => :boats, :action => :new)\n end\n end", "def new\n @photo = Photo.new\n @photo.set_as_blurb = @blurb_image\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end", "def new\n @picwall = Picwall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @picwall }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end", "def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end", "def new\n @slice = Xen::Slice.new\n @tarballs = Xen::Backup.find\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @slice }\n end\n end", "def new\n @picture = @museum.pictures.new #Picture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n end", "def new\n @image = Image.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @image }\n end\n end", "def new\n @avatar = Avatar.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @avatar }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end", "def new\n @pictures_of_cat = PicturesOfCat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pictures_of_cat }\n end\n end", "def new\n @shot = Shot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shot }\n end\n end", "def new2\n #does not allow attaching a picture\n @listing = Listing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.fbml # new.fbml.erb\n format.xml { render :xml => @listing }\n end\n end", "def new\n @news = News.new\n @news.build_image_reference\n @news.image_references.build\n @news.image_references.build\n# @news.image_references_attributes = [{:content_type=>\"news\"}]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @news }\n end\n end", "def new\n @image_gallery_group = ImageGalleryGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_gallery_group }\n end\n end", "def new\n @drop = Drop.new\n @breadcrumbs = [{\"home\" => drops_url}, {\"new file\" => nil}]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @drop }\n end\n end", "def new\n @remote_image_content = RemoteImageContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @remote_image_content }\n end\n end", "def new\n @banner_img = BannerImg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @banner_img }\n end\n end", "def new\n @memberimage = Memberimage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @memberimage }\n end\n end", "def new\n @bench_test_photo_gen = BenchTest::PhotoGen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bench_test_photo_gen }\n end\n end", "def new\n @gallery_asset = GalleryAsset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gallery_asset }\n end\n end", "def new\n @especie_imagem = EspecieImagem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @especie_imagem }\n end\n end", "def new\n @portfolio_picture = PortfolioPicture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @portfolio_picture }\n end\n end", "def new\n @image_member = ImageMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_member }\n end\n end", "def new\n @collage = Collage.new\n @images = Image.order('created_at DESC')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collage }\n end\n end", "def new\n \n @page = Page.new\n @page.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page }\n end\n end", "def new\n @imovel = Imovel.new\n @imovel.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imovel }\n end\n end", "def create\n\n if current_user.nil?\n redirect_to '/'\n end\n\n if(params[\"labels\"].nil?)\n respond_to do |format|\n format.html { redirect_to image_label_sets_url, error: 'Labels not present.' }\n end\n return\n end\n\n @image_label_set = ImageLabelSet.new\n @image_label_set.name = params[\"name\"]\n @image_label_set.user_id = current_user.id\n save_success = @image_label_set.save\n\n params[\"labels\"].split(\",\").each do |l|\n lb = Label.new\n lb.text = l\n lb.image_label_set_id = @image_label_set.id\n lb.save\n end\n\n images_folder_path = Rails.root.join('public', \"images/#{@image_label_set.id}\")\n FileUtils::mkdir_p images_folder_path\n\n accepted_formats = [\".jpg\", \".png\", \".bmp\"]\n\n params[\"upload\"].each do |uf|\n #Check if zipfile, raw images or URL textfile\n if (File.extname(uf.tempfile.path)==\".txt\")\n Image.transaction do\n File.readlines(uf.tempfile.path).each do |line|\n i = Image.new\n i.url = line.strip\n i.image_label_set_id = @image_label_set.id\n i.save\n end\n end\n end\n uf.tempfile.close\n uf.tempfile.unlink\n end\n\n respond_to do |format|\n if save_success\n format.html { redirect_to @image_label_set, notice: 'Image label set was successfully created.' }\n format.json { render :show, status: :created, location: @image_label_set }\n else\n format.html { render :new }\n format.json { render json: @image_label_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end", "def new\n @image_store = ImageStore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @image_store }\n end\n end", "def new\n @book = Book.new :copies => 1\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @book }\n end\n end", "def new\n @baby_pic = BabyPic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baby_pic }\n end\n end", "def new\n @photo_album = PhotoAlbum.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo_album }\n end\n end", "def new\n @image_datum = ImageDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_datum }\n end\n end", "def new\n @bowl = Bowl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bowl }\n end\n end", "def new\n @photo_album = PhotoAlbum.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo_album }\n end\n end", "def new\n @category_image = CategoryImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @category_image }\n end\n end", "def new\n @fileclip = Fileclip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fileclip }\n end\n end", "def new\n @collage_template = CollageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collage_template }\n end\n end", "def new\n @showcase = Showcase.find(params[:showcase_id])\n @showcase_image = @showcase.showcase_images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @showcase_image }\n end\n end", "def new\n @boss = Boss.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boss }\n end\n end", "def newFromSource\n\n @kite = Kite.new\n @images = []\n @isAutoAdd = true\n\n if uri_is_valid?(params[:path])\n site = URI.parse(URI.encode(params[:path]))\n\n #grab the reference page passed in as parameter\n doc = Nokogiri::HTML(open(site))\n\n #find all of the images\n doc.css('img').each do |image|\n #debugger\n path = image.attribute('src').value\n\n if path[0..0] == '/'\n path = URI.join(site, path).to_s\n end\n begin\n dimensions = FastImage.size(path, :timeout => 10.0)\n rescue => ex\n logger.error(\"Failed to retrieve image dimensions for image: #{ex}\")\n end\n if(!dimensions.nil? && dimensions.length > 1 && dimensions[0] > IMAGE_SQUARE_DIMENSION_LIMIT && dimensions[1] > IMAGE_SQUARE_DIMENSION_LIMIT )\n img = {:path => path,\n :source => doc.title,\n :alttext => image.attribute('alt').nil? ? \"\" : image.attribute('alt').value\n }\n\n @images << img\n else\n logger.debug \"The image #{path} was rejected as under size limit\"\n end\n end\n else\n logger.error \"The image was rejected as invalid path #{path}\"\n end\n @site = site\n if @images.count > 0\n @images[0][:first] = true\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kite }\n end\n end", "def new\n @bg = Bg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bg }\n end\n end", "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gallery }\n end\n end", "def new\n @gallery = Gallery.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gallery }\n end\n end", "def new\n @copy = Copy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @copy }\n end\n end" ]
[ "0.6475556", "0.6365224", "0.6238099", "0.622856", "0.6220146", "0.6219128", "0.6204947", "0.6203994", "0.6184958", "0.6152978", "0.61082494", "0.6080564", "0.6034241", "0.60305494", "0.6013691", "0.60003203", "0.5992225", "0.5980198", "0.5968671", "0.5957194", "0.59418637", "0.5926879", "0.5904638", "0.58923256", "0.58889073", "0.5888392", "0.5888392", "0.5839425", "0.5834773", "0.57880795", "0.5787883", "0.5787883", "0.57878053", "0.5780962", "0.5769918", "0.5761455", "0.57470477", "0.5745856", "0.5738711", "0.57367694", "0.57287943", "0.57131034", "0.5709049", "0.57068014", "0.57005703", "0.570042", "0.5696049", "0.5690155", "0.56894636", "0.56891084", "0.56891084", "0.56891084", "0.56891084", "0.56794727", "0.567807", "0.5671396", "0.5669559", "0.56683147", "0.5665748", "0.5665748", "0.5665748", "0.5665748", "0.5665748", "0.5665748", "0.56631255", "0.5658944", "0.5647826", "0.5646171", "0.5638131", "0.56336933", "0.5633622", "0.56184536", "0.56142676", "0.56046224", "0.56042385", "0.56030285", "0.5602244", "0.560036", "0.55915797", "0.5585844", "0.558325", "0.5577941", "0.5571512", "0.5562832", "0.5560316", "0.5554709", "0.55433017", "0.5539468", "0.55379045", "0.5517156", "0.55154467", "0.5513782", "0.55054075", "0.5496334", "0.5484749", "0.5478679", "0.54776275", "0.5473844", "0.5473844", "0.5469653" ]
0.7314431
0
POST /boat_cover_image_names POST /boat_cover_image_names.xml
def create @boat_cover_image_name = BoatCoverImageName.new(params[:boat_cover_image_name]) respond_to do |format| if @boat_cover_image_name.save format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully created.') } format.xml { render :xml => @boat_cover_image_name, :status => :created, :location => @boat_cover_image_name } else format.html { render :action => "new" } format.xml { render :xml => @boat_cover_image_name.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end", "def create\n\n if current_user.nil?\n redirect_to '/'\n end\n\n if(params[\"labels\"].nil?)\n respond_to do |format|\n format.html { redirect_to image_label_sets_url, error: 'Labels not present.' }\n end\n return\n end\n\n @image_label_set = ImageLabelSet.new\n @image_label_set.name = params[\"name\"]\n @image_label_set.user_id = current_user.id\n save_success = @image_label_set.save\n\n params[\"labels\"].split(\",\").each do |l|\n lb = Label.new\n lb.text = l\n lb.image_label_set_id = @image_label_set.id\n lb.save\n end\n\n images_folder_path = Rails.root.join('public', \"images/#{@image_label_set.id}\")\n FileUtils::mkdir_p images_folder_path\n\n accepted_formats = [\".jpg\", \".png\", \".bmp\"]\n\n params[\"upload\"].each do |uf|\n #Check if zipfile, raw images or URL textfile\n if (File.extname(uf.tempfile.path)==\".txt\")\n Image.transaction do\n File.readlines(uf.tempfile.path).each do |line|\n i = Image.new\n i.url = line.strip\n i.image_label_set_id = @image_label_set.id\n i.save\n end\n end\n end\n uf.tempfile.close\n uf.tempfile.unlink\n end\n\n respond_to do |format|\n if save_success\n format.html { redirect_to @image_label_set, notice: 'Image label set was successfully created.' }\n format.json { render :show, status: :created, location: @image_label_set }\n else\n format.html { render :new }\n format.json { render json: @image_label_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @boat_cover_image_name = BoatCoverImageName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boat_cover_image_name }\n end\n end", "def destroy\n @boat_cover_image_name = BoatCoverImageName.find(params[:id])\n @boat_cover_image_name.destroy\n\n respond_to do |format|\n format.html { redirect_to(boat_cover_image_names_url) }\n format.xml { head :ok }\n end\n end", "def parsePhotoRequestReponseXMl\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n doc = Nokogiri::XML.parse(File.open(file)) { |xml| xml.noblanks }\n project = doc.root.child\n project.children.each { |shotGrp|\n if shotGrp.name == 'ShotGroup'\n puts shotGrp.name #puts node.children.first.name\n puts 'SalsifyID: ' + shotGrp['SalsifyID']\n puts 'ShotGroupStatus: ' + shotGrp['ShotGroupStatus']\n puts '------------'\n shotGrp.children.each { |image|\n puts image.name\n puts image.values\n puts '-----------'\n image.children.each { |sample|\n puts sample.name\n puts sample.values\n puts '##########'\n }\n }\n end\n }\n end\n end", "def image_names=(names)\n self.images = []\n names = names.split(\"|\") if names.is_a?(String)\n names.each do |name|\n self.images <<= Image.find_by(name: name)\n end\n end", "def show\n @boat_cover_image_name = BoatCoverImageName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boat_cover_image_name }\n end\n end", "def ScrapPkmn(p1, p2, outdir)\n\tFileUtils.mkpath(outdir);\n\n\tpageURL = \"http://pokemon.alexonsager.net/#{p1}/#{p2}\";\n\timgURL = \"http://images.alexonsager.net/pokemon/fused/#{p2}/#{p2}.#{p1}.png\";\n\toutName = \"#{outdir}/#{p1}_#{p2}_name.txt\";\n\toutImg = \"#{outdir}/#{p1}_#{p2}.png\";\n\n\tdoc = Nokogiri::HTML(open(pageURL));\n\tname = doc.xpath('//*[@id=\"pk_name\"]');\n\n\tFile.write(outName, \"#{name[0].content()}\\n\");\n\t`curl #{imgURL} > \"#{outImg}\"`\nend", "def image_name\n ovf.xpath(\"//*[local-name()='References']/*[local-name()='File']\")[0].attribute(\"href\").value\n end", "def fetch_tags params\n encoded_image = Base64.strict_encode64(params[:image_file].tempfile.read)\n api_key = ENV[\"GOOGLE_API_KEY\"]\n api_url = \"https://vision.googleapis.com/v1/images:annotate?key=#{api_key}\"\n\n body = {\n requests: [{\n image: {\n content: encoded_image\n },\n features: [\n {\n type: 'LABEL_DETECTION', maxResults: 10\n }\n ]\n }]\n }\n # Send request.\n uri = URI.parse(api_url)\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri)\n request[\"Content-Type\"] = \"application/json\"\n response = https.request(request, body.to_json)\n\n # Add the generated labels to the list of tag\n JSON.parse(response.body)[\"responses\"].each do |res|\n res[\"labelAnnotations\"].each do |tag|\n @image.tags.prepend(tag[\"description\"], \",\")\n end\n end\n @image.tags = @image.tags.delete_suffix(',')\n end", "def avoid_duplicate_image_names(content)\n nodes = content.xpath(\"//draw:frame[@draw:name]\")\n nodes.each_with_index do |node, i|\n node.attribute('name').value = \"pic_#{i}\"\n node.xpath(\".//draw:image\").each do |draw_image|\n if !draw_image.attribute('href').nil?\n href = draw_image.attribute('href').value\n end\n unless href.to_s.empty?\n @global_image_paths_set.add(href) \n end\n end\n end\n end", "def image_names\n images.map { |i| i.name }.join(\"|\")\n end", "def images_for_mushroom_app # :nologin: :norobots:\n minimum_confidence = params[:minimum_confidence].blank? ? 1.5 : params[:minimum_confidence]\n minimum_quality = params[:minimum_quality].blank? ? 2.0 : params[:minimum_quality]\n target_width = params[:target_width].blank? ? 400 : params[:target_width]\n target_height = params[:target_height].blank? ? 600 : params[:target_height]\n minimum_width = params[:minimum_width].blank? ? target_width : params[:minimum_width]\n minimum_height = params[:minimum_height].blank? ? target_height : params[:minimum_height]\n confidence_reward = params[:confidence_reward].blank? ? 2.0 : params[:confidence_reward]\n quality_reward = params[:quality_reward].blank? ? 1.0 : params[:quality_reward]\n ratio_penalty = params[:ratio_penalty].blank? ? 0.5 : params[:ratio_penalty]\n\n # Last term in ORDER BY spec below penalizes images of the wrong aspect ratio.\n # If we wanted 600x400 it will penalize 400x400 images by 'ratio_penalty'.\n ratio_penalty = ratio_penalty.to_f / Math.log10(600.0/400)\n\n names = get_list_of_names(params[:names])\n names = names.map {|n| \"'\" + n.gsub(/'/, '\\\\\\'') + \"'\"}.join(',')\n\n data = Name.connection.select_rows(%(\n SELECT y.name, y.id, y.width, y.height\n FROM (\n SELECT x.text_name AS name, i.id AS id, i.width AS width, i.height AS height\n FROM (\n SELECT DISTINCT n1.text_name AS text_name, n2.id AS name_id\n FROM names n1\n JOIN names n2 ON IF(n1.synonym_id IS NULL, n2.id = n1.id, n2.synonym_id = n1.synonym_id)\n WHERE n1.rank = 'Species' AND n1.text_name IN (#{names})\n ) AS x, observations o, images i\n WHERE o.name_id = x.name_id\n AND i.id = o.thumb_image_id\n AND o.vote_cache >= #{minimum_confidence}\n AND i.vote_cache >= #{minimum_quality}\n AND i.width >= #{minimum_width} AND i.height >= #{minimum_height}\n ORDER BY\n o.vote_cache * #{confidence_reward} +\n i.vote_cache * #{quality_reward} -\n ABS(LOG(width/height) - #{Math.log10(target_width.to_f/target_height)}) * #{ratio_penalty} DESC\n ) AS y\n GROUP BY y.name\n ))\n\n if params[:test]\n render_test_image_report(data)\n else\n render_image_csv_file(data)\n end\n rescue => e\n render(:text => e.to_s, :layout => false, :status => 500)\n end", "def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend", "def image(name)\n @parts.push(image: \"#{Bioturk::Application.config.image_server_interface}#{name}\")\n end", "def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end", "def post(original_name)\n img = Magick::ImageList.new(original_name)\n if check? img\n element_name = ELEMENTS_PATH + File.basename(original_name)\n export(img, element_name)\n else\n File.delete original_name\n end\n img.destroy!\n end", "def imageNameFromUrl(url,idx)\n ImageFinder.nameForImageFromUrl(url,@start_idx,idx)\n end", "def update\n @boat_cover_image_name = BoatCoverImageName.find(params[:id])\n\n respond_to do |format|\n if @boat_cover_image_name.update_attributes(params[:boat_cover_image_name])\n format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat_cover_image_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def fileLabelPairs\n images.map{ |image| { \"url\" => File.basename(image.url), \"label\" => image.most_likely_label_text } }\n end", "def search_for_images(token, phrase)\r\n request = {\r\n :RequestHeader => { :Token => token},\r\n :SearchForImages2RequestBody => {\r\n :Query => { :SearchPhrase => phrase},\r\n :ResultOptions => {\r\n :ItemCount => 25,\r\n :ItemStartNumber => 1\r\n },\r\n :Filter => { :ImageFamilies => [\"creative\"], :Orientations => ['Horizontal']}\r\n }\r\n }\r\n response = post_json(request, \"http://connect.gettyimages.com/v1/search/SearchForImages\")\r\n\r\n #status = response[\"ResponseHeader\"][\"Status\"]\r\n #images = response[\"SearchForImagesResult\"][\"Images\"]\r\n end", "def get_image1(doc, image)\n x = doc.xpath(image).to_s\n end", "def test_foreign_images_will_not_be_converted\n data = post_book('id' => 2)\n assert_equal('http://www.example.com/images/books/calculus.jpg',\n data[0]['data']['image'])\n end", "def saveImagesFromUrls(urls)\n urls.each_with_index do |image,idx|\n name = imageNameFromUrl(image.uri, idx)\n puts \"saving... \" + name\n ImageFinder.saveImage(name,image.uri)\n end \n end", "def get_image_details(token, assetIds)\r\n\r\n request = {\r\n :RequestHeader => {\r\n :Token => token,\r\n :CoordinationId => \"MyUniqueId\"\r\n },\r\n :GetImageDetailsRequestBody => {\r\n :CountryCode => \"USA\",\r\n :ImageIds => assetIds,\r\n :Language => \"en-us\"\r\n }\r\n }\r\n\r\n response = post_json(request, \"https://connect.gettyimages.com/v1/search/GetImageDetails\")\r\n\r\n # status = response[\"ResponseHeader\"][\"Status\"]\r\n # images = response[\"GetImageDetailsResult\"][\"Images\"]\r\n end", "def image_name\n image.try(:name)\n end", "def image=(imageName)\n eachNode { |n|\n n.image = imageName\n }\n end", "def compare_images(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'SearchResultsSet')\n end", "def image_params\n params.require(:inspection).permit(:image => [])\n end", "def replace_image_tags(xml_text)\n doc = Nokogiri::XML(xml_text)\n doc.xpath(\"//image\").each { |c| c.name = \"seed_image\" }\n return doc.to_xml\n end", "def create\n @bwimage = Bwimage.new(params[:bwimage])\n\n respond_to do |format|\n if @bwimage.save\n format.html { redirect_to @bwimage, notice: 'Bwimage was successfully created.' }\n format.json { render json: @bwimage, status: :created, location: @bwimage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bwimage.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_img_names()\n if not File.exists?(@folder)\n Dir.mkdir(@folder)\n puts \"#{@folder} Directory Created\"\n end\n\t \n @files = Array.new\n img = @page.css('img')\n img.each do |i|\n nodes = i[\"src\"].split(\"/\")\n @files.push(@folder + \"/\" + nodes[nodes.length - 1])\n end\n end", "def images\n end", "def image_name=(name)\n self.image = Image.find_by(name: name)\n end", "def create\n @results = []\n\n unless params[:files].nil?\n params[:files].each do |data|\n img = Image.new\n img.filename = data.original_filename\n img.data = data.read\n img.upload_id = params[:uuid]\n img.visitation_form_id = params[:formId]\n img.image_type = params[:imageType]\n img.content_type = data.content_type\n #img.temp_index = params[:birdIndex]\n img.bird_id = params[:birdId]\n\n if !img.save\n render :json => { :errors => img.errors.full_messages }, :status => 400 and return\n else\n @results << { name: img.filename, imageType: img.image_type, id: img.id }\n end\n end\n end\n\n render json: { files: @results }\n end", "def test_local_images_converted_to_full_uri\n data = post_book('id' => 1)\n assert_equal('http://bookmarket.webhop.org/images/book/9780132990448.jpg',\n data[0]['data']['image'])\n end", "def images; end", "def detect_labels path_to_image_file:\n# [START detect_labels]\n # [START importing_libraries]\n require \"google/cloud/vision\"\n # [END importing_libraries]\n\n # [START create_vision_client]\n vision = Google::Cloud::Vision.new\n # [END create_vision_client]\n\n # [START annotate_image]\n image = vision.image path_to_image_file\n annotation = vision.annotate image, labels: true\n labels = annotation.labels\n # [END annotate_image]\n\n # [START print_labels]\n puts \"Image labels:\"\n labels.each do |label|\n puts label.description\n end\n # [END print_labels]\n# [END detect_labels]\nend", "def create\n @boat = Boat.new(boat_params)\n @boat.owner_name = current_user.first_name + ' ' + current_user.last_name\n @boat.ownerid = current_user.id\n @boat.file_link = params[:boat][:file_position]\n @boat.video_link = params[:boat][:video_position]\n\n respond_to do |format|\n\n if @boat.save\n params[:boat_attachments]['image'].each do |a|\n @boat_attachment = @boat.boat_attachments.create!(:image => a)\n end\n #below notice will cause strange position for rent button, will fix this later\n #format.html { redirect_to @boat, notice: 'Boat was successfully created.' }\n format.html { redirect_to @boat}\n format.json { render :show, status: :created, location: @boat }\n else\n format.html { render :new }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create_image_features(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, nil)\n nil\n end", "def create\n @image = Image.new(image_params)\n\n # fetch tags from google vision API\n helpers.fetch_tags(image_params)\n\n @image.image_file.attach(image_params[:image_file])\n\n respond_to do |format|\n if @image.save()\n format.html { redirect_to @image, notice: \"Image was successfully created.\" }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def single_image\n page_number = 1\n\n input_image_path = \"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/page#{page_number}.jpg\"\n image = Magick::Image.read(input_image_path)[0]\n json_path =\"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/output-#{page_number}-to-#{page_number}.json\"\n json_text = File.read(json_path)\n json = JSON.parse(json_text)\n\n bounding_box = json[\"responses\"].first[\"textAnnotations\"][1][\"boundingPoly\"]\n vertices = bounding_box[\"vertices\"]\n\n draw = Magick::Draw.new\n\n # For drawing boxes around all words.\n # text_annotations = json[\"responses\"].first[\"textAnnotations\"][1..-1]\n # text_annotations.each do |text_annotation|\n # bounding_box = text_annotation[\"boundingPoly\"]\n # vertices = bounding_box[\"vertices\"]\n\n # p1 = [ vertices[0]['x'], vertices[0]['y'] ]\n # p2 = [ vertices[1]['x'], vertices[1]['y'] ]\n # p3 = [ vertices[3]['x'], vertices[3]['y'] ]\n # p4 = [ vertices[2]['x'], vertices[2]['y'] ]\n\n # draw.line(p1[0],p1[1], p2[0], p2[1])\n # draw.line(p1[0],p1[1], p3[0], p3[1])\n # draw.line(p2[0],p2[1], p4[0], p4[1])\n # draw.line(p3[0],p3[1], p4[0], p4[1])\n # end\n\n # For drawing colored boxes around all symbols\n\n confidence_symbols_to_colors = {\n very_confidence: '#BED1D8',\n moderately_confidence: '#FFAE03',\n sort_of_confidence: '#E67F0D',\n low_confidence: '#E9190F'\n }\n\n numbers_to_confidence_symbols = {\n 80..100 => :very_confidence,\n 50..80 => :moderately_confidence,\n 31..50 => :sort_of_confidence,\n 0..30 => :low_confidence\n }\n\n pages = json[\"responses\"].first[\"fullTextAnnotation\"]['pages']\n blocks = pages.map{|p| p['blocks'] }.flatten.compact\n paragraphs = blocks.map{|b| b['paragraphs'] }.flatten.compact\n words = paragraphs.map{|p| p['words'] }.flatten.compact\n symbols = words.map{|w| w['symbols'] }.flatten.compact\n symbol_total = symbols.count\n symbols.each.with_index do |symbol, index|\n puts \"Processing symbol #{index} of #{symbol_count}\"\n bounding_box = symbol[\"boundingBox\"]\n vertices = bounding_box[\"vertices\"]\n confidence_number = (symbol['confidence'] * 100).to_i\n confidence_symbol = numbers_to_confidence_symbols.select{|n| n === confidence_number }.values.first\n color = confidence_symbols_to_colors[confidence_symbol]\n\n draw.stroke(color)\n draw.stroke_width(5)\n\n p1 = [ vertices[0]['x'], vertices[0]['y'] ]\n p2 = [ vertices[1]['x'], vertices[1]['y'] ]\n p3 = [ vertices[3]['x'], vertices[3]['y'] ]\n p4 = [ vertices[2]['x'], vertices[2]['y'] ]\n\n draw.line(p1[0],p1[1], p2[0], p2[1])\n draw.line(p1[0],p1[1], p3[0], p3[1])\n draw.line(p2[0],p2[1], p4[0], p4[1])\n draw.line(p3[0],p3[1], p4[0], p4[1])\n\n draw.draw(image)\n end\n output_image_path = \"/Users/kyle/Dropbox/code/kyletolle/handwriting_transcription/page#{page_number}.5px.symbols.jpg\"\n image.write(output_image_path)\nend", "def finderlabels\n %w{ Image Title Description }\n end", "def image_names(arr)\narr.map{|x|case when x[0]==\"H\" then \"hearts_\"+x[1..2]+\".jpg\"\nwhen x[0]==\"S\" then \"spades_\"+x[1..2]+\".jpg\"\nwhen x[0]==\"C\" then \"clubs_\"+x[1..2]+\".jpg\"\nwhen x[0]==\"D\" then \"diamonds_\"+x[1..2]+\".jpg\"\nend}\nend", "def parse_photo_request_reponse_xml\n logger.debug('PARSING FILES.')\n Dir.glob(File.join(LOCAL_DIR, FILE_EXTN)).each do |file|\n begin\n doc = Nokogiri::XML.parse(File.open(file)) { |xml| xml.noblanks }\n parse_xml(doc)\n rescue StandardError? => e\n logger.debug('Error is processing file ' + file + ' ' + e.message)\n next\n end\n end\n puts salsify_ids_map\n logger.debug('PARSING COMPLETED.')\n end", "def image_name\n setting.data[\"image\"]\n end", "def test_fb_sign_up_and_upload_monkey_image\n # Step 1\n @user.email = @fb_user['email']\n login_fb_user!(@fb_user, @user)\n\n # Step 2\n assign_http(Config[\"panda\"][\"host\"])\n\n opts = { 'vrid' => @user.vrid }\n\n get_consumer_search_resp('ramen', 'glendale, ca', opts)\n assert_response(@response, :success)\n\n listing = @parsed_response['SearchResult']['BusinessListings'].first\n int_xxid = listing['Int_Xxid']\n\n # Step 3\n assign_http(Config[\"monkey\"][\"host\"])\n\n headers = { 'Content-Type' => 'image/jpg' }\n\n params = {\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'oauth_token' => @user.oauth_token,\n 'metadata' => {\n 'user_type' => 'xx'\n }\n }\n\n put_file \"/b_image\", params, generate_random_image, headers\n assert_response(@response, :success)\n\n sha1 = @parsed_response['id']\n\n params = {\n 'ext_type' => 'int_xxid',\n 'ext_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'metadata' => {\n 'user_type' => 'xx'\n }\n }\n\n post \"/b_image/#{sha1}\", params\n assert_response(@response, :success)\n\n # Step 4\n assert_image_in_consumer_business(sha1, listing)\n assert_image_in_profile(sha1, @user)\n\n # Step 5\n assign_http(Config[\"monkey\"][\"host\"])\n\n params = {\n 'ext_type' => 'int_xxid',\n 'ext_id' => int_xxid,\n 'oauth_token' => @user.oauth_token,\n 'api_key' => Config[\"monkey\"][\"api_key\"],\n 'reason' => 6\n }\n\n post \"/b_image/#{sha1}/int_xxid/#{int_xxid}/report\", params\n assert_response(@response, :success)\n\n params = { 'api_key' => Config[\"monkey\"][\"api_key\"] }\n\n get \"/business/images/#{int_xxid}\", params\n assert_response(@response, :success)\n refute_empty(@parsed_response[int_xxid],\n \"Expected response for int_xxid #{int_xxid} to not be empty: #{@parsed_response}\")\n refute(@parsed_response[int_xxid].map { |images| images['id'] }.include?(sha1),\n \"Expected image removed from list after delete: #{sha1}\")\n end", "def create\n flash[:notice] = 'Image Created' if @owner.images << @image\n respond_with @owner, @image\n end", "def find_images_by_tags(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'SearchResultsSet')\n end", "def named_image(name)\n card = named(name)\n return card['image_uris']['normal']\n end", "def generate_images\n Docsplit.extract_images(@files.to_s)\n end", "def bulk_upload_images\n submissions = []\n params[:file].each do |key, image|\n registration_params = permitted_params.merge(image: image)\n \n @registration = Registration.new(registration_params)\n\n if @registration.save\n submissions << \"Image number #{key.to_i + 1}, upload sucessful\"\n else\n submissions << \"Image number #{key.to_i + 1}, upload unsucessful: #{@registration.errors.messages}\"\n end\n end\n submissions\n end", "def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end", "def images_select_album_create_render\n @images_ids = []\n images_ids = params[:image_ids]\n images_ids.each do |image_id|\n if image_id[-1] == \"&\"\n image_id[-1]=\"\"\n end\n @images_ids << image_id\n end\n end", "def image_name\n path = \"sets/#{set}/#{dimension}_#{polarity}_#{verbal}\"\n # Rails.application.assets.find_asset(path).nil? ? 'placeholder' : path\n path\n end", "def postEntityImageBy_url( entity_id, image_url, image_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['image_url'] = image_url\n params['image_name'] = image_name\n return doCurl(\"post\",\"/entity/image/by_url\",params)\n end", "def label_with_blanks\n ImageLabel.transaction do\n image_labels.each do |il|\n il.target = \"[]\";\n il.save\n end\n end\n end", "def create\n if params[:cover][:special_attribute] == 'covershot'\n @current_user_cover_pics = current_user.covers.where(upload_type: 'cover')\n @current_user_cover_pics.each do |s|\n if s.special_attribute == 'covershot'\n s.update_attribute(:special_attribute, '')\n s.save\n end\n end \n end\n \n @cover = Cover.new(cover_params)\n @cover.user_id = current_user.id\n @cover.save\n\n render 'crop'\n end", "def create_image_tag(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, nil)\n nil\n end", "def image_cover_save\n result = RestaurantManage.image_cover_save(@restaurant, params[:cover_id])\n get_restaurant()\n render json: result\n end", "def create\n msg = \"\"\n if params[:client_images].present?\n params[:client_images].split(\",\").each do |image_ur|\n if @client.client_images.where(stage_id: params[:client_image][:stage_id]).count < 10\n params[:client_image][:file] = image_ur\n client_image = @client.client_images.new(client_image_params)\n client_image.save\n else\n msg = \"Client has only 10 client images per stage\"\n break\n end\n end\n else\n msg = \"Please choose the images\"\n end\n\n notice = msg.present? ? msg : \"Client images were successfully created.\"\n\n if params[:manage_image]\n respond_to do |format|\n format.html { redirect_to client_client_images_path(params[:client_id], stage_id: params[:client_image][:stage_id]), notice: notice }\n # format.json { render :show, status: :created, location: @client_image }\n end\n else\n respond_to do |format|\n format.html { redirect_to redirect_panel_path, notice: notice }\n # format.json { render :show, status: :created, location: @client_image }\n end\n end\n end", "def make_request(img_paths)\n # Load contents of the imagefiles and instantiate Google::Apis::VisionV1::Image objects\n img_data = img_paths.map { |p| File.open(p).read }\n images = img_data.map { |d| Vision::Image.new(content: d)}\n\n # Maximum of 5 labels per image\n features = [ Vision::Feature.new(max_results: 5, type: 'LABEL_DETECTION') ]\n\n # Instantiate individual annotation API requests for each image\n requests = images.map { |i| Vision::AnnotateImageRequest.new(image: i, features: features) }\n\n # Combine requests into a single batch - max of 50\n batch_request = Vision::BatchAnnotateImagesRequest.new(requests: requests)\n end", "def images\n @picturesandmeta = Pictureandmeta.all\n @kind = Kind.find(params[:kind_id])\n Rails.logger.info(\"Kind: #{@kind.inspect}\")\n end", "def create\n @image_attrib = ImageAttrib.new(image_attrib_params)\n\n if @image_attrib.save\n render :show, status: :created, location: @image_attrib\n else\n render json: @image_attrib.errors, status: :unprocessable_entity\n end\n end", "def create\n name = params[:name]\n file = params[:img]\n\n f1 = file.read if file != nil\n f1.split(\"\\r\\n\").each{|line|\n if line.split(\",\").size == 4\n arr = line.split(\",\")\n subscriber = Subscriber.new\n subscriber.add_name(arr[0],arr[1],arr[2],arr[3])\n end\n }\n name.split(\"\\r\\n\").each{|line|\n if line.split(\",\").size == 4\n arr = line.split(\",\")\n subscriber = Subscriber.new\n subscriber.add_name(arr[0],arr[1],arr[2],arr[3])\n end\n }\n\n redirect_to \"/admin/home\"\n end", "def set_normal_image\n self.image_normal = 'pets/' + name.downcase + '.png'\n end", "def upload_image!(filename)\n client.post_image(\"categories/#{id}/image\", filename)\n end", "def admin_add_stock_cover_image_list\n %w( tt_add_stock_cover_image_list@booktrope.com )\n end", "def create\n\n\n @img_info = ImgInfo.new \n @img_info.img_url=upload_file(params[:img_info]['imgdata']);\n \n respond_to do |format|\n if @img_info.save\n flash[:notice] = 'ImgInfo was successfully created.'\n format.html { redirect_to(@img_info) }\n format.xml { render :xml => @img_info, :status => :created, :location => @img_info }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @img_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @used_bike = UsedBike.new(used_bike_params)\n\n if @used_bike.save\n adding_images(params)\n render json: @used_bike, status: :created, serializer: Web::V1::UsedBikeSerializer\n else\n render json: @used_bike.errors, status: :unprocessable_entity\n end\n end", "def create_listing_image(params)\n image = self.listing_images.create!(params)\n image.update_attributes(publicly_visible: false, category: 'home', caption: '')\n\n image\n end", "def add_image(data)\n regex = /(?<=ppageno\\s0'>)/\n data.gsub(regex) {\"\\n<img src='/page_images/#{self.filename}.jpg'>\"}\n end", "def post_file_to_server id, content, size, page_count, extension = \".jpg\"\n\n @s.execute_file_post @s.url_for(\"system/pool/createfile.#{id}.page#{page_count}-#{size}\"), \"thumbnail\", \"thumbnail\", content, related_mimetype(extension)\n alt_url = @s.url_for(\"p/#{id}/page#{page_count}.#{size}\" + extension)\n @s.execute_post alt_url, {\"sakai:excludeSearch\" => true}\n log \"Uploaded image to curl #{alt_url}\"\nend", "def create\r\n @family = Family.new(family_params)\r\n @image = @family.images.new\r\n @image.generate_filename\r\n @uploaded_io = params[:family][:uploaded_file]\r\n\r\n File.open(Rails.root.join('public', 'images', @image.filename), 'wb') do |file|\r\n file.write(@uploaded_io.read)\r\n end\r\n\r\n respond_to do |format|\r\n if @family.save\r\n format.html { redirect_to @family, notice: 'Family was successfully created.' }\r\n format.json { render :show, status: :created, location: @family }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @family.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def image(hash={})\n\t\tif hash['id'] =~ /nsys|Hand|Arm|Leg|Eye|back|abdomen|chest|head|neck/o\n\t\t\tStatus.sf_update(hash['id'], hash['name'])\n\t\tend\n\tend", "def create_image_files_where_needed()\n @file_info.data.each do |line|\n uri, filename = line\n process_file_info(uri, filename)\n end\n end", "def postEntityImage( entity_id, filedata, image_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['filedata'] = filedata\n params['image_name'] = image_name\n return doCurl(\"post\",\"/entity/image\",params)\n end", "def create\n @album = Album.new(params[:album])\n \n respond_to do |format|\n images = [params[:images]].flatten\n @album.images << Image.find(images) unless images[0].nil?\n \n if @album.save\n format.html { redirect_to(albums_path, :notice => 'Album was successfully created.') }\n format.xml { render :xml => albums_path, :status => :created, :location => @album }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n tags = params[:image][:tags] \n params[:image].delete(\"tags\")\n @image = Image.new(params[:image])\n \n respond_to do |format|\n if @image.save\n @image.tag_with tags\n flash[:notice] = 'Image was successfully created.'\n format.html { redirect_to([:admin, @image]) }\n format.xml { render :xml => @image, :status => :created, :location => @image }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def boat_params\n params.require(:boat).permit(:name, :image)\n end", "def tag_image_id name, pages = 1\n url = API + \"tags/#{name}/media/recent/?access_token=\" + @access_token\n pages.times do\n get(url)['data'].map do |image|\n unless image['user_has_liked']\n @image_ids << image['id']\n end\n end\n url = get(url)['pagination']['next_url']\n end\n export(@image_id_list, @image_ids)\n end", "def make_badge( badge_text, deal )\n\n badge_text = badge_text.gsub('\"', \"\").gsub(\"'\", \"\").strip # take out single and double ticks\n badge_text = \"'\" << badge_text << \"'\" # enclose in single ticks\n badge_text = badge_text.gsub(\"$\", \"\\\\$\").gsub(\"/\", \"\") # take out forward and backslashes\n\n # img = MiniMagick::Image.open(\"public/images/yellow_starburst.jpg\")\n img = MiniMagick::Image.open(\"app/assets/images/yellow_starburst.jpg\")\n\n img.combine_options do |c|\n c.resize \"#{Victoria::Application::BADGE[0]}x#{Victoria::Application::BADGE[1]}\" # \"75x75\"\n c.gravity \"Center\"\n c.antialias\n c.font \"helvetica italic\"\n c.pointsize \"18\"\n c.draw \"text 0,0 #{badge_text}\" # 0,0 = x,y coords\n c.fill(\"#000000\")\n end\n # badge_path = \"badges/badge_#{deal.id}.jpg\"\n badge_path = \"badge_#{deal.id}.jpg\"\n deal.update_attribute(:badge_path, badge_path)\n # img.write(\"public/images/#{badge_path}\")\n img.write(\"app/assets/badges/#{badge_path}\")\n # returns \"app/assets/images/badges/badge_21.jpg JPEG 145x150 145x150+0+0 8-bit DirectClass 11.6KB 0.000u 0:00.010 \"\n end", "def images\n [\n 'crow',\n 'cow',\n 'deer',\n 'monkey',\n 'fish',\n 'frog',\n 'horse',\n 'spider',\n ]\n end", "def create_image_frame(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end", "def create\n\n require 'RMagick'\n @images_added = []\n\n # params[:design_images] is set by a js library (Dropzone.js) and defined on dynamic_pages.js paramName\n params[:design_images].each do |array_file|\n\n # uploaded file example\n # {\"0\"=>#<ActionDispatch::Http::UploadedFile:0x007f88cf70b728 @tempfile=#<Tempfile:/var/folders/tx/fcpjq87x6b19sl3dvvm8fr040000gn/T/RackMultipart20150803-99318-18nmoiu.jpg>, @original_filename=\"10881656_10201963394846606_706439852029346946_n.jpg\", @content_type=\"image/jpeg\", @headers=\"Content-Disposition: form-data; name=\\\"singular_design[0]\\\"; filename=\\\"10881656_10201963394846606_706439852029346946_n.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\">, \"1\"=>#<ActionDispatch::Http::UploadedFile:0x007f88cf70b610 @tempfile=#<Tempfile:/var/folders/tx/fcpjq87x6b19sl3dvvm8fr040000gn/T/RackMultipart20150803-99318-1loctd5.jpg>, @original_filename=\"11062261_825163280904553_6934851262428256525_n.jpg\", @content_type=\"image/jpeg\", @headers=\"Content-Disposition: form-data; name=\\\"singular_design[1]\\\"; filename=\\\"11062261_825163280904553_6934851262428256525_n.jpg\\\"\\r\\nContent-Type: image/jpeg\\r\\n\">}\n\n uploaded_file = array_file.last\n\n # file checking (size and filetype)\n return false if !valid_img? uploaded_file\n\n # main image random filename\n random_filename = build_filename(uploaded_file)\n\n image = Magick::Image.from_blob(uploaded_file.read).first\n original_width = image.columns # columns are pixels\n original_height = image.rows # rows are pixels\n\n # just resize if image is larger in width\n image = image.resize_to_fit(2000, original_height) if original_width >= 2000\n image.write(Rails.root.join('public', 'assets', 'uploads','designs', random_filename))\n\n # thumbnail image random filename\n thumb_random_filename = build_filename(uploaded_file, true)\n thumbnail = image.resize_to_fill(250, 150)\n thumbnail.write(Rails.root.join('public', 'assets', 'uploads','designs', thumb_random_filename))\n\n # generating link for this new design\n random_link = SecureRandom.hex(4)\n\n while Design.exists?(link: random_link) == true do random_link = SecureRandom.hex(4) end\n\n @design = Design.new(user_id: current_user.id,\n link: random_link,\n image_path: random_filename,\n image_thumb_path: thumb_random_filename)\n\n @images_added << @design if @design.save\n end\n\n respond_to do |format|\n format.html { redirect_to :individuais }\n format.json { render json: @images_added }\n end\n end", "def add_search_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, nil)\n nil\n end", "def create\n @image_set = ImageSet.new(params[:image_set])\n\n respond_to do |format|\n if @image_set.save\n flash[:notice] = 'ImageSet was successfully created.'\n format.html { redirect_to(@image_set) }\n format.xml { render :xml => @image_set, :status => :created, :location => @image_set }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rent = Rent.new(rent_params)\n @rentpar = rent_params\n respond_to do |format|\n if @rent.save\n\n if params[:image]\n puts params[:image]\n params[:image].each { |image|\n @rent.rent_images.create(rent_id: @rent.id, image:image)\n }\n \n end\n\n format.html { redirect_to @rent, notice: 'Rent was successfully created.' }\n format.json { render :show, status: :created, location: @rent }\n else\n format.html { render :new }\n format.json { render json: @rent.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @images = @owner.images\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @images }\n end\n end", "def add_image(image_node)\n\t nodeset = self.find_by_terms(:vra)\n\t image_node.first.add_namespace_definition(\"vra\",\"http://www.vraweb.org/vracore4.htm\")\n\t nodeset.first.add_child(image_node)\n self.content = self.ng_xml.to_s\n return nodeset\n end", "def index\n # show the categories for a image\n flash[:notice] = \"Image has (#{@categories.size}) categories.\"\n respond_to do |format|\n format.html # index.html\n format.xml { render :xml => @categories }\n end\n end", "def postBusiness_toolImage( tool_id, filedata)\n params = Hash.new\n params['tool_id'] = tool_id\n params['filedata'] = filedata\n return doCurl(\"post\",\"/business_tool/image\",params)\n end", "def file_name\n \"images/#{@name}.msf\"\n end", "def test_add_mugshot\n\n # Create image directory and populate with test images.\n setup_image_dirs\n\n # Open file we want to upload.\n file = FilePlus.new(\"#{RAILS_ROOT}/test/fixtures/images/sticky.jpg\")\n file.content_type = 'image/jpeg'\n\n # It should create a new image: this is the current number of images.\n num_images = Image.count\n\n # Post form.\n params = {\n :user => {\n :name => @rolf.name,\n :place_name => '',\n :notes => '',\n :upload_image => file,\n :mailing_address => @rolf.mailing_address,\n },\n :copyright_holder => 'Someone Else',\n :upload => { :license_id => licenses(:ccnc25).id },\n :date => { :copyright_year => \"2003\" },\n }\n post_requires_login(:profile, params)\n assert_response(:controller => :observer, :action => :show_user, :id => 1)\n assert_flash_success\n\n @rolf.reload\n assert_equal(num_images+1, Image.count)\n assert_equal(Image.last.id, @rolf.image_id)\n assert_equal(\"Someone Else\", @rolf.image.copyright_holder)\n assert_equal(2003, @rolf.image.when.year)\n assert_equal(licenses(:ccnc25), @rolf.image.license)\n end", "def img_params\n\n end", "def create\n @banner_img = BannerImg.new(params[:banner_img])\n\n respond_to do |format|\n if @banner_img.save\n format.html { redirect_to @banner_img, notice: 'Banner img was successfully created.' }\n format.json { render json: @banner_img, status: :created, location: @banner_img }\n else\n format.html { render action: \"new\" }\n format.json { render json: @banner_img.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @image = Image.new(params[:image])\n @image.description = Description.new(params[:description]) if @image.description == nil\n @image.image_shell = ImageShell.find(params[:image_shell][:image_shell_id]) if params[:image_shell]\n \n if params[:request]\n r = Request.find(params[:request][:request_id])\n r.action_was_taken!\n @image.owner_request = r\n end\n \n respond_to do |format|\n if @image.save\n flash[:notice] = (@image.owner_request) ? \"We'll review your modifications and get back to you.\" : 'Image was successfully created.'\n format.html { redirect_to(@image) }\n format.xml { render :xml => @image, :status => :created, :location => @image }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @location = Location.new(location_params)\n\n respond_to do |format|\n if @location.save\n \n if params[:avatars]\n #===== The magic is here ;)\n params[:avatars].each { |avatar|\n @location.assets.create(avatar: avatar)\n }\n end\n\n format.html { redirect_to @location, notice: 'Gallery was successfully created.' }\n format.json { render json: @location, status: :created, location: @location }\n else\n format.html { render action: \"new\" }\n format.json { render json: @location.errors, status: :unprocessable_entity }\n end\n end\nend", "def get_message(images)\n names = images.map { |i| i.original_filename}\n \"Add #{ActionController::Base.helpers.pluralize(images.size, 'image')}\"\\\n \": #{names.to_sentence}\"\n end", "def get_message(images)\n names = images.map { |i| i.original_filename}\n \"Add #{ActionController::Base.helpers.pluralize(images.size, 'image')}\"\\\n \": #{names.to_sentence}\"\n end" ]
[ "0.6304909", "0.57786286", "0.5602623", "0.5442955", "0.5386451", "0.53202754", "0.53161", "0.53149563", "0.5314771", "0.5312919", "0.52604645", "0.52012485", "0.51891476", "0.51670563", "0.51473266", "0.51471937", "0.5112985", "0.5053737", "0.5048726", "0.503603", "0.50213337", "0.49971426", "0.4987968", "0.49742126", "0.4958466", "0.4956609", "0.49563703", "0.49489477", "0.4946024", "0.49418283", "0.49333167", "0.49315152", "0.49260217", "0.49180737", "0.49038124", "0.49026802", "0.48981836", "0.48974493", "0.4896383", "0.48775437", "0.48666576", "0.48661768", "0.48648193", "0.4864797", "0.48609263", "0.48599973", "0.48562804", "0.48526397", "0.48492685", "0.48484123", "0.48441318", "0.4838597", "0.48384434", "0.48369312", "0.48324057", "0.481301", "0.4808744", "0.48082352", "0.48081666", "0.48071465", "0.4805928", "0.4799138", "0.47988448", "0.47977197", "0.4794009", "0.47933194", "0.47844616", "0.47828773", "0.47799882", "0.477718", "0.47739536", "0.477374", "0.47696632", "0.47639057", "0.47614193", "0.4760862", "0.47603157", "0.47569093", "0.4753401", "0.4749582", "0.47472763", "0.4744494", "0.47442207", "0.47441575", "0.47338298", "0.473018", "0.47299516", "0.4729854", "0.4722681", "0.47201684", "0.47148716", "0.47136042", "0.47102818", "0.4707731", "0.47067577", "0.469965", "0.46975017", "0.46950164", "0.46946317", "0.46946317" ]
0.60576284
1
PUT /boat_cover_image_names/1 PUT /boat_cover_image_names/1.xml
def update @boat_cover_image_name = BoatCoverImageName.find(params[:id]) respond_to do |format| if @boat_cover_image_name.update_attributes(params[:boat_cover_image_name]) format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @boat_cover_image_name.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end", "def update_name(new_name)\n ensure_uri\n response = @client.rest_put(@data['uri'], 'body' => { 'name' => new_name, 'type' => 'ArtifactsBundle' })\n @client.response_handler(response)\n @data['name'] = new_name\n true\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n b = Bubo.from_heroku\n b.remove_image(@image.id.to_s)\n b.add_image(@image.id.to_s, @image.url)\n \n format.html { redirect_to(@image, :notice => 'Image was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @boat_cover_image_name = BoatCoverImageName.find(params[:id])\n @boat_cover_image_name.destroy\n\n respond_to do |format|\n format.html { redirect_to(boat_cover_image_names_url) }\n format.xml { head :ok }\n end\n end", "def update\n\n params = image_params\n params[\"tags\"] = params[\"tags\"].delete_suffix(',')\n\n respond_to do |format|\n if @image.update(params)\n format.html { redirect_to @image, notice: \"Image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def create\n @boat_cover_image_name = BoatCoverImageName.new(params[:boat_cover_image_name])\n\n respond_to do |format|\n if @boat_cover_image_name.save\n format.html { redirect_to(@boat_cover_image_name, :notice => 'Boat cover image name was successfully created.') }\n format.xml { render :xml => @boat_cover_image_name, :status => :created, :location => @boat_cover_image_name }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @boat_cover_image_name.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rename\n\t\tresult = Investor.update_name(params[:id], params[:name], params[:avatar_id])\n\n\t\treturn render json: result if result[:status] != 0\n\n\t\trender json: { status: 0, avatar_url: result[:result].avatar.url(:thumb) }\n\tend", "def update\n respond_to do |format|\n if @food.update(food_params)\n\n puts name = get_barcode_info(@food.picture.path.to_s)\n\n @food.update!(:name => name)\n\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @boat_cover_image_name = BoatCoverImageName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @boat_cover_image_name }\n end\n end", "def update\n @used_bike = UsedBike.find(params[:id])\n\n if @used_bike.update(used_bike_params)\n adding_images(params)\n head :no_content\n else\n render json: @used_bike.errors, status: :unprocessable_entity\n end\n end", "def image_name=(name)\n self.image = Image.find_by(name: name)\n end", "def update\n @food.build_image(params['image']) do |t|\n if params['food']['image']['data']\n t.data = Base64.encode64(params['food']['image']['data'].read)\n t.filename = params['food']['image']['data'].original_filename\n t.mime_type = params['food']['image']['data'].content_type\n end\n end \n @food.name = @food.name.capitalize\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n new_images = params[:images]||[]\n\n @intention = Intention.find_by_uuid(params[:id])\n @intention.image_urls = IntentionsHelper.strip_duplicate_images(new_images)\n @intention.save\n\n points = VISBD_INTENTION_IMAGE_POINTS*new_images.count\n track_event(current_action_item(Intention::COMPONENT_TYPE)||current_enrollment, Intention::VISUALIZED_EVENT, target:@intention, points:points)\n\n render nothing: true\n end", "def update_image image\n temp_path = @image_folder.detect{|image_string| image_string.downcase == \"#{@image_path}/#{image.image_file_name}\".downcase}\n filename = File.basename(temp_path)\n image.image_number = @img_count\n\n @img_count += 1\n if temp_path.blank?\n InputBatch::Log.status_log.error \">>>>>>>>Image #{filename} not found<<<<<<<<<\"\n puts \">>>>>>>>>>>>Image #{filename} not found\"\n InputBatch::Log.error_log.error \"Error on line #{@row_index} : Image #{filename} not found\"\n else\n InputBatch::Log.status_log.info \"Image #{filename} found\"\n image.page_count = %x[identify #{temp_path}].split(filename).length-1 rescue nil\n end\n\n rename_image image if facility.index_file_parser_type == \"WellsFargo_bank\"\n return image\n end", "def new\n @boat_cover_image_name = BoatCoverImageName.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @boat_cover_image_name }\n end\n end", "def update_good_images(arg)\n # Get list of images first.\n images = (arg || \"\").split(\" \").map do |id|\n Image.safe_find(id.to_i)\n end.reject(&:nil?)\n\n # Now check for edits.\n images.each do |image|\n next unless check_permission(image)\n args = param_lookup([:good_image, image.id.to_s])\n next unless args\n image.attributes = args\n next unless image.when_changed? ||\n image.notes_changed? ||\n image.copyright_holder_changed? ||\n image.license_id_changed? ||\n image.original_name_changed?\n image.updated_at = Time.now\n args = { id: image }\n args[:set_date] = image.when if image.when_changed?\n args[:set_notes] = image.notes if image.notes_changed?\n if image.copyright_holder_changed?\n args[:set_copyright_holder] = image.copyright_holder\n end\n args[:set_license] = image.license if image.license_id_changed?\n if image.original_name_changed?\n args[:set_original_name] = image.original_name\n end\n if image.save\n Transaction.put_image(args)\n flash_notice(:runtime_image_updated_notes.t(id: image.id))\n else\n flash_object_errors(image)\n end\n end\n\n images\n end", "def update\n respond_to do |format|\n if @image_label_set.update(image_label_set_params)\n format.html { redirect_to @image_label_set, notice: 'Image label set was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_label_set }\n else\n format.html { render :edit }\n format.json { render json: @image_label_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n unless params[:image][:tags].nil?\n @image.tag_with params[:image]['tags']\n params[:image].delete(\"tags\")\n end\n respond_to do |format|\n if @image.update_attributes(params[:image])\n flash[:notice] = 'Image was successfully updated.'\n format.html { redirect_to([:admin, @image]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @family_image = FamilyImage.find(params[:id])\n\n if @family_image.update(family_image_params)\n head :no_content\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end", "def post_rename(old_name,repo,data)\n curl_post(\"#{self.host}/api2/repos/#{repo}/file/?p=#{old_name}\",data).body_str\n end", "def image=(imageName)\n eachNode { |n|\n n.image = imageName\n }\n end", "def update\n @boat = Boat.find(params[:id])\n @boat.update({\n name: params[:boat][:name],\n maxcontainers: params[:boat][:maxcontainers],\n company_id: params[:boat][:company_id],\n location: params[:boat][:location],\n image: params[:boat][:image]\n })\n\n if (@boat)\n redirect_to url_for(:controller => :boats, :action => :index)\n else\n redirect_to url_for(:controller => :boats, :action => :edit)\n end\n end", "def update\r\n @album = Album.find(params[:id])\r\n if params[:album][:coverpage]\r\n tem_coverPage = upload_file(params[:album][:coverpage],\"app/assets/images/album_images\")\r\n params[:album][:coverpage] = \"album_images/\"+tem_coverPage\r\n end\r\n\r\n respond_to do |format|\r\n\r\n if @album.update_attributes(params[:album])\r\n format.html { redirect_to @album, notice: 'Album 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: @album.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @image_set = ImageSet.find(params[:id])\n\n respond_to do |format|\n if @image_set.update_attributes(params[:image_set])\n flash[:notice] = 'ImageSet was successfully updated.'\n format.html { redirect_to(@image_set) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image_set.errors, :status => :unprocessable_entity }\n end\n end\n end", "def image(hash={})\n\t\tif hash['id'] =~ /nsys|Hand|Arm|Leg|Eye|back|abdomen|chest|head|neck/o\n\t\t\tStatus.sf_update(hash['id'], hash['name'])\n\t\tend\n\tend", "def update\n ActiveRecord::Base.transaction do\n @album.update!(name: params[:name])\n @album.album_images.destroy_all\n # 画像登録数が多くなるUIになったらSQLの負荷を減らすためにactiverecord-importを入れる\n # https://github.com/zdennis/activerecord-import\n params[:urls].each do |image_url|\n AlbumImage.create!(album_id: @album.id, url: image_url)\n end\n end\n\n render json: @album\n end", "def update_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def update_image_for_building_tag name\n unless service_config_hash[\"build\"].nil?\n service_config_hash[\"image\"]=name\n end\n \n self.image_name = service_config_hash[\"image\"]\n end", "def create\n \n @book = Book.new(book_params)\n\n respond_to do |format|\n if @book.save\n bookapi = Book.for(@book.name)\n book1 = bookapi[0]\n bookcover = book1[\"volumeInfo\"][\"imageLinks\"][\"smallThumbnail\"] \n bookdescription = book1[\"volumeInfo\"][\"description\"]\n @book.update(coverimage: bookcover, description: bookdescription) \n format.html { redirect_to @book, notice: 'Book was successfully created.' }\n \n format.json { render :show, status: :created, location: @book }\n else\n format.html { render :new }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @img_info = ImgInfo.find(params[:id])\n\n respond_to do |format|\n if @img_info.update_attributes(params[:img_info])\n flash[:notice] = 'ImgInfo was successfully updated.'\n format.html { redirect_to(@img_info) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @img_info.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n flash[:notice] = 'Image Successfully updated' if @image.update_attributes! params[:image]\n respond_with @owner, @image\n end", "def update\n @bwimage = Bwimage.find(params[:id])\n\n respond_to do |format|\n if @bwimage.update_attributes(params[:bwimage])\n format.html { redirect_to @bwimage, notice: 'Bwimage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bwimage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @album = Album.find(params[:id])\n \n respond_to do |format|\n if @album.update_attributes(params[:album])\n @album.images.clear\n @album.images << Image.find([params[:images]].flatten)\n @album.save!\n format.html { redirect_to(albums_path, :notice => 'Album was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @album.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @image_url = args[:image_url] if args.key?(:image_url)\n @name = args[:name] if args.key?(:name)\n end", "def update\n @banner_img = BannerImg.find(params[:id])\n\n respond_to do |format|\n if @banner_img.update_attributes(params[:banner_img])\n format.html { redirect_to @banner_img, notice: 'Banner img was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @banner_img.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @moto_cover_image_uid = MotoCoverImageUid.find(params[:id])\n\n respond_to do |format|\n if @moto_cover_image_uid.update_attributes(params[:moto_cover_image_uid])\n format.html { redirect_to(@moto_cover_image_uid, :notice => 'Moto cover image uid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @moto_cover_image_uid.errors, :status => :unprocessable_entity }\n end\n end\n end", "def driveNameReplace(original, name)\n folder_path = File.dirname(__FILE__) + \"/Cyclo\"\n Dir.glob(folder_path + \"/*\").sort.each do |path|\n f = File.open(path, \"r+\")\n doc = Nokogiri::XML(f)\n doc.search(\".//image\").each do |node|\n #puts node['href']\n newLink = node['href'].split('/').last\n #complete = \"file:///Users/freelance/Google Drive/Specialized Docs/_photosBIKE/#{newLink}\"\n complete = \"file:///Users/freelance/Google Drive/Specialized Docs/dump_output/#{newLink}\"\n puts complete\n #node['href'] = node['href'].gsub(original, name)\n node['href'] = complete\n end\n f.close()\n o = File.new(path, \"w\")\n o.write(doc)\n o.close()\n\n end\nend", "def update\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_search_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :PUT, nil)\n nil\n end", "def modify_bmp(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'File')\n end", "def replace_image_files(file, collection)\n FileUtils.mkpath(::File.join(file.tmp_dir, Images::IMAGE_DIR_NAME))\n \n collection.each do |name, path|\n file.update(name) do |content|\n content.replace ::File.read(path)\n end\n end\n file.update('META-INF/manifest.xml') do |manifest_file|\n txt = Nokogiri::XML(manifest_file)\n manifest_node = txt.xpath('manifest:manifest').first()\n collection.each do |name, _|\n file_text = '<manifest:file-entry manifest:full-path=\"' << name << '\"/>'\n manifest_node.add_child file_text\n end\n manifest_file.replace txt.to_s\n end\n end", "def replace_image_tags(xml_text)\n doc = Nokogiri::XML(xml_text)\n doc.xpath(\"//image\").each { |c| c.name = \"seed_image\" }\n return doc.to_xml\n end", "def update\n respond_to do |format|\n if @spot.update(spot_params)\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n\n format.html { redirect_to [ @country, @spot ] , notice: 'Spot was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n respond_to do |format|\n if @spot.update(spot_params)\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @spot.photos.create!(:image => a, :imageable_id => @spot.id)\n end\n end\n\n format.html { redirect_to [ @country, @spot ] , notice: 'Spot was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @idea = Idea.find(params[:id])\n @idea.name = params[:name]\n @idea.description = params[:description]\n repo_path = \"#{Rails.root}/public/data/repository/#{current_user.id}/#{@idea.name}\"\n cover_img_path = \"/data/repository/#{current_user.id}/#{@idea.name}\"\n\n if params[:cover_img]\n @idea.cover_img = params[:cover_img]\n DataFile.save(params[:cover_img], cover_img_path)\n\t\t\t@git = GitHelper.init(repo_path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Changed cover image.\")\n end\n\n if @idea.save\n\t\t\trender json: @idea\n\t\telse\n\t\t\trender json: {error: \"Failed to update idea\"}, status: :unauthorized\n end\n end", "def rename_image\n @renaming_image ||= note =~ Bubs::Regexp::RENAME_IMAGE_TAG ? $1 : false\n end", "def rename_image image\n begin\n File.rename(\"#{@location}/#{image.image_file_name}\", \"#{@location}/#{@bat.index_batch_number}#{image.image_file_name}\")\n image.image_file_name = \"#{@bat.index_batch_number}#{image.image_file_name}\"\n temp_path = \"#{@image_path}/#{image.image_file_name}\"\n rescue\n InputBatch::Log.error_log.error \">>>>>>>>>>>>>>>> Error while renaming image, Probably due to file name or directory mismatch <<<<<<<<<<<<<<\"\n puts \">>>>>>>>>>>>>>>> Error while renaming image, Probably due to file name or directory mismatch <<<<<<<<<<<<<<\"\n end\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n flash[:notice] = 'Image was successfully updated.'\n format.html { redirect_to(@image) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def image_name\n ovf.xpath(\"//*[local-name()='References']/*[local-name()='File']\")[0].attribute(\"href\").value\n end", "def update\n respond_to do |format|\n if @welcome_image.update_attributes(params[:welcome_image])\n format.html { redirect_to(@welcome_image,\n :notice => I18n.t('backend.actions.success_update',\n :model => I18n.t('activerecord.capitalized_models.welcome_image'))) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @welcome_image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def image_names=(names)\n self.images = []\n names = names.split(\"|\") if names.is_a?(String)\n names.each do |name|\n self.images <<= Image.find_by(name: name)\n end\n end", "def update\n Rails.logger.debug bin_params[:image]\n @bin.assign_attributes bin_params\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image_bank = ImageBank.find(params[:id])\n \n respond_to do |format|\n if @image_bank.update_attributes(params[:image_bank])\n format.html { redirect_to @image_bank, notice: 'Image bank was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_bank.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @baby_pic = BabyPic.find(params[:id])\n\n respond_to do |format|\n if @baby_pic.update_attributes(params[:baby_pic])\n format.html { redirect_to @baby_pic, notice: 'Baby pic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @baby_pic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @components_bottom_bracket = Components::BottomBracket.find(params[:id])\n\n respond_to do |format|\n \n if @components_bottom_bracket.update_attributes(params[:components_bottom_bracket])\n if @components_bottom_bracket.image_path.blank?\n @components_bottom_bracket.update_attributes(:image_path => \"components/defaults/bottom_bracket.png\")\n end\n format.html { redirect_to(@components_bottom_bracket, :notice => 'Bottom bracket was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @components_bottom_bracket.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @topic = Topic.find(params[:id])\n @topic.user_id = session[:user_id]\n @group_id = params[:topic][:group_id]\n if @group_id\n @group = Group.find(@group_id)\n end\n logger.info (\"the image is #{params[:topic][:image]}\")\n if params[:topic][:image]\n rename = @topic.save_image(params[:topic][:image])\n else\n rename = @topic.image\n end\n respond_to do |format|\n if @topic.update_attributes(:image=>rename,:group_id=>@group_id,:user_id=>session[:user_id],:title=>params[:topic][:title],\n :description=>params[:topic][:description])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n \n respond_to do |format|\n if @image.update_attributes(params[:image]) && @image.description.update_attributes(params[:description])\n flash[:notice] = 'Image was successfully updated.'\n format.html { redirect_to(@image) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_cover_image\n enforce_permissions!('manage_collection', params[:id])\n\n @object = retrieve_object!(params[:id])\n\n if params[:batch].present? && [:cover_image].present?\n cover_image = params[:batch][:cover_image]\n else\n raise DRI::Exceptions::BadRequest, t('dri.views.exceptions.file_not_found')\n end\n\n @object.object_version ||= '1'\n @object.increment_version\n\n if cover_image.present?\n saved = Storage::CoverImages.validate_and_store(cover_image, @object)\n end\n\n if saved\n # Do the preservation actions\n preservation = Preservation::Preservator.new(@object)\n preservation.preserve(false, false, ['properties'])\n end\n\n # purge params from update action\n purge_params\n\n respond_to do |format|\n if saved\n flash[:notice] = t('dri.flash.notice.updated', item: params[:id])\n else\n flash[:error] = t('dri.flash.error.cover_image_not_saved')\n end\n format.html { redirect_to controller: 'my_collections', action: 'show', id: @object.id }\n end\n end", "def update\n @request = Request.find(params[:id])\n\n if params[:images_attributes]\n if @request.update(request_params)\n if params[:images_attributes]\n params[:images_attributes]['image'].each do |a|\n @image_attachment = @request.images.create!(:picture => a, :name => 'RequestApp')\n end\n end\n\n redirect_to action: 'show'\n flash[:success] = \"Su solicitud ha sido editada con exito\"\n else\n render 'edit'\n flash.now[:danger] = \"Revise los siguentes errores\"\n end\n else\n flash.now[:danger] = \"La solicitud requiere de una imagen\"\n render 'edit'\n end\n end", "def update\n nombreImagen = SecureRandom.uuid + File.extname(contest_params[:banner].original_filename)\n carpeta = File.join(Rails.public_path, \"uploaded_images\", Time.now.strftime(\"%Y-%m-%d\"))\n rutaAbsoluta = File.join(carpeta, nombreImagen)\n FileUtils.mkdir_p(carpeta)\n File.open(rutaAbsoluta, 'wb') do |f|\n f.write(contest_params[:banner].read)\n end\n \n params[:contest][:banner] = \"/uploaded_images/\" + Time.now.strftime(\"%Y-%m-%d\") + \"/\" + nombreImagen\n params[:contest][:url] = \"http://\" + request.host + \":\" + (request.port.to_s) +\"/contests/join/\" + params[:contest][:url]\n\n respond_to do |format|\n if @contest.update(contest_params)\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { render :show, status: :ok, location: @contest }\n else\n format.html { render :edit }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @cat1 = Cat1.find(params[:id])\r\n name = params[:cat1][:pic1].original_filename if params[:cat1][:pic1]\r\n directory = 'public/img'\r\n directory_1c = 'public/images_1c'\r\n path = File.join(directory, name) if params[:cat1][:pic1]\r\n path_1c = File.join(directory_1c, name) if params[:cat1][:pic1]\r\n # if params[:cat1][:pic1].instance_of?(Tempfile)\r\n # FileUtils.cp(params[:cat1][:pic1].local_path, path)\r\n # else\r\n File.open(path, \"wb\") { |f| f.write(params[:cat1][:pic1].read) } if params[:cat1][:pic1]\r\n FileUtils.cp(path, path_1c) if params[:cat1][:pic1]\r\n # end\r\n\r\n\r\n\r\n respond_to do |format|\r\n if @cat1.update_attributes(params[:cat1])\r\n pic = name[0..-5] if name\r\n @cat1.pic1 = pic if params[:cat1][:pic1]\r\n @cat1.save\r\n flash[:notice] = 'Сохранено.'\r\n format.html { redirect_to(:back) }\r\n end\r\n end\r\n end", "def update\n if @sighting.update(sighting_params)\n image = base64_to_uploaded_file(params[:sighting][:image][:file], params[:sighting][:image][:filename])\n @sighting.image.attach(image)\n render :show, status: :ok, location: @sighting\n else\n render json: @sighting.errors, status: :unprocessable_entity\n end\n end", "def update_good_images(arg)\n # Get list of images first.\n images = (arg || \"\").split(\" \").map do |id|\n Image.safe_find(id.to_i)\n end.reject(&:nil?)\n\n # Now check for edits.\n images.each do |image|\n next unless check_permission(image)\n\n args = param_lookup([:good_image, image.id.to_s])\n next unless args\n\n image.attributes = args.permit(whitelisted_image_args)\n next unless image.when_changed? ||\n image.notes_changed? ||\n image.copyright_holder_changed? ||\n image.license_id_changed? ||\n image.original_name_changed?\n\n image.updated_at = Time.zone.now\n if image.save\n flash_notice(:runtime_image_updated_notes.t(id: image.id))\n else\n flash_object_errors(image)\n end\n end\n\n images\n end", "def update\n @image.update(image_params)\n redirect_to '/images'\n end", "def create_updated_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end", "def test_add_image_to_obs_by_id\n obs = observations(:coprinus_comatus_obs)\n updated_at = obs.updated_at\n image = images(:disconnected_coprinus_comatus_image)\n assert_not(obs.images.member?(image))\n post_requires_login(:attach, id: obs.id, img_id: image.id)\n assert_redirected_to(permanent_observation_path(obs.id))\n assert(obs.reload.images.member?(image))\n assert(updated_at != obs.updated_at)\n end", "def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n flash[:success] = 'Image was successfully updated.'\n format.html { redirect_to([:admin, @parents, :images]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @image_set\n if @image_set.update(params[:image_set].permit(:title, :description))\n # to handle multiple images upload on update when user add more pictures\n if params[:images]\n params[:images].each {|image|\n @image_set.images.create(image: image)\n }\n end\n\n flash[:notice] = \"Your image set has been updated!.\"\n redirect_to @image_set\n else\n flash[:alert] = \"Something went wrong.\"\n render 'edit'\n end\n end", "def update\n # creates tag objects for photos\n tag_array = tag_params['tags'].split(',').each do |x|\n x.strip!\n end\n tag_array.each do |x| \n if Tag.find_by(name: x)\n @tag = Tag.find_by(name: x)\n else\n @tag = Tag.create(name: x)\n end\n Tagging.create(photo_id: @photo.id, tag_id: @tag.id)\n end\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@commission.slug = nil\n if @commission.update_attributes(commission_params)\n if params[:commission_images]\n params[:commission_images].each { |commission_image| @commission.commission_images.create(path: commission_image) }\n end\n flash[:success] = \"Commission successfully updated\"\n redirect_to @commission\n else\n render :edit\n end\n end", "def update\n @image = @album.images.find(params[:id])\n @image.update(image_params)\n redirect_to album_path(@image.album.id)\n end", "def update\n respond_to do |format|\n data = snarf_image_data\n if @beverage.update(beverage_params)\n if data\n STDERR.puts \"UPDATING DATA\"\n @beverage.image_data = Base64.encode64(data)\n @beverage.save\n end\n if mid = motor_id_param\n new_motor = Motor.find(mid)\n pp new_motor.id\n pp new_motor.uuid\n @beverage.motor = new_motor if new_motor\n @beverage.save\n end\n\n format.html { redirect_to @beverage, notice: \"Beverage was successfully updated.\" }\n format.json { render :show, status: :ok, location: @beverage }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @beverage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @accessory = Accessory.find(params[:id])\n\n respond_to do |format|\n if @accessory.update_attributes(params[:accessory])\n if @accessory.image_path.blank?\n @accessory.update_attributes(:image_path => (\"accessories/default.png\"))\n end\n format.html { redirect_to(@accessory, :notice => 'Accessory was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @accessory.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_add_image_to_obs\n obs = observations(:coprinus_comatus_obs)\n updated_at = obs.updated_at\n image = images(:disconnected_coprinus_comatus_image)\n assert_not(obs.images.member?(image))\n requires_login(:reuse_image, mode: \"observation\", obs_id: obs.id,\n img_id: image.id)\n assert_redirected_to(controller: :observations, action: :show,\n id: obs.id)\n assert(obs.reload.images.member?(image))\n assert(updated_at != obs.updated_at)\n end", "def update\n @welcome = Welcome.find(params[:id])\n if params[:remove_image]\n @welcome.image.remove_image!\n end\n respond_to do |format|\n if @welcome.update_attributes(params[:welcome])\n format.html { redirect_to(@welcome, :notice => 'Welcome was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @welcome.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_image\n # wish image can be updated only when then wish belongs to current user\n if @wish.user_id == current_user.id\n @wish.image.purge\n @wish.image.attach(wish_params[:image])\n render json: url_for(@wish.image)\n end\n end", "def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end", "def update\n @img = Img.find(params[:id])\n\n respond_to do |format|\n if @img.update_attributes(params[:img])\n format.html { redirect_to(@img, :notice => 'Img was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @img.errors, :status => :unprocessable_entity }\n end\n end\n end", "def docUpdateImageTags\n puts \"Updating image tags\"\n\n # Find all files.\n n = 0\n Pathname.glob(pathDocuments() + \"**/*.html\").each do |filePath|\n n = n + 1\n puts \"Updating File \" + n.to_s + \": \" + filePath.to_s\n\t\n # Iterate over all images in the file.\n html = fileReadContent(filePath)\n html.scan(/<img.*?>/) do |imgTag|\n puts \" img: \" + imgTag\n url = docGetImageDownloadURL(imgTag)\n if url != nil then\n # Update img tag.\n parts = imgTag.split(/src=\"(.*?)\"/)\n\t\timageFileName = docGetImagePath(url, \"\")\n\t\timageFileName = imageFileName.gsub(\" \", \"%20\")\n newImgTag = parts[0] + \"src=\\\"\" + imageFileName + \"\\\"\" + parts[2]\n puts \" new img: \" + newImgTag\n # Update image tag.\n html = html.gsub(imgTag, newImgTag)\n\t else\n\t puts \" *** IMAGE IGNORED: \" + imgTag\n end\n\tend\n\n # Write the updated file.\n fileSaveContent(filePath, html)\n end\nend", "def set_normal_image\n self.image_normal = 'pets/' + name.downcase + '.png'\n end", "def update\n respond_to do |format|\n if @taxi_image.update(taxi_image_params)\n format.html { redirect_to @taxi_image, notice: 'Taxi image was successfully updated.' }\n format.json { render :show, status: :ok, location: @taxi_image }\n else\n format.html { render :edit }\n format.json { render json: @taxi_image.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @image =Image.find(params[:id])\n \t\t\n \t\t#si viene imagen en los parametros la subo\n\t\tif (params[:image][:filename])\n\t\t#traigo el nombre de la iamgen anterior al cambio\n\t\timageold = @image.filename\n\t\tprocess_image(tmp = params[:image][:filename].tempfile)\n\t\t\n\t\t#remuevo la anterior\n\t\tremove_image_file(imageold)\n\t\tend\n\t\t\n\t\t#si viene titulo nuevo lo actualizo\n\t\tif(params[:image][:title])\n\t\t@image.title = params[:image][:title]\n\t\tend\n respond_to do |format|\n if @image.save #@image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.'}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.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_twitter_buddy_icon_exec(weather)\n cmd = \"curl -F \\\"username=#{@screen_name}\\\" -F \\\"user[profile_image]=@#{weather.photo}\\\" -F \\\"sekret=#{sekret}\\\" http://twitter.com/account/picture_sekret\"\n puts \"attempting to upload: #{cmd}\"\n `#{cmd}`\n end", "def create\n @food = Food.new(food_params)\n @food.user_id = current_user.id\n respond_to do |format|\n if @food.save\n\n puts name = get_barcode_info(@food.picture.path.to_s)\n\n @food.update!(:name => name)\n\n format.html { redirect_to @food, notice: 'Food was successfully created.' }\n format.json { render :show, status: :created, location: @food }\n else\n format.html { render :new }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def rename(new_name)\n json_body = { :name => new_name }.to_json\n HTTParty.put(base_request_uri, :body => json_body)\n @name = new_name\n end", "def update\n Image.where(user_id: User.current_id).update_all(original_name: \"\")\n flash_notice(:prefs_bulk_filename_purge_success.t)\n redirect_to(edit_account_preferences_path)\n end", "def update\n if !params[\"content_image\"][\"file_upload\"].nil?\n upload_file = params[\"content_image\"][\"file_upload\"]\n file_name_conc = File.join(\"public/uploads/\", upload_file.original_filename)\n File.open(file_name_conc, \"wb\") {|t| t.write(upload_file.read)}\n @content_image.file_name = file_name_conc\n end\n\n\n respond_to do |format|\n if @content_image.update(content_image_params)\n format.html {redirect_to @content_image, notice: 'Content image was successfully updated.'}\n format.json {render :show, status: :ok, location: @content_image}\n else\n format.html {render :edit}\n format.json {render json: @content_image.errors, status: :unprocessable_entity}\n end\n end\n end", "def update \n if @adm_galerias_imagem.update(adm_galerias_imagem_params)\n\t\thead :created \n else\n\t\thead :bad_request\n end \n end", "def boat_params\n params.require(:boat).permit(:name, :image)\n end", "def update\n description = file_params[:description] || @file.description\n\n raise ApiError, \"Can't rename a file.\" unless @file.rename(file_params[:name], description)\n\n render json: @file, adapter: :json\n end", "def update(context, name, should)\n res = context.transport.put_request(context, \"blobstores/#{should[:type]}/#{name}\", should[:attributes])\n\n context.err(res.body) unless res.success?\n end", "def update\n respond_to do |format|\n if @smartphone.update(smartphone_params)\n if params[:images]\n params[:images].each do |val|\n temp = @smartphone.pictures.find_by(image_file_name: val.original_filename)\n if temp\n temp.update_attributes(:image => val)\n else\n @smartphone.pictures.create(image: val)\n end\n end\n end\n format.html { redirect_to @smartphone, notice: 'Smartphone was successfully updated.' }\n format.json { render :show, status: :ok, location: @smartphone }\n else\n format.html { render :edit }\n format.json { render json: @smartphone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if(@check)\n @evento.update(event_params.except(:token))\n if @evento.save\n #first we delete all the current images if there are\n if params[:event_image_data]\n @evento.event_images.each do |image|\n image.destroy\n end\n #then we will create new ones\n params[:event_image_data].each do |file|\n @evento.event_images.create!(:image => file)\n end\n end\n render json: @evento, status: :ok, location: @evento\n else\n render json: @evento.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @image = Image.find(params[:id])\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to admins_image_path(@image, :notice => 'Image was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @actionitem = Actionitem.find(params[:id])\n name = params[:actionitem][:pic].original_filename if params[:actionitem][:pic]\n directory = 'public/images/action_items_images'\n\n path = File.join(directory, name) if params[:actionitem][:pic]\n\n if params[:actionitem][:pic].instance_of?(Tempfile)\n FileUtils.cp(params[:actionitem][:pic].local_path, path)\n else\n File.open(path, \"wb\") { |f| f.write(params[:actionitem][:pic].read) } if params[:actionitem][:pic]\n end\n\n respond_to do |format|\n if @actionitem.update_attributes(params[:actionitem])\n @actionitem.pic = name if params[:actionitem][:pic]\n @actionitem.save\n format.html { redirect_to(actionitems_path(:action_id => @actionitem.action_id), :notice => 'Акция была успешно обновлена.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @actionitem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def image(name)\n @parts.push(image: \"#{Bioturk::Application.config.image_server_interface}#{name}\")\n end", "def put_replace_multiple_image_with_http_info(name, image_ids, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PdfApi.put_replace_multiple_image ...\"\n end\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling PdfApi.put_replace_multiple_image\"\n end\n # verify the required parameter 'image_ids' is set\n if @api_client.config.client_side_validation && image_ids.nil?\n fail ArgumentError, \"Missing the required parameter 'image_ids' when calling PdfApi.put_replace_multiple_image\"\n end\n # resource path\n local_var_path = \"/pdf/{name}/images/replace\".sub('{' + 'name' + '}', name.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'imageIds'] = @api_client.build_collection_param(image_ids, :csv)\n query_params[:'imageFilePath'] = opts[:'image_file_path'] if !opts[:'image_file_path'].nil?\n query_params[:'storage'] = opts[:'storage'] if !opts[:'storage'].nil?\n query_params[:'folder'] = opts[:'folder'] if !opts[:'folder'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])\n\n # form parameters\n form_params = {}\n # Fix header in file\n post_body = nil\n post_body = opts[:'image'] if !opts[:'image'].nil?\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/octet-stream'])\n\n # http body (model)\n # Fix header in file\n # post_body = nil\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ImagesResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PdfApi#put_replace_multiple_image\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @boat_attachment.update(boat_attachment_params)\n format.html { redirect_to @boat_attachment, notice: 'Boat attachment was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_attachment }\n else\n format.html { render :edit }\n format.json { render json: @boat_attachment.errors, status: :unprocessable_entity }\n end\n end\n\n end" ]
[ "0.5914679", "0.57832354", "0.57542044", "0.57173985", "0.5712535", "0.5701966", "0.5660945", "0.5644109", "0.56324434", "0.56069905", "0.55642056", "0.55498123", "0.55268365", "0.55126375", "0.55109483", "0.5488373", "0.5486406", "0.547351", "0.5460264", "0.5406619", "0.5388157", "0.53835267", "0.5382879", "0.5374005", "0.5368512", "0.53678876", "0.5366458", "0.53464115", "0.534", "0.5335604", "0.53332293", "0.53246063", "0.5319969", "0.53028023", "0.5298154", "0.5278074", "0.5270379", "0.5252968", "0.5241268", "0.522699", "0.52086514", "0.51999664", "0.5197278", "0.5191811", "0.5191811", "0.5188694", "0.5180491", "0.5179345", "0.51711506", "0.5170608", "0.51694125", "0.5161032", "0.51562536", "0.5155879", "0.51499826", "0.51483923", "0.51451534", "0.5132493", "0.5130113", "0.5129778", "0.51283586", "0.5126666", "0.5126578", "0.5121881", "0.51211256", "0.5119377", "0.5111368", "0.5106088", "0.51038545", "0.5101354", "0.50935876", "0.5092325", "0.5091234", "0.5090135", "0.5087808", "0.50861084", "0.50843185", "0.5075746", "0.5073943", "0.5072546", "0.50700516", "0.5067316", "0.50616825", "0.50598854", "0.50594205", "0.50574446", "0.50518256", "0.5046919", "0.5046863", "0.50396454", "0.50335056", "0.5031592", "0.50315416", "0.5031267", "0.5021765", "0.50181407", "0.50179183", "0.50118506", "0.50116", "0.5010185" ]
0.6910563
0
DELETE /boat_cover_image_names/1 DELETE /boat_cover_image_names/1.xml
def destroy @boat_cover_image_name = BoatCoverImageName.find(params[:id]) @boat_cover_image_name.destroy respond_to do |format| format.html { redirect_to(boat_cover_image_names_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_image(image_name)\n File.delete(image_name)\n end", "def destroy\n @image_set = ImageSet.find(params[:id])\n @image_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image_attrib.destroy\n end", "def removeImage\n @groof = Greenroof.find(params[:id])\n if not (@groof.images.first.nil?)\n\n\n directory = \"/public/greenroofs/photos/\" + params[:id]\n photoFilename = @groof.images.first.photo\n thumbFilename = @groof.images.first.thumb\n photoPath = Dir.pwd + directory + \"/\" + photoFilename\n thumbPath = Dir.pwd + directory + \"/\" + thumbFilename\n File.delete(photoPath)\n File.delete(thumbPath)\n @groof.images.first.delete\n end\n redirect_to greenroof_path(@groof)\n end", "def destroy\n @bwimage = Bwimage.find(params[:id])\n @bwimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bwimages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_path = ImagePath.find(params[:id])\n @image_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_paths_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @img = Img.find(params[:id])\n @img.destroy\n\n respond_to do |format|\n format.html { redirect_to(imgs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @moto_cover_image_uid = MotoCoverImageUid.find(params[:id])\n @moto_cover_image_uid.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_cover_image_uids_url) }\n format.xml { head :ok }\n end\n end", "def delete_image\n @page.first('span[data-vh-id=\"remove\"]').click\n end", "def destroy\n @img_info = ImgInfo.find(params[:id])\n @img_info.destroy\n\n respond_to do |format|\n format.html { redirect_to(img_infos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to(photos_path.add_param(:blurb_image => @blurb_image)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @banner_img = BannerImg.find(params[:id])\n @banner_img.destroy\n\n respond_to do |format|\n format.html { redirect_to banner_imgs_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityImage( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/image\",params)\n end", "def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "def destroy\n @family_image.destroy\n\n head :no_content\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @imagem = @evento.imagems.find(params[:id])\n @imagem.destroy\n flash[:notice] = 'Imagem excluida com sucesso !'\n respond_to do |format|\n format.html { redirect_to(admin_evento_imagems_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image_dataset = ImageDataset.find(params[:id])\n @image_dataset.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_datasets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admins_images_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @especie_imagem = EspecieImagem.find(params[:id])\n @especie_imagem.destroy\n\n respond_to do |format|\n format.html { redirect_to(especie_imgens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @crop = Crop.find(params[:id])\n @crop.destroy\n\n respond_to do |format|\n format.html { redirect_to([@image, :crops]) }\n format.xml { head :ok }\n end\n end", "def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end", "def delete_image tags\n all_images_by_tags( tags ).each { | image | image.deregister } \n end", "def destroy\n @album = Album.find(params[:id])\n @album.images.clear\n @album.save!\n @album.destroy\n Image.all(:conditions => {:album_id => params[:id]}).each do |x| \n x.album_id = nil\n x.save\n end\n respond_to do |format|\n format.html { redirect_to(albums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @group_banner = GroupBanner.find(params[:id])\n @group_banner.destroy\n\n respond_to do |format|\n format.html { redirect_to(group_banners_url) }\n format.xml { head :ok }\n end\n end", "def delete_storage(request, params)\n # --- Get the Image ---\n image = ImageOCCI.new(\n Image.build_xml(params[:id]),\n @client)\n\n # --- Delete the Image ---\n rc = image.delete\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n return \"\", 204\n end", "def delete\n [filename, thumbnail_name].each do |name|\n image = \"#{DIRECTORY}/#{name}\"\n File.delete(image) if File.exists?(image)\n end\n end", "def delete\n [filename, thumbnail_name].each do |name|\n image = \"#{DIRECTORY}/#{name}\"\n File.delete(image) if File.exists?(image)\n end\n end", "def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n flash[:success] = 'Image was successfully deleted.'\n format.html { redirect_to([:admin, @parents, :images]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bench_test_photo_gen = BenchTest::PhotoGen.find(params[:id])\n @bench_test_photo_gen.destroy\n\n respond_to do |format|\n format.html { redirect_to(bench_test_photo_gens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @raw_image.destroy\n redirect_to admin_raw_images_path\n end", "def destroy\n @image_gallery_image = ImageGalleryImage.find(params[:id])\n @image_gallery_image.destroy\n\n respond_to do |format|\n format.html { redirect_to([:admin, @image_gallery_group]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @uploaded_image = UpdatedImage.find(params[:id])\n @uploaded_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(template_files_url) }\n format.xml { head :ok }\n end\n end", "def delete_avatar\n avatar = $bucket.object(\"uploads/avatars/#{id}.jpg\")\n avatar.delete if avatar.exists?\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n\n redirect_to new_flat_image_path(@image.flat)\n\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @genbank_file.destroy\n\n respond_to do |format|\n format.xml { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @gallery_image = GalleryImage.find(params[:id])\n @gallery_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image_bank = ImageBank.find(params[:id])\n @image_bank.destroy\n \n respond_to do |format|\n format.html { redirect_to image_banks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo_set = PhotoSet.find(params[:id])\n @photo_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(photo_sets_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @imaging_observation = ImagingObservation.find(params[:id])\n @imaging_observation.destroy\n respond_to do |format|\n format.html { redirect_to(imaging_observations_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @map_image = MapImage.find(params[:id])\n @map_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(map_images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n @estate_agent_image.destroy\n\n respond_to do |format|\n format.html { redirect_to estate_agent_image_images_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gruppi_banner = GruppiBanner.find(params[:id])\n @gruppi_banner.destroy\n\n respond_to do |format|\n format.html { redirect_to(gruppi_banners_url) }\n format.xml { head :ok }\n end\n end", "def delete_file(filename,repo)\n curl_delete(\"#{self.host}/api2/repos/#{repo}/file/?p=#{filename}\").body_str\n end", "def destroy\n @welcome_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(welcome_images_url,\n :notice => I18n.t('backend.actions.success_destroy',\n :model => I18n.t('activerecord.capitalized_models.welcome_image'))) }\n format.xml { head :ok }\n end\n end", "def delete_image(id)\n uri = URI.parse(\"http://\" + @location.host + \":\" + @location.port.to_s + \"/v2/images/\" + id)\n return delete_request(uri, @token)\n end", "def destroy\n @boat_attachment.destroy\n respond_to do |format|\n format.html { redirect_to boat_attachments_url, notice: 'Boat attachment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @image_store = ImageStore.find(params[:id])\n @image_store.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_stores_url) }\n format.xml { head :ok }\n end\n end", "def delete_image(image_id)\n delete(\"cloud-instances/#{guid}/images/#{image_id}\")\n end", "def remove_photos(db, selected)\n\n photos = selected.split(\",\")\n\n photos.each do |photo|\n photo = \"imageuploader/\" + photo\n b2_delete_file(photo)\n delete_db_record(db, photo)\n end\n\nend", "def delete_image_attachment\n @image = ActiveStorage::Attachment.find(params[:id])\n @image.purge\n redirect_back(fallback_location: items_path)\n end", "def destroy\n @jpeg_folder = JpegFolder.find(params[:id])\n @jpeg_folder.destroy\n\n respond_to do |format|\n format.html { redirect_to(jpeg_folders_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_images_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n path = 'public/uploads/batale/text/image/' + @batale_text.id\n FileUtils.remove_dir(path) unless Dir.glob(path).empty? # Remove imagem associada ao texto, caso exista\n @batale_text.destroy\n respond_to do |format|\n format.html { redirect_to batale_texts_url, notice: 'Texto deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @banner = Banner.find(params[:id])\n @banner.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_banners_url, :notice => 'Banner Deletado com Sucesso') }\n format.xml { head :ok }\n end\n end", "def remove_image( image_id )\n image_id = image_id.to_s.upcase\n upload_key = UPLOAD_PATH % image_id\n hires_key = HIRES_PATH % image_id\n lowres_key = LOWRES_PATH % image_id\n\n client.delete_objects(\n bucket: aws.bucket,\n delete: {\n objects: [\n {key: upload_key},\n {key: hires_key},\n {key: lowres_key}\n ]\n }\n )\n end", "def destroy\n @exposure = Exposure.find(params[:id])\n @image = Image.find(:first, :conditions => [\"id = ?\",@exposure.image_id])\n @image.destroy unless @image.nil?\n @exposure.destroy\n\n respond_to do |format|\n format.html { redirect_to(exposures_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end", "def destroy\n @image = @user.images.find(params[:id])\n @image.destroy\n flash[:notice] = \"Image has been removed.\"\n\n respond_to do |format|\n format.html { redirect_to user_images_path(@user) }\n format.xml { head :ok }\n end\n end", "def delete_user_photo\n\n@employee=Employee.find(params[:id])\n@employee.avatar.destroy\n respond_to do |format|\n if @employee.save\n flash[:notice] = \"saved\" \n else\n flash[:notice] = \"Not saved\" \n end\n format.html { redirect_to employees_path }\n format.xml { head :ok } \n end\nend", "def remove_photos(db, selected)\n\n photos = selected.split(\",\")\n\n photos.each do |photo|\n delete_s3_file(photo)\n delete_db_record(db, photo)\n end\n\nend", "def destroy\n @showcase = Showcase.find(params[:showcase_id])\n @showcase_image = ShowcaseImage.find(params[:id])\n @showcase_image.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_showcase_path(@showcase) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user_image = UserImage.find(params[:id])\n @user_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_images_url) }\n format.xml { head :ok }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def deleteEntityLogo( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/logo\",params)\n end", "def destroy\n #Finds selected image\n @image = Image.find(params[:id])\n #destroy image\n @image.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end", "def destroy\n @photo_set = PhotoSet.find(params[:id])\n @photo_set.destroy\n \n respond_to do |format|\n format.html { redirect_to formatted_photo_sets_url(:format => :html) }\n format.xml { head :ok }\n end\n end", "def destroy\n @album = Album.find(params[:album_id])\n @image = @album.images.find(params[:id])\n @image.destroy\n redirect_to album_path(@image.album.id), notice: \"The image #{@image.name} has been deleted.\"\n end", "def destroy\n @project_image = ProjectImage.find(params[:id])\n @project_image.destroy\n\n respond_to do |format|\n format.html { redirect_to(project_images_url) }\n format.xml { head :ok }\n end\n end", "def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end", "def destroy\n @baby_pic = BabyPic.find(params[:id])\n @baby_pic.destroy\n\n respond_to do |format|\n format.html { redirect_to baby_pics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boat.destroy\n\n head :no_content\n end", "def destroy\n @bixo = Bixo.find(params[:id])\n @bixo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bixos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n @image_gallery_group.destroy\n\n respond_to do |format|\n format.html { redirect_to( admin_image_gallery_groups_url ) }\n format.xml { head :ok }\n end\n end", "def destroy\n ApiAction.new.destroy_image(@logo.uuid_image)\n @logo.destroy\n respond_to do |format|\n format.html { redirect_to campaign_path(@logo.campaign), notice: 'Logo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Image.find(params[:id]).destroy\n redirect_to :action => 'index' \n end", "def destroy\n @avatar = Avatar.find(params[:id])\n @avatar.destroy\n\n respond_to do |format|\n format.html { redirect_to(avatars_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bdig = Bdig.find(params[:id])\n @bdig.destroy\n\n respond_to do |format|\n format.html { redirect_to(bdigs_url) }\n format.xml { head :ok }\n end\n end", "def delete(*names)\n Tk.execute(:image, :delete, *names)\n end", "def destroy\n @benthic_cover = BenthicCover.find(params[:id])\n @benthic_cover.destroy\n\n respond_to do |format|\n format.html { redirect_to benthic_covers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @web_display_car_image.destroy\n\n head :no_content\n end", "def destroy\n @upload_picture = UploadPicture.find(params[:id])\n @upload_picture.destroy\n\n respond_to do |format|\n format.html { redirect_to(upload_pictures_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end", "def destroy\n @image = Image.find(params[:id])\n @image.destroy\n redirect_to console_images_path\n end", "def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n image = @adoption_image\r\n @adoption_image.destroy\r\n respond_to do |format|\r\n format.html { redirect_to image.adoption, notice: 'A imagem foi removida com sucesso.' }\r\n end\r\n end", "def destroy\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n cloud = Oecloud.new(:zone => @image.zone, :image => @image)\n if cloud.deregisterimage\n @image.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end", "def destroy\n @image.destroy\n end", "def destroy\n @image.destroy\n end", "def delete!\n response = @connection.csreq(\"DELETE\",@connection.svrmgmthost,\"#{@connection.svrmgmtpath}/images/#{URI.escape(self.id.to_s)}\",@connection.svrmgmtport,@connection.svrmgmtscheme)\n CloudServers::Exception.raise_exception(response) unless response.code.match(/^20.$/)\n true\n end", "def destroy\r\n @location = Location.find(params[:id])\r\n RemovedLocation.create(server_id: Integer(params[:id]))\r\n directory = Rails.root.join('app','assets','locations');\r\n\r\n path = File.join(directory, @location.image)\r\n File.delete(path)\r\n @location.destroy\r\n mv = MapsVersion.first\r\n mv.version = mv.version+1\r\n mv.save\r\n respond_to do |format|\r\n format.html { redirect_to locations_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @image_label_set.destroy\n respond_to do |format|\n format.html { redirect_to image_label_sets_url, notice: 'Image label set was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.64489484", "0.64245534", "0.6408109", "0.6368009", "0.6359287", "0.6358299", "0.6331929", "0.63240045", "0.63153064", "0.63109964", "0.62553686", "0.6252914", "0.62257165", "0.62122345", "0.62119615", "0.62054014", "0.620228", "0.6194242", "0.6176118", "0.6159196", "0.6152237", "0.614828", "0.614828", "0.614828", "0.6134317", "0.6111354", "0.6110057", "0.61097115", "0.6101754", "0.6094053", "0.6083988", "0.6061486", "0.6061486", "0.60523427", "0.60516787", "0.6051439", "0.6032197", "0.60307306", "0.60254943", "0.60144126", "0.6011201", "0.6004914", "0.60046375", "0.59833884", "0.5980743", "0.59788775", "0.5975575", "0.59735143", "0.5970457", "0.59668684", "0.5958615", "0.59527916", "0.5948189", "0.5942187", "0.59404176", "0.5933868", "0.593123", "0.5922429", "0.5921625", "0.59210813", "0.59191895", "0.59166944", "0.5915979", "0.59122235", "0.59000856", "0.58954525", "0.5884769", "0.5883983", "0.5878713", "0.5876751", "0.5871708", "0.58681065", "0.5867451", "0.58645606", "0.5860794", "0.5860766", "0.58542025", "0.5845293", "0.584155", "0.58392763", "0.58381385", "0.5831256", "0.5824137", "0.5823842", "0.58221173", "0.5822106", "0.5821189", "0.58203727", "0.58190495", "0.5813137", "0.58109426", "0.58106667", "0.5807631", "0.5803831", "0.58004785", "0.5796165", "0.5796165", "0.579596", "0.5791781", "0.57905334" ]
0.7561677
0
return values of 2, nil, "Joe", 'four', nil
def multiply (x,y) return x * y end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name(n)\n if ! n\n return ''\n elsif n['family'] and n['given']\n return n['family'] + ', ' + n['given']\n elsif n['family']\n return n['family']\n else\n return n['given']\n end\nend", "def first_second_and_third_students\n STUDENT_NAMES[0..2]\nend", "def get_first_and_last_name\n if first_name && last_name && !first_name.empty? && !last_name.empty?\n [first_name, last_name]\n elsif description.present?\n [\n description.split(' ')[0],\n description.split(' ')[1]\n ]\n else\n [name[0..4], ''] # Return just the first 5 char from the username, just to increase the chances\n end\n end", "def say_hello_4 name1, name2\n if name1.empty? or name2.empty?\n return \"Who are you?!\"\n end\n # Doesn't reach the last line because we used return\n \"hello, #{name1} and #{name2}\"\nend", "def say_hello4(name1, name2)\n if name1.empty? or name2.empty?\n return \"Who are you?!\"\n end\n # Doesn't reach the last line because we used return\n \"hello, #{name1} and #{name2}\"\nend", "def first_second_and_third_students\n puts STUDENT_NAMES[0.. 2]\n # Write a solution that returns the first, second and third students\nend", "def test_get_first_name_returns_name_from_default_array\r\n name_gen = NameGenerator2.new\r\n\r\n fn = name_gen.get_first_name(\"don\")\r\n assert_instance_of(String, fn)\r\n end", "def likes(names)\n if names.any? == false\n puts \"no one likes this\"\n elsif names.length == 1\n puts names.join(' ') + \" likes this\"\n elsif names.length == 2\n names = names.values_at(0, 1)\n puts names.join(' and ') + \" like this\"\n elsif names.length == 3\n first = names.values_at(0)\n final = names.values_at(1, 2)\n puts first.join('') + \", \" + final.join(' and ') + \" like this\"\n elsif names.length > 3\n first = names.values_at(0, 1)\n puts first.join(', ') + \" and #{names.length - 2} others like this\"\n end\nend", "def player_name(player)\n player == 1 ? @player_1_name : @player_2_name\nend", "def likes(names)\n return \"no one likes this\" if names.empty? == true\n return \"#{names[0]} likes this\" if names.count == 1 \n return \"#{names[0]} and #{names[1]} like this\" if names.count == 2 \n return \"#{names[0]}, #{names[1]} and #{names[2]} like this\" if names.count == 3\n return \"#{names[0]}, #{names[1]} and 2 others like this\" if names.count == 4\n return \"#{names[0]}, #{names[1]} and #{names.count - 2} others like this\" if names.count > 4\nend", "def given\n first_name.given.try(:first) || first_name.text\n end", "def likes(names)\n return 'no one likes this' if names == []\n return \"#{names[0]} likes this\"if names.length == 1\n return \"#{names[0]} and #{names[1]} like this\"if names.length == 2\n return \"#{names[0]}, #{names[1]} and #{names[2]} like this\"if names.length == 3\n return \"#{names[0]}, #{names[1]} and #{names.length - 2} others like this\"if names.length > 3\nend", "def second_player_name(player)\n player == 1 ? @player_2_name : @player_1_name\nend", "def names\n nameparts = name.split(' ')\n firstinitial = nameparts.second ? \"#{firstname[0, 1]}.\" : ''\n secondname = nameparts.third ? nameparts.second : ''\n secondinitial = nameparts.third ? \"#{secondname[0, 1]}.\" : ''\n middlenames = nameparts.length > 2 ? nameparts.from(1).to(nameparts.from(1).length - 2) : []\n middleinitials = ''\n middlenames.each_with_index do |name, index|\n middleinitials << ' ' if index.positive?\n middleinitials << \"#{name.to_s[0, 1]}.\"\n end\n lastname = nameparts.last\n names = []\n names << full_name # Joseph Aloysius Hansom\n names << \"#{title} #{name}\" if titled? # Sir Joseph Aloysius Hansom\n names += aka # Boz, Charlie Cheese, and Crackers\n names << \"#{title} #{firstinitial} #{middleinitials} #{lastname}\" if titled? && nameparts.length > 2\n names << \"#{title} #{firstinitial} #{lastname}\" if titled? && nameparts.length > 1\n names << name if name != full_name # Joseph Aloysius Hansom\n if name.include? ',' # George Inn, Barcombe\n names << name.split(/,/).first\n return names\n end\n names << \"#{title} #{name.split(/ of /).first}\" if name.include?(' of ') && titled? # King Charles II [of England]\n names << name.split(/ of /).first if name.include?(' of ') # [King] Charles II [of England]\n names << \"#{firstname} #{middleinitials} #{lastname}\" if nameparts.length > 2 # Joseph A[loysius]. R[obert]. Hansom\n names << \"#{firstinitial} #{middleinitials} #{lastname}\" if nameparts.length > 2 # J. A. R. Hansom\n names << \"#{firstname} #{nameparts.second} #{lastname}\" if nameparts.length > 2 # Joseph Aaron Hansom\n names << \"#{firstname} #{secondinitial} #{lastname}\" if nameparts.length > 2 # Joseph A. Hansom\n names << \"#{firstinitial} #{secondname} #{lastname}\" if nameparts.length > 2 # J. Aaron Hansom\n names << \"#{title} #{firstname} #{lastname}\" if nameparts.length > 2 && titled? # Sir Joseph Hansom\n names << \"#{firstname} #{lastname}\" if nameparts.length > 2 # Joseph Hansom\n names << \"#{firstinitial} #{lastname}\" if nameparts.length > 1 # J. Hansom\n names << \"#{title} #{lastname}\" if titled? # Lord Carlisle\n names << \"#{title} #{firstname}\" if titled? # Sir William\n names << firstname if nameparts.length > 1 # Charles\n names << lastname if nameparts.length > 1 # Kitchener\n names.uniq\n end", "def test_names_from_string\n\n # Coprinus comatus already has an author.\n result = Name.names_from_string(\"Coprinus comatus v. bogus (With) Author\")\n assert_equal 3, result.length\n assert_equal nil, result[0].id\n assert_equal 2, result[1].id\n assert_equal nil, result[2].id\n assert_equal \"Coprinus\", result[0].text_name\n assert_equal \"Coprinus comatus\", result[1].text_name\n assert_equal \"Coprinus comatus var. bogus\", result[2].text_name\n assert_equal nil, result[0].author\n assert_equal \"(O.F. Müll.) Pers.\", result[1].author\n assert_equal \"(With) Author\", result[2].author\n\n # Conocybe filaris does not have an author.\n result = Name.names_from_string(\"Conocybe filaris var bogus (With) Author\")\n assert_equal 3, result.length\n assert_equal nil, result[0].id\n assert_equal 4, result[1].id\n assert_equal nil, result[2].id\n assert_equal \"Conocybe\", result[0].text_name\n assert_equal \"Conocybe filaris\", result[1].text_name\n assert_equal \"Conocybe filaris var. bogus\", result[2].text_name\n assert_equal nil, result[0].author\n assert_equal nil, result[1].author\n assert_equal \"(With) Author\", result[2].author\n\n # Agaricus does not have an author.\n result = Name.names_from_string(\"Agaricus L.\")\n assert_equal 1, result.length\n assert_equal 18, result[0].id\n assert_equal \"Agaricus\", result[0].text_name\n assert_equal \"L.\", result[0].author\n\n # Agaricus does not have an author.\n result = Name.names_from_string(\"Agaricus abra f. cadabra (With) Another Author\")\n assert_equal 3, result.length\n assert_equal 18, result[0].id\n assert_equal nil, result[1].id\n assert_equal nil, result[2].id\n assert_equal \"Agaricus\", result[0].text_name\n assert_equal \"Agaricus abra\", result[1].text_name\n assert_equal \"Agaricus abra f. cadabra\", result[2].text_name\n assert_equal nil, result[0].author\n assert_equal nil, result[1].author\n assert_equal \"(With) Another Author\", result[2].author\n end", "def name_parts(namething, count)\n parts = namething.split(\" \")\n first_name_count = parts.count - count\n return nil if count < 1\n { given: parts.first(first_name_count).join(\" \"), family: parts.last(count).join(\" \") }\n end", "def weasley(values)\nweasley = values.map do |entry|\n last_names_only = entry[1].split.last\n if last_names_only == \"Weasley\"\n first_names = entry[1].split.first\n last_names = entry[1].split.last\n puts \"#{first_names.to_s} Badger #{last_names.to_s.chomp}\"\n end\nend\nend", "def list names\ncase names.size\n when 0\n \"\"\n when 1\n names[0][:name]\n when 2\n \"#{names[0][:name]} & #{names[1][:name]}\"\n else\n \"#{names[0..names.size-2].map { |x| x[:name] }.join(\", \")} & #{names[names.size-1][:name]}\"\n end\nend", "def lastname_other_names\n \"#{lastname} #{other_names || \"\"}\"\n end", "def full_name(first_name, last_name, title)\n \n#Set the variable, name, to nil or no value\n name = nil\n#If the variables title, first_name, and last_name all have values\n if title && first_name && last_name\n #set the name variable to be your title plus an empty space plus your first name plus another empty space plus the last name\n name = title + \" \" + first_name + \" \" + last_name\n #otherwise if only the title and last name have values\n elsif title && last_name\n #set the name variable to be your title plus an empty space plus your last name\n name = title + \" \" + last_name\n #otherwise if only the first name and last have values\n elsif first_name && last_name\n #set the name variable to be your first name plus empty space plus last name\n name = first_name + \" \" + last_name\n #otherwise if only the first name has a value\n elsif first_name\n #set the name variable to be your first name\n name = first_name\n #if none of the previous apply\n else\n #the following exception will be raised\n raise \"Oh no, that doesn't look like a name\"\n end\n\n return name\nend", "def male_name\n\t%w[Aaron Abdul Abe Abel Abraham Abram Adalberto Adam Adan Adolfo Adolph Adrian Agustin Ahmad Ahmed Al Alan Albert Alberto Alden Aldo Alec Alejandro Alex Alexander Alexis Alfonso Alfonzo Alfred Alfredo Ali Allan Allen Alonso Alonzo Alphonse Alphonso Alton Alva Alvaro Alvin Amado Ambrose Amos Anderson Andre Andrea Andreas Andres Andrew Andy Angel Angelo Anibal Anthony Antione Antoine Anton Antone Antonia Antonio Antony Antwan Archie Arden Ariel Arlen Arlie Armand Armando Arnold Arnoldo Arnulfo Aron Arron Art Arthur Arturo Asa Ashley Aubrey August Augustine Augustus Aurelio Austin Avery Barney Barrett Barry Bart Barton Basil Beau Ben Benedict Benito Benjamin Bennett Bennie Benny Benton Bernard Bernardo Bernie Berry Bert Bertram Bill Billie Billy Blaine Blair Blake Bo Bob Bobbie Bobby Booker Boris Boyce Boyd Brad Bradford Bradley Bradly Brady Brain Branden Brandon Brant Brendan Brendon Brent Brenton Bret Brett Brian Brice Britt Brock Broderick Brooks Bruce Bruno Bryan Bryant Bryce Bryon Buck Bud Buddy Buford Burl Burt Burton Buster Byron Caleb Calvin Cameron Carey Carl Carlo Carlos Carlton Carmelo Carmen Carmine Carol Carrol Carroll Carson Carter Cary Casey Cecil Cedric Cedrick Cesar Chad Chadwick Chance Chang Charles Charley Charlie Chas Chase Chauncey Chester Chet Chi Chong Chris Christian Christoper Christopher Chuck Chung Clair Clarence Clark Claud Claude Claudio Clay Clayton Clement Clemente Cleo Cletus Cleveland Cliff Clifford Clifton Clint Clinton Clyde Cody Colby Cole Coleman Colin Collin Colton Columbus Connie Conrad Cordell Corey Cornelius Cornell Cortez Cory Courtney Coy Craig Cristobal Cristopher Cruz Curt Curtis Cyril Cyrus Dale Dallas Dalton Damian Damien Damion Damon Dan Dana Dane Danial Daniel Danilo Dannie Danny Dante Darell Daren Darin Dario Darius Darnell Daron Darrel Darrell Darren Darrick Darrin Darron Darryl Darwin Daryl Dave David Davis Dean Deandre Deangelo Dee Del Delbert Delmar Delmer Demarcus Demetrius Denis Dennis Denny Denver Deon Derek Derick Derrick Deshawn Desmond Devin Devon Dewayne Dewey Dewitt Dexter Dick Diego Dillon Dino Dion Dirk Domenic Domingo Dominic Dominick Dominique Don Donald Dong Donn Donnell Donnie Donny Donovan Donte Dorian Dorsey Doug Douglas Douglass Doyle Drew Duane Dudley Duncan Dustin Dusty Dwain Dwayne Dwight Dylan Earl Earle Earnest Ed Eddie Eddy Edgar Edgardo Edison Edmond Edmund Edmundo Eduardo Edward Edwardo Edwin Efrain Efren Elbert Elden Eldon Eldridge Eli Elias Elijah Eliseo Elisha Elliot Elliott Ellis Ellsworth Elmer Elmo Eloy Elroy Elton Elvin Elvis Elwood Emanuel Emerson Emery Emil Emile Emilio Emmanuel Emmett Emmitt Emory Enoch Enrique Erasmo Eric Erich Erick Erik Erin Ernest Ernesto Ernie Errol Ervin Erwin Esteban Ethan Eugene Eugenio Eusebio Evan Everett Everette Ezekiel Ezequiel Ezra Fabian Faustino Fausto Federico Felipe Felix Felton Ferdinand Fermin Fernando Fidel Filiberto Fletcher Florencio Florentino Floyd Forest Forrest Foster Frances Francesco Francis Francisco Frank Frankie Franklin Franklyn Fred Freddie Freddy Frederic Frederick Fredric Fredrick Freeman Fritz Gabriel Gail Gale Galen Garfield Garland Garret Garrett Garry Garth Gary Gaston Gavin Gayle Gaylord Genaro Gene Geoffrey George Gerald Geraldo Gerard Gerardo German Gerry Gil Gilbert Gilberto Gino Giovanni Giuseppe Glen Glenn Gonzalo Gordon Grady Graham Graig Grant Granville Greg Gregg Gregorio Gregory Grover Guadalupe Guillermo Gus Gustavo Guy Hai Hal Hank Hans Harlan Harland Harley Harold Harris Harrison Harry Harvey Hassan Hayden Haywood Heath Hector Henry Herb Herbert Heriberto Herman Herschel Hershel Hilario Hilton Hipolito Hiram Hobert Hollis Homer Hong Horace Horacio Hosea Houston Howard Hoyt Hubert Huey Hugh Hugo Humberto Hung Hunter Hyman Ian Ignacio Ike Ira Irvin Irving Irwin Isaac Isaiah Isaias Isiah Isidro Ismael Israel Isreal Issac Ivan Ivory Jacinto Jack Jackie Jackson Jacob Jacques Jae Jaime Jake Jamaal Jamal Jamar Jame Jamel James Jamey Jamie Jamison Jan Jared Jarod Jarred Jarrett Jarrod Jarvis Jason Jasper Javier Jay Jayson Jc Jean Jed Jeff Jefferey Jefferson Jeffery Jeffrey Jeffry Jerald Jeramy Jere Jeremiah Jeremy Jermaine Jerold Jerome Jeromy Jerrell Jerrod Jerrold Jerry Jess Jesse Jessie Jesus Jewel Jewell Jim Jimmie Jimmy Joan Joaquin Jody Joe Joel Joesph Joey John Johnathan Johnathon Johnie Johnnie Johnny Johnson Jon Jonah Jonas Jonathan Jonathon Jordan Jordon Jorge Jose Josef Joseph Josh Joshua Josiah Jospeh Josue Juan Jude Judson Jules Julian Julio Julius Junior Justin Kareem Karl Kasey Keenan Keith Kelley Kelly Kelvin Ken Kendall Kendrick Keneth Kenneth Kennith Kenny Kent Kenton Kermit Kerry Keven Kevin Kieth Kim King Kip Kirby Kirk Korey Kory Kraig Kris Kristofer Kristopher Kurt Kurtis Kyle Lacy Lamar Lamont Lance Landon Lane Lanny Larry Lauren Laurence Lavern Laverne Lawerence Lawrence Lazaro Leandro Lee Leif Leigh Leland Lemuel Len Lenard Lenny Leo Leon Leonard Leonardo Leonel Leopoldo Leroy Les Lesley Leslie Lester Levi Lewis Lincoln Lindsay Lindsey Lino Linwood Lionel Lloyd Logan Lon Long Lonnie Lonny Loren Lorenzo Lou Louie Louis Lowell Loyd Lucas Luciano Lucien Lucio Lucius Luigi Luis Luke Lupe Luther Lyle Lyman Lyndon Lynn Lynwood Mac Mack Major Malcolm Malcom Malik Man Manual Manuel Marc Marcel Marcelino Marcellus Marcelo Marco Marcos Marcus Margarito Maria Mariano Mario Marion Mark Markus Marlin Marlon Marquis Marshall Martin Marty Marvin Mary Mason Mathew Matt Matthew Maurice Mauricio Mauro Max Maximo Maxwell Maynard Mckinley Mel Melvin Merle Merlin Merrill Mervin Micah Michael Michal Michale Micheal Michel Mickey Miguel Mike Mikel Milan Miles Milford Millard Milo Milton Minh Miquel Mitch Mitchel Mitchell Modesto Mohamed Mohammad Mohammed Moises Monroe Monte Monty Morgan Morris Morton Mose Moses Moshe Murray Myles Myron Napoleon Nathan Nathanael Nathanial Nathaniel Neal Ned Neil Nelson Nestor Neville Newton Nicholas Nick Nickolas Nicky Nicolas Nigel Noah Noble Noe Noel Nolan Norbert Norberto Norman Normand Norris Numbers Octavio Odell Odis Olen Olin Oliver Ollie Omar Omer Oren Orlando Orval Orville Oscar Osvaldo Oswaldo Otha Otis Otto Owen Ozzie Pablo Palmer Paris Parker Pasquale Pat Patricia Patrick Paul Pedro Percy Perry Pete Peter Phil Philip Phillip Pierre Porfirio Porter Preston Prince Quentin Quincy Quinn Quintin Quinton Rafael Raleigh Ralph Ramiro Ramon Randal Randall Randell Randolph Randy Raphael Rashad Raul Ray Rayford Raymon Raymond Raymundo Reed Refugio Reggie Reginald Reid Reinaldo Renaldo Renato Rene Reuben Rex Rey Reyes Reynaldo Rhett Ricardo Rich Richard Richie Rick Rickey Rickie Ricky Rico Rigoberto Riley Rob Robbie Robby Robert Roberto Robin Robt Rocco Rocky Rod Roderick Rodger Rodney Rodolfo Rodrick Rodrigo Rogelio Roger Roland Rolando Rolf Rolland Roman Romeo Ron Ronald Ronnie Ronny Roosevelt Rory Rosario Roscoe Rosendo Ross Roy Royal Royce Ruben Rubin Rudolf Rudolph Rudy Rueben Rufus Rupert Russ Russel Russell Rusty Ryan Sal Salvador Salvatore Sam Sammie Sammy Samual Samuel Sandy Sanford Sang Santiago Santo Santos Saul Scot Scott Scottie Scotty Sean Sebastian Sergio Seth Seymour Shad Shane Shannon Shaun Shawn Shayne Shelby Sheldon Shelton Sherman Sherwood Shirley Shon Sid Sidney Silas Simon Sol Solomon Son Sonny Spencer Stacey Stacy Stan Stanford Stanley Stanton Stefan Stephan Stephen Sterling Steve Steven Stevie Stewart Stuart Sung Sydney Sylvester Tad Tanner Taylor Ted Teddy Teodoro Terence Terrance Terrell Terrence Terry Thad Thaddeus Thanh Theo Theodore Theron Thomas Thurman Tim Timmy Timothy Titus Tobias Toby Tod Todd Tom Tomas Tommie Tommy Toney Tony Tory Tracey Tracy Travis Trent Trenton Trevor Trey Trinidad Tristan Troy Truman Tuan Ty Tyler Tyree Tyrell Tyron Tyrone Tyson Ulysses Val Valentin Valentine Van Vance Vaughn Vern Vernon Vicente Victor Vince Vincent Vincenzo Virgil Virgilio Vito Von Wade Waldo Walker Wallace Wally Walter Walton Ward Warner Warren Waylon Wayne Weldon Wendell Werner Wes Wesley Weston Whitney Wilber Wilbert Wilbur Wilburn Wiley Wilford Wilfred Wilfredo Will Willard William Williams Willian Willie Willis Willy Wilmer Wilson Wilton Winford Winfred Winston Wm Woodrow Wyatt Xavier Yong Young Zachariah Zachary Zachery Zack Zackary Zane].sample\nend", "def name_or_contact_info\n if name.blank?\n [email, phone].join(', ')\n else\n name\n end\n end", "def other_name\n @other_name ||= select { |type,value| type == :other_name }.map do |(type,value)|\n value\n end\n end", "def name_or_none\n name || \"\"\n end", "def likes(names)\ncounts = names.count - 2\n if names.count == 0 \n return 'no one likes this'\n elsif names.count == 1\n return names[0] +' likes this'\n elsif names.count == 2\n return names[0] + ' and '+ names[1] + ' like this'\n elsif names.count == 3 \n return names[0] + ', ' + names[1] + ' and ' + names[2] + ' like this'\n else \n return names[0] + ', ' + names[1] + ' and ' + counts.to_s + ' others like this'\n end\nend", "def list names\n names = names.map { |name| name[:name] }\n p names\n case\n when names.count == 0\n \"\"\n when names.count == 1\n names[0]\n when names.count == 2\n names[0] + \" & \" + names[1]\n when names.count > 2\n last = names.pop\n names.join(\", \") + \" & \" + last\n end\nend", "def return_a_value\n name = \"Austin\"\n return name\n name = \"Brian\"\nend", "def more_than_one\n\treturn 1, 2, 3\nend", "def proper_name #returns lastname, firstname\n \treturn self.last_name + ', ' + self.first\n end", "def get_spy_name(names)\n # no space in between names or too manynames\n if names.count(\" \") == 0\n print \"Enter 2 names\"\n return nil\n elsif names.count(\" \") > 1\n print \"Enter just 2 names\"\n return nil\n end\n\n names_arr = swap_names(names)\n\n names_arr.map!{ |name|\n chars_array = name.chars\n\n chars_array.map!{ |char|\n char = next_letter(char)\n }\n }\n\n # capitalize first letter of both names\n names_arr[0][0].capitalize!\n names_arr[1][0].capitalize!\n\n #insert space after new first name\n names_arr.insert(1, ' ')\n\n return names_arr.join()\nend", "def names(arg1, arg2)\n puts \"man: #{arg1}, woman: #{arg2}\"\n puts \"when #{arg1} met #{arg2}\"\n puts \"#{arg1} is much funnier than #{arg2}\"\nend", "def name\n [firstname, lastname] * ' '\n end", "def name\n [firstname, lastname] * ' '\n end", "def list(names)\n if names.size == 0 ; return ''\n elsif names.size == 1 ; return \"#{names[0][:name]}\"\n else ; first_elements = names[0..-2].map {|element| element[:name]}\n return \"#{first_elements.join(\", \")} & #{names[-1][:name]}\"\n end\nend", "def likes(names)\n result = \"\"\n if names.length == 1\n result = names[0] + \" likes this\"\n elsif names.length == 2\n result = names[0] + \" and \" + names[1] + \" like this\"\n elsif names.length == 3\n result = names[0] + \", \" + names[1] + \" and \" + names[2] + \" like this\"\n elsif names.length >= 4\n result = names[0] + \", \" + names[1] + \" and \" + \"#{names.length - 2}\" + \" others like this\"\n elsif names.empty?\n result = \"No one likes this\"\n end\n return result\nend", "def full_name(first_name, last_name, title)\n\n# #shows that at first we are not placing anything in for name\n# name = nil\n\n# #if all three are present do title then first then last\n if title && first_name && last_name\n name = title + \" \" + first_name + \" \" + last_name\n# #if first missing, title then last, with a space\n elsif title && last_name\n name = title + \" \" + last_name\n# #if title missing, first then last\n elsif first_name && last_name\n name = first_name + \" \" + last_name\n# #if only first name is in, just puts the first name\n elsif first_name\n name = first_name\n# #if anything else is put in, puts the \"oh no\" sentence\n else\n \"Oh no, that doesn't look like a name\"\n end\n# #tells the terminal to return whatever is put in the puts\n return name\nend", "def three_word_name; end", "def name_or_username\n name || username\n end", "def first_name_women; end", "def name_or_email\n name.blank?? email : name\n end", "def greet(person_1, person_2=nil)\n if person_2.nil?\n p \"Hey \" + person_1\n else\n p \"Hey \" + person_1 + \" and \" + person_2 \n end\nend", "def test_getting_name\n result = get_name(@person5)\n assert_equal(\"Daphne\", result)\n end", "def greet(person_1=\"default\", person_2)\n p person_1 + \" and \" + person_2\nend", "def result\n @s.first[1] || t.default\n end", "def name; @names.first; end", "def likes(names)\n who = case names.size\n when 0\n 'no one'\n when 1\n names[0]\n when 2\n names.join(' and ')\n when 3\n \"#{names[0]}, #{names[1]} and #{names[2]}\"\n else\n \"#{names[0]}, #{names[1]} and #{names.size - 2} others\"\n end\n\n \"#{who} like#{'s' if names.empty? || names.one?} this\"\nend", "def name\n [first_name, last_name].compact.join(\" \").presence || email\n end", "def greet(name)\n\n if name == \"\" || name == nil\n p nil\n else\n return \"hello #{name}!\"\n end\n\nend", "def get2number(afirstname, asecondname)\n \"Hello #{afirstname} #{asecondname}\"\nend", "def authority_name\n [surname, given_name].reject(&:blank?).join(', ')\n end", "def name\n [first_name, initial, last_name].select {|x| not x.nil?}.map {|x| x.strip}.join(\" \").titleize\n end", "def friend(friends)\r\n friends_name = []\r\n friends.each {|friend| friends_name.push(friend) if friend.length == 4}\r\n return friends_name\r\nend", "def say_bye\n if @names.nil?\n puts \"...\"\n elsif @names.respond_to?(\"join\")\n #groupere les differents noms list par des virgules\n puts \"good bye #{@names.join(\" , \")}. come back soon \"\n\n else puts \"GOODBYE #{@names}. come back SOON\"\n\n end\n\nend", "def name_return\n'Marcos Paulo'\nend", "def gender_neutral_first_name; end", "def likes(names)\n case names.size\n when 0\n \"no one likes this\"\n when 1\n \"#{names[0]} likes this\"\n when 2\n \"#{names[0]} and #{names[1]} like this\"\n when 3\n \"#{names[0]}, #{names[1]} and #{names[2]} like this\"\n else\n \"#{names[0]}, #{names[1]} and #{names.size - 2} others like this\"\n end\nend", "def find_name_or_email\n if self.first_name.present? && self.last_name.present?\n self.first_name + \" \" + self.last_name\n else\n self.name || self.email\n end\n end", "def name\n if first_name.present? && last_name.present?\n first_name + \" \" + last_name\n elsif first_name.present? && last_name.blank?\n first_name\n elsif first_name.blank? && last_name.present?\n last_name\n else\n \"No Name\"\n end\n end", "def how_many_light_sabers_do_you_own(name = \"\")\n name == \"Zach\" ? 18 : 0\nend", "def two_word_name; end", "def greet(person_1, person_2 = nil)\n if person_2.nil?\n p \"Hey \" + person_1\n else\n p \"Hey \" + person_1 + \" and \" + person_2\n end\nend", "def name\n name = ''\n name = first_name if first_name\n name = name + ' ' + last_name if last_name\n name\n end", "def greet_two(name, time_of_day)\n return \"Good #{time_of_day}, #{name.capitalize()}\"\nend", "def get_name(player_number, name)\n if player_number == 1\n then @player1 = Player.new(name)\n else\n @player2 = Player.new(name)\n end\n end", "def all_names(values)\n values.each do |name|\n puts name[1]\n end\nend", "def one_word_names(list)\n own = list.select do |c|\n c[:name].include?(\" \") == false\n end\n return own\nend", "def names(name1, name2)\n puts \"Huge announcement today! #{name1} climbed #{name2}! Congratulations!\"\nend", "def first_name_neutral; end", "def full_name(person)\n name = person[\"first_name\"] + \" \" + person[\"last_name\"]\n return name\nend", "def get_first_name\r\n @first_names.sample\r\n end", "def likes(names)\n remaining = names.length - 2\n\n if (names.length === 0) \n return \"no one likes this\"\n elsif (names.length === 1) \n return names[0] + \" likes this\"\n elsif (names.length === 2) \n return names[0] + \" and \" + names[1] + \" like this\"\n elsif (names.length === 3) \n return names[0] + \", \" + names[1] + \" and \" + names[2] + \" like this\"\n elsif (names.length > 3) \n return names[0] + \", \" + names[1] + \" and \" + remaining.to_s + \" others like this\"\n end\nend", "def mothers_name\n\t\tmothersname = mothers_names.delete_if(&:blank?).join(' ')\n\t\t( mothersname.blank? ) ? '[name not available]' : mothersname\n\tend", "def correct_name\n name == \"Chris\" || name == \"Blake\"\nend", "def name_or_email\n if name.present?\n name\n else\n email\n end\n end", "def name\n first_name + \" \" + second_name\n end", "def full_name\n\n return \"#{first_name} #{last_name}\".strip if (first_name || last_name)\n \"Anonymouse\"\n end", "def account_name\n last_four.present? ? name + ' ( ... ' + last_four.to_s + ')' : name\n end", "def combine_name(first_name, last_name)\n # Q3 CODE HERE\n return \"#{first_name} #{last_name}\"\nend", "def name\n username || email\n end", "def name\n username || email\n end", "def movie_title(friend_name, other_friend_name)\n puts \"#{friend_name} + #{other_friend_name}'s Excellent Adventure.\"\n return friend_name + other_friend_name\nend", "def family\n system \"clear\"\n smith_family = [\"John\", \"Jane\", \"Jacob\"]\n last_name = \"Smith\"\n smith_family.collect! {|person| person = person + \" \" + last_name}\n return smith_family\nend", "def get_first_name(person)\n first_name = person[:first_name]\n first_name\nend", "def name\n value = \"#{last_name}, #{first_name}\".strip\n if value == ','\n ''\n else\n value\n end\n end", "def whole_name\n [given_name, family_name].compact.join(' ')\n end", "def open_or_senior(data)\n #your code here\n return data.map{|person| (person[0]>=55 && person[1]>7) ? \"Senior\": \"Open\"}\nend", "def favourite_drink name\r\n\tif name == \"Jean-Luc\"\r\n\t\t\"tea, Earl Grey, hot\"\r\n\telsif name == \"Kathryn\"\r\n\t\t\"coffee, black\"\r\n\telse\r\n\t\t\"perhaps...horchata?\"\r\n\tend\r\nend", "def mess_with_vars(one, two, three)\n one = \"two\"\n two = \"three\"\n three = \"one\"\n return one, two, three\nend", "def test_get_first_name_returns_name\r\n name_gen = NameGenerator2.new([\"first\"], [\"last\"])\r\n\r\n fn = name_gen.get_first_name(\"don\")\r\n assert_equal(\"first\", fn)\r\n end", "def persons\n if self.infos.sex == \"Couple\"\n 2\n else\n 1\n end\n end", "def forty_two\n self[41]\n end", "def one_word_names(values)\n one_word_names = values.map {|names| names}\n one_word_names.delete_if{|names| names[1].include?\" \"}\n one_word_names.each {|info| puts info.to_s}\nend", "def test(num)\n return \"cowboy bebop\", 1990, num * num * num\nend", "def correct_name\n name == \"Chris\" || name == \"Blak\"\nend", "def test_name_generator_with_nil\nresult = name_generator(\"\")\nassert_equal(\"Inavalid ID. Please enter new ID with only lower case letters.\", result)\nend", "def getFullName(arg1=\"Barton\", arg2=\"Joey\")\n \"#{arg1}, #{arg2}\"\nend", "def extract_name_by_multi_name\n name = ''\n names_arr = []\n @text.scan(/(Family|FAMILY|family|First|first|FIRST|Given|GIVEN|given|LAST|Last|last){1}[\\s|\\W]{0,}(name|Name|NAME){1}([\\:|\\s|\\,|\\W]{1,})+([A-Z]{1}[A-Za-z]+)/) do | track |\n names_arr << track\n end \n if names_arr.size == 2\n name = names_arr[0][-1] + names_arr[1][-1]\n end\n return name \n end", "def fathers_name\n\t\tfathersname = fathers_names.delete_if(&:blank?).join(' ')\n\t\t( fathersname.blank? ) ? '[name not available]' : fathersname\n\tend", "def get_quote(person)\n if person == 'Yoda'\n return 'Do. Or do not. There is no try.'\n end\n\n if person == 'Confucius'\n return 'I hear and I forget. I see and I remember. I do and I understand.'\n end\n\n if person == 'Einstein'\n return 'Do not worry about your difficulties in Mathematics. I can assure you mine are greater.'\n end\nend", "def full_name2 first_name, last_name\n first_name + \" \" + last_name\nend", "def get_quote(person)\n if person == 'Yoda'\n return 'Do. Or do not. There is no try.'\n end\n\n if person == 'Confucius'\n return 'I hear and I forget. I see and I remember. I do and I understand.'\n end\n\n if person == 'Einstein'\n return 'Do not worry about your difficulties in Mathematics. I can assure you mine are still greater.'\n end\nend" ]
[ "0.59068733", "0.57873094", "0.5721404", "0.5703749", "0.56736416", "0.56347275", "0.5618578", "0.56125754", "0.5579377", "0.55680484", "0.5562964", "0.5561588", "0.5557634", "0.5545423", "0.5530187", "0.552261", "0.5480288", "0.54648334", "0.5462712", "0.54555017", "0.53908795", "0.5384312", "0.53765744", "0.53740263", "0.53581685", "0.53450495", "0.53166723", "0.53126955", "0.5282245", "0.52798796", "0.52533543", "0.52513164", "0.52513164", "0.5240056", "0.5220369", "0.5186859", "0.51791805", "0.5173482", "0.5168769", "0.5165145", "0.5162273", "0.5155785", "0.51529264", "0.5148834", "0.51432264", "0.5136617", "0.5134991", "0.5133871", "0.5124145", "0.51237625", "0.5119791", "0.5100838", "0.50999796", "0.50986516", "0.50887036", "0.5087466", "0.508738", "0.5083937", "0.5083146", "0.50795084", "0.50784177", "0.5067604", "0.5059454", "0.5058982", "0.50530326", "0.5048545", "0.5046531", "0.5036924", "0.50323725", "0.5027697", "0.50258857", "0.5024952", "0.5023273", "0.5022884", "0.50221527", "0.5016848", "0.5011358", "0.50109565", "0.50051814", "0.5002278", "0.49940473", "0.49938783", "0.49924105", "0.4985069", "0.49685776", "0.49604717", "0.49589926", "0.49498922", "0.49446958", "0.49437505", "0.4939598", "0.49358857", "0.49354175", "0.49339935", "0.49304554", "0.49282742", "0.49272364", "0.49196357", "0.4916483", "0.49151713", "0.49135143" ]
0.0
-1
GET /subscription_lists GET /subscription_lists.json
def index @subscription_lists = SubscriptionList.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_subscription\n response = Faraday.get(@subscription_api_url)\n response_json = JSON.parse(response.body)\n fix_response(response_json)\n end", "def list_subscriptions(user)\n get(\"/#{user}/lists/subscriptions.json\")\n end", "def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end", "def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end", "def lists\n @lists ||= ActsAsIcontact::Subscription.lists(:contactId => id)\n end", "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def show\n @list_subscription = ListSubscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_subscription }\n end\n end", "def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end", "def get_lists\n response = rest(\"get\", \"lists\")\n\n return response[\"lists\"]\n end", "def set_subscription_list\n @subscription_list = SubscriptionList.find(params[:id])\n end", "def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end", "def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end", "def lists\n client.get_lists\n end", "def list_subscriptions(options = {})\n api.graph_call(subscription_path, {}, \"get\", options)\n end", "def index\n @api_subscriptions = Api::Subscription.all\n end", "def get_subscriber_of_list(user, list, subscriber_id)\n get(\"/#{user}/#{list}/subscribers/#{subscriber_id}.json\")\n end", "def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end", "def list\n @client.call(method: :get, path: 'recipient-lists')\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def subscribe_to_list(user, list, options={})\n post(\"/#{user}/#{list}/subscribers.json\")\n end", "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end", "def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end", "def list_subs\n \t@subs = instagram_client.subscriptions\n end", "def getAllSubscriptions\n if @subscriptionLists.hasKey(\"subscriptions\")\n return @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n end", "def new\n @list_subscription = ListSubscription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list_subscription }\n end\n end", "def get_lists(user)\n get(\"/#{user}/lists.json\")\n end", "def index\n @subscription_groups = SubscriptionGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscription_groups }\n end\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def list_subscriptions options = {}\n paged_enum = subscriber.list_subscriptions project: project_path(options),\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end", "def index\r\n @subscriptions = current_business_user.subscriptions.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @subscriptions }\r\n end\r\n end", "def index\n if params[:client_id].blank?\n @subscriptions = Subscription.all\n else\n @subscriptions = Client.find(params[:client_id]).subscriptions\n end\n end", "def index\n @subscriptions = current_user.subscriptions.all\n end", "def list(options={})\n response = Mailgun.submit(:get, list_url, options)[\"items\"] || []\n end", "def index\n @lists = current_user.lists\n #@lists = List.all\n render json: @lists\n end", "def index\n @subscriptions = current_user.subscriptions.order(:created_at)\n @user = current_user\n\n if not current_user.fitbit.nil?\n begin\n @fitbit_subscriptions = JSON.parse(current_user.fitbit.client.get('/1/user/-/apiSubscriptions.json').body)['apiSubscriptions']\n rescue SocketError\n logger.error \"Can not talk to fitbit\"\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def index\n @subscriptions = Subscription.all\n end", "def index\n @subscriptions = Subscription.all\n end", "def index\n @subscriptions = Subscription.all\n end", "def index\n\n @category_subscriptions = CategorySubscription.all\n\n render json: @category_subscriptions\n\n end", "def index\n @subscriptions = Subscription.where(:binder_id => params[:binder_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def list(filter)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.queue_service_action_call('subscription', 'list', 'KalturaSubscriptionListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def list(options={})\n Mailgun.submit(:get, unsubscribe_url, options)[\"items\"]\n end", "def index\n @admin_subscriptions = Subscription.all\n end", "def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def lists(params = {})\n @api.get(\"#{@api.path}/User/Lists\", params: params)\n end", "def index\n @subscriptions = nil #the load_and_authorize_resource cancan method is loading all the subscriptions and we want to start with a clean slate here.\n if params[:company_id]\n @owner = Company.find(params[:company_id])\n @subscriptions = Subscription.where(owner_type: 'Company', owner_id: params[:company_id])\n end\n if params[:person_id]\n @owner = Person.find(params[:person_id])\n @subscriptions ||= Subscription.where(owner_type: 'Person', owner_id: params[:person_id])\n end\n \n @subscriptions ||= Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def index\n session[:sub_delete_return_to] = request.fullpath\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def index\n @subscribers = Subscriber.order('created_at DESC').page params[:page]\n @subscribers_lists_map = SubscribersList.all.map { |e| [e.name, e.id] }\n end", "def lists\n response = get 'lists'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def list_all\n arr = []\n thr = []\n\n subscriptions.each do |sub|\n sub_id = sub['subscriptionId']\n resource_groups(sub_id).each do |group|\n @api_version = '2014-06-01'\n url = build_url(sub_id, group['name'])\n\n thr << Thread.new{\n res = JSON.parse(rest_get(url))['value'].first\n arr << res if res\n }\n end\n end\n\n thr.each{ |t| t.join }\n\n arr\n end", "def index\n @subscriptions = Subscription.all\nend", "def index\n @purchase_lists = PurchaseList.all\n render json: @purchase_lists\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end", "def index\n @subscription_users = SubscriptionUser.all\n end", "def list\n get('/')\n end", "def index\n @crytosubscriptions = Crytosubscription.all\n end", "def lists(options = { :filter => :open })\n return @lists if @lists\n @lists = Client.get(\"/boards/#{id}/lists\", options).json_into(List)\n end", "def list\n get()\n end", "def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end", "def index\n @subscriptions = Subscription.where(:campaign_id => @campaign.id)\n @subscriptions = @subscriptions.joins(:member).order(:last_name)\n @subscriptions = @subscriptions.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subscriptions }\n end\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def get_subscribers\n subscriber_data = RunrWatcherServer.runr_session_get(\"subscribers\")\n return [] unless subscriber_data.present?\n list = subscriber_data[:subscribers][\"list\"]\n return [] unless list.present?\n JSON.parse list\n end", "def get_lists()\n lists = api_request(\"list\")\n return lists.split(\"\\n\")\n end", "def index\n @panel_subscriptions = Panel::Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @panel_subscriptions }\n end\n end", "def index\n @subscriptions = current_user.subscriptions.select{|s| s.manga !=nil && s.manga.display_name != nil && s.manga.name!=nil}.sort_by{|s| s.manga.display_name}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def subscriptions\n @subscriptions ||= begin\n resp = @client.access_token.get('/reader/api/0/subscription/list?output=json')\n raise \"unable to retrieve the list of subscription for user \\\"#{user_id}\\\": #{resp.inspect}\" unless resp.code_type == Net::HTTPOK\n JSON.parse(resp.body)['subscriptions'].collect do |hash|\n Google::Reader::Subscription.new(hash.merge({:client => @client}))\n end\n end\n end", "def getLists()\n url = \"https://api.nytimes.com/svc/books/v3/lists/names.json\"\n params = {}\n self.request(url, params)\n end", "def create\n @subscription = Subscription.create(params[:subscription])\n gb = Gibbon::API.new(\"6f8672a5c2393d1441c54d3be3fb79a1-us1\")\n gb.lists.subscribe({:id => \"c0ca5b3d41\", :email => {:email => params[:subscription][:email]}, :merge_vars => {:FNAME => '', :LNAME => ''}, :double_optin => false})\n end", "def getPlaylists\n\t\tuserid = current_user.uid\n\t\tplaylists = GetPlaylistMetadataFromSpotify.build.call(session[\"devise.spotify_data\"])\n\t\tPlaylist.sync_playlists(playlists, userid)\n\t\trender json: playlists\n\tend", "def index\n if is_client_app?\n if params[:user_id].present?\n t = Subscription.arel_table\n s = Subscription.statuses\n @subscriptions = Subscription.where(user_id: params[:user_id]).where(t[:status].eq(s[:authorized]).or(t[:status].eq(s[:paused])))\n else\n @subscriptions = Subscription.all\n end\n\n render json: @subscriptions\n else\n response.headers['X-Total-Count'] = @subscriptions.count.to_s\n @subscriptions = @subscriptions.page(params[:page]) if params[:page].present?\n @subscriptions = @subscriptions.per(params[:per]) if params[:per].present?\n\n _render collection: @subscriptions, flag: params[:flag].try(:to_sym)\n end\n end", "def subscriptions( params={} )\n subscriptions = get_connections(\"subscriptions\", params)\n return map_connections subscriptions, :to => Facebook::Graph::Subscription\n end", "def all_subscriptions(&block)\n subscriptions.list(&block)\n end", "def list\n @topic = get_topic(params)\n @topic_list = get_topic_list(@topic)\n respond_to do |format|\n format.html\n format.xml { render xml: @topic_list.to_xml }\n format.json { render json: @topic_list.to_json }\n end\n end", "def list(id)\n get(\"lists/#{id}\").list\n end", "def index\n @lists = current_project.lists\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/#{get_user_id!(params)}#{@url_suffix}\", params)\n end", "def index\n @lists = List.all\n render json: @lists\n end", "def index\n @api_v1_shopping_lists = ShoppingList.all\n end", "def index\n @misuration_subscriptions = current_user.misuration_subscriptions.all\n end", "def index\n @subscriptions = @screen.subscriptions.all\n auth!\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def list(**options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list'))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end", "def playlists(args={})\n query = \"/?client_id=#{@client_id}&format=#{format.to_s}&#{format_parameters(args)}\"\n path = __method__.to_s\n http_get(path, query)\n end", "def index\n @lists = current.user.list\n end", "def index\n @subscription_types = SubscriptionType.all\n end", "def getChannelsList\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n result = HTTParty.get(broker_url + \"/resources/channels\", :verify => false)\n temp2 = JSON.parse(result.body)\n\n channels_data = temp2[\"resource_response\"][\"resources\"]\n return channels_data\n \n end", "def index\n @vendor_subscriptions = VendorSubscription.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def index\n paginate json: @user.playlists.all\n end", "def all\n get(\"#{domain}/unsubscribes\")\n end", "def index\n @my_subscriptions = current_user.active_subscriptions\n end", "def index\n @q = ::Pushar::Core::Subscription.unscoped.search(params[:q])\n @q.sorts = 'created_at desc' if @q.sorts.empty?\n @subscriptions = @q.result(distinct: true).page(params[:page]).per(50)\n end", "def list_all_webhook_subscription_for_tool_proxy(opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n {}\n \n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions\",\n )\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:get, path, query_params, form_params, headers)\n response\n \n\n end", "def list(q=nil)\n _params = {:q => q}\n return @master.call 'subaccounts/list', _params\n end", "def registered_lists\n List.registered(id)\n end" ]
[ "0.77005607", "0.7324029", "0.72297305", "0.72297305", "0.6923813", "0.6921102", "0.69118005", "0.68067193", "0.6754073", "0.6748711", "0.6720072", "0.67076004", "0.66942346", "0.66927594", "0.66211605", "0.66161394", "0.66109455", "0.6605383", "0.6571495", "0.6538525", "0.65364695", "0.64991724", "0.6493171", "0.6487738", "0.64776695", "0.6467541", "0.64387465", "0.6427003", "0.639566", "0.63842756", "0.6323732", "0.6311195", "0.62695223", "0.6255998", "0.6251871", "0.6251704", "0.6249994", "0.6249994", "0.6249994", "0.6240242", "0.62380743", "0.6227303", "0.62106746", "0.62106746", "0.61952597", "0.6181374", "0.6177034", "0.6175202", "0.61413777", "0.6125532", "0.6116182", "0.6114722", "0.60789245", "0.60692143", "0.6061233", "0.6051416", "0.6044954", "0.60322845", "0.6020827", "0.60182506", "0.60174865", "0.6010663", "0.60067064", "0.60044056", "0.59973997", "0.5991815", "0.5990219", "0.59816223", "0.59808886", "0.59789276", "0.5975089", "0.597442", "0.5971371", "0.59713364", "0.5969972", "0.59594655", "0.59333533", "0.5929975", "0.5928087", "0.5916917", "0.59159327", "0.5911041", "0.5899462", "0.5892488", "0.58849555", "0.58849555", "0.5872205", "0.5854844", "0.58517057", "0.584382", "0.58372146", "0.58367985", "0.58361346", "0.5836096", "0.58335197", "0.5832358", "0.5829156", "0.58265686", "0.5825091", "0.5824991" ]
0.75479186
1
GET /subscription_lists/1 GET /subscription_lists/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @subscription_lists = SubscriptionList.all\n end", "def show\n @list_subscription = ListSubscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_subscription }\n end\n end", "def list_subscription\n response = Faraday.get(@subscription_api_url)\n response_json = JSON.parse(response.body)\n fix_response(response_json)\n end", "def list_subscriptions(user)\n get(\"/#{user}/lists/subscriptions.json\")\n end", "def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end", "def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end", "def get_list(list_id)\n rest(\"get\", \"lists/#{list_id}\")\n end", "def set_subscription_list\n @subscription_list = SubscriptionList.find(params[:id])\n end", "def new\n @list_subscription = ListSubscription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list_subscription }\n end\n end", "def get_subscriber_of_list(user, list, subscriber_id)\n get(\"/#{user}/#{list}/subscribers/#{subscriber_id}.json\")\n end", "def get_list(user, list)\n get(\"/#{user}/lists/#{list}.json\")\n end", "def subscriber_list(statuspage_id)\n request :method => :get,\n :url => @url + 'subscriber/list/' + statuspage_id\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def index\n @api_subscriptions = Api::Subscription.all\n end", "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def list_subscribers(user, list)\n get(\"/#{user}/#{list}/subscribers.json\")\n end", "def index\n if params[:client_id].blank?\n @subscriptions = Subscription.all\n else\n @subscriptions = Client.find(params[:client_id]).subscriptions\n end\n end", "def index\n @subscriptions = Subscription.where(:binder_id => params[:binder_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end", "def index\n @subscription_groups = SubscriptionGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscription_groups }\n end\n end", "def index\r\n @subscriptions = current_business_user.subscriptions.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @subscriptions }\r\n end\r\n end", "def lists\n @lists ||= ActsAsIcontact::Subscription.lists(:contactId => id)\n end", "def subscribe_to_list(user, list, options={})\n post(\"/#{user}/#{list}/subscribers.json\")\n end", "def list_subs\n \t@subs = instagram_client.subscriptions\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n @subscriptions = current_user.subscriptions.order(:created_at)\n @user = current_user\n\n if not current_user.fitbit.nil?\n begin\n @fitbit_subscriptions = JSON.parse(current_user.fitbit.client.get('/1/user/-/apiSubscriptions.json').body)['apiSubscriptions']\n rescue SocketError\n logger.error \"Can not talk to fitbit\"\n end\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def index\n @list_items = List.find(params[:list_id]).list_items\n\n render json: @list_items\n end", "def show\n @list = current_project.lists.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n @subscriptions = Subscription.all\n end", "def index\n @subscriptions = Subscription.all\n end", "def index\n @subscriptions = Subscription.all\n end", "def get_list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/\", params)\n end", "def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(url)\n JSON.parse(resp.body)[\"value\"]\n end", "def index\n session[:sub_delete_return_to] = request.fullpath\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n @subscription = Subscription.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end", "def list\n url = prefix + \"list\"\n return response(url)\n end", "def index\n\n @category_subscriptions = CategorySubscription.all\n\n render json: @category_subscriptions\n\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription }\n end\n end", "def index\n @admin_subscriptions = Subscription.all\n end", "def list_subscriptions(options = {})\n api.graph_call(subscription_path, {}, \"get\", options)\n end", "def index\n @subscriptions = current_user.subscriptions.all\n end", "def getAllSubscriptions\n if @subscriptionLists.hasKey(\"subscriptions\")\n return @subscriptionLists.getRepositoryObject(\"subscriptions\").getObject\n end\n end", "def show\r\n @subscription = Subscription.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @subscription }\r\n end\r\n end", "def list\n @client.call(method: :get, path: 'recipient-lists')\n end", "def create\n @list_subscription = ListSubscription.new(params[:list_subscription])\n\n respond_to do |format|\n if @list_subscription.save\n format.html { redirect_to @list_subscription, notice: 'List subscription was successfully created.' }\n format.json { render json: @list_subscription, status: :created, location: @list_subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @subscription }\n end\n end", "def index\n @lists = current_user.lists\n #@lists = List.all\n render json: @lists\n end", "def index\n @subscriptions = Subscription.all\nend", "def index\n @subscriptions = Subscription.where(:campaign_id => @campaign.id)\n @subscriptions = @subscriptions.joins(:member).order(:last_name)\n @subscriptions = @subscriptions.page(params[:page]).per(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subscriptions }\n end\n end", "def index\n @purchase_lists = PurchaseList.all\n render json: @purchase_lists\n end", "def index\n @api_v1_shopping_lists = ShoppingList.all\n end", "def index\n @crytosubscriptions = Crytosubscription.all\n end", "def get_lists\n response = rest(\"get\", \"lists\")\n\n return response[\"lists\"]\n end", "def index\n @subscriptions = current_user.subscriptions.select{|s| s.manga !=nil && s.manga.display_name != nil && s.manga.name!=nil}.sort_by{|s| s.manga.display_name}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def create\n @subscription = Subscription.create(params[:subscription])\n gb = Gibbon::API.new(\"6f8672a5c2393d1441c54d3be3fb79a1-us1\")\n gb.lists.subscribe({:id => \"c0ca5b3d41\", :email => {:email => params[:subscription][:email]}, :merge_vars => {:FNAME => '', :LNAME => ''}, :double_optin => false})\n end", "def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list_id)\n url = build_url(url)\n response = RestClient.get(url, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def index\n @lists = current_project.lists\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lists }\n end\n end", "def index\n @panel_subscriptions = Panel::Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @panel_subscriptions }\n end\n end", "def index\n @tasks = current_user.lists.find(params[:list_id]).tasks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tasks }\n end\n end", "def show\n json_response(@user_subscription)\n end", "def index\n @subscriptions = nil #the load_and_authorize_resource cancan method is loading all the subscriptions and we want to start with a clean slate here.\n if params[:company_id]\n @owner = Company.find(params[:company_id])\n @subscriptions = Subscription.where(owner_type: 'Company', owner_id: params[:company_id])\n end\n if params[:person_id]\n @owner = Person.find(params[:person_id])\n @subscriptions ||= Subscription.where(owner_type: 'Person', owner_id: params[:person_id])\n end\n \n @subscriptions ||= Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subscriptions }\n end\n end", "def lists\n client.get_lists\n end", "def index\n @list = List.find(params[:list_id])\n @items = @list.items\n\n respond_with @items\n end", "def destroy\n @list_subscription = ListSubscription.find(params[:id])\n @list_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to list_subscriptions_url }\n format.json { head :no_content }\n end\n end", "def list\n get()\n end", "def list_subscriptions options = {}\n paged_enum = subscriber.list_subscriptions project: project_path(options),\n page_size: options[:max],\n page_token: options[:token]\n\n paged_enum.response\n end", "def index\n @subscribers = Subscriber.order('created_at DESC').page params[:page]\n @subscribers_lists_map = SubscribersList.all.map { |e| [e.name, e.id] }\n end", "def index\n @subscription_users = SubscriptionUser.all\n end", "def get(incoming={})\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :guid => HttpClient::Preconditions.assert_class_or_nil('guid', HttpClient::Helper.to_uuid(opts.delete(:guid)), String),\n :organization_key => HttpClient::Preconditions.assert_class_or_nil('organization_key', opts.delete(:organization_key), String),\n :user_guid => HttpClient::Preconditions.assert_class_or_nil('user_guid', HttpClient::Helper.to_uuid(opts.delete(:user_guid)), String),\n :publication => HttpClient::Preconditions.assert_class_or_nil('publication', opts[:publication].nil? ? nil : (opts[:publication].is_a?(Apidoc::Models::Publication) ? opts.delete(:publication) : Apidoc::Models::Publication.apply(opts.delete(:publication))), Apidoc::Models::Publication),\n :limit => HttpClient::Preconditions.assert_class_or_nil('limit', opts.delete(:limit), Integer),\n :offset => HttpClient::Preconditions.assert_class_or_nil('offset', opts.delete(:offset), Integer)\n }.delete_if { |k, v| v.nil? }\n @client.request(\"/subscriptions\").with_query(query).get.map { |hash| Apidoc::Models::Subscription.new(hash) }\n end", "def index\n @subscription_types = SubscriptionType.all\n end", "def index\n if is_client_app?\n if params[:user_id].present?\n t = Subscription.arel_table\n s = Subscription.statuses\n @subscriptions = Subscription.where(user_id: params[:user_id]).where(t[:status].eq(s[:authorized]).or(t[:status].eq(s[:paused])))\n else\n @subscriptions = Subscription.all\n end\n\n render json: @subscriptions\n else\n response.headers['X-Total-Count'] = @subscriptions.count.to_s\n @subscriptions = @subscriptions.page(params[:page]) if params[:page].present?\n @subscriptions = @subscriptions.per(params[:per]) if params[:per].present?\n\n _render collection: @subscriptions, flag: params[:flag].try(:to_sym)\n end\n end", "def get_lists(user)\n get(\"/#{user}/lists.json\")\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/list\", params)\n end", "def list(filter)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter)\n\t\t\tclient.queue_service_action_call('subscription', 'list', 'KalturaSubscriptionListResponse', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend", "def list_all\n arr = []\n thr = []\n\n subscriptions.each do |sub|\n sub_id = sub['subscriptionId']\n resource_groups(sub_id).each do |group|\n @api_version = '2014-06-01'\n url = build_url(sub_id, group['name'])\n\n thr << Thread.new{\n res = JSON.parse(rest_get(url))['value'].first\n arr << res if res\n }\n end\n end\n\n thr.each{ |t| t.join }\n\n arr\n end", "def index\n @lists = List.all\n render json: @lists\n end", "def list(id)\n get(\"lists/#{id}\").list\n end", "def index\n @subscriptions = @screen.subscriptions.all\n auth!\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subscriptions }\n end\n end", "def list\n get('/')\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def show\n @list = List.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list }\n end\n end", "def index\n\n if @notification\n json_response(@notification.user_subscriptions)\n end\n if request.path_parameters.has_key?(:user_id)\n json_response(@user.user_subscriptions)\n end\n end", "def list\n @collections = Admin::Collection.names\n\n render json: { collections: @collections }\n end", "def list(params = {})\n http_helper.send_get_request(\"#{@url_prefix}\", params)\n end", "def list(options={})\n response = Mailgun.submit(:get, list_url, options)[\"items\"] || []\n end", "def show\n @subscription_request = SubscriptionRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subscription_request }\n end\n end", "def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end", "def show\n render json: @list.as_json(include: [lists: {include: [cards: {methods: [:user_ids]}]}])\n end", "def show\n @mailing_list = MailingList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mailing_list }\n end\n end" ]
[ "0.7450691", "0.7405138", "0.7309067", "0.7055717", "0.69659877", "0.69659877", "0.693317", "0.688747", "0.6885521", "0.68203974", "0.675009", "0.6644347", "0.66364133", "0.6614293", "0.65854365", "0.64656943", "0.6442921", "0.6400824", "0.63947463", "0.6386045", "0.63426596", "0.6341797", "0.6333284", "0.63185376", "0.6317229", "0.6300781", "0.62860703", "0.6273259", "0.6242929", "0.6242929", "0.6242929", "0.62304866", "0.62296015", "0.62296015", "0.619853", "0.61926603", "0.6192464", "0.6192464", "0.6192464", "0.6192464", "0.6190846", "0.6172117", "0.61706614", "0.61648804", "0.61574984", "0.6151895", "0.6141868", "0.6136979", "0.6133561", "0.6129443", "0.61134726", "0.6110502", "0.61089927", "0.61037695", "0.60971797", "0.60756624", "0.60720754", "0.6070344", "0.6057692", "0.605375", "0.6050735", "0.604751", "0.6044099", "0.6040837", "0.60391814", "0.6036105", "0.60107696", "0.5989673", "0.59890574", "0.59818643", "0.59592485", "0.5954004", "0.5952261", "0.59404063", "0.59390223", "0.59160453", "0.59109503", "0.59028333", "0.58988065", "0.5897544", "0.5897544", "0.58898544", "0.58898544", "0.5889641", "0.58574367", "0.585539", "0.58549833", "0.5848006", "0.5841436", "0.5837782", "0.5837782", "0.5837782", "0.5837782", "0.58293223", "0.5827045", "0.58250374", "0.58160836", "0.5812372", "0.5799574", "0.5796891", "0.5788285" ]
0.0
-1
POST /subscription_lists POST /subscription_lists.json
def create # TODO switch on "rule" value, and use the proper value in the Where puts "\n\n\n\n\n\n\n\n\nThese are the params: #{params.inspect}" puts "\n\n\n\n\nThis is subscription_list_params object: #{subscription_list_params.inspect}\n\n\nand its class #{subscription_list_params.class}\n\n\n\n" #@subscription_list = SubscriptionList.new(subscription_list_params) @subscription_list = SubscriptionList.new(subscription_list_params[:subscription_list]) # TODO add a Where according to the rule # e.g. @subscription_lists = SubscriptionList.where(:id => params[:subscriptions]) @subscription_list.students = get_students_from_rule_param set_proper_rule_type_from_params(@subscription_list) puts "\n\n\n\n\n@subscription_list.students: #{@subscription_list.students.inspect}\n\n\nand its class #{@subscription_list.students.class}\n\n\n\n" respond_to do |format| if @subscription_list.save format.html { redirect_to @subscription_list, notice: 'La Lista de Entrega se creó exitosamente.' } format.json { render :show, status: :created, location: @subscription_list } else format.html { render :new } format.json { render json: @subscription_list.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @list_subscription = ListSubscription.new(params[:list_subscription])\n\n respond_to do |format|\n if @list_subscription.save\n format.html { redirect_to @list_subscription, notice: 'List subscription was successfully created.' }\n format.json { render json: @list_subscription, status: :created, location: @list_subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.create(params[:subscription])\n gb = Gibbon::API.new(\"6f8672a5c2393d1441c54d3be3fb79a1-us1\")\n gb.lists.subscribe({:id => \"c0ca5b3d41\", :email => {:email => params[:subscription][:email]}, :merge_vars => {:FNAME => '', :LNAME => ''}, :double_optin => false})\n end", "def subscribe_to_list(user, list, options={})\n post(\"/#{user}/#{list}/subscribers.json\")\n end", "def create_list(params={})\n @obj.post('create-list', @auth.merge(params))\n end", "def create_list(name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"post\", \"lists\", data)\n end", "def set_subscription_list\n @subscription_list = SubscriptionList.find(params[:id])\n end", "def create\n @subscription = Subscription.create(params[:subscription])\n groups = params[:subscription][:group_name].split(\",\").collect(&:strip)\n email = params[:subscription][:email]\n begin\n gb = Gibbon::API.new(\"f24fdd53217fab0b0698fdaba15c0c6f-us7\")\n subscribe = gb.lists.subscribe({\n :id => \"caa152eac4\",\n :email => {:email => email},\n :merge_vars => {\n :FNAME => \"\",\n :LNAME => \"\",\n :groupings => {\n 0 => {\n :id => 4457,\n :groups => groups\n }\n }\n },\n :update_existing => true,\n :double_optin => false\n })\n #logger.debug subscribe\n rescue Gibbon::MailChimpError\n \n end\n redirect_to \"/contact\"\n end", "def new\n @list_subscription = ListSubscription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @list_subscription }\n end\n end", "def create\n @list = List.create!(list_params)\n json_response(@list, :created)\n end", "def create_new_subscription\n @subscription_offers = Subscription.get_subscription_list\n end", "def subscription_list_params\n #params[:subscription_list].permit(:name, :description)\n #params.permit(:careers, :years, :subjects).permit(subscription_list: [ :name, :description ])\n #params.permit(:careers).require(:subscription_list).permit(:name, :description)\n params.permit! # So far, no strong params here...\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n if @subscription.save\n render json: @subscription, status: :created, location: @subscription\n else\n render json: @subscription.errors, status: :unprocessable_entity\n end\n end", "def post(subscription_form)\n HttpClient::Preconditions.assert_class('subscription_form', subscription_form, Apidoc::Models::SubscriptionForm)\n @client.request(\"/subscriptions\").with_json(subscription_form.to_json).post { |hash| Apidoc::Models::Subscription.new(hash) }\n end", "def index\n @subscription_lists = SubscriptionList.all\n end", "def subscribe(list)\n l = ActsAsIcontact::List.find(list)\n s = ActsAsIcontact::Subscription.new(:contactId => id, :listId => l.id)\n s.save\n end", "def subscribe_to_list(permalink, body, *args)\n http_method = :post\n path = '/words/wordOfTheDayList/{permalink}/subscription'\n path.sub!('{permalink}', permalink.to_s)\n\n # Ruby turns all key-value arguments at the end into a single hash\n # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')\n # becomes {:limit => 10, :part_of_speech => 'verb'}\n last_arg = args.pop if args.last.is_a?(Hash)\n last_arg = args.pop if args.last.is_a?(Array)\n last_arg ||= {}\n\n # Look for a kwarg called :request_only, whose presence indicates\n # that we want the request itself back, not the response body\n if last_arg.is_a?(Hash) && last_arg[:request_only].present?\n request_only = true\n last_arg.delete(:request_only)\n end\n\n params = last_arg\n body ||= {}\n request = Wordnik::Request.new(http_method, path, :params => params, :body => body)\n request_only ? request : request.response.body\n end", "def create\n @list = List.new(list_params)\n\n if @list.save\n respond_successfully(I18n.t('integral.backend.lists.notification.creation_success'), backend_list_path(@list))\n else\n respond_failure(I18n.t('integral.backend.lists.notification.creation_failure'), :new)\n end\n end", "def list_subscription\n response = Faraday.get(@subscription_api_url)\n response_json = JSON.parse(response.body)\n fix_response(response_json)\n end", "def create\n s_params = params[:subscription]\n s_params.delete(:id)\n @subscription = Subscription.new(s_params)\n @subscription.save\n respond_with(@subscription)\n end", "def subscribe(list_id, subscribers = [])\n attrs = {\n listId: list_id,\n subscribers: subscribers\n }\n Iterable.request(conf, '/lists/subscribe').post(attrs)\n end", "def create / update_subscriptions\n end", "def create_list(name)\n path = \"lists\"\n params = { list: { name: name }}\n list = request(path, params, :post)\n list_id = list[:id]\n # output full list again\n show_list(list_id)\n end", "def create\n @list = current_user.topics.create list_params\n end", "def post body=nil, headers={}\n @connection.post \"subscriptions.json\", body, headers\n end", "def create\n megam_rest.post_subscriptions(to_hash)\n end", "def create\n @list = current_user.lists.build(params[:list])\n respond_to do |format|\n format.js\n end\n end", "def create\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: (I18n.t :subscription_created) }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_list(name, source, opt_in_type)\n endpoint = \"/api/v1/list/create/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end", "def create(name)\n Iterable.request(conf, '/lists').post(name: name)\n end", "def create_transcriptions_listtranscription(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/transcriptions/listtranscription.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'status' => options['status'],\r\n 'dateTranscribed' => options['date_transcribed']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def create_list(params)\n MailManager::List.create(params)\n end", "def create_list(name, source, opt_in_type)\n endpoint = \"/api/#{@version}/list/create/\"\n custom_params = {\n \"name\" => name,\n \"source\" => source,\n \"opt_in_type\" => opt_in_type\n }\n make_post_request(endpoint, custom_params)\n end", "def create\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to root_url, notice: 'Subscription was successfully created.' }\n format.json { render action: 'show', status: :created, location: @subscription }\n else\n format.html { render action: 'new' }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = current_user.lists.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = @target.create_subscription(subscription_params)\n return_back_or_ajax\n end", "def create\n @subscription = current_user.subscriptions.create(subscription_params)\n redirect_to @playlist\n end", "def create\n @list = @user.lists.create(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_subscriber_list_details(slug:, params: {})\n patch_json(\n \"#{endpoint}/subscriber-lists/#{slug}\",\n params,\n )\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n respond_to do |format|\n\t\n if @subscription.valid? && @subscription.save\n\t SubscriptionMailer.delay.send_welcome(@subscription)\n\t \n format.html { redirect_to \"/subscriptions/done\", notice: 'Twoj adres zostal dodany do listy mailingowej' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.lists')\n url = build_url(url)\n payload = list.to_json\n response = RestClient.post(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def create\n list = List.find(params[:list_id])\n @list_item = list.list_items.new(list_items_params)\n @list_item.save ? json_response(@list_item) : json_response(@list_item.errors, status = :not_acceptable)\n end", "def create\n\n nested = params[:list].delete(:list_items_attributes)\n\n @list = List.new( params[:list] )\n @list.user = current_user\n\n records = nested.collect do |_, fields| \n\n ListItem.new( { \"list\" => @list }.merge( fields ) ) if !item_blank?( fields )\n\n end.compact\n\n respond_to do |format|\n if @list.save && records.map( &:save ).all?\n\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n\n else\n\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def create\n @list = current_user.lists.new(new_list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to my_list_path(@list), notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: my_list_path(@list) }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to club_path(@list.club_id), notice: 'List was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def push_list(stream, *array)\n post stream, 'list' => array.flatten.map{|item| {'listItem' => item}}\n end", "def create_list(project_id, list)\n record \"/projects/#{project_id}/todos/create_list\", list\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to Binder.find(@subscription.binder_id), notice: 'Subscription was successfully created.' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(subscription_params)\n @subscription.user = current_user\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: t('controller.successfully_created', model: t('activerecord.models.subscription')) }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = @organization.lists.build(list_params.merge(creator: authed_user))\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: [@list.organization, @list] }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to campaign_subscription_path(@campaign, @subscription), :notice => 'Subscription was successfully created.' }\n format.json { render :json => @subscription, :status => :created, :location => @subscription }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_subscriptions\n Subscription.create_subscriptions(self.id, self.hashtag)\n end", "def create\n @list = List.new(params[:list])\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render json: @list, status: :created, location: @list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @twitter_list = TwitterList.new(params[:twitter_list])\n\n respond_to do |format|\n if @twitter_list.save\n format.html { redirect_to @twitter_list, notice: 'Twitter list was successfully created.' }\n format.json { render json: @twitter_list, status: :created, location: @twitter_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @twitter_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@subscription = Subscription.new(params[:subscription])\n\t\trespond_to do |format|\n\t\t\tif fonct_new_dup?\n\t\t\t\tobject_orig=Subscription.find(params[:object_orig_id])\n\t\t\tst = @subscription.create_duplicate(object_orig)\n\t\t\telse\n\t\t\tst = @subscription.save\n\t\t\tend\n\t\t\tif st\n\t\t\t\t#format.html { redirect_to(@subscription, :notice => 'Subscription was successfully created.') }\n\t\t\t\tflash[:notice] = 'Subscription was successfully created.'\n\t\t\t\tparams[:id]= @subscription.id\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { render :xml => @subscription, :status => :created, :location => @subscription }\n\t\t\telse\n\t\t\t\t@ingroups = Group.all\n\t\t\t\t@inprojects = Project.all\n\t\t\t\t@fortypesobjects=Typesobject.get_from_observer\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @list = List.new(list_params)\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @subscription_list.destroy\n respond_to do |format|\n format.html { redirect_to subscription_lists_url, notice: 'La Lista de Entrega se borró exitosamente.' }\n format.json { head :no_content }\n end\n end", "def create_list(name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.post(\n '/lists', body: list.post_body, headers: headers\n )\n check_and_raise_errors(response)\n attributes = response.parsed_response.merge!('items' => [])\n Todoable::List.build_from_response(attributes)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def subscribe_to_lists(list_names, email)\n walk_recipients(list_names, email) do |lr, list_id, contact_id|\n if lr.nil?\n ::Mailjet::Listrecipient.create(list_id: list_id, contact_id: contact_id, is_unsubscribed: 'false')\n elsif lr.is_unsubscribed\n lr.update_attributes(is_unsubscribed: 'false', unsubscribed_at: nil)\n end\n end\n rescue ::Mailjet::ApiError\n # ignore\n end", "def create\n @subscription = Subscription.new(subscription_params)\n\n respond_to do |format|\n if @subscription.save\n record_activity :create, @subscription\n format.html { redirect_to edit_subscription_path(@subscription),\n notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'Nice Work- List Created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_subscription\n session[:merchant_subscription_id] = 'User' + sprintf('%03d', rand(1000)) + 'Subscription' + sprintf('%04d', rand(10000))\n\n # prepare payload\n data = {\n :Amount => params[:product] == '1' ? 1.99 : 3.99,\n :Category => 1,\n :Channel => 'MOBILE_WEB',\n :Description => 'Word game 1',\n :MerchantTransactionId => session[:merchant_subscription_id],\n :MerchantProductId => 'wordGame1',\n :MerchantPaymentRedirectUrl => settings.subscription_redirect_url,\n :MerchantSubscriptionIdList => 'sampleSubscription1',\n :IsPurchaseOnNoActiveSubscription => 'false',\n :SubscriptionRecurringNumber => '99999',\n :SubscriptionRecurringPeriod => 'MONTHLY',\n :SubscriptionRecurringPeriodAmount => 1\n }\n\n response = RestClient.post settings.notary_app_sign_url, :payload => data.to_json\n from_json = JSON.parse response\n\n redirect settings.FQDN + \"/Commerce/Payment/Rest/2/Subscriptions?clientid=#{settings.api_key}&SignedPaymentDetail=#{from_json['signed_payload']}&Signature=#{from_json['signature']}\"\nend", "def create\n @list = List.new(list_params)\n @list.user = current_user\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render :show, status: :created, location: @list }\n else\n format.html { render :new }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @purchase_list = PurchaseList.new(purchase_list_params)\n @purchase_list.save\n end", "def subscribe_to_newsletter\n # SubscribeUserToMailingListJob.perform_now(params[:email]);\n\n gb = Gibbon::Request.new\n\n list_id = ENV[\"MAILCHIMP_LIST_ID\"]\n\n gb.lists(list_id)\n .members\n .create(body: { email_address: params[:email], status: \"subscribed\"})\n\n render_success(\"Successfully Subscribed\")\n end", "def create\n @admin_subscription = Subscription.new(admin_subscription_params)\n\n respond_to do |format|\n if @admin_subscription.save\n format.html { redirect_to [:admin, @admin_subscription], notice: 'L\\'abonnement a bien été créé !' }\n format.json { render :show, status: :created, location: @admin_subscription }\n else\n format.html { render :new }\n format.json { render json: @admin_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe_to_list(list_id, email, name)\n begin\n @mc.lists.subscribe(list_id, { email: email}, merge_vars: { FIRSTNAME: name, STATUS: 'Subscribed' })\n flash[:success] = 'To complete the subscription process, please click the link in the email we just sent you.'\n rescue Mailchimp::ListAlreadySubscribedError\n flash[:warning] = \"#{email} is already subscribed to the list\"\n rescue Mailchimp::ListDoesNotExistError\n flash[:error] = \"The list could not be found\"\n rescue Mailchimp::Error => ex\n if ex.message\n flash[:warning] = ex.message\n else\n flash[:warning] = \"An unknown error occurred\"\n end\n end\n end", "def create\n @list = List.new(list_params)\n\n respond_to do |format|\n if @list.save\n format.html { redirect_to @list, notice: 'List was successfully created.' }\n format.json { render action: 'show', status: :created, location: @list }\n else\n format.html { render action: 'new' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @list_subscription = ListSubscription.find(params[:id])\n @list_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to list_subscriptions_url }\n format.json { head :no_content }\n end\n end", "def create\n @question_list = QuestionList.new(question_list_params)\n\n respond_to do |format|\n if @question_list.save\n format.html { redirect_to @question_list, notice: 'Question list was successfully created.' }\n format.json { render :show, status: :created, location: @question_list }\n else\n format.html { render :new }\n format.json { render json: @question_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_list(name)\n Wunderlist::List.new(name, false, self).save\n end", "def create\n @invite_list = InviteList.new(params[:invite_list])\n\n respond_to do |format|\n if @invite_list.save\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully created.' }\n format.json { render json: @invite_list, status: :created, location: @invite_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def signup_newsletter\n pp params\n #return unless ENV['RAILS_ENV'] = \"production\"\n\n # need an API key too\n list_id_newsletter = ENV['MAILCHIMP_LIST_ID_NEWSLETTER']\n\n msg = nil\n status = nil\n\n begin\n Gibbon::Request.lists(list_id_newsletter)\n .members\n .create(\n body: {\n email_address: mailchimp_params[:email_address],\n status: STATUS_SUBSCRIBED,\n merge_fields: {\n FNAME: mailchimp_params[:first_name],\n },\n }\n )\n msg = \"All right! You are now subscribed.\"\n rescue Gibbon::MailChimpError => e\n msg = \"Good news! You are already subscribed.\"\n end\n\n render json: {message: msg}, status: 200\n end", "def create\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription.transaction, notice: 'Subscription was successfully created.' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n args = ZAPIArgs.new\n args.uri = Resource_Endpoints::POST_SUBSCRIPTION\n\n args.req_body = ZAPIArgs.new\n args.req_body.accountKey = SAMPLE_ACCOUNT_KEY\n args.req_body.contractEffectiveDate = '2013-02-1'\n args.req_body.termType = 'TERMED'\n args.req_body.initialTerm = '12'\n args.req_body.autoRenew = true\n args.req_body.renewalTerm = \"3\"\n args.req_body.notes = 'Test POST subscription from z-ruby-sdk'\n args.req_body.subscribeToRatePlans = []\n args.req_body.subscribeToRatePlans[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].productRatePlanId = 'ff8080811ca15d19011cdda9b0ad3b51'\n args.req_body.subscribeToRatePlans[0].chargeOverrides = []\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0] = ZAPIArgs.new\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].productRatePlanChargeId =\n 'ff8080811ca15d19011cddad8c953b53'\n args.req_body.subscribeToRatePlans[0].chargeOverrides[0].quantity = 10\n args.req_body.invoiceTargetDate = '2013-12-31'\n args.req_body.invoiceCollect = false\n\n puts \"========== CREATE A SUBSCRIPTION ============\"\n\n begin\n @z_client.post(args) do |resp|\n ap resp\n return resp.subscriptionNumber if resp.httpStatusCode.to_i == 200 && resp.success\n end\n rescue ArgumentError => e\n puts e.message\n rescue RuntimeError => e\n puts e.message\n end\n\n nil\n end", "def create\n @mailing_list = MailingList.new(params[:mailing_list])\n\n respond_to do |format|\n if @mailing_list.save\n format.html { redirect_to @mailing_list, notice: 'Mailing list was successfully created.' }\n format.json { render json: @mailing_list, status: :created, location: @mailing_list }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mailing_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categories = Category.all\n @subscription = Subscription.new(subscription_params)\n respond_to do |format|\n if @subscription.save\n\t @subscription.update(ordinal: Subscription.count)\n SubscriptionMailer.with(subscription: @subscription, new: \"true\").notification_email.deliver_now\n format.html { render :subscription_judging, notice: '加盟店サブスクショップの審査申請しました' }\n format.json { render :show, status: :created, location: @subscription }\n else\n format.html { render :new }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = current_user.lists.build(params[:list])\n @list.user = current_user\n @user = @list.user\n respond_to do |format|\n if @list.save\n \n format.html { redirect_to root_path, notice: 'List was successfully created!' }\n format.json { render json: @user, status: :created, location: @user }\n else\n @feed_items = []\n format.html { render action: \"new\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end", "def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end", "def find_subscriber_list(attributes)\n query_string = nested_query_string(attributes)\n get_json(\"#{endpoint}/subscriber-lists?\" + query_string)\n end", "def create\n @email_list = EmailList.new(email_list_params)\n\n respond_to do |format|\n if @email_list.save\n format.html { redirect_to @email_list, notice: 'Email list was successfully created.' }\n format.json { render :show, status: :created, location: @email_list }\n else\n format.html { render :new }\n format.json { render json: @email_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def createItemOfList\n results1 = checkUser(params[:target_account]) #userid user to give the money\n if results1.code == 200\n parameters={user_id: (@current_user[\"id\"]).to_i, description: (params[:description]), date_pay: params[:date_pay], cost: params[:cost], target_account: params[:target_account], state_pay:params[:state_pay]}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4055/lists\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n elsif results1.code == 404\n renderError(\"Not Found\", 404, \"The resource does not exist\")\n end\n end", "def subscription_params\n params.require(:subscription).permit(:subscribed_id)\n end", "def create\n # params[:id] is the knowmadics id\n\n @api_subscription = Api::Subscription.new(api_subscription_params)\n\n respond_to do |format|\n if @api_subscription.save\n format.html { redirect_to @api_subscription, notice: 'Subscription was successfully created.' }\n format.json { render :show, status: :created, location: @api_subscription }\n else\n format.html { render :new }\n format.json { render json: @api_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listitem = Listitem.new(listitem_params)\n\n if @todolist.listitems << @listitem\n render :show, status: :created, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend", "def create\n @task_list = TaskList.new(task_list_params)\n\n if @task_list.save\n render json: @task_list, status: :created, location: @task_list\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end", "def subscription_params\n params.require(:subscription).permit(:client_id, :description, :plan_id, :primary_domain_id, :quantity, :next_bill_date, :bill_now, :auto_bill,\n :domains_attributes => [:id, :subscription_id, :url, :ssl_enabled]\n )\n end", "def test_list\n @builder.write_list('http://lancaster.myreadinglists.org/lists/4510B70F-7C50-D726-4A6C-B129F5EABB2C')\n end", "def create\n @saved_list = SavedList.new(saved_list_params)\n\n respond_to do |format|\n if @saved_list.save\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully created.\" }\n format.json { render :show, status: :created, location: @saved_list }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription_type = SubscriptionType.new(subscription_type_params)\n\n respond_to do |format|\n if @subscription_type.save\n format.html { redirect_to @subscription_type, notice: 'Subscription types was successfully created.' }\n format.json { render :show, status: :created, location: @subscription_type }\n else\n format.html { render :new }\n format.json { render json: @subscription_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @list = List.new(list_params)\n @list.save\n broadcast\n end", "def update_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list.id)\n url = build_url(url)\n payload = list.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def create\n @list = current_user.lists.find params[:list_id]\n @item = @list.items.build(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to list_items_path(@list), notice: 'Item was successfully created.' }\n #format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n #format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reference_list = ReferenceList.new(reference_list_params)\n\n respond_to do |format|\n if @reference_list.save\n format.html { redirect_to @reference_list, notice: 'Reference list was successfully created.' }\n format.json { render :show, status: :created, location: @reference_list }\n else\n format.html { render :new }\n format.json { render json: @reference_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @subscription = Subscription.new(params[:subscription])\n\n @subscription.owner = Company.find(params[:company_id]) if params[:company_id]\n @subscription.owner = Person.find(params[:person_id]) if params[:person_id]\n\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription.owner, notice: 'Subscription was successfully created.' }\n format.json { render json: @subscription, status: :created, location: @subscription }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.72809124", "0.7136452", "0.6987748", "0.69212216", "0.6605192", "0.6509733", "0.64841884", "0.64368695", "0.6413358", "0.64022726", "0.6362346", "0.6295419", "0.6265836", "0.6245115", "0.62223595", "0.62115437", "0.618352", "0.61101943", "0.60940987", "0.6081141", "0.60725975", "0.6058498", "0.605565", "0.60303634", "0.60302275", "0.60195357", "0.6018939", "0.6007314", "0.59481055", "0.5941556", "0.5937261", "0.59236586", "0.59230214", "0.59165907", "0.59138197", "0.59057426", "0.5897082", "0.5896342", "0.58904755", "0.58849156", "0.58800864", "0.58745134", "0.5870752", "0.5869036", "0.5849066", "0.58450013", "0.5828041", "0.5812995", "0.5808288", "0.58048576", "0.5762186", "0.5757935", "0.57324886", "0.57280403", "0.57191867", "0.5713912", "0.5709873", "0.5708152", "0.5708152", "0.569309", "0.56912243", "0.56876737", "0.56800264", "0.566788", "0.566052", "0.5653859", "0.5642409", "0.5640696", "0.5639544", "0.56393975", "0.5638801", "0.5635315", "0.56296986", "0.56224257", "0.5617725", "0.5607879", "0.5598978", "0.55978703", "0.55977535", "0.5597285", "0.559056", "0.55871975", "0.5580999", "0.5578291", "0.5578291", "0.55778235", "0.5571283", "0.5566565", "0.55658424", "0.5563072", "0.55601925", "0.55598646", "0.5556047", "0.5550866", "0.5550463", "0.5550161", "0.5540948", "0.55385923", "0.5538565", "0.55280554" ]
0.5850062
44
PATCH/PUT /subscription_lists/1 PATCH/PUT /subscription_lists/1.json
def update @subscription_list.students = get_students_from_rule_param set_proper_rule_type_from_params(@subscription_list) respond_to do |format| #if @subscription_list.update(subscription_list_params) if @subscription_list.update(subscription_list_params[:subscription_list]) format.html { redirect_to @subscription_list, notice: 'La Lista de Entrega se actualizó exitosamente.' } format.json { render :show, status: :ok, location: @subscription_list } else format.html { render :edit } format.json { render json: @subscription_list.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @list_subscription = ListSubscription.find(params[:id])\n\n respond_to do |format|\n if @list_subscription.update_attributes(params[:list_subscription])\n format.html { redirect_to @list_subscription, notice: 'List subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_subscriber_list_details(slug:, params: {})\n patch_json(\n \"#{endpoint}/subscriber-lists/#{slug}\",\n params,\n )\n end", "def update_list(list_id, name)\n data = {\n list: {\n name: name\n }\n }\n rest(\"patch\", \"lists/#{list_id}\", data)\n end", "def set_subscription_list\n @subscription_list = SubscriptionList.find(params[:id])\n end", "def update_list(access_token, list)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.list'), list.id)\n url = build_url(url)\n payload = list.to_json\n response = RestClient.put(url, payload, get_headers(access_token))\n Components::ContactList.create(JSON.parse(response.body))\n end", "def update_list(user, list, options={})\n post(\"/#{user}/lists/#{list}.json\", options)\n end", "def update_list\n current_path = '/api/v1/update'\n @conn.get(current_path)\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n if @subscription.update(subscription_params)\n head :no_content\n else\n render json: @subscription.errors, status: :unprocessable_entity\n end\n end", "def update\n @subscription = Subscription.get(params[:id])\n @subscription.update(params[:subscription])\n respond_with(@subscription.reload)\n end", "def update\n @list = current_user.lists.find(params[:id])\n @list.update_attributes(params[:list])\n respond_with(@list, :location => my_list_url(@list))\n end", "def update(options = {})\n self.merge!(Vermonster::Client.connection.put(\"lists/#{self[\"id\"]}\", \"{\\\"list\\\": #{options.to_json}}\").body)\n end", "def update_list(id, list)\n record \"/todos/update_list/#{id}\", :list => list\n end", "def update\n authorize @list\n\n if @list.update(list_params)\n json_response(@list.decorate, :ok)\n else\n json_response(@list.errors, :unprocessable_entity)\n end\n end", "def update\n respond_to do |format|\n if @api_subscription.update(api_subscription_params)\n format.html { redirect_to @api_subscription, notice: 'Subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_subscription }\n else\n format.html { render :edit }\n format.json { render json: @api_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @list.update(list_params)\n respond_successfully(I18n.t('integral.backend.lists.notification.edit_success'), backend_list_path(@list))\n else\n respond_failure(I18n.t('integral.backend.lists.notification.edit_failure'), :show)\n end\n end", "def update\n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to @subscription, notice: (I18n.t :subscription_updated) }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = current_user.subscriptions.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription.owner, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n # TODO: Modify subscription (refund remainder of current, prorate new)\n \n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to subscriptions_url, success: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n format.js { redirect_to subscriptions_url, :format => :html, success: 'Subscription was successfully updated.' }\n else\n format.html { render action: 'edit' }\n format.js { render action: 'edit' }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @subscription.update(subscription_params)\n format.html { redirect_to @subscription, notice: 'Subscription was successfully updated.' }\n format.json { render :show, status: :ok, location: @subscription }\n else\n format.html { render :edit }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n flash[:success] = \"Subscription was successfully updated.\"\n format.html { redirect_to @subscription }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription.assign_attributes(subscription_params)\n respond_to do |format|\n if @subscription.save\n format.html { redirect_to @subscription, notice: t('controller.successfully_updated', model: t('activerecord.models.subscription')) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to management_lists_path, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription.layer, notice: 'Subscription updated OK' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'Changes and Additions Successful.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @email_list.update(email_list_params)\n format.html { redirect_to @email_list, notice: 'Email list was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_list }\n else\n format.html { render :edit }\n format.json { render json: @email_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@subscription = Subscription.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tif @subscription.update_attributes(params[:subscription])\n\t\t\t\tflash[:notice] = 'Subscription was successfully updated.'\n\t\t\t\tshow_\n\t\t\t\tformat.html { render :action => \"show\" }\n\t\t\t\tformat.xml { head :ok }\n\t\t\telse\n\t\t\t\t@ingroups = Group.all\n\t\t\t\t@inprojects = Project.all\n\t\t\t\t@fortypesobjects=Typesobject.get_from_observer\n\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\tformat.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to [@list.organization, @list], notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: [@list.organization, @list] }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end", "def update\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to @subscription.transaction, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @list_items = args[:list_items] if args.key?(:list_items)\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(existing_list_params)\n format.html { redirect_to my_list_path(@list), notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: my_list_path(@list) }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @list = List.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_webhook_subscription(id,opts={})\n query_param_keys = [\n \n\n ]\n\n form_param_keys = [\n \n\n ]\n\n # verify existence of params\n raise \"id is required\" if id.nil?\n # set default values and merge with input\n options = underscored_merge_opts(opts,\n :id => id\n\n )\n\n # resource path\n path = path_replace(\"/lti/subscriptions/{id}\",\n :id => id)\n headers = nil\n form_params = select_params(options, form_param_keys)\n query_params = select_query_params(options, query_param_keys)\n\n response = mixed_request(:put, path, query_params, form_params, headers)\n response\n \n\n end", "def update\r\n @subscription = Subscription.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @subscription.update_attributes(subscription_params)\r\n format.html { redirect_to business_user_subscriptions_path, notice: 'Subscription was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update!(**args)\n @list_options = args[:list_options] if args.key?(:list_options)\n end", "def update\n @list.update_attributes list_params\n end", "def update\n respond_to do |format|\n if @list.update(_list_params)\n format.html { redirect_to @list, notice: \"List was successfully updated.\" }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n @list_item = ListItem.find(params[:id])\n\n if @list_item.update(list_item_params)\n head :no_content\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end", "def update\n @subscription_request = SubscriptionRequest.find(params[:id])\n\n respond_to do |format|\n if @subscription_request.update_attributes(params[:subscription_request])\n format.html { redirect_to @subscription_request, notice: 'Subscription request was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: blog_list_path(@list) }\n else\n format.html { render :edit }\n format.json { render json: @list.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 @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to campaign_subscriptions_path(@campaign), :notice => 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @document_list.update(document_list_params)\n format.html { redirect_to @document_list, notice: 'Document list was successfully updated.' }\n format.json { render :show, status: :ok, location: @document_list }\n else\n format.html { render :edit }\n format.json { render json: @document_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create / update_subscriptions\n end", "def update\n respond_to do |format|\n if @api_v1_shopping_list.update(api_v1_shopping_list_params)\n format.html { redirect_to @api_v1_shopping_list, notice: 'Shopping list was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_shopping_list }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_shopping_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_list(list_id:, name:)\n check_token\n list = Todoable::List.new(name: name)\n response = self.class.patch(\n \"/lists/#{list_id}\",\n body: list.post_body,\n headers: headers,\n format: :text\n )\n check_and_raise_errors(response)\n # This endpoint returns a plaintext body: \"<new name> updated\", so\n # while I'd like to return a List with ListItems, that would require\n # first looking up the list which isn't ideal. So we'll return true, ask\n # todoable to fix this endpoint, and make developers keep track of the\n # name change\n true\n end", "def update\n respond_to do |format|\n if @question_list.update(question_list_params)\n format.html { redirect_to @question_list, notice: 'Question list was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_list }\n else\n format.html { render :edit }\n format.json { render json: @question_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n self.init\n authorize! :read, @list\n authorize! :update, @task\n\n respond_to do |format|\n if @task.update_attributes(params[:task])\n format.html { redirect_to @list, notice: I18n.t('tasks.update_success') }\n format.json { render json: [] }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @task_list = TaskList.find(params[:id])\n\n if @task_list.update(task_list_params)\n head :no_content\n else\n render json: @task_list.errors, status: :unprocessable_entity\n end\n end", "def update\n @list = List.find(params[:id])\n\n nested = params[:list].delete( :list_items_attributes )\n\n new_items = []\n\n if nested then\n nested.each do |i, r|\n\n if !r.key?( \"id\" )\n\n new_items << ListItem.new( { \"list\" => @list }.merge( r ) ) if !item_blank?( r )\n\n nested.delete( i )\n\n else\n\n r[ \"_destroy\" ] = \"true\" if item_blank?( r )\n\n end\n\n end\n end\n\n respond_to do |format|\n if @list.update_attributes( params[ :list ] ) && \n @list.update_attributes( list_items_attributes: (nested || {}) ) &&\n new_items.map( &:save ).all? then\n\n format.html { redirect_to @list, notice: 'List was successfully updated.' }\n format.json { head :no_content }\n\n else\n\n format.html { render action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def update\n respond_to do |format|\n if @mail_list.update(mail_list_params)\n format.html { redirect_to [:admin, @mail_list], notice: 'Mail list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mail_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @task_list = TaskList.find(params[:id])\n\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.html { redirect_to @task_list, notice: 'Task list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @invite_list = InviteList.find(params[:id])\n\n respond_to do |format|\n if @invite_list.update_attributes(params[:invite_list])\n format.html { redirect_to @invite_list, notice: 'Invite list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invite_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_list.update(task_list_params)\n @task_lists = TaskList.all\n format.html { render :index, notice: 'Task list was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_list }\n else\n format.html { render :edit }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n \n respond_to do |format|\n \n \n if @subscription.update_attributes(params[:subscription])\n flash[:notice] = 'Subscription was successfully updated.'\n format.html { redirect_to(@subscription) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @list = @project.lists.find(params[:id])\n\n respond_to do |format|\n if @list.update_attributes(params[:list])\n format.html { redirect_to [@project, @list], notice: 'List was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mailing_list = MailingList.find(params[:id])\n\n respond_to do |format|\n if @mailing_list.update_attributes(params[:mailing_list])\n format.html { redirect_to @mailing_list, notice: 'Mailing list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mailing_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.by_user_channel_ids(current_user.id, params[:channel_id])\n\n respond_to do |format|\n if @subscription and @subscription.update_attributes(params[:subscription])\n @channel = Channel.find(params[:channel_id])\n format.html { redirect_to @subscription, notice: I18n.t('subscription_updated') }\n format.json { render json: { name: @channel.subscription_name(current_user) }, status: :ok}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_subscription\n # Only change the subscription if the models email\n # address has been changed.\n self.class.list_manager.update_subscription(self.email_was, self.email, campaignable_additional_fields) if self.email_changed?\n end", "def update\n @newsletter_subscription = NewsletterSubscription.find(params[:id])\n\n respond_to do |format|\n if @newsletter_subscription.update_attributes(params[:newsletter_subscription])\n format.html { redirect_to newsletter_subscriptions_path, notice: 'Subscription was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newsletter_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @list.update(list_params)\n format.html { redirect_to @list, notice: 'The List was updated.' }\n format.json { render :show, status: :ok, location: @list }\n else\n format.html { render :edit }\n format.json { render json: @list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to(subscriptions_url, :notice => 'Subscription was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @set_list.update(set_list_params)\n format.html { redirect_to @set_list, notice: 'Set list was successfully updated.' }\n format.json { render :show, status: :ok, location: @set_list }\n else\n format.html { render :edit }\n format.json { render json: @set_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @listed.update(listed_params)\n format.html { redirect_to session[:previous_url], notice: 'List item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @email_price_list = EmailPriceList.find(params[:id])\n\n if @email_price_list.update(email_price_list_params)\n head :no_content\n else\n render json: @email_price_list.errors, status: :unprocessable_entity\n end\n end", "def update\n current_user.update(playlist_names: params[:playlists])\n render json: current_user\n end", "def update\n respond_with []\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to(@subscription, :notice => 'Subscription was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @purchase_list.update(purchase_list_params)\n end", "def update\n raise CanCan::AccessDenied unless current_ability.admin?\n respond_to do |format|\n if @email_subscription.update(email_subscription_params)\n format.html { redirect_to @email_subscription, notice: \"Job status was successfully updated.\" }\n format.json { render :show, status: :ok, location: @email_subscription }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @email_subscription.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, params = {})\n @client.call(method: :put, path: \"recipient-lists/#{id}\", body_values: params.slice(:name, :description, :attributes, :recipients))\n end", "def update\n @task_list = TaskList.find(params[:id])\n respond_to do |format|\n if @task_list.update_attributes(params[:task_list])\n format.html { redirect_to @task_list, notice: 'Task list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mailing_list.update(mailing_list_params)\n format.html { redirect_to @mailing_list, notice: 'Mailing list was successfully updated.' }\n format.json { render :show, status: :ok, location: @mailing_list }\n else\n format.html { render :edit }\n format.json { render json: @mailing_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "def update!(**args)\n @subscription = args[:subscription] if args.key?(:subscription)\n end", "def update\n respond_to do |format|\n if @reference_list.update(reference_list_params)\n format.html { redirect_to @reference_list, notice: 'Reference list was successfully updated.' }\n format.json { render :show, status: :ok, location: @reference_list }\n else\n format.html { render :edit }\n format.json { render json: @reference_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def subscribe_to_updates\n if @subscription = @requestor.find_or_create_subscriptions(@target.id)\n @subscription.update_attributes(blocked: false) if @subscription.blocked?\n render json: { success: true }\n else\n render json: {message: @subscription.errors&.full_messages || 'Unable to subscriber updates, please try again'}, status: 202\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n auth!\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n format.html { redirect_to(manage_screen_field_subscriptions_path(@screen, @field), :notice => t(:subscription_updated)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n if @subscription.update_attributes(params[:subscription])\n flash[:notice] = 'Subscription was successfully updated.'\n format.html { redirect_to(@subscription) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @task_list.update(task_list_params)\n format.html { redirect_to @task_list, notice: 'List was successfully updated.' }\n format.json { render :show, status: :ok, location: @task_list }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @task_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @saved_list.update(saved_list_params)\n format.html { redirect_to @saved_list, notice: \"Saved list was successfully updated.\" }\n format.json { render :show, status: :ok, location: @saved_list }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @saved_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_update_params\n\t\tparams.require(:list).permit(:description, :deadline, :completion_status, :userID)\n\tend", "def update\n \n list_attributes = params[:list] || params[:check_list]\n \n if @list.update(list_attributes)\n flash[:notice] = t(:list_saved)\n redirect_to @list\n else\n render :action => 'edit'\n end\n end" ]
[ "0.7307792", "0.6945016", "0.6517418", "0.6487615", "0.6450037", "0.63820535", "0.63067204", "0.6305354", "0.6294411", "0.62411064", "0.62286615", "0.61959815", "0.61923337", "0.61919904", "0.61875784", "0.61309505", "0.6123276", "0.6118765", "0.61113006", "0.6107", "0.6107", "0.6107", "0.6093572", "0.6093572", "0.6082825", "0.6078398", "0.6073175", "0.6070538", "0.60688823", "0.60665643", "0.60550165", "0.6041777", "0.6040075", "0.60244423", "0.6022079", "0.6011338", "0.6011338", "0.6008726", "0.6005478", "0.6002581", "0.6002581", "0.6000111", "0.5997868", "0.5997246", "0.59669703", "0.5963364", "0.5952448", "0.59455276", "0.5936479", "0.59321374", "0.59321374", "0.59321374", "0.59321374", "0.59321374", "0.59310454", "0.59277385", "0.59210306", "0.5908325", "0.59001476", "0.59000707", "0.5899404", "0.58922225", "0.5890549", "0.588996", "0.58824927", "0.5871925", "0.586675", "0.5858575", "0.58528924", "0.5847078", "0.58466744", "0.58335125", "0.5830417", "0.581749", "0.5813162", "0.58110774", "0.5810601", "0.5810077", "0.5806062", "0.58056", "0.5792388", "0.57919455", "0.5788494", "0.5783369", "0.5781423", "0.57794976", "0.5778022", "0.5768991", "0.57566893", "0.57556564", "0.57552385", "0.57552385", "0.57547575", "0.57514167", "0.57403815", "0.5731655", "0.57252645", "0.5725186", "0.57204425", "0.57204086" ]
0.65668875
2
DELETE /subscription_lists/1 DELETE /subscription_lists/1.json
def destroy @subscription_list.destroy respond_to do |format| format.html { redirect_to subscription_lists_url, notice: 'La Lista de Entrega se borró exitosamente.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @list_subscription = ListSubscription.find(params[:id])\n @list_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to list_subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :no_content }\n end\n end", "def delete options={}, headers={}\n @connection.delete \"subscriptions.json\", options, headers\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to root_url}\n format.json { head :no_content }\n end\n end", "def delete_list(user, list)\n delete(\"/#{user}/lists/#{list}.json\")\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: (I18n.t :subscription_deleted) }\n format.json { head :no_content }\n end\n end", "def unsubscribe_from_list(user, list)\n delete(\"/#{user}/#{list}/subscribers.json\")\n end", "def destroy\n @subscription.destroy\n\n head :no_content\n end", "def destroy\n subscription = current_user.subscriptions.find(params[:id])\n subscription.destroy!\n\n render json: { status: 'success'}\n end", "def destroy\n @subscription_request = SubscriptionRequest.find(params[:id])\n @subscription_request.destroy\n\n respond_to do |format|\n format.html { redirect_to subscription_requests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @api_subscription.destroy\n respond_to do |format|\n format.html { redirect_to api_subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to management_lists_path }\n format.json { head :no_content }\n end\n end", "def delete_list(list_id)\n rest(\"delete\", \"lists/#{list_id}\")\n\n return true\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to subscriptions_url, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_list(params={})\n @obj.delete('delete', @auth.merge(params))\n end", "def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to artist_subscription_path }\n format.json { head :ok }\n end\n end", "def delete_subscriptions\n end", "def destroy\r\n @subscription = Subscription.find(params[:id])\r\n @subscription.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to business_user_subscriptions_path }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @email_list.destroy\n respond_to do |format|\n format.html { redirect_to email_lists_url, notice: 'Email list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to my_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_subscription.destroy\n respond_to do |format|\n format.html { redirect_to admin_subscriptions_url, notice: 'L\\'abonnement a bien été créé supprimé.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to campaign_subscriptions_path(@campaign) }\n format.json { head :no_content }\n end\n end", "def destroy\n @crytosubscription.destroy\n respond_to do |format|\n format.html { redirect_to crytosubscriptions_url, notice: 'Crytosubscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to organization_lists_url(@organization), notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end", "def destroy\n @subscription = current_user.subscriptions.find(params[:id])\n #TODO move to model Subscription\n if not current_user.fitbit.nil?\n path = ['/1/user/-', @subscription.collection_path, 'apiSubscriptions', @subscription.subscription_id + '-' + @subscription.collection_path]\n current_user.fitbit.client.delete(path.join('/') + '.json')\n flash[:success] = 'Subscription successfully removed from Fitbit.'\n else\n flash[:error] = 'Can not remove subscription from Fitbit, because you are not connected.'\n end\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to subscriptions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sent_list.destroy\n respond_to do |format|\n format.html { redirect_to sent_lists_url, notice: 'Sent list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = List.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to list_types_url, notice: \"Check ya later list.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscribe.destroy\n\n respond_to do |format|\n format.html { redirect_to subscribes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: \"List was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to @subscription.transaction }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscriptions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @invite_list = InviteList.find(params[:id])\n @invite_list.destroy\n\n respond_to do |format|\n format.html { redirect_to invite_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mail_list.destroy\n respond_to do |format|\n format.html { redirect_to admin_mail_lists_url, notice: 'Mail list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reference_list.destroy\n respond_to do |format|\n format.html { redirect_to reference_lists_url, notice: 'Reference list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_shopping_list.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_shopping_lists_url, notice: 'Shopping list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription_type.destroy\n respond_to do |format|\n format.html { redirect_to subscription_types_path, notice: 'Subscription types was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_list(id)\n record \"/todos/delete_list/#{id}\"\n end", "def destroy\n authorize @list\n @list.destroy\n head :no_content\n end", "def destroy\n @url_list.destroy\n respond_to do |format|\n format.html { redirect_to url_lists_url, notice: 'Url list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @document_list.destroy\n respond_to do |format|\n format.html { redirect_to document_lists_url, notice: 'Document list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'The List was destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @newsletter_subscription = NewsletterSubscription.find(params[:id])\n @newsletter_subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to newsletter_subscriptions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @checklist = Checklist.find(params[:id])\n @checklist.destroy\n\n respond_to do |format|\n format.html { redirect_to checklists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :delete, @ml_list\n @ml_list.destroy\n respond_to do |format|\n format.html { redirect_to ml_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ro_r_list.destroy\n respond_to do |format|\n format.html { redirect_to ro_r_lists_url, notice: 'Ro r list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscribe.destroy\n respond_to do |format|\n format.html { redirect_to subscribes_url, notice: 'Subscribe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_list.destroy\n respond_to do |format|\n format.html { redirect_to service_lists_url, notice: 'Service list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @twitter_list = TwitterList.find(params[:id])\n @twitter_list.destroy\n\n respond_to do |format|\n format.html { redirect_to twitter_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = @project.lists.find(params[:id])\n @list.destroy\n\n respond_to do |format|\n format.html { redirect_to project_lists_url(@project) }\n format.json { head :no_content }\n end\n end", "def destroy\n @stringlist = Stringlist.find(params[:id])\n Redis.current.del @stringlist.redis_key\n @stringlist.destroy\n\n respond_to do |format|\n format.html { redirect_to stringlists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @list.destroy\n respond_to do |format|\n format.html { redirect_to lists_url, notice: 'Funcionario deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_list.destroy\n respond_to do |format|\n format.html { redirect_to item_lists_url, notice: 'Item list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @saved_list.destroy\n respond_to do |format|\n format.html { redirect_to saved_lists_url, notice: \"Saved list was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env[\"HTTP_REFERER\"] }\n format.xml { head :ok }\n end\n end", "def destroy\n @question_list.destroy\n respond_to do |format|\n format.html { redirect_to question_lists_url, notice: 'Question list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription_group = SubscriptionGroup.find(params[:id])\n @subscription_group.destroy\n\n respond_to do |format|\n format.html { redirect_to subscription_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mailing_list = MailingList.find(params[:id])\n @mailing_list.destroy\n\n respond_to do |format|\n format.html { redirect_to mailing_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy \n Instagram.delete_subscription({:id => params[:id]})\n local_subscription = Subscription.find_by_original_id params[:id]\n local_subscription.destroy if local_subscription\n redirect_to :admin_subscriptions\n end", "def destroy\n @task_list.destroy\n respond_to do |format|\n format.html { redirect_to task_lists_url, notice: 'List was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n @owner = @subscription.owner\n @subscription.destroy\n\n respond_to do |format|\n format.html { redirect_to polymorphic_url([@owner, :subscriptions]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @check_list.destroy\n respond_to do |format|\n format.html { redirect_to check_lists_url, notice: \"Check list was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @list = current_user.lists.find(params[:id])\n @list.destroy\n respond_with(@list, :location => my_lists_url)\n end", "def destroy\n @bucket_list.destroy\n respond_to do |format|\n format.html { redirect_to bucket_lists_url, notice: 'Delete successful.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mailing_list.destroy\n respond_to do |format|\n format.html { redirect_to mailing_lists_url, notice: 'Mailing list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @task_list = TaskList.find(params[:id])\n @task_list.destroy\n\n respond_to do |format|\n format.html { redirect_to task_lists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @special_device_list.destroy\n respond_to do |format|\n format.html { redirect_to special_device_lists_url, notice: 'Special device list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription_history = SubscriptionHistory.find(params[:id])\n @subscription_history.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_histories_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @subscription_type = SubscriptionType.find(params[:id])\n @subscription_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n targets = Subscription.where(ordinal: (@subscription.ordinal + 1)..Float::INFINITY)\n\n targets.each do |target|\n target.update(ordinal: target.ordinal - 1)\n end\n\n @subscription.destroy\n respond_to do |format|\n format.html { redirect_to owner_subscriptions_url(owner_id: @owner.id), notice: 'サブスクショップを削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @email_newsletter_subscription.destroy\n respond_to do |format|\n format.html { redirect_to email_newsletter_subscriptions_url, notice: 'Email newsletter subscription was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7853924", "0.71697277", "0.7140043", "0.7051224", "0.7051224", "0.7051224", "0.7051224", "0.7049974", "0.7047578", "0.70414", "0.70308095", "0.702332", "0.69912016", "0.6960443", "0.6941727", "0.6935252", "0.69055337", "0.69049627", "0.69047254", "0.6895843", "0.6895843", "0.6895843", "0.6891373", "0.6891373", "0.6891373", "0.6891373", "0.6891373", "0.6889976", "0.6875563", "0.68697655", "0.6865955", "0.686205", "0.683521", "0.68206483", "0.68104947", "0.68062574", "0.68055034", "0.68027437", "0.6795403", "0.6792156", "0.679003", "0.679003", "0.679003", "0.678997", "0.6784546", "0.6763727", "0.6763727", "0.6763727", "0.6763727", "0.6763727", "0.6763727", "0.6763727", "0.6758392", "0.6751521", "0.67042357", "0.67009485", "0.67009485", "0.67009485", "0.66960096", "0.66900283", "0.66702324", "0.66695875", "0.6668888", "0.6662144", "0.6653077", "0.66519", "0.66440463", "0.66433567", "0.66319627", "0.6609064", "0.65995765", "0.6597727", "0.6596165", "0.65869987", "0.65869987", "0.65869987", "0.6580041", "0.65791434", "0.6578102", "0.65688175", "0.65667653", "0.656585", "0.6565707", "0.65639436", "0.6559646", "0.655739", "0.6550845", "0.6546888", "0.6546345", "0.65458906", "0.65411526", "0.6537045", "0.65316534", "0.6530875", "0.652523", "0.6523857", "0.65194446", "0.6515488", "0.6510106", "0.6509598" ]
0.7789424
1
Use callbacks to share common setup or constraints between actions.
def set_subscription_list @subscription_list = SubscriptionList.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 subscription_list_params #params[:subscription_list].permit(:name, :description) #params.permit(:careers, :years, :subjects).permit(subscription_list: [ :name, :description ]) #params.permit(:careers).require(:subscription_list).permit(:name, :description) params.permit! # So far, no strong params here... 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
Create a new SpanContext
def initialize(tid, sid, level = 1, baggage = {}) @trace_id = tid @span_id = sid @level = Integer(level || 1) @baggage = baggage || {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace_context\n TraceContextData.new trace_id, @span_id, trace_options\n end", "def non_recording_span(span_context)\n Span.new(span_context: span_context)\n end", "def trace_context\n ensure_exists!\n trace.trace_context.with span_id: span_id\n end", "def create_child\n loop do\n child_span_id = rand 1..MAX_SPAN_ID\n child_span_id = child_span_id.to_s(16).rjust(16, \"0\")\n unless @trace_data.span_map.key? child_span_id\n return SpanContext.new @trace_data, self, child_span_id\n end\n end\n end", "def start_span name, skip_frames: 0, sampler: nil\n child_context = create_child\n sampler ||= OpenCensus::Trace.config.default_sampler\n sampled = sampler.call span_context: self\n span = SpanBuilder.new child_context, sampled,\n skip_frames: skip_frames + 1\n span.name = name\n span.start!\n @trace_data.span_map[child_context.span_id] = span\n end", "def span_context\n OpenCensus::Context.get SPAN_CONTEXT_KEY\n end", "def start_span(name, with_parent: nil, with_parent_context: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil, sampling_hint: nil)\n span_context = with_parent&.context || with_parent_context || current_span.context\n if span_context.valid?\n Span.new(span_context: span_context)\n else\n Span.new\n end\n end", "def context_with_span(span, parent_context: Context.current)\n parent_context.set_value(CURRENT_SPAN_KEY, span)\n end", "def start_span(name, with_parent: nil, with_parent_context: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)\n span_context = with_parent&.context || active_span_context(with_parent_context)\n if span_context.valid?\n Span.new(span_context: span_context)\n else\n Span.new\n end\n end", "def with_span(span)\n Context.with(CONTEXT_SPAN_KEY, span) { |s| yield s }\n end", "def convert_span obj\n TraceProtos::Span.new \\\n name: make_resource_name(@project_id, obj.trace_id, obj.span_id),\n span_id: obj.span_id,\n parent_span_id: obj.parent_span_id || \"\",\n display_name: convert_truncatable_string(obj.name),\n start_time: convert_time(obj.start_time),\n end_time: convert_time(obj.end_time),\n attributes:\n convert_attributes(obj.attributes,\n obj.dropped_attributes_count,\n include_agent_attribute: true),\n stack_trace:\n convert_stack_trace(obj.stack_trace, obj.dropped_frames_count,\n obj.stack_trace_hash_id),\n time_events:\n convert_time_events(obj.time_events,\n obj.dropped_annotations_count,\n obj.dropped_message_events_count),\n links: convert_links(obj.links, obj.dropped_links_count),\n status: convert_optional_status(obj.status),\n same_process_as_parent_span:\n convert_optional_bool(obj.same_process_as_parent_span),\n child_span_count: convert_optional_int32(obj.child_span_count)\n end", "def start_span(name, with_parent: nil, attributes: nil, links: nil, start_timestamp: nil, kind: nil)\n span = OpenTelemetry::Trace.current_span(with_parent)\n\n if span.context.valid?\n span\n else\n Span::INVALID\n end\n end", "def start_span(operation_name, child_of: active_span, **args)\n span = @tracer.start_span(operation_name, child_of: child_of, **args)\n @managed_span_source.make_active(span)\n end", "def with_span(\n name,\n type = nil,\n subtype: nil,\n action: nil,\n context: nil,\n include_stacktrace: true,\n trace_context: nil,\n parent: nil,\n sync: nil\n )\n unless block_given?\n raise ArgumentError,\n 'expected a block. Do you want `start_span\\' instead?'\n end\n\n return yield nil unless agent\n\n begin\n span =\n start_span(\n name,\n type,\n subtype: subtype,\n action: action,\n context: context,\n include_stacktrace: include_stacktrace,\n trace_context: trace_context,\n parent: parent,\n sync: sync\n )\n result = yield span\n span&.outcome ||= Span::Outcome::SUCCESS\n result\n rescue\n span&.outcome ||= Span::Outcome::FAILURE\n raise\n ensure\n end_span\n end\n end", "def start_span(\n name,\n type = nil,\n subtype: nil,\n action: nil,\n backtrace: nil,\n context: nil,\n trace_context: nil\n )\n return unless (transaction = current_transaction)\n return unless transaction.sampled?\n\n transaction.inc_started_spans!\n\n if transaction.max_spans_reached?\n transaction.inc_dropped_spans!\n return\n end\n\n parent = current_span || transaction\n\n span = Span.new(\n name: name,\n subtype: subtype,\n action: action,\n transaction_id: transaction.id,\n trace_context: trace_context || parent.trace_context.child,\n type: type,\n context: context,\n stacktrace_builder: stacktrace_builder\n )\n\n if backtrace && transaction.config.span_frames_min_duration?\n span.original_backtrace = backtrace\n end\n\n current_spans.push span\n\n span.start\n end", "def with_span(span)\n Context.with_value(CURRENT_SPAN_KEY, span) { |c, s| yield s, c }\n end", "def initialize trace_id, span_id, name, start_time, end_time,\n kind: SPAN_KIND_UNSPECIFIED,\n parent_span_id: \"\", attributes: {},\n dropped_attributes_count: 0, stack_trace: [],\n dropped_frames_count: 0, time_events: [],\n dropped_annotations_count: 0,\n dropped_message_events_count: 0, links: [],\n dropped_links_count: 0, status: nil,\n same_process_as_parent_span: nil,\n child_span_count: nil\n @name = name\n @kind = kind\n @trace_id = trace_id\n @span_id = span_id\n @parent_span_id = parent_span_id\n @start_time = start_time\n @end_time = end_time\n @attributes = attributes\n @dropped_attributes_count = dropped_attributes_count\n @stack_trace = stack_trace\n @dropped_frames_count = dropped_frames_count\n @stack_trace_hash_id = init_stack_trace_hash_id\n @time_events = time_events\n @dropped_annotations_count = dropped_annotations_count\n @dropped_message_events_count = dropped_message_events_count\n @links = links\n @dropped_links_count = dropped_links_count\n @status = status\n @same_process_as_parent_span = same_process_as_parent_span\n @child_span_count = child_span_count\n end", "def with_span(span)\n Context.with_value(CURRENT_SPAN_KEY, span) { |c, s| yield s, c }\n end", "def start_request_trace trace_context: nil, same_process_as_parent: nil\n span_context = SpanContext.create_root \\\n trace_context: trace_context,\n same_process_as_parent: same_process_as_parent\n self.span_context = span_context\n if block_given?\n begin\n yield span_context\n ensure\n unset_span_context\n end\n else\n span_context\n end\n end", "def start_span(operation_name, child_of: nil, references: nil, start_time: nil, tags: nil, ignore_active_scope: false)\n if child_of.nil? && references.nil? && !ignore_active_scope\n child_of = active_span\n end\n\n span_options = {\n tracer: self,\n operation_name: operation_name,\n child_of: child_of,\n references: references,\n start_micros: start_time.nil? ? LightStep.micros(Time.now) : LightStep.micros(start_time),\n tags: tags,\n max_log_records: max_log_records,\n }\n\n Span.new(**span_options).tap do |span|\n if block_given?\n begin\n return yield span\n ensure\n span.finish\n end\n end\n end\n end", "def ensure_clean_context!\n return unless Tracing.active_span\n\n Tracing.send(:tracer).provider.context = Tracing::Context.new\n end", "def ensure_clean_context!\n return unless configuration[:tracer].call_context.current_span\n configuration[:tracer].provider.context = Context.new\n end", "def ensure_clean_context!\n return unless configuration[:tracer].call_context.current_span\n configuration[:tracer].provider.context = Context.new\n end", "def start_span(\n name,\n type = nil,\n subtype: nil,\n action: nil,\n context: nil,\n include_stacktrace: true,\n trace_context: nil,\n parent: nil,\n sync: nil\n )\n agent&.start_span(\n name,\n type,\n subtype: subtype,\n action: action,\n context: context,\n trace_context: trace_context,\n parent: parent,\n sync: sync\n ).tap do |span|\n break unless span && include_stacktrace\n break unless agent.config.span_frames_min_duration?\n\n span.original_backtrace ||= caller\n end\n end", "def new_trace trace_context: :DEFAULT\n if trace_context == :DEFAULT\n trace_context = Stackdriver::Core::TraceContext.get\n end\n Google::Cloud::Trace::TraceRecord.new project, trace_context\n end", "def initialize trace_id: nil, is_new: nil, span_id: nil, sampled: nil,\n capture_stack: false\n @trace_id = trace_id || new_random_trace_id\n @is_new = if is_new.nil?\n !trace_id\n else\n is_new ? true : false\n end\n @span_id = span_id ? span_id.to_i : nil\n @sampled = sampled\n if @sampled.nil?\n @capture_stack = nil\n else\n @sampled = @sampled ? true : false\n @capture_stack = capture_stack && @sampled\n end\n end", "def trace(name, options = {})\n span = Span.new(self, name, options)\n\n # set up inheritance\n parent = @buffer.get()\n span.set_parent(parent)\n @buffer.set(span)\n\n @tags.each { |k, v| span.set_tag(k, v) } unless @tags.empty?\n\n # sampling\n if parent.nil?\n @sampler.sample(span)\n else\n span.sampled = span.parent.sampled\n end\n\n # call the finish only if a block is given; this ensures\n # that a call to tracer.trace() without a block, returns\n # a span that should be manually finished.\n if block_given?\n begin\n yield(span)\n rescue StandardError => e\n span.set_error(e)\n raise\n ensure\n span.finish()\n end\n else\n span\n end\n end", "def unset_span_context\n OpenCensus::Context.unset SPAN_CONTEXT_KEY\n end", "def prepare_span(key, data, span)\n end", "def new(context)\n dup.tap do |logger|\n logger.context = \"#{logger.context}#{context_separator}#{context}\"\n end\n end", "def initialize(tid, sid, baggage = nil)\n @trace_id = tid\n @span_id = sid\n @baggage = baggage\n end", "def on_start(span, _parent_context)\n context = span.context\n trace_id = context.trace_id\n\n lock do\n if all_spans_count(traces_spans_count) >= max_queue_size\n # instead of just dropping all new spans, dd-trace-rb drops a random trace\n # https://github.com/DataDog/dd-trace-rb/blob/c6fbf2410a60495f1b2d8912bf7ea7dc63422141/lib/ddtrace/buffer.rb#L34-L36\n # It allows for a more fair usage of the queue when under stress load,\n # and will create proportional representation of code paths being instrumented at stress time.\n unfinished_trace_id = fetch_unfinished_trace_id\n\n # if there are no unfinished traces able to be dropped, don't add more spans, and return early\n if unfinished_trace_id.nil?\n OpenTelemetry.logger.warn('Max spans for all traces, spans will be dropped')\n @_spans_dropped = true\n return\n end\n\n drop_unfinished_trace(unfinished_trace_id)\n OpenTelemetry.logger.warn('Max spans for all traces, traces will be dropped')\n end\n\n if traces[trace_id].nil?\n traces[trace_id] = [span]\n traces_spans_count[trace_id] = 1\n else\n if traces[trace_id].size >= max_trace_size\n OpenTelemetry.logger.warn('Max spans for trace, spans will be dropped')\n @_spans_dropped = true\n return\n end\n\n traces[trace_id] << span\n traces_spans_count[trace_id] += 1\n end\n end\n end", "def new_instance(*contexts, **locals)\n Renderer.new(*(contexts | @contexts), **locals)\n end", "def extract(operation_name, format, carrier, tracer)\n case format\n when OpenTracing::FORMAT_TEXT_MAP, OpenTracing::FORMAT_BINARY, OpenTracing::FORMAT_RACK\n return SpanContext.new()\n else\n warn 'Unknown extract format'\n nil\n end\n end", "def initialize trace_data, parent, span_id\n @trace_data = trace_data\n @parent = parent\n @span_id = span_id\n end", "def create\n @span = Span.new(span_params)\n\n respond_to do |format|\n if @span.save\n format.html { redirect_to @span, notice: 'Span was successfully created.' }\n format.json { render :show, status: :created, location: @span }\n else\n format.html { render :new }\n format.json { render json: @span.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_baggage(baggage = {})\n @span_context = SpanContext.new(\n id: span_context.id,\n trace_id: span_context.trace_id,\n baggage: baggage\n )\n end", "def context(key = nil)\n current_context = key.nil? ? @context.local : @context.local(key)\n\n # Rebuild/reset context after a fork\n #\n # We don't want forked processes to copy and retransmit spans\n # that were generated from the parent process. Reset it such\n # that it acts like a distributed trace.\n current_context.after_fork! do\n current_context = self.context = current_context.fork_clone\n end\n\n current_context\n end", "def new_context( name, parent_context = nil )\n @last_unique_id += 1\n @context_list[ @last_unique_id ] = V3::ContextDAO.new( @last_unique_id, name.to_s, parent_context )\n end", "def context\n @_context ||= begin\n ptr = MemoryPointer::new( Context )\n error = OpenCL.clGetSamplerInfo(self, CONTEXT, Context.size, ptr, nil)\n error_check(error)\n Context::new( ptr.read_pointer )\n end\n end", "def initialize(\n spans,\n agent_sample_rate: nil,\n hostname: nil,\n id: nil,\n lang: nil,\n name: nil,\n origin: nil,\n process_id: nil,\n rate_limiter_rate: nil,\n resource: nil,\n root_span_id: nil,\n rule_sample_rate: nil,\n runtime_id: nil,\n sample_rate: nil,\n sampling_priority: nil,\n service: nil,\n tags: nil,\n metrics: nil,\n profiling_enabled: nil\n )\n @id = id\n @root_span_id = root_span_id\n @spans = spans || []\n\n # Does not make an effort to move metrics out of tags\n # The caller is expected to have done that\n @meta = (tags && tags.dup) || {}\n @metrics = (metrics && metrics.dup) || {}\n\n # Set well-known tags, defaulting to getting the values from tags\n @agent_sample_rate = agent_sample_rate || agent_sample_rate_tag\n @hostname = hostname || hostname_tag\n @lang = lang || lang_tag\n @name = Core::Utils::SafeDup.frozen_or_dup(name || name_tag)\n @origin = Core::Utils::SafeDup.frozen_or_dup(origin || origin_tag)\n @process_id = process_id || process_id_tag\n @rate_limiter_rate = rate_limiter_rate || rate_limiter_rate_tag\n @resource = Core::Utils::SafeDup.frozen_or_dup(resource || resource_tag)\n @rule_sample_rate = rule_sample_rate_tag || rule_sample_rate\n @runtime_id = runtime_id || runtime_id_tag\n @sample_rate = sample_rate || sample_rate_tag\n @sampling_decision_maker = sampling_decision_maker_tag\n @sampling_priority = sampling_priority || sampling_priority_tag\n @service = Core::Utils::SafeDup.frozen_or_dup(service || service_tag)\n @profiling_enabled = profiling_enabled\n end", "def build_context(\n rack_env: nil,\n for_type: :transaction\n )\n agent&.build_context(rack_env: rack_env, for_type: for_type)\n end", "def at(*args, &block)\n\tRPoint::Contexts::ContextFactory.create_context(*args, &block)\nend", "def initialize trace_id, span_id, type: nil,\n attributes: {}, dropped_attributes_count: 0\n @trace_id = trace_id\n @span_id = span_id\n @type = type\n @attributes = attributes\n @dropped_attributes_count = dropped_attributes_count\n end", "def start(span_name=nil)\n return if !enabled?\n raise TraceProcessedException.new(trace_processed_error_string) if flushed?\n if in_progress?\n start_new_span(span_name)\n end\n instrument do\n @current_span.start(span_name)\n @in_progress = true\n end\n end", "def initialize(ctx)\n @ctx = ctx\n end", "def initialize(ctx)\n @ctx = ctx\n end", "def create_with_logging_context( m, *a, &b )\n mdc, ndc = nil\n\n if Thread.current[Logging::MappedDiagnosticContext::NAME]\n mdc = Thread.current[Logging::MappedDiagnosticContext::NAME].dup\n end\n\n if Thread.current[Logging::NestedDiagnosticContext::NAME]\n ndc = Thread.current[Logging::NestedDiagnosticContext::NAME].dup\n end\n\n self.send(m, *a) { |*args|\n Logging::MappedDiagnosticContext.inherit(mdc)\n Logging::NestedDiagnosticContext.inherit(ndc)\n b.call(*args)\n }\n end", "def initialize(context, offset = T.unsafe(nil), decrypter = T.unsafe(nil)); end", "def new_context(env)\n\n makara_context, makara_status = makara_values(env)\n\n context = nil\n\n # if the previous request was a redirect, let's keep that context\n if makara_status.to_s =~ /^3/ # 300+ redirect\n context = makara_context\n end\n\n context ||= Makara::Context.get_current if env['rack.test']\n context ||= Makara::Context.generate(env[\"action_dispatch.request_id\"])\n context\n end", "def to_ctx(format = nil)\n @_ctx || build_ctx(format)\n end", "def new_context(type, proc = nil)\n create_new_context(type)\n\n # run context initializer\n yield if block_given?\n\n # execute user provided block within context\n self.instance_eval(&proc) if proc\n\n restore_old_context\n end", "def to_grpc default_parent_id = 0\n start_proto = Google::Cloud::Trace::Utils.time_to_grpc start_time\n end_proto = Google::Cloud::Trace::Utils.time_to_grpc end_time\n Google::Cloud::Trace::V1::TraceSpan.new \\\n span_id: span_id.to_i,\n kind: kind.to_sym,\n name: name,\n start_time: start_proto,\n end_time: end_proto,\n parent_span_id: parent_span_id || default_parent_id,\n labels: labels\n end", "def get_or_create_context\n if !block_given?\n return ::Vertx::Util::Utils.safe_create(@j_del.java_method(:getOrCreateContext, []).call(),::Vertx::Context)\n end\n raise ArgumentError, \"Invalid arguments when calling get_or_create_context()\"\n end", "def format!\n return unless trace\n return trace unless root_span\n\n # Because the trace API does not support\n # trace metadata, we must put our trace\n # metadata on the root span. This \"root span\"\n # is needed by the agent/API to ingest the trace.\n\n # Apply generic trace tags. Any more specific value will be overridden\n # by the subsequent calls below.\n set_trace_tags!\n\n set_resource!\n\n tag_agent_sample_rate!\n tag_hostname!\n tag_lang!\n tag_origin!\n tag_process_id!\n tag_rule_sample_rate!\n tag_runtime_id!\n tag_rate_limiter_rate!\n tag_sample_rate!\n tag_sampling_decision_maker!\n tag_high_order_trace_id!\n tag_sampling_priority!\n tag_profiling_enabled!\n\n trace\n end", "def log_entry(name, kvs = {})\n return unless tracing?\n self.current_trace.new_span(name, kvs)\n end", "def in_span name, skip_frames: 0, sampler: nil\n span = start_span name, skip_frames: skip_frames + 1, sampler: sampler\n begin\n yield span\n ensure\n end_span span\n end\n end", "def call env\n formatter = AUTODETECTABLE_FORMATTERS.detect do |f|\n env.key? f.rack_header_name\n end\n if formatter\n context = formatter.deserialize env[formatter.rack_header_name]\n end\n\n Trace.start_request_trace \\\n trace_context: context,\n same_process_as_parent: false do |span_context|\n begin\n Trace.in_span get_path(env) do |span|\n start_request span, env\n @app.call(env).tap do |response|\n finish_request span, response\n end\n end\n ensure\n @exporter.export span_context.build_contained_spans\n end\n end\n end", "def initialize\n self.context = Context.new\n end", "def initialize(ctx)\n @ctx = ctx\n end", "def extract(carrier, context: Context.current, getter: Context::Propagation.text_map_getter)\n header = getter.get(carrier, IDENTITY_KEY)\n return context unless header\n return context unless (match = header.match(TRACE_SPAN_IDENTITY_REGEX))\n return context if match['trace_id'] =~ ZERO_ID_REGEX\n return context if match['span_id'] =~ ZERO_ID_REGEX\n\n sampling_flags = match['sampling_flags'].to_i\n span = build_span(match, sampling_flags)\n context = Jaeger.context_with_debug(context) if sampling_flags & DEBUG_FLAG_BIT != 0\n context = context_with_extracted_baggage(carrier, context, getter)\n Trace.context_with_span(span, parent_context: context)\n end", "def activate(span, finish_on_close: true)\n ThreadLocalScope.new(\n manager: self,\n span: span,\n finish_on_close: finish_on_close\n ).tap do |scope|\n set_scope(scope)\n end\n end", "def extract(carrier, context: Context.current, getter: Context::Propagation.text_map_getter)\n trace_parent_value = getter.get(carrier, TRACEPARENT_KEY)\n return context unless trace_parent_value\n\n tp = TraceParent.from_string(trace_parent_value)\n tracestate = Tracestate.from_string(getter.get(carrier, TRACESTATE_KEY))\n\n span_context = Trace::SpanContext.new(trace_id: tp.trace_id,\n span_id: tp.span_id,\n trace_flags: tp.flags,\n tracestate: tracestate,\n remote: true)\n span = OpenTelemetry::Trace.non_recording_span(span_context)\n OpenTelemetry::Trace.context_with_span(span, parent_context: context)\n rescue OpenTelemetry::Error\n context\n end", "def initialize(context)\n @context = context\n end", "def in_span(name, attributes: nil, links: nil, start_timestamp: nil, kind: nil, sampling_hint: nil, with_parent: nil, with_parent_context: nil)\n span = start_span(name, attributes: attributes, links: links, start_timestamp: start_timestamp, kind: kind, sampling_hint: sampling_hint, with_parent: with_parent, with_parent_context: with_parent_context)\n with_span(span) { |s| yield s }\n ensure\n span.finish\n end", "def set_baggage(baggage = {})\n @context = SpanContext.new(\n id: context.id,\n trace_id: context.trace_id,\n trace_id_upper64: context.trace_id_upper64,\n sampled: context.sampled?,\n baggage: baggage\n )\n end", "def context\n unless @instance_context\n @instance_context = SummaryContext.new(\n @version,\n @params['call_sid'],\n )\n end\n @instance_context\n end", "def new_scope\n self.class.new(@input, @output, @wrap_at,\n @page_at, @indent_size, @indent_level)\n end", "def start_active_span(operation_name,\n child_of: nil,\n references: nil,\n start_time: Time.now,\n tags: nil,\n ignore_active_scope: false,\n finish_on_close: true)\n if child_of.nil? && references.nil? && !ignore_active_scope\n child_of = active_span\n end\n\n span = start_span(\n operation_name,\n child_of: child_of,\n references: references,\n start_time: start_time,\n tags: tags,\n ignore_active_scope: ignore_active_scope\n )\n\n scope_manager.activate(span: span, finish_on_close: finish_on_close).tap do |scope|\n if block_given?\n begin\n return yield scope\n ensure\n scope.close\n end\n end\n end\n end", "def initialize(context)\n super()\n self.context = context\n end", "def initialize(parent = nil)\n @trace = parent ? parent.trace : random_uint64\n @span = random_uint64\n @parent = parent.span if parent\n end", "def span_id\n self.current_trace ? current_trace.current_span_id : nil\n end", "def to_s\n \"Span(name:#{@name},sid:#{@id},tid:#{@trace_id},pid:#{@parent_id})\"\n end", "def get_span span_id\n @trace_data.span_map[span_id]\n end", "def set_span\n @span = Span.find(params[:id])\n end", "def context(status, header, body, request)\n @context = context_retriever(request)&.call(status, header, body)\n @data[:request_context] = @context[:context_id] \\\n if @context && @context[:context_id]\n @context\n end", "def start_span(span)\n @@spans.push(span)\n end", "def trace_from_encoded_context(encoded_context = nil, additional_context: {})\n trace_context = decode_trace_context(encoded_context) || {}\n trace_id = trace_context[:trace_id]\n parent_span_id = trace_context[:parent_span_id]\n context = trace_context[:context] || {}\n\n trace(trace_id: trace_id, parent_span_id: parent_span_id, context: context.merge(additional_context)) do\n yield\n end\n end", "def new_streaming_buffer\n buffer_class = suspended? ? SuspendedStreamingBuffer : StreamingBuffer\n buffer_class.new(Config.span_events_queue_size)\n end", "def initialize(opts = {})\r\n @context = opts[:context] || 3\r\n end", "def in_context(context_type, &block)\n context_type.new.instance_eval(&block)\n end", "def thread_context(tid)\r\n Ragweed::Wrap32::open_thread(tid) do |h|\r\n Ragweed::Wrap32::get_thread_context(h)\r\n end\r\n end", "def initialize(context)\n @context = context\n end", "def initialize(context)\n @context = context\n end", "def create_browser_context\n {\n method: \"Target.createBrowserContext\"\n }\n end", "def initialize exporter: nil\n @exporter = exporter || OpenCensus::Trace.config.exporter\n\n config = configuration\n @trace_prefix = config.trace_prefix\n @job_name_attrs = config.job_attrs_for_trace_name\n @job_span_attrs = config.job_attrs_for_span\n end", "def context\n unless @instance_context\n @instance_context = CallSummaryContext.new(@version , @params['call_sid'])\n end\n @instance_context\n end", "def extract(carrier, context, getter = nil)\n getter ||= default_getter\n trace_id = optionally_pad_trace_id(getter.get(carrier, TRACE_ID_HEADER))\n span_id = getter.get(carrier, SPAN_ID_HEADER)\n sampled = getter.get(carrier, SAMPLED_HEADER)\n\n return context unless valid?(trace_id: trace_id, span_id: span_id)\n\n span_context = Trace::SpanContext.new(\n trace_id: Array(trace_id).pack('H*'),\n span_id: Array(span_id).pack('H*'),\n trace_flags: sampled == 'true' ? Trace::TraceFlags::SAMPLED : Trace::TraceFlags::DEFAULT,\n remote: true\n )\n\n span = Trace::Span.new(span_context: span_context)\n Trace.context_with_span(span, parent_context: set_baggage(carrier: carrier, context: context, getter: getter))\n end", "def initialize(ctx)\r\n @verbose = false\r\n @context = ctx\r\n end", "def to_h\n {\n runtime_guid: tracer.guid,\n span_guid: span_context.id,\n trace_guid: span_context.trace_id,\n span_name: operation_name,\n attributes: tags.map {|key, value|\n {Key: key.to_s, Value: value}\n },\n oldest_micros: start_micros,\n youngest_micros: end_micros,\n error_flag: false,\n dropped_logs: dropped_logs_count,\n log_records: log_records\n }\n end", "def new_context(description, klass, &definition)\n (@contexts << klass.new(description, self, &definition)).last\n end", "def context\n unless @instance_context\n @instance_context = CallContext.new(@version , @params['sid'])\n end\n @instance_context\n end", "def new(env = T.unsafe(nil)); end", "def set_request_tags!(trace, request_span, env, status, headers, response, original_env)\n request_header_collection = Header::RequestHeaderCollection.new(env)\n\n # Since it could be mutated, it would be more accurate to fetch from the original env,\n # e.g. ActionDispatch::ShowExceptions middleware with Rails exceptions_app configuration\n original_request_method = original_env['REQUEST_METHOD']\n\n # request_headers is subject to filtering and configuration so we\n # get the user agent separately\n user_agent = parse_user_agent_header(request_header_collection)\n\n # The priority\n # 1. User overrides span.resource\n # 2. Configuration\n # 3. Nested App override trace.resource\n # 4. Fallback with verb + status, eq `GET 200`\n request_span.resource ||=\n if configuration[:middleware_names] && env['RESPONSE_MIDDLEWARE']\n \"#{env['RESPONSE_MIDDLEWARE']}##{original_request_method}\"\n elsif trace.resource_override?\n trace.resource\n else\n \"#{original_request_method} #{status}\".strip\n end\n\n # Overrides the trace resource if it never been set\n # Otherwise, the getter method would delegate to its root span\n trace.resource = request_span.resource unless trace.resource_override?\n\n request_span.set_tag(Tracing::Metadata::Ext::TAG_COMPONENT, Ext::TAG_COMPONENT)\n request_span.set_tag(Tracing::Metadata::Ext::TAG_OPERATION, Ext::TAG_OPERATION_REQUEST)\n request_span.set_tag(Tracing::Metadata::Ext::TAG_KIND, Tracing::Metadata::Ext::SpanKind::TAG_SERVER)\n\n # Set analytics sample rate\n if Contrib::Analytics.enabled?(configuration[:analytics_enabled])\n Contrib::Analytics.set_sample_rate(request_span, configuration[:analytics_sample_rate])\n end\n\n # Measure service stats\n Contrib::Analytics.set_measured(request_span)\n\n if request_span.get_tag(Tracing::Metadata::Ext::HTTP::TAG_METHOD).nil?\n request_span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_METHOD, original_request_method)\n end\n\n url = parse_url(env, original_env)\n\n if request_span.get_tag(Tracing::Metadata::Ext::HTTP::TAG_URL).nil?\n options = configuration[:quantize] || {}\n\n # Quantization::HTTP.url base defaults to :show, but we are transitioning\n options[:base] ||= :exclude\n\n request_span.set_tag(\n Tracing::Metadata::Ext::HTTP::TAG_URL,\n Contrib::Utils::Quantization::HTTP.url(url, options)\n )\n end\n\n if request_span.get_tag(Tracing::Metadata::Ext::HTTP::TAG_BASE_URL).nil?\n options = configuration[:quantize]\n\n unless options[:base] == :show\n base_url = Contrib::Utils::Quantization::HTTP.base_url(url)\n\n unless base_url.empty?\n request_span.set_tag(\n Tracing::Metadata::Ext::HTTP::TAG_BASE_URL,\n base_url\n )\n end\n end\n end\n\n if request_span.get_tag(Tracing::Metadata::Ext::HTTP::TAG_CLIENT_IP).nil?\n Tracing::ClientIp.set_client_ip_tag(\n request_span,\n headers: request_header_collection,\n remote_ip: env['REMOTE_ADDR']\n )\n end\n\n if request_span.get_tag(Tracing::Metadata::Ext::HTTP::TAG_STATUS_CODE).nil? && status\n request_span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_STATUS_CODE, status)\n end\n\n if request_span.get_tag(Tracing::Metadata::Ext::HTTP::TAG_USER_AGENT).nil? && user_agent\n request_span.set_tag(Tracing::Metadata::Ext::HTTP::TAG_USER_AGENT, user_agent)\n end\n\n HeaderTagging.tag_request_headers(request_span, request_header_collection, configuration)\n HeaderTagging.tag_response_headers(request_span, headers, configuration) if headers\n\n # detect if the status code is a 5xx and flag the request span as an error\n # unless it has been already set by the underlying framework\n request_span.status = 1 if status.to_s.start_with?('5') && request_span.status.zero?\n end", "def initialize(context)\r\n @context = context\r\n end", "def context\n unless @instance_context\n @instance_context = CallContext.new(@version, @params['account_sid'], @params['sid'],)\n end\n @instance_context\n end", "def context label, &block\n return unless block\n Tiramisu.define_and_register_a_context(label, block, self)\n end", "def have_span(operation_name = anything)\n Tracing::Matchers::HaveSpan.new(operation_name)\n end", "def initialize(context)\n @context = context\n end", "def create_spans(layer, parent_id = nil)\n span_id = ScoutApm::Utils::SpanId.new.to_s\n\n start_instant = layer.start_time\n stop_instant = layer.stop_time\n operation = layer.legacy_metric_name\n tags = {\n :start_allocations => layer.allocations_start,\n :stop_allocations => layer.allocations_stop,\n }\n if layer.desc\n tags[:desc] = layer.desc.to_s\n end\n if layer.annotations && layer.annotations[:record_count]\n tags[\"db.record_count\"] = layer.annotations[:record_count]\n end\n if layer.annotations && layer.annotations[:class_name]\n tags[\"db.class_name\"] = layer.annotations[:class_name]\n end\n if layer.backtrace\n tags[:backtrace] = backtrace_parser(layer.backtrace) rescue nil\n end\n\n # Collect up self, and all children into result array\n result = []\n result << DetailedTraceSpan.new(\n span_id.to_s,\n parent_id.to_s,\n start_instant,\n stop_instant,\n operation,\n tags)\n\n layer.children.each do |child|\n # Don't create spans from limited layers. These don't have start/stop times and our processing can't\n # handle these yet.\n unless over_span_limit?(result) || child.is_a?(LimitedLayer)\n result += create_spans(child, span_id)\n end\n end\n\n return result\n end" ]
[ "0.70198977", "0.69962186", "0.6922547", "0.68260103", "0.6736814", "0.66864425", "0.65917724", "0.6553084", "0.62761396", "0.6188183", "0.6167505", "0.6085077", "0.6034239", "0.5998214", "0.5996701", "0.5931383", "0.5901731", "0.58537287", "0.5774807", "0.57116485", "0.5682516", "0.5657775", "0.5657775", "0.56512165", "0.5646071", "0.5562386", "0.5549024", "0.55421", "0.5537665", "0.55366653", "0.5487375", "0.5447331", "0.5445363", "0.54231393", "0.5401904", "0.53885907", "0.5384247", "0.5381508", "0.53617", "0.53418446", "0.5302941", "0.5296501", "0.5269582", "0.5257192", "0.52530575", "0.52373147", "0.52373147", "0.52322274", "0.52230644", "0.52217513", "0.52105576", "0.5170594", "0.51573557", "0.51266193", "0.51159704", "0.5111416", "0.51062274", "0.51059276", "0.5103507", "0.5098723", "0.5095674", "0.5084579", "0.50474834", "0.49904197", "0.49903184", "0.49848163", "0.49621144", "0.49565527", "0.4949203", "0.4914956", "0.4890828", "0.48862162", "0.48846292", "0.48823482", "0.4879048", "0.48742402", "0.4841037", "0.4836581", "0.4828533", "0.48018405", "0.4799922", "0.47965786", "0.47806382", "0.47806382", "0.4773767", "0.47728816", "0.47610748", "0.47522715", "0.4747312", "0.47390538", "0.4737888", "0.47357574", "0.47301427", "0.47250855", "0.47197115", "0.47120267", "0.47111025", "0.47108704", "0.47026432", "0.4700659" ]
0.5431274
33
Runs the RPC server until a SIGINT signal.
def run raise 'Server has shutdown.' unless @server @server.run_till_terminated @server = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run!\n CarrotRpc.connect\n\n signal.trap\n\n pid.check\n daemonize && suppress_output if daemonize?\n pid.ensure_written\n\n # Initialize the servers. Set logger.\n run_servers\n stop_servers(signal.wait)\n end", "def handle_interrupt\n system \"SIGINT received, starting shutdown\"\n @shutdown = true\n end", "def signal_server_down\n interrupt_server_polling_sleep\n nil\n end", "def run\n @run_mutex.synchronize do\n fail 'cannot run without registering services' if rpc_descs.size.zero?\n @server.start\n transition_running_state(:running)\n @run_cond.broadcast\n end\n loop_handle_server_calls\n end", "def shutdown\n if PushmiPullyu.server_running?\n # using stderr instead of logger as it uses an underlying mutex which is not allowed inside trap contexts.\n warn 'Exiting... Interrupt again to force quit.'\n PushmiPullyu.server_running = false\n else\n exit!(1)\n end\n end", "def sigHandler\n Signal.trap(\"INT\") { stop }\n Signal.trap(\"TERM\") { stop }\n end", "def setup_signal_handlers\n Thread.abort_on_exception = true\n\n Signal.trap('INT') do\n @stop_server = true\n @stop_server_cv.broadcast\n end\n\n Signal.trap('TERM') do\n @stop_server = true\n @stop_server_cv.broadcast\n end\n end", "def start_async\n while c = @serv.accept\n Thread.start do\n begin\n @threads << Thread.current\n l = Mutex.new\n loop do\n begin\n x = Dr2.read(c, [Dr2::Types::Message,\n Dr2::Types::Error])\n Thread.start {\n begin\n @threads << Thread.current\n receive x, c, l\n ensure\n l.unlock rescue nil if l.locked?\n @threads.delete Thread.current\n end\n }\n rescue Dr2::Types::EOFException\n break\n rescue Dr2::Types::QuitException\n break\n rescue Exception\n l.synchronize { Dr2.write(c, $!) }\n end\n end\n ensure\n c.close rescue nil\n @threads.delete Thread.current\n end\n end\n end\n end", "def run\n @script.parse!\n @handler.listen(monitored_paths)\n rescue Interrupt\n end", "def run\n trap('INT') { http_server.shutdown }\n http_server.start\n end", "def handle_hangup\n system \"SIGHUP received, starting shutdown\"\n @shutdown = true\n end", "def run\n @script.parse!\n handler.listen(monitored_paths)\n rescue Interrupt\n end", "def run()\n #Keep track of time so the periodic things can be done\n lastTime = Time.now().to_i\n\n while (true)\n selectRes = IO.select([@@socket, $stdin], nil, nil, SELECT_TIMEOUT)\n if (selectRes)\n # Check the read ios\n selectRes[0].each{|ioStream|\n if (ioStream.eof)\n # Got an eof? Stop the thread\n stop()\n return\n end\n\n if (ioStream == @@socket)\n data = ''\n @@lock.synchronize{\n data = @@socket.gets()\n }\n\n InputHandler::queueTask(InputHandler::SERVER_INPUT, data)\n elsif (ioStream == $stdin)\n InputHandler::queueTask(InputHandler::STDIN_INPUT, $stdin.gets())\n else\n # Got some crazy io stream\n log(ERROR, \"Got bad io stream #{ioStream}\")\n end\n }\n end\n\n now = Time.now().to_i\n if (now - lastTime >= SELECT_TIMEOUT)\n #Do periodic stuff\n lastTime = now\n InputHandler::queueTask(InputHandler::PERIODIC_ACTIONS, nil)\n end\n end\n end", "def run\n trap_signals\n loop do\n break if signals_want_shutdown\n begin\n # IO.select returns either a triplet of lists with IO objects that\n # need attention or nil on timeout of 2 seconds.\n if needy = IO.select([server.socket, lifeline], nil, [server.socket, lifeline], 2)\n server.log.debug(\"Detected activity on: #{needy.inspect}\")\n # If the lifeline is active the server went down and we need to go\n # down as well.\n break if needy.flatten.any? { |io| !io.respond_to?(:accept_nonblock) }\n # Otherwise we handle incoming requests\n needy.flatten.each do |io|\n if io.respond_to?(:accept_nonblock)\n begin\n process_incoming_socket(*io.accept_nonblock)\n rescue Errno::EAGAIN, Errno::ECONNABORTED\n end\n end\n end\n end\n rescue EOFError, Errno::EAGAIN, Errno::EINTR, Errno::EBADF, IOError\n end\n end\n cleanup\n end", "def run()\n loop do\n s = @sock.gets\n break if s.nil?\n @mutex.synchronize { handle_server_input(s) }\n end\n end", "def loop_handle_server_calls\n fail 'not started' if running_state == :not_started\n while running_state == :running\n begin\n an_rpc = @server.request_call\n break if (!an_rpc.nil?) && an_rpc.call.nil?\n active_call = new_active_server_call(an_rpc)\n unless active_call.nil?\n @pool.post(active_call) do |ac|\n c, mth = ac\n begin\n rpc_descs[mth].run_server_method(c, rpc_handlers[mth])\n rescue StandardError\n c.send_status(GRPC::Core::StatusCodes::INTERNAL,\n 'Server handler failed')\n end\n end\n end\n rescue Core::CallError, RuntimeError => e\n # these might happen for various reasonse. The correct behaviour of\n # the server is to log them and continue, if it's not shutting down.\n if running_state == :running\n GRPC.logger.warn(\"server call failed: #{e}\")\n end\n next\n end\n end\n # @running_state should be :stopping here\n @run_mutex.synchronize { transition_running_state(:stopped) }\n GRPC.logger.info(\"stopped: #{self}\")\n end", "def signal_restart_graceful\n @signal_operation_queue << :restart_graceful\n interrupt_server_polling_sleep\n nil\n end", "def run\n while s = @socket.accept do\n Thread.new do\n begin\n input = s.gets.strip\n result = @backend.process(input)\n if result.ready?\n log \"OK: #{input}\"\n s.puts \"OK\"\n s.puts result.value\n elsif result.error\n log \"ERROR: #{input}: #{result.error}\"\n if result.error.respond_to?(:backtrace)\n result.error.backtrace.each do |line|\n log \"ERROR: #{line}\"\n end\n end\n s.puts \"ERROR\"\n s.puts result.error.to_s\n else\n log \"PENDING: #{input}\"\n s.puts \"PENDING\"\n end\n rescue Errno::EPIPE\n log \"pipe closed\"\n # client closed the socket early\n rescue => e\n puts e\n puts e.backtrace.join(\"\\n\")\n ensure\n s.close\n end\n end\n end\n rescue Errno::EBADF\n # socket got cleaned up, but we're done anyway\n end", "def graceful_shutdown(signal)\n EventMachine.stop_server(@server) if @server\n Thread.new{ logger.info \"Received #{signal} signal. No longer accepting new connections.\" }\n Thread.new{ logger.info \"Waiting for #{EventMachine.connection_count} connections to finish.\" }\n @server = nil\n graceful_shutdown_check\n end", "def server_stop\n Process.kill 'INT', 0\n end", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to \n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def wait_for_signal\n signal_read, signal_write = IO.pipe\n\n %w[INT TERM].each do |signal|\n Signal.trap(signal) do\n signal_write.puts signal\n end\n end\n\n # Adapted from Sidekiq:\n # https://github.com/mperham/sidekiq/blob/e634177/lib/sidekiq/cli.rb#L94-L97\n while io = IO.select([signal_read])\n readables = io.first\n signal = readables.first.gets.strip\n\n Fluffle.logger.info \"Received #{signal}; shutting down...\"\n\n # First stop the consumers from receiving messages\n @consumers.each &:cancel\n\n # Then wait for worker pools to finish processing their active jobs\n @handler_pool.shutdown\n unless @handler_pool.wait_for_termination(@shutdown_timeout)\n # `wait_for_termination` returns false if it didn't shut down in time,\n # so we need to kill it\n @handler_pool.kill\n end\n\n # Finally close the connection\n @channel.close\n\n return\n end\n end", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to\n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def main\n s = GRPC::RpcServer.new\n s.add_http2_port('0.0.0.0:50051', :this_port_is_insecure)\n s.handle(GreeterServer)\n # Runs the server with SIGHUP, SIGINT and SIGQUIT signal handlers to\n # gracefully shutdown.\n # User could also choose to run server via call to run_till_terminated\n s.run_till_terminated_or_interrupted([1, 'int', 'SIGQUIT'])\nend", "def main_loop\n debug(\"Entering request handler main loop\")\n reset_signal_handlers\n begin\n @graceful_termination_pipe = IO.pipe\n @graceful_termination_pipe[0].close_on_exec!\n @graceful_termination_pipe[1].close_on_exec!\n\n @main_loop_thread_lock.synchronize do\n @main_loop_generation += 1\n @main_loop_running = true\n @main_loop_thread_cond.broadcast\n\n @select_timeout = nil\n\n @selectable_sockets = []\n @server_sockets.each_value do |value|\n socket = value[2]\n @selectable_sockets << socket if socket\n end\n @selectable_sockets << @owner_pipe\n @selectable_sockets << @graceful_termination_pipe[0]\n end\n\n install_useful_signal_handlers\n start_threads\n wait_until_termination_requested\n wait_until_all_threads_are_idle\n terminate_threads\n debug(\"Request handler main loop exited normally\")\n\n rescue EOFError\n # Exit main loop.\n trace(2, \"Request handler main loop interrupted by EOFError exception\")\n rescue Interrupt\n # Exit main loop.\n trace(2, \"Request handler main loop interrupted by Interrupt exception\")\n rescue SignalException => signal\n trace(2, \"Request handler main loop interrupted by SignalException\")\n if signal.message != HARD_TERMINATION_SIGNAL\n raise\n end\n rescue Exception => e\n trace(2, \"Request handler main loop interrupted by #{e.class} exception\")\n raise\n ensure\n debug(\"Exiting request handler main loop\")\n revert_signal_handlers\n @main_loop_thread_lock.synchronize do\n @graceful_termination_pipe[1].close rescue nil\n @graceful_termination_pipe[0].close rescue nil\n @selectable_sockets = []\n @main_loop_generation += 1\n @main_loop_running = false\n @main_loop_thread_cond.broadcast\n end\n end\n end", "def run(&block)\n raise \"#{self} cannot run; it was permanently killed.\" if @dead\n \n super do |socket, revents|\n if socket == @int_sock_rep || socket == @int_sock_pull\n key, * = socket.recv_array\n kill = key == \"KILL\"\n blocking = socket == @int_sock_rep\n \n # Call the user block of #interrupt and store the return value\n unless kill\n result = @interruptions.pop.call\n @outerruptions.push result if blocking\n end\n \n # Call the user block of #run\n block.call nil, nil if block\n \n # Send a response if the interruption was blocking\n socket.send_array [\"OKAY\"] if blocking\n \n if kill\n @int_sock_rep.close\n @int_sock_pull.close\n @dead = true\n end\n else\n block.call socket, revents if block\n end\n end.tap do |hash|\n hash.delete @int_sock_rep\n hash.delete @int_sock_pull\n end\n end", "def start\n puts \"Press Ctrl-C to close.\"\n @server.start\n end", "def main_loop\n %w[INT TERM].each { |sig| Signal.trap(sig) { save_state; exit(0) } }\n\n while true\n check_log_file unless File.size(@auth_log.file) == @auth_log.size\n sleep(@cfg['check_interval'])\n end\n end", "def trap_signals\n [\"TERM\", \"INT\"].each do |signal|\n trap(signal) do\n @thin_server.stop! if @thin_server\n EM.stop\n end\n end\n end", "def handle_term_signal\n system \"SIGTERM received, starting shutdown\"\n @shutdown = true\n end", "def run\n Thread.new {\n loop do\n @server.update(1000)\n break if @terminate\n end\n }\n end", "def run_async\n stop = false\n\n puts \"Press Crtl+C to quit...\"\n trap('INT') do\n puts \"\\nFinish...\"\n stop = true\n end\n\n while !stop\n Orocos::Async.step\n sleep(0.01)\n end\n\nend", "def main_loop\n Thread.start(@protocol.accept) do |client|\n @grp.add Thread.current\n Thread.current['DRb'] = { 'client' => client ,\n 'server' => self }\n DRb.mutex.synchronize do\n client_uri = client.uri\n @exported_uri << client_uri unless @exported_uri.include?(client_uri)\n end\n loop do\n begin\n succ = false\n invoke_method = InvokeMethod.new(self, client)\n succ, result = invoke_method.perform\n if !succ && verbose\n p result\n result.backtrace.each do |x|\n puts x\n end\n end\n client.send_reply(succ, result) rescue nil\n ensure\n client.close unless succ\n if Thread.current['DRb']['stop_service']\n Thread.new { stop_service }\n end\n break unless succ\n end\n end\n end\n end", "def add_sigint_handler\n trap 'INT' do\n puts '\\nCancelled. Bye Bye!'\n exit!\n end\n end", "def listen\n while true\n data = $BLIX_REQUEST.pop\n response = do_handle(body)\n if response\n puts \"[DummyServer] response: data=#{data}, options=#{options}\" if $DEBUG\n $BLIX_RESPONSE.push(data)\n end\n end\n end", "def user_interrupt\n write 'Terminating' # XXX get rid of this\n stoploop\n end", "def watch\n begin\n yield\n rescue Interrupt\n puts\n exit 0\n end\n end", "def start\n @logger.info('daemon start.')\n\n unless (server_address = @sysop.get_server_address(@sockaddr_get)) then\n @logger.fatal('failed to start daemon.')\n return 1\n end\n\n unless (server_socket = @sysop.get_server_socket(server_address)) then\n @logger.fatal('failed to start daemon.')\n return 1\n end\n @logger.info(\"open server socket: #{@sysop.get_sockaddr(server_socket) || server_address}\")\n\n begin\n server_socket_option(server_socket, server_address)\n\n unless (server_pid = run_server(server_socket)) then\n @logger.fatal('failed to start daemon.')\n return 1\n end\n @logger.info(\"server process start (pid: #{server_pid})\")\n\n @logger.info(\"start server polling (interval seconds: #{@server_polling_interval_seconds})\")\n until (@stop_state)\n server_polling_sleep\n if (server_pid) then\n @logger.debug(\"server polling... (pid: #{server_pid})\") if @logger.debug?\n else\n @logger.debug('server polling...') if @logger.debug?\n end\n\n if (! server_pid || @sysop.wait(server_pid, Process::WNOHANG)) then\n if (server_pid) then\n @logger.warn(\"found server down (pid: #{server_pid}) and restart server.\")\n else\n @logger.warn('found server down and restart server.')\n end\n if (server_pid = run_server(server_socket)) then\n @logger.info(\"server process start (pid: #{server_pid})\")\n end\n end\n\n while (! @stop_state && server_pid && sig_ope = @signal_operation_queue.shift)\n case (sig_ope)\n when :restart_graceful, :restart_forced\n if (next_server_address = @sysop.get_server_address(@sockaddr_get)) then\n if (next_server_address.to_address == server_address.to_address) then\n if (next_server_address.to_option != server_address.to_option) then\n server_address = next_server_address\n end\n else\n if (next_server_socket = @sysop.get_server_socket(next_server_address)) then\n @logger.info(\"open server socket: #{@sysop.get_sockaddr(next_server_socket) || next_server_address}\")\n server_socket_close(server_socket, server_address)\n server_socket = next_server_socket\n server_address = next_server_address\n else\n @logger.warn(\"server socket continue: #{@sysop.get_sockaddr(server_socket) || server_address}\")\n end\n end\n else\n @logger.warn(\"server socket continue: #{@sysop.get_sockaddr(server_socket) || server_address}\")\n end\n server_socket_option(server_socket, server_address)\n\n case (sig_ope)\n when :restart_graceful\n @logger.info(\"server graceful restart (pid: #{server_pid})\")\n when :restart_forced\n @logger.info(\"server forced restart (pid: #{server_pid})\")\n else\n @logger.warn(\"internal warning: unknown signal operation <#{sig_ope.inspect}>\")\n end\n\n if (next_pid = run_server(server_socket)) then\n @logger.info(\"server process start (pid: #{next_pid})\")\n\n if (@server_restart_overlap_seconds > 0) then\n @logger.info(\"server restart overlap (interval seconds: #{@server_restart_overlap_seconds})\")\n sleep(@server_restart_overlap_seconds)\n end\n\n case (sig_ope)\n when :restart_graceful\n @logger.info(\"server graceful stop (pid: #{server_pid})\")\n server_stop_graceful(server_pid)\n when :restart_forced\n @logger.info(\"server forced stop (pid: #{server_pid})\")\n server_stop_forced(server_pid)\n else\n @logger.warn(\"internal warning: unknown signal operation <#{sig_ope.inspect}>\")\n end\n\n add_terminated_child_process(server_pid)\n server_pid = next_pid\n else\n @logger.warn(\"server continue (pid: #{server_pid})\")\n end\n when :stat_get_and_reset\n if (@sysop.send_signal(server_pid, SIGNAL_STAT_GET_AND_RESET)) then\n @logger.info(\"stat get(reset: true) (pid: #{server_pid})\")\n else\n @logger.error(\"failed to stat get(reset: true) (pid: #{server_pid})\")\n end\n when :stat_get_no_reset\n if (@sysop.send_signal(server_pid, SIGNAL_STAT_GET_NO_RESET)) then\n @logger.info(\"stat get(reset: false) (pid: #{server_pid})\")\n else\n @logger.error(\"failed to stat get(reset: false) (pid: #{server_pid})\")\n end\n when :stat_stop\n if (@sysop.send_signal(server_pid, SIGNAL_STAT_STOP)) then\n @logger.info(\"stat stop (pid: #{server_pid})\")\n else\n @logger.error(\"failed to stat stop (pid: #{server_pid})\")\n end\n else\n @logger.warn(\"internal warning: unknown signal operation <#{sig_ope.inspect}>\")\n end\n end\n\n wait_terminated_child_processes\n end\n\n if (server_pid) then\n case (@stop_state)\n when :graceful\n @logger.info(\"server graceful stop (pid: #{server_pid})\")\n unless (server_stop_graceful(server_pid)) then\n @logger.fatal('failed to stop daemon.')\n return 1\n end\n unless (@sysop.wait(server_pid)) then\n @logger.fatal('failed to stop daemon.')\n return 1\n end\n when :forced\n @logger.info(\"server forced stop (pid: #{server_pid})\")\n unless (server_stop_forced(server_pid)) then\n @logger.fatal('failed to stop daemon.')\n return 1\n end\n unless (@sysop.wait(server_pid)) then\n @logger.fatal('failed to stop daemon.')\n return 1\n end\n else\n @logger.warn(\"internal warning: unknown stop state <#{@stop_state.inspect}>\")\n end\n else\n @logger.warn('no server to stop.')\n end\n ensure\n server_socket_close(server_socket, server_address)\n end\n\n @logger.info('daemon stop.')\n return 0\n end", "def run\n loop do\n Thread.start(server.accept) do |client|\n begin\n ServerThread.new(client,@job_queue).run\n rescue Exception => e\n STDERR.puts \"A server thread has encountered an exception:\"\n STDERR.puts \"--------------------------------\"\n STDERR.puts e.message\n STDERR.puts e.backtrace\n STDERR.puts \"--------------------------------\"\n end\n end\n end\n end", "def run\n connect = false\n until connect do\n begin\n call { |server| @server = server ; start }\n rescue\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end", "def signal_stop_graceful\n @stop_state ||= :graceful\n interrupt_server_polling_sleep\n nil\n end", "def run\r\n while true do\r\n begin\r\n msg = $stdin.gets\r\n if msg.to_s.include? \"exit\"\r\n break\r\n else\r\n set_socket() #must do it in every run\r\n send_data(msg)\r\n com = msg.to_s.split\r\n if (com[0] == \"add\" or com[0] == \"set\" or com[0] == \"cas\" or com[0] == \"append\" or com[0] == \"prepend\") #must send value\r\n value = read_msg(com[4].to_i) #com[4] -> size of the value to read\r\n send_data(value)\r\n end\r\n retrieve_data()#prints data\r\n #while next_line_readable?(@socket)\r\n # puts @socket.gets.chop #puts every line that the socket sends as response\r\n #end\r\n end\r\n rescue => exception\r\n puts exception.message\r\n puts \"A server failure has been encountered\"\r\n puts \"Closing...\"\r\n sleep(2)\r\n break\r\n end\r\n end\r\n end", "def signal_restart_forced\n @signal_operation_queue << :restart_forced\n interrupt_server_polling_sleep\n nil\n end", "def run_c!(port=9091)\n puts \"Started on #{port}!!\"\n sleep(100)\n rescue Interrupt\n puts \"Interrupt!!\"\n exit\n ensure\n puts \"Closing!!\"\n end", "def trap_exit_signal(signal)\n trap(signal) {\n Serv::Initializer.stop!\n }\n end", "def main\n loop do\n unless @context\n begin\n self.process(self.await_input)\n rescue ConsoleInterrupt\n self.replace '^C'\n self.println ':(', 2\n rescue ConsoleError => e\n self.print _INTL(\"{1}: {2}\",self.name,e.message), 0, true\n self.println ':(', 2\n rescue ConsoleExit\n self.exit_session\n break\n end\n end\n end\n end", "def stop\n logger.debug \"stopping server\"\n @status = :stopping\n EM.stop_server @sig\n done if @connections.empty?\n sleep 0.1 while @status != :stopped unless EM.reactor_thread?\n end", "def fast_shutdown(signal)\n EventMachine.stop_server(@server) if @server\n Thread.new{ logger.info \"Received #{signal} signal. No longer accepting new connections.\" }\n Thread.new{ logger.info \"Maximum time to wait for connections is #{MAX_FAST_SHUTDOWN_SECONDS} seconds.\" }\n Thread.new{ logger.info \"Waiting for #{EventMachine.connection_count} connections to finish.\" }\n @server = nil\n EventMachine.stop_event_loop\n #EventMachine.stop_event_loop if EventMachine.connection_count == 0\n #Thread.new do\n # sleep MAX_FAST_SHUTDOWN_SECONDS\n # $kernel.exit!\n #end\n end", "def run\n loop{\n @client = @server.accept\n @serverPool.schedule(@client)\n }\n end", "def run\n loop{\n @client = @server.accept\n @serverPool.schedule(@client)\n }\n end", "def run\n @connection.queue do |queue|\n puts(\"Server started. Broadcasting to queue: “#{queue.name}”.\")\n\n loop do\n message = $stdin.gets.chomp\n queue.broadcast(message.to_json)\n rescue Interrupt\n return\n end\n end\n end", "def run\n while true; async.handle_message @socket.read; end\n end", "def interrupt_handler\n signal_handler(2)\n end", "def run!\n start_server!\n @server_thread = Thread.new do\n loop do\n Thread.start(@server.accept) do |socket|\n begin\n handle_request(socket)\n rescue => e\n @logger.error \"#{e.class}: #{e.message}\"\n @logger.debug e.backtrace\n ensure\n closing_client = @client_mutex.synchronize do\n @clients.delete(socket)\n end\n # invoke callbacks for disconnect if there is a client to\n # disconnect\n emit(:client_disconnect, closing_client) if closing_client\n socket.close\n end\n end\n end\n end\n end", "def run\n @logger.info 'Running'\n @thread_status = :running\n\n register_self_with_zk\n register_callbacks\n watch\n loop do\n queue_event = @queue.pop\n GracefulTrap.critical_section(%w(INT TERM), @logger) do\n process_queue_event(\n queue_event[:type],\n queue_event[:value],\n queue_event[:meta]\n )\n end\n end\n @thread_status = :stopped\n end", "def request_termination\n @sigterm_timer.cancel if @sigterm_timer\n ::Process.kill('TERM', @pid) rescue nil\n end", "def start!\n stop_server_thread = Thread.new do\n loop do\n break if @stop_server\n @stop_server_mu.synchronize { @stop_server_cv.wait(@stop_server_mu, 10) }\n end\n logger.info { 'Shutting down...' }\n server.stop\n end\n\n logger.info { 'Booting gRPC Server...' }\n @started = true\n server.run\n stop_server_thread.join\n @started = false\n\n logger.info { 'Goodbye!' }\n end", "def restart_server(connection)\n signal :USR2\n\n connection.write \"GET / HTTP/1.1\\r\\n\\r\\n\" # trigger it to start by sending a new request\n\n wait_for_server_to_boot\n end", "def listen\n trap(\"SIGINT\") { sig_int_received }\n trap(\"SIGTERM\") { abort; exit!(0) }\n trap(\"USR2\") { abort; restart } if Signal.list.has_key?(\"USR2\")\n DRb.start_service(\"druby://127.0.0.1:#{port}\", self)\n stderr.puts \"Spork is ready and listening on #{port}!\"\n stderr.flush\n DRb.thread.join\n end", "def run\n @reactor.run do\n @root.run\n\n Signal.trap('INT', &method(:close))\n Signal.trap('TERM', &method(:close))\n end\n end", "def start_server\n loop do\n socket = @server.accept\n @pool.post do\n request = socket.gets\n unless request.nil?\n response = fetch_data(request)\n socket.print build_response(response)\n socket.print \"\\r\\n\"\n socket.print response[:message]\n end\n socket.close\n end\n end\n end", "def run\n Thread.start do\n begin\n while true\n main_loop\n end\n ensure\n @protocol.close if @protocol\n end\n end\n end", "def run\r\n Settings::DEFAULT_TRIGGERS.each_key{|k| load_trigger(k, true)}\r\n Settings::TRIGGERS.each_key{|k| load_trigger(k)}\r\n @socket = TCPSocket.open(self.server, self.port)\r\n\r\n $log.info(\"Initiating handshake with server...\")\r\n say \"USER #{nick} 0 * #{nick}\"\r\n say \"NICK #{nick}\"\r\n\r\n until @socket.eof? do\r\n msg = @socket.gets\r\n msg = (msg.split(\" \")[1] == \"PRIVMSG\" ? PrivateMessage.new(msg) : Message.new(msg))\r\n\r\n if msg.type == \"PRIVMSG\"\r\n cache_message(msg)\r\n fire_triggers(msg)\r\n end\r\n\r\n #keep alive\r\n if msg.parts[0] == \"PING\"\r\n say \"PONG :pingis\"\r\n else\r\n case msg.parts[1]\r\n when \"001\"\r\n $log.info(\"Processing connection to server...\")\r\n when \"376\"\r\n $log.info(\"Connected to server, joining channel...\")\r\n join_chan(self.chan)\r\n when \"366\"\r\n @in_chan = true\r\n $log.info(\"Successfully joined ##{self.chan}\")\r\n else\r\n end\r\n end\r\n #output to terminal window whatever the server is giving our socket\r\n $log.info(\"#{msg.stringify}\")\r\n end\r\n end", "def register_signal_handlers\n trap(\"QUIT\") { stop }\n trap(\"INT\") { @stop ? stop! : stop }\n trap(\"TERM\") { stop! }\n end", "def run\n srv = if self.path\n UNIXServer.new(path)\n else\n TCPServer.new(host, port)\n end\n\n loop do\n io = accept_connection(srv)\n\n begin\n data = receive_data(io)\n send_data(io, handle_data(io, data)) if data\n rescue\n raise 'Connection reset by peer' if config[:debug] && io.closed?\n ensure\n io.close rescue nil\n GC.start if config[:run_gc_per_request]\n end\n end\n end", "def process_signal(signal_name)\n if signal_name == 'TERM'\n if $shutdown\n logger.info \"TERM received again, exiting immediately\"\n Process.exit(1) if $shutdown\n else\n logger.info \"TERM received, starting graceful shutdown\"\n $shutdown = true\n graceful_shutdown\n end\n elsif signal_name == 'USR1'\n logger.info \"USR1 received, hot restart in progress\"\n hot_restart\n end\n end", "def client_loop(socket)\n while (line = socket.gets)\n case msg = line.chop\n\n # on receipt of either 'enable' or 'disable,' call entry-point routine\n # for additional client-side processing\n #\n when 'enable', 'disable' then @entrypoint_routine.call(msg)\n else\n @client.logging \"ignoring unexpected server response: #{msg}\", 2\n end\n end\n end", "def trap_signals\n [:INT, :QUIT, :TERM].each do |sig|\n trap(sig) do\n ProcessManager::Log.info \"#{description}: Received #{sig} - setting internal shutting down flag and possibly finishing last run\"\n stop_thread = Thread.new {stop}\n stop_thread.join\n end\n end\n # make sure we do not handle children like the master process\n trap(:CHLD, 'DEFAULT')\n end", "def run port, verbose_level, script_inject, upstream_host, upstream_port\n\t\tbegin\n\t\t\t# Start our server to handle connections (will raise things on errors)\n\t\t\t@socket = TCPServer.new port\n\t\t\t@verbose_level = verbose_level\n\t\t\t@upstream_host = upstream_host\n\t\t\t@upstream_port = upstream_port\n\t\t\t@script_inject = script_inject\n\n\t\t\trequest_number = 0\n\t\t\t# Handle every request in another thread\n\t\t\tloop do\n\t\t\t\ts = @socket.accept\n\n\t\t\t\tThread.new s, request_number, &method(:handle_request)\n\t\t\t\trequest_number += 1\n\t\t\tend\n\n\t\t# CTRL-C\n\t\trescue Interrupt\n\t\t\tputs 'Got Interrupt..'\n\t\t\t# Ensure that we release the socket on errors\n\t\tensure\n\t\t\tif @socket\n\t\t\t\t@socket.close\n\t\t\t\tputs 'Socked closed..'\n\t\t\tend\n\t\t\tputs 'Quitting.'\n\t\tend\n\tend", "def trap_signals\n %w(TERM INT).each do |signal|\n trap(signal) { stop }\n end\n end", "def listen\n\n puts('listening')\n while true\n begin\n received_data = p @socket.recv(1000) # Receive\n Thread.new do # Start a new thread to handle the incoming message\n respond(JSON.parse(received_data)) # Determine how to respond to received and parsed message\n end\n rescue Errno::ECONNRESET # If there was an issue in replaying in respond function - e.g. remote host no longer up\n puts('Connection to remote host failed')\n end\n end\n end", "def start!\n logger.info { 'Booting gRPC Server...' }\n server.run_till_terminated\n logger.info { 'Shutting down gRPC server...' }\n end", "def listen()\n loop { \n Thread.start(@server.accept) do |client|\n client.puts(Time.now.ctime) \n while line = client.recv(200)\n purge()\n puts line\n interprete(client,line)\n end\n end\n }\n end", "def quit _signal = :SIGINT\n @networks.each do |network|\n network.transmit :QUIT, 'Got SIGINT?'\n network.disconnect\n end\n\n EventMachine.stop\n end", "def add_irb_trap\n Merb.trap(\"INT\") do\n if @interrupted\n Merb.logger.warn! \"Interrupt received a second time, exiting!\\n\"\n exit\n end\n\n @interrupted = true\n Merb.logger.warn! \"Interrupt a second time to quit.\"\n Kernel.sleep 1.5\n ARGV.clear # Avoid passing args to IRB\n\n if @irb.nil?\n require \"irb\"\n IRB.setup(nil)\n @irb = IRB::Irb.new(nil)\n IRB.conf[:MAIN_CONTEXT] = @irb.context\n end\n\n Merb.trap(:INT) { @irb.signal_handle }\n catch(:IRB_EXIT) { @irb.eval_input }\n\n Merb.logger.warn! \"Exiting from IRB mode back into server mode.\"\n @interrupted = false\n add_irb_trap\n end\n end", "def start\n\t\tloop do\n\t\t\t@client = @server.accept # Wait for a client to connect\n\t\t\t@client.sendmsg \"220 ready\\r\\n\" # 220 - the server is ready\n\n\t\t\t# authentication (we assume that the client does this correctly)\n\t\t\t@user = @client.gets.gsub(\"\\r\\n\", \"\") # => USER\n\t\t\t@client.sendmsg \"331\\r\\n\" # => USER ok\n\n\t\t\t@pass = @client.gets.gsub(\"\\r\\n\", \"\") # => PASS\n\t\t\t@client.sendmsg \"230\\r\\n\" # => PASS ok\n\n\t\t\twhile req = @client.gets\n\t\t\t\treq.gsub!(\"\\r\\n\", \"\")\n\n\t\t\t\t# XXX not really needed since no QUIT signal is sent by FCP\n\t\t\t\tif req == \"QUIT\"\n\t\t\t\t\t@client.sendmsg \"221\\r\\n\" # => QUIT ok, bye!\n\t\t\t\t\t@client.close\n\t\t\t\t\t@client = nil\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\t\t\t\ttmp = req.split(\" \")\n\t\t\t\tcmd, args = tmp[0], tmp[1..tmp.length-1]\n\n\t\t\t\tif !SUPPORTED_CMD.include?(cmd)\n\t\t\t\t\t@client.sendmsg \"500\\r\\n\"\n\t\t\t\t\tnext\n\t\t\t\tend\n\n\t\t\t\tself.__send__(\"cmd_#{cmd.downcase}\", args)\n\t\t\tend\n\t\tend\n\tend", "def on_interrupt(&block)\n trap(\"INT\") { yield \"SIGINT\" }\n trap(\"QUIT\") { yield \"SIGQUIT\" }\n trap(\"TERM\") { yield \"SIGTERM\" }\n end", "def process_signal(signal_name)\n if signal_name == 'TERM'\n if @shutdown\n logger.info \"TERM received again, exiting immediately\"\n Process.exit(1)\n else\n logger.info \"TERM received, starting graceful shutdown\"\n graceful_shutdown\n end\n elsif signal_name == 'USR1'\n logger.info \"USR1 received, hot restart in progress\"\n hot_restart\n end\n end", "def daemon_install_signal_handler\n install_signal_handler(['TERM', 'INT', 'HUP'], :trap_msg => \"Caught trap signal. Shutdown workers...\") do\n $daemon[:worker_pids].each do |pid|\n begin\n Process.kill('TERM', pid)\n rescue => exception\n end\n end\n $daemon[:work] = false\n end\nend", "def server_loop(server)\n loop do\n Thread.start(server.accept) do |client|\n _unused, remote_port, _unused, remote_ip = client.peeraddr\n @server.logging \"--> OPEN connection from #{remote_ip}:#{remote_port}\"\n client.puts @entrypoint_routine.call\n client.close\n @server.logging \"<-- CLOSE connection from #{remote_ip}:#{remote_port}\"\n end\n end\n end", "def kgio_tryaccept # :nodoc:\n case buf = @to_io.kgio_tryread(4)\n when String\n # unpack the buffer and trigger the signal handler\n signum = buf.unpack('l')\n fake_sig(signum[0])\n # keep looping, more signals may be queued\n when nil # EOF: master died, but we are at a safe place to exit\n fake_sig(:QUIT)\n when :wait_readable # keep waiting\n return false\n end while true # loop, as multiple signals may be sent\n end", "def detect_interruption\n trap('INT') do\n interrupted!\n puts\n puts 'Hold on, let me finish this file...'\n end\n end", "def run\n run_app\n adapter.run\n rescue Interrupt\n shut_down\n end", "def run_server_thread; end", "def start\n\t\tstart_async\n\t\tputs \"\\nPress ^C to exit.\\n\"\n\t\tGReactor.join { puts \"\\r\\nStarting shutdown sequesnce. Press ^C to force quit.\"}\n\tend", "def trap_sigint(metabolizer, &block)\n trap 'SIGINT', proc {\n block.call if block\n metabolizer.stop\n }\nend", "def install_signal_handlers\n trap 'TERM' do do_exit end\n trap 'INT' do do_exit end\n end", "def start\n while not @stopped\n puts \"Waiting for something to happen\"\n sleep 1\n end\n end", "def status_loop\n loop do\n @launcher.events.debug \"systemd: notify status\"\n begin\n @systemd.notify_status(status.to_s)\n rescue\n @launcher.events.error \"! systemd: notify status failed:\\n #{$!.to_s}\\n #{$!.backtrace.join(\"\\n \")}\"\n ensure\n sleep 1\n end\n end\n end", "def hot_restart\n fork do\n # Let the new server know where to find the file descriptor server\n ENV[FILE_DESCRIPTOR_SERVER_VAR] = file_descriptor_server.socket_path\n\n Dir.chdir(ENV['APP_ROOT']) if ENV['APP_ROOT']\n ENV.delete('BUNDLE_GEMFILE') # Ensure a fresh bundle is used\n\n exec(\"bundle exec #{server_configuration.start_command}\")\n end\n end", "def interrupt_forked_worker_and_exit\n Process.kill('USR1', @forked_worker_pid) if @forked_worker_pid\n Process.waitall\n exit\n end", "def interrupt_forked_worker_and_exit\n Process.kill('USR1', @forked_worker_pid) if @forked_worker_pid\n Process.waitall\n exit\n end", "def start\n @heroku_manager = nil\n while true do\n begin\n self.run_loop\n rescue SystemExit, Interrupt # purposeful quit, ctrl-c, kill signal etc\n raise\n rescue StandardError => e # any other error\n ErrorHandler.handle(e)\n end\n sleep @interval\n end\n end", "def signal_stat_stop\n @signal_operation_queue << :stat_stop\n interrupt_server_polling_sleep\n nil\n end", "def start!\n update_proc_title(:starting)\n\n server_thread = Thread.new do\n logger.info { \"[gruf] Starting gruf server at #{@hostname}...\" }\n server.run_till_terminated_or_interrupted(KILL_SIGNALS)\n end\n @started = true\n update_proc_title(:serving)\n server_thread.join\n @started = false\n\n update_proc_title(:stopped)\n logger.info { '[gruf] Goodbye!' }\n end", "def start_daemon(config, &block) # :yields: socket_server\n c = DEFAULT.dup\n c.update(config)\n\n File.umask(c[:daemon_umask])\n\n if (c[:status_file]) then\n status_file = StatusFile.new(c[:status_file])\n status_file.open\n status_file.lock or abort(\"#{c[:daemon_name]} daemon is already running.\")\n end\n\n if (c[:daemonize]) then\n logger = Syslog::Logger.new(c[:daemon_name])\n def logger.close\n Syslog::Logger.syslog = nil\n Syslog.close\n nil\n end\n else\n logger = Logger.new(STDOUT)\n logger.progname = c[:daemon_name]\n def logger.close # not close STDOUT\n end\n end\n\n if (c[:daemon_debug]) then\n logger.level = Logger::DEBUG\n else\n logger.level = Logger::INFO\n end\n\n if (c[:listen_address].respond_to? :call) then\n sockaddr_get = c[:listen_address]\n else\n sockaddr_get = proc{ c[:listen_address] }\n end\n\n euid = Daemon.get_uid(c[:server_privileged_user])\n egid = Daemon.get_gid(c[:server_privileged_group])\n\n root_process = RootProcess.new(logger, sockaddr_get, c[:server_polling_interval_seconds], c[:server_restart_overlap_seconds], euid, egid, &block)\n [ [ :signal_stop_graceful, proc{ root_process.signal_stop_graceful } ],\n [ :signal_stop_forced, proc{ root_process.signal_stop_forced } ],\n [ :signal_stat_get_and_reset, proc{ root_process.signal_stat_get(reset: true) } ],\n [ :signal_stat_get_no_reset, proc{ root_process.signal_stat_get(reset: false) } ],\n [ :signal_stat_stop, proc{ root_process.signal_stat_stop } ],\n [ :signal_restart_graceful, proc{ root_process.signal_restart_graceful } ],\n [ :signal_restart_forced, proc{ root_process.signal_restart_forced } ]\n ].each{|sig_key, sig_hook|\n if (signal = c[sig_key]) then\n Signal.trap(signal, &sig_hook)\n end\n }\n Signal.trap(:CHLD) { root_process.signal_server_down }\n\n if (c[:daemonize]) then\n Process.daemon(c[:daemon_nochdir])\n end\n\n # update after process ID changes in daemonization.\n if (c[:status_file]) then\n status_file.write({ 'pid' => $$ }.to_yaml)\n end\n\n status = root_process.start\n exit(status)\n end", "def shutdown\n _shutdown 'SIGUSR1' unless dead?\n end", "def start\n loop do\n begin\n socket = tcp_server.accept\n\n handle_request(socket)\n ensure\n socket.close\n end\n end\n end", "def run(options = {})\n loop do\n supervisor = run!(options)\n\n sleep 0.1 while supervisor.alive?\n\n break if @shutdown\n\n log.error \"!!! #{self} crashed. Restarting...\"\n end\n\n Celluloid.shutdown\n end", "def wait_for_sinatra_to_startup!\n 10.times do\n Net::HTTP.get(URI.parse(\"http://#{@host}:#{@port}/up_and_running\"))\n return\n rescue Errno::ECONNREFUSED => e # rubocop:todo Lint/UselessAssignment\n sleep(1)\n end\n\n raise StandardError, \"Our dummy webservice did not start up in time!\"\n end" ]
[ "0.6743719", "0.6282611", "0.6260028", "0.623745", "0.6153226", "0.60285866", "0.60183835", "0.60058933", "0.5991355", "0.5962793", "0.59567213", "0.5938346", "0.5879837", "0.58623683", "0.58566815", "0.5824581", "0.5816113", "0.58004975", "0.5793054", "0.5787713", "0.5782777", "0.5777647", "0.57634443", "0.57634443", "0.57471704", "0.57409304", "0.57295614", "0.57225835", "0.5717735", "0.57037956", "0.56732136", "0.5658715", "0.563494", "0.5631444", "0.5630449", "0.5630177", "0.5627216", "0.56210095", "0.56181073", "0.56072915", "0.5584795", "0.5568324", "0.55528504", "0.5551683", "0.555064", "0.55295557", "0.5529378", "0.55281806", "0.55260986", "0.55260986", "0.5497403", "0.54953915", "0.548086", "0.54596776", "0.54394346", "0.5434085", "0.5426905", "0.5424487", "0.5417648", "0.5400411", "0.53926307", "0.5387627", "0.53874373", "0.53864694", "0.5382383", "0.53800637", "0.53664017", "0.53605705", "0.5356411", "0.53521156", "0.53492004", "0.53463113", "0.533142", "0.5329998", "0.53197426", "0.5318307", "0.5307117", "0.5306713", "0.53059393", "0.5303274", "0.5300726", "0.52980226", "0.5297999", "0.52949965", "0.52928925", "0.52925473", "0.5292139", "0.5283196", "0.5281568", "0.5269358", "0.52621794", "0.5261431", "0.5248845", "0.52443427", "0.5243005", "0.5242708", "0.5240421", "0.5236759", "0.5235208", "0.52311414" ]
0.66912156
1
override hash when overriding eql?
def hash [schema, name].hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n super || @hash == other.hash\n end", "def ==(other)\n self.to_hash == other.to_hash\n end", "def eql?(arg)\n self.hash == arg.hash\n end", "def ==(other)\n self.hash == other.hash\n end", "def == other\n return @hash == other.hash if other.class <= Blobject\n return @hash == other if other.class <= Hash\n super\n end", "def eql?(other)\n @hash.hash == other.hash\n end", "def eql?(other)\n @hash == other.hash\n end", "def ==(other)\n self.class==other.class && self.hash==other.hash\n end", "def eql?(other)\n hash == other.hash\n end", "def ==(other)\n self.to_hash == other.to_hash\n end", "def eql?(other)\n return false if self.class != other.class\n self.to_hash == (other.respond_to?(:to_hash) ? other.to_hash : nil)\n end", "def eql?(other)\r\n other.class == self.class && other.hash == self.hash && _eql?(other)\r\n end", "def ==(other)\n to_hash == other.to_hash\n end", "def ==(other)\n to_hash == other.to_hash\n end", "def eql?( other )\n\t\treturn false unless other.class.eql?( self.class )\n\t\treturn self.hash == other.hash\n\tend", "def test_Hash_InstanceMethods_Equality\n\t\th1 = { 'a'=>1, 'c'=>2 }\n\t\th2 = { 7=>35, 'c'=>2, 'a'=>1 }\n\t\th3 = { 'a'=>1, 'c'=>2, 7=>35 }\n\t\th4 = { 'a'=>1, 'd'=>2, 'f'=>35 }\n\t\tassert_equal(false, h1 == h2)\n\t\tassert_equal(true, h2 == h3)\n\t\tassert_equal(false, h3 == h4)\n\tend", "def ==(other)\n hash == other.hash\n end", "def ==(other)\n hash == other.hash\n end", "def ==(other)\n case other\n when self.class\n hash == other.hash\n else\n false\n end\n end", "def eql?(*) end", "def eql?(other)\r\n\t\treturn hash == other.hash\r\n\tend", "def hash(*) end", "def eql?(another)\n self.to_hash == another.to_hash\n end", "def ==(other)\n @hash == other.hash\n end", "def ==(other)\n @hash == other.to_h\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash_method\n super\n end", "def ==(another)\n self.to_hash == another.to_hash\n end", "def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end", "def hashable? = super && index.hashable?", "def hash() source.hash ^ target.hash; end", "def eql?(other)\n super\n end", "def eql?(other)\n super\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def ==(other)\n to_hash == other.to_hash\n end", "def ==(other)\n return false unless other.kind_of?(self.class) || other.kind_of?(Hash)\n\n other = other.to_hash if other.kind_of?(self.class)\n to_hash == other\n end", "def compare_by_identity\n if @hash.respond_to?(:compare_by_identity)\n @hash.compare_by_identity\n self\n else\n raise NotImplementedError, \"#{self.class.name}\\##{__method__} is not implemented\"\n end\n end", "def ==(other)\n # TODO: Below is needed?\n # object_equivalence = super\n # return true if object_equivalence\n \n raise TypeError, 'other must respond to #to_hash or #to_h' unless other.respond_to?(:to_hash) || other.respond_to?(:to_h)\n other = other.to_hash rescue other.to_h\n \n other == to_h\n end", "def hash_code; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n source.hash ^ target.hash\n end", "def eql?(ct); end", "def eql?(ct); end", "def == other\n return false if other == nil\n if other.is_a?(Universa::HashId)\n super\n else\n if other.size == 96\n bytes == other\n else\n to_s == other\n end\n end\n end", "def hash\n self.class.hash ^ operand.hash\n end", "def hash\n self.class.hash ^ left.hash ^ right.hash\n end", "def ==(another)\n another.respond_to?(:to_hash) && to_hash == another.to_hash\n end", "def hash() source.hash ^ (target.hash+1); end", "def hash() source.hash ^ (target.hash+1); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def eql?(other); end", "def ==(other)\n return false unless other.class == self.class\n\n to_h == other.to_h\n end", "def eql?(other)\n self.class == other.class && key == other.key\n end", "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n return name.hash ^ direction.hash ^ lhs.hash ^ rhs.hash\n end", "def eql?(other)\n self.class == other.class &&\n self.base_url == other.base_url &&\n fuzzy_hash_eql?(self.options, other.options)\n end", "def ==(other)\n if self.equal?(other)\n true\n elsif other.instance_of?(self.class)\n @hash == other.instance_variable_get(:@hash)\n elsif other.is_a?(Set) && self.size == other.size\n other.all? { |o| @hash.include?(o) }\n else\n false\n end\n end", "def == other\n return false unless other.is_a?(RemoteHash)\n secret == other.secret\n end", "def hash(key); end", "def rehash() end", "def ==(other); false; end", "def hash\n ([self.class] + self.class.comparison_attrs.map{|x| send(x)}).hash\n end", "def ==(other)\n other.kind_of?(model) && other.hash == hash\n end", "def hash()\n #This is a stub, used for indexing\n end", "def eq(_obj)\n raise NotImplementedError\n end", "def hash\n super ^ number.hash\n end", "def hash # Hack for Ruby 1.8.6\n @node.id.hash ^ self.class.hash\n end", "def ===(other); end", "def ==(other)\n a = to_h\n b = other.to_h\n a.delete(:_id)\n b.delete(:_id)\n a == b\n end", "def ==(other)\n @hashed == other.hash && @downcase_key == other.downcase_key\n end", "def eql?(that)\n self.class.equal? that.class and self.key.equal? that.key\n end", "def eql?(other); self == other; end", "def hash\n end", "def hash\n end", "def hash\n end", "def ==(other)\n super\n end", "def ==(other)\n super\n end", "def equal?(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end" ]
[ "0.76206", "0.748876", "0.7298575", "0.7271604", "0.72301817", "0.7225668", "0.71948093", "0.71900725", "0.71563125", "0.71161807", "0.7084123", "0.7081286", "0.7043062", "0.7043062", "0.7007731", "0.69957525", "0.69773", "0.69773", "0.69574386", "0.69182867", "0.69069564", "0.69002414", "0.68752056", "0.68677205", "0.6833537", "0.6784002", "0.6784002", "0.6784002", "0.6784002", "0.6784002", "0.6784002", "0.6784002", "0.6771523", "0.67702925", "0.67691076", "0.6764207", "0.67464983", "0.6712137", "0.6712137", "0.67102385", "0.6685238", "0.66817933", "0.66781884", "0.66507703", "0.66429365", "0.6598209", "0.6598209", "0.6598209", "0.6598209", "0.6598209", "0.6598209", "0.6598209", "0.6598209", "0.6598209", "0.6598209", "0.6590082", "0.6583228", "0.6583228", "0.6566708", "0.6551976", "0.65431625", "0.65131855", "0.65126765", "0.65126765", "0.64985806", "0.64985806", "0.64985806", "0.64985806", "0.64985806", "0.64985806", "0.64985806", "0.6481351", "0.6475576", "0.6440777", "0.6419825", "0.64058566", "0.6387615", "0.63870823", "0.6386616", "0.6378182", "0.63637024", "0.63589555", "0.63580185", "0.63380665", "0.6334473", "0.6285895", "0.6273708", "0.6266244", "0.62373376", "0.62211317", "0.6216437", "0.6213626", "0.6207778", "0.6207778", "0.6207778", "0.6202261", "0.6202261", "0.61958134", "0.61948806", "0.61948806", "0.61948806" ]
0.0
-1
while i < collection.length movies = collection[i] if !result[movies[:studio]] result[movies[:studio]] = movies[:worldwide_gross] else result[movies[:studio]] += movies[:worldwide_gross] end i +=1 end
def consolidate_cart(cart) # [{:item => "AVOCADO", :price => 3.00, :clearance => true }, # {:item => "AVOCADO", :price => 3.00, :clearance => true }, # {:item => "KALE", :price => 3.00, :clearance => false}] new_cart = [] i = 0 while i < cart.length do new_cart_item = find_item_by_name_in_collection(cart[i][:item], new_cart) if new_cart_item != nil new_cart_item[:count] += 1 else new_cart_item = { :item=> cart[i][:item], :price => cart[i][:price], :clearance => cart[i][:clearance], :count => 1 } new_cart << new_cart_item end i+=1 end new_cart end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gross_per_studio(collection)\n new_hash = {}\n counter = 0 \n while counter < collection.length do \n studio_name = collection[counter][:studio]\n ww_gross = collection[counter][:worldwide_gross]\n if !new_hash[studio_name]\n new_hash[studio_name] = ww_gross\n else \n new_hash[studio_name] += ww_gross\n end \n counter += 1 \nend\nreturn new_hash\nend", "def director_gross(director_data)\n movies_index = 0\n total = 0\n \n while movies_index < director_data[:movies].count do\n total += director_data[:movies][movies_index][:worldwide_gross] \n movies_index += 1\n end\n total\nend", "def gross_per_studio(collection)\n result = {}\n i = 0\n while i < collection.size do\n studio = collection[i][:studio]\n total_earnings = collection[i][:worldwide_gross]\n if !result[studio]\n result[studio] = total_earnings\n else\n result[studio] += total_earnings\n end\n i += 1\n end\n \n # GOAL: Given an AoH where each Hash is a movie, return a Hash that includes\n # the total worldwide_gross of all the movies from each studio.\n #\n # INPUT: (collection) AoH where each Hash represents a movie\n #\n # RETURN: Hash where the keys are the studios and the values are the sum of\n # all the worldwide_gross numbers for every movie in the input Hash\n \n result\nend", "def gross_for_director(d)\n total = 0\n index = 0\n while index < d[:movies].length do\n total += d[:movies][index][:worldwide_gross]\n index += 1\n end\n total\nend", "def gross_for_director(director_data)\n movie_index = 0 \n inner_result = 0 \n while movie_index < director_data[:movies].length do\n inner_result += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1 \n end\n inner_result\nend", "def gross_for_director(director_data)\ntotal = 0\nmovie_index = 0\n while movie_index<director_data[:movies].length do\n total+=director_data[:movies][movie_index][:worldwide_gross]\n movie_index+=1\n end\ntotal\nend", "def gross_for_director(director_data)\n counter = 0\n #gross = directors_database[:movies].count()\n # len = directors_database[director_data][:movies].length\n# while counter < len do \n# gross = directors_database[0][:movies][0][:worldwide_gross]\n# end\n\n# counter += 1\n # while\n new = 0\n limit = director_data[:movies].size\n while counter < limit do\n new += director_data[:movies][counter][:worldwide_gross]\n \n counter += 1\nend \n \n new\nend", "def gross_for_director(director_data)\ntotal = 0\nindex_movies = 0\nmovie = director_data[:movies]\nwhile index_movies < movie.length do\n puts movie[index_movies][:worldwide_gross]\n total = total + movie[index_movies][:worldwide_gross]\n index_movies += 1\n \nend\ntotal\nend", "def gross_for_director(director_data)\nmovieNum = 0\ntotalGross = 0\nwhile movieNum < director_data[:movies].length do\n totalGross += director_data[:movies][movieNum][:worldwide_gross]\n movieNum += 1\nend\ntotalGross\nend", "def gross_for_director(director_data)\n movie_index = 0 \n total_gross = 0\n while director_data[:movies][movie_index] do \n movie_hash = director_data[:movies][movie_index]\n total_gross += movie_hash[:worldwide_gross]\n movie_index += 1\n end \n total_gross\nend", "def gross_for_director(director_data)\n i = 0 \n total = 0\n while i < director_data[:movies].length do \n total += director_data[:movies][i][:worldwide_gross]\n i += 1 \n end \n total \nend", "def gross_for_director(director_data)\n #p director_data\n i = 0\n total = 0\n while i < director_data[:movies].length do\n total += director_data[:movies][i][:worldwide_gross] \n i += 1\n end\n total\nend", "def gross_for_director(director_data)\n total_gross = 0\n\n i = 0\n while i < director_data[:movies].length\n worldwide_gross = director_data[:movies][i][:worldwide_gross]\n total_gross += worldwide_gross\n i += 1\n end\n\n total_gross\nend", "def gross_for_director(director_data)\n \n total = 0\n i = 0 \n while i < director_data[:movies].length do\n total += director_data[:movies][i][:worldwide_gross]\n i += 1\n\n\nend\n\nreturn total\nend", "def gross_for_director(director_data)\n movie_count = 0\n total_gross = 0\n while movie_count < director_data[:movies].length do\n total_gross += director_data[:movies][movie_count][:worldwide_gross]\n movie_count += 1\n end\n total_gross\nend", "def gross_for_director(director_data)\ntotal=0\nm= director_data[:movies]\nrow = 0\nwhile row < m.length \n g= m[row][:worldwide_gross]\n row += 1\n total += g\nend\ntotal\n\nend", "def gross_for_director(director_data)\n sum = 0\n x = 0\n\n while x < director_data[:movies].length do\n sum += director_data[:movies][x][:worldwide_gross]\n x += 1\n end\n\n sum\nend", "def gross_for_director(director_data)\n gross_for_director=0\n i=0\n while i<director_data[:movies].size\n gross_for_director+=director_data[:movies][i][:worldwide_gross]\n i+=1\n end\n gross_for_director\nend", "def gross_for_director(director_data)\n total = 0\n index = 0\n\n while index < director_data[:movies].length do\n total += director_data[:movies][index][:worldwide_gross]\n index += 1\n end\n\n total\nend", "def gross_for_director(director_data)\ndirector_gross = 0\n movie_len = director_data[:movies].length\n movie_index = 0\n while movie_index < movie_len do\n director_gross += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\n director_gross\nend", "def gross_for_director(director_data)\n movie_index = 0\n worldwide_grosses = 0\n while movie_index < director_data[:movies].length\n worldwide_grosses += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\nworldwide_grosses\nend", "def gross_for_director(director_data)\nfilmsMade = director_data[:movies].length\n movies_index = 0 \n gross_index = 0\n\n while gross_index < filmsMade do\n director_gross = director_data[:movies][gross_index][:worldwide_gross]\n movies_index += director_gross \n gross_index += 1\n end \n\n movies_index\nend", "def gross_for_director(director_data)\n new_array = director_data[:movies]\n i = 0 \n total_gross = 0\n while i < new_array.length do\n anotha_array = new_array[i]\n gross = anotha_array[:worldwide_gross]\n total_gross += gross\n i+=1\n end\n total_gross\nend", "def gross_for_director(director_data)\n count = 0\n sum = 0\n while director_data[:movies][count] do\n sum += director_data[:movies][count][:worldwide_gross]\n count += 1\n end\n \n return sum\nend", "def gross_for_director(director_data)\n movies_index = 0\n director_gross = 0\n movies_array = director_data[:movies]\n while movies_index < movies_array.length do\n director_gross += movies_array[movies_index][:worldwide_gross]\n movies_index += 1\n end\n p director_gross\nend", "def gross_for_director(director_data)\ntotal=0 \ncolumn_index=0\nwhile column_index<director_data[:movies].length do \ntotal+=director_data[:movies][column_index][:worldwide_gross]\ncolumn_index+=1\nend\ntotal\nend", "def gross_for_director(director_data)\n #total gross for director\n director_total = 0\n #movie iterator\n movie_element = 0\n #iterate through movies\n while movie_element < director_data[:movies].length do\n #add movie gross to total for director\n director_total += director_data[:movies][movie_element][:worldwide_gross]\n #increase movie iterator\n movie_element += 1\n end\n return director_total\nend", "def gross_for_director(nds)\n\n sum=0\n idx2 = 0\n while idx2 < nds[:movies].length\n # p director_database[idx1][:movies][idx2][:worldwide_gross]\n sum += nds[:movies][idx2][:worldwide_gross]\n idx2 +=1\n end\n # puts sum\n # puts \"-\"\n sum\nend", "def gross_for_director(director_data)\n i = 0\n tot = 0\n while i < director_data[:movies].count do\n tot += director_data[:movies][i][:worldwide_gross]\n i += 1\n end\n return tot\nend", "def gross_for_director(director_data)\n director_gross = 0\n movie_count = 0\n while movie_count < director_data[:movies].length do\n director_gross += director_data[:movies][movie_count][:worldwide_gross]\n movie_count += 1\n end\n director_gross\nend", "def gross_for_director(director_data)\n earnings = 0\n which_mov = 0\n while which_mov < director_data[:movies].length do\n earnings += director_data[:movies][which_mov][:worldwide_gross]\n which_mov += 1\n end\n earnings \nend", "def gross_for_director(director_data)\n m_index = 0\n director_data = 0\n gross = 0\n while m_index < directors_database[director_data][:movies].length do\n gross += directors_database[director_data][:movies][m_index][:worldwide_gross]\n m_index += 1\nend\ngross\nend", "def gross_for_director(director_data)\n # index = 0\n coordinate_total = 0\n # while index < director_data.length do\n totalindex = 0\n while totalindex < director_data[:movies].length do\n coordinate_total += director_data[:movies][totalindex][:worldwide_gross]\n totalindex += 1\n # end\n # index += 1\n end\n coordinate_total\n\nend", "def movies_with_director_key(name, movies_collection)\n # GOAL: For each Hash in an Array (movies_collection), \n # provide a collection\n # of movies and a directors name to the movie_with_director_name method\n # and accumulate the returned Array of movies into a new Array that's\n # returned by this method.\n #\n # INPUT:\n # * name: A director's name\n # * movies_collection: An Array of Hashes where each Hash represents a movie\n #\n # RETURN:\n #\n # Array of Hashes where each Hash represents a movie; however, they should all have a\n # :director_name key. This addition can be done by using the provided\n # movie_with_director_name method\n \n # test_set = [{e :title => \"TestA\", :director_name => nam}, {:title => \"TestB\"}]\n puts \"********\"\n pp movies_collection\n new_arry = []\n movies_collection.each { |movie|\n new_arry << movie_with_director_name(name, movie)\n \n \n \n }\n # row = 0 \n # new_arry = []\n \n # while row < movies_collection.length do\n # # binding.pry\n # # get the value of director_name form movie_with_director_name(name, movies_collection[row])\n # # add it to movies_collection[row]\n \n # new_arry << movie_with_director_name(name, movies_collection[row])\n \n # row += 1 \n # end\n pp new_arry\n new_arry\nend", "def gross_for_director(director_data)\n \n result = {}\n movie_gross = 0\n movie_index = 0\n \n director_movies = director_data[:movies] # this is pointing to an array of hashes\n puts director_movies\n director_name = director_data[:name] # √\n \n while movie_index < director_movies.count do\n movie_gross += director_movies[movie_index][:worldwide_gross]\n movie_index +=1\n end\n \n movie_gross \nend", "def gross_for_director(director_data)\n\n result = 0\n movie_idx = 0\n while movie_idx < director_data[:movies].count\n result += director_data[:movies][movie_idx][:worldwide_gross]\n movie_idx += 1\n end\n result\nend", "def movies_with_director_key(name, movies_collection)\n mwd_aoh = []\n index = 0\n while index < movies_collection.length do\n mindex = 0\n while mindex < movies_collection[index][:movies].length do\n movie_name = movies_collection[index][:movies][mindex]\n mwd_aoh << movie_with_director_name(name, movie_name)\n mindex += 1\n end\n index += 1\n end\n mwd_aoh\nend", "def gross_for_director(director_data)\n director_total = 0 #intialization\n row_index = 0 # intialization\n\n while row_index < director_data[:movies].length do # \n \n director_total += director_data[:movies][row_index][:worldwide_gross] # adds each movies gross to a value director_total \n \n # puts \" World wide gross for the #{row_index + 1} movie is #{director_total}\" \n row_index += 1 \n end\n return director_total\nend", "def gross_for_director(director_data)\n gross = 0\n director_data[:movies].each do |n|\n gross +=n[:worldwide_gross]\n end\n return gross\nend", "def gross_for_director(director_data)\n row_index = 0\n director_total = 0\n\n while row_index < director_data[:movies].length do\n director_total += director_data[:movies][row_index][:worldwide_gross]\n \n row_index += 1\n end\n\n director_total\nend", "def gross_for_director(director_data)\n\ntotal = 0 \nindex = 0 \n while index < director_data[:movies].length \n director_gross = director_data[:movies][index][:worldwide_gross]\n total += director_gross\n index += 1 \n end \n\n#binding.pry \n\nreturn total\nend", "def gross_for_director(director_data)\n total_director_gross = 0\n director_data[:movies].each do |movie|\n total_director_gross += movie[:worldwide_gross]\n end\n total_director_gross\nend", "def movies_with_director_key(name, movies_collection) \naoh = []\ni = 0\n while i < movies_collection.length do\n aoh << movie_with_director_name(name, movies_collection[i])\n i += 1\n end\n aoh\nend", "def gross_for_director(director_data)\n array = director_data[:movies]\n i = 0 \n total = 0\n \n while i < array.length do\n obj = array[i]\n income = obj[:worldwide_gross]\n \n total += income\n i+=1\n end\n \n return total\nend", "def gross_for_director(director_data)\n #dir_name = director_data[:name]\n movie_list = director_data[:movies]\n dir_gross = 0\n movie_index = 0\n while movie_index < movie_list.length do\n dir_gross += movie_list[movie_index][:worldwide_gross]\n movie_index += 1\n end\n dir_gross\nend", "def movies_with_director_key(name, movies_collection)\n new_collection = []\n i = 0\n while i < movies_collection.length do\n movie_info = movies_collection[i]\n new_collection << movie_with_director_name(name, movie_info)\n i += 1 \n end\n return new_collection # {director => [array of movies]}\nend", "def movies_with_director_key(name, movies_collection)\n \n results_arr = [] # Delcare and initalize empty hash\n \n movies_collection.length.times do |movie| # Traverse through movie collection\n # Push the hash returned from the movie_with_director_name onto the empty array results_arr\n results_arr << movie_with_director_name(name,movies_collection[movie]) \n end\n\n results_arr\nend", "def directors_totals(nds)\n result = {} \n directors_index = 0 \n while directors_index < nds.length do \n directors = nds[directors_index][:name]\n result[directors] = 0 \n movie_index = 0\n totalmade = 0 \n while movie_index < nds[directors_index][:movies].length do\n directors_gross = nds[directors_index][:movies][movie_index][:worldwide_gross]\n result[directors] += directors_gross\n movie_index += 1 \n end \n directors_index += 1 \n end \n result\nend", "def gross_for_director(director_data)\n total=0\n rownum=0\n while rownum< director_data[:movies].length\n total+=director_data[:movies][rownum][:worldwide_gross]\n rownum+=1\nend\nreturn total\nend", "def movies_with_director_key(name, movies_collection)\n new_movies_arr = []\n i = 0 \n while i < movies_collection.length do \n new_movies_arr << movie_with_director_name(name, movies_collection[i])\n i += 1 \n end \n new_movies_arr\nend", "def gross_for_director(director_data)\n movie_index = 0\n director_total = 0\n while movie_index < director_data[:movies].length\n director_total += director_data[:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\n director_total\n\n end", "def gross_for_director(director_data)\n index = 0 \n total = 0 \n while index < director_data[:movies].length do\n total+=director_data[:movies][index][:worldwide_gross]\n index+=1\n end\n total\n end", "def gross_for_director(nds, element_index)\n total = 0\n new_index = 0\n \n #extract numbers\n while new_index < nds[element_index][:movies].length do\n total = total + nds[element_index][:movies][new_index][:worldwide_gross]\n new_index += 1\n end\n total\nend", "def movies_with_director_key(name, movies_collection)\n # GOAL: For each Hash in an Array (movies_collection), provide a collection\n # of movies and a directors name to the movie_with_director_name method\n # and accumulate the returned Array of movies into a new Array that's\n # returned by this method.\n #\n # INPUT:\n # * name: A director's name\n # * movies_collection: An Array of Hashes where each Hash represents a movie\n #\n # RETURN:\n #\n # Array of Hashes where each Hash represents a movie; however, they should all have a\n # :director_name key. This addition can be done by using the provided\n # movie_with_director_name method\n movies_collection.each do |e|\n e[:director_name] = name\n end\n movies_collection\nend", "def movies_with_director_key(director, movie_collection)\n result = []\n i = 0\n while i < movie_collection.size do\n movie = movie_collection[i]\n result[i] = movie_with_director_name(director, movie)\n i += 1\n end\n \n # GOAL: For each Hash in an Array (movies_collection), provide a collection\n # of movies and a directors name to the movie_with_director_name method\n # and accumulate the returned Array of movies into a new Array that's\n # returned by this method.\n #\n # INPUT: (name), a director's name, and (movies_collection), an AoH where\n # each Hash represents a movie\n #\n # RETURN: AoH where each Hash represents a movie; however, they should all have\n # a :director_name key. This addition can be done by using the provided\n # movie_with_director_name method\n \n result\nend", "def gross_for_director(director_data)\n grand_total = 0\n row_index = 0\n column_index = 0\n while column_index < directors_database[row_index][:movies].length do\n grand_total += directors_database[row_index][:movies][column_index][:worldwide_gross]\n column_index += 1\n end\n grand_total\nend", "def gross_for_director(director_data)\n\n \n col = 0\n value = 0\n \n while col < director_data[:movies].length do\n \n value = value + director_data[:movies][col][:worldwide_gross]\n # puts director_data[row][:movies][col][:worldwide_gross]\n # puts value\n col += 1\n end\n # puts value\n value \nend", "def movies_with_director_key(name, movies_collection) #iterate over movies collection. \n new_array = []\n row_index = 0 \n while row_index < movies_collection.length do \n new_array << movie_with_director_name(name, movies_collection[row_index]) \n row_index += 1 \nend\nreturn new_array\nend", "def gross_for_director(director_data)\n total = 0\n movies = director_data[:movies]\n movies.length.times do |movie_idx|\n total+=movies[movie_idx][:worldwide_gross]\n end\n return total\nend", "def movies_with_director_key(name, movies_collection)\n # GOAL: For each Hash in an Array (movies_collection), provide a collection\n # of movies and a directors name to the movie_with_director_name method\n # and accumulate the returned Array of movies into a new Array that's\n # returned by this method.\n #\n # INPUT:\n # * name: A director's name\n # * movies_collection: An Array of Hashes where each Hash represents a movie\n #\n # RETURN:\n #\n # Array of Hashes where each Hash represents a movie; however, they should all have a\n # :director_name key. This addition can be done by using the provided\n # movie_with_director_name method\n \n array = []\n \n \n # pp name\n # pp movies_collection\n \n i = 0\n while i < movies_collection.length\n array[i] = movie_with_director_name(name, movies_collection[i])\n i += 1\n end\n\n array\nend", "def directors_totals(nds)\nresult = []\n r_index=0 \n while r_index < nds.length \n i=0 \n total=0 \n\n n= nds[r_index][:name]\n t= nds[r_index][:movies]\n while i < t.length\n \n k= t[i][:worldwide_gross]\n total += k\n \n i += 1\n end\n r_index += 1\n result << [n , total]\n end\n result.to_h\n end", "def movies_with_director_key(name, movies_collection)\n \nnew_array = []\n\n counter = 0 \n while counter < movies_collection.length do \n array_info = movie_with_director_name(name, movies_collection[counter])\n new_array << array_info\ncounter += 1\nend\nreturn new_array\nend", "def harmonize_results(tmdb, rt)\n tmdb.each do |movie|\n match = rt.find { |rotten| movie['title'] == rotten['title'] }\n if match\n movie.merge!({\n rotten_score: match['ratings']['critics_score'],\n rotten_url: match['links']['alternate'],\n imdb_id: match['alternate_ids'].try(:[], 'imdb')\n })\n end\n end\n end", "def movies_with_director_key(name, movies_collection)\n directors_array = []\n movie_index = 0 \n \n while movie_index < movies_collection.length do\n directors_array.push(movie_with_director_name(name, movies_collection[movie_index]))\n \n movie_index +=1\nend\n\ndirectors_array\n\n\nend", "def consolidate_cart(cart)\n updated_cart = []\n i = 0\n while i < cart.length do\n updated_cart_item = find_item_by_name_in_collection(cart[i][:item], updated_cart)\n if updated_cart_item #if it does have a value\n updated_cart_item[:count] += 1\n else\n updated_cart_item = {\n :item => cart[i][:item],\n :price => cart[i][:price],\n :clearance => cart[i][:clearance],\n :count => 1\n }\n updated_cart << updated_cart_item\n end\n i += 1\n end\n updated_cart\nend", "def consolidate_cart(cart)\n new_cart = []\ncart.each do |grocery_item|\n current_item = find_item_by_name_in_collection(grocery_item[:item],new_cart)\n if current_item\n new_cart.each do |new_cart_item|\n if new_cart_item[:item] == current_item[:item]\n new_cart_item[:count]+=1 \n end\n end\n else\n grocery_item[:count] = 1 \n new_cart << grocery_item\nend\nend\nnew_cart\nend", "def movies_with_director_key(name, movies_collection)\n\n x = 0\n arr =[]\n\n while x < movies_collection.length do\n arr.push(movie_with_director_name(name, movies_collection[x]))\n x += 1\n end\n return arr\nend", "def movies_with_director_key(name, movies_collection)\n dir_movie_array = []\n movie_index = 0\n while movie_index < movies_collection.length do\n dir_movie_array << movie_with_director_name(name, movies_collection[movie_index])\n movie_index += 1\n end\n dir_movie_array\nend", "def gross_for_director(director_data)\n #pp director_data\n\n result = []\n movie_index = 0\n\n while movie_index < director_data[:movies].length do\n total_gross = director_data[:movies][movie_index][:worldwide_gross]\n result.push(total_gross)\n movie_index += 1\n end\n puts result\n return result.sum\n end", "def get_gross_for(title, movies)\n movie = movies.find{|movie| movie[:title] == title}\n movie = movie[:gross].gsub(/[$,]/, '').to_i\nend", "def consolidate_cart(cart)\n new_cart = []\n counter = 0 \n while counter < cart.length do \n new_cart_item = find_item_by_name_in_collection(cart[counter][:item], new_cart) #returns item if it finds it, and if it doesn't find it will return nil\n if new_cart_item != nil #if this variable has a truthy value,\n new_cart_item[:count] += 1 \n else #if that new cart item is nil, create our item. in hash construct item for the new cart\n new_cart_item = {\n :item => cart[counter][:item],\n :price => cart[counter][:price], \n :clearance => cart[counter][:clearance],\n :count => 1 #here we are going over item's name price and clearance value and adding a count key value pair and setting that equal to one.\n }\n new_cart << new_cart_item\nend \ncounter += 1 \nend\nnew_cart \nend", "def avg_movie_ratings r\n res = {}\n #return a array of outter keys {ryan, clay, christine, jon, david}\n k = r.keys\n k.each do |x|\n #return array of keys of outter key, Ex: ryan keys {avengers, little mermaind, inception }\n inner_arr = r[x].keys\n #loop through each inner keys\n inner_arr.each do |y|\n if res[y] != nil\n res[y] = (res[y] + r[x][y])\n else\n res[y] = r[x][y]\n end\n end\nend\nres\nend", "def directors_totals(nds)\n total = {}\n i = 0\n while i < nds.length do\n director = nds[i][:name]\n total[director] = gross_for_director(nds[i])\n i += 1 \n end\n return total \nend", "def print_first_directors_movie_titles\n spielberg = directors_database[0]\n movies_index = 0 \n movies = spielberg[:movies]\n while movies_index < movies.count do\n puts movies[movies_index][:title]\n movies_index += 1 \nend\nend", "def early_materialization(db)\n aggregate = 0\n db[\"gender\"][\"dic\"].each_with_index do |v, i|\n if v == \"M\" \n c_pos = i \n db[\"gender\"][\"av\"].each_with_index do |v, i|\n if v == c_pos \n av_pos = db[\"country\"][\"av\"][i]\n dic_value = db[\"country\"][\"dic\"][av_pos]\n if dic_value == \"GER\"\n aggregate = aggregate + 1\n end\n end\n end\n break\n end\n end\n aggregate \nend", "def games(meeting, record)\n meeting.each do |play|\n if play[:home_score].to_i > play[:away_score].to_i\n record[play[:home_team]][\"W\"] += 1\n record[play[:away_team]][\"L\"] += 1\n else play[:home_score].to_i < play[:away_score].to_i\n record[play[:away_team]][\"W\"] += 1\n record[play[:home_team]][\"L\"] += 1\n end\n end\n record\nend", "def directors_totals(nds)\n # Remember, it's always OK to pretty print what you get *in* to make sure\n # that you know what you're starting with!\n #\n #\n # The Hash result be full of things like \"Jean-Pierre Jeunet\" => \"222312123123\"\n\n #\n # Use loops, variables and the accessing method, [], to loop through the NDS\n # and total up all the\n # ...\n # ...\n # ...\n #\n #\n # Be sure to return the result at the end!\n\n result = {}\n\n director_index = 0\n movie_index = 0\n\n while director_index < nds.size do\n director = nds[director_index][:name]\n result[director] = 0\n while movie_index < nds[director_index][:movies].size do\n result[director] += nds[director_index][:movies][movie_index][:worldwide_gross]\n movie_index += 1\n end\n director_index += 1\n movie_index = 0\n end\n\n result\nend", "def cat_dog array\n array.each do |hash|\n if hash[:title].downcase.include?(\"cat\") or hash[:title].downcase.include?(\"dog\")\n hash[:score] = hash[:score].to_i * 2\n end\n end\nend", "def total_money(people) #function\n money = 0\n\n for person in people\n money += person[:monies]\n #person[:monies] = 0\n end\n\n return money\n \n\nend", "def add_item(grocery_list, item, quantity)\n grocery_list = grocery_list.each {|item,quantity|}\n if grocery_list.has_key?(item)\n grocery_list[item] += quantity\n else\n grocery_list[item] = quantity\n end\nend", "def directors_totals(source)\n result = {}\n director_index = 0\n while director_index < source.size do\n director = source[director_index]\n result[director[:name]] = gross_for_director(director)\n director_index += 1\n end\n result\nend", "def consolidate_cart(cart)\n cons_cart = []\n item_index = 0 \n while item_index < cart.length do \n item = cart[item_index][:item]\n price = cart[item_index][:price]\n clearance = cart[item_index][:clearance]\n current_item = find_item_by_name_in_collection(item, cons_cart)\n if !current_item\n cons_cart << {:item => item, :price => price, :clearance => clearance, :count => 1}\n else\n current_item[:count] += 1\n end\n item_index += 1\n end\n cons_cart\nend", "def movie_with_director_name(director, movie)\n result = { \n :title => movie[:title],\n :worldwide_gross => movie[:worldwide_gross], # DON'T CHANGE!\n :release_year => movie[:release_year],\n :studio => movie[:studio],\n :director_name => director\n }\n result\nend", "def movies_with_directors_set(source)\n result = []\n i = 0 \n while i < source.length do \n dir_name = source[i][:name]\n dir_movies = source[i][:movies]\n result << movies_with_director_key(dir_name, dir_movies)\n end \n result \nend", "def count_cart(cart)\n cart2 = {}\n #outer loop, then do each thing in the innner loop, than outer loop....\n cart.each do |item|\n # <{\"AVOCADO\" => {:price => 3.00, :clearance_items => true}}>\n item.each do |food, info|\n #<\"AVOCADO\" => {:price => 3.00, :clearance_items => true}>\n #if cart 2 does not have food then merge it with info and give it a count key value of 1\n if cart2[food].nil?\n cart2[food] = info\n cart2[food].merge!(:count => 1)\n #if cart2food exists, add one to the count key\n else\n cart2[food][:count] += 1\n end\n end\n end\n cart2\nend", "def get_gross_for(title,array)\n #loops the array and locates each hash in the array\n array.each {|movie|\n #if the title of the move matches the symbol title in the hash then\n if title == movie[:title]\n #gives the movie gross by deleting the $ sign and removing the , to join it and return the integer only\n puts \"#{movie[:gross].delete('$').split(',').join.to_i}\"\n end\n }\nend", "def consolidate_cart(cart)\nindex = 0\nnew_cart = []\n\nwhile index < cart.length do\n item = find_item_by_name_in_collection(cart[index][:item],new_cart)\n if item\n new_cart_index = 0\n while new_cart_index < new_cart.length do\n if new_cart[new_cart_index][:item]===item[:item]\n new_cart[new_cart_index][:count]+=1\n end\n new_cart_index+=1\n end\n else \n cart[index][:count] = 1\n new_cart << cart[index]\n end\n index+=1\nend\nnew_cart\nend", "def parse_character_movies(films_array) #films_hash\n count = 1\n films_array.each do |current_film|\n puts \"#{count}. #{current_film['title']}, released: #{current_film['release_date']}\"\n count += 1\n end\nend", "def movies_with_directors_set(nds)\n result = []\n i = 0\n while i < nds.size do\n director = nds[i][:name]\n movie_collection = nds[i][:movies]\n result[i] = movies_with_director_key(director, movie_collection)\n i += 1\n end\n \n # GOAL: For each director, find their :movies Array and put it in a new Array\n #\n # INPUT: (source) An AoH containing director info incl. :name and :movies\n #\n # RETURN: AoA containing all of a director's movies. Each movie will need\n # to have a :director_name key added to it.\n \n result\nend", "def its_a_tie game\n game.each do |team|\n team_standings = get_team_by_name(team)\n team_standings[:winnings] += 1\n end\nend", "def consolidate_cart(cart)\n new_cart = []\n counter = 0 \n while counter < cart.length do \n new_cart_item = find_item_by_name_in_collection(cart[counter][:item], new_cart)\n #We want to figureout if item is in our new cart \n #This method checks to see if the item we're looking for is in the new cart. Takes in items name and collection or cart. :item key points to name of the item. \n # This will either return the item or it will retrun nil. RETURNS THE ITEM OR RETURNS NIL\n #This above code produces nil or cart[counter], per the above method. If nil is prodcued then a new hash called new_cart_item is added to the new array with a new hash called :count.\n #If it already exist, the counter is incremented by one. \n #My question is, what is new_cart_item \n\nif new_cart_item \n #If this has a truthy value, do whats below. New_cart_item is the item!!! It will be truthy if it is in the array. If in the array, we will just incremement count by 1. And do this every time this item comes up. \n new_cart_item[:count] += 1 \n else new_cart_item = { \n #Else is all other options. Either truthy of falsey. If new_cart_item returns nil, then we will do below. Which is creating our item. Creating a new hash, which is the same hash with :count added. So you can say, if this is not already in our array, which will produce nil, we will add :count to the array and and put it into the new array. We will give it a count of 1. Once its been built the count will be incremented by one for each time the item is in the old cart.\n:item => cart[counter][:item], \n:price => cart[counter][:price],\n:clearance => cart[counter][:clearance],\n:count => cart[counter][:count] = 1 \n }\nnew_cart<< new_cart_item\nend \ncounter += 1 \nend\nnew_cart \n\nend", "def consolidate_cart(cart)\n consol_cart = []\n i = 0\n while i < cart.length\n new_item = find_item_by_name_in_collection(cart[i][:item], consol_cart)\n if new_item\n new_item[:count] += 1\n else\n new_item = {\n :item => cart[i][:item],\n :price => cart[i][:price],\n :clearance => cart[i][:clearance],\n :count => 1\n }\n consol_cart << new_item\n end\n i += 1\n end\n consol_cart\nend", "def consolidate_cart(cart)\n new_cart = []\n count = 0\n while count < cart.length\n new_cart_item = find_item_by_name_in_collection(cart[count][:item], new_cart)\n if new_cart_item != nil\n new_cart_item[:count] += 1\n else\n new_cart_item = {\n :item => cart[count][:item], \n :price => cart[count][:price],\n :clearance => cart[count][:clearance],\n :count => 1\n }\n new_cart << new_cart_item\n end\n count += 1\n end\n new_cart\nend", "def print_first_directors_movie_titles\n movie_index = 0 \n \n while movie_index < directors_database[0][:movies].count do \n puts directors_database[0][:movies][movie_index][:title]\n movie_index += 1\n end\nend", "def matches_played_by_season(table_of_teams)\n matches_played = Hash.new { |hash, key| hash[key] = Hash.new(0) }\n\n table_of_teams.each do |table_row|\n matches_played[table_row['season']][table_row['team1']] += 1\n matches_played[table_row['season']][table_row['team2']] += 1\n end\n matches_played\nend", "def consolidate_cart(cart)\n new_cart = {}\n cart.each do |hash| #hash is the whole array\n hash.each do |name, describe| #name: avocado, cheese. describe: price, clearance\n #if new_cart has name and count already, increase the count\n if new_cart[name]\n new_cart[name][:count] += 1\n #new_cart is empty so set name as key and describe as value\n else\n new_cart[name] = describe\n new_cart[name][:count] = 1 #set count = 1 cuz we set name and describe for 1 item\n end\n end\n end\n new_cart\nend", "def claimed_rewards_by_project\n claimed_rewards_by_project = Hash.new(0)\n self.rewards_selected.each do |reward, frequency|\n selected_reward = Reward.find_by(description: reward)\n claimed_rewards_by_project[selected_reward.project_id] += selected_reward.dollar_amount\n end\n return claimed_rewards_by_project\nend", "def consolidate_cart(cart)\n # code here\n new_hash = {}\n cart.each do |items|\n items.each do |name, attributes|\n if new_hash[name]\n new_hash[name][:count] += 1 #adds a count of one to each item when there are no duplicates\n else\n new_hash[name] = attributes\n new_hash[name][:count] = 1\n end\n end\n end\n new_hash\nend", "def consolidate_cart(cart)\n \n new_cart = []\n index = 0\n\n while index < cart.count do\n new_cart_item = find_item_by_name_in_collection(cart[index][:item], new_cart)\n if new_cart_item\n new_cart_item[:count] += 1\n else\n new_cart_item = {\n :item => cart[index][:item],\n :price => cart[index][:price],\n :clearance => cart[index][:clearance],\n :count => 1\n }\n new_cart << new_cart_item\n end\n\n index += 1\n end\n \n return new_cart\nend", "def movie_function\n movies = {}\n\n movie_list = \"Goodnight, Moon|2015|Chris Clearfield|www.awesome.com\n On the waterfront|1982|1982|DiNiro|www.google.com\n hackers|1996|Jolie|Example.com\"\n\n movie_list.each_line do |line|\n movie_info = line.split(\"|\")\n\n movie_info_hash = {}\n movie_info_hash[:title] = movie_info[0]\n movie_info_hash[:year] = {:released => movie_info[1], :started => 2010, :production_started => 2013}\n movie_info_hash[:director] = movie_info[2]\n movie_info_hash[:movie_url] = movie_info[3]\n\n # for arrays only\n # movies << movie_info_hash\n movies[movie_info_hash[:title].to_sym]=movie_info_hash\n end\n puts movies[:\"Goodnight, Moon\"][:year][:started]\n # this is a local variable\n # return to use it outside\n return movies\nend" ]
[ "0.73348093", "0.7177914", "0.711617", "0.7020996", "0.69970393", "0.6975766", "0.6974969", "0.6963125", "0.6941712", "0.69295835", "0.69197947", "0.6905626", "0.68811136", "0.687753", "0.68746066", "0.686954", "0.68607235", "0.68484443", "0.6826044", "0.6823911", "0.68063176", "0.67979175", "0.678917", "0.67805284", "0.67804253", "0.675789", "0.67526114", "0.6728538", "0.6726695", "0.67262197", "0.66884035", "0.66742545", "0.66622746", "0.6648153", "0.66481364", "0.6636061", "0.6626749", "0.6621426", "0.6614072", "0.6600709", "0.65993017", "0.6533626", "0.6503509", "0.64776194", "0.64715844", "0.6447651", "0.64455473", "0.64453804", "0.64372617", "0.6355542", "0.63555354", "0.6352573", "0.6344288", "0.6339727", "0.6333233", "0.63294715", "0.63102263", "0.6269526", "0.6254867", "0.62246907", "0.61940473", "0.60890865", "0.6044268", "0.6011486", "0.5990538", "0.59550667", "0.59276694", "0.59246016", "0.58861303", "0.5832287", "0.578387", "0.57656586", "0.5752474", "0.5724813", "0.5700097", "0.5681638", "0.5676926", "0.56686366", "0.56353605", "0.5620804", "0.5609741", "0.5608042", "0.5584692", "0.5555248", "0.55258685", "0.5523988", "0.5510765", "0.5504683", "0.5501428", "0.5498937", "0.5496841", "0.54961306", "0.5495058", "0.5468199", "0.5389526", "0.5380071", "0.5367988", "0.53642833", "0.5360586", "0.53571755" ]
0.58235735
70
Consult README for inputs and outputs REMEMBER: This returns a new Array that represents the cart. Don't merely change `cart` (i.e. mutate) it. It's easier to return a new thing.
def apply_coupons(cart, coupons) i = 0 while i<coupons.length cart_item = find_item_by_name_in_collection(coupons[i][:item], cart) couponed_item_name = "#{coupons[i][:item]} W/COUPON" cart_item_with_coupon = find_item_by_name_in_collection(couponed_item_name, cart) if cart_item && cart_item[:count] >= coupons[i][:num] if cart_item_with_coupon cart_item_with_coupon[:count] += coupons[i][:num ] cart_item -= coupons[i][:num] else cart_item_with_coupon = { :item=>couponed_item_name, :price=>coupons[i][:cost] / coupons[i][:num], :count => coupons[i][:num], :clearance=>cart_item[:clearance] } cart << cart_item_with_coupon cart_item[:count] -= coupons[i][:num] end end i += 1 end cart end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consolidate_cart(cart)\n # Consult README for inputs and outputs\n #\n # REMEMBER: This returns a new Array that represents the cart. Don't merely\n # change `cart` (i.e. mutate) it. It's easier to return a new thing.\n new_cart = []\n counter = 0\n\n while counter < cart.length\n new_item = find_item_by_name_in_collection(cart[counter][:item], new_cart)\n if new_item != nil\n new_item[:count] += 1\n else\n new_item = {\n :item => cart[counter][:item],\n :price => cart[counter][:price],\n :clearance => cart[counter][:clearance],\n :count => 1\n }\n new_cart << new_item #shoving the new hash into new array\n end\n counter += 1\n end\n\n new_cart\nend", "def cart\n shopping_cart = []\n\n # Each item in session[:cart] is an array of [gameID, qty]\n session[:cart].each do |game_array|\n game = Game.find(game_array[0])\n shopping_cart << [game, game_array[1]]\n end\n\n shopping_cart\n end", "def consolidate_cart(cart)\n \n nhash ={}\n new_array = []\n row_index =0\n \n while row_index < cart.length\n item_mutch = find_item_by_name_in_collection(cart[row_index][:item],nhash)\n \n if !item_mutch\n \n nhash[row_index] = {}\n nhash[row_index][:item] = cart[row_index][:item]\n nhash[row_index][:count] = 1\n nhash[row_index][:clearance] = false\n nhash[row_index][:price] = cart[row_index][:price]\n new_array << nhash[row_index]\n# binding.pry\nelse\n item_mutch[:count] += 1\n item_mutch[:clearance] =true\n # nhash[:price] += cart[row_index][:price]\nend\n\n\n row_index += 1\n # Consult README for inputs and outputs\n #\n # REMEMBER: This returns a new Array that represents the cart. Don't merely\n # change `cart` (i.e. mutate) it. It's easier to return a new thing.\n\nend\nreturn new_array\n end", "def get_cart\n if session[:cart]\n @cart = session[:cart]\n else\n @cart = []\n end\n end", "def cart\n\t\tsession[:cart] ||= []\n\tend", "def consolidate_cart(cart)\n \n new_cart = []\n index = 0\n\n while index < cart.count do\n new_cart_item = find_item_by_name_in_collection(cart[index][:item], new_cart)\n if new_cart_item\n new_cart_item[:count] += 1\n else\n new_cart_item = {\n :item => cart[index][:item],\n :price => cart[index][:price],\n :clearance => cart[index][:clearance],\n :count => 1\n }\n new_cart << new_cart_item\n end\n\n index += 1\n end\n \n return new_cart\nend", "def cart\n session[:cart] ||= []\n end", "def cart\n session[:cart] ||= []\n end", "def cart\n session[:cart] ||= []\n end", "def cart\n session[:cart] ||= []\n end", "def add_items_from_cart(cart)\n\t\tcart.line_items.each do |item|\n\t\t\titem.cart_id = nil\n\t\t\tline_items << item\n\t\tend\n\tend", "def cart\n #cart is the session cart or equal to an empty array\n session[:cart] ||= []\n end", "def consolidate_cart(cart)\n i = 0\n cons_cart = [] #will be a new array that represents the cart with the item counts\n while i < cart.length do\n in_cart = find_item_by_name_in_collection(cart[i][:item],cons_cart)\n if in_cart != nil\n in_cart[:count] += 1\n else\n in_cart = {\n :item => cart[i][:item],\n :price => cart[i][:price],\n :clearance => cart [i][:clearance],\n :count => 1\n }\n cons_cart << in_cart\n end\n i += 1\n end\n cons_cart\nend", "def consolidate_cart(cart)\n new_cart = []\n count = 0\n while count < cart.length\n new_cart_item = find_item_by_name_in_collection(cart[count][:item], new_cart)\n if new_cart_item != nil\n new_cart_item[:count] += 1\n else\n new_cart_item = {\n :item => cart[count][:item], \n :price => cart[count][:price],\n :clearance => cart[count][:clearance],\n :count => 1\n }\n new_cart << new_cart_item\n end\n count += 1\n end\n new_cart\nend", "def make_cart_compatible\n return if session[:cart].items.is_a? Hash\n session[:cart] = Cart.new\n end", "def current_cart\n session[:cart] ||= []\n end", "def current_cart=(current_cart)# <- This may work\n self.carts << current_cart\n end", "def cart_item_op(&block)\n session[:cart] = get_cart.collect(&block)\n end", "def cart\n session[:shopping_cart].transform_keys { |game_id| Game.find(game_id) }\n end", "def cartProd\n @items = []\n @arr1.each{ |a|\n @arr2.each{ |b|\n item = [] << a << b\n @items << item\n }\n }\n end", "def use_cart(cart)\n cart.cart_items.each do |cart_item|\n order_items.build(item_id: cart_item.item.id, price: cart_item.item.send(item_price_method_name), quantity: cart_item.quantity) if cart_item.quantity.to_i > 0\n end\n end", "def update_cart(new_cart)\n cookies[:cart] ={value: JSON.generate(new_cart), expires_in: 7.days}\n cookies[:cart]\n end", "def consolidate_cart(cart:[])\n add_item_counts(cart:cart)\n remove_duplicates(cart:cart)\n cart.inject({}) { |hash, cart_item| hash.merge(cart_item) }\nend", "def generateCart\n\t\t@cart = []\n\t rand(20).times do\n\t\t\t@cart.push(ITEMS.sample) \n\t\tend\n\t\t@cart\n\tend", "def products_in_cart (complete)\n cart = []\n @total = 0\n Cart.all.each do |item|\n product_total = item.quantity * item.price\n @total += product_total\n cart.append('Name': item.name,\n 'Description': item.description,\n 'Item ID': item.item_id,\n 'Price': item.price,\n 'Quantity': item.quantity,\n 'Subtotal': \"$#{product_total.round(2)}\")\n if complete\n product = Product.find_by(name: item.name)\n product.update_columns(quantity: product.quantity - item.quantity)\n end\n end\n cart.append('Total': \"$#{@total.round(2)}\")\n return cart\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_line_items_from_cart(cart)\n \tcart.line_items.each do |item|\n \t\titem.cart_id = nil\n \t\tline_items << item\n \tend \t\n end", "def process_cart_items()\n \torder = self.customer.orders.create\n \tself.cart_items.each do |item|\n \t\torder.order_items.create :product_id => item.product_id\n \tend\n \tself.cart_items = [] #clear the cart\n \treturn order\n end", "def cart_op\n session[:cart] = yield(get_cart)\n end", "def old_order_lines_from_cart(cart)\n order = self\n cart.cart_lines.each do |cl|\n ol = OldOrderLine.create(cl.attributes)\n ol.cart_id = nil\n order.old_order_lines << ol\n end\n return order\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def add_line_items_from_cart(cart)\n\t\tcart.line_items.each do |item|\n\t\t\titem.cart_id = nil\n\t\t\tline_items << item\n\t\tend\n\tend", "def reorganizeCart\n\t\t@new_cart = {}\n\t\t@cart.each do |itemhash|\n\t\t\titemhash.each do |item, details|\n\t\t\t\t@new_cart[item] = details\n\t\t\t\t# adds :count key value to the hash\n\t\t\t\tif @new_cart[item][:count].nil? \n\t\t\t\t\t@new_cart[item][:count] = 1\n\t\t\t\telse\n\t\t\t\t\t@new_cart[item][:count] += 1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t#gets rid of duplicate entries\n\t\trepeat = []\n\t\t@new_cart.each do |item, hash|\n\t\t\tif repeat.include?(item) \n\t\t\t\tdelete(item)\n\t\t \telse\n\t\t \t\trepeat << item\n\t\t \tend\n\t\tend\n\t\t@new_cart\n\tend", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n # remove the cart id\n item.cart_id = nil\n # add the order line items\n line_items << item\n end\n\n end", "def consolidate_cart(cart)\n \n #declare new array\n new_cart = []\n \n #start with a counter so it begins at the first item\n counter = 0 \n \n #then create while loop\n while counter < cart.length \n \n #take each item in the cart and see if it is already in the new cart\n #calling the find_item_by_name_in_collection to check if item is in the new cart. Second argument is the collection we want to search want to see if the item is in our new cart.\n #So this will return either the item found or if not found it will return nil\n \n new_cart_item = find_item_by_name_in_collection(cart[counter][:item], new_cart)\n #if item is already in cart, we just want to increase the count\n if new_cart_item != nil \n \n #if new_cart_item does not equal nil then we want to access new_cart_item and inside we want to access the count and increase by 1\n new_cart_item[:count] += 1\n \n #otherwise, item is nil. We would need to create our item. Inside the hash we need to construct the new item in the new cart\n else\n new_cart_item = {\n :item => cart[counter][:item], \n :price => cart[counter][:price],\n :clearance => cart[counter][:clearance],\n #this is the first time count is being used, the old item did not have count\n :count => 1\n }\n #after the new_cart is built, we are going to shovel new_cart_item variable\n new_cart << new_cart_item\n end\n #to ensure there is not an infinite loop \n counter += 1\n end\n new_cart\nend", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n\t item.cart_id = nil\n \t line_items << item\n end\n end", "def items_from_cart\n items = session[:cart]\n products = []\n items.each do |item|\n product = Product.find(item['product'])\n products << { name: product.name, price: product.price, image: product.product_images[0].image.url(:thumb), quantity: item['quantity'] }\n end\n return products\n end", "def generateCart\n\tcart = []\n\trand(20).times do\n\t\tcart.push(ITEMS.sample) \n\tend\n\tcart\nend", "def generateCart\n\tcart = []\n\trand(20).times do\n\t\tcart.push(ITEMS.sample) \n\tend\n\tcart\nend", "def cart\n cart = super\n if cart.nil?\n cart = Cart.new\n\n self.cart = cart\n self.save!\n else\n # TODO: Refactor out this duration to a class variable\n if cart.updated_at < DateTime.now - 12.hours\n cart.clear!\n end\n end\n\n cart\n end", "def consolidate_cart(cart)\nindex = 0\nnew_cart = []\n\nwhile index < cart.length do\n item = find_item_by_name_in_collection(cart[index][:item],new_cart)\n if item\n new_cart_index = 0\n while new_cart_index < new_cart.length do\n if new_cart[new_cart_index][:item]===item[:item]\n new_cart[new_cart_index][:count]+=1\n end\n new_cart_index+=1\n end\n else \n cart[index][:count] = 1\n new_cart << cart[index]\n end\n index+=1\nend\nnew_cart\nend", "def get_cart\n @cart = current_user.init_cart\n end", "def add_line_items_from_cart(cart)\n cart.line_items.each do |item|\n item.cart_id = nil\n order_item = OrderLineItem.new(quantity: item.quantity,\n price: item.price,\n discount: item.discount,\n product_id: item.product_id)\n order_line_items << order_item\n end\n end", "def consolidate_cart(cart)\n index = 0\n new_cart = []\n \n cart.each do |grocery_item|\n current_item = find_item_by_name_in_collection(grocery_item[:item], new_cart)\n if current_item\n new_cart_index = 0\n new_cart.each do |new_cart_item|\n if new_cart_item[:item] === current_item[:item]\n new_cart_item[:count] += 1\n end\n new_cart_index += 1\n end\n else\n grocery_item[:count] = 1\n new_cart << grocery_item\n end\n index += 1\n end\n new_cart\nend", "def add_cart(cart)\n @cart = cart\n end", "def cart_clear\n cc = CartClear.new\n cc.params.merge!( { 'CartId' => @cart_id, 'HMAC' => @hmac } )\n cart = search( cc, @rg ).cart_clear_response.cart\n @cart_items = []\n @saved_for_later_items = []\n end", "def add_line_items_from_cart(cart)\n #for each lineitem added to the cart we remove the cart id and add to the order (loop)\n cart.line_items.each do |item|\n item.cart_id = nil\n line_items << item\n end\n end", "def consolidate_cart(cart)\n# [{:item => \"AVOCADO\", :price => 3.00, :clearance => true },\n# {:item => \"AVOCADO\", :price => 3.00, :clearance => true },\n# {:item => \"KALE\", :price => 3.00, :clearance => false}]\n new_cart = []\n i = 0\n while i < cart.length do\n new_cart_item = find_item_by_name_in_collection(cart[i][:item], new_cart)\nif new_cart_item != nil\n new_cart_item[:count] += 1\nelse\n new_cart_item = {\n :item=> cart[i][:item],\n :price => cart[i][:price],\n :clearance => cart[i][:clearance],\n :count => 1\n }\n new_cart << new_cart_item\nend\n i+=1\n end\n new_cart\nend", "def cart\n current_cart\n end", "def build_subcarts\n # do not build subcarts for subcarts\n return [] if parent.present?\n\n grouped_items = cart_items.group_by(&:mill_id)\n\n # stop here if there's only one cart\n return [] if grouped_items.length < 2\n\n grouped_items.map do |mill_id, items|\n cart = self.dup\n cart.parent = self\n cart.state = :ordered\n cart.mill_id = mill_id\n cart.cart_items = items\n cart\n end\n end", "def add_items_from_cart(cart)\n cart.line_items.each do |item|\n self.line_items << item if item.sufficient_stock?\n end\n end", "def add_cart_item\n current_cart.cart_items.new\n end", "def load_cart_from_session\n #--- leave due to YAML bug\n CartLineItem\n Product\n #--- end leave due to YAML bug\n persisted_cart = YAML.load(session[cart_session_param].to_s)\n # rebuild cart as persisted cart line items cannot be saved\n persisted_cart.line_items.each_with_index do |line_item, index|\n persisted_cart.line_items[index] = line_item.clone\n end if persisted_cart\n self.current_cart = persisted_cart\n end", "def consolidate_cart(cart)\n consol_cart = []\n i = 0\n while i < cart.length\n new_item = find_item_by_name_in_collection(cart[i][:item], consol_cart)\n if new_item\n new_item[:count] += 1\n else\n new_item = {\n :item => cart[i][:item],\n :price => cart[i][:price],\n :clearance => cart[i][:clearance],\n :count => 1\n }\n consol_cart << new_item\n end\n i += 1\n end\n consol_cart\nend", "def add_line_items_from_cart(cart)\n cart.items.each do |item|\n li = LineItem.from_cart_item(item)# \"from_cart_item(item)\" is a method? to get the item from cart, store in li #\n line_items << li # appends the li stuff to line_items?\n end\n\n\n end", "def show_the_cart\n @cart_items = Nacho.find(cart)\n end", "def add_items_from_cart(cart)\n cart.order_items.all.each do |item|\n #self refers to the individual order\n self.order_items.new(product: item.product, quantity: item.quantity)\n end\n end", "def cart_with_price(price)\n Cart.new(cart_items: [\n CartItem.new(product: Product.new(price: price))\n ])\n end", "def add_line_items_from_cart(cart)\n\t\tcart.items.each do |item|\n\t\t\t#li = LineItem.from_cart_item(item)\n\t\t\t#li.quantity.times{line_items << li}\n\t\t\titem.quantity.times{line_items << LineItem.new( :price => item.price,\n \t\t\t\t\t\t\t\t\t\t\t\t\t :product_id => item.product_id)}\n\t\t\t#LineItem.new(:order_id => order_id, :product_id => li.product_id )\n\t\tend\n\t\tlogger.info line_items.inspect + \"These are the line items\"\n\t\t#line_items\n\tend", "def consolidate_cart(cart)\n updated_cart = []\n i = 0\n while i < cart.length do\n updated_cart_item = find_item_by_name_in_collection(cart[i][:item], updated_cart)\n if updated_cart_item #if it does have a value\n updated_cart_item[:count] += 1\n else\n updated_cart_item = {\n :item => cart[i][:item],\n :price => cart[i][:price],\n :clearance => cart[i][:clearance],\n :count => 1\n }\n updated_cart << updated_cart_item\n end\n i += 1\n end\n updated_cart\nend", "def cart\n # Calculate price\n # Warn: Need to update cart price every time items changed in cart for the safe side\n update_total_price_and_quantity_in_cart\n @cart = get_current_cart\n \n # prepare coupons\n @available_coupons = get_available_coupons(@cart) \n end", "def add_items_to_cart(cart)\n cart.cart_items.each do |item|\n @command.shopping_cart.create_item do |i|\n i.name = item.name\n i.description = \"\"\n i.unit_price = Money.new(item.product_price * 100, \"USD\")\n i.quantity = item.quantity\n end\n end\n end", "def get_items_info_in_cart\n return [] unless page.has_css?('.no-style.cart__list', wait: TimeOut::WAIT_BIG_CONST)\n\n items_arr = []\n str = page.evaluate_script(\"$('.no-style.cart__list').html();\")\n html_doc = Nokogiri::HTML(str)\n\n # get all information of product\n html_doc.css('.cart__item.ng-scope').each do |el|\n prod_id = el.css('div.media >a.pull-left> @href').to_s.split('/')[-1].gsub('A-', '')\n title = el.css('div.media>div>div.row>div>h3.title>a.ng-binding').text\n strike = el.css('div.media>div>div.row>div.span3>div.qty-price>span.single.price.strike.ng-binding').text\n sale = el.css('div.media>div>div.row>div.span3>div.qty-price>span.single.price.ng-binding.sale').text\n price = el.css('div.media>div>div.row>div.span3>div.qty-price>span.single.price').text if strike == ''\n\n # Put all info into array\n items_arr.push(prod_id: prod_id, title: title, price: price, strike: strike, sale: sale)\n end\n\n items_arr\n end", "def find_carts\n if current_cart != nil\n current_cart\n else\n Cart.create(user_id: self.id )\n end\n end", "def cart_line_items(products)\n products.map {|p| self.cart_line_item(p)}\n end", "def cart\n @cart ||= cookies[:cart].present? ? JSON.parse(cookies[:cart]) : {}\n end", "def set_cart\n @cart = Cart.find(@s[0])\n end", "def shopping_cart\n Cart.new session\n end", "def apply_clearance(cart)\n new_cart = cart\n cart.each do |name, hash|\n if hash[:clearance] #if clearance is true, take 20% off\n new_cart[name][:price] = (cart[name][:price] * 0.8).round(2)\n \n end\n \n end\n new_cart #if not, just return the same cart\nend", "def get_cart(options = {})\n\n options.assert_valid_keys(:merge, :force_anon_cart)\n options[:merge] = true if options[:merge].nil?\n\n # XXXFIX P3: WIERD BUG, version 2023, if we just use the finds, sending\n # in nil, sometimes we get a customer! (Is it a caching thing?)\n\n customer = session[:customer_id] ? Customer.find_by_customer_id(session[:customer_id]) : nil\n anonymous_cart = session[:anonymous_cart_id] ? Cart.find_by_cart_id(session[:anonymous_cart_id]) : nil\n\n return anonymous_cart if options[:force_anon_cart]\n\n if (customer)\n\n if (anonymous_cart)\n if (customer.cart)\n if (options[:merge])\n customer.cart.merge(anonymous_cart)\n anonymous_cart.destroy\n else\n customer.cart.merge(anonymous_cart, :saved_items_only => true)\n return set_discount(anonymous_cart)\n end\n else\n customer.carts << anonymous_cart\n end\n session[:anonymous_cart_id] = nil\n end\n\n if customer.carts.empty?\n customer.carts << Cart.create\n end\n\n return set_discount(customer.cart)\n\n else\n\n if (!anonymous_cart)\n anonymous_cart = Cart.create\n session[:anonymous_cart_id] = anonymous_cart.id\n end\n\n return set_discount(anonymous_cart)\n\n end\n end", "def get_cart_items\n\n @cart_id = params[:cart]\n @card_used = params[:card].present? ? params[:card][:type] : params[:card] #if user has chosen from existing cards.\n @card_used = params[:card_id] if @card_used.blank? #if user has chosen from existng cards.\n\n if @cart_id.present? && @card_used.present?\n\n @cart = Cart.where(id: @cart_id).first\n @items = @cart.cart_items.select('variant_id')\n @item_array = []\n\n @items.each do |item|\n @item_array.push({variant_id: item.variant_id })\n end #end of loop\n\n end #end of if condition\n\n end", "def cart\n # x ||= y this means x || x = y so if x is nil or false set x to be the value of y.\n #session[:cart] ||= [] # if session[:cart].nil? than set session[:cart] = []\n if session[:cart].nil? \n session[:cart] = []\n else \n session[:cart]\n end\n \n end", "def add_to_cart\n cart_op do |cart|\n if params[:id].class == Array\n params[:id].collect!(&:to_i)\n params[:id].delete_if {|id| cart.include?(id) }\n cart = cart + params[:id]\n else\n cart << params[:id].to_i if not params[:id].blank? and not get_cart.find {|i| i == params[:id].to_i }\n end\n cart\n end\n render_cart_size\n end", "def generateCart\n cart = []\n rand(20).times do\n cart.push(ITEMS.sample) \n end\n cart\nend", "def consolidate_cart(cart)\n new_cart = []\n counter = 0 \n while counter < cart.length do \n new_cart_item = find_item_by_name_in_collection(cart[counter][:item], new_cart) #returns item if it finds it, and if it doesn't find it will return nil\n if new_cart_item != nil #if this variable has a truthy value,\n new_cart_item[:count] += 1 \n else #if that new cart item is nil, create our item. in hash construct item for the new cart\n new_cart_item = {\n :item => cart[counter][:item],\n :price => cart[counter][:price], \n :clearance => cart[counter][:clearance],\n :count => 1 #here we are going over item's name price and clearance value and adding a count key value pair and setting that equal to one.\n }\n new_cart << new_cart_item\nend \ncounter += 1 \nend\nnew_cart \nend", "def get_customer_cart\n Customer.find(session[:customer_id]).cart\n end", "def update_cart\n # center of cart is taken as (x, y), actual is (_x, _y)\n pw = @cart[:image].width * @cart[:scale]\n ph = @cart[:image].height * @cart[:scale]\n @cart[:_x] = @cart[:x] - pw / 2.0\n @cart[:_y] = @cart[:y] - ph / 2.0\n\n # Wheels in their respective places\n @wheels.each do |wl|\n #ww = wl[:image].width * wl[:scale]\n #wh = wl[:image].height * wl[:scale]\n wl[:_x] = @cart[:x] + wl[:xoff] * pw / 2.0\n wl[:_y] = @cart[:y] + wl[:yoff] * ph / 2.0\n end\n\n # Pendulum\n polew = @pole[:image].width * @pole[:scale]\n poleh = @pole[:image].height * @pole[:scale]\n @pole[:_x] = @cart[:x]\n @pole[:_y] = @cart[:y]\n end", "def cart_get(cart_id, hmac)\n cg = CartGet.new\n cg.params.merge!( { 'CartId' => cart_id, 'HMAC' => hmac } )\n\n @rg = ResponseGroup.new( 'Cart' )\n cart = search( cg, @rg ).cart_get_response.cart\n\n @cart_id = cart.cart_id\n @hmac = cart.hmac\n @purchase_url = cart.purchase_url\n\n if ci = cart.cart_items\n @cart_items = ci.cart_item\n else\n @cart_items = []\n end\n\n if sfl = cart.saved_for_later_items\n @saved_for_later_items = sfl.saved_for_later_item\n else\n @saved_for_later_items = []\n end\n\n self\n end", "def cart\n Product.find(session[:user_cart])\n end", "def set_cart\n @cart = nil\n if session[:cart_id]\n @cart = Cart.find(session[:cart_id], :include => [:line_items])\n end\n if @customer and !@cart\n @cart = @customer.carts.find_by_sold_at(nil)\n end\n if !@cart\n @cart = Cart.create(:customer => @customer)\n end\n session[:cart_id] = @cart.id\n end", "def ordered_products_total_arr\n ordered_products_arr = cart.items.map { |item| item[:product_id] }\n ordered_products_arr.map { |id| [id] * Item.where(product_id: id)[0].quantity }.flatten\n end", "def session_cart!\n if cookies[:cart_id]\n @session_cart = Cart.find_by_id(cookies[:cart_id])\n unless @session_cart\n @session_cart = Cart.create(:user_id => current_user_id)\n cookies[:cart_id] = @session_cart.id\n end\n elsif current_user && current_user.current_cart\n @session_cart = current_user.current_cart\n cookies[:cart_id] = @session_cart.id\n else\n @session_cart = Cart.create\n cookies[:cart_id] = @session_cart.id\n end\n\n return @session_cart\n end", "def current_cart\n return @cart if @cart\n if params[:cart_token]\n @cart = Cart.find_by(token: params[:cart_token])\n elsif current_user && current_user.cart\n @cart = current_user.cart\n elsif current_user\n @cart = current_user.cart.create!\n else\n @cart = Cart.create!\n end\n end", "def current_cart\n self.carts.reorder('created_at DESC').first\n end", "def find_cart_items\n\t\tconditions = {:resource_id => get_resource.id.to_s, :parent_id => self.id.to_s}\n\t\tself.cart_items = Auth.configuration.cart_item_class.constantize.where(conditions).order(:created_at => 'asc')\n\t\t\n\t\tself.cart_items\n\tend", "def add_products(products)\n # remove nil element and save bidimensional array.\n (@cart_products << [products].compact).flatten!\n end", "def generateCart\n cart = []\n rand(20).times do\n cart.push(ITEMS.sample)\n end\n ap cart \nend", "def apply_clearance(cart)\n counter = 0\n while counter < cart.length\n if cart[counter][:clearance]\n cart[counter][:price] = (cart[counter][:price] * 0.8).round(2)\n end\n counter += 1\n end\n cart\nend", "def set_cart\n @cart = Cart.includes(:line_items).find(params[:id])\n end", "def session_cart\n Cart.find(session[:cart_id]) if session[:cart_id]\n end", "def consolidate_cart(cart)\n cons_cart = []\n item_index = 0 \n while item_index < cart.length do \n item = cart[item_index][:item]\n price = cart[item_index][:price]\n clearance = cart[item_index][:clearance]\n current_item = find_item_by_name_in_collection(item, cons_cart)\n if !current_item\n cons_cart << {:item => item, :price => price, :clearance => clearance, :count => 1}\n else\n current_item[:count] += 1\n end\n item_index += 1\n end\n cons_cart\nend", "def find_cart\n #session[:cart] ||= Cart.new\n cart = current_cart\n cart\n end", "def items\n @cart.each_pair.reduce([]) do |list, (product, qty)|\n list + Array.new(qty, product)\n end.join(', ')\n end", "def apply_clearance(cart)\n index = 0 \n while index < cart.length do\n if cart[index][:clearance] == true\n cart[index][:price] = (cart[index][:price] * 0.8).round(2)\n end\n index += 1\n end\n cart\nend", "def add_line_items_from(cart)\n\t\tcart.line_items.each do |item| \n\t\t\titem.cart_id = nil \n\t\t\tline_items << item \n\t\tend\n\tend", "def cart_hash\n end", "def add_shop_items_from_user_cart(shop_cart)\n shop_cart.shop_items.each do |si|\n si.shop_cart_id = nil\n shop_items << si\n end\n end", "def addtocart\n\t\tinsidecart<< createproduct\n\t\taddtocart\n\tend" ]
[ "0.71819156", "0.71223277", "0.6858337", "0.6845903", "0.67749083", "0.676538", "0.6528557", "0.6528557", "0.6528557", "0.6528557", "0.65179825", "0.64994276", "0.6447973", "0.644747", "0.6442914", "0.6411282", "0.6360142", "0.6357091", "0.634503", "0.62993217", "0.6292563", "0.62908196", "0.62771267", "0.62715566", "0.6237996", "0.6232227", "0.6232227", "0.6232227", "0.6232227", "0.6217783", "0.6211854", "0.61936104", "0.6192699", "0.6190435", "0.6185149", "0.6169969", "0.615562", "0.6154332", "0.613214", "0.61268806", "0.61017114", "0.61017114", "0.61010206", "0.6090231", "0.60803944", "0.607312", "0.6059236", "0.6057675", "0.60516626", "0.60267687", "0.60019535", "0.60003585", "0.5996803", "0.59959066", "0.5992789", "0.5983185", "0.59734374", "0.59496796", "0.59258837", "0.59190834", "0.5917665", "0.5916407", "0.59160006", "0.59151053", "0.5907094", "0.5906561", "0.5906543", "0.5900197", "0.5895682", "0.5891108", "0.58825684", "0.588178", "0.5870889", "0.58670914", "0.5866502", "0.5848594", "0.584088", "0.58295023", "0.5825963", "0.58076227", "0.58066666", "0.57972604", "0.5781258", "0.57810384", "0.577065", "0.5744573", "0.57402706", "0.57233936", "0.5720932", "0.5714355", "0.56974614", "0.56949186", "0.56945294", "0.5693423", "0.56789374", "0.56705403", "0.56690425", "0.5665797", "0.56655514", "0.566222", "0.56617594" ]
0.0
-1
Consult README for inputs and outputs REMEMBER: This method should update cart
def checkout(cart, coupons) i=0 total=0 total_cart = consolidate_cart(cart) apply_coupons(total_cart, coupons) apply_clearance(total_cart) while i < total_cart.length do total += total_cart[i][:price] * total_cart[i][:count] i += 1 end if total >= 100 total *= 9/10.to_f end total.round(2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cart\n # Calculate price\n # Warn: Need to update cart price every time items changed in cart for the safe side\n update_total_price_and_quantity_in_cart\n @cart = get_current_cart\n \n # prepare coupons\n @available_coupons = get_available_coupons(@cart) \n end", "def update_cart\n product = Product.find_by_cs_sku(params[:sku])\n item = ReservedItem.where('user_id = ? and product_id = ? and session_id = ?', current_user.id,\n product.id,\n session.id).first\n qty = BigDecimal.new(get_qty)\n\n if available?(product, item, qty)\n product.update_attribute(:qty, (product.qty + item.qty) - qty)\n item.update_attribute(:qty, qty)\n respond_with_format { @cart.update_item(params[:sku], get_qty) }\n else\n flash[:error] = 'Not enough item in inventory'\n respond_with_format\n end\n end", "def apply_coupons(cart, coupons)\n # Consult README for inputs and outputs\n #\n # REMEMBER: This method **should** update cart\nend", "def create_cart\n\tend", "def update\n @first_value = session[:passed_variable] \n @get_value = @first_value\n @p = Product.find_by(id:@get_value)\n\n\n\n puts @p.name \n puts cart_params[\"quantity\"]\n\n \n if cart_params[\"quantity\"].to_i > @p.quantity\n puts \"LAAAAAAAAAAAAAA\"\n flash.now[:danger] = \"You cannot order more than the product's quantity\"\n render :new\n\n else\n @cart = Cart.find_by(buyer_id:current_buyer.id)\n @editing_Quantity = session[:edited_Quantity]\n puts \"FOUND CART\"\n\n if @editing_Quantity != nil\n @entry = CartCarry.find_by(cart_id:@cart.id , product_id:@p.id)\n puts \"Cart Carry\"\n puts \"EDITING\"\n @entry.quantity = cart_params[\"quantity\"]\n @entry.save\n session[:edited_Quantity] = nil\n else\n puts \"ADDING\"\n @entry = CartCarry.create(cart_id:@cart.id,product_id:@p.id,quantity: cart_params[\"quantity\"].to_i)\n Rails.logger.info(@entry.errors.inspect) \n end\n respond_to do |format|\n format.html { redirect_to cart_path, notice: \"Product added to cart\" }\n end\n end\n\n\n\n # respond_to do |format|\n # if @cart.update(cart_params)\n # format.html { redirect_to @cart, notice: \"Cart was successfully updated.\" }\n # format.json { render :show, status: :ok, location: @cart }\n # else\n # format.html { render :edit, status: :unprocessable_entity }\n # format.json { render json: @cart.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def checkout_cart\n self.line_items.each do |li|\n li.item.inventory -= li.quantity\n li.item.save\n end\n self.line_items.clear\n self.status = \"submitted\"\n self.user.current_cart_id = nil\n self.user.save\n end", "def update_quantities\n if params[:quantities]\n params[:quantities].each do |id, num|\n li = @cart.update_quantity(id, num)\n\n if !li\n p = @cart.line_items.find(id) rescue nil\n if p\n (flash[:notice] ||= '') << \"Unable to change quantity of \" +\n \"#{p.name} to #{num}, there are not \"+\n \"enough available at this time.\"\n end\n else #updated quantity\n # update any coupon generated lines for this line\n if cl = li.coupon_line\n cl.coupon.update_quantity_of_coupon_line(cl)\n end \n end\n end\n\n # if any master lines for coupon lines were destroyed,\n # remove their coupon lines as well\n @cart.line_items.select{|x| x.custom_double_line_id}.each do |cl|\n unless @cart.line_items.find_by_id(cl.custom_double_line_id)\n cl.destroy\n end\n end\n\n # (and their coupons)\n @cart.coupons.each do |x|\n @cart.coupons.delete(x) unless x.applies_to?(@cart)\n end\n\n end\n\n # update comments as well\n if params[:cart] and params[:cart][:comments]\n @cart.comments = params[:cart][:comments]\n end\n\n # build the redirect Url Options based on submitted action and\n # what already exists in the session\n uo = {}\n if params[:commit] == 'Checkout'\n uo = build_url_options_for_checkout\n else # just update\n uo = {:controller => 'cart', :action => 'show'}\n end\n\n # save the cart, so we know when the last action was taken on it\n unless @cart.save\n flash[:warning] = \"Unable to save cart: <ul><li>\" +\n \"#{@cart.errors.full_messages.join('</li><li>')}\" + \n \"</li></ul>\"\n end\n\n redirect_to uo\n end", "def checkout_shopping_cart\n\tputs \"------------------------------------ ITEMS PURCHASED ------------------------------------\"\n\n\t# Displays all the items\n\t@shopping_cart.items.each_with_index do |item, index|\n\t\t# Displays the item\n\t\tputs \"(#{index+1}) Name: #{item.name} \\n\"\n\t\tputs \"Price: $#{item.price}\\n\"\n\t\tputs \"Shipping Cost: $#{item.shipping_cost}\\n \\n\"\n\tend\n\tputs \"-----------------------------------------------------------------------------------------\"\n\tputs \"TOTAL Price: $#{@shopping_cart.total_price}\"\n\tputs \"TOTAL Shipping Cost: $#{@shopping_cart.total_shipping_cost}\"\n\tputs \"-----------------------------------------------------------------------------------------\"\n\tputs \"GRAND TOTAL: $#{@shopping_cart.total_cost}\"\n\tputs \"-----------------------------------------------------------------------------------------\\n\"\nend", "def add_to_cart\n if current_user.cart\n update\n else\n create\n end\n end", "def cart(display_cc = false)\n c = Cart.new(self)\n\n tstotal = (tshirts || 0) + (tshirtm || 0) + (tshirtl || 0)+ (tshirtxl || 0) + \n (tshirtxxl || 0) + (tshirtxxxl || 0)\n\n # 2013\n # if staff? \n # tstotal = tstotal - 1\n # tstotal = 0 if tstotal < 0\n # elsif board? # Board gets flat rate, with dorm rooms, sunday arrival and one T-shirt included\n # c.set_quantity(\"Board Member Flat Rate\", 1)\n # tstotal = tstotal - 1\n # tstotal = 0 if tstotal < 0\n # else\n # c.set_quantity(\"Registration\", 1)\n # c.set_quantity(\"Tuition\", participant ? 1 : 0)\n # c.set_quantity(\"Dorm\", dorm ? 1 : 0)\n # c.set_quantity(\"Meals\", meals ? 1 : 0)\n # c.set_quantity(\"No Breakfast\", meals && meals_lunch_and_dinner_only ? 1 : 0)\n # end\n #c.set_quantity(\"Commemorative Wine Glass\", wine_glasses)\n #\n # 2015 pre change\n # elsif board?\n # tstotal = tstotal <= 1 ? 0 : tstotal - 1\n # c.set_quantity(\"Dorm\", (dorm_selection == 'd' || dorm_selection == 's') ? 1 : 0)\n # c.set_quantity(\"Single Room\", dorm_selection == 's' ? 1 : 0)\n # c.set_quantity(\"Meals\", (meals_selection == 'f' || meals_selection == 'l') ? 1 : 0)\n # c.set_quantity(\"No Breakfast\", meals_selection == 'l' ? 1 : 0)\n\n # FIXME: Nothing is preventing these from being mutually exclusive in the database.\n\n if staff?\n tstotal = tstotal <= 1 ? 0 : tstotal - 1\n elsif board? # Board gets flat rate, with dorm rooms, sunday arrival and one T-shirt included\n c.set_quantity(\"Board Member Flat Rate\", 1)\n tstotal = tstotal - 1\n tstotal = 0 if tstotal < 0\n elsif major_volunteer? #Major volunteer -- no registration or tuition, but pay for everything else\n c.set_quantity(\"Dorm\", (dorm_selection == 'd' || dorm_selection == 's') ? 1 : 0)\n c.set_quantity(\"Meals\", (meals_selection == 'f' || meals_selection == 'l') ? 1 : 0)\n c.set_quantity(\"No Breakfast\", meals_selection == 'l' ? 1 : 0)\n c.set_quantity(\"Sunday Arrival\", (sunday && dorm) ? 1 : 0)\n elsif faculty?\n tstotal = tstotal - 1\n tstotal = 0 if tstotal < 0\n else\n c.set_quantity(\"Registration\", 1)\n c.set_quantity(\"Tuition\", participant ? 1 : 0)\n c.set_quantity(\"Dorm\", (dorm_selection == 'd' || dorm_selection == 's') ? 1 : 0)\n c.set_quantity(\"Meals\", (meals_selection == 'f' || meals_selection == 'l') ? 1 : 0)\n c.set_quantity(\"No Breakfast\", meals_selection == 'l' ? 1 : 0)\n c.set_quantity(\"Sunday Arrival\", (sunday && dorm) ? 1 : 0)\n end\n\n # Add-ons for everybody\n c.set_quantity(\"Tshirts\", tstotal)\n c.set_quantity(\"Single Room\", (dorm_selection == 's') ? 1 : 0)\n c.set_quantity(\"Commemorative Wine Glass\", wine_glasses)\n donation ? c.install_charge(\"Donation\", donation) : c.set_quantity(\"Donation\", 0)\n\n c\n end", "def update_quantity_to_cart\n \t\n\n \tproduct_id_ = params[:product_id].to_i\n\n \tsession[\"cart\"].each do |h|\n \t\tif h['id'] == product_id_\n \t\t\th['quantity'] = params[:quantity_update].to_i\n \t\t\th['total'] = h['price'] * h['quantity']\n \t\t\t\n \t\tend\n \tend\n\n \tredirect_to :back\n end", "def checkout\n @current_cart.adjust_inventory\n @current_cart.mark_submited\n current_user.remove_current_cart\n redirect_to cart_path(@current_cart)\n end", "def view_cart\n cart_total = 0.00\n puts \"--------CART------------\"\n @cart.each_with_index do |product, index|\n print \"#{index + 1}. #{product[:product]} - \"\n puts \"$#{product[:price]}\"\n cart_total += product[:price]\n end\n puts \"------------------------\"\n puts \"Cart Subtotal: $#{cart_total.round(2)}\"\n tax = cart_total * 0.068\n puts \"Tax: $#{tax.round(2)}\"\n puts \"Cart Total: $#{(cart_total + tax).round(2)}\"\n puts \"___________________________________________________________________________________\"\n puts \"To remove a product, enter the item number. Or, enter M to return to the Main Menu.\"\n user_input = gets.strip\n if user_input == \"M\"\n menu\n else\n user_input = user_input.to_i\n remove_product(user_input - 1)\n end\nend", "def add_to_cart(product, amount)\n purchase = \" • #{amount} #{product}\\n\"\n @cart << purchase\n\n cost_per_item = @inventory[product][\"price\"]\n @total_cart_value += (cost_per_item * amount)\n\n @inventory[product][\"quantity\"] -= amount\nend", "def add_in_cart \n product_id=params[:id].to_i\n @product=Product.find(product_id)\n total_request=1\n update_through_cart=0 \n if params.has_key?(:quant) \n total_request=params[:quant][:total_request].to_i\n update_through_cart=1 \n end \n if(check_availabilty(product_id,total_request,update_through_cart))\n update_session(product_id,total_request,update_through_cart)\n else\n flash[:notice] = \"#{Product.find(product_id).name} is not available in this quantity\" \n end\n end", "def add_cart_item\n current_cart.cart_items.new\n end", "def create\n # Find associated product and current cart\n chosen_cabinet = CabConfig.find(params[:cab_config_id])\n current_cart = @current_cart\n \n # If cart already has this product then find the relevant line_item and iterate quantity otherwise create a new line_item for this product\n if current_cart.cab_configs.include?(chosen_cabinet)\n # Find the line_item with the chosen_product\n @cart_item = current_cart.cart_items.find_by(cab_config_id: chosen_cabinet)\n # Iterate the line_item's quantity by one\n @cart_item.quantity += 1\n else\n @cart_item = CartItem.new\n \n @cart_item.cart = current_cart\n @cart_item.cab_config = chosen_cabinet\n end\n \n\n # Save and redirect to cart show path\n @cart_item.save\n redirect_to cart_path(current_cart)\n end", "def add_to_cart\n \tif session[\"cart\"].nil?\n \t\tsession[\"cart\"] = []\n \tend\n \t#So luong cua san pham add vao gio hang\n \tquantity_ = 1\n \tsession[\"item\"] = {:id => params[:id].to_i, :name => params[:name], :quantity => quantity_.to_i, :price => params[:price].to_i, :total => quantity_.to_i * params[:price].to_i}\n \tcheck_cart session[\"item\"]\n \tredirect_to :back\n end", "def cart\n current_cart\n end", "def update_item(name,quantity, cart)\n \n if cart.has_key?(name)\n cart[name] = quantity\n puts 'Quantity of item successfully updated!'\n else\n puts 'Item doesn\\'t exist!'\n end\n \n p cart\n \nend", "def cart_op\n session[:cart] = yield(get_cart)\n end", "def update_cart\n # center of cart is taken as (x, y), actual is (_x, _y)\n pw = @cart[:image].width * @cart[:scale]\n ph = @cart[:image].height * @cart[:scale]\n @cart[:_x] = @cart[:x] - pw / 2.0\n @cart[:_y] = @cart[:y] - ph / 2.0\n\n # Wheels in their respective places\n @wheels.each do |wl|\n #ww = wl[:image].width * wl[:scale]\n #wh = wl[:image].height * wl[:scale]\n wl[:_x] = @cart[:x] + wl[:xoff] * pw / 2.0\n wl[:_y] = @cart[:y] + wl[:yoff] * ph / 2.0\n end\n\n # Pendulum\n polew = @pole[:image].width * @pole[:scale]\n poleh = @pole[:image].height * @pole[:scale]\n @pole[:_x] = @cart[:x]\n @pole[:_y] = @cart[:y]\n end", "def current_cart=(current_cart)# <- This may work\n self.carts << current_cart\n end", "def update\n # byebug\n current_cart_copy=Cart.where(user_id:current_user.id).first\n newps=params.require(:cart_item).permit(:cart_id, :product_id, :item_quantity)\n current_cart=Cart.find(newps[:cart_id].to_i)\n if current_cart_copy.id==newps[:cart_id].to_i && current_cart.user_id==current_user.id\n product=params[:product];\n unit_product_cost=Product.find(newps[:product_id]).product_cost\n new_total_price=newps[:item_quantity].to_i*unit_product_cost\n newps[:total_price_item]=new_total_price\n respond_to do |format|\n if @cart_item.update(newps)\n format.html { redirect_to carts_url, notice: 'Cart item was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart_item }\n else\n format.html { render :edit }\n format.json { render json: @cart_item.errors, status: :unprocessable_entity }\n end\n end\n Cart.new_subtotal_price current_cart\n else\n # byebug\n # byebug\n render_404\n end\n end", "def update(stuff, quantity, options={})\n if stuff.is_a?(MerchantSidekick::ShoppingCart::LineItem)\n self.update_cart_line_item(stuff, quantity, options)\n else\n self.update_product(stuff, quantity, options)\n end\n end", "def call(_obj, args, _ctx)\n product = Product.find_by(id: args[:product_id])\n cart = ShoppingCart.find_by(user_id: args[:user_id])\n if product.nil?\n raise GraphQL::ExecutionError, \"Product with the product id #{args[:product_id]} does not exist.\"\n end\n existing = cart.cart_items.find_by(product_id: product.id)\n if existing.nil?\n cart.cart_items.create(product_id: product.id, quantity: args[:quantity])\n cart.completed = false\n puts cart.cart_items\n else\n existing.quantity += args[:quantity]\n cart.completed = false\n cart.save\n existing.save\n end\n cart.total_cost += product.price * args[:quantity] + product.shipping\n cart.save\n cart\n end", "def update\n cart_item = current_user.cart.cart_items.where(\"item_id = ?\", cart_items_params[:item_id]).first\n cart_item.quantity += cart_items_params[:quantity].to_i\n if cart_item.quantity < 1\n if cart_item.delete\n @cart = CartItem.where(cart_id: current_user.cart_id).order(created_at: :desc)\n render 'carts/show'\n else\n render json: ['no such product in the cart'], status: 404\n end\n else\n if cart_item.save\n @cart = CartItem.where(cart_id: current_user.cart_id).order(created_at: :desc)\n render 'carts/show'\n else\n render cart_item.errors.full_messages, status: 422\n end\n end\n end", "def update_quantity token, cart_id, product_code, qty = 1\n\tend", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: I18n.t('carts.name') + I18n.t('messages.success') + I18n.t('messages.actions.update')}\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @cart.update(order_params)\n flash[:success] = \"Your order has been placed successfully\"\n # order model method 'update_orderitem_status' changes the orderitems status from \"pending\" to \"paid\"\n @cart.update_orderitem_status\n # order model method 'update_product_stock' updates the inventory of the product ro reflect sale\n @cart.update_product_stock\n # updates the card_number stored in the databas -- only store last 4 digits\n @cart.update(card_number: @cart.card_number.split('').last(4).join)\n redirect_to confirm_path\n return\n else\n flash.now[:failure] = \"A problem occurred: Could not place order\"\n render :edit\n end\n end", "def shopping_cart\n Cart.new session\n end", "def cart_hash\n end", "def make_cart_compatible\n return if session[:cart].items.is_a? Hash\n session[:cart] = Cart.new\n end", "def add_items_to_cart(cart)\n cart.cart_items.each do |item|\n @command.shopping_cart.create_item do |i|\n i.name = item.name\n i.description = \"\"\n i.unit_price = Money.new(item.product_price * 100, \"USD\")\n i.quantity = item.quantity\n end\n end\n end", "def add_cart(cart)\n @cart = cart\n end", "def set_cart_item\r\n \t \t@cart_item = CartItem.find(params[:id])\r\n \t\tend", "def create\n # grabbing cart from application controller current_cart method\n @cart = current_cart\n # session[:cart_id] = @cart.id\n # individual product items get added to cart item and added to cart and saved\n @cart_item = @cart.cart_items.build(cart_item_params)\n @cart.save\n end", "def prepare_cart\n\n\t\tfind_cart_items\n\t\t\n\t\tset_cart_price\n\t\t\n\t\tset_cart_payments\n\t\t\n\t\tset_cart_paid_amount\n\t\t\n\t\tset_cart_pending_balance\n\n\t\tset_cart_minimum_payable_amount\n\n\t\tset_discount\n\n\tend", "def set_cart\n @cart = Cart.find(@s[0])\n end", "def addtocart\n\t\tinsidecart<< createproduct\n\t\taddtocart\n\tend", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def purchase\n @cart_items = CartItem.where(cart: Cart.last)\n \n @cart_items.each do |cart_item|\n @product = cart_item.product\n if (@product.inventory_count > 0)\n cart_item.product.update(title: @product.title, \n description: @product.description,\n price: @product.price,\n inventory_count: @product.inventory_count - cart_item.quantity)\n cart_item.destroy\n else\n flash[:notice] = \"Item in cart had no inventory left\"\n next\n end\n end\n if @cart = Cart.last\n @cart.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Cart was successfully purchased.'}\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to products_url, notice: \"A cart must exist for products to be added to\" }\n format.json { head :no_content }\n end\n end\n Cart.create()\n end", "def update\n # if @cart_item.update(cart_item_params)\n # render :show, status: :ok, location: @cart_item\n # else\n # render json: @cart_item.errors, status: :unprocessable_entity\n # end\n\n if params[:cart_item][:quantity].to_i.zero?\n destroy\n elsif @cart_item.update(cart_item_params)\n @cart = @cart_item.cart\n build do\n message 'Изменение количества'\n view 'carts/show'\n end\n # render :show, status: :ok, location: @item\n else\n render json: @cart_item.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: \"Cart was successfully updated.\" }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @shopping_carts_product.nil?\n # Shopping card product doesn't exist, add to the cart\n product_params = {\n shopping_cart_id: params[:shopping_cart_id],\n product_id: params[:id],\n quantity: 1\n }\n @shopping_carts_product = ShoppingCarts::Product.new(product_params)\n\n if @shopping_carts_product.save\n render_success\n else\n render_error\n end\n else\n # Shopping card product exists, increase quantity by one\n new_quantity = @shopping_carts_product.quantity + 1\n if @shopping_carts_product.update(quantity: new_quantity)\n render_success\n else\n render_error\n end\n end\n\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def prepare_cart_items(variant_id)\n self.update_attributes(variant_id: variant_id, quantity: 1)\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, success: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n\n #Use of logger class to log messages into the log file\n Logger.instance.log(Time.now.to_s + \": Cart updated by user \\n\")\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def customer_update_cart(customer_reference, cart)\n MerchantPluginProvider.api_not_implemented(self)\n end", "def use_cart(cart)\n cart.cart_items.each do |cart_item|\n order_items.build(item_id: cart_item.item.id, price: cart_item.item.send(item_price_method_name), quantity: cart_item.quantity) if cart_item.quantity.to_i > 0\n end\n end", "def set_cart\n @cart = Cart.find(params[:id]).decorate\n end", "def add_to_cart\n @cart = current_user.carts.find_or_create_by(completed: false)\n @line_item = @cart.line_items.find_or_create_by(product_id: params[:product_id])\n @line_item.update quantity: @line_item.quantity + 1\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to show_cart_path, notice: 'Cart was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { redirect_to show_cart_path, alert: @cart.errors.full_messages.to_sentence }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # if user is not logged_in\n if cart_product_params[:user_id].empty?\n session[:temp_cart] = cart_product_params\n redirect_to login_path, :notice => \"Please log in, the product will be placed in your cart once you've logged in.\"\n else\n @cart_product = CartProduct.new(cart_product_params)\n respond_to do |format|\n if cart_product_params[:quantity].to_i > 0\n if @cart_product.save\n format.html { redirect_to request.referrer, notice: \"Added to Cart. Please go to your cart to pay for your items!\" }\n format.json { render :show, status: :created, location: @cart_product }\n \n # Then remove from savedlist\n session[:savedlist] ||= []\n session[:savedlist].delete(cart_product_params[:product_id])\n \n # update admin stats\n saved_products_stats(cart_product_params[:product_id], -1)\n \n # Then update popularity of product\n increase_product_popularity_by_product_id(cart_product_params[:product_id])\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @cart_product.errors, status: :unprocessable_entity }\n end\n else\n format.html { redirect_to request.referrer, notice: \"Quantity cannot be 0 or less!.\" }\n end\n end\n end\n end", "def transfer cart\n \t\tself.order_items.destroy_all\n \t\tcart.cart_items.each do |item|\n \t\t\t@order_item = order_items.build(price: item.price, quantity: item.quantity, sku_id: item.sku_id, weight: item.weight, order_id: id)\n \t\t\t@order_item.build_order_item_accessory(accessory_id: item.cart_item_accessory.accessory_id, price: item.cart_item_accessory.price, quantity: item.cart_item_accessory.quantity) unless item.cart_item_accessory.nil?\n \t\t\t@order_item.save!\n \t\tend\n \tend", "def fetch_cart_and_check_inventory\n @cart = Cart.find_or_create_by user_id: @current_user.id\n\n # Check user's line items against current inventory levels\n updated_line_items = []\n\n @cart.line_items.each do |item|\n if item.quantity > item.product_size.quantity\n update_qty = item.get_update_qty item.quantity\n item.update quantity: update_qty\n updated_line_items << item\n end\n end\n\n # If items in the user's cart had to be adjusted,\n # redirect to carts#user_cart and set flash error\n if updated_line_items.length > 0\n flash[:item_error] = \"Sorry, stock is running low. Your shopping basket has been adjusted accordingly.\"\n redirect_to cart_path\n return\n end\n end", "def set_cart\n @cart = Cart.includes(:line_items).find(params[:id])\n end", "def cart_session_param\n :cart\n end", "def update \n\t\t@cart_item = CartItem.find(params[:id])\n\n\t\tif @cart_item.update( cart_item_params )\n\t\t head :no_content\n\t\telse\n\t\t render json: @cart_item.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update_cart(new_cart)\n cookies[:cart] ={value: JSON.generate(new_cart), expires_in: 7.days}\n cookies[:cart]\n end", "def update\n if current_user\n @cart = OrderProduct.find(params[:id])\n product = Product.find(@cart.product_id)\n quantity = params[:quantity].to_i\n total = product.price * quantity\n\n respond_to do |format|\n if @cart.update(quantity: quantity, total: total)\n format.html { redirect_to carts_path}\n # format.json { render :show, status: :ok, location: @order_product }\n format.js {}\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n format.js {}\n end\n end\n else\n x = JSON.parse(cookies[:add_to_cart])\n x.each do |item|\n if item[\"product_id\"] == params[:id]\n item[\"quantity\"] = params[:quantity]\n end\n end\n cookies[:add_to_cart] = JSON.generate(x)\n respond_to do |format|\n format.html { redirect_to carts_path }\n format.js {}\n end\n end\n end", "def index\n # if not signed in\n if current_user == nil\n redirect_to user_session_path\n else\n unless params[:id].nil?\n # get product info\n @purchased = ProductListing.find(params[:id])\n # get restaurant info\n @restaurant = Seller.where(id: @purchased.seller_id).first\n # grab a random number\n ref = 15.times.map{rand(10)}.join\n # qrcode check it\n # testing qr code\n # @qr = RQRCode::QRCode.new(\"#{@restaurant.website_url}?ref:#{ref}\").to_img.resize(200, 200).to_data_url\n # real qr code with reference number\n @qr = RQRCode::QRCode.new(\"https://kendodeal.herokuapp.com/scans/outcome?ref=#{ref}\").to_img.resize(200, 200).to_data_url\n # check if product exits in model where currentuser\n # Seller cannot add the same product name twice anyways\n @checkIfExists = Cart.where(product_name: @purchased.product_name, user_id: current_user.id ).first\n if @checkIfExists == nil\n # insert into cart\n @addToCart = Cart.create(company_name: @restaurant.company_name, product_name: @purchased.product_name, description: @purchased.description, was_price: @purchased.was_price, price: @purchased.price, reference_number: ref, expiry_date: @purchased.expiry_date, qrcode: @qr.to_str, user_id: current_user.id)\n end\n end\n # insert into cartcart_params\n\n # @addToCart = Cart.create(company_name: @restaurant.company_name, product_name: @purchased.product_name, description: @purchased.description, was_price: @purchased.was_price, price: @purchased.price, reference_number: ref, expiry_date: @purchased.expiry_date, qrcode: @qr.to_str, user_id: current_user.id)\n # @addToCart = Cart.create(addToCart_params)\n\n # @addToCart.picture.attach(@purchased.picture)\n\n \n @carts = Cart.where(user_id: current_user.id)\n # cart quantity check\n @quantity = Cart.where(user_id: current_user.id).count\n # seller check needed - no adding to cart for seller\n @sellerCheck = Seller.where(user_id: current_user.id).first\n # get sum for stripe\n userCart = Cart.where(user_id: current_user.id)\n # grand total\n @sumForStripe = 0\n # cart savings calculations for display only\n @savings = 0\n userCart.each do |price|\n @sumForStripe += price[:price].to_i\n @savings += price[:was_price].to_i\n end\n end\n end", "def transfer_order_items_from_previous_session\n if session[:cart_id].present? && Cart.find_by(id: session[:cart_id]).order_items.present?\n \n @cart = Cart.first_or_create(user_id: current_user.id)\n \n #we iterate through order_items of the cart which was in previous session, \n #and we add order items to our current_user cart (if order_item is present \n #in current_user cart then we update quantity of that order_item)\n #debugger\n Cart.find_by(id: session[:cart_id]).order_items.each do |order_item|\n if @cart.order_items.find_by(product_id: order_item.product_id).present?\n\n @cart.order_items.find_by(product_id: order_item.product_id).update_attributes(quantity: @cart.order_items.find_by(product_id: order_item.product_id).quantity + order_item.quantity)\n \n else\n \n order_item.update_attributes(cart_id: @cart.id)\n end \n end\n session[:cart_id] = @cart.id\n end\n end", "def save_cart\n \tself.status = 'saved'\n \tself.save\n end", "def add\n response.headers['Content-type'] = \"text/plain; charset=utf-8\"\n unless cookies[:cart].nil?\n @cart = Cart.find_by_unique_identifier(cookies[:cart])\n unless @cart.nil?\n @cart.add_product_to_products(params[:catalog_id], params[:product_id])\n if @cart.save\n render :text => {:cart => { 'result' => true, 'cart_unique_id' => @cart.unique_identifier, 'products_count' => @cart.products_count(params[:catalog_id]), 'product_count' => @cart.product_count(params[:catalog_id],params[:product_id])}}.to_json()\n else\n render :text => {'result' => false }.to_json()\n end\n else\n render :text => {'result' => false }.to_json()\n end\n else\n @cart = Cart.new()\n # @cart.catalog_id = params[:catalog_id]\n @cart.unique_identifier = BCrypt::Engine.hash_secret(\"#{@cart.id}\", BCrypt::Engine.generate_salt)\n @cart.add_product_to_products(params[:catalog_id], params[:product_id])\n if @cart.save\n # render :text => {:cart => {'result' => true, 'cart_unique_id' => @cart.unique_identifier }}.to_json()\n render :text => {:cart => { 'result' => true, 'cart_unique_id' => @cart.unique_identifier, 'products_count' => @cart.products_count(params[:catalog_id]), 'product_count' => @cart.product_count(params[:catalog_id],params[:product_id])}}.to_json()\n else\n render :text => {'result' => false }.to_json()\n end\n end\n end", "def update\n @cart = current_cart\n #We use params to get the product ID from the request\n #This is stored locally as no need to let view see it\n product = Product.find(params[:product_id])\n \n #Adds an item to the cart using the \"add_product\" \n #function in the \"cart.rb\" file.\n @line_item = @cart.delete_product(product.id)\n\n respond_to do |format|\n if @line_item.update_attributes(params[:line_item])\n format.html { redirect_to(store_url) }\n format.js { @current_item = @line_item }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_cart\n @cart = current_api_v1_user&.products&.find(params[:id])\n end", "def cart_params\n { cart: { } }\n end", "def update\n item_quantities = Array.new\n item_quantities = params[:shopping_cart]\n item_list = Hash.new\n @shopping_cart = ShoppingCart.find(params[:id])\n shopping_cart_hash = eval(@shopping_cart.item_list)\n counter = 0\n shopping_cart_hash.each do |item_id, quantity|\n item_list[item_id] = Integer(item_quantities[counter])\n counter += 1\n end\n params[:shopping_cart] = Hash[\"item_list\" => item_list.to_s]\n respond_to do |format|\n if @shopping_cart.update_attributes(params[:shopping_cart])\n format.html { redirect_to @shopping_cart, notice: 'Shopping cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shopping_cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def show_the_cart\n @cart_items = Nacho.find(cart)\n end", "def create\n @order = current_order\n # if there already is an order_item with that product_id, then just update the quantity of the order_item\n # if product_in_cart?, redirect to the edit method\n unless product_in_cart?\n @item = @order.order_items.new(item_params)\n @item.save\n @order.save\n session[:order_id] = @order.id\n redirect_to cart_path\n else\n edit\n end\n end", "def checkout\n if current_cart && current_user\n update_quantity_of_item_in_cart\n current_cart.update(total_price: params[:total_price], checkout: true)\n flash[:notice] = success_checkout_message\n redirect_to cart_user_cart_path and return \n else\n flash[:notice] = \"Please sign in or sign up to checkout\"\n session[:cart_path] = cart_path\n redirect_to signin_path\n end\n end", "def set_cart\n @cart = nil\n if session[:cart_id]\n @cart = Cart.find(session[:cart_id], :include => [:line_items])\n end\n if @customer and !@cart\n @cart = @customer.carts.find_by_sold_at(nil)\n end\n if !@cart\n @cart = Cart.create(:customer => @customer)\n end\n session[:cart_id] = @cart.id\n end", "def set_cart\n begin\n @cart = Order.in_cart.find(session[:cart_id])\n rescue ActiveRecord::RecordNotFound\n @cart = Order.create(client: current_client)\n session[:cart_id] = @cart.id\n end\n @cart.update(client: current_client) if !@cart.client && current_client\n end", "def set_cart\n @cart = Cart.find_by(buyer_id:current_buyer.id)\n end", "def add\n # we need the id of the product to be added\n # lets get it now\n \n id = params[:id]\n # if the cart exists already use it if not make a new one\n if session[:cart] then\n \n cart = session[:cart]\n else\n session[:cart] = {}\n cart = session[:cart]\n end\n \n # If the product is in the cart then increase the existing quantity by 1\n \n if cart[id] then\n \n cart[id] = cart[id] + 1 # this is the actual increase quantity part\n else\n \n cart[id] = 1\n \n end\n \n redirect_to :action => :index\n \n end", "def cart\n type = params[:type]\n\n if type == \"addcart\"\n #current_user.cart_additions << @item\n current_user.carts.create!(:item =>@item, :iscart? =>true)\n redirect_to cart_index_path, notice: \"#{@item.name} was added to your cart\"\n elsif type == \"removecart\"\n current_user.carts.update(:item =>@item, :iscart? =>false)\n #current_user.cart_additions.delete(@item)\n redirect_to root_path, notice: \"#{@item.name} was removed from your cart\"\n else\n redirect_to item_path(@item), notice: \"Looks like nothing happened. Try again!\"\n\n end\n end", "def info\n cart_info = {id: id, total: total, completed: completed}\n items = {}\n\n cart_items.collect do |item|\n items[item.product_id] = {\n product_title: item.product_title,\n product_price: item.price,\n quantity: item.quantity,\n total: item.total_price\n }\n end\n\n cart_info[:in_cart] = items\n\n cart_info\n end", "def add_univstub_with_discount() add_to_cart_common(:add_product, params[:id]) end", "def add_to_cart(product)\n @products << product\n @sub_total += product.base_price\n @total_price += product.total_price\n puts \"Added to cart!\"\n end", "def show\n @cart = Cart.find_by(buyer_id:current_buyer.id)\n @entries = CartCarry.where(cart_id:@cart.id)\n @TotalPrice = 0\n @entries.each do |item|\n @TotalPrice += Product.find_by(id:item.product_id).currentPrice * item.quantity\n end\n end", "def update\n logger.debug \"***Updating Line Item #{params[:id]} quantity to #{params[:cart_line_item][:quantity]}\"\n @cart_line_item = CartLineItem.find(params[:id])\n @cart_line_item.quantity = params[:cart_line_item][:quantity]\n if @cart_line_item.save\n flash[:success] = \"Cart Item successfully updated\"\n else\n flash[:error] = \"Cart Item update unsuccessful\"\n end\n redirect_to cart_path(session[:cart_id])\n end", "def apply_clearance(cart)\n # Consult README for inputs and outputs\n #\n # REMEMBER: This method **should** update cart\n cart.each do |item_hash|\n if item_hash[:clearance]\n discount = item_hash[:price] * 0.20\n item_hash[:price] -= discount\n # binding.pry\n end\n end\n cart\nend", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Cart was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cart.update(cart_params)\n format.html { redirect_to @cart, notice: 'Expense Report was successfully updated.' }\n format.json { render :show, status: :ok, location: @cart }\n else\n format.html { render :edit }\n format.json { render json: @cart.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n # @carts = Cart.all\n # @cart = Cart.where(user_id: session[:user_id]).first\n # byebug\n\n\n @cart = Cart.where(user_id: session[:user_id]).first\n\n\n\n @amount = @cart.calculate_price_based_on_qty\n\n @fabric_type_options = [['Basic Cotton Ultra', 30], ['Satin', 40], ['Kona® Cotton', 44],\n ['Performance Piqué', 33], ['Cotton Poplin', 59], ['Poly Crepe de Chine', 39],\n ['Cotton Lawn Ultra', 47], ['Silky Faille', 23], ['Performance Knit', 21], ['Modern Jersey', 31],\n ['Cotton Spandex Jersey', 55], ['Fleece', 56], ['Minky', 46],\n ['Linen-Cotton Canvas', 52], ['Organic Cotton Knit', 5], ['Organic Cotton Sateen', 36],\n ['Sport Lycra', 50], ['Heavy Cotton Twill', 7], ['Eco Canvas', 34],\n ['Faux Suede', 32], ['Silk Crepe de Chine', 10]]\n\n end", "def current_cart=(new_cart)\n session[cart_session_param] = new_cart ? new_cart.to_yaml : nil\n @current_cart = new_cart || false\n end" ]
[ "0.76693606", "0.7292008", "0.7246855", "0.7243659", "0.7121665", "0.70870227", "0.7067355", "0.7052658", "0.70241874", "0.6979406", "0.69738674", "0.6955815", "0.6949921", "0.6945123", "0.6908599", "0.69085234", "0.6898777", "0.686617", "0.6845554", "0.68366593", "0.683327", "0.68327844", "0.6828414", "0.68282", "0.6813984", "0.680592", "0.6801797", "0.6797352", "0.6782461", "0.6769468", "0.6765611", "0.6753888", "0.6729195", "0.67238826", "0.6720689", "0.6720354", "0.67195594", "0.6718586", "0.67129546", "0.67110664", "0.6702946", "0.66953975", "0.6682448", "0.6681607", "0.66806936", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.6680599", "0.66766965", "0.6674537", "0.6669373", "0.6665695", "0.66604406", "0.66602176", "0.6658484", "0.6657096", "0.66564846", "0.6649583", "0.66348016", "0.66320676", "0.66315836", "0.66301197", "0.66214794", "0.66196406", "0.66148967", "0.6608733", "0.6599101", "0.65962386", "0.6593254", "0.65922254", "0.6591208", "0.65799874", "0.6575248", "0.65616745", "0.65614766", "0.6561235", "0.65485346", "0.65478975", "0.6545618", "0.65413666", "0.6535302", "0.65351754", "0.6532226", "0.6529589", "0.6529361", "0.65254897", "0.65227693", "0.65203834", "0.6514501" ]
0.0
-1
the creation of a custom node definition or use the 'default' node definition. ==== Attributes +master_certname+ Certificate name of Puppet master. +manifest+ A Puppet manifest to inject into the node definition. +node_def_name+ A node definition pattern or name. ==== Returns +string+ A combined manifest with node definition containing input manifest ==== Examples site_pp = create_site_pp("puppetmaster", '', node_def_name='agent')
def create_site_pp(master_certname, manifest='', node_def_name='default') default_def = <<-MANIFEST node default { } MANIFEST node_def = <<-MANIFEST node #{node_def_name} { #{manifest} } MANIFEST if node_def_name != 'default' node_def = "#{default_def}\n#{node_def}" end site_pp = <<-MANIFEST filebucket { 'main': server => '#{master_certname}', path => false, } File { backup => 'main' } #{node_def} MANIFEST return site_pp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_site_pp(master_host, opts = {})\n opts[:manifest] ||= ''\n opts[:node_def_name] ||= 'default'\n master_certname = on(master_host, puppet('config print certname')).stdout.rstrip\n\n default_def = <<-MANIFEST\nnode default {\n}\nMANIFEST\n\n node_def = <<-MANIFEST\nnode #{opts[:node_def_name]} {\n\n#{opts[:manifest]}\n}\nMANIFEST\n\n if opts[:node_def_name] != 'default'\n node_def = \"#{default_def}\\n#{node_def}\"\n end\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\n#{node_def}\nMANIFEST\n\n return site_pp\n end", "def create_node_manifest(manifest_path, master_certname, node_def_name='default')\n manifest = File.read(manifest_path)\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\nnode default {\n\n#{manifest}\n}\nMANIFEST\n\n return site_pp\nend", "def set_sitepp_content(manifest)\n content = <<-HERE\n node default {\n #{manifest}\n }\n HERE\n\n master.run_shell(\"echo '#{content}' > /etc/puppetlabs/code/environments/production/manifests/site.pp\")\nend", "def set_sitepp_content(manifest)\n content = <<-HERE\n node default {\n #{manifest}\n }\n HERE\n\n master.run_shell(\"echo '#{content}' > /etc/puppetlabs/code/environments/production/manifests/site.pp\")\nend", "def set_sitepp_content(manifest)\n content = <<-HERE\n node default {\n #{manifest}\n }\n HERE\n\n puppetserver.run_shell(\"echo '#{content}' > /etc/puppetlabs/code/environments/production/manifests/site.pp\")\nend", "def manifest\n root + '.node.yml'\n end", "def create_manifests_node\n Bebox::Provision.add_node_to_step_manifests(self.project_root, self)\n end", "def create_manifest_file(manifest)\n target_node_name = ENV['TARGET_HOST']\n manifest_file = Tempfile.new(['manifest_', '.pp'])\n manifest_file.write(manifest)\n manifest_file.close\n if target_node_name.nil? || target_node_name == 'localhost'\n # no need to transfer\n manifest_file_location = manifest_file.path\n else\n # transfer to TARGET_HOST\n command = \"bundle exec bolt file upload #{manifest_file.path} /tmp/#{File.basename(manifest_file)} --nodes #{target_node_name} --inventoryfile inventory.yaml\"\n stdout, stderr, status = Open3.capture3(command)\n error_message = \"Attempted to run\\ncommand:'#{command}'\\nstdout:#{stdout}\\nstderr:#{stderr}\"\n raise error_message unless status.to_i.zero?\n\n manifest_file_location = \"/tmp/#{File.basename(manifest_file)}\"\n end\n manifest_file_location\n end", "def create_manifest_file(manifest, opts = {})\n require 'tmpdir'\n target_node_name = ENV.fetch('TARGET_HOST', nil)\n tmp_filename = File.join(Dir.tmpdir, \"manifest_#{Time.now.strftime('%Y%m%d')}_#{Process.pid}_#{rand(0x100000000).to_s(36)}.pp\")\n manifest_file = File.open(tmp_filename, 'w')\n manifest_file.write(manifest)\n manifest_file.close\n if target_node_name.nil? || target_node_name == 'localhost'\n # no need to transfer\n manifest_file_location = manifest_file.path\n else\n # transfer to TARGET_HOST\n inventory_hash = inventory_hash_from_inventory_file\n target_option = opts['targets'] || opts[:targets]\n target_node_name = search_for_target(target_option, inventory_hash) unless target_option.nil?\n\n manifest_file_location = File.basename(manifest_file)\n bolt_result = upload_file(manifest_file.path, manifest_file_location, target_node_name, options: {}, config: nil, inventory: inventory_hash)\n raise bolt_result.first['value'].to_s unless bolt_result.first['status'] == 'success'\n end\n\n manifest_file_location\n end", "def inject_site_pp(master_host, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master_host, site_pp_path, manifest)\n\n set_perms_on_remote(master_host, site_pp_dir, '744')\n end", "def inject_site_pp(master_host, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master_host, site_pp_path, manifest)\n\n set_perms_on_remote(master_host, site_pp_dir, '0744')\n end", "def inject_site_pp(master, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master, site_pp_path, manifest)\n\n set_perms_on_remote(master, site_pp_dir, \"777\")\nend", "def puppet_master_install(opts = {}, &block)\n RSpecSystemPuppet::Helpers::PuppetMasterInstall.new(opts, self, &block)\n end", "def master_contents\n @master = <<-MASTER\n blueprint:\n name: #{spec_bp_name}\n description: This is for testing purposes\n icon:\n file : test.png\n content : (--- base64 encoded ---)\n documentation : 'http://openstack.org/forj'\n locations:\n modules:\n - src-repo: redstone\n git: https://review.forj.io/p/forj-oss/redstone\n puppet-apply: install\n - src-repo: config\n git: https://review.forj.io/p/oo-infra/config\n puppet-extra-modules: /opt/config/production/git/config/modules\n MASTER\n @master\n end", "def node_create(node, node_class=Deployment::Node)\n if node_present? node\n node = node_get node\n elsif node.is_a? Deployment::Node\n node = node_add node\n else\n node = node_class.new node, self\n node = node_add node unless node_present? node\n end\n node\n end", "def node\n @node ||=\n begin\n node = Chef::Node.new(chef_server_rest: client_rest)\n node.name(node_name)\n node.run_list(normalized_run_list)\n node.normal_attrs = first_boot_attributes if first_boot_attributes\n node.environment(environment) if environment\n node.policy_name = policy_name if policy_name\n node.policy_group = policy_group if policy_group\n (config[:tags] || []).each do |tag|\n node.tags << tag\n end\n node\n end\n end", "def create\n params[:deployment_id] = Deployment.find_key(params[:deployment]).id if params.has_key? :deployment\n params[:deployment_id] ||= Deployment.system\n params.require(:name)\n params.require(:deployment_id)\n default_net = nil\n Node.transaction do\n @node = Node.create!(params.permit(:name,\n :description,\n :admin,\n :deployment_id,\n :allocated,\n :alive,\n :system,\n :available,\n :bootenv))\n # Keep suport for mac and ip hints in short form around for legacy Sledgehammer purposes\n if params[:ip]\n default_net = Network.lookup_network(params[:ip]) ||\n Network.find_by_name(\"unmanaged\")\n Attrib.set(\"hint-#{default_net.name}-v4addr\",@node,params[:ip]) if default_net\n Attrib.set(\"hint-admin-macs\", @node, [params[:mac]]) if params[:mac]\n end\n end\n default_net.make_node_role(@node) if default_net\n render api_show @node\n end", "def genNodeConfig(outfile, allParams, builtins, preReq, manifestDir, binDir=nil)\n\n\t\t\tisBuiltin = false\n\t\t\tmyfile = \"#{manifestDir}/#{@type_}.pp\"\n\n\t\t\tif File.exist?(myfile)\n\t\t\t\t# I have my own manifest, I'm a builtin class\n\t\t\t\tisBuiltin = true\n\t\t\t\tparentFile = File.basename(myfile).chomp(\".pp\")\n\t\t\telse\n\t\t\t\t# Locate my type definition file\n\t\t\t\tparentFile = findParent(myfile, extension=\".pp\").chomp(\".pp\")\n\t\t\tend\n\n\t\t\t# Generate the classHash which will have all the defaults for my type\n\t\t\tif parentFile != nil\n\t\t\t\tclassHash = parseManifest(manifestDir, parentFile)\n\t\t\t\tname = @uri.sub(/.*?\\/config\\/active\\/.*\\/(.*)/,'\\1')\n\t\t\telse\n\t\t\t\tclassHash = {}\n\t\t\tend\n\n\t\t\t# If I'm binary and a builtin class, then read in my default data\n\t\t\tif @isBinary\n\t\t\t\tif isBuiltin\n\t\t\t\t\tmyDataFile = classHash[\"content\"].sub(\"brocadevtm\",\"#{manifestDir}../files\")[7..-4]\n\t\t\t\t\tif File.exist?(myDataFile) \n\t\t\t\t\t\tmyData = File.read(myDataFile) \n\t\t\t\t\telse\n\t\t\t\t\t\tmyData = \"\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tmyData = \"\"\n\t\t\t\tend\n\n\t\t\t# If I'm a JSON object, then decode the data\n\t\t\telse\n\t\t\t\tdecodeJSON()\n\n\t\t\t\t# Process the preReqs to determine which objects we have dependencies on. This will \n\t\t\t\t# populate the requires meta-data, and inform puppet of our relationships to ensure\n\t\t\t\t# objects are created in a sensible order. \n\t\t\t\tif preReq.has_key?(parentFile)\n\t\t\t\t\tcheckRequires(parentFile,preReq,manifestDir,builtins,outfile)\n\t\t\t\tend\n\n\t\t\t\t# If we're generating a sparse config or excluding default built-in classes\n\t\t\t\t# then check to see which params are using defaults and drop them.\n\t\t\t\tif (!allParams) or (isBuiltin and !builtins) \n\t\t\t\t\t@params.each do |key,value|\n\t\t\t\t\tvalue = inspectValue(value)\n\t\t\t\t\t\tif classHash.has_key?(key)\n\t\t\t\t\t\t\tif classHash[key] == value\n\t\t\t\t\t\t\t\t@params.delete(key)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tputs(\"Including/Declaring #{@type}, uses custom setting for: #{key}\")\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# If we're a unmodified built-in, and built-ins are excluded, then we're done\n\t\t\tif (!builtins) and isBuiltin \n\t\t\t\tif (!@isBinary) and @params.empty?\n\t\t\t\t\tputs(\"Ignoring BuiltIn JSON Object: #{@type_}\")\n\t\t\t\t\treturn\n\t\t\t\telsif @isBinary and myData == @data\n\t\t\t\t\tputs(\"Ignoring BuiltIn Binary Object: #{@type_}\")\n\t\t\t\t\treturn\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Append my configuration to the output file\n\t\t\tnodefile = File.open(outfile,\"a\")\n\t\t\tif isBuiltin\n\t\t\t\tif @isBinary\n\n\t\t\t\t\tif (myData != @data) or allParams\n\t\t\t\t\t\tdataOut = writeBinFile(outfile,binDir)\n\t\t\t\t\t\tnodefile.puts(\"\\nclass { 'brocadevtm::#{@type_}':\\n\")\n\t\t\t\t\t\tnodefile.puts(\" ensure => present,\\n\")\n\t\t\t\t\t\tnodefile.puts(\" content => file('#{dataOut}'),\\n\")\n\t\t\t\t\t\tnodefile.puts(\"}\\n\\n\")\n\t\t\t\t\telse\n\t\t\t\t\t\tnodefile.puts(\"include brocadevtm::#{@type_}\\n\")\n\t\t\t\t\tend\n\n\t\t\t\telse\n\n\t\t\t\t\tif @params.empty?\n\t\t\t\t\t\tnodefile.puts(\"include brocadevtm::#{@type_}\\n\")\n\t\t\t\t\telse\n\t\t\t\t\t\tnodefile.puts(\"\\nclass { 'brocadevtm::#{@type_}':\\n\")\n\t\t\t\t\t\t@params.each do |key,value|\n\t\t\t\t\t\t\tvalue = inspectValue(value)\n\t\t\t\t\t\t\tsp = \" \" * ( @maxKeyLength - key.length )\n\t\t\t\t\t\t\tnodefile.puts(\" #{key}#{sp} => #{value},\\n\")\n\t\t\t\t\t\tend\n\t\t\t\t\t\tnodefile.puts(\"}\\n\\n\")\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\telse\n\n\t\t\t\tnodefile.puts(\"\\nbrocadevtm::#{parentFile} { '#{name}':\\n\")\n\t\t\t\tif @isBinary\n\t\t\t\t\t\tdataOut = writeBinFile(outfile,binDir)\n\t\t\t\t\t\tnodefile.puts(\" ensure => present,\\n\")\n\t\t\t\t\t\tnodefile.puts(\" content => file('#{dataOut}'),\\n\")\n\t\t\t\telse\n\n\t\t\t\t\t@maxKeyLength >= 6 ? sp = \" \" * ( @maxKeyLength - 6 ) : sp = \" \"\n\t\t\t\t\tnodefile.puts(\" ensure#{sp} => present,\\n\")\n\t\t\t\t\tif ! @params.empty?\n\t\t\t\t\t\t@params.each do |key,value|\n\t\t\t\t\t\t\tvalue = inspectValue(value)\n\t\t\t\t\t\t\tsp = \" \" * ( @maxKeyLength - key.length )\n\t\t\t\t\t\t\tnodefile.puts(\" #{key}#{sp} => #{value},\\n\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tnodefile.puts(\"}\\n\\n\")\n\n\t\t\tend\n\t\t\tnodefile.close()\n\n\t\tend", "def _create_chef_node(&block)\n step(\" creating chef node\", :green)\n @chef_node = Chef::Node.new\n @chef_node.name(fullname)\n set_chef_node_attributes\n set_chef_node_environment\n sync_ipconfig_attribute\n sync_volume_attributes\n chef_api_server_as_client.post_rest('nodes', @chef_node)\n end", "def get_site_pp_path(master_host, opts = {})\n opts[:env] ||= 'production'\n\n return File.join(get_manifests_path(master_host, opts), 'site.pp')\n end", "def add_node\n return if @node_name == nil\n unless node_exist? \n tool_hash = Hash[*@tool_properties.zip(@tool_values).flatten]\n new_node = {\n \"node_name\" => @node_name,\n \"tools\" => [\n tool_hash\n ]\n }\n @site_data[\"site\"][\"node\"] << new_node\n end\n end", "def apply_manifest(manifest, opts = {}, &block)\n apply_manifest_on(default, manifest, opts, &block)\n end", "def generate_manifests_file\n generate_file_from_template(\"#{templates_path}/puppet/roles/manifests/init.pp.erb\", \"#{self.path}/manifests/init.pp\", {role: self})\n end", "def create_perconapuppet_fact(factname, varname)\n Facter.add(factname) do\n confine :kernel => :linux\n re = Regexp.new(\"^#-puppet-##{varname}[\\s=]+([^ ]+)$\")\n setcode do\n value = nil\n configfile = Facter.value(:mysqld_configfile)\n if File.readable?(configfile) and\n Facter::Util::Resolution.exec(\"cat #{configfile}\").match re\n value = $1\n end\n value\n end\n end\nend", "def master_node\n {:nodename => @master_nodename}\n end", "def create\n create_hiera_template\n create_manifests_node\n create_node_checkpoint\n end", "def role_puppet_master\n $myxp.get_deployed_nodes('capi5k-init').first\nend", "def site_create_minimal(data_source)\n # Create output\n FileUtils.mkdir_p('output')\n\n # Create config\n File.open('config.yaml', 'w') do |io|\n io.write(YAML.dump(\n 'output_dir' => 'output',\n 'data_sources' => [\n {\n 'type' => data_source,\n 'items_root' => '/',\n 'layouts_root' => '/'\n }\n ]\n ))\n end\n Nanoc3::NotificationCenter.post(:file_created, 'config.yaml')\n\n # Create rakefile\n File.open('Rakefile', 'w') do |io|\n io.write \"require 'nanoc3/tasks'\"\n end\n Nanoc3::NotificationCenter.post(:file_created, 'Rakefile')\n\n # Create rules\n File.open('Rules', 'w') do |io|\n io.write DEFAULT_RULES\n end\n Nanoc3::NotificationCenter.post(:file_created, 'Rules')\n end", "def allocate_node(name, machine_options)\n\n # get available nodes\n from_deployment = AVAILABLE_DEPLOYMENT\n raise \"Available Pool '#{from_deployment} does not exist\" unless deployment_exists?(from_deployment)\n pool = get(driver_url + API_BASE + \"deployments/#{from_deployment}/nodes\")\n raise \"No available nodes in pool #{from_deployment}\" if pool.size == 0\n\n # assign node from pool\n node = pool[0]\n\n # prepare for moving by moving the deployment to proposed\n to_deployment = RESERVED_DEPLOYMENT\n put(driver_url + API_BASE + \"deployments/#{to_deployment}/propose\")\n\n # set alias (name) and reserve\n node[\"alias\"] = name\n node[\"deployment\"] = to_deployment\n put(driver_url + API_BASE + \"nodes/#{node[\"id\"]}\", node)\n\n # bind the OS NodeRole if missing (eventually set the OS property)\n bind = {:node=>node[\"id\"], :role=>TARGET_NODE_ROLE, :deployment=>to_deployment}\n # blindly add node role > we need to make this smarter and skip if unneeded\n post(driver_url + API_BASE + \"node_roles\", bind)\n\n # commit the deployment\n put(driver_url + API_BASE + \"deployments/#{to_deployment}/commit\")\n\n # at this point Crowbar will bring up the node in the background\n # we can return the node handle to the user\n node[\"name\"]\n\n end", "def create(config_node_name)\n @call_params[:config_node_name] = config_node_name\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def provision(node)\n node_inventory = node.inventory\n node_ipaddress_fact = @config.settings[\"target\"][\"ipaddress_fact\"] || \"ipaddress\"\n master_ipaddress_fact = @config.settings[\"master\"][\"ipaddress_fact\"] || \"ipaddress\"\n\n raise \"Could not determine node ip address from fact #{node_ipaddress_fact}\" unless node_inventory[:facts].include?(node_ipaddress_fact)\n\n steps = @config.settings[\"steps\"].keys.select{|s| @config.settings[\"steps\"][s] }\n MCProvision.info(\"Provisioning #{node.hostname} / #{node_inventory[:facts][node_ipaddress_fact]} with steps #{steps.join ' '}\")\n\n\n chosen_master, master_inventory = pick_master_from(@config.settings[\"master\"][\"criteria\"], node_inventory[:facts])\n\n raise \"Could not determine master ip address from fact #{master_ipaddress_fact}\" unless master_inventory[:facts].include?(master_ipaddress_fact)\n master_ip = master_inventory[:facts][master_ipaddress_fact]\n\n MCProvision.info(\"Provisioning node against #{chosen_master.hostname} / #{master_ip}\")\n\n node.lock if @config.settings[\"steps\"][\"lock\"]\n\n node.set_puppet_host(master_ip) if @config.settings[\"steps\"][\"set_puppet_hostname\"]\n\n # Only do certificate management if the node is clean and doesnt already have a cert\n unless node.has_cert?\n @master.clean_cert(node.hostname.downcase) if @config.settings[\"steps\"][\"clean_node_certname\"]\n\n node.send_csr if @config.settings[\"steps\"][\"send_node_csr\"]\n\n @master.sign(node.hostname.downcase) if @config.settings[\"steps\"][\"sign_node_csr\"]\n else\n MCProvision.info(\"Skipping SSL certificate management for node - already has a cert\")\n end\n\n node.bootstrap if @config.settings[\"steps\"][\"puppet_bootstrap_stage\"]\n node.run_puppet if @config.settings[\"steps\"][\"puppet_final_run\"]\n node.unlock if @config.settings[\"steps\"][\"unlock\"]\n node.flag if @config.settings[\"steps\"][\"flag\"]\n @notifier.notify(\"Provisioned #{node.hostname} against #{chosen_master.hostname}\", \"New Node\") if @config.settings[\"steps\"][\"notify\"]\n end", "def create_temp_dir_env(master, env_root_path, env_seed_name, manifest)\n env_name = \"#{env_seed_name}\" + rand(36**16).to_s(36)\n env_path = \"#{env_root_path}/#{env_name}\"\n env_site_pp_path = \"#{env_path}/manifests/site.pp\"\n\n on(master, \"mkdir -p #{env_path}/manifests #{env_path}/modules\")\n set_perms_on_remote(master, env_path, \"777\")\n\n inject_site_pp(master, env_site_pp_path, manifest)\n\n return env_name\nend", "def bootstrap_for_node\n bootstrap = Chef::Knife::Bootstrap.new\n bootstrap.name_args = [config[:fqdn]]\n bootstrap.config[:run_list] = get_config(:run_list).split(/[\\s,]+/)\n bootstrap.config[:secret_file] = get_config(:secret_file)\n bootstrap.config[:hint] = get_config(:hint)\n bootstrap.config[:ssh_user] = get_config(:ssh_user)\n bootstrap.config[:ssh_password] = get_config(:ssh_password)\n bootstrap.config[:ssh_port] = get_config(:ssh_port)\n bootstrap.config[:identity_file] = get_config(:identity_file)\n bootstrap.config[:chef_node_name] = get_config(:chef_node_name)\n bootstrap.config[:prerelease] = get_config(:prerelease)\n bootstrap.config[:bootstrap_version] = get_config(:bootstrap_version)\n bootstrap.config[:distro] = get_config(:distro)\n bootstrap.config[:use_sudo] = true unless get_config(:ssh_user) == 'root'\n bootstrap.config[:template_file] = get_config(:template_file)\n bootstrap.config[:environment] = get_config(:environment)\n bootstrap.config[:first_boot_attributes] = get_config(:first_boot_attributes)\n bootstrap.config[:log_level] = get_config(:log_level)\n # may be needed for vpc_mode\n bootstrap.config[:no_host_key_verify] = get_config(:no_host_key_verify)\n bootstrap\n end", "def node(data)\n if (data['provisioning'])\n if(data['provisioning']['node_group'] && data['provisioning']['node_group']['size'])\n Topo::Provision::NodeGroupGenerator.new(data)\n else \n Topo::Provision::MachineGenerator.new(data)\n end\n else\n Topo::Provision::ChefNodeGenerator.new(data)\n end \n end", "def slave_xml_resource\n return @slave_xml_resource if @slave_xml_resource\n\n slave_xml = ::File.join(new_resource.remote_fs, \"#{new_resource.service_name}.xml\")\n\n @slave_xml_resource = Chef::Resource::Template.new(slave_xml, run_context)\n @slave_xml_resource.cookbook('jenkins')\n @slave_xml_resource.source('jenkins-slave.xml.erb')\n @slave_xml_resource.sensitive = true if new_resource.password\n @slave_xml_resource.variables(\n new_resource: new_resource,\n endpoint: endpoint,\n java_bin: java,\n slave_jar: slave_jar,\n jnlp_url: jnlp_url,\n jnlp_secret: jnlp_secret,\n user_domain: user_domain,\n user_account: user_account,\n user_password: new_resource.password,\n path: new_resource.path\n )\n @slave_xml_resource.notifies(:run, install_service_resource)\n @slave_xml_resource\n end", "def create_vm(config, node_name)\n config.vm.define node_name do |vm|\n vm.vm.host_name = node_name\n vm.vm.network \"private_network\", type: \"dhcp\"\n vm.vm.box = \"ubuntu/xenial64\"\n end\nend", "def create_node(node, host, &block)\n pubsub.create_with_configuration(node, PUBSUB_CONFIGURE, host, &callback_logging(__method__, node, &block))\n end", "def generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n ssh.write \"#{CHEF_VAR_PATH}/node.json\", content: JSON.generate(run_list), sudo: true\n end", "def generate_standalone_topology()\n name = 'pwcsta'\n # Define provider agnostic layout\n @config[:layout] = { :topology => @options.topology,\n :api_fqdn => 'api.opscode.aws',\n :default_orgname => default_orgname,\n :manage_fqdn => 'manage.opscode.aws',\n :analytics_fqdn => 'analytics.opscode.aws',\n :standalones => {\n \"#{name}-standalone\" => {\n :hostname => \"#{name}-standalone.centos.aws\",\n :ebs_optimized => true,\n :instance_type => 'm3.xlarge'\n }\n }\n }\n end", "def action_create\n if current_resource.exists? && correct_config?\n Chef::Log.debug(\"#{new_resource} exists - skipping\")\n else\n converge_by(\"Create #{new_resource}\") do\n executor.groovy! <<-EOH.gsub(/ ^{12}/, '')\n import hudson.model.*\n import hudson.slaves.*\n import jenkins.model.*\n import jenkins.slaves.*\n\n props = []\n availability = #{convert_to_groovy(new_resource.availability)}\n usage_mode = #{convert_to_groovy(new_resource.usage_mode)}\n env_map = #{convert_to_groovy(new_resource.environment)}\n labels = #{convert_to_groovy(new_resource.labels.sort.join(\"\\s\"))}\n\n // Compute the usage mode\n if (usage_mode == 'normal') {\n mode = Node.Mode.NORMAL\n } else {\n mode = Node.Mode.EXCLUSIVE\n }\n\n // Compute the retention strategy\n if (availability == 'demand') {\n retention_strategy =\n new RetentionStrategy.Demand(\n #{new_resource.in_demand_delay},\n #{new_resource.idle_delay}\n )\n } else if (availability == 'always') {\n retention_strategy = new RetentionStrategy.Always()\n } else {\n retention_strategy = RetentionStrategy.NOOP\n }\n\n // Create an entry in the prop list for all env vars\n if (env_map != null) {\n env_vars = new hudson.EnvVars(env_map)\n entries = env_vars.collect {\n k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v)\n }\n props << new EnvironmentVariablesNodeProperty(entries)\n }\n\n // Launcher\n #{launcher_groovy}\n\n // Build the slave object\n slave = new DumbSlave(\n #{convert_to_groovy(new_resource.name)},\n #{convert_to_groovy(new_resource.description)},\n #{convert_to_groovy(new_resource.remote_fs)},\n #{convert_to_groovy(new_resource.executors.to_s)},\n mode,\n labels,\n launcher,\n retention_strategy,\n props\n )\n\n // Create or update the slave in the Jenkins instance\n nodes = new ArrayList(Jenkins.instance.getNodes())\n ix = nodes.indexOf(slave)\n (ix >= 0) ? nodes.set(ix, slave) : nodes.add(slave)\n Jenkins.instance.setNodes(nodes)\n EOH\n end\n end\n end", "def generate_blank_for_new_site(options = {})\n @site = Site.new({ \n :short_name => nil, \n :full_name => nil, \n :url => nil, \n :comments_allowed => true,\n :active => true })\n end", "def content\n return <<-EOF\ndefault lucie\n\nlabel lucie\nkernel #{ INSTALLER_KERNEL }\nappend initrd=#{ initrd } ip=dhcp devfs=nomount root=/dev/nfs nfsroot=#{ @nfsroot } boot=live hostname=#{ @node.name } #{ $KERNEL_OPTIONS }\nEOF\n end", "def manifest(type)\n type = type.downcase\n say \"Rendering #{type} manifest\", :green\n @values = parse_cloud_config\n @tf_output = parse_tf_state('terraform/terraform.tfstate') if options[:cloud] == 'aws'\n\n if options[:cloud] == 'aws'\n @private_subnet = IPAddr.new(@values['aws']['private_subnet']['network']).to_range.to_a\n @public_subnet = IPAddr.new(@values['aws']['public_subnet']['network']).to_range.to_a\n else\n @private_subnet = IPAddr.new(@values['gcp']['subnet_cidr']).to_range.to_a\n end\n\n @static_ip_vault = @private_subnet[11].to_s\n @static_ips_concourse = [@private_subnet[12]].map(&:to_s)\n @static_ip_prometheus_stack = @private_subnet[18].to_s\n\n case type\n when \"bosh\"\n directory(\"#{options[:cloud]}/deployments/bosh\", 'deployments/bosh')\n template(\"#{options[:cloud]}/bosh-vars.yml.erb\", 'config/bosh-vars.yml')\n copy_file(\"#{options[:cloud]}/docs/bosh.md\", \"docs/bosh.md\")\n template(\"#{options[:cloud]}/bin/bosh-install.sh.tt\", \"bin/bosh-install.sh\")\n chmod('bin/bosh-install.sh', 0755)\n\n when \"concourse\"\n directory(\"#{options[:cloud]}/deployments/concourse\", \"deployments/concourse\")\n copy_file(\"#{options[:cloud]}/docs/concourse.md\", \"docs/concourse.md\")\n template(\"#{options[:cloud]}/bin/concourse-deploy.sh.tt\", \"bin/concourse-deploy.sh\")\n chmod('bin/concourse-deploy.sh', 0755)\n ingress_add_entry(@values['concourse']['hostname'], @static_ips_concourse, port: 8080)\n\n when \"vault\"\n template(\"#{options[:cloud]}/deployments/vault/vault.yml.erb\", \"deployments/vault/vault.yml\")\n copy_file(\"#{options[:cloud]}/docs/vault.md\", \"docs/vault.md\")\n template(\"#{options[:cloud]}/bin/vault-deploy.sh.tt\", \"bin/vault-deploy.sh\")\n chmod('bin/vault-deploy.sh', 0755)\n ingress_add_entry(@values['vault']['hostname'], [@static_ip_vault], port: 8200)\n\n when \"ingress\"\n template(\"#{options[:cloud]}/deployments/ingress/ingress.yml.erb\", \"deployments/ingress/ingress.yml\")\n copy_file(\"#{options[:cloud]}/docs/ingress.md\", \"docs/ingress.md\")\n template(\"#{options[:cloud]}/bin/ingress-deploy.sh.tt\", \"bin/ingress-deploy.sh\")\n template(\"#{options[:cloud]}/bin/ingress-update.sh.tt\", \"bin/ingress-update.sh\")\n chmod('bin/ingress-deploy.sh', 0755)\n chmod('bin/ingress-update.sh', 0755)\n\n when \"prometheus\"\n directory(\"#{options[:cloud]}/deployments/prometheus\", \"deployments/prometheus\")\n copy_file(\"#{options[:cloud]}/docs/prometheus.md\", \"docs/prometheus.md\")\n template(\"#{options[:cloud]}/bin/prometheus-deploy.sh.tt\", \"bin/prometheus-deploy.sh\")\n chmod('bin/prometheus-deploy.sh', 0755)\n ingress_add_entry(@values['alertmanager']['hostname'], [@static_ip_prometheus_stack], port: 9093)\n ingress_add_entry(@values['grafana']['hostname'], [@static_ip_prometheus_stack], port: 3000)\n ingress_add_entry(@values['prometheus']['hostname'], [@static_ip_prometheus_stack], port: 9090)\n\n else\n say \"Manifest type not specified\"\n\n end\n end", "def create_site(sitecontainer, title = \"Test Site\", sitepath = \"\", sitetemplate=nil )\n\t path = @sling.url_for(sitecontainer)\n res = @sling.execute_post(path+\".createsite.json\", \"sakai:title\" => title, \":sitepath\" => sitepath, \"sakai:site-template\" => sitetemplate )\n if (res.code != \"200\" && res.code != \"201\")\n puts \"Unable to create site: #{res.code} #{res.body}\"\n return nil\n end\n return Site.new(@sling, sitecontainer+sitepath)\n end", "def create\n name = @resource[:name]\n client = Savon.client(wsdl: @resource[:connection]['url'] + WSDL_PATH)\n\n environment = @resource[:environment]\n custom_props = @resource[:properties]\n dynamic_props = @resource[:dynamic_properties]\n\n raise Puppet::Error, \"Target name, folder, owner and type must not be empty!\" if empty_str?(name) or empty_str?(@resource[:folder]) or empty_str?(@resource[:owner]) or empty_str?(@resource[:type])\n\n self.info(\"Importing deployment target..\")\n \n doc = REXML::Document.new '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\n root = doc.add_element 'Sync', { \"xmlns:xsi\" => \"http://www.w3.org/2001/XMLSchema-instance\" }\n entity = root.add_element \"Entity\", { \"mainType\" => \"DeploymentTarget\", \"customType\" => @resource[:type] }\n \n prop_hash = { \"system_name\" => name, \"system_owner.system_name\" => @resource[:owner], \"system_folder.system_name\" => @resource[:folder], \"system_deployment_agent_name\" => @resource[:agent],\n \"system_description\" => \"created via Automic Puppet resource type\", \"system_is_active\" => \"true\" }\n\n prop_hash.keys.each do |prk|\n prop_ele = entity.add_element \"Property\", { \"name\" => prk }\n if prk == 'system_name'\n prop_ele.add_attribute \"isIdentity\", \"true\"\n end\n value_ele = prop_ele.add_element \"Value\"\n value_ele.add_text prop_hash[prk]\n end\n\n if not custom_props.nil? and not custom_props.empty?\n # add custom properties\n custom_props.keys.each do |prk|\n prop_ele = entity.add_element \"Property\", { \"name\" => prk }\n value_ele = prop_ele.add_element \"Value\"\n value_ele.add_text custom_props[prk]\n end\n end\n \n message = { \"username\" => @resource[:connection]['username'], \"password\" => @resource[:connection]['password'], \"mainType\" => \"DeploymentTarget\", \"failOnError\" => true, \"fomat\" => \"XML\", \"data\" => doc.to_s }\n \n response = client.call(:import, message: message)\n\n # check error and status\n status = response.body[:import_response][:import_result][:status].to_i \n token = response.body[:import_response][:import_result][:token]\n\n self.debug(\"Got token: #{token}\")\n \n # wait for target id return in status\n while status == 0\n sleep 1\n response = client.call(:get_status, message: { \"token\" => token } )\n status = response.body[:get_status_response][:get_status_result][:status].to_i \n end\n\n if status < 0\n self.info(\"Unsuccessfully create or update deployment target\")\n error = response.body[:get_status_response][:get_status_result][:error] \n if not error.nil? and not error.empty?\n self.info(\"Error detail: \" + error.to_s)\n end\n return status\n end\n\n self.info(\"Deployment target import successfully\")\n \n # add environment\n if not environment.nil? and not environment.empty?\n begin\n env_id = get_environment_id(client, environment)\n if (env_id > 0)\n add_environment_relation(client, env_id, name)\n end\n rescue Exception => e\n self.info(\"Error occurred while updating environment for deployment target\") \n self.debug(e.message)\n self.debug(e.backtrace.inspect)\n end\n end \n\n # update dynamic properties\n if not dynamic_props.nil? and not dynamic_props.empty?\n begin\n update_dynamic_properties(client, status, dynamic_props)\n rescue Exception => e\n self.info(\"Error occurred while updating dynamic properties for deployment target\") \n self.debug(e.message)\n self.debug(e.backtrace.inspect)\n end\n end\n\n return status\n end", "def node\n returning \"#{@name}_node\" do |nodename|\n @canvas << \"var #{nodename} = #{@name}.node;\"\n end\n end", "def config_creates_file(_new_resource)\n return 'Makefile'\n end", "def config_creates_file(_new_resource)\n return 'Makefile'\n end", "def create_deployment_manifest\n cloud_properties = {\n \"instance_type\" => \"m1.small\",\n }\n cloud_properties[\"persistent_disk\"] = flags[:disk] if flags[:disk]\n cloud_properties[\"static_ips\"] = ip_addresses\n director_uuid = Bosh::Gen::Models::BoshConfig.new.target_uuid\n manifest = Bosh::Gen::Models::DeploymentManifest.new(\n name, director_uuid,\n release_properties, cloud_properties, default_properties)\n manifest.jobs = job_manifests\n create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]\n end", "def slave_compat_xml\n return @slave_compat_xml if @slave_compat_xml\n slave_compat_xml = ::File.join(new_resource.remote_fs, \"#{new_resource.service_name}.exe.config\")\n @slave_compat_xml = Chef::Resource::File.new(slave_compat_xml, run_context)\n @slave_compat_xml.content(\n <<-EOH.gsub(/^ {8}/, '')\n <configuration>\n <startup>\n <supportedRuntime version=\"v4.0\" />\n </startup>\n </configuration>\n EOH\n )\n @slave_compat_xml\n end", "def add_jobs_to_manifest(manifest)\n if any_service_nodes?\n config.each do |cluster|\n server_count = cluster[\"count\"]\n server_flavor = cluster[\"flavor\"]\n job = {\n \"name\" => cluster_name(cluster),\n \"template\" => [job_node_name],\n \"instances\" => server_count,\n \"resource_pool\" => cluster_name(cluster),\n # TODO are these AWS-specific networks?\n \"networks\" => [{\n \"name\" => \"default\",\n \"default\" => [\"dns\", \"gateway\"]\n }],\n \"persistent_disk\" => system_config.common_persistent_disk\n }\n manifest[\"jobs\"] << job\n end\n end\n end", "def apply_manifest(manifest, opts = {})\n target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV.fetch('TARGET_HOST', nil)\n raise 'manifest and manifest_file_location in the opts hash are mutually exclusive arguments, pick one' if !manifest.nil? && !opts[:manifest_file_location].nil?\n raise 'please pass a manifest or the manifest_file_location in the opts hash' if (manifest.nil? || manifest == '') && opts[:manifest_file_location].nil?\n raise 'please specify only one of `catch_changes`, `expect_changes`, `catch_failures` or `expect_failures`' if\n [opts[:catch_changes], opts[:expect_changes], opts[:catch_failures], opts[:expect_failures]].compact.length > 1\n\n opts = { trace: true }.merge(opts)\n\n if opts[:catch_changes]\n use_detailed_exit_codes = true\n acceptable_exit_codes = [0]\n elsif opts[:catch_failures]\n use_detailed_exit_codes = true\n acceptable_exit_codes = [0, 2]\n elsif opts[:expect_failures]\n use_detailed_exit_codes = true\n acceptable_exit_codes = [1, 4, 6]\n elsif opts[:expect_changes]\n use_detailed_exit_codes = true\n acceptable_exit_codes = [2]\n else\n use_detailed_exit_codes = false\n acceptable_exit_codes = [0]\n end\n\n manifest_file_location = opts[:manifest_file_location] || create_manifest_file(manifest)\n inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash\n\n target_option = opts['targets'] || opts[:targets]\n if target_option.nil?\n raise \"Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml\" unless target_in_inventory?(inventory_hash, target_node_name)\n else\n target_node_name = search_for_target(target_option, inventory_hash)\n end\n\n # Forcibly set the locale of the command\n locale = if os[:family] == 'windows'\n ''\n else\n 'LC_ALL=en_US.UTF-8 '\n end\n command_to_run = \"#{locale}#{opts[:prefix_command]} puppet apply #{manifest_file_location}\"\n command_to_run += ' --trace' if !opts[:trace].nil? && (opts[:trace] == true)\n command_to_run += \" --modulepath #{Dir.pwd}/spec/fixtures/modules\" if target_node_name == 'litmus_localhost'\n command_to_run += \" --hiera_config='#{opts[:hiera_config]}'\" unless opts[:hiera_config].nil?\n command_to_run += ' --debug' if !opts[:debug].nil? && (opts[:debug] == true)\n command_to_run += ' --noop' if !opts[:noop].nil? && (opts[:noop] == true)\n command_to_run += ' --detailed-exitcodes' if use_detailed_exit_codes == true\n\n if os[:family] == 'windows'\n # IAC-1365 - Workaround for BOLT-1535 and bolt issue #1650\n command_to_run = \"try { #{command_to_run}; exit $LASTEXITCODE } catch { write-error $_ ; exit 1 }\"\n bolt_result = Tempfile.open(['temp', '.ps1']) do |script|\n script.write(command_to_run)\n script.close\n run_script(script.path, target_node_name, [], options: {}, config: nil, inventory: inventory_hash)\n end\n else\n bolt_result = run_command(command_to_run, target_node_name, config: nil, inventory: inventory_hash)\n end\n result = OpenStruct.new(exit_code: bolt_result.first['value']['exit_code'],\n stdout: bolt_result.first['value']['stdout'],\n stderr: bolt_result.first['value']['stderr'])\n\n status = result.exit_code\n if opts[:catch_changes] && !acceptable_exit_codes.include?(status)\n report_puppet_apply_change(command_to_run, bolt_result)\n elsif !acceptable_exit_codes.include?(status)\n report_puppet_apply_error(command_to_run, bolt_result, acceptable_exit_codes)\n end\n\n yield result if block_given?\n\n if ENV['RSPEC_DEBUG']\n puts \"apply manifest succeded\\n #{command_to_run}\\n======\\nwith status #{result.exit_code}\"\n puts result.stderr\n puts result.stdout\n end\n result\n end", "def provision_node(platform, suite_name)\n run_list = generate_runlist(platform, suite_name)\n ui.info ui.color(\" -> Provisioning suite #{suite_name} on platform: #{platform}\", :cyan)\n v_inst = vagabond_instance(:create, platform, :suite_name => suite_name)\n v_inst.send(:execute)\n solo_path = configure_for(v_inst.name, platform, suite_name, run_list, :dna, :cookbooks)\n v_inst.send(:provision_solo, solo_path)\n end", "def customize\n # If the PACKAGE_VERSION variable is passed from the command line, then set\n # @package_version equal to what was passed. Else, use the current version\n # of puppet\n if ENV['PACKAGE_VERSION']\n @package_version = ENV['PACKAGE_VERSION']\n else\n @package_version = '2.7.3'\n end\n \n # Puppet-specific Variables\n @title = \"Puppet_Install\"\n @reverse_domain = \"com.puppetlabs\"\n @package_major_version = @package_version.split('.')[0]\n @package_minor_version = @package_version.split('.')[1] + @package_version.split('.')[2]\n @puppet_file = \"puppet-#{@package_version}\"\n @puppet_url = \"http://downloads.puppetlabs.com/puppet/\"\n @puppet_tarfile = \"#{@puppet_file}.tar.gz\"\nend", "def create_site(opts = {})\n data, _status_code, _headers = create_site_with_http_info(opts)\n return data\n end", "def node_entry\n \"node #{name}\"\n end", "def create_deploy\n @@tpl = CapistranoDeployGenerator.source_root\n empty_directory \"config/deploy\"\n\n say <<-EOF\n\nconfig/deploy.rb generator\n\nThis menu will help you creating deployment configuration file\ndeploy.rb for Capistrano. It is safe to acceppt defulat values for\nmost or all questions. Just hit Enter if default is provided.\n\nAll values can be changed later in the file itself or you can re-run\ngenerator again.\n\nEOF\n template \"deploy.rb.erb\", \"config/deploy.rb\"\n @stages.each do |stage|\n template \"staging.rb.erb\", \"config/deploy/#{stage}.rb\" \n end\n say \"Please edit manually configuration of the multi-staging files:\"\n @stages.map { |x| say \"./confg/deploy/#{x}.rb\\n\"}\n end", "def build_node\n Chef::Log.trace(\"Building node object for #{@node_name}\")\n @node = Chef::Node.find_or_create(node_name)\n ohai_data = @ohai.data.merge(@node.automatic_attrs)\n @node.consume_external_attrs(ohai_data, nil)\n @run_list_expansion = @node.expand!(\"server\")\n @expanded_run_list_with_versions = @run_list_expansion.recipes.with_version_constraints_strings\n Chef::Log.info(\"Run List is [#{@node.run_list}]\")\n Chef::Log.info(\"Run List expands to [#{@expanded_run_list_with_versions.join(\", \")}]\")\n @node\n end", "def create_puppetfile(puppetfile_contents)\n File.open('Puppetfile', 'w') do |file|\n file.write puppetfile_contents\n end\n end", "def create_default_template!(from_addr, from_name, subject)\n\t\treturn false unless templates_for(\"default\").empty?\n\t\t@supported_languages.each do |lang|\n\t\t\tname = name_from_labels(\"default\", lang)\n\t\t\ttempl = @mandrill_connection.templates.add(name, from_addr, from_name, subject, \"<html><body>Base Template</body></html>\", \"Base Template\", true, [@service_label, \"activity-default\", \"lang-#{lang}\"])\n\t\tend\n\tend", "def create_deployment_manifest\n cloud_properties = { \"instance_type\" => \"m1.small\", \"availability_zone\" => \"us-east-1e\" }\n cloud_properties[\"persistent_disk\"] = flags[:disk] if flags[:disk]\n cloud_properties[\"static_ips\"] = ip_addresses\n manifest = Bosh::Gen::Models::DeploymentManifest.new(name, director_uuid, release_properties, cloud_properties)\n manifest.jobs = job_manifests\n create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]\n end", "def create_node(configuration = Jabber::PubSub::NodeConfig.new)\n unless node_exist?\n super(@nodename,configuration)\n else\n false\n end\n end", "def create_node(node, tag=nil)\n end", "def create_site(opts = {})\n data, _status_code, _headers = create_site_with_http_info(opts)\n data\n end", "def create_site(params={name:random_string})\n\t\tnew_site = site[:new]\n\t\tparams[:site] = params[:name]\n\t\tnew_site[:params].merge!(params)\n\t\tnew_site[:params][:address] = append_ftp_value(new_site[:params][:address],new_site[:params][:ftp_type])\n\t\tpost(new_site)\n\tend", "def jenkins_node_manage(args)\n args = jenkins_node_defaults(args)\n\n if args[:env]\n map = args[:env].collect { |k,v| %Q(\"#{k}\":\"#{v}\") }.join(\",\")\n env = \"new jenkins.EnvVars([#{map}])\"\n else\n env = \"null\"\n end\n\n case args[:launcher]\n when \"jnlp\"\n launcher = \"new JNLPLauncher()\"\n when \"command\"\n launcher = %Q(new CommandLauncher(\"#{args[:command]}\", env))\n when \"ssh\"\n if args[:password] == nil\n password = \"null\"\n else\n password = %Q(\"#{args[:password]}\")\n end\n\n launcher = %Q(new_ssh_launcher([\"#{args[:host]}\", #{args[:port]}, \"#{args[:username]}\", #{password},\n \"#{args[:private_key]}\", \"#{args[:jvm_options]}\"] as Object[]))\n end\n\n remote_fs = args[:remote_fs].gsub('\\\\', '\\\\\\\\\\\\') # C:\\jenkins -> C:\\\\jenkins\n\n if args[:availability] == \"Demand\"\n rs_args = \"#{args[:in_demand_delay]}, #{args[:idle_delay]}\"\n else\n rs_args = \"\"\n end\n\n return <<EOF\nimport jenkins.model.*\nimport jenkins.slaves.*\n\napp = jenkins.instance\nenv = #{env}\nprops = []\n\ndef new_ssh_launcher(args) {\n jenkins.instance.pluginManager.getPlugin(\"ssh-slaves\").classLoader.\n loadClass(\"jenkins.plugins.sshslaves.SSHLauncher\").\n getConstructor([String, int, String, String, String, String] as Class[]).newInstance(args)\n}\n\nif (env != null) {\n entries = env.collect { k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v) }\n props << new EnvironmentVariablesNodeProperty(entries)\n}\n\nslave = new DumbSlave(\"#{args[:name]}\", \"#{args[:description]}\", \"#{remote_fs}\",\n \"#{args[:executors]}\", Node.Mode.#{args[:mode]}, \"#{args[:labels]}\",\n #{launcher},\n new RetentionStrategy.#{args[:availability]}(#{rs_args}), props)\n\nnodes = new ArrayList(app.getNodes())\nix = nodes.indexOf(slave)\nif (ix >= 0) {\n nodes.set(ix, slave)\n}\nelse {\n nodes.add(slave)\n}\n\napp.setNodes(nodes)\n\nEOF\nend", "def create\n Souffle::Log.info \"#{@node.log_prefix} Creating a new node...\"\n provider.create_node(@node)\n end", "def createApplicationDefinition(args)\n app_uri = args[0]\n app_name = args[1]\n\n properties = args[2]\n blockApp = s(:block, nil)\n block_index = 1\n\n properties[:options].each do |k,v|\n if k != \"properties\"\n begin\n # attributes\n next if [\"uri\", \"name\"].include?(k)\n if k == \"version\"\n v_values = v.split(\".\")\n sexp = version(v_values)\n else \n sexp = attr_assgn(k, v)\n end\n blockApp[block_index] = sexp\n block_index += 1\n rescue\n next\n end\n else\n # properties\n v.each do |prop,prop_v|\n options = s(:hash, nil)\n h_i = 1\n prop_v[:options].each do |opt,opt_v|\n options[h_i] = s(:lit, opt.to_sym)\n v = nil\n is_sym_value = (opt == \"dynamic\" or opt == \"type\")\n is_int_value = (opt == \"order\")\n need_bool_sexp = (opt == \"dynamic\")\n need_lit_sexp = (opt == \"type\" or opt == \"order\")\n v = opt_v.to_sym if is_sym_value\n v = opt_v.to_i if is_int_value\n options[h_i + 1] = s(v) if need_bool_sexp\n options[h_i + 1] = s(:lit, v) if need_lit_sexp\n h_i += 2\n end\n #options = s(:block, options)\n mnemonic = s_str(prop_v[:mnemonic])\n description = s_str(prop_v[:description].to_s)\n blockApp[block_index] = defProperty(prop, description, mnemonic, options)\n block_index += 1\n end\n end\n end\n\n # measurements\n unless properties[:measures].nil?\n properties[:measures].each do |ms, fields|\n blockMetrics = s(:block, nil)\n bMetrics_index = 1\n fields.each do |name, type|\n blockMetrics[bMetrics_index] = defMetric(name, type) \n bMetrics_index += 1\n end\n blockApp[block_index] = defMeasurement(ms, blockMetrics)\n block_index += 1\n end\n end\n \n return defApplication(app_uri, app_name, blockApp)\n end", "def create_hiera_template\n options = {ssh_key: Bebox::Project.public_ssh_key_from_file(project_root, environment), project_name: Bebox::Project.shortname_from_file(project_root)}\n Bebox::Provision.generate_hiera_for_steps(self.project_root, \"node.yaml.erb\", self.hostname, options)\n end", "def build_puppet_config(agent)\n error_string = %(\n INSTALL PUPPET: Unable to retrieve puppet.conf\n template from #{options['hosts_file']} or agent #{agent}\n )\n\n if user_template_exists?\n puppet_config = puppet_config_tohash(template_config)\n elsif agent_template_exists?(agent)\n puppet_config = puppet_config_tohash(get_agent_config(agent))\n else\n fail error_string\n end\n\n # Add certname and server values to main section\n puppet_config['main']['certname'] = agent['ip']\n puppet_config['main']['server'] = master['ip']\n\n puppet_config\nend", "def generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n @ssh.write \"/tmp/node.json\", content: JSON.generate(run_list), sudo: true\n end", "def create_custom_nginx_template(filename)\n node[:engineyard][:environment][:apps].each do |app|\n template \"/etc/nginx/servers/#{app[:name]}/#{filename}\" do\n source \"#{filename}.erb\"\n owner node[:users][0][:username]\n group node[:users][0][:username]\n mode 0644\n end\n end\nend", "def server_create(server_name, template)\n # calculate instance id\n Puppet.debug \"template keys => \" + JSON.pretty_generate(template)\n\n server_id, server_host = ::Pinas::Common.extract_instance_id_from(server_name)\n\n # 1. setup the default options\n options = {\n :name => server_name,\n :flavor_ref => get_flavor(template[:flavor_name]), # For Openstack provider\n :image_ref => get_image(template[:image_name]), # For Openstack provider\n :flavor_id => get_flavor(template[:flavor_name]), # For HPCloud provider\n :image_id => get_image(template[:image_name]), # For HPCloud provider\n :key_name => template[:key_name],\n :security_groups => template[:security_groups],\n }\n Puppet.debug \"setup default options = >\" + JSON.pretty_generate(options)\n # 2. setup the meta data/user data for the server, for boot hooks\n begin\n options[:metadata] = meta_to_hash(ERB.new(template[:meta_data]).result(binding)) if template.has_key?(:meta_data)\n rescue Exception => e\n Puppet.crit \"servers.create in running erb for :metadata, Error: #{e}\"\n raise Puppet::Error, \"Error : #{e}\"\n end\n begin\n options[:user_data] = ERB.new(File.read(template[:user_data])).result(binding) if template.has_key?(:user_data)\n rescue Exception => e\n Puppet.crit \"servers.create in running erb for :user_data, Error: #{e}\"\n raise Puppet::Error, \"Error : #{e}\"\n end\n Puppet.debug \"added metadata and user_data\"\n Puppet.debug \"has network_name key ? #{template.has_key?(:network_name)}\"\n Puppet.debug \"network class => #{network.class}\"\n Puppet.debug \"template[:network_name] => #{template[:network_name]}\"\n Puppet.debug \"template[:network_name] => #{template['network_name']}\"\n # 3. get the network uuid and name\n if @network != nil and template.has_key?(:network_name) and template[:network_name] != ''\n Puppet.debug \"adding network #{template[:network_name]}\"\n networks = Array.new\n nics = Array.new\n nics << get_networkid(template[:network_name])\n # nics << template[:network_name]\n Puppet.debug \"working on nics => #{nics}.\"\n begin\n nics.each do |net|\n Puppet.debug \"working on net => #{net}\"\n network = find_match(@network.networks, net)\n networks.push('net_id' => network.id) if network\n end\n options[:nics] = networks\n rescue Exception => e\n raise Puppet::Error, \"Problem assigning nics, #{e}\"\n end\n Puppet.debug \"after options, got = >\" + JSON.pretty_generate(options)\n end\n # 4. create new server and wait for it to be ready.\n # TODO: implement retryable and wait for code. need to confirm we have a timeout in fog.\n # server = @compute.servers.create(options)\n # retryable(on: Timeout::Error, tries: 200) do\n # begin\n # server.wait_for(30) { ready? }\n # rescue RuntimeError, Fog::Errors::TimeoutError => e\n # end\n # end\n Puppet.debug \"attempting to create server #{server_name}\"\n new_server = nil\n begin\n new_server = @compute.servers.create(options)\n new_server.wait_for { ready?}\n new_server.wait_for { !addresses.nil? }\n rescue Exception => e\n Puppet.crit \"servers.create Error: #{e}\"\n raise Puppet::Error, \"Error : #{e}\"\n end\n\n Puppet.notice \"server created #{server_name} on net #{template[:network_name]} \"\n begin\n newserver_ip_assign(new_server)\n rescue Exception => e\n Puppet.crit \"server_ip_assign Error: #{e}\"\n raise Puppet::Error, \"Error : #{e}\"\n end\n\n end", "def create\n create_role_directory\n generate_manifests_file\n end", "def cluster_template(config)\n template = <<~YAML\n '$schema': https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#\n contentVersion: 1.0.0.0\n parameters: {}\n variables: {}\n resources:\n - type: Microsoft.ContainerService/managedClusters\n name: <%= context[:name] %>\n apiVersion: '2019-06-01'\n location: #{@region}\n tags:\n cluster: <%= context[:name] %>\n properties:\n kubernetesVersion: <%= context[:version] %>\n dnsPrefix: <%= context[:name] %>\n addonProfiles:\n httpapplicationrouting:\n enabled: true\n config:\n HTTPApplicationRoutingZoneName: <%= context[:domain] %>\n agentPoolProfiles:\n - name: compute\n count: <%= context[:size] %>\n maxPods: 110\n osDiskSizeGB: <%= context[:disk_size_gb] %>\n osType: Linux\n storageProfile: ManagedDisks\n type: VirtualMachineScaleSets\n vmSize: <%= context[:machine_type] %>\n servicePrincipalProfile:\n clientId: #{@client_id}\n secret: #{@client_secret}\n linuxProfile:\n adminUsername: azureuser\n <%- unless (context[:ssh_key] || '').empty? -%>\n ssh:\n publicKeys:\n - keyData: <%= context[:ssh_key] %>\n <%- end -%>\n enableRBAC: true\n enablePodSecurityPolicy: true\n networkProfile:\n dnsServiceIP: 10.0.0.10\n dockerBridgeCidr: 172.17.0.1/16\n loadBalancerSku: basic\n networkPlugin: azure\n networkPolicy: azure\n serviceCidr: <%= context[:services_ipv4_cidr].empty? ? '10.0.0.0/16' : context[:services_ipv4_cidr] %>\n YAML\n HubClustersCreator::Utils::Template::Render.new(config).render(template)\n end", "def add_node(name, parent, content: nil, attribute: false)\n unless String === name\n name = name.attributes['name'].value\n end\n\n node = BuildNode.new(name, parent: parent, attribute: attribute)\n\n if content\n node.contents << content\n end\n\n parent.children << node\n\n node\n end", "def load_main_manifest\n parser = Parser::EvaluatingParser.singleton\n parsed_code = Puppet[:code]\n program = if parsed_code != \"\"\n parser.parse_string(parsed_code, 'unknown-source-location')\n else\n file = @environment.manifest\n\n # if the manifest file is a reference to a directory, parse and combine\n # all .pp files in that directory\n if file == Puppet::Node::Environment::NO_MANIFEST\n nil\n elsif File.directory?(file)\n raise Puppet::Error, \"manifest of environment '#{@environment.name}' appoints directory '#{file}'. It must be a file\"\n elsif File.exist?(file)\n parser.parse_file(file)\n else\n raise Puppet::Error, \"manifest of environment '#{@environment.name}' appoints '#{file}'. It does not exist\"\n end\n end\n instantiate_definitions(program, public_environment_loader) unless program.nil?\n program\n rescue Puppet::ParseErrorWithIssue => detail\n detail.environment = @environment.name\n raise\n rescue => detail\n msg = _('Could not parse for environment %{env}: %{detail}') % { env: @environment, detail: detail }\n error = Puppet::Error.new(msg)\n error.set_backtrace(detail.backtrace)\n raise error\n end", "def set_creator_node(fnode)\n @node.set_creator_node(fnode)\n end", "def get_stackdata(node, attribute = nil)\n data = {}\n\n data['environment'] = node['easybib_deploy']['envtype']\n\n if ::EasyBib.is_aws(node)\n data['stackname'] = node['opsworks']['stack']['name']\n elsif node['vagrant']\n data['stackname'] = 'vagrant'\n data['environment'] = 'vagrant'\n else\n data['stackname'] = 'undefined'\n end\n\n unless attribute.nil?\n return data[attribute]\n end\n\n data\n end", "def apply_manifest_on(host, manifest, opts = {}, &block)\n on_options = {:stdin => manifest + \"\\n\"}\n on_options[:acceptable_exit_codes] = opts.delete(:acceptable_exit_codes)\n args = [\"--verbose\"]\n args << \"--parseonly\" if opts[:parseonly]\n args << \"--trace\" if opts[:trace]\n\n if opts[:catch_failures]\n args << '--detailed-exitcodes'\n\n # From puppet help:\n # \"... an exit code of '2' means there were changes, an exit code of\n # '4' means there were failures during the transaction, and an exit\n # code of '6' means there were both changes and failures.\"\n # We're after failures specifically so catch exit codes 4 and 6 only.\n on_options[:acceptable_exit_codes] |= [0, 2]\n end\n\n # Not really thrilled with this implementation, might want to improve it\n # later. Basically, there is a magic trick in the constructor of\n # PuppetCommand which allows you to pass in a Hash for the last value in\n # the *args Array; if you do so, it will be treated specially. So, here\n # we check to see if our caller passed us a hash of environment variables\n # that they want to set for the puppet command. If so, we set the final\n # value of *args to a new hash with just one entry (the value of which\n # is our environment variables hash)\n if opts.has_key?(:environment)\n args << { :environment => opts[:environment]}\n end\n\n on host, puppet( 'apply', *args), on_options, &block\n end", "def clone_node(dc_name)\n # only clone virtual nodes\n return nil unless node_type.is_virtual?\n # can't clone to yourself. redendent below but less work\n dc = Datacenter.find_by_name(dc_name)\n return nil if dc.name == datacenter.name\n # can't clone an existing node. \n x = Node.find_by_name(hostname, dc.name)\n return x unless x.nil?\n mgmt_cluster = Cluster.find_mgmt_cluster_by_location(dc.name)\n # clone me!\n aNode = clone()\n aNode.datacenter = dc\n aNode.mgmt_ip_address = nil \n aNode.save\n aNode.mgmt_ip_address = Cluster.add_node_to_cluster(mgmt_cluster, aNode)\n aNode.save\n # clone nics\n nics.each{|n| \n aNode.nics << n\n }\n # clone all non-mgmt clusters\n cluster_nodes.each {|cn|\n if cn.cluster.vlan != 4000 then\n ClusterNode.create({:cluster_id => cn.cluster_id, :node_id => aNode.id, :ip_address => cn.ip_address })\n end\n }\n aNode\n end", "def CreateDefault\n @Behaviour = :one\n tmp_hex_ip = @hostid\n @tomerge = Builtins.add(@tomerge, tmp_hex_ip)\n while Builtins.size(tmp_hex_ip) != 1\n tmp_hex_ip = Builtins.substring(\n tmp_hex_ip,\n 0,\n Ops.subtract(Builtins.size(tmp_hex_ip), 1)\n )\n @tomerge = Builtins.add(@tomerge, tmp_hex_ip)\n end\n @tomerge = Builtins.add(@tomerge, Builtins.toupper(@mac))\n @tomerge = Builtins.add(@tomerge, Builtins.tolower(@mac))\n @tomerge = Builtins.add(@tomerge, \"default\")\n Builtins.y2milestone(\"Created default rules=%1\", @tomerge)\n nil\n end", "def manifest_name\n \"MANIFEST.#{name}\"\n end", "def generate_environment(options)\n modulepath = options[:modulepath]\n manifestpath = options[:manifestpath]\n env_name = options[:env_name]\n\n environment = <<-MANIFEST_SNIPPET\n file {\n ###################################################\n # #{env_name}\n #{generate_module(\"testing_mod\", env_name, modulepath)}\n\n \"#{manifestpath}\":;\n \"#{manifestpath}/site.pp\":\n ensure => file,\n content => '\n notify { \"in #{env_name} site.pp\": }\n include testing_mod\n '\n ;\n }\n MANIFEST_SNIPPET\n end", "def define_vm config, role, index, ip, memory = 512\n id = (index + 1).to_s.rjust(3, '0')\n config.vm.define \"#{role}_#{id}\" do |box|\n box.vm.customize [ \"modifyvm\", :id, \"--memory\", memory ]\n box.vm.box = \"centos_6_3\"\n box.vm.box_url = \"https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box\"\n box.vm.network :hostonly, \"192.168.34.#{ip}\", :netmask => \"255.255.255.0\"\n box.vm.host_name = \"#{role.downcase.gsub(/[^a-z0-9]+/, '-')}-#{id}.esi.dev\"\n #box.vm.provision :shell, :path => \"script/bootstrap-vm.sh\"\n box.vm.provision :puppet, :module_path => \"modules\" do |p|\n p.manifests_path = \"manifests\"\n p.manifest_file = \"site.pp\"\n end\n end\nend", "def write_manifest_file\n render_template(resource_path(\"AppxManifest.xml.erb\"),\n destination: \"#{windows_safe_path(project.install_dir)}/AppxManifest.xml\",\n variables: {\n name: project.package_name,\n friendly_name: project.friendly_name,\n version: windows_package_version,\n maintainer: project.maintainer,\n certificate_subject: certificate_subject.gsub('\"', \"&quot;\"),\n })\n end", "def createPuppetMasterEnv(json_loaded)\n git_working_dir = json_loaded['environment_path']\n git_buildoop_branch = json_loaded['environment_branch']\n puppet_environment = json_loaded['environment_cluster']\n\n @outputHandler.msgOutput 'Patch to environments: ' + git_working_dir\n @outputHandler.msgOutput 'Based on Buildoop branch: ' + git_buildoop_branch\n\n # git staff\n g = Git.open(git_working_dir, :log => Logger.new(STDOUT))\n g.branches.remote\n g.branch(git_buildoop_branch).checkout\n\n if confirm_action? \"the /etc/puppet/environments/#{puppet_environment} will be erased,\"\n FileUtils.rm_rf(\"/etc/puppet/environments/#{puppet_environment}\")\n\n # copy environment to puppet location\n FileUtils.cp_r git_working_dir + \"/all\", \n '/etc/puppet/environments', :verbose => true\n FileUtils.cp_r git_working_dir + \"/cluster-name\", \n \"/etc/puppet/environments/#{puppet_environment}\", :verbose => true\n\n fillExtlookupCSV json_loaded\n end\n end", "def xmlinstall\n\n\t\tif !File.exists?(resource[:xml_file])\n\t\t\tdebug \"Creating the XML file: %s \" % resource[:xml_file]\n\n\t\t\tcase resource[:virt_type]\n\t\t\t\twhen :openvz then\n\t\t\t\t\tdebug \"Detected hypervisor type: %s \" % resource[:virt_type]\n\t\t\t\t\ttmplcache = resource[:tmpl_cache]\n\t\t\t\t\txargs = \"-c openvz:///system define --file \"\n\t\t\t\t\tif !tmplcache.nil?\n\t\t\t\t\t\trequire \"erb\"\n\t\t\t\t\t\txmlovz = File.new(resource[:xml_file], APPEND)\n\t\t\t\t\t\txmlwrite = ERB.new(\"puppet-virt/templates/ovz_xml.erb\")\n\t\t\t\t\t\txmlovz.puts = xmlwrite.result\n\t\t\t\t\t\txmlovz.close\n\t\t\t\t\telse\n\t\t\t\t\t\tfail(\"OpenVZ Error: No template cache define!\")\n\t\t\t\t\tend\n\t\t\t\telse debug \"Detected hypervisor type: %s \" % resource[:virt_type]\n\t\t\t\t\txargs = \"-c qemu:///session define --file \"\n\t\t\t\t\trequire \"erb\"\n\t\t\t\t\txmlqemu = File.new(resource[:xml_file], APPEND)\n\t\t\t\t\txmlwrite = ERB.new(\"puppet-virt/templates/qemu_xml.erb\")\n\t\t\t\t\txmlqemu.puts = xmlwrite.result\n\t\t\t\t\txmlqemu.close\n\t\t\t\tend\n\t\n\t\t\tdebug \"Creating the domain: %s \" % [resource[:name]]\n\t\t\tvirsh xargs + resource[:xml_file]\n\t\telse\n\t\t\tfail(\"Error: XML already exists on disk \" + resource[:xml_file] + \".\" )\t\n\t\tend\n\tend", "def create_site\n # create it in the default locale\n Mounter.with_locale(self.default_locale) do\n self.output_locale\n\n self.output_resource_op self.site\n\n if (site = self.post(:sites, self.site.to_hash(false), Mounter.locale)).nil?\n raise Mounter::WriterException.new('Sorry, we are unable to create the site.')\n else\n self.site._id = site['id']\n self.output_resource_op_status self.site\n end\n end\n\n # update it in other locales\n self.update_site(true)\n end", "def apply_manifest_on(host, manifest, options={}, &block)\n on_options = {:stdin => manifest + \"\\n\"}\n on_options[:acceptable_exit_codes] = options.delete(:acceptable_exit_codes) if options.keys.include?(:acceptable_exit_codes)\n args = [\"--verbose\"]\n args << \"--parseonly\" if options[:parseonly]\n args << \"--trace\" if options[:trace]\n\n if options[:catch_failures]\n args << '--detailed-exitcodes'\n\n # From puppet help:\n # \"... an exit code of '2' means there were changes, an exit code of '4' means there were\n # failures during the transaction, and an exit code of '6' means there were both\n # changes and failures.\"\n # We're after failures specifically so catch exit codes 4 and 6 only.\n on_options[:acceptable_exit_codes] = [0, 2]\n end\n\n # Not really thrilled with this implementation, might want to improve it later. Basically, there is a magic\n # trick in the constructor of PuppetCommand which allows you to pass in a Hash for the last value in the *args\n # Array; if you do so, it will be treated specially. So, here we check to see if our caller passed us a hash\n # of environment variables that they want to set for the puppet command. If so, we set the final value of\n # *args to a new hash with just one entry (the value of which is our environment variables hash)\n args << { :environment => options[:environment]} if options.has_key?(:environment)\n\n on host, puppet_apply(*args), on_options, &block\n end", "def get_setuptools\n\t\tpackage_name = \"python-setuptools\"\n\t\tcase node.platform\n\t\twhen /fedora|redhat|centos|ubuntu/\n\t\t package_name = \"python-setuptools\"\n\t\tend\n\t\tpackage_name\n\tend", "def manifest\n fail ResourceNotFound, \"#{full_repo_name} does not exist\" unless repo_exists?\n fail ResourceNotPublic, \"#{full_repo_name} is not public\" unless public?\n fail ManifestMissing, \"#{full_repo_name} has no manifest\" unless manifest_exists?\n fail ResourceNotIndexable, \"#{full_repo_name} cannot be indexed\" unless indexable?\n\n @manifest ||= {\n url: url,\n name: name,\n category: category,\n description: description,\n tags: tags,\n readme: readme\n }\n end", "def build_host_name\n if @build_host_template_name.nil?\n validate_platform\n @build_host_template_name = @platform.vmpooler_template\n end\n\n @build_host_template_name\n end", "def node_template_data\n {'node' => @node, @node['classification'] => @node}\n end", "def create_gemfile\n unless options[:skip_gemfile]\n puts \"Create #{name} gemfile manifest\"\n end\n end", "def add_resource_pools_to_manifest(manifest)\n if any_service_nodes?\n config.each do |cluster|\n server_count = cluster[\"count\"]\n server_flavor = cluster[\"flavor\"]\n resource_pool = {\n \"name\" => cluster_name(cluster),\n \"network\" => \"default\",\n \"size\" => server_count,\n \"stemcell\" => {\n \"name\" => system_config.stemcell_name,\n \"version\" => system_config.stemcell_version\n },\n # TODO how to create \"cloud_properties\" per-provider?\n \"cloud_properties\" => {\n \"instance_type\" => server_flavor\n },\n \"persistent_disk\" => system_config.common_persistent_disk\n }\n manifest[\"resource_pools\"] << resource_pool\n end\n end\n end", "def generate\n generate_manifest\n fix_windows_manifest\n end", "def manifest\n if !@manifest.is_a?(Condenser::Manifest) && @manifest.respond_to?(:call)\n @manifest = @manifest.call\n else\n @manifest\n end\n end", "def render_defaults\n template '/etc/default/haproxy' do\n cookbook 'consul-haproxy'\n source 'haproxy_defaults.erb'\n mode '0644'\n action :create\n end\nend", "def generate(site)\n end" ]
[ "0.7470808", "0.72417575", "0.6050029", "0.6050029", "0.582662", "0.5364564", "0.5363732", "0.5279123", "0.5262483", "0.5093455", "0.50499946", "0.5011684", "0.4840369", "0.47749773", "0.47224563", "0.46902674", "0.46900573", "0.46787798", "0.46635938", "0.4632619", "0.46291584", "0.46256673", "0.45404848", "0.4540248", "0.4520946", "0.45072263", "0.448154", "0.44759485", "0.44002107", "0.4399211", "0.43890756", "0.4386262", "0.43782887", "0.43693495", "0.43636602", "0.43595845", "0.435144", "0.43226117", "0.43210316", "0.43184996", "0.43171424", "0.429368", "0.42858025", "0.4280719", "0.4270943", "0.4254819", "0.42515337", "0.42515337", "0.4221745", "0.42182404", "0.42114818", "0.42060918", "0.41964078", "0.4193847", "0.41753638", "0.4172729", "0.4169311", "0.4159187", "0.414617", "0.4145157", "0.41349036", "0.4131218", "0.4126664", "0.41259316", "0.41183862", "0.41142973", "0.4107847", "0.4101723", "0.41013455", "0.4101095", "0.41000813", "0.4093672", "0.40935656", "0.4085278", "0.40763938", "0.40747437", "0.40701616", "0.4058961", "0.4056912", "0.40512872", "0.40512666", "0.40510905", "0.40475827", "0.4046912", "0.4046408", "0.40433222", "0.4040242", "0.40298724", "0.40231788", "0.40091228", "0.4005922", "0.40058038", "0.40029058", "0.3994214", "0.39858288", "0.39833555", "0.39773288", "0.3973285", "0.39719468", "0.39698064" ]
0.7306205
1
Read a Puppet manifest file and inject the content into a "default" node definition. (Used mostly to overide site.pp) ==== Attributes +manifest_path+ The file path to target manifest. +master_certname+ Certificate name of Puppet master. ==== Returns +string+ A combined manifest with node definition containg input manifest ==== Examples site_pp = create_node_manifest("/tmp/test.pp", "master")
def create_node_manifest(manifest_path, master_certname, node_def_name='default') manifest = File.read(manifest_path) site_pp = <<-MANIFEST filebucket { 'main': server => '#{master_certname}', path => false, } File { backup => 'main' } node default { #{manifest} } MANIFEST return site_pp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_site_pp(master_host, opts = {})\n opts[:manifest] ||= ''\n opts[:node_def_name] ||= 'default'\n master_certname = on(master_host, puppet('config print certname')).stdout.rstrip\n\n default_def = <<-MANIFEST\nnode default {\n}\nMANIFEST\n\n node_def = <<-MANIFEST\nnode #{opts[:node_def_name]} {\n\n#{opts[:manifest]}\n}\nMANIFEST\n\n if opts[:node_def_name] != 'default'\n node_def = \"#{default_def}\\n#{node_def}\"\n end\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\n#{node_def}\nMANIFEST\n\n return site_pp\n end", "def create_site_pp(master_certname, manifest='', node_def_name='default')\n default_def = <<-MANIFEST\nnode default {\n}\nMANIFEST\n\n node_def = <<-MANIFEST\nnode #{node_def_name} {\n\n#{manifest}\n}\nMANIFEST\n\n if node_def_name != 'default'\n node_def = \"#{default_def}\\n#{node_def}\"\n end\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\n#{node_def}\nMANIFEST\n\n return site_pp\nend", "def manifest\n root + '.node.yml'\n end", "def set_sitepp_content(manifest)\n content = <<-HERE\n node default {\n #{manifest}\n }\n HERE\n\n master.run_shell(\"echo '#{content}' > /etc/puppetlabs/code/environments/production/manifests/site.pp\")\nend", "def set_sitepp_content(manifest)\n content = <<-HERE\n node default {\n #{manifest}\n }\n HERE\n\n master.run_shell(\"echo '#{content}' > /etc/puppetlabs/code/environments/production/manifests/site.pp\")\nend", "def create_manifest_file(manifest)\n target_node_name = ENV['TARGET_HOST']\n manifest_file = Tempfile.new(['manifest_', '.pp'])\n manifest_file.write(manifest)\n manifest_file.close\n if target_node_name.nil? || target_node_name == 'localhost'\n # no need to transfer\n manifest_file_location = manifest_file.path\n else\n # transfer to TARGET_HOST\n command = \"bundle exec bolt file upload #{manifest_file.path} /tmp/#{File.basename(manifest_file)} --nodes #{target_node_name} --inventoryfile inventory.yaml\"\n stdout, stderr, status = Open3.capture3(command)\n error_message = \"Attempted to run\\ncommand:'#{command}'\\nstdout:#{stdout}\\nstderr:#{stderr}\"\n raise error_message unless status.to_i.zero?\n\n manifest_file_location = \"/tmp/#{File.basename(manifest_file)}\"\n end\n manifest_file_location\n end", "def create_manifest_file(manifest, opts = {})\n require 'tmpdir'\n target_node_name = ENV.fetch('TARGET_HOST', nil)\n tmp_filename = File.join(Dir.tmpdir, \"manifest_#{Time.now.strftime('%Y%m%d')}_#{Process.pid}_#{rand(0x100000000).to_s(36)}.pp\")\n manifest_file = File.open(tmp_filename, 'w')\n manifest_file.write(manifest)\n manifest_file.close\n if target_node_name.nil? || target_node_name == 'localhost'\n # no need to transfer\n manifest_file_location = manifest_file.path\n else\n # transfer to TARGET_HOST\n inventory_hash = inventory_hash_from_inventory_file\n target_option = opts['targets'] || opts[:targets]\n target_node_name = search_for_target(target_option, inventory_hash) unless target_option.nil?\n\n manifest_file_location = File.basename(manifest_file)\n bolt_result = upload_file(manifest_file.path, manifest_file_location, target_node_name, options: {}, config: nil, inventory: inventory_hash)\n raise bolt_result.first['value'].to_s unless bolt_result.first['status'] == 'success'\n end\n\n manifest_file_location\n end", "def set_sitepp_content(manifest)\n content = <<-HERE\n node default {\n #{manifest}\n }\n HERE\n\n puppetserver.run_shell(\"echo '#{content}' > /etc/puppetlabs/code/environments/production/manifests/site.pp\")\nend", "def create_manifests_node\n Bebox::Provision.add_node_to_step_manifests(self.project_root, self)\n end", "def generate_manifests_file\n generate_file_from_template(\"#{templates_path}/puppet/roles/manifests/init.pp.erb\", \"#{self.path}/manifests/init.pp\", {role: self})\n end", "def inject_site_pp(master_host, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master_host, site_pp_path, manifest)\n\n set_perms_on_remote(master_host, site_pp_dir, '744')\n end", "def inject_site_pp(master_host, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master_host, site_pp_path, manifest)\n\n set_perms_on_remote(master_host, site_pp_dir, '0744')\n end", "def inject_site_pp(master, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master, site_pp_path, manifest)\n\n set_perms_on_remote(master, site_pp_dir, \"777\")\nend", "def apply_manifest(manifest, opts = {}, &block)\n apply_manifest_on(default, manifest, opts, &block)\n end", "def master_contents\n @master = <<-MASTER\n blueprint:\n name: #{spec_bp_name}\n description: This is for testing purposes\n icon:\n file : test.png\n content : (--- base64 encoded ---)\n documentation : 'http://openstack.org/forj'\n locations:\n modules:\n - src-repo: redstone\n git: https://review.forj.io/p/forj-oss/redstone\n puppet-apply: install\n - src-repo: config\n git: https://review.forj.io/p/oo-infra/config\n puppet-extra-modules: /opt/config/production/git/config/modules\n MASTER\n @master\n end", "def manifest\n fail ResourceNotFound, \"#{full_repo_name} does not exist\" unless repo_exists?\n fail ResourceNotPublic, \"#{full_repo_name} is not public\" unless public?\n fail ManifestMissing, \"#{full_repo_name} has no manifest\" unless manifest_exists?\n fail ResourceNotIndexable, \"#{full_repo_name} cannot be indexed\" unless indexable?\n\n @manifest ||= {\n url: url,\n name: name,\n category: category,\n description: description,\n tags: tags,\n readme: readme\n }\n end", "def read_manifest()\n if not File.exists?(MANIFEST)\n return {}\n end\n\n f = File.new(MANIFEST, \"r\")\n f.rewind()\n yml = f.read()\n f.close()\n return YAML.load(yml)\nend", "def manifest\n case manifest_path.extname.downcase.delete \".\"\n when \"json\"\n JSON.parse(File.read(manifest_path))\n when \"yml\", \"yaml\"\n YAML.load_file(manifest_path)\n end\n end", "def bootstrap_for_node\n bootstrap = Chef::Knife::Bootstrap.new\n bootstrap.name_args = [config[:fqdn]]\n bootstrap.config[:run_list] = get_config(:run_list).split(/[\\s,]+/)\n bootstrap.config[:secret_file] = get_config(:secret_file)\n bootstrap.config[:hint] = get_config(:hint)\n bootstrap.config[:ssh_user] = get_config(:ssh_user)\n bootstrap.config[:ssh_password] = get_config(:ssh_password)\n bootstrap.config[:ssh_port] = get_config(:ssh_port)\n bootstrap.config[:identity_file] = get_config(:identity_file)\n bootstrap.config[:chef_node_name] = get_config(:chef_node_name)\n bootstrap.config[:prerelease] = get_config(:prerelease)\n bootstrap.config[:bootstrap_version] = get_config(:bootstrap_version)\n bootstrap.config[:distro] = get_config(:distro)\n bootstrap.config[:use_sudo] = true unless get_config(:ssh_user) == 'root'\n bootstrap.config[:template_file] = get_config(:template_file)\n bootstrap.config[:environment] = get_config(:environment)\n bootstrap.config[:first_boot_attributes] = get_config(:first_boot_attributes)\n bootstrap.config[:log_level] = get_config(:log_level)\n # may be needed for vpc_mode\n bootstrap.config[:no_host_key_verify] = get_config(:no_host_key_verify)\n bootstrap\n end", "def load_main_manifest\n parser = Parser::EvaluatingParser.singleton\n parsed_code = Puppet[:code]\n program = if parsed_code != \"\"\n parser.parse_string(parsed_code, 'unknown-source-location')\n else\n file = @environment.manifest\n\n # if the manifest file is a reference to a directory, parse and combine\n # all .pp files in that directory\n if file == Puppet::Node::Environment::NO_MANIFEST\n nil\n elsif File.directory?(file)\n raise Puppet::Error, \"manifest of environment '#{@environment.name}' appoints directory '#{file}'. It must be a file\"\n elsif File.exist?(file)\n parser.parse_file(file)\n else\n raise Puppet::Error, \"manifest of environment '#{@environment.name}' appoints '#{file}'. It does not exist\"\n end\n end\n instantiate_definitions(program, public_environment_loader) unless program.nil?\n program\n rescue Puppet::ParseErrorWithIssue => detail\n detail.environment = @environment.name\n raise\n rescue => detail\n msg = _('Could not parse for environment %{env}: %{detail}') % { env: @environment, detail: detail }\n error = Puppet::Error.new(msg)\n error.set_backtrace(detail.backtrace)\n raise error\n end", "def manifest\n manifest_file = project_path( \"Manifest.txt\" )\n abort \"You need a Manifest.txt\" unless manifest_file.readable?\n manifest_file.readlines.map { |l| l.strip }\n end", "def pkg_manifest_file\n @pkg_manifest_file ||= File.join(staging_dir, \"#{safe_base_package_name}.p5m\")\n end", "def infer_manifest\n if file = root.glob('manifest{,.txt}', :casefold).first\n set :manifest, File.basename(file)\n end\n end", "def configure_manifest\n @configuration = YAML.load_file(manifest.to_s) if exist?\n end", "def create_puppetfile(puppetfile_contents)\n File.open('Puppetfile', 'w') do |file|\n file.write puppetfile_contents\n end\n end", "def manifest\n return refresh if config.auto_build\n\n @manifest ||= load_manifest\n end", "def apply_manifest_on(host, manifest, opts = {}, &block)\n on_options = {:stdin => manifest + \"\\n\"}\n on_options[:acceptable_exit_codes] = opts.delete(:acceptable_exit_codes)\n args = [\"--verbose\"]\n args << \"--parseonly\" if opts[:parseonly]\n args << \"--trace\" if opts[:trace]\n\n if opts[:catch_failures]\n args << '--detailed-exitcodes'\n\n # From puppet help:\n # \"... an exit code of '2' means there were changes, an exit code of\n # '4' means there were failures during the transaction, and an exit\n # code of '6' means there were both changes and failures.\"\n # We're after failures specifically so catch exit codes 4 and 6 only.\n on_options[:acceptable_exit_codes] |= [0, 2]\n end\n\n # Not really thrilled with this implementation, might want to improve it\n # later. Basically, there is a magic trick in the constructor of\n # PuppetCommand which allows you to pass in a Hash for the last value in\n # the *args Array; if you do so, it will be treated specially. So, here\n # we check to see if our caller passed us a hash of environment variables\n # that they want to set for the puppet command. If so, we set the final\n # value of *args to a new hash with just one entry (the value of which\n # is our environment variables hash)\n if opts.has_key?(:environment)\n args << { :environment => opts[:environment]}\n end\n\n on host, puppet( 'apply', *args), on_options, &block\n end", "def create\n create_hiera_template\n create_manifests_node\n create_node_checkpoint\n end", "def manifest_ttl\n @manifest_ttl = File.read(MANIFEST_FILE)\n end", "def puppet_master_install(opts = {}, &block)\n RSpecSystemPuppet::Helpers::PuppetMasterInstall.new(opts, self, &block)\n end", "def apply_manifest_on(host, manifest, options={}, &block)\n on_options = {:stdin => manifest + \"\\n\"}\n on_options[:acceptable_exit_codes] = options.delete(:acceptable_exit_codes) if options.keys.include?(:acceptable_exit_codes)\n args = [\"--verbose\"]\n args << \"--parseonly\" if options[:parseonly]\n args << \"--trace\" if options[:trace]\n\n if options[:catch_failures]\n args << '--detailed-exitcodes'\n\n # From puppet help:\n # \"... an exit code of '2' means there were changes, an exit code of '4' means there were\n # failures during the transaction, and an exit code of '6' means there were both\n # changes and failures.\"\n # We're after failures specifically so catch exit codes 4 and 6 only.\n on_options[:acceptable_exit_codes] = [0, 2]\n end\n\n # Not really thrilled with this implementation, might want to improve it later. Basically, there is a magic\n # trick in the constructor of PuppetCommand which allows you to pass in a Hash for the last value in the *args\n # Array; if you do so, it will be treated specially. So, here we check to see if our caller passed us a hash\n # of environment variables that they want to set for the puppet command. If so, we set the final value of\n # *args to a new hash with just one entry (the value of which is our environment variables hash)\n args << { :environment => options[:environment]} if options.has_key?(:environment)\n\n on host, puppet_apply(*args), on_options, &block\n end", "def apply_manifest(manifest, opts = {})\n target_node_name = targeting_localhost? ? 'litmus_localhost' : ENV.fetch('TARGET_HOST', nil)\n raise 'manifest and manifest_file_location in the opts hash are mutually exclusive arguments, pick one' if !manifest.nil? && !opts[:manifest_file_location].nil?\n raise 'please pass a manifest or the manifest_file_location in the opts hash' if (manifest.nil? || manifest == '') && opts[:manifest_file_location].nil?\n raise 'please specify only one of `catch_changes`, `expect_changes`, `catch_failures` or `expect_failures`' if\n [opts[:catch_changes], opts[:expect_changes], opts[:catch_failures], opts[:expect_failures]].compact.length > 1\n\n opts = { trace: true }.merge(opts)\n\n if opts[:catch_changes]\n use_detailed_exit_codes = true\n acceptable_exit_codes = [0]\n elsif opts[:catch_failures]\n use_detailed_exit_codes = true\n acceptable_exit_codes = [0, 2]\n elsif opts[:expect_failures]\n use_detailed_exit_codes = true\n acceptable_exit_codes = [1, 4, 6]\n elsif opts[:expect_changes]\n use_detailed_exit_codes = true\n acceptable_exit_codes = [2]\n else\n use_detailed_exit_codes = false\n acceptable_exit_codes = [0]\n end\n\n manifest_file_location = opts[:manifest_file_location] || create_manifest_file(manifest)\n inventory_hash = File.exist?('spec/fixtures/litmus_inventory.yaml') ? inventory_hash_from_inventory_file : localhost_inventory_hash\n\n target_option = opts['targets'] || opts[:targets]\n if target_option.nil?\n raise \"Target '#{target_node_name}' not found in spec/fixtures/litmus_inventory.yaml\" unless target_in_inventory?(inventory_hash, target_node_name)\n else\n target_node_name = search_for_target(target_option, inventory_hash)\n end\n\n # Forcibly set the locale of the command\n locale = if os[:family] == 'windows'\n ''\n else\n 'LC_ALL=en_US.UTF-8 '\n end\n command_to_run = \"#{locale}#{opts[:prefix_command]} puppet apply #{manifest_file_location}\"\n command_to_run += ' --trace' if !opts[:trace].nil? && (opts[:trace] == true)\n command_to_run += \" --modulepath #{Dir.pwd}/spec/fixtures/modules\" if target_node_name == 'litmus_localhost'\n command_to_run += \" --hiera_config='#{opts[:hiera_config]}'\" unless opts[:hiera_config].nil?\n command_to_run += ' --debug' if !opts[:debug].nil? && (opts[:debug] == true)\n command_to_run += ' --noop' if !opts[:noop].nil? && (opts[:noop] == true)\n command_to_run += ' --detailed-exitcodes' if use_detailed_exit_codes == true\n\n if os[:family] == 'windows'\n # IAC-1365 - Workaround for BOLT-1535 and bolt issue #1650\n command_to_run = \"try { #{command_to_run}; exit $LASTEXITCODE } catch { write-error $_ ; exit 1 }\"\n bolt_result = Tempfile.open(['temp', '.ps1']) do |script|\n script.write(command_to_run)\n script.close\n run_script(script.path, target_node_name, [], options: {}, config: nil, inventory: inventory_hash)\n end\n else\n bolt_result = run_command(command_to_run, target_node_name, config: nil, inventory: inventory_hash)\n end\n result = OpenStruct.new(exit_code: bolt_result.first['value']['exit_code'],\n stdout: bolt_result.first['value']['stdout'],\n stderr: bolt_result.first['value']['stderr'])\n\n status = result.exit_code\n if opts[:catch_changes] && !acceptable_exit_codes.include?(status)\n report_puppet_apply_change(command_to_run, bolt_result)\n elsif !acceptable_exit_codes.include?(status)\n report_puppet_apply_error(command_to_run, bolt_result, acceptable_exit_codes)\n end\n\n yield result if block_given?\n\n if ENV['RSPEC_DEBUG']\n puts \"apply manifest succeded\\n #{command_to_run}\\n======\\nwith status #{result.exit_code}\"\n puts result.stderr\n puts result.stdout\n end\n result\n end", "def generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n ssh.write \"#{CHEF_VAR_PATH}/node.json\", content: JSON.generate(run_list), sudo: true\n end", "def manifest_name\n \"MANIFEST.#{name}\"\n end", "def verify_manifest(theme_path)\n manifest_path = File.join(theme_path, \"manifest.yml\")\n manifest_file = File.open( manifest_path )\n abort(\"rake aborted: repo must contain valid manifest.yml\") unless File.exist? manifest_file\n manifest = YAML.load( manifest_file )\n manifest_file.close\n manifest\nend", "def stored_manifest\n @stored_manifest ||= directory.files.get(\"#{manifest.name}-#{version}.json\")\n end", "def write_manifest_file\n render_template(resource_path(\"AppxManifest.xml.erb\"),\n destination: \"#{windows_safe_path(project.install_dir)}/AppxManifest.xml\",\n variables: {\n name: project.package_name,\n friendly_name: project.friendly_name,\n version: windows_package_version,\n maintainer: project.maintainer,\n certificate_subject: certificate_subject.gsub('\"', \"&quot;\"),\n })\n end", "def create_stored_manifest\n unless stored_manifest\n @stored_manifest = directory.files.new(:body => components.to_json, :key => \"#{manifest.name}-#{version}.json\", :content_type => 'application/json')\n @stored_manifest.acl = 'public-read' if Manifesto.public_manifests?\n @stored_manifest.save\n create_current_manifest\n end\n end", "def create_test_file(host, file_rel_path, file_content, options)\n\n # set default options\n options[:mkdirs] ||= false\n options[:owner] ||= \"root\"\n options[:group] ||= \"puppet\"\n options[:mode] ||= \"755\"\n\n file_path = get_test_file_path(host, file_rel_path)\n\n mkdirs(host, File.dirname(file_path)) if (options[:mkdirs] == true)\n create_remote_file(host, file_path, file_content)\n\n#\n# NOTE: we need these chown/chmod calls because the acceptance framework connects to the nodes as \"root\", but\n# puppet 'master' runs as user 'puppet'. Therefore, in order for puppet master to be able to read any files\n# that we've created, we have to carefully set their permissions\n#\n\n chown(host, options[:owner], options[:group], file_path)\n chmod(host, options[:mode], file_path)\n\nend", "def create_test_file(host, file_rel_path, file_content, options)\n\n # set default options\n options[:mkdirs] ||= false\n options[:owner] ||= \"root\"\n options[:group] ||= \"puppet\"\n options[:mode] ||= \"755\"\n\n file_path = get_test_file_path(host, file_rel_path)\n\n mkdirs(host, File.dirname(file_path)) if (options[:mkdirs] == true)\n create_remote_file(host, file_path, file_content)\n\n#\n# NOTE: we need these chown/chmod calls because the acceptance framework connects to the nodes as \"root\", but\n# puppet 'master' runs as user 'puppet'. Therefore, in order for puppet master to be able to read any files\n# that we've created, we have to carefully set their permissions\n#\n\n chown(host, options[:owner], options[:group], file_path)\n chmod(host, options[:mode], file_path)\n\nend", "def manifest\n if File.exists?(manifest_file) && File.readable?(manifest_file) then\n MultiJson.load(File.read(manifest_file))\n else\n {}\n end\n end", "def send_manifest\n begin\n manifest = JSON.parse(File.read(@manifest))\n manifest['instanceId'] = \"#{Socket.gethostname}_#{SecureRandom.uuid}\" if @generate_instance_ids\n @instance_id = manifest['instanceId']\n rescue\n end\n send_message('APP_MANIFEST', manifest)\n end", "def environment_manifest(testdir)\n manifest = <<-MANIFEST\n File {\n ensure => directory,\n owner => puppet,\n mode => 0700,\n }\n\n file { \"#{testdir}\": }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/modules\",\n :manifestpath => \"#{testdir}/manifests\",\n :env_name => \"default environment\")}\n\n #{generate_environment(\n :modulepath => \"#{testdir}/testing-modules\",\n :manifestpath => \"#{testdir}/testing-manifests\",\n :env_name => \"legacy testing environment\")}\n\n file {\n \"#{testdir}/dynamic\":;\n \"#{testdir}/dynamic/testing\":;\n }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/dynamic/testing/modules\",\n :manifestpath => \"#{testdir}/dynamic/testing/manifests\",\n :env_name => \"dynamic testing environment\")}\n\n file {\n \"#{testdir}/environments\":;\n \"#{testdir}/environments/testing\":;\n }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/environments/testing/modules\",\n :manifestpath => \"#{testdir}/environments/testing/manifests\",\n :env_name => \"directory testing environment\")}\n\n file {\n \"#{testdir}/environments/testing_environment_conf\":;\n }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/environments/testing_environment_conf/nonstandard-modules\",\n :manifestpath => \"#{testdir}/environments/testing_environment_conf/nonstandard-manifests\",\n :env_name => \"directory testing with environment.conf\")}\n\n file { \"#{testdir}/environments/testing_environment_conf/environment.conf\":\n ensure => file,\n content => '\n modulepath = nonstandard-modules:$basemodulepath\n manifest = nonstandard-manifests\n config_version = local-version.sh\n '\n }\n\n file {\n \"#{testdir}/environments/testing_environment_conf/local-version.sh\":\n ensure => file,\n content => '#! /usr/bin/env bash\n echo \"local testing_environment_conf\"'\n ;\n }\n\n ###################\n # Services\n\n file {\n \"#{testdir}/services\":;\n \"#{testdir}/services/testing\":;\n #{generate_module('service_mod',\n \"service testing environment\",\n \"#{testdir}/services/testing/modules\")}\n }\n\n #######################\n # Config version script\n\n file {\n \"#{testdir}/static-version.sh\":\n ensure => file,\n content => '#! /usr/bin/env bash\n echo \"static\"'\n ;\n }\n MANIFEST\n end", "def create_temp_dir_env(master, env_root_path, env_seed_name, manifest)\n env_name = \"#{env_seed_name}\" + rand(36**16).to_s(36)\n env_path = \"#{env_root_path}/#{env_name}\"\n env_site_pp_path = \"#{env_path}/manifests/site.pp\"\n\n on(master, \"mkdir -p #{env_path}/manifests #{env_path}/modules\")\n set_perms_on_remote(master, env_path, \"777\")\n\n inject_site_pp(master, env_site_pp_path, manifest)\n\n return env_name\nend", "def node\n @node ||=\n begin\n node = Chef::Node.new(chef_server_rest: client_rest)\n node.name(node_name)\n node.run_list(normalized_run_list)\n node.normal_attrs = first_boot_attributes if first_boot_attributes\n node.environment(environment) if environment\n node.policy_name = policy_name if policy_name\n node.policy_group = policy_group if policy_group\n (config[:tags] || []).each do |tag|\n node.tags << tag\n end\n node\n end\n end", "def get_node(node_name)\n Chef::Config.from_file(\"/etc/chef/client.rb\")\n Chef::Config[:client_key] = \"/etc/chef/client.pem\"\n Chef::Config[:http_retry_count] = 5\n node = Chef::Node.load(node_name)\n end", "def manifest_path\n path = @config[\"manifest\"][\"path\"] if @config[\"manifest\"]\n return Licensed::Git.repository_root.join(path) if path\n\n @config.cache_path.join(\"manifest.json\")\n end", "def manifest\n return @manifest if @manifest\n result = []\n app_prefix = /^\\{app\\}\\//\n manifest_regexp = /#{manifest_name}$/\n files.each do |file|\n path, installed_path = file.source, file.dest\n next unless installed_path =~ app_prefix\n # Skip the MANIFEST file if it already exists. Should only happen \n # when doing a dirty build. \n # TODO - we should only skip if we're doing a dirty build; if we're \n # doing a normal build, and have a preexisting manifest, we should \n # fail hard. \n next if path =~ manifest_regexp \n digest = Digest::SHA1.hexdigest(IO.read(path))\n # TODO - Should use a struct, not an array.\n result << [digest, File.size(path), \n installed_path.gsub(app_prefix, '')]\n end\n @manifest = \n result.sort_by {|x| x[2] }.map {|x| \"#{x[0]} #{x[1]} #{x[2]}\\n\" }.join\n end", "def manifest\n if !@manifest.is_a?(Condenser::Manifest) && @manifest.respond_to?(:call)\n @manifest = @manifest.call\n else\n @manifest\n end\n end", "def manifest_path\n build_output_dir.join('manifest.json')\n end", "def pkg_metadata_file\n @pkg_metadata_file ||= File.join(staging_dir, \"gen.manifestfile\")\n end", "def manifest_file_name\n basename = \"#{name}.yml\"\n end", "def manifest_path\n Gym.cache[:manifest_path] ||= File.join(temporary_output_path, \"manifest.plist\")\n end", "def manifest\n @manifest\n end", "def add_jobs_to_manifest(manifest)\n if any_service_nodes?\n config.each do |cluster|\n server_count = cluster[\"count\"]\n server_flavor = cluster[\"flavor\"]\n job = {\n \"name\" => cluster_name(cluster),\n \"template\" => [job_node_name],\n \"instances\" => server_count,\n \"resource_pool\" => cluster_name(cluster),\n # TODO are these AWS-specific networks?\n \"networks\" => [{\n \"name\" => \"default\",\n \"default\" => [\"dns\", \"gateway\"]\n }],\n \"persistent_disk\" => system_config.common_persistent_disk\n }\n manifest[\"jobs\"] << job\n end\n end\n end", "def initialize\n json_string = File.read(MANIFEST_PATH)\n @manifest = JSON.parse json_string\n end", "def create_perconapuppet_fact(factname, varname)\n Facter.add(factname) do\n confine :kernel => :linux\n re = Regexp.new(\"^#-puppet-##{varname}[\\s=]+([^ ]+)$\")\n setcode do\n value = nil\n configfile = Facter.value(:mysqld_configfile)\n if File.readable?(configfile) and\n Facter::Util::Resolution.exec(\"cat #{configfile}\").match re\n value = $1\n end\n value\n end\n end\nend", "def bootstrap_for_node(server, bootstrap_ip)\n bootstrap = Chef::Knife::Bootstrap.new\n Chef::Log.debug(\"Bootstrap name_args = [ #{bootstrap_ip} ]\")\n bootstrap.name_args = [ bootstrap_ip ]\n\n Chef::Log.debug(\"Bootstrap run_list = #{config[:run_list]}\")\n bootstrap.config[:run_list] = config[:run_list]\n\n Chef::Log.debug(\"Bootstrap ssh_user = #{config[:ssh_user]}\")\n bootstrap.config[:ssh_user] = config[:ssh_user]\n\n Chef::Log.debug(\"Bootstrap chef_node_name = #{config[:chef_node_name]}\")\n bootstrap.config[:chef_node_name] = config[:chef_node_name] || server.id\n\n Chef::Log.debug(\"Bootstrap prerelease = #{config[:prerelease]}\")\n bootstrap.config[:prerelease] = config[:prerelease]\n\n Chef::Log.debug(\"Bootstrap distro = #{config[:distro]}\")\n bootstrap.config[:distro] = config[:distro]\n\n if config[:ssh_user] == 'root'\n bootstrap.config[:use_sudo] = false\n else\n bootstrap.config[:use_sudo] = true\n end\n\n Chef::Log.debug(\"Bootstrap use_sudo = #{bootstrap.config[:use_sudo]}\")\n\n bootstrap.config[:environment] = config[:environment]\n Chef::Log.debug(\"Bootstrap environment = #{bootstrap.config[:environment]}\")\n\n bootstrap.config[:no_host_key_verify] = config[:no_host_key_verify]\n Chef::Log.debug(\"Bootstrap no_host_key_verify = #{bootstrap.config[:no_host_key_verify]}\")\n\n bootstrap.config[:identity_file] = config[:identity_file]\n Chef::Log.debug(\"Bootstrap identity_file = #{bootstrap.config[:identity_file]}\")\n\n bootstrap.config[:ssh_gateway] = determine_ssh_gateway(bootstrap_ip)\n Chef::Log.debug(\"Bootstrap ssh_gateway= #{bootstrap.config[:ssh_gateway]}\")\n\n bootstrap.config[:first_boot_attributes] = config[:json_attributes]\n Chef::Log.debug(\"Bootstrap json_attributes = #{bootstrap.config[:json_attributes]}\")\n\n bootstrap\n end", "def run_manifest (manifest)\n if ENV.has_key? 'LOCAL_TEST'\n print 'Notice: Skipping apply_manifest changes, due to local test. Please run puppet apply manually with the manifest above.\\n'\n else\n # with local tests, we can't use beaker function like apply_manifest\n\n let(:manifest) { manifest }\n it 'should run without errors' do\n expect(apply_manifest(manifest, :catch_failures => true).exit_code).to eq(2)\n end\n\n it 'should re-run without changes' do\n expect(apply_manifest(manifest, :catch_changes => true).exit_code).to be_zero\n end\n end\nend", "def _create_chef_node(&block)\n step(\" creating chef node\", :green)\n @chef_node = Chef::Node.new\n @chef_node.name(fullname)\n set_chef_node_attributes\n set_chef_node_environment\n sync_ipconfig_attribute\n sync_volume_attributes\n chef_api_server_as_client.post_rest('nodes', @chef_node)\n end", "def find_nodes( manifest )\n # storing found node names with the node object into a hash\n found_nodes = {}\n \n lines = File.open( manifest ).readlines\n lines.each do |line|\n case line\n # skipping lines that match the following:\n when /^#|\\}/\n next\n \n # found node definition of puppet DSL. A @node instance variable, \n # containing Snode object is created, and used for all the lines coming after\n # until the next node definition.\n when /^node (\\S+).*\\{/\n node_name = line.split[1].gsub(/\\'|\"/,\"\")\n @node = SpkDashboard::SpkNode.new( node_name )\n found_nodes[node_name] = @node\n \n # dealing with node inheritance\n if line.match(/\\s+inherits\\s+/)\n super_node = line.split[3].gsub(/\\'|\"/,\"\")\n next if super_node == \"default\"\n super_obj = found_nodes[super_node]\n super_obj.params.each { |key, value| @node.add_param( key, value ) }\n super_obj.includes.each { |klass| @node.add_includes( klass ) }\n end\n \n # Find parameters and add them to the node object\n when /^\\s+\\$/\n pair = line.split(\" = \")\n key = pair.shift.gsub(/ /,'').delete(\"$\")\n value = pair.join.gsub(/^\\'|^\\\"|\\'$|\\\"$/,\"\").chomp\n # by the time we got our parameter we should have the node object created\n @node.add_param( key, value )\n\n # Find classes included and add them to the node object\n when /^\\s+include/\n klass = line.split.last.chomp\n @node.add_includes( klass ) unless klass == 'spk'\n end\n end\n \n return found_nodes\n end", "def get_template(path)\n if @mode == :production\n @manifest.serve(path)\n else\n @manifest.parse(path) if !@manifest.provides?(path) \n @manifest.serve(path)\n end\n end", "def retrieve_manifest(manifest, options = {})\n options = { :full => false, :tagged => false, :shallow => false, :non_ext => true }.update(options)\n\n @assets = []\n @parsed_manifests = []\n @controller = options[:controller]\n @action = options[:action]\n @shallow_retrieval = options[:shallow]\n\n @assets = meta_retrieve(root, manifest)\n @assets.uniq!\n\n @assets.map! { |asset| PathInfo.new(asset).abs } if options[:full]\n @assets.map! { |asset| tag(\"/#{asset.rel}\") } if options[:tagged]\n\n @assets\n end", "def create_gemfile\n unless options[:skip_gemfile]\n puts \"Create #{name} gemfile manifest\"\n end\n end", "def read_manifest\n\t\tif self.has_manifest?\n\t\t\tentries = self.manifest_file.readlines.map( &:chomp )\n\t\t\treturn Rake::FileList[ *entries ]\n\t\telse\n\t\t\tself.prompt.warn \"No manifest (%s): falling back to a default list\" %\n\t\t\t\t[ self.manifest_file ]\n\t\t\treturn self.default_manifest\n\t\tend\n\tend", "def get_site_pp_path(master_host, opts = {})\n opts[:env] ||= 'production'\n\n return File.join(get_manifests_path(master_host, opts), 'site.pp')\n end", "def manifest(type)\n type = type.downcase\n say \"Rendering #{type} manifest\", :green\n @values = parse_cloud_config\n @tf_output = parse_tf_state('terraform/terraform.tfstate') if options[:cloud] == 'aws'\n\n if options[:cloud] == 'aws'\n @private_subnet = IPAddr.new(@values['aws']['private_subnet']['network']).to_range.to_a\n @public_subnet = IPAddr.new(@values['aws']['public_subnet']['network']).to_range.to_a\n else\n @private_subnet = IPAddr.new(@values['gcp']['subnet_cidr']).to_range.to_a\n end\n\n @static_ip_vault = @private_subnet[11].to_s\n @static_ips_concourse = [@private_subnet[12]].map(&:to_s)\n @static_ip_prometheus_stack = @private_subnet[18].to_s\n\n case type\n when \"bosh\"\n directory(\"#{options[:cloud]}/deployments/bosh\", 'deployments/bosh')\n template(\"#{options[:cloud]}/bosh-vars.yml.erb\", 'config/bosh-vars.yml')\n copy_file(\"#{options[:cloud]}/docs/bosh.md\", \"docs/bosh.md\")\n template(\"#{options[:cloud]}/bin/bosh-install.sh.tt\", \"bin/bosh-install.sh\")\n chmod('bin/bosh-install.sh', 0755)\n\n when \"concourse\"\n directory(\"#{options[:cloud]}/deployments/concourse\", \"deployments/concourse\")\n copy_file(\"#{options[:cloud]}/docs/concourse.md\", \"docs/concourse.md\")\n template(\"#{options[:cloud]}/bin/concourse-deploy.sh.tt\", \"bin/concourse-deploy.sh\")\n chmod('bin/concourse-deploy.sh', 0755)\n ingress_add_entry(@values['concourse']['hostname'], @static_ips_concourse, port: 8080)\n\n when \"vault\"\n template(\"#{options[:cloud]}/deployments/vault/vault.yml.erb\", \"deployments/vault/vault.yml\")\n copy_file(\"#{options[:cloud]}/docs/vault.md\", \"docs/vault.md\")\n template(\"#{options[:cloud]}/bin/vault-deploy.sh.tt\", \"bin/vault-deploy.sh\")\n chmod('bin/vault-deploy.sh', 0755)\n ingress_add_entry(@values['vault']['hostname'], [@static_ip_vault], port: 8200)\n\n when \"ingress\"\n template(\"#{options[:cloud]}/deployments/ingress/ingress.yml.erb\", \"deployments/ingress/ingress.yml\")\n copy_file(\"#{options[:cloud]}/docs/ingress.md\", \"docs/ingress.md\")\n template(\"#{options[:cloud]}/bin/ingress-deploy.sh.tt\", \"bin/ingress-deploy.sh\")\n template(\"#{options[:cloud]}/bin/ingress-update.sh.tt\", \"bin/ingress-update.sh\")\n chmod('bin/ingress-deploy.sh', 0755)\n chmod('bin/ingress-update.sh', 0755)\n\n when \"prometheus\"\n directory(\"#{options[:cloud]}/deployments/prometheus\", \"deployments/prometheus\")\n copy_file(\"#{options[:cloud]}/docs/prometheus.md\", \"docs/prometheus.md\")\n template(\"#{options[:cloud]}/bin/prometheus-deploy.sh.tt\", \"bin/prometheus-deploy.sh\")\n chmod('bin/prometheus-deploy.sh', 0755)\n ingress_add_entry(@values['alertmanager']['hostname'], [@static_ip_prometheus_stack], port: 9093)\n ingress_add_entry(@values['grafana']['hostname'], [@static_ip_prometheus_stack], port: 3000)\n ingress_add_entry(@values['prometheus']['hostname'], [@static_ip_prometheus_stack], port: 9090)\n\n else\n say \"Manifest type not specified\"\n\n end\n end", "def execute_manifest\n # load manifest, it is on the root dir of the package\n root_new_files = @manifest_dir\n @log.debug(\"execute_manifest, search manifest in dir #{root_new_files}\")\n mani_filename = File.join(root_new_files, @manifest_fname)\n opt = YAML::load_file( mani_filename )\n if opt\n if opt.class == Hash\n arr_newdir = opt[:new_dir]\n version_title = opt[:version_title]\n arr_newfiles = opt[:new_file]\n @new_version_str = opt[:version_str]\n if version_title\n @log.info(\"Update description: #{version_title}\")\n end\n if arr_newdir\n # process all directories\n arr_newdir.each{|x| proc_dir_toinst(x, root_new_files)}\n end\n if arr_newfiles\n # process all single files\n arr_newfiles.each{|x| proc_file_toinst(x, root_new_files)}\n end\n else\n @log.error(\"Malformed manifest\")\n end\n else\n @log.error(\"Manifest file #{mani_filename} not found\")\n end\n rescue\n @log.error(\"Error on execute_manifest #{$!}\")\n raise(\"Errore nell'esecuzione del manifesto\")\n end", "def build_manifest(opts={})\n main_class = (opts[:main_class] ? randomize(opts[:main_class]) : nil)\n app_name = (opts[:app_name] ? randomize(opts[:app_name]) : nil)\n existing_manifest = nil\n meta_inf_exists = @entries.find_all{|item| item.name == 'META-INF/' }.length > 0\n\n @manifest = \"Manifest-Version: 1.0\\r\\n\"\n @manifest << \"Main-Class: #{main_class}\\r\\n\" if main_class\n @manifest << \"Application-Name: #{app_name}\\r\\n\" if app_name\n @manifest << \"Permissions: all-permissions\\r\\n\"\n @manifest << \"\\r\\n\"\n @entries.each { |e|\n next if e.name =~ %r|/$|\n if e.name == \"META-INF/MANIFEST.MF\"\n existing_manifest = e\n next\n end\n #next unless e.name =~ /\\.class$/\n @manifest << \"Name: #{e.name}\\r\\n\"\n #@manifest << \"SHA1-Digest: #{Digest::SHA1.base64digest(e.data)}\\r\\n\"\n @manifest << \"\\r\\n\"\n }\n if existing_manifest\n existing_manifest.data = @manifest\n else\n add_file(\"META-INF/\", '') unless meta_inf_exists\n add_file(\"META-INF/MANIFEST.MF\", @manifest)\n end\n end", "def create_deployment_manifest\n cloud_properties = {\n \"instance_type\" => \"m1.small\",\n }\n cloud_properties[\"persistent_disk\"] = flags[:disk] if flags[:disk]\n cloud_properties[\"static_ips\"] = ip_addresses\n director_uuid = Bosh::Gen::Models::BoshConfig.new.target_uuid\n manifest = Bosh::Gen::Models::DeploymentManifest.new(\n name, director_uuid,\n release_properties, cloud_properties, default_properties)\n manifest.jobs = job_manifests\n create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]\n end", "def prepare_manifest_for(entries)\n deploy_manifest\n end", "def manifest\n template \"#{favorite_cleaned}.txt\", 'Song.txt'\n end", "def provision(node)\n node_inventory = node.inventory\n node_ipaddress_fact = @config.settings[\"target\"][\"ipaddress_fact\"] || \"ipaddress\"\n master_ipaddress_fact = @config.settings[\"master\"][\"ipaddress_fact\"] || \"ipaddress\"\n\n raise \"Could not determine node ip address from fact #{node_ipaddress_fact}\" unless node_inventory[:facts].include?(node_ipaddress_fact)\n\n steps = @config.settings[\"steps\"].keys.select{|s| @config.settings[\"steps\"][s] }\n MCProvision.info(\"Provisioning #{node.hostname} / #{node_inventory[:facts][node_ipaddress_fact]} with steps #{steps.join ' '}\")\n\n\n chosen_master, master_inventory = pick_master_from(@config.settings[\"master\"][\"criteria\"], node_inventory[:facts])\n\n raise \"Could not determine master ip address from fact #{master_ipaddress_fact}\" unless master_inventory[:facts].include?(master_ipaddress_fact)\n master_ip = master_inventory[:facts][master_ipaddress_fact]\n\n MCProvision.info(\"Provisioning node against #{chosen_master.hostname} / #{master_ip}\")\n\n node.lock if @config.settings[\"steps\"][\"lock\"]\n\n node.set_puppet_host(master_ip) if @config.settings[\"steps\"][\"set_puppet_hostname\"]\n\n # Only do certificate management if the node is clean and doesnt already have a cert\n unless node.has_cert?\n @master.clean_cert(node.hostname.downcase) if @config.settings[\"steps\"][\"clean_node_certname\"]\n\n node.send_csr if @config.settings[\"steps\"][\"send_node_csr\"]\n\n @master.sign(node.hostname.downcase) if @config.settings[\"steps\"][\"sign_node_csr\"]\n else\n MCProvision.info(\"Skipping SSL certificate management for node - already has a cert\")\n end\n\n node.bootstrap if @config.settings[\"steps\"][\"puppet_bootstrap_stage\"]\n node.run_puppet if @config.settings[\"steps\"][\"puppet_final_run\"]\n node.unlock if @config.settings[\"steps\"][\"unlock\"]\n node.flag if @config.settings[\"steps\"][\"flag\"]\n @notifier.notify(\"Provisioned #{node.hostname} against #{chosen_master.hostname}\", \"New Node\") if @config.settings[\"steps\"][\"notify\"]\n end", "def update_manifest(manifest_version)\n manifest = JSON.parse(IO.read(@manifest_template_path))\n if manifest.instance_of? Array\n manifest.each { |m| m['version'] = manifest_version }\n else\n manifest['version'] = manifest_version\n if !manifest['tasks'].nil? and manifest['tasks'].instance_of? Array\n manifest['tasks'].each { |m| m['version'] = manifest_version }\n end\n end\n\n File.open('manifest.json','w'){ |f| f.write(JSON.pretty_generate(manifest)) }\n end", "def create_current_manifest\n if stored_manifest && latest_version == version\n retries = 0\n begin\n stored_manifest.copy(Manifesto.bucket, \"#{manifest.name}-current.json\", s3_headers)\n rescue Excon::Errors::NotFound => error\n raise error unless error.response.body =~ /NoSuchKey/ &&\n (retries += 1) < 5\n sleep 0.5\n retry\n end\n end\n end", "def server_config(config)\n config.vm.provision :puppet, :module_path => '..' do |puppet|\n puppet.manifests_path = \"vagrant\"\n puppet.manifest_file = \"server.pp\"\n end\nend", "def prepare_manifest_tests (manifest_path, manifest_file)\n # copy test manifest which includes current module\n rm_rf manifest_path\n mkdir_p manifest_path\n cp manifest_file, manifest_path\nend", "def update_manifest(file, digest, version)\n # We only ever add to the manifest.\n physical_filepath = \"#{OcflTools::Utils.version_int_to_string(version)}/#{@contentDirectory}/#{file}\"\n\n if @manifest.key?(digest)\n # This bitstream is already in the manifest.\n # We need to append the new filepath to the existing array.\n @manifest[digest] = (@manifest[digest] << physical_filepath)\n return @manifest[digest]\n end\n @manifest[digest] = [physical_filepath] # otherwise, add our first entry to the array.\n @manifest[digest]\n end", "def generate_node_config\n run_list = { run_list: @recipes.map{|name| \"recipe[#{name}]\"} }\n @ssh.write \"/tmp/node.json\", content: JSON.generate(run_list), sudo: true\n end", "def slave_compat_xml\n return @slave_compat_xml if @slave_compat_xml\n slave_compat_xml = ::File.join(new_resource.remote_fs, \"#{new_resource.service_name}.exe.config\")\n @slave_compat_xml = Chef::Resource::File.new(slave_compat_xml, run_context)\n @slave_compat_xml.content(\n <<-EOH.gsub(/^ {8}/, '')\n <configuration>\n <startup>\n <supportedRuntime version=\"v4.0\" />\n </startup>\n </configuration>\n EOH\n )\n @slave_compat_xml\n end", "def slave_xml_resource\n return @slave_xml_resource if @slave_xml_resource\n\n slave_xml = ::File.join(new_resource.remote_fs, \"#{new_resource.service_name}.xml\")\n\n @slave_xml_resource = Chef::Resource::Template.new(slave_xml, run_context)\n @slave_xml_resource.cookbook('jenkins')\n @slave_xml_resource.source('jenkins-slave.xml.erb')\n @slave_xml_resource.sensitive = true if new_resource.password\n @slave_xml_resource.variables(\n new_resource: new_resource,\n endpoint: endpoint,\n java_bin: java,\n slave_jar: slave_jar,\n jnlp_url: jnlp_url,\n jnlp_secret: jnlp_secret,\n user_domain: user_domain,\n user_account: user_account,\n user_password: new_resource.password,\n path: new_resource.path\n )\n @slave_xml_resource.notifies(:run, install_service_resource)\n @slave_xml_resource\n end", "def create\n create_role_directory\n generate_manifests_file\n end", "def manifest\n @_manifest\n end", "def remove_manifests_node\n Bebox::Provision.remove_node_for_steps(self.project_root, self.hostname)\n end", "def bootstrap\n return if File.exist?(yaml_file)\n\n FileUtils.mkdir_p(File.split(yaml_file).first)\n FileUtils.cp(example_config, yaml_file)\n end", "def run\n if !repo_manifest_exists?\n Rails.logger.info \"Creating manifest for #{manifest['name']}\"\n\n create_repo_manifest!\n elsif repo_manifest_changed?\n Rails.logger.info \"Updating manifest for #{manifest['name']}\"\n\n update_repo_manifest!\n else\n Rails.logger.info \"No changes to manifest for #{manifest['name']}, \" \\\n \"skipping...\"\n end\n end", "def manifest(repo:, tag:)\n res = doget(\"/v2/#{repo}/manifests/#{tag}\")\n digest = res.headers[:docker_content_digest]\n res = RecursiveOpenStruct.new(JSON.parse(res), recurse_over_arrays: true)\n res.digest = digest\n res\n end", "def action_create\n if current_resource.exists? && correct_config?\n Chef::Log.debug(\"#{new_resource} exists - skipping\")\n else\n converge_by(\"Create #{new_resource}\") do\n executor.groovy! <<-EOH.gsub(/ ^{12}/, '')\n import hudson.model.*\n import hudson.slaves.*\n import jenkins.model.*\n import jenkins.slaves.*\n\n props = []\n availability = #{convert_to_groovy(new_resource.availability)}\n usage_mode = #{convert_to_groovy(new_resource.usage_mode)}\n env_map = #{convert_to_groovy(new_resource.environment)}\n labels = #{convert_to_groovy(new_resource.labels.sort.join(\"\\s\"))}\n\n // Compute the usage mode\n if (usage_mode == 'normal') {\n mode = Node.Mode.NORMAL\n } else {\n mode = Node.Mode.EXCLUSIVE\n }\n\n // Compute the retention strategy\n if (availability == 'demand') {\n retention_strategy =\n new RetentionStrategy.Demand(\n #{new_resource.in_demand_delay},\n #{new_resource.idle_delay}\n )\n } else if (availability == 'always') {\n retention_strategy = new RetentionStrategy.Always()\n } else {\n retention_strategy = RetentionStrategy.NOOP\n }\n\n // Create an entry in the prop list for all env vars\n if (env_map != null) {\n env_vars = new hudson.EnvVars(env_map)\n entries = env_vars.collect {\n k,v -> new EnvironmentVariablesNodeProperty.Entry(k,v)\n }\n props << new EnvironmentVariablesNodeProperty(entries)\n }\n\n // Launcher\n #{launcher_groovy}\n\n // Build the slave object\n slave = new DumbSlave(\n #{convert_to_groovy(new_resource.name)},\n #{convert_to_groovy(new_resource.description)},\n #{convert_to_groovy(new_resource.remote_fs)},\n #{convert_to_groovy(new_resource.executors.to_s)},\n mode,\n labels,\n launcher,\n retention_strategy,\n props\n )\n\n // Create or update the slave in the Jenkins instance\n nodes = new ArrayList(Jenkins.instance.getNodes())\n ix = nodes.indexOf(slave)\n (ix >= 0) ? nodes.set(ix, slave) : nodes.add(slave)\n Jenkins.instance.setNodes(nodes)\n EOH\n end\n end\n end", "def site_create_minimal(data_source)\n # Create output\n FileUtils.mkdir_p('output')\n\n # Create config\n File.open('config.yaml', 'w') do |io|\n io.write(YAML.dump(\n 'output_dir' => 'output',\n 'data_sources' => [\n {\n 'type' => data_source,\n 'items_root' => '/',\n 'layouts_root' => '/'\n }\n ]\n ))\n end\n Nanoc3::NotificationCenter.post(:file_created, 'config.yaml')\n\n # Create rakefile\n File.open('Rakefile', 'w') do |io|\n io.write \"require 'nanoc3/tasks'\"\n end\n Nanoc3::NotificationCenter.post(:file_created, 'Rakefile')\n\n # Create rules\n File.open('Rules', 'w') do |io|\n io.write DEFAULT_RULES\n end\n Nanoc3::NotificationCenter.post(:file_created, 'Rules')\n end", "def create_deployment_manifest\n cloud_properties = { \"instance_type\" => \"m1.small\", \"availability_zone\" => \"us-east-1e\" }\n cloud_properties[\"persistent_disk\"] = flags[:disk] if flags[:disk]\n cloud_properties[\"static_ips\"] = ip_addresses\n manifest = Bosh::Gen::Models::DeploymentManifest.new(name, director_uuid, release_properties, cloud_properties)\n manifest.jobs = job_manifests\n create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]\n end", "def define_manifest_task\n\n if File.exist?( 'Manifest.static' )\n file 'Manifest.txt' => [ 'Manifest.static' ]\n end\n\n gf = clean_list( spec.generated_files ).sort\n [ :gem, :test ].each { |t| task t => gf }\n\n unless gf.empty?\n task :gen_clean do\n rm_f gf\n end\n task :clean => :gen_clean\n end\n\n desc \"Force update of Manifest.txt\"\n task :manifest do\n spec.generate_manifest\n end\n\n mtask = file 'Manifest.txt' do\n spec.generate_manifest\n end\n\n mtask\n end", "def load_manifest(entry) # :nodoc:\n raise FoobarMod::Package::FormatError.new \"Mod manifest size is too large\" if entry.size > MAX_MANIFEST_SIZE\n @manifest = FoobarMod::Manifest.from_hcl entry.get_input_stream.read\n end", "def manifest_algorithm_or_nil(path)\n path.match(/^manifest-(\\w+)\\.txt$/)\n $1\n end", "def generate_manifest(test_resources)\n manifest = ''\n test_resources = [test_resources].flatten # ensure it's an array so we enumerate properly\n test_resources.each do |resource|\n manifest << resource[:pre_code] + \"\\n\" if resource[:pre_code]\n namevar = (resource[:parameters][:namevar] if resource[:parameters]) || \"#{resource[:type]}_#{random_string}\"\n # ensure these are double quotes around the namevar incase users puppet-interpolate inside it\n # FIXME: add test ^^\n manifest << resource[:type] + '{\"' + namevar + '\":' if resource[:type]\n if resource[:parameters]\n resource[:parameters].each do |key,value|\n next if key == :namevar\n manifest << \"#{key} => #{value},\"\n end\n end\n manifest << \"}\\n\" if resource[:type]\n end\n return manifest\n end", "def package(path, target)\n # Load manifest\n puts \"Load manifest...\"\n manifest = YAML::load_file(File.join(path, 'manifest.yml'))\n \n # Target directory for package files\n puts \"Target is: #{target}\"\n Dir.mkdir(target) if not File.exists?(target)\n \n # Package name\n package = \"#{manifest['name']}-#{manifest['version']}\"\n puts \"Package: #{package}\"\n \n # Tgz\n manifest['package'] = \"#{package}.tgz\"\n command = \"tar -czf #{package}.tgz --exclude pkg -C #{path} .\"\n puts \"Packing: #{command}\"\n system command\n \n # Move\n puts \"Finishing..\"\n FileUtils.mv(\"#{package}.tgz\", target)\n File.open(File.join(target, \"#{package}.yml\"), 'w') do |f|\n f.puts(manifest.to_yaml)\n f.close\n end\n \n puts \"Done.\"\nend", "def role_puppet_master\n $myxp.get_deployed_nodes('capi5k-init').first\nend", "def get_image_from_manifest(manifest)\n return RaisEcs::ContainerImage.new({\n primary_image_tag: self.extract_tag_from_manifest(manifest),\n local_image_id: self.extract_local_id_from_manifest(manifest),\n remote_repository: self,\n image_sha_digest: self.extract_digest_from_manifest(manifest),\n image_created_dt: self.extract_created_from_manifest(manifest)\n })\n end", "def generate_chef_config(path)\n contents = <<-TXT\nchef_server_url \"http://localhost:4000\"\nvalidation_key \"/etc/chef/validation.pem\"\nvalidation_client_name \"chef-validator\"\nclient_key \"/etc/chef/client.pem\"\n TXT\n File.open(path, 'w+') do |f|\n f.write(contents)\n end\n end", "def manifest_entry\n return @manifest_entry if @manifest_entry\n \n # Start off with the last revision's manifest_entry, that's safe.\n man = parents()[0].manifest_entry.dup\n # Any copied files since the last revision?\n copied = @repo.dirstate.copy_map\n # Any modified, added, etc files since the last revision?\n modified, added, removed = status[:modified], status[:added], status[:removed]\n deleted, unknown = status[:deleted], status[:unknown]\n # Merge these discoveries in!\n {:a => added, :m => modified, :u => unknown}.each do |k, list|\n list.each do |file|\n copy_name = (copied[file] || file)\n man[file] = (man.flags[copy_name] || NULL_ID) + k.to_s\n man.flags[file] = @repo.dirstate.flags(file)\n end\n end\n \n # Delete files from the real manifest entry that don't exist.\n (deleted + removed).each do |file|\n man.delete file if man[file]\n end\n \n @manifest_entry = man\n end", "def text_manifest_path(path = NULL)\n if null?(path)\n @text_manifest_path || File.join(install_dir, \"version-manifest.txt\")\n else\n @text_manifest_path = path\n end\n end" ]
[ "0.69561505", "0.6935098", "0.6582124", "0.62504935", "0.62504935", "0.62267864", "0.6063514", "0.605106", "0.56757796", "0.5502658", "0.54138565", "0.53964466", "0.5343424", "0.52187884", "0.517615", "0.50771815", "0.50681776", "0.5059875", "0.50534964", "0.5045868", "0.50246465", "0.4963647", "0.49142668", "0.49137414", "0.49051082", "0.48982513", "0.48186222", "0.48122707", "0.48040903", "0.48000523", "0.47615272", "0.47448394", "0.47413704", "0.4719273", "0.47179925", "0.47157943", "0.47030836", "0.4700671", "0.469158", "0.469158", "0.4676465", "0.46758503", "0.4666187", "0.46280634", "0.46263218", "0.46163067", "0.4613377", "0.45923358", "0.45876688", "0.458765", "0.45871854", "0.45859674", "0.45746917", "0.4548913", "0.45438278", "0.45402688", "0.45390123", "0.45327803", "0.45324087", "0.4517217", "0.4512316", "0.45079532", "0.45028684", "0.44944012", "0.449281", "0.44898278", "0.44840026", "0.44787088", "0.44781426", "0.447491", "0.44738603", "0.44677192", "0.44615555", "0.4460187", "0.44583115", "0.445498", "0.44519863", "0.44511026", "0.44448155", "0.44333902", "0.44300804", "0.44297606", "0.44181466", "0.44165593", "0.44154438", "0.44031098", "0.4401112", "0.43977484", "0.43910706", "0.4387747", "0.43870246", "0.4379978", "0.43696144", "0.4365811", "0.43644634", "0.43534186", "0.4350477", "0.43490586", "0.43405744", "0.43378365" ]
0.77165544
0
Set mode, owner and group on a remote path. ==== Attributes +host+ The remote host containing the target path. +path+ The path to set mode, user and group upon. +mode+ The desired mode to set on the path in as a string. +owner+ The owner to set on the path. (Puppet user if not specified.) +group+ The group to set on the path. (Puppet group if not specified.) ==== Returns nil ==== Examples set_perms_on_remote(master, "/tmp/test/site.pp", "777")
def set_perms_on_remote(host, path, mode, owner=nil, group=nil) if (owner.nil?) owner = on(host, puppet('config', 'print', 'user')).stdout.rstrip end if (group.nil?) group = on(host, puppet('config', 'print', 'group')).stdout.rstrip end on(host, "chmod -R #{mode} #{path}") on(host, "chown -R #{owner}:#{group} #{path}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_perms_on_remote(host, path, mode, opts = {})\n opts[:owner] ||= on(host, puppet('config print user')).stdout.rstrip\n opts[:group] ||= on(host, puppet('config print group')).stdout.rstrip\n\n on(host, \"chmod -R #{mode} #{path}\")\n on(host, \"chown -R #{opts[:owner]}:#{opts[:group]} #{path}\")\n end", "def chmod_remote!(username, pass)\n com = \"chmod 644 #{CONFIG[:server_path] + @filename}\"\n ssh_command(com, username, pass)\n\tend", "def scp_set_folder_perms(remote_folder)\n # set proper permissions for remote host (allowing for client override)\n puts(\" -> setting remote ownership on host #{server_ip} folder #{remote_folder}\") if is_verbose or is_dryrun\n $stdout.flush\n output, exit_code1 = ssh_exec(\"chown -R #{ssh_owner_ug} #{remote_folder}\")\n puts(\"ERR: #{output}\") unless exit_code == 0\n\n output, exit_code2 = ssh_exec(\"chmod -R #{ssh_ugw_perm} #{remote_folder}\")\n puts(\"ERR: #{output}\") unless exit_code == 0\n (exit_code1 == 0) and (exit_code2 == 0)\n end", "def chmod(mode, path)\n exec! \"chmod #{mode.to_s(8)} #{escape(expand_path(path))}\"\n end", "def chmod(path, mode = 0700)\n if session.platform == 'windows'\n raise \"`chmod' method does not support Windows systems\"\n end\n\n if session.type == 'meterpreter' && session.commands.include?(Rex::Post::Meterpreter::Extensions::Stdapi::COMMAND_ID_STDAPI_FS_CHMOD)\n session.fs.file.chmod(path, mode)\n else\n cmd_exec(\"chmod #{mode.to_s(8)} '#{path}'\")\n end\n end", "def chown(owner, group) File.chown(owner, group, path) end", "def remote_set_immutable(host, files)\n remote_ssh_cmd(host, \"sudo chattr +i #{files.join(\" \")}\")\nend", "def chmod(path, mode, config = {})\n return unless behavior == :invoke\n path = File.expand_path(path, destination_root)\n say_status :chmod, relative_to_original_destination_root(path), config.fetch(:verbose, true)\n FileUtils.chmod_R(mode, path) unless options[:pretend]\n end", "def chown(path, owner = nil, group = nil, &block)\n add Config::Patterns::Chown do |p|\n p.path = path\n p.owner = owner if owner\n p.group = group if group\n yield p if block_given?\n end\n end", "def chmod(path, mode = nil, &block)\n add Config::Patterns::Chmod do |p|\n p.path = path\n p.mode = mode if mode\n yield p if block_given?\n end\n end", "def chmod(mode, target)\n eval(CHMOD, binding, __FILE__, CHMOD_LINE)\n nil\nend", "def chmod(path, mode, *args, **opts)\n TTY::File.chmod(path, mode, *args, **opts)\n end", "def set_mode\n chmod = command? 'chmod'\n find = command? 'find'\n\n return unless chmod && find\n\n {fmode: 'f', dmode: 'd'}.each do |k, v|\n next if send(k).nil?\n cmd = [find, destination_path, '-type', v, '-exec']\n cmd.concat [chmod, send(k).to_s(8), '{}', '+']\n logger.debug { \"Running command: #{cmd.join ' '}\" }\n system(*cmd)\n end\n end", "def sudo_upload(local, remote, opts={})\n remote = expand_path remote\n\n # TODO: umask this?\n local_mode = File.stat(local).mode & 07777\n File.chmod 0600, local\n \n\n # Get temporary filename\n tmpfile = '/'\n while exists? tmpfile\n tmpfile = '/tmp/sudo_upload_' + Time.now.to_f.to_s\n end\n\n # Upload\n upload local, tmpfile, opts\n\n # Get remote mode/user/group\n sudo do\n if exists? remote\n mode = self.mode remote\n user = stat('-c', '%U', remote).strip\n group = stat('-c', '%G', remote).strip\n else\n user = stat('-c', '%U', File.dirname(remote)).strip\n group = stat('-c', '%G', File.dirname(remote)).strip\n mode = local_mode\n end\n\n # Move and chmod\n mv tmpfile, remote\n chmod mode, remote\n chown \"#{user}:#{group}\", remote\n end\n end", "def chmod( mode ) File.chmod( mode, expand_tilde ) end", "def chown(path, owner); raise NotImplementedError; end", "def chmod mod, path\n add \"chmod #{mod} #{path}\", check_perms(mod, path)\n end", "def chmod_linux_file(host, user, pass, path, file_name)\n Net::SSH.start(host, user, :password => pass) do |ssh|\n ssh.exec!(\"cd #{path}; chmod 777 #{file_name}\")\n end\n end", "def chmod ctx, path, mode\n\n end", "def chown( owner, group ) File.chown( owner, group, expand_tilde ) end", "def chmod_r(mode, path)\n exec! \"chmod -R #{mode.to_s(8)} #{escape(expand_path(path))}\"\n end", "def chmod(mode) File.chmod(mode, path) end", "def chmod(path=nil,perms=nil)\n if path.class == String && perms.class == String && block_given?\n @j_del.java_method(:chmod, [Java::java.lang.String.java_class,Java::java.lang.String.java_class,Java::IoVertxCore::Handler.java_class]).call(path,perms,(Proc.new { |ar| yield(ar.failed ? ar.cause : nil) }))\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling chmod(path,perms)\"\n end", "def adjust(path, permissions)\n\n # chowns all run user files to the sftp user\n with_tempfile do |tf|\n sudo(run_user_uid,group_gid) do\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type d > #{tf}\")\n cmd(\"find #{shellescape(path)} -user #{options['run_user']} -type f >> #{tf}\")\n end\n on_filelist(File.read(tf),run_user_uid) do |p|\n FileUtils.chown( options['sftp_user'], options['group'], p)\n end\n end\n # chmod runs as sftp user, which should own all the relevant files now\n sudo(sftp_user_uid,group_gid) do\n cmd(\"chmod -R #{permissions} #{shellescape(path)}\")\n end\n log \"Adjusted #{path} with #{permissions} and #{options['sftp_user']}:#{options['group']}\"\nrescue => e\n log \"Error while adjusting path #{path}: #{e.message}\"\nend", "def chown_r(user, group)\n util.chown_r(user, group, path)\n end", "def change_owner(username, group, path)\n %x(sudo chown -R #{Shellwords.escape(username)}:#{Shellwords.escape(group)} #{path})\n\n $?.success?\n end", "def set_owner\n return unless owner || group\n chown = command? 'chown'\n\n return unless chown\n\n cmd = [chown, '-R', \"#{owner}:#{group}\", destination_path]\n logger.debug { \"Running command: #{cmd.join ' '}\" }\n system(*cmd)\n end", "def set_remote_permissions\n sudo <<-CMD\n sh -c \"chown -R #{app_user}:#{group} #{deploy_to} &&\n chmod -R g+w #{deploy_to}\"\n CMD\nend", "def set_perms_files(dir_path, perm = 644)\n try_sudo \"find #{dir_path} -type f -exec chmod #{perm} {} \\\\;\"\nend", "def change_mode!\n chmod_params = [Integer(\"0\" + self.target_mode), self.target]\n\n if(File.symlink?(self.target) && (self.no_follow == 'both' || self.no_follow == 'chmod'))\n File.lchmod *chmod_params\n elsif(self.stat(:ftype) == 'directory' && (self.recursive == 'both' || self.recursive == 'chmod'))\n FileUtils.chmod_R *chmod_params\n else\n File.chmod *chmod_params\n end\n rescue NotImplementedError => ex\n WarningShot::PermissionResolver.logger.error(\"lchmod is not implemented on this machine, (disable nofollow).\")\n return false\n rescue Exception => ex\n WarningShot::PermissionResolver.logger.error(\"Unable to change mode for file: #{self.target}; Exception: #{ex.message}\")\n return false\n end", "def chown(path, owner, options = {})\n paths = glob(path, options)\n owner = Etc.getpwnam(owner)\n changed = false\n\n paths.each do |f|\n stat = File.stat(f)\n unless stat.uid == owner.uid && stat.gid == owner.gid\n old_owner = \"#{Etc.getpwuid(stat.uid).name}:#{Etc.getgrgid(stat.gid).name}\"\n puts \"Changing owner of #{f} from #{old_owner} to #{owner.name}:#{owner.name}\"\n File.chown(owner.uid, owner.gid, f)\n changed = true\n end\n end\n\n @changed ||= changed\n changed\n end", "def chmod(mode, list, noop: nil, verbose: nil)\n list = fu_list(list)\n fu_output_message sprintf('chmod %s %s', mode_to_s(mode), list.join(' ')) if verbose\n return if noop\n list.each do |path|\n Entry_.new(path).chmod(fu_mode(mode, path))\n end\n end", "def set_mode\n if (mode = target_mode) && (mode != (stat.mode & 007777))\n File.chmod(target_mode, file)\n Chef::Log.info(\"#{log_string} mode changed to #{mode.to_s(8)}\")\n modified\n end\n end", "def set_perms_dirs(dir_path, perm = 755)\n try_sudo \"find #{dir_path} -type d -exec chmod #{perm} {} \\\\;\"\nend", "def chmod(path, mode, options = {})\n paths = glob(path, options).reject{|f| f.include?(\".git\")} # We can probably generalize this later\n changed = false\n\n paths.each do |f|\n old_mode = File.stat(f).mode & 07777\n unless old_mode == mode\n puts \"Changing mode of #{f} from #{old_mode.to_s(8)} to #{mode.to_s(8)}\"\n FileUtils.chmod(mode, f)\n changed = true\n end\n end\n\n @changed ||= changed\n changed\n end", "def mkdir(path, mode=0755, group=nil, user=nil)\n sudo \"test -d #{path} || sudo mkdir -p -m#{mode} #{path}\"\n sudo \"chgrp -R #{group} #{path}\" if group\n sudo \"chown -R #{user} #{path}\" if user\n end", "def chown user, path, options = {}\n recursive = '-R ' if options[:recursive]\n add \"chown #{recursive}#{user}:#{user} #{path}\", check_owner(user, path)\n end", "def chown(user, group, target)\n eval(CHOWN, binding, __FILE__, CHOWN_LINE)\n nil\nend", "def chown(p0, p1) end", "def chmod_r(mode)\n util.chmod_r(mode, path)\n end", "def create_remote_path!(remote_path)\n if @local\n FileUtils.mkdir_p(remote_path)\n else\n connection do |ssh|\n ssh.exec!(\"mkdir -p '#{ remote_path }'\")\n end\n end\n end", "def set_owner\n user = @conf['user'] || Process.uid\n group = @conf['group'] || Process.gid\n\n begin\n FileUtils.chown_R(user, group, @location)\n rescue StandardError => err\n Pemlogger.logit(err, :fatal)\n raise(err)\n end\n end", "def chmod(acl)\n if(acl == 777)\n mode = \"777\"\n end\n end", "def chmod(mode, args, options)\n FileUtils.chmod_R(mode, args, **options)\n end", "def upload(local, remote, mode = 0o644)\n file.open(remote, 'w', mode) { |io| io.upload(local) }\n end", "def chmod(mode, options={})\n #list = list.to_a\n fileutils.chmod(mode, list, options)\n end", "def action_chmod\n if @omode == nil\n Chef::Log::fatal \"target mode need to be provided to perform chmod\"\n elsif (!dir_exists?(@path))\n Chef::Log::Error(\"Directory #{ @path } doesn't exist; chmod action not taken\")\n else\n converge_by(\"chmod #{ @new_resource }\") do\n @client.chmod(@path, @mode)\n end\n new_resource.updated_by_last_action(true)\n end\n end", "def create_and_permissions_on_path(log_path, user = nil, group = nil)\n user = Capistrano::BaseHelper.get_capistrano_instance.fetch(:user) if user.nil?\n group = \"syslog\" if group.nil?\n c = Capistrano::BaseHelper.get_capistrano_instance\n # will use sudo\n commands = []\n commands << \"#{c.sudo} mkdir -p #{log_path}\"\n commands << \"#{c.sudo} chown -R #{user}:#{group} #{log_path}\"\n commands << \"#{c.sudo} chmod u+w #{log_path}\"\n commands << \"#{c.sudo} chmod g+w #{log_path}\"\n Capistrano::BaseHelper.get_capistrano_instance.run commands.join(\" && \")\n end", "def chmod(mode, list, options = {})\r\n fu_check_options options, :noop, :verbose\r\n list = fu_list(list)\r\n fu_output_message sprintf('chmod %o %s', mode, list.join(' ')) if options[:verbose]\r\n return if options[:noop]\r\n File.chmod mode, *list\r\n end", "def update_permissions_on_storage\n if @options[:perms]\n response = system(\"chmod -R o+w #{File.join(@path, 'storage')}\")\n if response\n say_success \"Updated permissions on storage/ directory.\"\n else\n say_failed \"Could not update permissions on storage/ directory.\"\n end\n end\n end", "def edit_remote_mirror(project, id, options = {})\n put(\"/projects/#{url_encode project}/remote_mirrors/#{id}\", body: options)\n end", "def upload_file local_source, remote_dest, options = {}\n add [local_source, remote_dest], check_file(remote_dest)\n chmod options[:perms], remote_dest if options[:perms]\n chown options[:owner], remote_dest if options[:owner]\n end", "def chown_r(user, group, options={})\n #list = list.to_a\n fileutils.chown_r(user, group, list, options)\n end", "def setup_proc\n comp = self\n raise ArgumentError.new( \"File #{comp.local} is not exist!\" ) if !File.exists? comp.local\n\n set_check( ->(host) do \n if !test(\" [ -f #{comp.remote} ] \" )\n next false\n end\n\n local_checksum = `md5sum #{comp.local}`\n remote_checksum = capture( :md5sum, comp.remote )\n local_checksum.strip.split(\" \")[0] == remote_checksum.strip.split(\" \")[0]\n end )\n\n set_up( Proc.new{ |host|\n upload! comp.local, \"tmp\"\n if comp.permission\n execute( :chmod, comp.permission, \"tmp\" )\n end\n if test( \" [ -w '#{File.dirname comp.remote}' ] \" )\n execute( :mv, \"tmp\", comp.remote ) \n else\n prepare_sudo_password( host ) do\n as :root do\n execute( :mv, \"tmp\", comp.remote ) \n end\n end\n end\n if comp.owner\n prepare_sudo_password( host ) do\n as :root do\n execute( :chmod, comp.permission, comp.remote )\n end\n end\n end\n })\n\n set_down( Proc.new{ |host|\n if test( \" [ -w '#{File.dirname comp.remote}' ] \" )\n execute( :rm, comp.remote ) \n else\n prepare_sudo_password( host ) do \n as :root do\n execute( :rm, comp.remote ) \n end\n end\n end\n } )\n end", "def mode=(value)\n File.chmod(Integer(\"0\" + value), @resource[:name])\n end", "def inject_site_pp(master_host, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master_host, site_pp_path, manifest)\n\n set_perms_on_remote(master_host, site_pp_dir, '0744')\n end", "def inject_site_pp(master_host, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master_host, site_pp_path, manifest)\n\n set_perms_on_remote(master_host, site_pp_dir, '744')\n end", "def set(path, *values)\n values.flatten.each { |v| set_internal(path, v) }\n end", "def set_modes(dir)\n Dir.glob(\"#{dir}/**/*\", File::FNM_DOTMATCH).each do |path|\n next if File.basename(path) == '.'\n\n if File.directory? path\n File.chmod(0755, path)\n else\n File.chmod(0644, path)\n end\n end\nend", "def mode=(value)\n File.chmod(Integer(\"0#{value}\"), @resource[:name])\n end", "def perms=(value)\n @hash[:perms] = value\n end", "def chown(user, group, options={})\n #list = list.to_a\n fileutils.chown(user, group, list, options)\n end", "def chmod(p0) end", "def touch(path, mode = 0o755)\n FileUtils.touch path\n FileUtils.chmod mode, path\n end", "def cp(src, dst, owner = nil, mode = nil)\n FileUtils.cp_r(src, dst, :preserve => true, :verbose => verbose?)\n if owner && !File.symlink?(dst) \n chown(dst, owner) \n end\n if mode\n chmod(dst, mode)\n end\n end", "def set(path, value, source)\n my_path = path.clone\n return source.send(my_path[0].to_s + \"=\",value) if my_path.length == 1\n target = my_path.shift\n set(my_path, value, source.send(target))\n end", "def chown(user, group, list, noop: nil, verbose: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown %s %s',\n (group ? \"#{user}:#{group}\" : user || ':'),\n list.join(' ')) if verbose\n return if noop\n uid = fu_get_uid(user)\n gid = fu_get_gid(group)\n list.each do |path|\n Entry_.new(path).chown uid, gid\n end\n end", "def chmod_r(mode, options={})\n #list = list.to_a\n fileutils.chmod_r(mode, list, options)\n end", "def chmod(permissions = nil)\r\n permissions ||= self.class.upload_options[:chmod]\r\n File.chmod(permissions, full_path) if file_exists?\r\n end", "def set_mode\n # Why are we trying to set_mode when we don't even have a file?\n return false if !@file\n File.chmod @mode, @file if File.exist? @file\n\n # the backup file may not exist for whatever reason, lets not shit if it doesn't.\n return true if !backup_file\n File.chmod @mode, backup_file if File.exist? backup_file\n true\n end", "def set_remote(args)\n remote = `#{Templates.check_remote(args)}`\n if (remote.empty?)\n `#{Templates.add_remote(args)}`\n end\n end", "def make_folder(path:, mode: \"644\", owner: nil, group: nil )\n @output.item @i18n.t('setup.mkdir', path: path)\n FileUtils::mkdir_p path unless File::exist? path\n FileUtils.chmod mode.to_i(8), path\n FileUtils.chown owner, group, path if owner and group\n end", "def create_remote_path(remote_path, ftp)\n path_parts = []\n remote_path.split('/').each do |path_part|\n path_parts << path_part\n begin\n dir = path_parts.join('/')\n ftp.mkdir(dir) unless dir.empty?\n rescue Net::FTPPermError;\n end\n end\n end", "def set_mode\n FileUtils.chmod options[:mode], options[:file] if options[:mode] && File.exist?(options[:file])\n\n return true if !backup_file\n FileUtils.chmod options[:mode], backup_file if File.exist? backup_file\n return true\n end", "def permissions(username,path)\n # walk the path from the most specific to the least specific scanning the\n # rules at each way point, capturing any explicit user name match and merging\n # any matching group permissios. The first such match is the result\n #\n repo , dir = path.split(':')\n @path_routes.each do |point|\n next if !(path =~ /^#{point}/) && !(dir =~ /^#{point}/)\n gperms = []\n uperms = nil\n @paths[point].each do |selector,rule|\n fail \"Syntax error #{selector}='#{rule}'\" if rule.tr('^rw','')!=rule\n p = (rule=='rw')? ['r', 'w'] : [rule]\n if username==selector || @aliases[username]==selector\n uperms = p # user permssion\n elsif user_included?(username,selector)\n gperms |= p # group permission\n end\n end\n gperms |= [uperms] if !uperms.nil? # user perms extend group perms\n return gperms.sort.join('') if !gperms.empty?\n end\n '' # no matching rule\n end", "def chown_R(user, group, list, noop: nil, verbose: nil, force: nil)\n list = fu_list(list)\n fu_output_message sprintf('chown -R%s %s %s',\n (force ? 'f' : ''),\n (group ? \"#{user}:#{group}\" : user || ':'),\n list.join(' ')) if verbose\n return if noop\n uid = fu_get_uid(user)\n gid = fu_get_gid(group)\n list.each do |root|\n Entry_.new(root).traverse do |ent|\n begin\n ent.chown uid, gid\n rescue\n raise unless force\n end\n end\n end\n end", "def inject_site_pp(master, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master, site_pp_path, manifest)\n\n set_perms_on_remote(master, site_pp_dir, \"777\")\nend", "def server_put_file(server, io, remote_path, options={})\n request(\n :method => :post,\n :path => \"containers/#{server.id}/files\",\n :params => {\n :path => remote_path\n },\n :body => io,\n :headers => {\n 'Transfer-Encoding' => 'chunked',\n 'X-LXD-uid' => options.fetch(:uid, 0),\n 'X-LXD-gid' => options.fetch(:gid, 0),\n 'X-LXD-mode' => options.fetch(:mode, 0700)\n }\n )\n true\n end", "def chmod(mode = nil)\n return unless mode\n begin\n Integer mode\n mode = Integer mode.size == 3 ? \"0#{mode}\" : mode\n rescue ArgumentError\n end\n FileUtils.chmod mode, selected_items.map(&:path)\n ls\n end", "def create_test_file(host, file_rel_path, file_content, options)\n\n # set default options\n options[:mkdirs] ||= false\n options[:owner] ||= \"root\"\n options[:group] ||= \"puppet\"\n options[:mode] ||= \"755\"\n\n file_path = get_test_file_path(host, file_rel_path)\n\n mkdirs(host, File.dirname(file_path)) if (options[:mkdirs] == true)\n create_remote_file(host, file_path, file_content)\n\n#\n# NOTE: we need these chown/chmod calls because the acceptance framework connects to the nodes as \"root\", but\n# puppet 'master' runs as user 'puppet'. Therefore, in order for puppet master to be able to read any files\n# that we've created, we have to carefully set their permissions\n#\n\n chown(host, options[:owner], options[:group], file_path)\n chmod(host, options[:mode], file_path)\n\nend", "def create_test_file(host, file_rel_path, file_content, options)\n\n # set default options\n options[:mkdirs] ||= false\n options[:owner] ||= \"root\"\n options[:group] ||= \"puppet\"\n options[:mode] ||= \"755\"\n\n file_path = get_test_file_path(host, file_rel_path)\n\n mkdirs(host, File.dirname(file_path)) if (options[:mkdirs] == true)\n create_remote_file(host, file_path, file_content)\n\n#\n# NOTE: we need these chown/chmod calls because the acceptance framework connects to the nodes as \"root\", but\n# puppet 'master' runs as user 'puppet'. Therefore, in order for puppet master to be able to read any files\n# that we've created, we have to carefully set their permissions\n#\n\n chown(host, options[:owner], options[:group], file_path)\n chmod(host, options[:mode], file_path)\n\nend", "def upload_and_run(local_path, remote_path)\n upload local_path, remote_path\n run \"chmod a+x #{remote_path}\"\n sudo remote_path\n sudo \"rm #{remote_path}\"\nend", "def exec(argv, options = {}, &block)\n sshcmd = %W( ssh #{@remote} -tS #{controlsocket} )\n\n sshcmd += %W( cd #{options[:chdir]} && ) if options.has_key?(:chdir)\n\n @local.exec(sshcmd + argv, &block)\n end", "def chmod(file, mode)\n if File.stat(file).mode != mode\n FileUtils.chmod(mode, file, :verbose => verbose?) \n end\n end", "def set_perms\n self.perms = Access.for_user(self)\n end", "def set_public_access(*perms)\n perms.each do |perm_symbol|\n perm = find_permission_object(perm_symbol)\n if perm\n perm.set_as_public_access \n else\n msg = \"Permission not found: #{perm_symbol}\"\n raise Lockdown::InvalidRuleAssignment, msg\n end\n end\n end", "def umask(mask)\n @commands_and_opts.push \"#{OPTIONAL_OPTS[:umask]}=#{mask}\"\n self\n end", "def upload(local, remote = nil, opts={})\n remote ||= File.split(local).last\n remote = expand_path remote\n ssh.scp.upload!(local, remote, opts)\n end", "def FileModesOwnership\n\tarquivo = File.new(\"arquivo_novo.txt\", \"w\")\n\tarquivo.chmod(0755)\n\tarquivo.close()\nend", "def action_chgrp\n if @tgroup == nil\n Chef::Log::fatal \"target group need to be provided to perform chgrp\"\n elsif (!dir_exists?(@path))\n Chef::Log::info(\"Directory #{ @path } doesn't exist; chmod action not taken\")\n else\n converge_by(\"chgrp #{ @new_resource }\") do\n @client.chown(@path, 'group' => @tgroup)\n end\n new_resource.updated_by_last_action(true)\n end\n end", "def update!(**args)\n @remote_path = args[:remote_path] if args.key?(:remote_path)\n end", "def chown(file)\n user = options[:user]\n group = options[:group]\n return unless user || group\n\n FileUtils.chown(user, group, file)\n end", "def copy_perms(src, dst)\n stat = File.stat(src)\n File.chmod(stat.mode, dst)\n end", "def action_chown\n if @tuser == nil\n Chef::Log::fatal \"target user need to be provided to perform chown\"\n elsif (!dir_exists?(@path))\n Chef::Log::Error(\"Directory #{ @path } doesn't exist; chown action not taken\")\n else\n if @tgroup == nil\n @tgroup = @meta_data[\"group\"]\n end\n converge_by(\"chown #{ @new_resource }\") do\n @client.chown(@path, 'owner' => @tuser, 'group' => @tgroup)\n end\n new_resource.updated_by_last_action(true)\n end\n end", "def []=(path,value)\n set(path, value)\n end", "def remote=(remote)\n super\n\n @sets.each {|set| set.remote = remote }\n end", "def set_access_mode(mode = :r)\n modes = [:r, :w, :rw, :x]\n raise ArgumentError, \"Mode must be one of #{modes}\" unless modes.include? mode\n case mode\n when :r\n self.access_mode = 0\n when :w\n self.access_mode = 1\n when :rw\n self.access_mode = 2\n when :x\n self.access_mode = 3\n end\n end", "def set_mode(mode)\n send_request(FUNCTION_SET_MODE, [mode], 'C', 0, '')\n end", "def chg_permission(groups, arg, mode)\n arg = UserGroup.one_user(arg) if arg.is_a?(User)\n if (mode == :add) &&\n groups.exclude?(arg)\n groups.push(arg)\n elsif (mode == :remove) &&\n groups.include?(arg)\n groups.delete(arg)\n end\n end", "def store(path, content, mode = 0o644)\n put_at(parse_path(path), content && repo.data_sha(content), mode)\n end" ]
[ "0.853508", "0.62313455", "0.6067766", "0.58636713", "0.5812962", "0.5807897", "0.57689315", "0.5756103", "0.5750437", "0.57163846", "0.5713541", "0.5635026", "0.5621682", "0.558019", "0.5562776", "0.5513096", "0.54989916", "0.5477864", "0.54386497", "0.5429715", "0.53882444", "0.5381132", "0.5346424", "0.52530855", "0.5221048", "0.51774246", "0.5154256", "0.513627", "0.51137805", "0.5108395", "0.5107616", "0.5092777", "0.50295526", "0.49551687", "0.49503654", "0.49483502", "0.49265793", "0.4924133", "0.49064526", "0.49056575", "0.48931718", "0.4779289", "0.47782788", "0.47709078", "0.4755153", "0.47498354", "0.47463694", "0.4742095", "0.4729081", "0.46836212", "0.46822914", "0.46446732", "0.4600048", "0.45830452", "0.45792142", "0.4554324", "0.45488548", "0.4546681", "0.45426288", "0.44975317", "0.44914308", "0.44866422", "0.44817424", "0.44787365", "0.44688824", "0.4459015", "0.4453122", "0.44418472", "0.44416052", "0.4434994", "0.4406888", "0.44051898", "0.43997556", "0.43990627", "0.43895227", "0.43770412", "0.43769833", "0.43767688", "0.43603846", "0.43440494", "0.43440494", "0.4343392", "0.434231", "0.43307352", "0.43190703", "0.42981142", "0.42894092", "0.42891663", "0.42543036", "0.4248017", "0.4243717", "0.42273462", "0.42267516", "0.42196065", "0.42017338", "0.41950867", "0.41874138", "0.41819268", "0.41799423", "0.4178854" ]
0.8571411
0
Inject temporary "site.pp" onto target host. This will also create a "modules" folder in the target remote directory. ==== Attributes +master+ The target master for injection. +site_pp_path+ A path on the remote host into which the site.pp will be injected. +manifest+ The manifest content to inject into "site.pp" to the host target path. ==== Returns nil ==== Examples site_pp = inject_site_pp(master, "/tmp/test/site.pp", manifest)
def inject_site_pp(master, site_pp_path, manifest) site_pp_dir = File.dirname(site_pp_path) create_remote_file(master, site_pp_path, manifest) set_perms_on_remote(master, site_pp_dir, "777") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inject_site_pp(master_host, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master_host, site_pp_path, manifest)\n\n set_perms_on_remote(master_host, site_pp_dir, '0744')\n end", "def inject_site_pp(master_host, site_pp_path, manifest)\n site_pp_dir = File.dirname(site_pp_path)\n create_remote_file(master_host, site_pp_path, manifest)\n\n set_perms_on_remote(master_host, site_pp_dir, '744')\n end", "def set_sitepp_content(manifest)\n content = <<-HERE\n node default {\n #{manifest}\n }\n HERE\n\n puppetserver.run_shell(\"echo '#{content}' > /etc/puppetlabs/code/environments/production/manifests/site.pp\")\nend", "def create_site_pp(master_host, opts = {})\n opts[:manifest] ||= ''\n opts[:node_def_name] ||= 'default'\n master_certname = on(master_host, puppet('config print certname')).stdout.rstrip\n\n default_def = <<-MANIFEST\nnode default {\n}\nMANIFEST\n\n node_def = <<-MANIFEST\nnode #{opts[:node_def_name]} {\n\n#{opts[:manifest]}\n}\nMANIFEST\n\n if opts[:node_def_name] != 'default'\n node_def = \"#{default_def}\\n#{node_def}\"\n end\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\n#{node_def}\nMANIFEST\n\n return site_pp\n end", "def set_sitepp_content(manifest)\n content = <<-HERE\n node default {\n #{manifest}\n }\n HERE\n\n master.run_shell(\"echo '#{content}' > /etc/puppetlabs/code/environments/production/manifests/site.pp\")\nend", "def set_sitepp_content(manifest)\n content = <<-HERE\n node default {\n #{manifest}\n }\n HERE\n\n master.run_shell(\"echo '#{content}' > /etc/puppetlabs/code/environments/production/manifests/site.pp\")\nend", "def get_site_pp_path(master_host, opts = {})\n opts[:env] ||= 'production'\n\n return File.join(get_manifests_path(master_host, opts), 'site.pp')\n end", "def install_site(site, opts={})\n user = opts[:user] || \"root\"\n group = opts[:group] || \"root\"\n mode = opts[:mode] || 0444\n enable = opts[:enable] != false\n source = opts[:source] || \"#{interpreter.dist}/#{self.sites_available}/#{site}\"\n target = opts[:target] || \"#{self.sites_available}/#{site}\"\n template = opts[:template] || false\n params = opts[:params] || {}\n\n modified = false\n if template\n template_source = template == true ? \"#{source}.erb\" : template\n modified |= interpreter.render(template_source, target, :user => user, :group => group, :mode => mode, :params => params)\n else\n modified |= interpreter.cp(source, target, :user => user, :group => group, :mode => mode)\n end\n if enable\n modified |= self.enable_site(site)\n end\n return modified\n end", "def copy_site\n target_dir = File.join(@deploy_dir, @remote_path).sub(/\\/$/,'')\n FileUtils.cp_r @local + '/.', target_dir\n message = \"Site updated at: #{Time.now.utc}\"\n `git add --all .`\n `git commit -m \\\"#{message}\\\"`\n end", "def add_wpcontent(sharedPath, application)\n Chef::Log.info \"Caylent-deploy.add_wpcontent:Wordpress add copy from #{node[:deploy][application][:current_path]}/wp-content\"\n Chef::Log.info \"Caylent-deploy.add_wpcontent:Wordpress add copy to #{sharedPath}\"\n execute \"copy wordpress framework\" do\n command \"rsync --recursive --compress #{node[:deploy][application][:current_path]}/wp-content/* #{sharedPath}\"\n only_if { File.exists?(\"#{node[:deploy][application][:current_path]}/wp-content\")}\n end\n \n end", "def push\n if File.exist?(@local)\n check_branch\n init_repo\n puts \"Syncing #{@local.sub(Dir.pwd.strip+'/', '')} files to #{@repo}.\"\n FileUtils.cd @deploy_dir do\n git_pull\n clean_deploy\n copy_site\n git_push\n end\n else\n abort \"Cannot find site build at #{@local}. Be sure to build your site first.\"\n end\n end", "def create_site_pp(master_certname, manifest='', node_def_name='default')\n default_def = <<-MANIFEST\nnode default {\n}\nMANIFEST\n\n node_def = <<-MANIFEST\nnode #{node_def_name} {\n\n#{manifest}\n}\nMANIFEST\n\n if node_def_name != 'default'\n node_def = \"#{default_def}\\n#{node_def}\"\n end\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\n#{node_def}\nMANIFEST\n\n return site_pp\nend", "def inject_modules(template)\n template['$INJECT_MODULES'] = script.modules_url.inspect\n template\n end", "def create_temp_dir_env(master, env_root_path, env_seed_name, manifest)\n env_name = \"#{env_seed_name}\" + rand(36**16).to_s(36)\n env_path = \"#{env_root_path}/#{env_name}\"\n env_site_pp_path = \"#{env_path}/manifests/site.pp\"\n\n on(master, \"mkdir -p #{env_path}/manifests #{env_path}/modules\")\n set_perms_on_remote(master, env_path, \"777\")\n\n inject_site_pp(master, env_site_pp_path, manifest)\n\n return env_name\nend", "def deploySite\n verifyOS\n timeDate = Time.new\n vConfig(CONFIG['configWebsite'])\n read_json(CONFIG['configWebsite'])\n compileP = @parse_json_config['deploy']['compile']['built']\n branchBuilt = @parse_json_config['deploy']['branch']['built']\n msgCommit = @parse_json_config['deploy']['github']['config']['commit']\n if compileP == \"yes\"\n system_commands(\"rake build\")\n end\n # enter_folder(\"./_site\") # DEPRECATED\n add_repo_git(SITEDIR)\n add_remoteurl(SITEDIR)\n pull_execute(branchBuilt, SITEDIR)\n system_commands(\"echo Deploy source files. Wait ...\")\n git_checkout(branchBuilt, SITEDIR)\n system_commands(\"cd #{SITEDIR}; git add .\")\n system_commands(\"cd #{SITEDIR}; git commit -m \\\"#{msgCommit} - #{timeDate.inspect}\\\"\")\n system_commands(\"cd #{SITEDIR}; git push origin -u #{branchBuilt}\")\n\n end", "def create_site\n # see if the site already exists\n abort \"'#{site}' already exists\" if test ?e, site\n\n # copy over files from the data directory\n files = site_files\n\n files.keys.sort.each do |dir|\n mkdir dir\n files[dir].sort.each {|file| cp file}\n end\n nil\n end", "def publish!\n inform \"Publishing local version to http://chapmanu.github.io/web-components\"\n \n # Production Configuration\n inform \"Building site with production configuration\"\n Jekyll::Site.new(Jekyll.configuration({\n \"source\" => \".\",\n \"destination\" => \"_site\"\n })).process\n\n Dir.mktmpdir do |tmp|\n FileUtils.cp_r \"_site/.\", tmp\n \n pwd = Dir.pwd\n Dir.chdir tmp\n\n cmd \"git init\"\n cmd \"git add .\"\n message = \"Site updated at #{Time.now.utc}\"\n cmd \"git commit -m #{message.inspect}\"\n cmd \"git remote add origin git@github.com:#{GITHUB_REPONAME}.git\"\n cmd \"git push origin master:refs/heads/gh-pages --force\"\n\n Dir.chdir pwd\n end\n inform \"Publish successful\"\n end", "def pack\n # Set the variable here so it can grab the contents of @working_tree (which\n # is set in the make_directory_tree method).\n @work = \"#{@working_tree['WORK_D']}\"\n \n # Download and unpack the Puppet Source\n safe_system(\"curl #{@puppet_url}/#{@puppet_tarfile} -o #{@puppet_tarfile}\")\n safe_system(\"#{TAR} xzf #{@puppet_tarfile}\")\n \n # Make all necessary directories\n FileUtils.mkdir_p(\"#{@work}/private/etc/puppet/\")\n FileUtils.mkdir_p(\"#{@work}/usr/bin\")\n FileUtils.mkdir_p(\"#{@work}/usr/sbin\")\n FileUtils.mkdir_p(\"#{@work}/usr/share/doc/puppet\")\n FileUtils.mkdir_p(\"#{@work}/usr/share/man/man5\")\n FileUtils.mkdir_p(\"#{@work}/usr/share/man/man8\")\n FileUtils.mkdir_p(\"#{@work}/Library/Ruby/Site/1.8/puppet\")\n \n # Install necessary files\n safe_system(\"#{INSTALL} -o root -g wheel -m 644 ./#{@puppet_file}/conf/auth.conf #{@work}/private/etc/puppet/auth.conf\")\n safe_system(\"#{DITTO} ./#{@puppet_file}/bin/ #{@work}/usr/bin\")\n safe_system(\"#{DITTO} ./#{@puppet_file}/sbin/ #{@work}/usr/sbin\")\n safe_system(\"#{INSTALL} -o root -g wheel -m 644 ./#{@puppet_file}/man/man5/puppet.conf.5 #{@work}/usr/share/man/man5/\")\n safe_system(\"#{DITTO} ./#{@puppet_file}/man/man8/ #{@work}/usr/share/man/man8\")\n safe_system(\"#{DITTO} ./#{@puppet_file}/lib/ #{@work}/Library/Ruby/Site/1.8/\")\n \n # Setup a preflight script and replace variables in the files with \n # the correct paths.\n safe_system(\"#{INSTALL} -o root -g wheel -m 644 ./#{@puppet_file}/conf/osx/preflight #{@working_tree['SCRIPT_D']}\")\n safe_system(\"sed -i '' \\\"s\\#{SITELIBDIR}\\#/usr/lib/ruby/site_ruby/1.8\\#g\\\" #{@working_tree['SCRIPT_D']}/preflight\")\n safe_system(\"sed -i '' \\\"s\\#{BINDIR}\\#/usr/bin\\#g\\\" #{@working_tree['SCRIPT_D']}/preflight\")\n \n # Install documentation (matching for files with capital letters)\n Dir.foreach(\"./#{@puppet_file}\") do |file|\n safe_system(\"#{INSTALL} -o root -g wheel -m 644 ./#{@puppet_file}/#{file} #{@work}/usr/share/doc/puppet\") if file =~ /^[A-Z][A-Z]/\n end\n\n # Set Permissions\n FileUtils.chmod_R(0755, \"#{@work}/usr/bin\")\n FileUtils.chown_R('root', 'wheel', \"#{@work}/usr/bin\")\n FileUtils.chmod_R(0755, \"#{@work}/usr/sbin\")\n FileUtils.chown_R('root', 'wheel', \"#{@work}/usr/sbin\")\n FileUtils.chmod_R(0755, \"#{@work}/usr/share/man/man8\")\n FileUtils.chown_R('root', 'wheel', \"#{@work}/usr/share/man/man8\")\n FileUtils.chmod_R(0644, \"#{@work}/Library/Ruby/Site/1.8/\")\n FileUtils.chown_R('root', 'wheel', \"#{@work}/Library/Ruby/Site/1.8/\")\n Find.find(\"#{@work}/Library/Ruby/Site/1.8/\") do |dir|\n FileUtils.chmod(0755, dir) if File.directory?(dir)\n end\nend", "def server_config(config)\n config.vm.provision :puppet, :module_path => '..' do |puppet|\n puppet.manifests_path = \"vagrant\"\n puppet.manifest_file = \"server.pp\"\n end\nend", "def inject_php_files\n \n raise \"We only inject php to gsteamer for now!\" if GardensTestRun.instance.gardener.stage != 'gsteamer'\n Log.logger.info(\"Injecting testing php files into stage: #{GardensTestRun.instance.gardener.stage}\")\n \n #TODO: These are hardcoded! Change that!\n managed_servers = ['managed-51.gsteamer.hosting.acquia.com', 'managed-47.gsteamer.hosting.acquia.com']\n \n managed_servers.each do |host|\n Log.logger.info(\"Inbjecting PHP file into host: #{host.inspect}.\")\n scp(host) {|remote|\n remote.upload!(\"../helpers/testing_themefolder_related.php\", \"/mnt/www/html/tangle001/docroot/testing_themefolder_related.php\")\n }\n end\n \n end", "def sync_spec_puppet_module\n copy_skel_files\n install_fixtures\n install_spec_helper\n\n # ONLY install init_spec.rb if no spec files already exist in spec/classes.\n # These files are otherwise not managed from here.\n unless @config[@origin].has_key?('no_init_spec')\n if (Dir.entries('spec/classes') - %w{. .. .gitkeep readme_spec.rb}).empty?\n install_template(\n [\"#{@templates}/init_spec.rb\"], 'spec/classes/init_spec.rb')\n end\n end\n end", "def update_site\n # ensure the site already exists\n abort \"'#{site}' does not exist\" unless test ?d, site\n\n # copy over files from the data/tasks directory\n files = site_files\n\n mkdir 'tasks'\n files['tasks'].sort.each {|file| cp file}\n\n nil\n end", "def add_to_site(site, path, content)\n page = ::Awestruct::Page.new(site,\n ::Awestruct::Handlers::LayoutHandler.new(site,\n ::Awestruct::Handlers::TiltHandler.new(site,\n ::Aweplug::Handlers::SyntheticHandler.new(site, content, path))))\n page.layout = @layout\n page.output_path = path\n site.pages << page\n page\n end", "def write(path)\n File.open(path, 'w') do |file|\n file.puts '# This Puppetfile is managed by Bolt. Do not edit.'\n modules.each { |mod| file.puts mod.to_spec }\n end\n rescue SystemCallError => e\n raise Bolt::FileError.new(\n \"#{e.message}: unable to write Puppetfile.\",\n path\n )\n end", "def install_template(path)\n puts \"Installing project template to #{path} ...\"\n template_dir = File.expand_path('../template', __FILE__)\n FileUtils.cp_r(\"#{template_dir}/.\", path)\n end", "def deploy\n system %Q[ssh -lroot \"#{server}\" <<'EOF'\n \tcat >\"#{remote_script_name}\" <<'EOS'\n#{generate}EOS\nchmod +x \"#{remote_script_name}\"\nsource \"#{remote_script_name}\"\nEOF\n ]\n end", "def write(path, moduledir = nil)\n File.open(path, 'w') do |file|\n file.puts '# This Puppetfile is managed by Bolt. Do not edit.'\n file.puts \"moduledir '#{moduledir.basename}'\" if moduledir\n modules.each { |mod| file.puts mod.to_spec }\n end\n rescue SystemCallError => e\n raise Bolt::FileError.new(\n \"#{e.message}: unable to write Puppetfile.\",\n path\n )\n end", "def write(path, moduledir = nil)\n File.open(path, 'w') do |file|\n if moduledir\n file.puts \"# This Puppetfile is managed by Bolt. Do not edit.\"\n file.puts \"# For more information, see https://pup.pt/bolt-modules\"\n file.puts\n file.puts \"# The following directive installs modules to the managed moduledir.\"\n file.puts \"moduledir '#{moduledir.basename}'\"\n file.puts\n end\n\n @modules.each { |mod| file.puts mod.to_spec }\n end\n rescue SystemCallError => e\n raise Bolt::FileError.new(\n \"#{e.message}: unable to write Puppetfile.\",\n path\n )\n end", "def deploy(package_path, opts={}, &block)\n end", "def deploy\n if @base_modules.nil?\n load_puppetfile_modules\n end\n\n if ! @base_modules.empty?\n pool_size = @overrides.dig(:modules, :pool_size)\n updated_modules = R10K::ContentSynchronizer.concurrent_sync(@base_modules, pool_size, logger)\n end\n\n if (@overrides.dig(:purging, :purge_levels) || []).include?(:puppetfile)\n logger.debug(\"Purging unmanaged Puppetfile content for environment '#{dirname}'...\")\n @puppetfile_cleaner.purge!\n end\n\n updated_modules\n end", "def add_to_site(site, file)\n page_path = Pathname.new file\n page = site.engine.load_site_page file\n page.layout = @layout\n page.output_path = File.join @output_dir, page_path.relative_path_from(Pathname.new @repo).dirname, 'index.html'\n site.pages << page\n page\n end", "def sync_puppet_manifests(deployment_info)\n sync_mclient = MClient.new(@ctx, \"puppetsync\", deployment_info.map{ |n| n['uid'] }.uniq)\n master_ip = deployment_info.first['master_ip']\n # Paths /puppet/modules and /puppet/manifests/ in master node set by FUEL\n # Check fuel source code /deployment/puppet/nailgun/manifests/puppetsync.pp\n sync_mclient.rsync(:modules_source => \"rsync://#{master_ip}:/puppet/modules/\",\n :manifests_source => \"rsync://#{master_ip}:/puppet/manifests/\"\n )\n end", "def generate(site)\n @site = site\n @app_engine = source_config\n\n unless app_yaml_exists?\n unless @app_engine\n raise \"App engine base configration not found\"\n end\n\n @app_engine[\"handlers\"] ||= {}\n\n write\n @site.keep_files ||= []\n @site.keep_files << \"app.yaml\"\n end\n end", "def stage_wp_site\n # Note - this assumes that the wordpress files are saved in the repository that\n # the WPDeploy script will look for them in a particular directory\n begin \n if AppConfig.wp_deploy_enabled?\n LOGGER.debug \"Staging original wordpress site for project #{self.label}\"\n wpd = WpDeploy.new(self.label)\n wpd.deploy\n else\n LOGGER.info \"Skipping staging of WordPress site for #{self.label} as wp_deploy is disabled\"\n end\n rescue Exception => e\n LOGGER.error \"Error occurred staging original wordpress site: #{e.message}\"\n end\n end", "def process\n\t\t\t\tbegin\n\t\t\t\t\t@site_name = self.args.join\n\t\t\t\t\tFileUtils.mkdir @site_name\n\t\t\t\t\tFileUtils.cp_r Dir.glob(File.expand_path('../../../new_site', __FILE__) + '/*'), File.join(self.source, @site_name)\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"pages\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media/images\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media/videos\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"media/sounds\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"includes\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"plugins\")\n\t\t\t\t\tFileUtils.mkdir_p File.join(self.source, @site_name, \"extras\")\n\t\t\t\t\tdefault_page\n\n\t\t\t\t\tp \"#{@site_name} created.\"\n\t\t\t\trescue Exception => e\n\t\t\t\t\tp e\n\t\t\t\tend\n\t\t\tend", "def create_manifest_file(manifest)\n target_node_name = ENV['TARGET_HOST']\n manifest_file = Tempfile.new(['manifest_', '.pp'])\n manifest_file.write(manifest)\n manifest_file.close\n if target_node_name.nil? || target_node_name == 'localhost'\n # no need to transfer\n manifest_file_location = manifest_file.path\n else\n # transfer to TARGET_HOST\n command = \"bundle exec bolt file upload #{manifest_file.path} /tmp/#{File.basename(manifest_file)} --nodes #{target_node_name} --inventoryfile inventory.yaml\"\n stdout, stderr, status = Open3.capture3(command)\n error_message = \"Attempted to run\\ncommand:'#{command}'\\nstdout:#{stdout}\\nstderr:#{stderr}\"\n raise error_message unless status.to_i.zero?\n\n manifest_file_location = \"/tmp/#{File.basename(manifest_file)}\"\n end\n manifest_file_location\n end", "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def run\n # the safe_create_module_files will render every file under the templates/module_files\n # folder in your gem and copy them to the destination.\n safe_create_module_files(template_dir, module_path, context)\n # Should you need to change the file name of the copied file you will have to move\n # the file outside of the module_files directory and\n # render it using: safe_create_template_file(file_path, template, context)\n cleanup(module_path, context.plugin_name)\n end", "def add_template_repo_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"springer-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/troyizzle/springer.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{springer/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def install_puppetfile(path, moduledir, config = {})\n @outputter.print_action_step(\"Syncing modules from #{path} to #{moduledir}\")\n @outputter.start_spin\n ok = Installer.new(config).install(path, moduledir)\n @outputter.stop_spin\n\n # Automatically generate types after installing modules\n if ok\n @outputter.print_action_step(\"Generating type references\")\n @pal.generate_types(cache: true)\n end\n\n @outputter.print_puppetfile_result(ok, path, moduledir)\n\n ok\n end", "def load_site site=nil\n @site = nil # reset site\n self.require_site\n current_site = self.site\n \n # load site-specific config\n current_site.extended_build_config('.', site) unless site.nil?\n \n # load site data (including plugins)\n current_site.load\n\n current_site\n end", "def add_image_to_site(site, image)\n page_path = Pathname.new image\n page = site.engine.load_site_page image\n page.output_path = File.join @output_dir, page_path.relative_path_from(Pathname.new @repo).dirname, File.basename(image)\n site.pages << page\n end", "def deploy(&block)\n in_directory do\n self.setup!\n self.push_with_retry!\n block.call(self, platform_api, output) if block_given?\n end\n ensure\n self.teardown!\n end", "def copy_repo(host, repo_filename, repo_name = 'simp_manual.repo')\n if File.exists?(repo_filename)\n puts('='*72)\n puts(\"Using repos defined in #{repo_filename}\")\n puts('='*72)\n scp_to(hosts, repo_filename, \"/etc/yum.repos.d/#{repo_name}\")\n else\n fail(\"File #{repo_filename} could not be found\")\n end\nend", "def create_site\n files = site_files\n\n # in update mode we only want to update the tasks directory\n if options[:update]\n FileUtils.mkdir_p site unless pretend?\n mkdir 'tasks'\n files['tasks'].sort.each {|file| cp file}\n else\n dirs = files.keys.concat %w[content layouts lib tasks templates]\n dirs.sort!\n dirs.uniq!\n\n # create the directories first\n dirs.each do |dir|\n next if dir =~ %r/^output\\/.*$/\n mkdir dir\n end\n\n # and the create the files under each directory\n dirs.each do |dir|\n next if dir =~ %r/^output(\\/.*)?$/\n files[dir].sort.each {|file| cp file}\n end\n end\n end", "def run(params={})\n config_name = params.has_key?(:config_name) ? params[:config_name].to_sym : :default\n\n # Validate config\n error 'No deploy configuration found' if @site.config[:deploy].nil?\n error \"No deploy configuration found for #{config_name}\" if @site.config[:deploy][config_name].nil?\n \n src_branch = @site.config[:deploy][config_name][:src_branch]\n dst_branch = @site.config[:deploy][config_name][:dst_branch]\n dst_remote = @site.config[:deploy][config_name][:dst_remote]\n \n error 'No source branch found in deployment configuration' if src_branch.nil?\n error 'No destination branch found in deployment configuration' if dst_branch.nil?\n error 'No destination remote found in deployment configuration' if dst_remote.nil?\n \n git = ::Git::Base.open('.')\n \n # Compile the site from scratch\n Nanoc::Tasks::Clean.new(@site).run\n \n # Check out the source branch\n puts \"Checking out #{src_branch}.\"\n git.checkout(src_branch)\n \n # Compile the site from scratch\n puts \"Compiling site.\"\n @site.compiler.run\n \n # Check out the destination branch\n puts \"Checking out destination branch.\"\n git.checkout(dst_branch)\n \n # Copy output files recursively into the current directory\n puts \"Copying files.\"\n FileUtils.cp_r(@site.config[:output_dir].chomp('/') + '/.', '.')\n \n # Automatically add and commit changes\n puts \"Committing changes.\"\n git.add\n git.commit(\"updated #{Time.now.to_s}\", :add_all => true)\n \n # Push changes to the destination repo/branch\n puts \"Pushing to #{dst_remote} #{dst_branch}.\"\n git.push(dst_remote, dst_branch)\n \n # Switch back to the source branch\n puts \"Checking out #{src_branch}.\"\n git.checkout(src_branch)\n end", "def cp_site_cookbooks\n info(\"Preparing site-cookbooks from project directory\")\n debug(\"Using cookbooks from #{site_cookbooks_dir}\")\n\n FileUtils.mkdir_p(tmpsitebooks_dir)\n FileUtils.cp_r(File.join(site_cookbooks_dir, \".\"), tmpsitebooks_dir)\n end", "def install_dev_repo_on(host, package, sha, repo_configs_dir)\n platform = host['platform'] =~ /^(debian|ubuntu)/ ? host['platform'].with_version_codename : host['platform']\n platform_configs_dir = File.join(repo_configs_dir, platform)\n\n case platform\n when /^(fedora|el|centos)-(\\d+)-(.+)$/\n variant = (($1 == 'centos') ? 'el' : $1)\n fedora_prefix = ((variant == 'fedora') ? 'f' : '')\n version = $2\n arch = $3\n\n #hack for https://tickets.puppetlabs.com/browse/RE-1990\n # Previously this used `host.is_pe?`, but with AIO this is no longer\n # reliable. Defaulting to `true` since these tests only happen in PE.\n if true\n pattern = \"pl-%s-%s-repos-pe-%s-%s%s-%s.repo\"\n else\n pattern = \"pl-%s-%s-%s-%s%s-%s.repo\"\n end\n repo_filename = pattern % [\n package,\n sha,\n variant,\n fedora_prefix,\n version,\n arch\n ]\n\n repo = fetch(\n \"http://builds.puppetlabs.lan/%s/%s/repo_configs/rpm/\" % [package, sha],\n repo_filename,\n platform_configs_dir\n )\n\n scp_to(host, repo, '/etc/yum.repos.d/')\n\n when /^(debian|ubuntu)-([^-]+)-(.+)$/\n variant = $1\n version = $2\n arch = $3\n\n list = fetch(\n \"http://builds.puppetlabs.lan/%s/%s/repo_configs/deb/\" % [package, sha],\n \"pl-%s-%s-%s.list\" % [package, sha, version],\n platform_configs_dir\n )\n\n scp_to host, list, '/etc/apt/sources.list.d'\n on host, 'apt-get update'\n else\n host.logger.notify(\"No repository installation step for #{platform} yet...\")\n end\n end", "def deploy_modules\n password_prompt\n system %Q!mlpm install!\n system %Q!mlpm deploy -u #{ @properties['ml.user'] } \\\n -p #{ @ml_password } \\\n -H #{ @properties['ml.server'] } \\\n -P #{ @properties['ml.app-port'] }!\n original_deploy_modules\n end", "def promote_assembly_aux(mode, assembly_or_workspace_id, service_module_name_x = nil, assembly_template_name = nil, opts = {})\n namespace = nil\n local_clone_dir_exists = nil\n\n post_body = {\n :assembly_id => assembly_or_workspace_id,\n :mode => mode.to_s\n }\n\n if service_module_name_x\n service_module_name = service_module_name_x\n if service_module_name_x =~ /(^[^:]+):([^:]+$)/\n namespace, service_module_name = [$1,$2]\n end\n post_body.merge!(:service_module_name => service_module_name)\n end\n\n namespace ||= opts[:default_namespace]\n if namespace\n local_clone_dir_exists = Helper(:git_repo).local_clone_dir_exists?(:service_module, service_module_name, :namespace => namespace)\n post_body.merge!(:namespace => namespace)\n post_body.merge!(:local_clone_dir_exists => true) if local_clone_dir_exists\n end\n\n post_body.merge!(:assembly_template_name => assembly_template_name) if assembly_template_name\n post_body.merge!(:use_module_namespace => true) if opts[:use_module_namespace]\n post_body.merge!(:description => opts[:description]) if opts[:description]\n response = post rest_url('assembly/promote_to_template'), post_body\n return response unless response.ok?()\n\n # synchronize_clone will load new assembly template into service clone on workspace (if it exists)\n commit_sha, workspace_branch, namespace, full_module_name, repo_url, version = response.data(:commit_sha, :workspace_branch, :module_namespace, :full_module_name, :repo_url, :version)\n service_module_name ||= response.data(:module_name)\n merge_warning_message = response.data(:merge_warning_message)\n opts = { :local_branch => workspace_branch, :namespace => namespace }\n\n if (mode == :update) || local_clone_dir_exists\n response = Helper(:git_repo).synchronize_clone(:service_module, service_module_name, commit_sha, opts)\n else\n response = Helper(:git_repo).create_clone_with_branch(:service_module, service_module_name, repo_url, workspace_branch, version, namespace)\n end\n return response unless response.ok?\n\n OsUtil.print(\"New assembly template '#{assembly_template_name}' created in service module '#{full_module_name}'.\", :yellow) if mode == :create\n OsUtil.print(merge_warning_message, :yellow) if merge_warning_message\n\n response\n end", "def copy_static_modules\n `cp -R #{Bebox::FilesHelper::templates_path}/puppet/#{self.step}/modules/* #{self.project_root}/puppet/steps/#{step_name}/modules/`\n end", "def file_inject(node, local_file, remote_file)\n code, _remote = node.inject_file(local_file, remote_file, 'root', false)\n code\nend", "def install_modules_on(hosts, modules, logger = nil)\n hosts.each do |host|\n logger.debug(\"Installing modules on #{host}\") if logger\n\n temp_dir_on(host) do |target_dir|\n modules.each do |name, source_path|\n target_file = File.join(target_dir, File.basename(source_path))\n logger.debug(\"Copying module #{name} from #{source_path} to #{target_file}\") if logger\n\n scp_to(host, source_path, target_file)\n on host, \"puppet module install --force --ignore-dependencies '#{target_file}'\"\n end\n end\n end\n\n nil\n end", "def get_template(path)\n if @mode == :production\n @manifest.serve(path)\n else\n @manifest.parse(path) if !@manifest.provides?(path) \n @manifest.serve(path)\n end\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-tailwinded-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/beyode/rails-tailwinded.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-tailwinded/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def dev(name, *args)\n mod name, :path => \"#{ENV['HOME']}/src/boxen/puppet-#{name}\"\nend", "def push(manifest, token)\n post(\n \"#{extension}/push\",\n data: { manifest: manifest },\n headers: { 'Conflux-User' => token },\n show_err_response: true\n )\n end", "def create_site(params={name:random_string})\n\t\tnew_site = site[:new]\n\t\tparams[:site] = params[:name]\n\t\tnew_site[:params].merge!(params)\n\t\tnew_site[:params][:address] = append_ftp_value(new_site[:params][:address],new_site[:params][:ftp_type])\n\t\tpost(new_site)\n\tend", "def deploy_remote_sdfile(application_package, sd_filename, params={})\n remotehost = hostlist.first\n proxy = @vespa.nodeproxies[remotehost]\n content = proxy.readfile(sd_filename)\n local_sdfilename = selfdir+File.basename(sd_filename)\n File.open(local_sdfilename, \"w\") do |file|\n file.write(content)\n end\n deploy(application_package, local_sdfilename, params)\n FileUtils.rm_rf(local_sdfilename)\n end", "def apply_manifest_on(host, manifest, opts = {}, &block)\n on_options = {:stdin => manifest + \"\\n\"}\n on_options[:acceptable_exit_codes] = opts.delete(:acceptable_exit_codes)\n args = [\"--verbose\"]\n args << \"--parseonly\" if opts[:parseonly]\n args << \"--trace\" if opts[:trace]\n\n if opts[:catch_failures]\n args << '--detailed-exitcodes'\n\n # From puppet help:\n # \"... an exit code of '2' means there were changes, an exit code of\n # '4' means there were failures during the transaction, and an exit\n # code of '6' means there were both changes and failures.\"\n # We're after failures specifically so catch exit codes 4 and 6 only.\n on_options[:acceptable_exit_codes] |= [0, 2]\n end\n\n # Not really thrilled with this implementation, might want to improve it\n # later. Basically, there is a magic trick in the constructor of\n # PuppetCommand which allows you to pass in a Hash for the last value in\n # the *args Array; if you do so, it will be treated specially. So, here\n # we check to see if our caller passed us a hash of environment variables\n # that they want to set for the puppet command. If so, we set the final\n # value of *args to a new hash with just one entry (the value of which\n # is our environment variables hash)\n if opts.has_key?(:environment)\n args << { :environment => opts[:environment]}\n end\n\n on host, puppet( 'apply', *args), on_options, &block\n end", "def copy_gem(spec, destination)\n message(\"copying #{spec.name} #{spec.version} to #{destination}\")\n cp_r(\"#{spec.full_gem_path}/.\",destination)\n end", "def push_file(user, host, copy_path, paste_path, sudo = false)\n ping(user, host) do\n begin\n file = open(copy_path)\n write_body(user, host, file.read(File.size(copy_path)), paste_path)\n file.close if file\n rescue\n \"No such file.\"\n end\n end\n end", "def deploy_local(appdir, appname, params={})\n @vespa.deploy_local(appdir, appname, @vespa.nodeproxies[hostlist.first], selfdir, params)\n end", "def add_template_repository_to_source_path\n template_dir =\n if __FILE__ =~ %r{\\Ahttps?://}\n clone_repo\n else\n File.dirname(__FILE__)\n end\n\n source_paths.unshift(template_dir)\n puts \"*** source_paths: (#{source_paths.join(\" \")})\"\n puts \"*** template_dir: (#{template_dir})\"\n template_dir\nend", "def add_template_repository_to_source_path\n template_dir =\n if __FILE__ =~ %r{\\Ahttps?://}\n clone_repo\n else\n File.dirname(__FILE__)\n end\n\n source_paths.unshift(template_dir)\n puts \"*** source_paths: (#{source_paths.join(\" \")})\"\n puts \"*** template_dir: (#{template_dir})\"\n template_dir\nend", "def apply_manifest_on(host, manifest, options={}, &block)\n on_options = {:stdin => manifest + \"\\n\"}\n on_options[:acceptable_exit_codes] = options.delete(:acceptable_exit_codes) if options.keys.include?(:acceptable_exit_codes)\n args = [\"--verbose\"]\n args << \"--parseonly\" if options[:parseonly]\n args << \"--trace\" if options[:trace]\n\n if options[:catch_failures]\n args << '--detailed-exitcodes'\n\n # From puppet help:\n # \"... an exit code of '2' means there were changes, an exit code of '4' means there were\n # failures during the transaction, and an exit code of '6' means there were both\n # changes and failures.\"\n # We're after failures specifically so catch exit codes 4 and 6 only.\n on_options[:acceptable_exit_codes] = [0, 2]\n end\n\n # Not really thrilled with this implementation, might want to improve it later. Basically, there is a magic\n # trick in the constructor of PuppetCommand which allows you to pass in a Hash for the last value in the *args\n # Array; if you do so, it will be treated specially. So, here we check to see if our caller passed us a hash\n # of environment variables that they want to set for the puppet command. If so, we set the final value of\n # *args to a new hash with just one entry (the value of which is our environment variables hash)\n args << { :environment => options[:environment]} if options.has_key?(:environment)\n\n on host, puppet_apply(*args), on_options, &block\n end", "def dev(name, *args)\n mod \"puppet-#{name}\", :path => \"#{ENV['HOME']}/src/puppet/modules/#{name}\"\nend", "def deploy_mod(name, version, location)\n mod_name = name.split('-')[1]\n\n begin\n amods = @pem.modules\n if amods.keys.include?(name) && amods[name].get_version(version)\n FileUtils.cp_r(amods[name].get_version(version).location, \"#{location}/#{mod_name}\")\n File.open(\"#{location}/#{mod_name}/.pemversion\", 'w+') do |file|\n file.write({ 'version' => version, 'name' => name }.to_yaml)\n end\n else\n err = \"Unkown module or version supplied for #{name} @ #{version} \"\n Pem::Logger.logit(err, :fatal)\n throw(err)\n end\n rescue StandardError => err\n Pem::Logger.logit(err, :fatal)\n raise(err)\n end\n end", "def pull_directory(path)\n template = File.join(@user.homedir, 'git', 'template')\n FileUtils.rm_r(template) if File.exist? template\n\n git_path = File.join(@user.homedir, 'git')\n FileUtils.cp_r(path, git_path)\n\n Utils.oo_spawn(ERB.new(GIT_INIT).result(binding),\n chdir: template,\n expected_exitstatus: 0)\n begin\n # trying to clone as the user proved to be painful as git managed to \"loose\" the selinux context\n Utils.oo_spawn(ERB.new(GIT_LOCAL_CLONE).result(binding),\n chdir: git_path,\n expected_exitstatus: 0)\n rescue ShellExecutionException => e\n FileUtils.rm_r(@path) if File.exist? @path\n\n raise ShellExecutionException.new(\n 'Failed to clone application git repository from template repository',\n e.rc, e.stdout, e.stderr)\n ensure\n FileUtils.rm_r(template)\n end\n end", "def install(specs, path, moduledir, config = {}, force: false, resolve: true)\n @outputter.print_message(\"Installing project modules\\n\\n\")\n\n if resolve != false\n specs = Specs.new(specs, config)\n\n # If forcibly installing or if there is no Puppetfile, resolve\n # and write a Puppetfile.\n if force || !path.exist?\n @outputter.print_action_step(\"Resolving module dependencies, this might take a moment\")\n\n # This doesn't use the block as it's more testable to just mock *_spin\n @outputter.start_spin\n puppetfile = Resolver.new.resolve(specs, config)\n @outputter.stop_spin\n\n # We get here either through 'bolt module install' which uses the\n # managed modulepath (which isn't configurable) or through bolt\n # project init --modules, which uses the default modulepath. This\n # should be safe to assume that if `.modules/` is the moduledir the\n # user is using the new workflow\n @outputter.print_action_step(\"Writing Puppetfile at #{path}\")\n if moduledir.basename.to_s == '.modules'\n puppetfile.write(path, moduledir)\n else\n puppetfile.write(path)\n end\n # If not forcibly installing and there is a Puppetfile, assert\n # that it satisfies the specs.\n else\n puppetfile = Puppetfile.parse(path)\n puppetfile.assert_satisfies(specs)\n end\n end\n\n # Install the modules.\n install_puppetfile(path, moduledir, config)\n end", "def write\n self.open_file('config/site.yml') do |file|\n self.output_resource_op self.mounting_point.site\n\n file.write(self.mounting_point.site.to_yaml)\n\n self.output_resource_op_status self.mounting_point.site\n end\n end", "def puppet_master_install(opts = {}, &block)\n RSpecSystemPuppet::Helpers::PuppetMasterInstall.new(opts, self, &block)\n end", "def copy_file_to_remote(host, file_path, file_content)\n block_on host do |host|\n Tempfile.open 'beaker' do |tempfile|\n File.open(tempfile.path, 'w') { |file| file.puts file_content }\n\n host.do_scp_to(tempfile.path, file_path, @options)\n end\n end\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-app-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n \"https://github.com/andersklenke/rails-app-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def create_manifest_file(manifest, opts = {})\n require 'tmpdir'\n target_node_name = ENV.fetch('TARGET_HOST', nil)\n tmp_filename = File.join(Dir.tmpdir, \"manifest_#{Time.now.strftime('%Y%m%d')}_#{Process.pid}_#{rand(0x100000000).to_s(36)}.pp\")\n manifest_file = File.open(tmp_filename, 'w')\n manifest_file.write(manifest)\n manifest_file.close\n if target_node_name.nil? || target_node_name == 'localhost'\n # no need to transfer\n manifest_file_location = manifest_file.path\n else\n # transfer to TARGET_HOST\n inventory_hash = inventory_hash_from_inventory_file\n target_option = opts['targets'] || opts[:targets]\n target_node_name = search_for_target(target_option, inventory_hash) unless target_option.nil?\n\n manifest_file_location = File.basename(manifest_file)\n bolt_result = upload_file(manifest_file.path, manifest_file_location, target_node_name, options: {}, config: nil, inventory: inventory_hash)\n raise bolt_result.first['value'].to_s unless bolt_result.first['status'] == 'success'\n end\n\n manifest_file_location\n end", "def apply\n started_at = DateTime.now.to_s\n # Check if a Puppetfile is neccesary for use/not use librarian-puppet\n check_puppetfile_content\n # Copy static modules that are not downloaded by librarian-puppet\n copy_static_modules\n # Apply step and if the process is succesful create the checkpoint.\n process_status = apply_step\n create_step_checkpoint(started_at) if process_status.success?\n process_status\n end", "def set_modulepath(modulepath)\n @env = Puppet::Node::Environment.new(Puppet[:environment])\n Puppet[:modulepath] = modulepath || @env[:modulepath]\n end", "def copied_remote(path)\n remote = File.expand_path(testpath(path))\n remote_copied = tmp_path(\"remote_copied\")\n\n FileUtils.cp_r remote, remote_copied\n\n remote_copied\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n tempdir = Dir.mktmpdir(\"template-tmp\")\n source_paths.unshift(tempdir + \"/rails/muffi_template\")\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n \"https://github.com/abtion/guidelines.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def copy_master_slide(name, clone_from, clone_from_position, clone_from_password = nil, clone_from_storage = nil, apply_to_all = nil, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = copy_master_slide_with_http_info(name, clone_from, clone_from_position, clone_from_password, clone_from_storage, apply_to_all, password, folder, storage)\n data\n end", "def create_puppetfile(puppetfile_contents)\n File.open('Puppetfile', 'w') do |file|\n file.write puppetfile_contents\n end\n end", "def add_webpub_manifest!\n system \"cd #{share_path}; #{Rails.root.join('script/create_manifest')} #{edition.store_link}\"\n end", "def stub_jekyll_site(opts = {})\n path = File.expand_path(\"../../fixture\", __FILE__)\n Jekyll::RSpecHelpers.cleanup_trash\n\n silence_stdout do\n Jekyll::Site.new(Jekyll.configuration(opts.merge({\n \"source\" => path, \"destination\" => File.join(path, \"_site\")\n }))).tap(&:read)\n end\n end", "def create(path)\n self.destination_root = path\n\n copy_file(\".gitignore\")\n copy_file(\"config.ru\")\n copy_file(\"Gemfile\")\n copy_file(\"Procfile\")\n copy_file(\"README.md\")\n\n copy_content\n copy_themes\n end", "def copy_module (path, name)\n module_path = File.join(path, name)\n puts module_path\n mkdir_p module_path\n copy_all_but_fixtures('.', module_path)\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n TEMPLATE_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def cp( file )\n src = template / file\n dst = site / file\n\n if test(?e, dst)\n if identical?(src, dst)\n identical(dst)\n return\n end\n\n choice = case options[:collision]\n when :force then :force\n when :skip then :skip\n else force_file_collision?( dst ) end\n\n case choice\n when :force then force(dst)\n when :skip then skip(dst); return\n else raise \"Invalid collision choice: #{choice.inspect}\" end\n else\n create(dst)\n end\n return if pretend?\n\n FileUtils.cp(src, dst)\n end", "def is_manifest_exists?\n abort \"ERROR : No ssh session found\" if @ssh.nil?\n r = @ssh.do_ssh_cmd(\"ls #{@puppetfolder}/manifests/site.pp\")\n r[:exit_code].eql? 0\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstarter-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/whatapalaver/jumpstarter.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstarter/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend" ]
[ "0.8374873", "0.8358925", "0.6207552", "0.6191572", "0.6177562", "0.6177562", "0.60841703", "0.5300444", "0.52765256", "0.51313573", "0.50357187", "0.50072366", "0.47951895", "0.47606674", "0.47088793", "0.46950063", "0.4690981", "0.46466935", "0.46059483", "0.45476407", "0.45456713", "0.45437494", "0.45384648", "0.45260835", "0.45065856", "0.4478199", "0.44614384", "0.4445036", "0.44327253", "0.44308558", "0.44085", "0.4397025", "0.43953195", "0.43732807", "0.43652678", "0.43618074", "0.43370453", "0.43370453", "0.43370453", "0.43370453", "0.43370453", "0.43370453", "0.43316427", "0.42906043", "0.4272759", "0.42664832", "0.42628926", "0.42562667", "0.42501876", "0.42446002", "0.4226433", "0.42242116", "0.42237133", "0.4215476", "0.42145962", "0.41748887", "0.41625032", "0.41624773", "0.4157615", "0.41558826", "0.41503528", "0.41503528", "0.41503528", "0.41503528", "0.41503528", "0.41503528", "0.41503528", "0.4149126", "0.41373214", "0.4127594", "0.41255692", "0.4113831", "0.41081223", "0.4107641", "0.41042036", "0.41042036", "0.41002303", "0.40931192", "0.40827903", "0.4081373", "0.40786734", "0.40693396", "0.40597177", "0.40497956", "0.4048989", "0.40400472", "0.40335083", "0.4029904", "0.40252742", "0.40242442", "0.40241984", "0.40217358", "0.40207672", "0.4016268", "0.40011284", "0.3993546", "0.39774966", "0.39740336", "0.39669755", "0.39601097" ]
0.82689875
2
Create a temporary directory environment and inject a "site.pp" for the target environment. ==== Attributes +master+ The master on which to create a new Puppet environment. +env_root_path+ The base path on the master that contains all environments. +env_seed_name+ The seed name to use for generating an environment name. +manifest+ The manifest content to inject into "site.pp" of the newly created environment. ==== Returns +string+ The environment name that was generated. ==== Examples temp_env_name = create_temp_dir_env(master, "/tmp/test/site.pp", "stuff", manifest)
def create_temp_dir_env(master, env_root_path, env_seed_name, manifest) env_name = "#{env_seed_name}" + rand(36**16).to_s(36) env_path = "#{env_root_path}/#{env_name}" env_site_pp_path = "#{env_path}/manifests/site.pp" on(master, "mkdir -p #{env_path}/manifests #{env_path}/modules") set_perms_on_remote(master, env_path, "777") inject_site_pp(master, env_site_pp_path, manifest) return env_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mk_tmp_environment(environment)\n # add the tmp_environment to a set to ensure no collisions\n @@tmp_environment_set ||= Set.new\n deadman = 100; loop_num = 0\n while @@tmp_environment_set.include?(tmp_environment = environment.downcase + '_' + random_string) do\n break if (loop_num = loop_num + 1) > deadman\n end\n @@tmp_environment_set << tmp_environment\n tmpdir = File.join('','tmp',tmp_environment)\n\n on master, \"mkdir -p #{tmpdir}/manifests #{tmpdir}/modules\"\n\n # register teardown to remove the link below\n teardown do\n on master, \"rm -rf #{File.join(environmentpath,tmp_environment)}\"\n end\n\n # WARNING: this won't work with filesync (symlinked environments are not supported)\n on master, \"ln -sf #{tmpdir} #{File.join(environmentpath,tmp_environment)}\"\n return tmp_environment\n end", "def generate_base_directory_environments(tmpdir)\n puppet_conf = \"#{tmpdir}/puppet2.conf\"\n dir_envs = \"#{tmpdir}/environments\"\n\n step 'Configure a the direnv directory environment'\n apply_manifest_on master, %Q{\n File {\n ensure => directory,\n owner => #{master.puppet['user']},\n group => #{master.puppet['group']},\n mode => \"0750\",\n }\n file {\n [\n '#{dir_envs}',\n '#{dir_envs}/direnv',\n ]:\n }\n\n file {\n '#{puppet_conf}':\n ensure => file,\n content => \"\n [main]\n environmentpath=#{dir_envs}\n \"\n }\n }\n\n return puppet_conf\n end", "def generate_environment(options)\n modulepath = options[:modulepath]\n manifestpath = options[:manifestpath]\n env_name = options[:env_name]\n\n environment = <<-MANIFEST_SNIPPET\n file {\n ###################################################\n # #{env_name}\n #{generate_module(\"testing_mod\", env_name, modulepath)}\n\n \"#{manifestpath}\":;\n \"#{manifestpath}/site.pp\":\n ensure => file,\n content => '\n notify { \"in #{env_name} site.pp\": }\n include testing_mod\n '\n ;\n }\n MANIFEST_SNIPPET\n end", "def create_env_archive(name)\n if !@envs.keys.include?(name)\n err = 'Invalid environment name supplied'\n Pem.log_error(err, @logger)\n raise err\n else\n begin\n tmpfile = Tempfile.new\n\n Dir.chdir(@conf['envdir']) do\n Minitar.pack(name, Zlib::GzipWriter.new(tmpfile))\n end\n\n return tmpfile\n rescue StandardError => err\n Pem.log_error(err, @logger)\n raise err\n end\n end\n end", "def environment_manifest(testdir)\n manifest = <<-MANIFEST\n File {\n ensure => directory,\n owner => puppet,\n mode => 0700,\n }\n\n file { \"#{testdir}\": }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/modules\",\n :manifestpath => \"#{testdir}/manifests\",\n :env_name => \"default environment\")}\n\n #{generate_environment(\n :modulepath => \"#{testdir}/testing-modules\",\n :manifestpath => \"#{testdir}/testing-manifests\",\n :env_name => \"legacy testing environment\")}\n\n file {\n \"#{testdir}/dynamic\":;\n \"#{testdir}/dynamic/testing\":;\n }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/dynamic/testing/modules\",\n :manifestpath => \"#{testdir}/dynamic/testing/manifests\",\n :env_name => \"dynamic testing environment\")}\n\n file {\n \"#{testdir}/environments\":;\n \"#{testdir}/environments/testing\":;\n }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/environments/testing/modules\",\n :manifestpath => \"#{testdir}/environments/testing/manifests\",\n :env_name => \"directory testing environment\")}\n\n file {\n \"#{testdir}/environments/testing_environment_conf\":;\n }\n\n #{generate_environment(\n :modulepath => \"#{testdir}/environments/testing_environment_conf/nonstandard-modules\",\n :manifestpath => \"#{testdir}/environments/testing_environment_conf/nonstandard-manifests\",\n :env_name => \"directory testing with environment.conf\")}\n\n file { \"#{testdir}/environments/testing_environment_conf/environment.conf\":\n ensure => file,\n content => '\n modulepath = nonstandard-modules:$basemodulepath\n manifest = nonstandard-manifests\n config_version = local-version.sh\n '\n }\n\n file {\n \"#{testdir}/environments/testing_environment_conf/local-version.sh\":\n ensure => file,\n content => '#! /usr/bin/env bash\n echo \"local testing_environment_conf\"'\n ;\n }\n\n ###################\n # Services\n\n file {\n \"#{testdir}/services\":;\n \"#{testdir}/services/testing\":;\n #{generate_module('service_mod',\n \"service testing environment\",\n \"#{testdir}/services/testing/modules\")}\n }\n\n #######################\n # Config version script\n\n file {\n \"#{testdir}/static-version.sh\":\n ensure => file,\n content => '#! /usr/bin/env bash\n echo \"static\"'\n ;\n }\n MANIFEST\n end", "def maketempdir(prefix_suffix=nil, parent_dir=nil)\n Dir.mktmpdir(prefix_suffix, parent_dir)\n end", "def temp_dir\n name = 'tmp_' + rand.to_s.gsub(/\\D/, '')\n File.join(@temp_root, name)\n end", "def new_puppet_testing_environment\n environment_name = 'puppet_agent_testing_' + SecureRandom.hex(10).to_s\n puppet_testing_environment = environment_location(environment_name)\n step '(Master) Create test environment' do\n on(master, \"mkdir -p #{File.join(puppet_testing_environment, 'modules')}\")\n on(master, \"mkdir -p #{File.join(puppet_testing_environment, 'manifests')}\")\n end\n step '(Master) Install puppet_agent to the test environment' do\n install_puppet_agent_module_on(master, environment_name)\n end\n environment_name\n end", "def tempdir_name\n dir = File.join(Dir.tmpdir, SecureRandom.uuid)\n refute(Dir.exists?(dir))\n dir\n end", "def host_tmpdir(stage)\n @host_tmpdirs ||= {}\n @host_tmpdirs[stage.to_s] ||= begin\n dimg.tmp_path(dimg.dapp.consistent_uniq_slugify(dimg.config._name || \"nameless\"), \"ansible-tmpdir-#{stage}\").tap do |p|\n p.mkpath\n p.join('local').mkpath\n p.join('remote').mkpath\n end\n end\n end", "def createPuppetMasterEnv(json_loaded)\n git_working_dir = json_loaded['environment_path']\n git_buildoop_branch = json_loaded['environment_branch']\n puppet_environment = json_loaded['environment_cluster']\n\n @outputHandler.msgOutput 'Patch to environments: ' + git_working_dir\n @outputHandler.msgOutput 'Based on Buildoop branch: ' + git_buildoop_branch\n\n # git staff\n g = Git.open(git_working_dir, :log => Logger.new(STDOUT))\n g.branches.remote\n g.branch(git_buildoop_branch).checkout\n\n if confirm_action? \"the /etc/puppet/environments/#{puppet_environment} will be erased,\"\n FileUtils.rm_rf(\"/etc/puppet/environments/#{puppet_environment}\")\n\n # copy environment to puppet location\n FileUtils.cp_r git_working_dir + \"/all\", \n '/etc/puppet/environments', :verbose => true\n FileUtils.cp_r git_working_dir + \"/cluster-name\", \n \"/etc/puppet/environments/#{puppet_environment}\", :verbose => true\n\n fillExtlookupCSV json_loaded\n end\n end", "def make_tmp_dir dir\n tmp_dir = File.join dir, \"lsa_cluster_tmp.#{rand}\"\n\n # Make sure tmp_dir doesn't already exist\n while Dir.exist? tmp_dir\n tmp_dir = File.join dir, \"lsa_cluster_tmp.#{rand}\"\n end\n\n FileUtils.mkdir_p tmp_dir\n\n tmp_dir\nend", "def make_tmp_dir\n if(!File.directory? @temp_dir)\n Dir.mkdir(@temp_dir)\n end\n end", "def maketempfile(prefix_suffix=nil, parent_dir=nil)\n Dir::Tmpname.create(prefix_suffix || \"f\", parent_dir || Dir.tmpdir) {|n| FileUtils.touch(n)}\n end", "def make_tmpdir_name(base)\n require 'tmpdir'\n\n t = Time.now.strftime('%Y%m%d')\n name = \"#{base}#{t}-#{Process.pid}-#{rand(0x100000000).to_s(36)}\"\n File.join(Dir.tmpdir, name)\n end", "def run_generator_in_tmp(args=[])\n FileUtils.cd(tmp_dir) do\n FileUtils.mkdir_p('config/environments')\n FileUtils.touch('config/environments/development.rb')\n FileUtils.touch('config/environments/production.rb')\n @output = run_generator(args)\n end\n end", "def temp_dir(prefix_suffix = nil, *args)\n prefix_suffix = fix_prefix_suffix(prefix_suffix || 'd')\n if block_given?\n Dir.mktmpdir(prefix_suffix, *args) do |dir|\n yield new(dir)\n end\n else\n new(Dir.mktmpdir(prefix_suffix, *args))\n end\n end", "def build_workspace_dir(root_dir, dirname, uuid)\n \"/#{root_dir}/#{dirname}-#{uuid}\"\nend", "def environmentpath\n @@memoized_environmentpath ||= master.puppet['environmentpath']\n end", "def create_site_pp(master_host, opts = {})\n opts[:manifest] ||= ''\n opts[:node_def_name] ||= 'default'\n master_certname = on(master_host, puppet('config print certname')).stdout.rstrip\n\n default_def = <<-MANIFEST\nnode default {\n}\nMANIFEST\n\n node_def = <<-MANIFEST\nnode #{opts[:node_def_name]} {\n\n#{opts[:manifest]}\n}\nMANIFEST\n\n if opts[:node_def_name] != 'default'\n node_def = \"#{default_def}\\n#{node_def}\"\n end\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\n#{node_def}\nMANIFEST\n\n return site_pp\n end", "def mktemp\n # I used /tmp rather than mktemp -td because that generates a directory\n # name with exotic characters like + in it, and these break badly written\n # scripts that don't escape strings before trying to regexp them :(\n tmp=Pathname.new `/usr/bin/mktemp -d /tmp/homebrew-#{name}-#{version}-XXXX`.strip\n raise \"Couldn't create build sandbox\" if not tmp.directory? or $? != 0\n begin\n wd=Dir.pwd\n Dir.chdir tmp\n yield\n ensure\n Dir.chdir wd\n tmp.rmtree\n end\n end", "def make_tmpdir\n unless @tmpdir\n @tmpdir = Dir.tmpdir\n at_exit { FileUtils.rm_rf(@tmpdir) }\n end\n @tmpdir\n end", "def create_tmp_prj_dir\n begin\n Dir.mkdir(@test_tmp,0777)\n Dir.mkdir(@test_prj_dir,0777)\n rescue Exception => e\n puts \"Could not make #{@test_tmp} dirs at #{Dir.getwd} - #{e.to_s}\"\n end\n @test_prj_dir \n end", "def assert_that_puppet_environment_directory_exists\n target_dir = File.join(@builddir.tempdir, 'environments', environment)\n return if File.directory?(target_dir)\n raise Errno::ENOENT, \"Environment directory #{target_dir} does not exist\"\n end", "def create_temp_dir(name, location)\n @@temporary_dir_number += 1\n pid = Process.pid # This doesn't work on some platforms, according to the docs. A better way to get it would be nice.\n random_number = Kernel.rand(1000000000).to_s # This is to avoid a possible symlink attack vulnerability in the creation of temporary files.\n complete_dir_name = \"#{location}/#{name}.#{pid}.#{random_number}.#{@@temporary_dir_number}\"\n\n yield_result = Object.new\n\n FileUtils.mkdir_p(complete_dir_name)\n Dir.chdir(complete_dir_name) do\n begin\n yield_result = yield\n ensure\n FileUtils.rmtree([complete_dir_name])\n end\n end\n\n yield_result\n end", "def new_tempfile\n intopdir = Pathname.new(Tempfile.new('dummy').path)\n subdir = intopdir.parent + 'manual/'\n subdir.mkpath\n Pathname.new(Tempfile.new(['data-ids', '.csv'], subdir).path)\nend", "def mktmpdir\n prefix = File.basename($0).sub(/\\.rb$/, '-')\n dir = Dir.mktmpdir(prefix)\n at_exit do\n FileUtils.rm_rf dir, secure: true\n end\n dir\nend", "def make_tmpdir_name(base)\n Dir::Tmpname.make_tmpname(File.join(Dir.tmpdir, base), nil)\n end", "def mktestdir\n testdir = File.join(tmpdir, \"remotefilecopytesting\")\n @@tmpfiles << testdir\n\n # create a tmpfile\n pattern = \"tmpfile\"\n tmpfile = File.join(testdir, pattern)\n assert_nothing_raised {\n Dir.mkdir(testdir)\n File.open(tmpfile, \"w\") { |f|\n 3.times { f.puts rand(100) }\n }\n }\n\n [testdir, %r{#{pattern}}, tmpfile]\n end", "def tempdir #:doc:\n Dir.tmpdir\n end", "def mktemp\n FileUtils.rm_rf(TMPDIR)\n FileUtils.mkdir(TMPDIR)\nend", "def create_role_directory\n `cd #{self.project_root} && mkdir -p puppet/roles/#{self.name}/manifests`\n end", "def create_manifest_file(manifest)\n target_node_name = ENV['TARGET_HOST']\n manifest_file = Tempfile.new(['manifest_', '.pp'])\n manifest_file.write(manifest)\n manifest_file.close\n if target_node_name.nil? || target_node_name == 'localhost'\n # no need to transfer\n manifest_file_location = manifest_file.path\n else\n # transfer to TARGET_HOST\n command = \"bundle exec bolt file upload #{manifest_file.path} /tmp/#{File.basename(manifest_file)} --nodes #{target_node_name} --inventoryfile inventory.yaml\"\n stdout, stderr, status = Open3.capture3(command)\n error_message = \"Attempted to run\\ncommand:'#{command}'\\nstdout:#{stdout}\\nstderr:#{stderr}\"\n raise error_message unless status.to_i.zero?\n\n manifest_file_location = \"/tmp/#{File.basename(manifest_file)}\"\n end\n manifest_file_location\n end", "def temp_dir\n dir = make_temp_dir\n chown(dir, user)\n dir\n end", "def tmp_root_path\n @tmp_root_path ||= File.realpath(Dir.mktmpdir)\n end", "def clone_repo_into_temp_directory\n require \"tmpdir\"\n tempdir = Dir.mktmpdir(REPO_NAME)\n puts \"*** tempdir: (#{tempdir})\"\n\n at_exit { FileUtils.remove_entry(tempdir) }\n\n git clone: [\"--quiet\", REPO, tempdir].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[BRANCH_NAME_REGEX, 1])\n Dir.chdir(tempdir) do\n git checkout: branch\n end\n end\n\n # template_dir\n File.join(tempdir,TEMPLATE_DIR_NAME)\nend", "def mk_tmp_dir\n Dir.mktmpdir('janna-tmp-download-', '/tmp')\n end", "def publish_tmp_dir_path()\n user_tmp_dir_container = ENV['DOCS_TMP_DIR_CONTAINER']\n if (not user_tmp_dir_container.nil?) && user_tmp_dir_container.length > 0\n subdir = File.join(\n user_tmp_dir_container,\n SecureRandom.uuid\n )\n else\n subdir = SecureRandom.uuid\n end\n\n return File.join(\n Dir.tmpdir(),\n subdir\n )\n end", "def create_workspace\n @workspace = Dir.mktmpdir.chomp\n end", "def mkdir(relative_path)\n new_dir = File.join self.tmpdir, relative_path\n FileUtils.mkdir_p new_dir\n new_dir\n end", "def temporary_directory\n \"#{ROOT}/spec/tmp\"\n end", "def mktempdir(filename, mask=true)\n fn = mask ? tmpnam(filename) : filename\n Dir.mkdir(fn)\n return fn\n end", "def tempfile_dirnames\n # in why-run mode we need to create a Tempfile to compare against, which we will never\n # wind up deploying, but our enclosing directory for the destdir may not exist yet, so\n # instead we can reliably always create a Tempfile to compare against in Dir::tmpdir\n if Chef::Config[:why_run]\n [ Dir.tmpdir ]\n else\n case Chef::Config[:file_staging_uses_destdir]\n when :auto\n # In auto mode we try the destination directory first and fallback to ENV['TMP'] if\n # that doesn't work.\n [ ::File.dirname(@new_resource.path), Dir.tmpdir ]\n when true\n [ ::File.dirname(@new_resource.path) ]\n when false\n [ Dir.tmpdir ]\n else\n raise Chef::Exceptions::ConfigurationError, \"Unknown setting '#{Chef::Config[:file_staging_uses_destdir]}' for Chef::Config[:file_staging_uses_destdir]. Possible values are :auto, true or false.\"\n end\n end\n end", "def lotemix_tempdir\n if File.exist?('/dev/null') #si es linux\n tf = \"/tmp/lotfiles/\"\n else\n tf = 'c:\\\\temp\\\\'\n end\n\tif not File.exist?(tf)\n FileUtils.mkdir(tf)\n end\n\n return tf \n end", "def create_tmp_folder\n %x{ mkdir -p #{tmp_path} }\n end", "def with_temp_env(environment)\n # Build up the new environment, preserving the old values so we\n # can replace them back in later.\n old_env = {}\n environment.each do |key, value|\n old_env[key] = ENV[key]\n ENV[key] = value\n end\n\n # Call the block, returning its return value\n return yield\n ensure\n # Reset the environment no matter what\n old_env.each do |key, value|\n ENV[key] = value\n end\n end", "def create_storage_dir\n placeholder = @placeholder || @dirname\n dirpath = File.join(storage_path, placeholder)\n FileUtils.mkdir dirpath unless Dir.exists? dirpath\n end", "def staging_dir\n @staging_dir ||= Dir.mktmpdir(project.name)\n end", "def create_yaml_templates_dir(templates_yaml_source, templates_yaml_destination)\n log(\"Creating #{templates_yaml_destination}\")\n remote_directory templates_yaml_destination do\n source templates_yaml_source # files/default/templates_yaml\n files_owner node['jmxtrans']['user']\n files_group node['jmxtrans']['user']\n files_mode \"0755\"\n owner node['jmxtrans']['user']\n group node['jmxtrans']['user']\n mode \"0755\"\n purge true\n action :nothing\n # because we need all the templates on disk for\n # rendering, we force this to happen at compile time\n end.run_action(:create)\nend", "def create_tmpdir_on(hosts, path_prefix = '', user = nil, group = nil)\n block_on hosts do |host|\n # create the directory\n dir = host.tmpdir(path_prefix)\n # only chown if explicitly passed; don't make assumptions about perms\n # only `chown user` for cleaner codepaths\n if user\n # ensure user exists\n unless host.user_get(user).success?\n # clean up\n host.rm_rf(\"#{dir}\")\n raise \"User #{user} does not exist on #{host}.\"\n end\n # chown only user\n host.chown(user, dir)\n # on host, \"chown #{user} #{dir}\"\n end\n # only chgrp if explicitly passed; don't make assumptions about perms\n if group\n # ensure group exists\n unless host.group_get(group).success?\n # clean up\n # on host, \"rmdir #{dir}\"\n host.rm_rf(dir)\n raise \"Group #{group} does not exist on #{host}.\"\n end\n # chgrp\n # on host, \"chgrp #{group} #{dir}\"\n host.chgrp(group, dir)\n end\n dir\n end\n end", "def get_temp_directory\n defined?(Rails) ? \"#{Rails.root}/tmp\" : \"/tmp\"\n end", "def exec_env_directory\n filename.dirname.to_s\n end", "def write_build_environments(path)\n r = Chef::Resource::File.new(::File.join(path, \"#{new_resource.chef_environment}.json\"), run_context)\n r.content(Chef::Environment.load(new_resource.chef_environment).to_json)\n r.run_action(:create)\n end", "def ensure_directory_exists\r\n dir = File.dirname(full_path_from_current_attributes)\r\n FileUtils.mkdir_p(dir) unless File.exists?(dir)\r\n end", "def mktmpdircd(&block)\n if block\n Dir.mktmpdir do |dir|\n Dir.chdir(dir) do\n yield(dir)\n end\n end\n else\n dir = Dir.mktmpdir\n Dir.chdir(dir)\n return dir\n end\nend", "def create_manifest_file(manifest, opts = {})\n require 'tmpdir'\n target_node_name = ENV.fetch('TARGET_HOST', nil)\n tmp_filename = File.join(Dir.tmpdir, \"manifest_#{Time.now.strftime('%Y%m%d')}_#{Process.pid}_#{rand(0x100000000).to_s(36)}.pp\")\n manifest_file = File.open(tmp_filename, 'w')\n manifest_file.write(manifest)\n manifest_file.close\n if target_node_name.nil? || target_node_name == 'localhost'\n # no need to transfer\n manifest_file_location = manifest_file.path\n else\n # transfer to TARGET_HOST\n inventory_hash = inventory_hash_from_inventory_file\n target_option = opts['targets'] || opts[:targets]\n target_node_name = search_for_target(target_option, inventory_hash) unless target_option.nil?\n\n manifest_file_location = File.basename(manifest_file)\n bolt_result = upload_file(manifest_file.path, manifest_file_location, target_node_name, options: {}, config: nil, inventory: inventory_hash)\n raise bolt_result.first['value'].to_s unless bolt_result.first['status'] == 'success'\n end\n\n manifest_file_location\n end", "def create_dir(filename)\n expanded_filename = \"#{working_dir}/#{filename}\"\n FileUtils.mkdir_p expanded_filename\n expanded_filename\n end", "def temp_dir temp='tmp/trash'\n FileUtils.rm_rf temp\n FileUtils.mkpath temp\n Dir.chdir(temp) { yield }\n FileUtils.rm_rf temp\nend", "def generate_temp_dir\n empty_directory File.join(Rails.root, \"tmp\", \"fusioncharts\")\n end", "def root\n root = ENV['JETS_ROOT'].to_s\n root = '.' if root == ''\n root = \"#{root}/\" unless root.ends_with?('/')\n Pathname.new(root)\n end", "def temp_dir\n if @temp_dir.nil?\n @@get_temp_dir_api = Win32::API.new('GetTempPath', 'LP', 'L') unless @@get_temp_dir_api\n buffer = 0.chr * MAX_PATH\n @@get_temp_dir_api.call(buffer.length, buffer)\n @temp_dir = pretty_path(buffer.unpack('A*').first.chomp('\\\\'))\n end\n rescue\n @temp_dir = File.join(Dir::WINDOWS, \"temp\")\n ensure\n return @temp_dir\n end", "def mkdir( *args ) Dir.mkdir( expand_tilde, *args ) end", "def create_app_structure(root_path, arg_app_name, quiet = false, gem_path = nil)\n # create directory structure\n dirs = [\n Hailstorm.db_dir,\n Hailstorm.app_dir,\n Hailstorm.log_dir,\n Hailstorm.tmp_dir,\n Hailstorm.reports_dir,\n Hailstorm.config_dir,\n Hailstorm.vendor_dir,\n Hailstorm.script_dir\n ]\n\n dirs.each do |dir|\n FileUtils.mkpath(File.join(root_path, dir))\n puts \" created directory: #{File.join(arg_app_name, dir)}\" unless quiet\n end\n\n skeleton_path = File.join(Hailstorm.templates_path, 'skeleton')\n\n # Process Gemfile - add additional platform specific gems\n engine = ActionView::Base.new\n engine.assign(jruby_pageant: !File::ALT_SEPARATOR.nil?, # File::ALT_SEPARATOR is nil on non-windows\n gem_path: gem_path)\n File.open(File.join(root_path, 'Gemfile'), 'w') do |f|\n f.print(engine.render(file: File.join(skeleton_path, 'Gemfile')))\n end\n puts \" wrote #{File.join(arg_app_name, 'Gemfile')}\" unless quiet\n\n # Copy to script/hailstorm\n hailstorm_script = File.join(root_path, Hailstorm.script_dir, 'hailstorm')\n FileUtils.copy(File.join(skeleton_path, 'hailstorm'), hailstorm_script)\n FileUtils.chmod(0o775, hailstorm_script) # make it executable\n puts \" wrote #{File.join(arg_app_name, Hailstorm.script_dir, 'hailstorm')}\" unless quiet\n\n # Copy to config/environment.rb\n FileUtils.copy(File.join(skeleton_path, 'environment.rb'),\n File.join(root_path, Hailstorm.config_dir))\n puts \" wrote #{File.join(arg_app_name, Hailstorm.config_dir, 'environment.rb')}\" unless quiet\n\n # Copy to config/database.properties\n FileUtils.copy(File.join(skeleton_path, 'database.properties'),\n File.join(root_path, Hailstorm.config_dir))\n puts \" wrote #{File.join(arg_app_name, Hailstorm.config_dir, 'database.properties')}\" unless quiet\n\n # Process to config/boot.rb\n engine = ActionView::Base.new\n engine.assign(app_name: arg_app_name)\n File.open(File.join(root_path, Hailstorm.config_dir, 'boot.rb'), 'w') do |f|\n f.print(engine.render(file: File.join(skeleton_path, 'boot')))\n end\n puts \" wrote #{File.join(arg_app_name, Hailstorm.config_dir, 'boot.rb')}\" unless quiet\n end", "def prepare(module_name, version)\n return if @target.directory?\n\n begin\n @target.mkpath\n Puppet.notice _(\"Created target directory %{dir}\") % { dir: @target }\n rescue SystemCallError => orig_error\n raise converted_to_friendly_error(module_name, version, orig_error)\n end\n end", "def create_test_directories\n\t\ttrace \"Creating test directory #{TEST_DATADIR}\"\n\t\tTEST_DATADIR.mkpath\n\t\treturn TEST_WORKDIR\n\tend", "def create_config_base\n # Create keys directory for environment\n FileUtils.cd(self.project_root) { FileUtils.mkdir_p \"config/environments/#{self.name}\" }\n FileUtils.cd(\"#{project_root}/config/environments/#{self.name}\") { FileUtils.mkdir_p %w{steps keys} }\n # Create ssh key for puppet user if environment is vagrant\n generate_puppet_user_keys('vagrant') if self.name == 'vagrant'\n end", "def tmp_dir\n File.expand_path(self.relative_tmp_dir, @options[:root_dir])\n end", "def temp_dir(*args, &block)\n self.class.temp_dir(prefix_suffix, *args, &block)\n end", "def setup_path\n # The Java Buildpack for WLS creates the complete domain structure and other linkages during staging.\n # The directory used for staging is at /tmp/staged/app\n # But the actual DEA execution occurs at /home/vcap/app. This discrepancy can result in broken paths and non-startup of the server.\n # So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution\n # Also, this script needs to be invoked before starting the server as it will create the links and also tweak the server args\n # (to listen on correct port, use user supplied jvm args)\n\n File.open(@application.root.to_s + '/' + SETUP_ENV_SCRIPT, 'w') do |f|\n\n f.puts '#!/bin/sh '\n f.puts '# There are 4 things handled by this script '\n f.puts ' '\n f.puts '# 1. Create links to mimic staging env and update scripts with jvm options '\n f.puts '# The Java Buildpack for WLS creates complete domain structure and other linkages during staging at '\n f.puts '# /tmp/staged/app location '\n f.puts '# But the actual DEA execution occurs at /home/vcap/app. '\n f.puts '# This discrepancy can result in broken paths and non-startup of the server. '\n f.puts '# So create linkage from /tmp/staged/app to actual environment of /home/vcap/app when things run in real execution '\n f.puts '# Create paths that match the staging env, as otherwise scripts will break!! '\n f.puts ' '\n f.puts 'if [ ! -d \\\"/tmp/staged\\\" ]; then '\n f.puts ' /bin/mkdir /tmp/staged '\n f.puts 'fi; '\n f.puts 'if [ ! -d \\\"/tmp/staged/app\\\" ]; then '\n f.puts ' /bin/ln -s `pwd` /tmp/staged/app '\n f.puts 'fi; '\n f.puts ' '\n f.puts ' '\n end\n end", "def create_directory()\n Dir.mkdir(ARGV.join('_'))\n Dir.chdir(ARGV.join('_'))\n Dir.mkdir(\"lib\")\n create_rspec_env()\nend", "def app_tmp_dir\n base_dir = app_sandbox_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'tmp')\n end\n end", "def prepare_sandbox\n\t%x{ mkdir -p #{example_sandbox_path} } unless File.exist?(example_sandbox_path)\nend", "def create_project(invocation_path, arg_app_name, quiet = false, gem_path = nil)\n root_path = File.join(invocation_path, arg_app_name)\n FileUtils.mkpath(root_path)\n puts \"(in #{invocation_path})\" unless quiet\n puts \" created directory: #{arg_app_name}\" unless quiet\n create_app_structure(root_path, arg_app_name, quiet, gem_path)\n puts '' unless quiet\n puts 'Done!' unless quiet\n\n root_path\n end", "def copy_environment_as_needed!\n env_directory = File.join('config', 'environments')\n env_file = File.join(env_directory, \"#{rails_env}.rb\")\n\n unless File.exist?(env_file)\n test_env_file = File.join(env_directory, \"test.rb\")\n raise \"No test.rb file at: #{test_env_file}?!?\" unless File.exist?(test_env_file)\n FileUtils.cp(test_env_file, env_file)\n end\n end", "def set_temp_directory\n @base_theme_directory = 'public/temp/theme_1/'\n @temp_number = 1\n\n # Change value of @base_theme_directory until the folder name does not appear\n until !File.exist?(@base_theme_directory)\n @temp_number = @temp_number + 1\n @base_theme_directory = \"public/temp/theme_#{@temp_number.to_s}/\"\n end\n end", "def generate_tmpdir\n pipeline.generate_tmpdir\n end", "def get_tmp_path\n \"#{Dir.tmpdir}/#{Time.now.to_i * rand}\"\n end", "def tmpdir(root)\n project.tmpdir = root\n end", "def tmpdir(root)\n project.tmpdir = root\n end", "def tmp &block\n tmp_dir = \"/tmp_#{rand(10**6)}\"\n if block\n begin\n create_dir tmp_dir\n block.call tmp_dir\n ensure\n delete_dir tmp_dir\n end\n else\n create_dir tmp_dir\n tmp_dir\n end\n end", "def with_tmp_dir(&block)\n Dir.mktmpdir(SecureRandom.hex(3)) do |tmp_dir|\n Dir.chdir(tmp_dir, &block)\n end\n end", "def mkdirs(base)\n if !File.exists?(BASE_DIR)\n Dir.mkdir(BASE_DIR)\n end \n if !File.exists?(base)\n Dir.mkdir(base)\n end\n if !File.exists?(\"#{base}/cache\")\n Dir.mkdir(\"#{base}/cache\")\n end\n if !File.exists?(\"#{base}/data\")\n Dir.mkdir(\"#{base}/data\")\n end\nend", "def tempdir\n @tmpdir ||= Dir.mktmpdir(\"dockerfile\")\n File.realpath(@tmpdir)\nend", "def tmpdir(id=:default)\n @tmpdirs[id] ||= Dir.mktmpdir\n end", "def create_node_manifest(manifest_path, master_certname, node_def_name='default')\n manifest = File.read(manifest_path)\n\n site_pp = <<-MANIFEST\nfilebucket { 'main':\n server => '#{master_certname}',\n path => false,\n}\n\nFile { backup => 'main' }\n\nnode default {\n\n#{manifest}\n}\nMANIFEST\n\n return site_pp\nend", "def make_directory_tree\n project_tmp = \"/tmp/#{@package_name}\"\n @scratch = \"#{project_tmp}/#{@title}\"\n @working_tree = {\n 'scripts' => \"#{@scratch}/scripts\",\n 'resources' => \"#{@scratch}/resources\",\n 'working' => \"#{@scratch}/root\",\n 'payload' => \"#{@scratch}/payload\",\n }\n puts \"Cleaning Tree: #{project_tmp}\"\n FileUtils.rm_rf(project_tmp)\n @working_tree.each do |key,val|\n puts \"Creating: #{val}\"\n FileUtils.mkdir_p(val)\n end\n File.open(\"#{@scratch}/#{'prototype.plist'}\", \"w+\") do |f|\n f.write(ERB.new(File.read('tasks/templates/prototype.plist.erb')).result())\n end\n File.open(\"#{@working_tree[\"scripts\"]}/preflight\", \"w+\") do |f|\n f.write(ERB.new(File.read('ext/osx/preflight.erb')).result())\n end\nend", "def make_dirs\r\n FileUtils.rm_rf @dirs[:tmp]\r\n @dirs.each do |k, dir|\r\n FileUtils.mkdir_p dir\r\n end\r\n end", "def mktemp\n f = Tempfile.new('tmp', @temp_dir)\n [f, f.path]\n end", "def create_env(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:env, :create, resource_name)\n end", "def setup_environment\n `rm -rf /tmp/#{@upload_id} && mkdir /tmp/#{@upload_id}`\n Dir.chdir(\"/tmp/\" + @upload_id)\n end", "def use_an_environment(environment, description, master_opts, confdir, options = {})\n ssldir = on(master, puppet(\"master --configprint ssldir\")).stdout.chomp\n master_puppet_conf = master_opts.dup # shallow clone\n master_puppet_conf[:__commandline_args__] = \"--confdir=#{confdir} --ssldir=#{ssldir}\"\n config_print = options[:config_print]\n directory_environments = options[:directory_environments]\n results = {}\n\n with_puppet_running_on(master, master_puppet_conf, confdir) do\n agents.each do |agent|\n agent_results = results[agent] = {}\n\n step \"puppet agent using #{description} environment\"\n args = \"-t\", \"--server\", master\n args << [\"--environment\", environment] if environment\n # Test agents configured to use directory environments (affects environment\n # loading on the agent, especially with regards to requests/node environment)\n args << \"--environmentpath='$confdir/environments'\" if directory_environments && agent != master \n on(agent, puppet(\"agent\", *args), :acceptable_exit_codes => (0..255)) do\n agent_results[:puppet_agent] = result\n end\n\n if agent == master\n args = [\"--trace\", \"--confdir\", confdir]\n args << [\"--environment\", environment] if environment\n\n step \"print puppet config for #{description} environment\"\n on(agent, puppet(*([\"config\", \"print\", \"basemodulepath\", \"modulepath\", \"manifest\", \"config_version\", config_print] + args)), :acceptable_exit_codes => (0..255)) do\n agent_results[:puppet_config] = result\n end\n\n step \"puppet apply using #{description} environment\"\n on(agent, puppet(*([\"apply\", '-e', '\"include testing_mod\"'] + args)), :acceptable_exit_codes => (0..255)) do\n agent_results[:puppet_apply] = result\n end\n\n # Be aware that Puppet Module Tool will create the module directory path if it\n # does not exist. So these tests should be run last...\n step \"install a module into environment\"\n on(agent, puppet(*([\"module\", \"install\", \"pmtacceptance-nginx\"] + args)), :acceptable_exit_codes => (0..255)) do\n agent_results[:puppet_module_install] = result\n end\n\n step \"uninstall a module from #{description} environment\"\n on(agent, puppet(*([\"module\", \"uninstall\", \"pmtacceptance-nginx\"] + args)), :acceptable_exit_codes => (0..255)) do\n agent_results[:puppet_module_uninstall] = result\n end\n end\n end\n end\n\n return results\n end", "def tmpdir\n @tmpdir = (\n dir = ENV['XDG_CACHE_HOME'] || '~/.cache'\n dir = File.expand_path(File.join(dir, 'ruby'))\n ensure_directory(dir) # TODO: do this here?\n )\n end", "def current_directory\n @current_directory ||=\n if __FILE__ =~ %r{\\Ahttps?://}\n tempdir = Dir.mktmpdir(\"rails-templates\")\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/nimbl3/rails-templates.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n tempdir\n else\n File.expand_path(File.dirname(__FILE__))\n end\nend", "def current_directory\n @current_directory ||=\n if __FILE__ =~ %r{\\Ahttps?://}\n tempdir = Dir.mktmpdir(\"rails-templates\")\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/nimbl3/rails-templates.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n tempdir\n else\n File.expand_path(File.dirname(__FILE__))\n end\nend", "def construct_env host, opts\n env = additive_hash_merge(host[:host_env], opts[:host_env])\n\n env.each_key do |key|\n separator = host['pathseparator']\n separator = ':' if key == 'PATH' && (not host.is_powershell?)\n env[key] = env[key].join(separator)\n end\n env\n end", "def prepare_target_dir\n begin\n FileUtils.mkdir(@output_dir)\n copy_default_files\n rescue Errno::EEXIST\n puts \"-- #{output_dir} already exists -- canceling initialization. \"\n return\n end\n end", "def do_into_tmpdir(t)\n Dir.mktmpdir do |dir|\n do_into_dir(dir, t)\n end\nend", "def make_tmp_dir\n FileUtils.mkdir_p @log_dir\n Dir[\"#{@log_dir}/*\"].each do |file|\n FileUtils.rm_rf file\n end\n end", "def build_verification_dir(root_dir, dirname, uuid)\n return unless root_dir\n \"/#{root_dir}/#{dirname}-#{uuid}/#{dirname}\"\nend", "def mkshelf(env)\n shelves = Berkshelf.shelves_path\n\n if !File.exist?(shelves)\n FileUtils.mkdir_p(shelves)\n end\n\n Dir.mktmpdir(['berkshelf', \"-#{env[:machine].name}\"], shelves)\n end" ]
[ "0.62542784", "0.60449564", "0.57045144", "0.56640023", "0.5639595", "0.56154525", "0.5581251", "0.5462933", "0.53894436", "0.5296564", "0.527444", "0.5107344", "0.51043284", "0.5100353", "0.5087843", "0.4992919", "0.49681512", "0.49661678", "0.49555176", "0.49258938", "0.4913273", "0.49078378", "0.48993275", "0.48980516", "0.48922125", "0.4878982", "0.48757625", "0.48751107", "0.4818635", "0.48063475", "0.47699764", "0.47663862", "0.47646856", "0.47424516", "0.47355044", "0.4728173", "0.47254953", "0.47152445", "0.47128615", "0.47091755", "0.47033575", "0.46954", "0.4681633", "0.4680541", "0.4674425", "0.46646112", "0.46491957", "0.4632204", "0.4631481", "0.46208712", "0.46074507", "0.45971912", "0.45879582", "0.45810765", "0.4572831", "0.4572576", "0.4572384", "0.457207", "0.45663497", "0.4558287", "0.4554167", "0.45531946", "0.45478183", "0.45418558", "0.45394757", "0.45320004", "0.4529657", "0.45274204", "0.4522201", "0.45200473", "0.45170647", "0.45106933", "0.4510453", "0.45048165", "0.4504444", "0.45037532", "0.45026204", "0.44938806", "0.44938806", "0.44903287", "0.448904", "0.44889382", "0.44842863", "0.44841978", "0.44589698", "0.44538924", "0.4448592", "0.44451246", "0.4441011", "0.44384786", "0.44306824", "0.44135103", "0.43989244", "0.43989244", "0.4395548", "0.43949652", "0.4391163", "0.43847194", "0.43841156", "0.4373198" ]
0.8519662
0
A method for building attribute string
def mk_attr_str **attr_map attr_map.map{|k,v|" #{k}='#{v}'"}.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buildAttrString(attributes)\r\n str = \"\"\r\n\r\n attributes.each do |key, val|\r\n str += \" #{key}='#{val}'\"\r\n end # attributes.each\r\n\r\n puts \"attrib str: #{str}\" if $DEBUG\r\n str\r\n end", "def attributes_string\n\t\t\t#note that underscores are converted to hyphens. Quotes are entity encoded\n\t\t\tattrs = @attributes.reject{|k,v| v.nil?}.map do |k,v|\n\t\t\t\tvv = escape_quote v.to_s\n\t\t\t\tkk = k.to_s.gsub('_', '-')\n\t\t\t\t%Q[#{kk}=\"#{vv}\"]\n\t\t\tend\n\t\t\t\n\t\t\treturn attrs.join(' ')\n\t\tend", "def attribute_string\n s = []\n s << \"PROGRAM-ID=#{ (program_id || 1).to_i }\"\n s << \"BANDWIDTH=#{ bandwidth.to_i }\"\n s << \"CODECS=\\\"#{ codecs }\\\"\" if codecs\n s << \"RESOLUTION=#{ resolution }\" if resolution\n s.join(',')\n end", "def encode_attr(name)\n \"a$\" + @attribute_name_generator.get(name.to_s)\n end", "def attribute_string(attributes)\n attributes.map { |name, value| \"#{name}=\\\"#{value}\\\"\" }\n end", "def create_attrs hash\n r = hash.map { |k,v| \"#{k}=\\\"#{escape_attr v.to_s}\\\"\" }.join(' ')\n \" #{r}\" unless r.empty?\n end", "def get_string(attr); 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 to_s\n each_with_object([]) do |(name, value), array|\n if value.is_a?(Component::Attr)\n # Flatten nested hashs and inject them unless empty\n value = value.to_s\n array << value unless value.empty?\n else\n name = [@prefix, name].compact.join(\"-\").gsub(/[\\W_]+/, \"-\")\n array << %(#{name}=\"#{value}\") unless value.nil?\n end\n end.sort.join(\" \")\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 to_s\n %(<#{ @name }#{attributes}>)\n end", "def to_s\n \t\tattributes.each_with_object(\"\") do |attribute, result|\n \t\tresult << \"#{attribute[1].to_s} \"\n \t\tend\n\tend", "def attr\n @attr.map{|k,v| \"#{k}=\\\"#{h v}\\\"\"}.sort.join(' ')\n end", "def to_s\n attributes = ALLOWED_ATTRIBUTES.select { |a| @attributes[a] }.map do |a|\n case a\n when :httponly\n 'HttpOnly' if @attributes[a]\n when :secure\n 'Secure' if @attributes[a]\n when :maxage\n 'Max-Age=' + @attributes[a].to_s\n when :expires\n 'Expires=' + rfc2822(@attributes[a])\n when :comment\n 'Comment=' + escape(@attributes[a].to_s)\n else\n a.to_s.sub(/^\\w/) { $&.capitalize } + '=' + @attributes[a].to_s\n end\n end\n\n ([escape(name) + '=' + escape(value)] + attributes).join('; ')\n end", "def attributor(attributes)\n inject_s(attributes) {|key, value| \" #{key.to_s}=\\\"#{value.to_s}\\\"\"}\n end", "def tag_attributes_string\n tag_attributes.map{|k, v| \"#{k}=\\\"#{v}\\\"\"}.join(' ')\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 encode_globalattr(name)\n \"a$\" + @global_attribute_name_generator.get(name.to_s)\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def required_attributes_to_s\n str = \"#{self.count}D#{self.dietype}\"\n str << \"+\" if self.static > 0\n str << \"#{self.static}\" if options.static != 0\n str\n end", "def to_s\n attributes = @attributes.map do |key, value|\n \"#{key}: \\\"#{value}\\\"\"\n end.join \" \"\n\n \"#<#{self.class} #{attributes}>\"\n end", "def attribute *array\n return self if guard *array\n r = self.clone\n a = array.flatten\n n_full_pairs, n_unpaired = a.length.divmod 2\n (1..n_full_pairs + n_unpaired).each do |i|\n r << '[' + a.shift\n r << '=' + a.shift unless i > n_full_pairs\n r << ']'\n end\n CssString.new r\n end", "def to_s\n attrs = self.class.attributes.map do |attr|\n \"#{attr.name}=#{self.send(attr.name)}\"\n end.join(', ')\n\n \"[#{self.class.name.split('::').last}] #{attrs}\"\n end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attr_strings\n @attr_strings\n end", "def build_name\n \"#{manufacturer} #{weight} #{style} #{name}\"\n end", "def transform_attr(key, value)\n if value.is_a? Array\n sub_attrs = value.map do |sub_prop|\n sub_prop.map { |k, v| transform_attr(k, v) }\n end\n \"<w:#{key}>#{sub_attrs.join}</w:#{key}>\"\n elsif value.is_a? Hash\n props = value.map { |k, v| format('w:%s=\"%s\"', k, v) if v }\n \"<w:#{key} #{props.compact.join(' ')} />\"\n else\n value = format('w:val=\"%s\" ', value) if value\n \"<w:#{key} #{value}/>\"\n end\n end", "def transform_attr(key, value)\n if value.is_a? Array\n sub_attrs = value.map do |sub_prop|\n sub_prop.map { |k, v| transform_attr(k, v) }\n end\n \"<w:#{key}>#{sub_attrs.join}</w:#{key}>\"\n elsif value.is_a? Hash\n props = value.map { |k, v| format('w:%s=\"%s\"', k, v) if v }\n \"<w:#{key} #{props.compact.join(' ')} />\"\n else\n value = format('w:val=\"%s\" ', value) if value\n \"<w:#{key} #{value}/>\"\n end\n end", "def to_s\n\t\tstr = \"\\n<\" + @type\n\t\t@attributes.each{ |key,value|\n\t\t\tstr += \" \" + key.to_s + \" = \" + value.to_s\n\t\t}\n\t\tif @type == 'text'\n\t\t\tstr += \"> \" + @content[0] + \" </\" + @type + \">\"\n\t\telse\n\t\t\tstr += \"> \"\n\t\t\t@content.each { |c|\n\t\t\t\tstr += c.to_s\n\t\t\t}\n\t\t\tstr += \"\\n</\" + @type + \">\"\n\t\tend\n\t\tstr\n\tend", "def html_attributes(attr)\n return '' if attr.empty?\n\n attr.map do |k, v|\n v.nil? || (k == 'id' && v.strip.empty?) ? '' : \" #{k}=\\\"#{escape_html(v.to_s, :attribute)}\\\"\"\n end.join('')\n end", "def attrs_to_s(attrs)\n (attrs || {}).map do |key, value|\n \"#{key}='#{value.to_xs}'\"\n end.join(' ')\n end", "def to_s\n # Start with the name\n string = sprintf \"%-9s\", \"#{self.name}:\"\n # Print the attr mods\n self.raceattrs.each do |a|\n string += sprintf \" %s %+i,\", a.short, a.value if a.value != 0\n end\n return string.chomp(\",\")\n end", "def format_attributes(attributes)\n return if attributes.nil?\n attributes.collect do |name, value|\n value = if value.kind_of? Array\n value.flatten.compact * \" \"\n else\n value.to_s\n end\n next if value == \"\"\n %Q{ #{name}=\"#{escape(value)}\"}\n end.join\n end", "def inspect\n vals = ATTRS.map { |field| \"#{field}: #{public_send(field).inspect}\" }\n \"#<#{self.class.name} #{vals.join(', ')}>\"\n end", "def format_name(attribute_name)\n attribute_name.to_s\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 attributes_for_params\n attributes.collect{ |key, value| \"#{key}:'#{CGI.escape value}'\" }.join(\", \")\n end", "def template_like_str(attributes, indent = true)\n if indent\n ind_enter = \"\\n\"\n ind_tab = ' '\n else\n ind_enter = ''\n ind_tab = ' '\n end\n\n str = attributes.collect do |key, value|\n next unless value\n\n str_line = ''\n\n if value.class == Array\n\n value.each do |value2|\n str_line << key.to_s.upcase << '=[' << ind_enter\n\n if value2 && value2.class == Hash\n str_line << value2.collect do |key3, value3|\n str = ind_tab + key3.to_s.upcase + '='\n\n if value3\n str += \"\\\"#{value3}\\\"\"\n end\n\n str\n end.compact.join(\",\\n\")\n end\n str_line << \"\\n]\\n\"\n end\n\n elsif value.class == Hash\n str_line << key.to_s.upcase << '=[' << ind_enter\n\n str_line << value.collect do |key3, value3|\n str = ind_tab + key3.to_s.upcase + '='\n\n if value3\n str += \"\\\"#{value3}\\\"\"\n end\n\n str\n end.compact.join(\",\\n\")\n\n str_line << \"\\n]\\n\"\n\n else\n str_line << key.to_s.upcase << '=' << \"\\\"#{value}\\\"\"\n end\n str_line\n end.compact.join(\"\\n\")\n\n str\n end", "def attributes(*attrs)\n return '' if attrs.empty?\n attrs.inject({}) { |attrs,hash| attrs.merge(hash) }.\n reject { |k,v| v.nil? }.\n collect { |k,v| \"#{k}='#{h(v)}'\" }.\n join(' ')\n end", "def attributes(*attrs)\n return '' if attrs.empty?\n attrs.inject({}) { |attrs,hash| attrs.merge(hash) }.\n reject { |k,v| v.nil? }.\n collect { |k,v| \"#{k}='#{h(v)}'\" }.\n join(' ')\n end", "def html_attr(str)\n '\"' + str.gsub(/[&<>\"]/) {|ch| HTML_ATTR_ESCAPE_HASH[ch] } + '\"'\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 template_like_str(attributes, indent = true)\n if indent\n ind_enter = \"\\n\"\n ind_tab = ' '\n else\n ind_enter = ''\n ind_tab = ' '\n end\n\n attributes.collect do |key, value|\n next unless value\n\n str_line = ''\n\n if value.class == Array\n\n value.each do |value2|\n str_line << key.to_s.upcase << '=[' << ind_enter\n\n if value2 && value2.class == Hash\n str_line << value2.collect do |key3, value3|\n str = ind_tab + key3.to_s.upcase + '='\n\n if value3\n str += \"\\\"#{value3}\\\"\"\n end\n\n str\n end.compact.join(\",\\n\")\n end\n str_line << \"\\n]\\n\"\n end\n\n elsif value.class == Hash\n str_line << key.to_s.upcase << '=[' << ind_enter\n\n str_line << value.collect do |key3, value3|\n str = ind_tab + key3.to_s.upcase + '='\n\n if value3\n str += \"\\\"#{value3}\\\"\"\n end\n\n str\n end.compact.join(\",\\n\")\n\n str_line << \"\\n]\\n\"\n\n else\n str_line << key.to_s.upcase << '=' << \"\\\"#{value}\\\"\"\n end\n str_line\n end.compact.join(\"\\n\")\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 raw_getter field\n val = self.instance_variable_get(\"@#{field}\")\n return nil if val.nil? == true || val == false\n\n if BOOL_ATTRIBUTES.include? field\n return field.to_s.gsub '_', '-' \n end\n\n if STR_ATTRIBUTES.include? field \n return val \n end\n\n if ARR_STR_ATTRIBUTES.include? field && val.empty? == false \n return val.join ' '\n end\n\n if SUB_STR_ATTRIBUTES.include? field \n return SUB_STR_ATTRIBUTES[field].sub '%sub%', val \n end \n end", "def attribute attr\n @ref.attribute(TRANSLATOR.cocoaify(attr)).to_ruby\n end", "def format_string(record, attribute, val)\n val\n end", "def begintag(name, attributes=[])\r\n\tattribs = \"\"\r\n\tif (!attributes.empty)\r\n\t\tattributes.each do |(key,value)| \r\n\t\t\tattribs = \" #{key.strip}=\\\"#{value.strip}\\\"\"\r\n\t\tend\r\n\tend\r\n\treturn \"<\" + name.strip + \" \" + attribs + \">\"\r\nend", "def tag_attributes(options)\n return '' unless options\n options.inject('') do |all,(key,value)|\n next all unless value\n all << ' ' if all.empty?\n all << if value.is_a?(Hash)\n nested_values(key, value)\n elsif BOOLEAN_ATTRIBUTES.include?(key)\n %(#{key}=\"#{key}\" )\n else\n %(#{key}=\"#{escape_value(value)}\" )\n end\n end.chomp!(' ')\n end", "def inspect\n \"#<#{classname} :#{attribute}>\"\n end", "def inspect\n attributes = [\"seqid=\\\"#{@seqid}\\\"\", \"source=\\\"#{@source}\\\"\", \"type=\\\"#{@type}\\\"\", \"strand=\\\"#{@strand}\\\"\"]\n attributes += @attributes.map { |(attribute, value)| \"#{attribute}=\\\"#{value}\\\"\" }\n \n \"#<#{self.class} #{attributes.join(', ')}>\"\n end", "def tagattr(name, expr, value=nil, escape=true)\n if !expr\n return ''\n elsif escape\n return \" #{name}=\\\"#{escape_xml((value || expr).to_s)}\\\"\"\n else\n return \" #{name}=\\\"#{value || expr}\\\"\"\n end\n end", "def render_attr ref\n \"#{ ref.node_idx==0 ? 'p' : 'c'+(ref.node_idx-1).to_s }.#{ @attributes[ ref.attr_idx ] }\"\n end", "def toEncodedString()\n s = \"<\" + @name.to_s\n key_count = 0\n @attrkeys.each do |key|\n s = s + \" \" + key.to_s + \"=\\\"\" + @attrvals[key_count].to_s + \"\\\"\"\n key_count = key_count + 1\n end\n s = s + \">\"\n @children.each do |child|\n unless(child.class.name.eql?(\"NaElement\"))\n abort(\"Unexpected reference found, expected NaElement not \" + child.class.name)\n end\n s = s + child.toEncodedString()\n end\n cont = @content.to_s\n cont = NaElement::escapeHTML(cont)\n s = s + cont\n s = s + \"</\" + @name.to_s + \">\"\n s\n end", "def normalized_str(attribute)\n normalized(attribute).join(\"; \")\n end", "def attribute(value, default_value=nil)\n str = value.to_s\n not(str.empty?) ? str : default_value\n end", "def to_s\n\t\tparts = [ self.oid ]\n\n\t\tparts << \"NAME %s\" % Treequel::Schema.qdescrs( self.names ) unless self.names.empty?\n\n\t\tparts << \"DESC '%s'\" % [ self.desc ] if self.desc\n\t\tparts << \"OBSOLETE\" if self.obsolete?\n\t\tparts << \"APPLIES %s\" % [ Treequel::Schema.oids(self.attr_oids) ]\n\t\tparts << self.extensions.strip unless self.extensions.empty?\n\n\t\treturn \"( %s )\" % [ parts.join(' ') ]\n\tend", "def attributes_to_str(mbean_attributes)\n attributes = ''\n mbean_attributes.each { |attribute| attributes = attributes + \",\" + attribute}\n\n return attributes\n end", "def attribute(name); end", "def print_attribute(*) end", "def attribute_str(name, indent)\n \"#{indent}this.#{name} = null;\"\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 compact_string\n s = [ATTRIBUTES.sort.collect{|a| send(a)}].join(\"|\").downcase.gsub(/\\s/, '')\n end", "def gen_raw_line\n return nil unless self.valid?\n line = ''\n data = []\n SUB_STR_ATTRIBUTES.each do |field,field_regex|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n unless data.empty?\n line = \"#{data.join ' ,'}\"\n end\n\n data = []\n BOOL_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n unless data.empty?\n if line == ''\n line += \"#{data.join ','} \"\n else\n line += \",#{data.join ','} \"\n end\n end\n\n data = []\n ARR_STR_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n unless data.empty?\n if line == ''\n line += \"#{data.join ','} \"\n else\n line += \", #{data.join ','} \"\n end\n end\n\n data = []\n STR_ATTRIBUTES.each do |field|\n val = self.raw_getter field\n data.push val if val.nil? == false\n end\n line += data.join ' '\n return line\n end", "def to_xml\n\t\t\t\"<#{@name} #{attributes_string} />\"\n\t\tend", "def name_attribute(suffix = nil)\n extra = suffix ? \"_#{suffix}\" : ''\n %(name=\"#{name_base}#{extra}\")\n end", "def attributes_to_docx\n return '' if @attributes.nil? || @attributes.empty?\n ' ' + @attributes.map { |k, v| %(#{k}=\"#{v}\") }.join(' ')\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def inspect\n klass = self.class\n attrs = klass\n .attribute_names\n .reject { |key| key == :data }\n .map { |key| \" #{key}=#{@attributes[key].inspect}\" }\n .join\n \"#<#{klass.name || klass.inspect}#{attrs}>\"\n end", "def attr(name); end", "def to_s\n\t\trval = \"%s=%s\" % [ self.name, self.make_valuestring ]\n\n\t\trval << make_field( \"Version\", self.version ) if self.version.nonzero?\n\t\trval << make_field( \"Domain\", self.domain )\n\t\trval << make_field( \"Expires\", make_cookiedate(self.expires) ) if self.expires\n\t\trval << make_field( \"Max-Age\", self.max_age )\n\t\trval << make_field( \"Path\", self.path )\n\n\t\trval << '; ' << 'HttpOnly' if self.httponly?\n\t\trval << '; ' << 'Secure' if self.secure?\n\n\t\treturn rval\n\tend", "def attr_h(string)\n h(string).gsub('\"', '&quot;')\n end", "def attribute_render_naming\n OBJ_ATTRIBUTE_RENDER_NAMING\n end", "def to_s\n ret = \"--- #{@attrs[:event_name]} ---\\n\"\n attrs = @attrs.collect { |k,v| [k.to_s, v] }\n attrs.reject! { |k,_| k == 'event_name' }\n attrs.sort.each do |k,v|\n # Adjust the length of the attribute name\n line = \"#{k[0,MAX_ATTR_NAME-2]}:#{' '*MAX_ATTR_NAME}\"[0,MAX_ATTR_NAME] \n \n # Beautify the attribute\n v = v.join(', ') if v.class <= Array\n v = v.to_s\n unless @full_event_display\n v = v[0,MAX_ATTR_VALUE] if v.length > MAX_ATTR_VALUE\n end\n i = 0\n while i < v.length do\n v[i,1] = \"\\\\x#{'%02x' % v[i]}\" unless _printable?(v[i])\n i += 1\n end\n unless @full_event_display\n v = v[0,MAX_ATTR_VALUE] if v.length > MAX_ATTR_VALUE\n end\n ret << \" #{line}#{v}\\n\"\n end\n ret << \"\\n\"\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 localized_attribute_string(resource, attr_name)\n model_name = resource.class.name.underscore\n action_name = template.params[:action].to_s rescue ''\n attribute_name = attr_name.to_s\n\n i18n_scopes = ['{{model}}.{{action}}.{{attribute}}', '{{model}}.{{attribute}}', '{{attribute}}']\n defaults = i18n_scopes.collect do |i18n_scope|\n i18n_path = i18n_scope.dup\n i18n_path.gsub!('{{action}}', action_name)\n i18n_path.gsub!('{{model}}', model_name)\n i18n_path.gsub!('{{attribute}}', attribute_name)\n i18n_path.gsub!('..', '.')\n i18n_path.to_sym\n end\n defaults << ''\n\n i18n_value = ::I18n.t(defaults.shift, :default => defaults, :scope => \"formtastic.labels\")\n i18n_value.blank? ? nil : i18n_value\n end", "def human_attribute_name(field_name, options={})\n \"\"\n end", "def format_attributes(attributes)\n if attributes.size > 0\n \" \" + attributes.map{ |k, v, attr| format_attribute(k, v, attr)}.join(\" \")\n else\n \"\"\n end\n end", "def attribute(name, value)\n\t if !@inStartTag\n\t\traise WriterError.new('attribute outside of tag start')\n\t end\n\t @io << \" #{name}=\\\"#{NQXML.encode(value.to_s)}\\\"\"\n\tend", "def grouped_attributes_prefix(value, plural)\n (value ? \"with \" : \"without \") + (plural ? \"attributes \" : \"attribute \")\n end", "def attr_tag(text); end", "def name_attribute_multi\n %(name=\"#{name_base}[]\")\n end", "def reflection_or_attribute_name; end", "def build_transform_attr(transform = {})\n # TODO: Support matrix, scale, and translate transforms\n \"\" if transform.nil?\n\n transforms = []\n\n unless transform[:rotate].nil?\n unless transform[:rotate_origin].nil?\n transforms << \"translate(#{transform[:rotate_origin].join(\",\")})\"\n end\n transforms << \"rotate(#{transform[:rotate]})\"\n unless transform[:rotate_origin].nil?\n transforms << \"translate(#{transform[:rotate_origin].map{|el| -el}.join(\",\")})\"\n end\n end\n\n transforms.join(\" \")\n end", "def attr_name\n parameters.first.jump(:ident).first.to_sym\n end", "def write_attribute_text(prefix, line)\n print prefix\n line.each do |achar|\n print achar.char\n end\n puts\n end" ]
[ "0.7914002", "0.75023293", "0.7355576", "0.7305694", "0.7254207", "0.7232861", "0.7195633", "0.71831703", "0.70630234", "0.6961891", "0.69222146", "0.6919757", "0.6909795", "0.68599856", "0.6849177", "0.68178535", "0.66554976", "0.66554976", "0.66554976", "0.66519", "0.66372293", "0.66372293", "0.66372293", "0.66242284", "0.6624167", "0.6553374", "0.65359056", "0.64601046", "0.64601046", "0.64601046", "0.64601046", "0.64601046", "0.64601046", "0.64601046", "0.6437307", "0.6422953", "0.64169", "0.64169", "0.6411637", "0.63777596", "0.6355623", "0.6350433", "0.6340495", "0.6320213", "0.63180524", "0.6314085", "0.63048553", "0.6304609", "0.6297724", "0.6297724", "0.6296531", "0.62940854", "0.62850475", "0.6279789", "0.6261351", "0.6227051", "0.62187225", "0.62106365", "0.6182982", "0.61827457", "0.6182671", "0.6168593", "0.6157769", "0.61537194", "0.6152242", "0.61375535", "0.6134734", "0.61306393", "0.611267", "0.61016905", "0.60970473", "0.6096996", "0.60863155", "0.6083841", "0.6061355", "0.60405904", "0.6038216", "0.6033741", "0.6033741", "0.6033741", "0.6033741", "0.6033741", "0.60329676", "0.60314804", "0.6028599", "0.6026842", "0.60234994", "0.6022698", "0.60048926", "0.6003073", "0.60006016", "0.59988487", "0.59960663", "0.5972531", "0.59675246", "0.5966989", "0.5964686", "0.59508824", "0.59472173", "0.59391916" ]
0.7885479
1
A method for building inline tag string
def tag_inline tagname, value, **attr_map attr_str = mk_attr_str(attr_map) "<#{tagname}#{attr_str}>#{value}</div>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inline_tags; end", "def _gestalt_build_tag(name, attr = {}, text = [])\n @out << \"<#{name}\"\n @out << attr.map{|(k,v)| %[ #{k}=\"#{_gestalt_escape_entities(v)}\"] }.join\n if text != [] or block_given?\n @out << \">\"\n @out << _gestalt_escape_entities([text].join)\n if block_given?\n text = yield\n @out << text.to_str if text != @out and text.respond_to?(:to_str)\n end\n @out << \"</#{name}>\"\n else\n @out << ' />'\n end\n end", "def format_tag(tag, attributes, body)\n if body.size > 0\n [\"<#{tag}#{format_attributes(attributes)}>\", body, \"</#{tag}>\"]\n else\n [\"<#{tag}#{format_attributes(attributes)} />\"]\n end.join('')\n end", "def tagify tag, params, *args\n text = [*args].join(SEPARATOR)\n text.vacant? ? '' : \"#{opening tag, params}#{text.strip}#{closing tag}\"\n end", "def inline_tags\n %w[w:bdo w:bookmarkEnd w:bookmarkStart w:commentRangeEnd\n w:commentRangeStart w:customXml\n w:customXmlDelRangeEnd w:customXmlDelRangeStart\n w:customXmlInsRangeEnd w:customXmlInsRangeStart\n w:customXmlMoveFromRangeEnd w:customXmlMoveFromRangeStart\n w:customXmlMoveToRangeEnd w:customXmlMoveToRangeStart\n w:del w:dir w:fldSimple w:hyperlink w:ins w:moveFrom\n w:moveFromRangeEnd w:moveFromRangeStart w:moveTo\n w:moveToRangeEnd w:moveToRangeStart m:oMath m:oMathPara\n w:pPr w:proofErr w:r w:sdt w:smartTag]\n end", "def generate_tagged_str(tag, *args)\n tag_head = generate_tag_header(tag)\n tag_body = args.join\n tag_foot = generate_tag_footer\n [tag_head, tag_body, tag_foot].join\n end", "def render_open_tag(tag)\n tag_string = \"<\"\n tag_string << tag.type\n tag_string << \" name= \" << tag.name unless tag.name = \"\"\n tag_string << \" id= \" << tag.id unless tag.id = \"\"\n tag_string << \" class= \" << tag.classes.join(\" \") unless tag.classes = []\n tag_string << \">\"\n end", "def inline_formatting(str)\n str.rstrip!\n str = @re_help.rewrite_emphasis(str) do |marker, s|\n \"#{Tags[marker][:open]}#{s}#{Tags[marker][:close]}\"\n end\n str = @re_help.rewrite_images(str) do |link|\n \"<img src=\\\"#{link}\\\" />\"\n end\n str = @re_help.rewrite_links(str) do |link, text|\n text ||= link\n link = link.sub(/^file:(.*)::(.*?)$/) do\n\n # We don't support search links right now. Get rid of it.\n\n \"file:#{$1}\"\n end\n link = link.sub(/^file:/i, \"\") # will default to HTTP\n link = link.sub(/\\.org$/i, \".html\")\n \"<a href=\\\"#{link}\\\">#{text}</a>\"\n end\n if (@output_type == :table_row) then\n str.gsub!(/^\\|\\s*/, \"<td>\")\n str.gsub!(/\\s*\\|$/, \"</td>\")\n str.gsub!(/\\s*\\|\\s*/, \"</td><td>\")\n end\n if (@output_type == :table_header) then\n str.gsub!(/^\\|\\s*/, \"<th>\")\n str.gsub!(/\\s*\\|$/, \"</th>\")\n str.gsub!(/\\s*\\|\\s*/, \"</th><th>\")\n end\n str\n end", "def formated_tagline_for(game)\n return \"\" if game.nil? || game.tagline.nil?\n return \"\\\"#{game.tagline}\\\"\"\n end", "def inline_code; end", "def to_inline_html\n to_html true\n end", "def to_s\n \"<#{tag_name}>#{content}</#{tag_name}>\"\n end", "def aa(str)\r\n %Q|<pre class=\"aa\">#{str}</pre>|\r\nend", "def annotated_tag(tag, text, class: '')\n\t\t(\"<#{tag.to_s} \" + \"id=\\\"#{id_safe(text)}\\\" >\" + text + \"</#{tag.to_s}>\").html_safe\n\t\t#class=\\\"#{class.to_s}\\\"\n\tend", "def tag_for_label_with_inline_help( label_text, field_id, help_text )\n _html = \"\"\n _html << %{<label for=\"#{field_id}\">#{label_text}}\n _html << %{<img src=\"/images/icons/help_icon.png\" onclick=\"$('#{field_id}_help').toggle();\" class='inline_icon' />}\n _html << %{</label><br />}\n _html << %{<div class=\"inline_help\" id=\"#{field_id}_help\" style=\"display: none;\">}\n _html << %{<p>#{help_text}</p>}\n _html << %{</div>}\n _html\n end", "def _content_tag(tag, options = {}, content = nil)\n if !options.is_a?(Hash)\n # content is first argument, do not pass hash as content\n inline = true\n content = options\n options = {}\n elsif content.present?\n inline = true\n end\n self.class.indent += 1\n html = \"#{' ' * self.class.indent}<#{tag}\".html_safe\n options.each do |attribute, value|\n value = value.to_json if value.is_a?(Hash) || value.is_a?(Array)\n html << \" #{attribute}='\".html_safe << replace_quote(value) << \"'\".html_safe\n end\n html << if inline\n '>'.html_safe << content.to_s << \"</#{tag}>\\n\".html_safe\n else\n \">\\n\".html_safe << yield << \"\\n#{' ' * self.class.indent}</#{tag}>\".html_safe\n end\n self.class.indent -= 1 if self.class.indent > 1\n html\n end", "def tag(name, options = {})\n content = options.delete(:content)\n identity_tag_attributes.each { |attr| options[attr] = attr.to_s if options[attr] }\n html_attrs = options.collect { |a, v| v.empty? ? nil : \"#{a}=\\\"#{v}\\\"\" }.compact.join(\" \")\n base_tag = (!html_attrs.empty? ? \"<#{name} #{html_attrs}\" : \"<#{name}\")\n base_tag << (content ? \">#{content}</#{name}>\" : \" />\")\n end", "def to_s\r\n \"&#{wrap}\"\r\n end", "def tag(html_tag, content, attributes = {})\n \n html_attributes = attributes.map do |key, value|\n \"#{key}=\\\"#{value}\\\"\"\n end\n\n \"<#{html_tag} #{html_attributes.join(' ')}>#{content}</#{html_tag}>\"\nend", "def tag(name, content, attrs = {})\n # Convert every element of the hash to this --> \"href='example.com'\"\n # I need to do something for every element, I need a loop...\n # I can save all those string in an array...\n\n # If I want an array --> I will use map to iterate!\n attrs_arr = attrs.map do |key, value| \n \t\" #{key}='#{value}'\"\n end\n\n # I need a string --> I join the array\n attributes = attrs_arr.join\n\n # The last line is automatically returned\n \"<#{name}#{attributes}>#{content}</#{name}>\"\nend", "def inline_tag\n @inline_tag_regex ||= tag_regexp(\"inline\")\n end", "def attr_tag(text); end", "def render_inlined_string(template)\n render(template: template, layout: 'layouts/inlined_string')\n end", "def tag(tag_name, content, attributes = {})\n partials = attributes.map do |key, value|\n \"#{key}=\\\"#{value}\\\"\"\n end\n\n html_attributes = partials.join(' ')\n\n \"<#{tag_name} #{html_attributes}>#{content}</#{tag_name}>\"\nend", "def tagger_format tag\n \"<a href='/tags/#{tag}'>#{tag}</a>\"\n end", "def sprintf(indent = \"\")\n s = indent + \"<\" + @name\n key_count = 0\n @attrkeys.each do |key|\n s = s + \" \" + key.to_s + \"=\\\"\" + @attrvals[key_count].to_s + \"\\\"\"\n key_count = key_count + 1\n end\n s = s + \">\"\n if(@children.size() > 0)\n s = s + \"\\n\"\n end\n @children.each do |child|\n unless(child.class.name.eql?(\"NaElement\"))\n abort(\"Unexpected reference found, expected NaElement not \" + child.class.name)\n end\n s = s + child.sprintf(indent + \"\\t\")\n end\n @content = NaElement::escapeHTML(@content)\n s = s + @content.to_s\n if(@children.size() > 0)\n s = s + indent\n end\n s = s + \"</\" + @name + \">\\n\"\n s\n end", "def to_s(attributes = nil)\r\n assert_exists\r\n hash_properties = {\"text\"=>\"innerHTML\"}\r\n hash_properties.update(attributes) if attributes != nil\r\n r = super(hash_properties)\r\n #r = string_creator\r\n #r += span_div_string_creator\r\n return r.join(\"\\n\")\r\n end", "def to_s\n \"#{tag} #{[@from.quoteize, @to.quoteize, @options].compact.flatten * \" \"}\"\n end", "def to_s\n \"#{tag} #{[@from.source, @to].quoteize.compact.flatten * \" \"}\"\n end", "def render_inlined_string(template)\n render(template: template, layout: \"layouts/inlined_string\")\n end", "def to_html\n \"<p>#{inline_html(escape_xml(@lines.join(\"\\n\")))}</p>\"\n end", "def format_as_span_html(name, attr, body); end", "def tag(tag, *a)\n if Hash === a.last\n opts = a.pop\n else\n opts = {}\n end\n\n attrs = opts.map do |k,v|\n \"#{k}=\\\"#{h v}\\\"\"\n end.join ' '\n\n content = if block_given?\n a << yield\n else\n a\n end.flatten.join(\"\\n\")\n\n s = \"<#{tag} #{attrs}>#{content}</#{tag}>\"\n end", "def tag(tagname, text)\n html = \"<#{tagname}>#{text}</#{tagname}>\"\n yield html\nend", "def to_s\n\t\t@material_name + \": \" + @markup.to_s + \"%\" + (!@material_parent.nil? ? (\", Parent: \" + material_parent) : \"\")\n\tend", "def make_img_tag(x)\n\n\"<img src='\" + x +\"'/>\"\n\nend", "def to_embedded_s # :nodoc:\n if name\n name.to_s\n else\n needs_paren? && label.nil? ? \"(#{to_s})\" : to_s\n end\n end", "def cdk_fmt\n \"</#{@id}>\"\n end", "def example_tag(text); end", "def add_tag(name, start, stop)\n attr = @attributes.bitmap_for name\n @attr_tags << InlineTag.new(attr, start, stop)\n end", "def single_tag(name,options={})\n options ||= options.stringify_keys\n \"<#{name.to_s} #{options.to_html_attrs} />\"\n end", "def build_line_content_tag(line_content, container_attributes)\n result = Nokogiri::XML::Element.new('td', doc)\n result['class'] = 'line-content'\n\n line_pre = Nokogiri::XML::Element.new('pre', doc)\n result.add_child(line_pre)\n container_attributes.each { |key, value| line_pre.set_attribute(key, value) }\n\n line_code = Nokogiri::XML::Element.new('code', doc)\n line_pre.add_child(line_code)\n line_code.inner_html = line_content\n\n result\n end", "def to_markup\n <<-STR\n= #{self.class} Api\n\n#{sorted_endpoints.map do |e|\n \"=== #{e.http_method} #{e.path}\\n\\n\" +\n \"<em>#{e.description}</em>\\n\\n\" +\n \"Details at link:#{e.path}#{self.class.api_doc_suffix}\"\n end.join \"\\n\\n\" }\n STR\n end", "def to_html\n %(<span class=\"ricsvn_string\" >#{self}</span>)\n end", "def on_html_tag(name, attrs, content = nil)\n return super if name != '*'\n hash, merger, formatter = splat_attributes(attrs[2..-1])\n tmp = unique_name\n tag = [:multi,\n merger,\n [:code, \"#{tmp} = #{hash}.delete('tag').to_s\"],\n [:if, \"#{tmp}.empty?\",\n [:code, \"#{tmp} = #{@options[:default_tag].inspect}\"]],\n [:static, '<'],\n [:dynamic, \"#{tmp}\"],\n formatter]\n tag << if content\n [:multi,\n [:static, '>'],\n compile(content),\n [:static, '</'],\n [:dynamic, \"#{tmp}\"],\n [:static, '>']]\n else\n [:static, '/>']\n end\n end", "def to_tag_string(tags)\n\t\ttags.each_with_index.map { |tag, i|\n\t\t\tnext if (i > 0 && i.odd?)\n\t\t tag\n }.join(\":\").html_safe\n end", "def inline_label(wrapper_options = nil)\n inline_option = options[:inline_label]\n\n if inline_option\n label = inline_option == true ? label_text : html_escape(inline_option)\n \" #{label}\".html_safe\n end\n end", "def to_s\n \"<#{@name}\" + @attrs.sort.map{|k,v| \" #{k}='#{v.xml_attr_escape}'\"}.join +\n if @contents.size == 0\n \"/>\"\n else\n \">\" + @contents.map{|x| if x.is_a? String then x.xml_escape else x.to_s end}.join + \"</#{name}>\"\n end\n end", "def _reduce_13(val, _values, result)\n content = val[1]\n result = inline \"<em>#{content}</em>\", content\n\n result\nend", "def open_tag(name, attrs = nil)\n \"<#{name}#{' ' + attrs.to_html_attributes if attrs && !attrs.empty?}>\"\n end", "def span_wrap tag, text\n \"<span class='#{tag}' markdown='1'>#{text}</span>\"\nend", "def open_tag(name, attrs = nil)\n \"<#{name}#{' ' + attrs.to_html_attributes if attrs && !attrs.empty?}>\"\n end", "def link_html(type, text = '')\n base_link = raw(\"<span class='glyphicon glyphicon-#{type}'></span>\")\n #base_link = raw(\"\")\n if text.empty?\n base_link\n else\n raw(\"#{base_link} #{text}\")\n end\n end", "def inline_html(opts)\n opts[:text] || \"\"\n end", "def return_tag(text); end", "def to_html\n child_type = element_type\n type_string = ''\n type_string = \"type=\\\"#{@type}\\\"\" if @type\n\n element_string = \"<#{child_type} id=\\\"#{@id}\\\" #{type_string}></#{child_type}>\"\n end", "def to_s\r\n assert_exists\r\n super({\"for\" => \"htmlFor\",\"text\" => \"innerHTML\"})\r\n # r=r + label_string_creator\r\n end", "def tag_attributes(options)\n return '' unless options\n options.inject('') do |all,(key,value)|\n next all unless value\n all << ' ' if all.empty?\n all << if value.is_a?(Hash)\n nested_values(key, value)\n elsif BOOLEAN_ATTRIBUTES.include?(key)\n %(#{key}=\"#{key}\" )\n else\n %(#{key}=\"#{escape_value(value)}\" )\n end\n end.chomp!(' ')\n end", "def tag_attributes_string\n tag_attributes.map{|k, v| \"#{k}=\\\"#{v}\\\"\"}.join(' ')\n end", "def to_xhtml(*args); end", "def to_xhtml(*args); end", "def to_xhtml(*args); end", "def to_xhtml(*args); end", "def sections_augmented_link( obj )\n title = \"\"\n title << obj.code unless obj.try( :code ).blank?\n title << \"\\n\" unless title.empty? or obj.try( :description ).blank?\n title << obj.description unless obj.try( :description ).blank?\n\n content_tag(\n :span,\n link_to( h( obj.title ), obj ),\n :title => title\n )\n end", "def to_s\n %(<#{ @name }#{attributes}>)\n end", "def toEncodedString()\n s = \"<\" + @name.to_s\n key_count = 0\n @attrkeys.each do |key|\n s = s + \" \" + key.to_s + \"=\\\"\" + @attrvals[key_count].to_s + \"\\\"\"\n key_count = key_count + 1\n end\n s = s + \">\"\n @children.each do |child|\n unless(child.class.name.eql?(\"NaElement\"))\n abort(\"Unexpected reference found, expected NaElement not \" + child.class.name)\n end\n s = s + child.toEncodedString()\n end\n cont = @content.to_s\n cont = NaElement::escapeHTML(cont)\n s = s + cont\n s = s + \"</\" + @name.to_s + \">\"\n s\n end", "def badge_maker(name) #method that takes a name and returns \"Hello, my name is <name>\"\r\n \"Hello, my name is #{name}.\"\r\nend", "def tagstring\n\tself.taglist.join ', '\n end", "def render_inline_tag_list(post, **options)\n render TagListComponent.new(tags: post.tags, **options).with_variant(:inline)\n end", "def render_inline_tag_list(post, **options)\n render TagListComponent.new(tags: post.tags, **options).with_variant(:inline)\n end", "def build_tags(method, options)\n options[:class] ||= \"\"\n options[:label] ||= method.to_s.humanize\n options[:label] << \" *\" if options[:required]\n content = setup_label_for(method, options[:label]) \n content = add_hint_to(options[:hint],content)\n return content\n end", "def wrap(text)\n return text if @done\n\n text = \"#{@pre_wrap.values}#{text}\" if @pre_wrap\n\n if dyn_params[:id]\n @tag ||= 'div'\n end\n\n if @tag\n if text.blank? && EMPTY_TAGS.include?(@tag)\n res = \"#{@pre_wrap}<#{@tag}#{params_to_html}#{@append}/>\"\n else\n res = \"<#{@tag}#{params_to_html}#{@append}>#{text}</#{@tag}>\"\n end\n else\n res = text\n end\n @done = true\n\n (@space_before || '') + res + (@space_after || '')\n end", "def to_s\n text = ''\n\n text << \"#{tag_output_string}\\n\" unless tags.empty?\n text << \"#{@keyword}:#{name_output_string}\"\n text << \"\\n#{description_output_string}\" unless no_description_to_output?\n text << \"\\n\\n#{background_output_string}\" if background\n text << \"\\n\\n#{tests_output_string}\" unless tests.empty?\n\n text\n end", "def open_tag\n %{<#{@tag} #{attributes}>}\n end", "def as_img_tag()\n \"<img src='#{self.encode}' />\"\n end", "def to_s\n return content unless node?\n props = properties || {}\n html = props.collect{ |key, value| '%s=\"%s\"' % [key, value] }\n attrs = \"\" \n attrs = (\" \" << html.join(\" \")) unless html.empty?\n \n if SELF_CLOSING_TAGS.include?(node)\n return \"\" unless attrs.strip.blank?\n \"<%s%s />\" % [node, attrs]\n else\n \"<%s%s>%s</%s>\" % [node, attrs, content, node]\n end\n end", "def inline(input, alternate = false)\n\n parts = tokenize_line(input, /(\\[.+?\\]\\(.+?\\))/)\n result = ''\n\n parts.each do |p|\n if p.matched\n result << p.content.gsub(/\\[(.+?)\\]\\((.+?)\\)/, '\\href{\\2}{\\1}').gsub('_', '\\_')\n else\n result << replace_inline_content(p.content, alternate)\n end\n end\n\n result\n end", "def begintag(name, attributes=[])\r\n\tattribs = \"\"\r\n\tif (!attributes.empty)\r\n\t\tattributes.each do |(key,value)| \r\n\t\t\tattribs = \" #{key.strip}=\\\"#{value.strip}\\\"\"\r\n\t\tend\r\n\tend\r\n\treturn \"<\" + name.strip + \" \" + attribs + \">\"\r\nend", "def tag tag, text, classes = nil\n \"<#{tag} #{classes.nil? ? '': \"class='#{classes}'\"}'>#{text}</#{tag}>\"\nend", "def mytag(opts)\n Rails.logger.info \"Own method mytag is active\"\n \"<b>#{opts[:text]}</b>\"\n end", "def to_s\n\t\tstr = \"\\n<\" + @type\n\t\t@attributes.each{ |key,value|\n\t\t\tstr += \" \" + key.to_s + \" = \" + value.to_s\n\t\t}\n\t\tif @type == 'text'\n\t\t\tstr += \"> \" + @content[0] + \" </\" + @type + \">\"\n\t\telse\n\t\t\tstr += \"> \"\n\t\t\t@content.each { |c|\n\t\t\t\tstr += c.to_s\n\t\t\t}\n\t\t\tstr += \"\\n</\" + @type + \">\"\n\t\tend\n\t\tstr\n\tend", "def to_s(options={})\n s = \"[#{line.to_s.rjust(options[:indent])}] \"\n s << \"[#{tag}] \" if options[:tag]\n s << text\n end", "def input_tag_wrapper(label, tag)\n \"<tr><td>#{label}</td><td>#{tag}</td></tr>\\n\"\n end", "def page_header_tag\n return \"\" if @tag.blank? || @tag.name.blank?\n icon = <<-HTML\n <i class=\"icon-tag\"></i>\n HTML\n unless @tag.icon_url.blank?\n icon = <<-HTML\n <img src=\"#{@tag.icon_url}\">\n HTML\n end\n html = <<-HTML\n <div class=\"page-header\">\n <h2>#{icon} #{@tag.name}</h2>\n </div>\n HTML\n html.html_safe\n end", "def op_helper_simple(tagname, tagclass, to_add)\n @content << %(<#{tagname} class=\"#{tagclass}\">) << to_add << %(</#{tagname}>)\n end", "def tag(text, options={})\n puts \"options before processing: #{options.inspect}\"\n tag = options.delete(:tag) || 'div'\n puts \"options after processing: #{options.inspect}\"\n attrs = options.map {|(key, value)| \"#{key}='#{value}'\" }.join(' ')\n \n \"<#{tag} #{attrs}>#{text}</#{tag}>\"\nend", "def inner_html(options = T.unsafe(nil)); end", "def to_html\r\n html = @text\r\n html = html_tag(:em, content: html) if italicized?\r\n html = html_tag(:strong, content: html) if bolded?\r\n styles = {}\r\n styles['text-decoration'] = 'underline' if underlined?\r\n # No need to be granular with font size down to the span level if it doesn't vary.\r\n styles['font-size'] = \"#{font_size}pt\" if font_size != @font_size\r\n html = html_tag(:span, content: html, styles: styles) unless styles.empty?\r\n html = html_tag(:a, content: html, attributes: {href: href, target: \"_blank\"}) if hyperlink?\r\n return html\r\n end", "def tag(element, content, attributes = {})\n attr_string = \"\"\n attributes.each do |name, value|\n attr_string += \" #{name}=\\\"#{value}\\\"\"\n end\n \"<#{element}#{attr_string}>#{content}</#{element}>\"\nend", "def __ag_render_a_inline(key, template, options, other, &block)\n _ag_render_without_silverlight(key, template, options, other, &block)\n end", "def to_s\n TEXT_SYMBOLS[self.entry_type] + \n \"] \" +\n body\n end", "def make_tags(tag, word)\n \"<#{tag}>#{word}</#{tag}>\"\n end", "def codespan(code)\n \"{{#{code}}}\"\n end", "def t_e(tag_name)\n %Q{</#{tag_name}>}\n end", "def tagline; end", "def content_tag(name, content, attributes = nil)\n name = html_escape(name) unless name.html_safe?\n content = html_escape(content) if content && !content.html_safe?\n attributes = attributes.map do |name, value|\n value = html_escape(value) unless value.html_safe?\n %Q{#{name}=\"#{value}\"}\n end if attributes && attributes.any?\n start = [name, attributes.join(\" \")].reject(&:nil?).join(' ')\n \"<#{start}>#{content}</#{name}>\"\n end", "def open_tag(name, attrs = {}) \n \"<#{name}#{normalize_html_attributes(attrs)}>\"\n end", "def tag(name, content = nil, options = {})\n \"<#{name}\" +\n (!options.empty? ? \" #{hash_to_html_attrs(options)}\" : '') +\n (content.nil? ? '>' : \">#{content}</#{name}>\")\n end", "def html\n #this is a way to create longer strings in place easily.\n x = <<DELIM\n<html>\n<body>\n#{yield}\n</body>\n</html>\nDELIM\nend", "def init_tags\n @attr_tags = [\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:BOLD), l(\"\\\\textbf{\"), l(\"}\")),\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:TT), l(\"\\\\texttt{\"), l(\"}\")),\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:EM), l(\"\\\\emph{\"), l(\"}\")),\n ]\n end" ]
[ "0.7471103", "0.69979167", "0.6410485", "0.63333434", "0.63280934", "0.63246924", "0.6314425", "0.6307209", "0.6238538", "0.62183344", "0.61661804", "0.61649233", "0.60918224", "0.6033075", "0.6022059", "0.6015177", "0.59945685", "0.5990561", "0.5985831", "0.5982855", "0.59818876", "0.597611", "0.59650517", "0.5948229", "0.5945121", "0.5935173", "0.5913998", "0.59090376", "0.5885711", "0.5885699", "0.58752036", "0.5868089", "0.582331", "0.5798337", "0.5782473", "0.5771125", "0.5769602", "0.5769382", "0.57648706", "0.5760305", "0.5752517", "0.5741251", "0.57302487", "0.5729897", "0.5727929", "0.57077", "0.57071936", "0.5705573", "0.56987077", "0.5689922", "0.568622", "0.5684749", "0.5683794", "0.56753254", "0.5674057", "0.56712365", "0.56536925", "0.56403744", "0.5622979", "0.5617568", "0.5617568", "0.5617568", "0.5617568", "0.56134576", "0.56087774", "0.5601939", "0.5600344", "0.5589073", "0.55865806", "0.55865806", "0.5582577", "0.5574462", "0.5573029", "0.5572808", "0.5570116", "0.5569443", "0.55693436", "0.5567824", "0.5567289", "0.55573606", "0.55568564", "0.5552763", "0.554545", "0.55367327", "0.55294114", "0.55242765", "0.5522852", "0.55223924", "0.55217", "0.55119115", "0.55056906", "0.5503491", "0.5501182", "0.5500776", "0.5500375", "0.54992527", "0.5498317", "0.54941857", "0.54921246", "0.5487287" ]
0.7233123
1
A method for building inline div string with class attribute
def div_inline value, role tag_inline('div', value, class: role) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div_with_opts(opts, &block)\n class_list = opts[:classes]\n if class_list.instance_of?(Array) && class_list.size > 0\n class_list.reject! { |c| c.blank? }\n class_list = class_list.join(\" \")\n end\n content = with_output_buffer(&block)\n content_tag(:div, content, :class => class_list, :id => opts[:id])\n end", "def div_wrap tag, text\n \"<div class='#{tag}' markdown='1'>#{text}</div>\"\nend", "def make_class(klass)\n %Q{\n <td class=\"class_item\" colspan=\"#{klass.intervals}\">\n <p>#{klass.name} - #{klass.location}</p>\n <p>#{klass.type}</p>\n </td>}\n end", "def to_s\n \"#<#{classname}>\"\n end", "def css_class *a; CssString.new a.flatten.unshift(self).join '.' end", "def bp_class class_param\n class_param.blank? ? '' : class_param.strip().html_safe\n end", "def tag tag, text, classes = nil\n \"<#{tag} #{classes.nil? ? '': \"class='#{classes}'\"}'>#{text}</#{tag}>\"\nend", "def class2html c\n name = c.name\n doc = REXML::Document.new\n html = doc.add_element \"html\", \"xmlns\" => \"http://www.w3.org/1999/xhtml\", \"xml:lang\" => \"en\", \"lang\" => \"en\"\n head = html.add_element \"head\"\n head.add_element \"meta\", \"http-equiv\" => \"Content-type\", \"content\" => \"text/html; charset=utf-8\"\n title = head.add_element \"title\"\n title.text = \"Class #{name}\"\n css = head.add_element \"link\", \"rel\" => \"stylesheet\", \"href\" => \"../mofhtml.css\", \"type\" => \"text/css\", \"media\" => \"screen,projection,print\"\n body = html.add_element \"body\"\n c.to_html body.add_element(\"div\", \"class\" => \"outer_div\")\n doc\nend", "def quote_tag\n :div\n end", "def op_helper_simple(tagname, tagclass, to_add)\n @content << %(<#{tagname} class=\"#{tagclass}\">) << to_add << %(</#{tagname}>)\n end", "def div_by_class(class_name)\n return @browser.div(:class, cuke_class(class_name))\nend", "def to_s\n content_tag :div, id: @id, class: container_classes do\n @content.call(self)\n end\n end", "def to_html\n %(<span class=\"ricsvn_string\" >#{self}</span>)\n end", "def render(item_container)\n # Add support for a dom_class attribute on the parent element\n item_container.dom_class = \"\"\n item_container.dom_class = options.delete(:dom_class) if options.has_key?(:dom_class)\n item_container.dom_id = options.delete(:dom_id) if options.has_key?(:dom_id)\n item_container.dom_class += \" \" + get_class(has_icons ? \"__with-icons\" : \"__without-icons\")\n item_container.dom_class += \" \" + get_class(has_toggles ? \"__with-toggles\" : \"__without-toggles\")\n item_container.dom_class += \" level-#{item_container.level}\"\n super\n end", "def html_options\n { :class => attribute }\n end", "def div(options = {})\r\n attributes = \"id=\\\"#{@container}\\\" \"\r\n if options.has_key?(:height) && options.has_key?(:width)\r\n attributes += \"style=\\\"width:#{options.delete(:width)}px;height:#{options.delete(:height)}px\\\" \"\r\n end\r\n if options.has_key?(:class)\r\n attributes += options.keys.map {|opt| \"#{opt}=\\\"#{options[opt]}\\\"\" }.join(\" \")\r\n end\r\n \"<div #{attributes}></div>\"\r\n end", "def new_tooltip_div_code(display_text, hidden_text)\n return %Q{\n <span class=\"newtooltip\">#{display_text}</span>\n <div id=\"liquid-roundTT\" class=\"tooltip\" style=\"display:none;\">\n <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n <tr>\n <td width=\"10\"><div class=\"top_curve_left\"></div></td>\n <td width=\"278\"><div class=\"top_middle\"><div class=\"ap_pixel11\"></div></div></td>\n <td width=\"12\"><div class=\"top_curve_right\"></div></td>\n </tr>\n <tr>\n <td class=\"center_left\"><div class=\"ap_pixel1\"></div></td>\n <td><div class=\"center-contentTT\">#{hidden_text}</div></td>\n <td class=\"center_right\"><div class=\"ap_pixel1\"></div></td>\n </tr>\n <tr>\n <td valign=\"top\"><div class=\"bottom_curve_left\"></div></td>\n <td><div class=\"bottom_middle\"><div class=\"ap_pixel12\"></div></div></td>\n <td valign=\"top\"><div class=\"bottom_curve_right\"></div></td>\n </tr>\n </table>\n </div>\n }\n end", "def to_s\n content_tag :div, id: @id, class: \"accordion #{@class}\", data: @data do\n @content.call(self)\n end\n end", "def aa(str)\r\n %Q|<pre class=\"aa\">#{str}</pre>|\r\nend", "def html_classes; end", "def to_s\n content_tag :div, id: @id, class: \"card #{@class}\", data: @data do\n @content.call(self)\n end\n end", "def render_icon(icon_class)\n content_tag('span', '', :class => \"icon #{icon_class}\")\n end", "def the_widget(attrs = {}, &block)\n attrs = {qty_truncate: 100, block_right: '', class: ''}.merge(attrs)\n \"<div class='media #{attrs[:class]}'>\n <div class='media-left text-center'>\n <div class='text-red'>#{object.day}</div>\n <div class='num'>#{object.hour}</div>\n </div>\n <div class='media-body'>\n <div class='media-heading text-gray'>\n #{object.title}\n </div>\n #{block ? h.capture(&block) : ''}\n </div>\n #{\"<div class='media-right'>#{attrs[:media_right]}</div>\" if attrs[:media_right]}\n </div>\".html_safe\n end", "def annotated_tag(tag, text, class: '')\n\t\t(\"<#{tag.to_s} \" + \"id=\\\"#{id_safe(text)}\\\" >\" + text + \"</#{tag.to_s}>\").html_safe\n\t\t#class=\\\"#{class.to_s}\\\"\n\tend", "def span_wrap tag, text\n \"<span class='#{tag}' markdown='1'>#{text}</span>\"\nend", "def div_wrapper(attribute, options = {}, &block)\n options[:id] = _wrapper_id attribute, options[:id]\n options[:class] = _wrapper_classes attribute, options[:class]\n\n template.content_tag :div, options, &block\n end", "def render\n \"<div id=\\\"#{self.area_type}_#{self.id}\\\">#{self.html}</div>\"\n end", "def render\n \"<div id=\\\"#{self.area_type}_#{self.id}\\\">#{self.html}</div>\"\n end", "def html_class(*args)\n (@html_class ||= HTMLClass.new) << args\n end", "def render(_options = {})\n content_tag :div, class: css_name do\n content_text = data['text'] || ''\n CommonMarker::Rouge.render_html(\n content_text,\n %i[UNSAFE FOOTNOTES STRIKETHROUGH_DOUBLE_TILDE],\n %i[UNSAFE GITHUB_PRE_LANG HARDBREAKS TABLE_PREFER_STYLE_ATTRIBUTES FULL_INFO_STRING FOOTNOTES],\n %i[table strikethrough tasklist tagfilter],\n formatter: Rouge::Formatters::HTMLLegacy.new(inline_theme: 'github')\n ).html_safe\n end\n end", "def append_class!(options, scope, value)\n html = (options[scope] ||= {})\n\n if html[:class]\n html[:class] << \" #{value}\"\n else\n html[:class] = value\n end\n\n nil\n end", "def container_class\n string = 'badge '\n string += @context == 'secondary' ? 'badge-secondary' : \"badge-#{@context}\"\n string += \" #{@class}\"\n string\n end", "def eval_string(klass, attrib)\n s = <<EOS\n class #{klass}\n def #{attrib}\n @#{attrib}\n end\n\n def #{attrib}=(value)\n @#{attrib} = value\n end\n end\nEOS\n return s\nend", "def add_class class_name\n string=\"$('##{@id}').addClass(#{class_name.to_s.inspect})\"\n @app.dom_on_sockets.execute string\n end", "def to_s\n content_tag(\n :div,\n id: @id,\n class: \"input-group #{@class}\",\n data: @data\n ) do\n @content.call(self)\n end\n end", "def open(width: @width, custom_class: @class)\n \"<div class='content-block column #{width} #{custom_class}'><div class='element-step' data-step-id='#{@random}'>\n <div class='step-scroller'>\"\n end", "def html\n original_options = @html_options.dup\n self[:class] = \"#{self[:class]} #{alternate_class}\".strip if alternate\n html = super\n @html_options = original_options\n html\n end", "def definition_as_html() \"default html #{self.class}\" end", "def add_class c\n each do |q|\n str = q.get_attribute(\"class\")\n\n if str.empty?\n str = c.to_s\n else\n str = str+\" #{c}\"\n end\n \n q.set_attribute(\"class\",str)\n end\n end", "def append_class(block_name, appended_classes='')\n current_page_classes = current_page.data[block_name] || ''\n existing_classes_a = current_page_classes.split(' ')\n appended_classes_a = appended_classes.split(' ')\n classes = existing_classes_a.concat(appended_classes_a).reverse.join(' ')\n content_for(block_name, classes)\n end", "def snippet_tag\n :div\n end", "def css_class name\n attr \".#{name}\"\n end", "def inner_html(*args); end", "def inner_html(*args); end", "def icon(dom_class, options = {}, &block)\n dom_class = dom_class_icon_dispatcher(dom_class)\n\n options.reverse_merge!({\n :class => dom_class,\n :style => \"float: left\"\n })\n content_tag(:span, (block ? yield : \"&nbsp;\".html_safe), options)\n end", "def render_explanation(method)\n\t\tcontent_tag \"div\", method, :class => \"activity\"\n\tend", "def method_missing(class_or_id, content = nil, **attributes, &template)\n class_or_id = class_or_id.to_s\n self.send class_or_id.end_with?(?!) ? :id : :klass,\n class_or_id.chomp(?!)\n\n _merge attributes\n\n @content.concat @builder.tags_for(content, &template) \\\n if @builder\n\n self\n end", "def css_class\n result = [self.project.try(:css_class), self.try(:format).try(:css_class)].join(' ')\n result = 'other' unless CSS_CLASSES.include?(result)\n result += ' invisible' unless self.is_visible\n result\n end", "def render_div(line)\n render_tag('%div' + line)\n end", "def render_div(line)\n render_tag('%div' + line)\n end", "def to_s(attributes = nil)\r\n assert_exists\r\n hash_properties = {\"text\"=>\"innerHTML\"}\r\n hash_properties.update(attributes) if attributes != nil\r\n r = super(hash_properties)\r\n #r = string_creator\r\n #r += span_div_string_creator\r\n return r.join(\"\\n\")\r\n end", "def column container_class, content_class, &block\n concat content_tag(:div, :class => container_class) {\n content_tag(:div, :class => content_class) {\n capture(&block)\n }\n }\n end", "def show_header_tag(obj)\n return \"no display_name method\" if !obj.respond_to?('display_name')\n content_tag('div', :style => 'display:inline;') do\n obj.display_name + \"&nbsp;\" + content_tag('span', \"(id: #{obj.id})\", :class => 'small_grey')\n end\n end", "def css_class(hay, needle); end", "def render\n result, extends = Visitors::Cssize.visit(Visitors::Perform.visit(self))\n result = result.do_extend(extends) unless extends.empty?\n result.to_s\n end", "def span_tag(class_name, token)\n \"<span class='#{class_name}'>#{token}</span>\"\n end", "def add_divs (html)\n\thtml.gsub!(/^<p>\\[(.*?)\\/\\]/m, '<div class=\"\\1\"></div>')\n\thtml.gsub!(/^<p>\\[\\/(.*?)\\]/m, '</div>')\n\thtml.gsub!(/^<p>\\[(.*?)\\]/m, '<div class=\"\\1\">')\n\thtml\nend", "def css_class\n end", "def css_classes_for(*args)\n return nil if args.empty?\n\n conditions = args.extract_options!\n classes = args.dup\n conditions.each { |clas, condition| classes << clas if condition }\n classes.join(\" \")\n end", "def open(width: @width, custom_class: @class)\n \"<div class='content-block column #{width} #{custom_class}'>\"\n end", "def render(item_container)\n # Add support for a dom_class attribute on the parent element\n item_container.dom_class = \"\"\n item_container.dom_class = options.delete(:dom_class) if options.has_key?(:dom_class)\n item_container.dom_id = options.delete(:dom_id) if options.has_key?(:dom_id)\n item_container.dom_class += has_icons ? \" simple-navigation__with-icons\" : \" simple-navigation__without-icons\"\n item_container.dom_class += has_toggles ? \" simple-navigation__with-toggles\" : \" simple-navigation__without-toggles\"\n super\n end", "def showInHtml(data)\n \"<div>#{data}</div>\"\n end", "def render_threads\n <<-HTML\n #{ @vm.thread_pcs.each_with_index.map { |thread_pc,thread_id|\n opcode_addr_prev = @vm.start_of_opcode_at(thread_pc - 1)\n opcode_addr_next = @vm.start_of_opcode_at(thread_pc + (@vm.disassemble_opcode_at(thread_pc).flatten.size))\n classes = []\n classes << \"current\" if thread_id == @vm.thread_id\n %(\n <tr>\n <td class=\"thread\">\n <h2>#{thread_id} #{@vm.thread_names[thread_id]}</h2>\n\n <h2>Local Vars</h2>\n <table class=\"local_vars\">\n </table>\n\n <h2>PC</h2>\n #{thread_pc}\n </td>\n <td>\n <h2>Opcode</h2>\n <table class=\"opcode_sequence\">\n <tr class=\"sequence_item inactive\"><td>\n #{opcode_addr_prev ? render_disassembly_at(opcode_addr_prev,:classes => %w(inactive)) : \"--\"}\n </td></tr>\n <tr class=\"sequence_item\"><td>\n #{render_disassembly_at(thread_pc)}\n </td></tr>\n <tr class=\"sequence_item inactive\"><td>\n #{opcode_addr_next ? render_disassembly_at(opcode_addr_next,:classes => %w(inactive)) : \"--\"}\n </td></tr>\n </table>\n </td>\n </tr>\n )}.join(\"\\n\")}\n HTML\n end", "def result_icon(obj, opts={})\n inner_html = \"\"\n\n display_name = obj.is_a?(Team) ? obj.name : obj.uniform_name\n display_number = obj.is_a?(Team) ? obj.abbrev : obj.uniform_number\n shirt_color = obj.is_a?(Team) ? obj.shirt_color : obj.team.shirt_color\n\n inner_html += content_tag(:span, display_name, :class=>\"name\") + content_tag(:span, display_number, :class=>\"number\")\n html_classes = opts[:class]\n html_classes = [\"athlete-icon\", \"result-icon\", html_classes]\n html_classes << \"shirt-#{shirt_color}\"\n\n html_attribs = {:class=>html_classes.join(\" \"), \"data-name\"=>display_name, \"data-number\"=>display_number}\n if obj.is_a?(Team)\n html_attribs[\"data-team\"] = obj.id\n elsif obj.is_a?(Registration)\n html_attribs[\"data-team\"] = obj.team_id\n html_attribs[\"data-registration\"] = obj.id\n end\n\n content_tag :div, inner_html.html_safe, html_attribs\n end", "def tag_inline tagname, value, **attr_map\n attr_str = mk_attr_str(attr_map)\n \"<#{tagname}#{attr_str}>#{value}</div>\"\n end", "def roundedbox(html_options = {}, &block)\n html_options[:class] = ['box', html_options[:class]].compact.join(' ')\n concat <<-MARKUP\n <div #{tag_options(html_options)}>\n <div class=\"boxtop\"><div>&nbsp;</div></div>\n <div class=\"boxcontent\">#{capture(&block)}</div>\n <div class=\"boxbottom\"><div>&nbsp;</div></div>\n </div>\n MARKUP\n end", "def div(text)\n \"<div>#{text}</div>\" unless text.blank?\n end", "def add_class(class_name)\n @fragment.each_element do |c|\n c.attributes['class'] = ((c.attributes['class']||'').split(' ') + [class_name]).join(' ')\n end\n end", "def id_and_class(options = {}) # change to {}\n\t\tids = [\"id='td_#{self.cell_id(options[:number])}' class='#{self.class_name} #{options[:outer_span]}\"]\n\t\tids << \" \" << options[:target] if options[:target]\n\t\t(ids << \"'\").join\n\t\t# end\n\tend", "def css_class\n @css_class ||= \"project #{status.gsub(' ','-').downcase}\"\n end", "def cc_html(options={}, &blk)\n attrs = options.map { |(k, v)| \" #{h k}='#{h v}'\" }.join('')\n [ \"<!--[if lt IE 7 ]> <html#{attrs} class='ie6'> <![endif]-->\",\n \"<!--[if IE 7 ]> <html#{attrs} class='ie7'> <![endif]-->\",\n \"<!--[if IE 8 ]> <html#{attrs} class='ie8'> <![endif]-->\",\n \"<!--[if IE 9 ]> <html#{attrs} class='ie9'> <![endif]-->\",\n \"<!--[if (gt IE 9)|!(IE)]><!--> <html#{attrs}> <!--<![endif]-->\",\n capture_haml(&blk).strip,\n \"</html>\"\n ].join(\"\\n\")\n end", "def render\n content_tag(:span, text, class: \"label #{dom_label_class}\")\n end", "def render\n content_tag(:span, text, class: \"label #{dom_label_class}\")\n end", "def to_s\n content_tag :div, id: @id, class: container_class do\n concat(@dismissible ? close_button : '')\n @content.call(self)\n end\n end", "def to_s\n content_tag :div, id: @id, class: container_class do\n concat(@dismissible ? close_button : '')\n @content.call(self)\n end\n end", "def _wrapped_spans(object_name,method,options={})\n\t\ts = \"<span class='label'>#{options[:label_text]||method}</span>\\n\"\n\t\tvalue = if options[:value]\n\t\t\toptions[:value]\n\t\telse\n\t\t\tobject = instance_variable_get(\"@#{object_name}\")\n\t\t\tvalue = object.send(method)\n\t\t\tvalue = (value.to_s.blank?)?'&nbsp;':value\n\t\tend\n\t\ts << \"<span class='value'>#{value}</span>\"\n\tend", "def add_class(class_name)\n @fragment.children.each do |c|\n c['class'] = ((c['class']||'').split(' ') + [class_name]).join(' ')\n end\n end", "def build_markup\n Object.const_get(output_class).new\n end", "def css_class\n @css_class ||= [\"project\", status.gsub(' ','-').downcase, (hideable? ? \"hideable\" : nil)].compact.join(\" \")\n end", "def render_plain_styleblock(name)\n @block_html.gsub('$modifier_class', '').gsub(' class=\"\"', '').prepend('<div class=\"styleguide-styleblock\">') << '</div>'\n end", "def to_html\n m = Markaby::Builder.new({}, self)\n\n m.div do\n {\n :module => 'Module:', :description => 'Description:',\n :line_number => 'Line Number:', :submitted_by => 'Submitted By:',\n :owner => 'Owner:', :ticket => 'Ticket:',\n :resolved => 'Resolved:'\n }.each do |key, value|\n h5 value\n span self.send(key).to_s\n end\n end\n end", "def main_tag(html_options = {}, &block)\n html_options[:id] ||= [controller_name, action_name].map(&:capitalize).join\n html_options[:class] = [html_options[:class]].compact.flatten\n if content_for?(:class)\n html_options[:class].concat content_for(:class).split(' ')\n end\n content_tag :main, html_options, &block\n end", "def html_div(*args, &block)\n html_tag(:div, *args, &block)\n end", "def to_html_fragment(wrap_class = 'mp')\n frag_nodes = html.at('body').children\n out = frag_nodes.to_s.rstrip\n out = \"<div class='#{wrap_class}'>#{out}\\n</div>\" unless wrap_class.nil?\n out\n end", "def render\n tag.div(children, class: \"badge #{label_class}\") + computed_visibility_notice\n end", "def format_as_span_html(name, attr, body); end", "def label(email_count, count)\n\"<div onmouseover='highlight(\\\"s#{email_count}.#{count}\\\");' onmouseout='lowlight(\\\"s#{email_count}.#{count}\\\");'>\\\n<img class='prop' id='prop#{email_count}.#{count}' onclick='toggleMe(\\\"prop#{email_count}.#{count}\\\");' src='/images/prop_d.gif' title='The sentence proposes a joint activity, or \\\"action item\\\".'>\\\n<img class='req' id='req#{email_count}.#{count}' onclick='toggleMe(\\\"req#{email_count}.#{count}\\\");' src='/images/req_d.gif' title='The sentence asks the recipient to perform an activity, or \\\"action item\\\".'>\\\n<img class='cmt' id='cmt#{email_count}.#{count}' onclick='toggleMe(\\\"cmt#{email_count}.#{count}\\\");' src='/images/cmt_d.gif' title='This sentence commits the user to some future course of action, or \\\"action item\\\".'>\\\n<img class='meet' id='meet#{email_count}.#{count}' onclick='toggleMe(\\\"meet#{email_count}.#{count}\\\");' src='/images/meet_d.gif' title='The sentence is regarding a joint activity in time or space.'>\\\n<img class='meta' id='meta#{email_count}.#{count}' onclick='toggleMe(\\\"meta#{email_count}.#{count}\\\");' src='/images/meta_d.gif' title='The sentence refers to this email thread.'>\\\n<img class='subj' id='subj#{email_count}.#{count}' onclick='toggleMe(\\\"subj#{email_count}.#{count}\\\");' src='/images/subj_d.gif' title='A sentence where the writer is expressing an opinion or strong sentiment.'>\\\n<div id='s#{email_count}.#{count}' class='clear_sentences'><b>#{email_count}.#{count}</b>&nbsp;\"\n end", "def comp_class\n @xml += '<class> '\n while @i < @tokens.length\n case @tokens[@i].val\n when 'static', 'field'\n comp_class_var_dec\n next\n when 'constructor', 'function', 'method'\n comp_subroutine\n next\n else\n comp_line\n end\n end\n @xml += '</class> '\n @xml\n end", "def to_html\n\n bootstrap_wrapping do\n content_tag(:div, class: 'input-group bs_label_with_content') do\n content_tag(:div, class: 'row') do\n tmp = ActiveSupport::SafeBuffer.new\n\n tmp << content_tag(:div, class: \"col-md-6 col-lg-6\") do\n builder.input method, :label => false\n end\n\n if object.send(method).exists?\n tmp << content_tag(:div, class: \"col-md-6 col-lg-6\") do\n image_tag object.send(method).url,class:'img-responsive img-thumbnail',style:'max-height:200px;'\n end\n end\n\n tmp\n end\n end\n end\n end", "def append_class(name); end", "def append_class(name); end", "def bob_left_span\n raw '<div class=\"row\">' \\\n ' <div class=\"large-8 medium-6 small-12 columns\">'\n end", "def append_class_name! options, class_name\n key = options.has_key?('class') ? 'class' : :class \n unless options[key].to_s =~ /(^|\\s+)#{class_name}(\\s+|$)/\n options[key] = \"#{options[key]} #{class_name}\".strip\n end\n options\n end", "def issue_label(name, value, classes=[])\n classes << \"tag\" unless classes.include? \"tag\"\n title = \"#{name}: #{value}\"\n\n content_tag :span, value, :class => classes.join(' '), :title => title\n end", "def css_classes\n s = \"meeting status-#{status}\"\n s << ' created-by-me' if User.current.logged? && author_id == User.current.id\n s\n end", "def e(content, params = {})\n clazz = params.fetch(:class, 'emoji')\n content.gsub(Unicode::Emoji::REGEX, '<span class=\"' + clazz + '\">\\0</span>')\nend", "def to_s\n content_tag :div, id: @id, class: 'tab-content' + @class do\n @content.call(self)\n end\n end", "def join_dom_classes(*names)\n names.reject(&:blank?).join(' ')\n end", "def css(klass='', opts={})\n if klass.is_a?(Hash)\n opts = klass\n klass = ''\n end\n mentos(:css, ['html', klass], opts)\n end", "def as_css_background_with_class(klass=nil)\n klass=File.basename(@file_path).tr('.','_') unless klass\n \".#{klass} {\\n #{self.as_css_background}\\n}\"\n end" ]
[ "0.6959277", "0.69079596", "0.6722711", "0.6668557", "0.6538182", "0.64266914", "0.6351896", "0.62614477", "0.6241365", "0.61993265", "0.6178322", "0.61711556", "0.6168415", "0.61362976", "0.61201686", "0.60939145", "0.60395265", "0.5968912", "0.59623134", "0.59617704", "0.59222025", "0.59063387", "0.5888227", "0.58775365", "0.5862239", "0.5847029", "0.5817731", "0.5817731", "0.57875633", "0.5783547", "0.57831985", "0.5767482", "0.57650584", "0.576065", "0.5757161", "0.573556", "0.5719758", "0.5707179", "0.570276", "0.56936824", "0.56700206", "0.56585693", "0.5652812", "0.5652812", "0.5629909", "0.56019557", "0.5597118", "0.559306", "0.558704", "0.558704", "0.5578908", "0.5576458", "0.5569122", "0.55647045", "0.5564492", "0.55543995", "0.55535436", "0.55514544", "0.5542727", "0.5527232", "0.5511884", "0.55094886", "0.5506263", "0.5498849", "0.5496784", "0.549226", "0.5490653", "0.5487577", "0.5487403", "0.5485544", "0.5464078", "0.54573417", "0.54573417", "0.54552424", "0.54552424", "0.54513955", "0.5443102", "0.5439034", "0.54371583", "0.54324216", "0.54280925", "0.5414316", "0.540916", "0.54071736", "0.54064125", "0.54033184", "0.5396197", "0.5392967", "0.5383264", "0.5378289", "0.5378289", "0.53751326", "0.5370532", "0.5368054", "0.53621674", "0.53605133", "0.5357144", "0.5356155", "0.53397834", "0.5331579" ]
0.6323583
7
A method for indent array
def a_indent arr, level=1 [arr].flatten.map{|e|"#{SP*level}#{e}"} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indent()\n #This is a stub, used for indexing\n end", "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def indent!(num = nil, i_char = ' ')\n collect! do |array_element|\n array_element.indent!(num, i_char)\n end\n end", "def indent(num = nil, i_char = ' ')\n collect do |array_element|\n array_element.indent(num, i_char)\n end\n end", "def indent=(_arg0); end", "def indent(content)\n a = blockss(content)\n arr = []\n space = 0\n (a.length - 1).times do |i|\n x = a[i]\n y = a[i + 1]\n if x[0] != 'end'\n space += 2\n arr << [space, x[1], y[1]] # rubocop:disable Style/IdenticalConditionalBranches\n else\n space -= 2\n arr << [space, x[1], y[1]] # rubocop:disable Style/IdenticalConditionalBranches\n end\n end\n arr\n end", "def indentation; end", "def indentation; end", "def indent_for(line); end", "def indent1\n ' ' * 2\n end", "def indent_in\n @indent.slice!(-1, 1)\n end", "def indent\n\t\tif @marked\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tblock_indent(mark_row,row)\n\t\telse\n\t\t\taddchar(?\\t)\n\t\tend\n\tend", "def indent( mod = nil )\n #p [ self.id, level, mod, :INDENT ]\n if level <= 0\n mod ||= 0\n else\n mod ||= options(:Indent)\n mod += ( level - 1 ) * options(:Indent)\n end\n return \" \" * mod\n\t\tend", "def indent_atom; \" \"; end", "def indent_each_line!(indent_sequence=\"\\t\")\n\t\treturn self.collect!{ |line|\t\"#{indent_sequence}#{line}\" }\n\tend", "def indented\n \"#{INDENTATION * indents}#{original}\"\n end", "def indentation\n \" \" * @indent_size * @indent_level\n end", "def indent_out\n @indent << \" \"\n end", "def indent\n @__indent__ ||= 0\n @__indent__ += indentation\n end", "def indent!\n\t\t\tself << indent\n\t\tend", "def inner(el, indent); end", "def to_pretty\r\n\t\t\ta = dup\r\n\t\t\ts = \"\"\r\n\t\t\ta.each_with_index {|i, ind|\r\n\t\t\t\ta[ind].each_with_index {|ii, iind|\r\n\t\t\t\t\ta[ind][iind].each_with_index {|iii, iiind|\r\n\t\t\t\t\t\ts << iii\r\n\t\t\t\t\t\ts << \" &\\n\" unless (iiind == (a[ind][iind].size - 1))\r\n\t\t\t\t\t}\r\n\t\t\t\t\ts << \"\\n| \" unless iind == (a[ind].size - 1)\r\n\t\t\t\t}\r\n\t\t\t\ts << \" ;\\n\\n\" unless ind == (a.size - 1)\r\n\t\t\t}\r\n\t\t\treturn s\r\n\t\tend", "def indent(indent, *s)\n \"#{\" \" * indent}#{s.join('')}\"\n end", "def printarray(array)\n print'{'\n array.each_index do |i|\n print \"#{array[i]}\"\n if i < array.length - 1\n print ', '\n end\n end\n print\"}\\n\\n\"\n end", "def with_indent ()\n thread[:indent] += 1\n yield\n ensure\n thread[:indent] -= 1\n end", "def indent(code, level = 2)\n lines = case code\n when String then code.split(\"\\n\")\n when BlocklyInterpreter::Block then start_block_to_dsl(code).split(\"\\n\")\n when Array then deep_flatten(code).compact.flat_map { |code| code.split(\"\\n\") }\n else code\n end\n\n lines.map { |line| (\" \" * level) + line }.join(\"\\n\")\n end", "def parse_nested_array(array,tab = 0)\n n = 0\n array.each do |item|\n if(item.size > 0)\n puts \"#{\"\\t\" * tab}[#{n}] {\"\n if(item.class == Array)\n parse_nested_array(item,tab+1)\n else\n puts \"#{\"\\t\" * (tab+1)}#{item}\"\n end\n puts \"#{\"\\t\" * tab}}\"\n end\n n += 1\n end\nend", "def print_arr(arr, i, prefix, xd, rv)\n vals = xd[arr[i]]\n vals.each do |v|\n new_prefix = prefix.clone << v\n if i == arr.size - 1\n rv << new_prefix\n else\n print_arr(arr, i+1, new_prefix, xd, rv)\n end\n end\nend", "def indent=(indent)\n #This is a stub, used for indexing\n end", "def tidy(data)\n indent = 0\n data.split(/\\n/).map do |line|\n line.gsub!(/^\\s*/, '')\n next if line.empty?\n indent -= 1 if line =~ /^\\s*\\}\\s*$/\n line = (' ' * (indent * 2)) + line\n indent += 1 if line =~ /\\{\\s*$/\n line\n end.compact.join(\"\\n\") + \"\\n\"\n end", "def printarr\n\t\t@arr.each_with_index do |element, index|\n\t\t\tprint element.empty? ? \".\t\" : \"#{element}\t\"\n\t\t\tputs \"\" if (index == 2)||(index == 5)\n\t\tend\n\t\tputs \"\"\n\tend", "def change_indent plus\n super(plus)\n puts plus ? \"<li><ul class=\\\"pre\\\">\" : \"<li class =\\\"none\\\">LAST</li> </ul></li>\"\n end", "def indentify\n 'name'\n end", "def indentify\n 'name'\n end", "def indentify\n 'name'\n end", "def indentify\n 'name'\n end", "def indentify\n 'name'\n end", "def indent!(amount, indent_string = nil, indent_empty_lines = false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end", "def change_indent plus\n # nothing here\n end", "def puts_indent(level, text)\n print \" \"*level, text, \"\\n\"\nend", "def increment_indent\n\t\t\t@indent[-1] += 1\n\t\tend", "def initialize(opts = {})\n # The number of times to reduce the left indent of a nested array's\n # opening bracket\n @left_bracket_offset = 0\n\n # True if printing a nested array\n @need_offset = false\n\n valid_indent = (2..12).step(2).include?(opts[:indent])\n valid_space_before = (1..8).include?(opts[:space_before])\n valid_space_after = (1..8).include?(opts[:space])\n # don't test for the more explicit :integer? method because it's defined\n # for floating point numbers also\n valid_depth = opts[:max_nesting] >= 0 \\\n if opts[:max_nesting].respond_to?(:times)\n valid_newline = ->(str) { str.respond_to?(:strip) && str.strip.empty? }\n @format = {\n indent: \"\\s\" * (valid_indent ? opts[:indent] : 2),\n space_before: \"\\s\" * (valid_space_before ? opts[:space_before] : 0),\n space: \"\\s\" * (valid_space_after ? opts[:space] : 1),\n object_nl: (valid_newline.call(opts[:object_nl]) ? opts[:object_nl] : \"\\n\"),\n array_nl: (valid_newline.call(opts[:array_nl]) ? opts[:array_nl] : \"\\n\"),\n max_nesting: valid_depth ? opts[:max_nesting] : 100,\n escape_slash: opts[:escape_slash] || false,\n ascii_only: opts[:ascii_only] || false,\n allow_nan: opts[:allow_nan] || false,\n sorted: opts[:sort] || false\n }\n end", "def indent_content(content)\n content = content.split(\"\\n\").map do |line|\n line.blank? ? line : ' ' + line\n end\n\n content.join(\"\\n\") << \"\\n\"\n end", "def print_stack\n self.arr[0...self.curr].join(' ')\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 indent!(amount, indent_string=nil, indent_empty_lines=false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end", "def outdent(n)\n indent(-n)\n end", "def outdent(n)\n indent(-n)\n end", "def indent!(num)\n replace( ' ' * num + self.gsub(\"\\n\", \"\\n\"+' '*num))\n self\n end", "def inspect\n return if @arr.empty?\n w = @arr.compact.collect { |row| row.size }.max\n result = \"\\n \" \n w.times do |y|\n result += '%3d'%y\n end\n result += \"\\n\"\n @arr.each_index do |x|\n result += '%3d:'%x\n if @arr[x]\n @arr[x].each do |val|\n result += val.nil? ? ' ' : '%3d'%val\n end\n end\n result += \"\\n\"\n end\n result\n end", "def indent\n return unless blank?\n write(' ' * @indentation)\n self\n end", "def indent_template(template, index)\n striped_template(template).map do |slice|\n slice.prepend(' ' * index)\n end.join(\"\\n\") + \"\\n\"\n end", "def add_line_breaks(arr)\n arr.each do |element|\n element[-1] += \"\\n\"\n end\nend", "def indentify\n 'description'\n end", "def indentify\n 'description'\n end", "def indent(left, right = 0, &block)\n bounds.indent(left, right, &block)\n end", "def optimize_indentation(value, amount = 0) # :doc:\n return \"#{value}\\n\" unless value.is_a?(String)\n\n if value.lines.size > 1\n value.strip_heredoc.indent(amount)\n else\n \"#{value.strip.indent(amount)}\\n\"\n end\n end", "def indent(modifier = 0)\n \" \" * (@options.fetch(:log_depth, log_depth) * 2 + modifier)\n end", "def insert_indentation(line, indentation)\n line ? \" \" * indentation + line.to_s : \"\"\n end", "def optimize_indentation(value, amount = 0)\n return \"#{value}\\n\" unless value.is_a?(String)\n \"#{value.strip_heredoc.indent(amount).chomp}\\n\"\n end", "def optimize_indentation(value, amount = 0)\n return \"#{value}\\n\" unless value.is_a?(String)\n \"#{value.strip_heredoc.indent(amount).chomp}\\n\"\n end", "def indentation(parents, last, symbols)\n i = parents.map do |parent_last|\n if !parent_last\n SYMBOLS[symbols][:has_parent]\n else\n SYMBOLS[symbols][:no_parent]\n end\n end\n\n if last\n i.join(\"\") + SYMBOLS[symbols][:last_item]\n else\n i.join(\"\") + SYMBOLS[symbols][:item]\n end\n end", "def adj_indent(adjust = 1)\n old, self.indent_depth = indent_depth, (indent_depth+adjust)\n self.indent_str =\n (indenting == true) ? (TAB * indent_depth) : EMPTY\n old\n end", "def prettyOutput(array)\n if array.length > 1\n array[0..-2].join(\"\") + \" & \" + array[-1]\n elsif array.length == 1\n array[0]\n else\n \"\"\n end\n end", "def to_a list = @list\n lines = []\n return lines if list.length < 2\n if list[0].is_a? Array\n left = to_a(list[0]).flatten\n right = to_a(list[1]).flatten\n indent = (left + right).collect { |i| i.length }.max\n all = left[0..(left.length / 2)]\n left[(left.length / 2 + 1)..-1].each do |i|\n all << ((i + (\" \"*indent))[0..(indent-1)] + \"|\")\n end\n all << (\" \"*indent) + \"|---\"\n right[0..(right.length / 2 - 1)].each do |i|\n all << ((i + (\" \"*indent))[0..(indent-1)] + \"|\")\n end\n all << right[(right.length / 2)..-1]\n else\n return [list[0].to_s, \"---\", \" |---\", \"---\", list[1].to_s]\n end\n end", "def indent( text, spaces=4 )\n\t\tprefix = ' ' * spaces\n\t\treturn text.gsub( /(?<=\\A|\\n)/m, prefix )\n\tend", "def recursive_iterate( arr, indent=0 )\n\n # remove the first element from the array and print it\n # - if there are any elements left in the array\n # call ourselves again with the shorter array\n\n # first = arr.shift # mutates the arg (a)\n\n # first = arr.first\n # rest = arr[1..-1]\n\n first, *rest = arr # JS: const [first, ...rest] = arr;\n\n spaces = \" \" * indent\n\n puts \"#{ spaces } recursive_iterate( #{ arr.to_s })\"\n puts \"#{ spaces } first: #{ first }\"\n puts \"#{ spaces } rest: #{ rest.to_s }\"\n # puts first\n\n if rest.any?\n recursive_iterate( rest, indent+1 )\n end\n\n puts \"#{ spaces } --- returning from recursive_iterate( #{ arr.to_s} ), first: #{ first }\"\n\nend", "def element_linenumbers(elements); end", "def indent(str, depth=2)\n space = \" \"*depth\n str.split(\"\\n\").join(\"\\n#{space}\").gsub(/^ *$/, \"\")\n end", "def write_array(key)\n write_comma\n increment\n indent\n write_key(key)\n write_colon\n end", "def add_line_breaks(arr)\n arr.map {|element| element[0..-1] + [\"\\n\"]}\nend", "def arraySimplePrint(a)\nputs \"Iterate over an array using 'each'.\"\n# I need somethin that counts the current array index\n# Well, thats more than just 'each'. Perhaps there is a better solution for this\ni=1\na.each do |value| \n print value\n # Use mod to create a new line\n if i%4==0\n print \"\\n\" \n else\n # To make it look prettier\n print \",\"\t\t\n end\n i+=1\nend\nend", "def haml_indent\n ' ' * haml_buffer.tabulation\n end", "def _Indent\n _tmp = scan(/\\G(?-mix:\\t| )/)\n set_failed_rule :_Indent unless _tmp\n return _tmp\n end", "def pretty_print(arr)\n arr.each do |row|\n rowstr = \"\"\n if row == nil\n puts\n next\n end\n row.each do |cell|\n if cell == nil\n rowstr << \" \"\n else\n rowstr << (\"%3d\" % cell)\n end\n end\n puts rowstr\n end\nend", "def indent(amount, indent_string=nil, indent_empty_lines=false)\n dup.tap {|_| _.indent!(amount, indent_string, indent_empty_lines)}\n end", "def indent(n)\n indent = \" \" * n\n gsub '\\n', \"\\n#{indent}\"\n end", "def indent(prefix=\" \")\n prefix = (\" \" * prefix) if prefix.is_an? Integer\n\n if block_given?\n lines.each { |line| yield prefix + line }\n else\n lines.map { |line| prefix + line }.join('')\n end\n end", "def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end", "def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end", "def nice_list(arr)\n\tarr.each { |i| puts \"* \" + i.to_s }\nend", "def print_array(a, word_length)\r\n a.each{|x|\r\n x.each{|y| print y.to_s.rjust(word_length)}\r\n puts \r\n }\r\n puts\r\nend", "def print_array(arr)\n print(\"Rotated array is: \" + arr.join(\", \") + \"\\n\")\n return\nend", "def print_2d_array(a)\r\n\r\n max_word_length = 0 # keeps track of the longest string in layout\r\n flattened = a.flatten\r\n flattened.each{|x| if x.length > max_word_length\r\n max_word_length = x.length \r\n end}\r\n max_word_length += 1 # we want a space in front when printing\r\n \r\n # insert a row of numbers into layout for printing\r\n max_no_columns = 0\r\n a.each{|x| if x.length > max_no_columns\r\n max_no_columns = x.length\r\n end}\r\n counter_array = [*0...max_no_columns] # [0, 1, 2, 3....max_no_columns]\r\n \r\n # clone, insert numbers into array, then print\r\n temp = Marshal.load(Marshal.dump(a))\r\n temp.unshift(counter_array) # insert in front\r\n print_array(temp, max_word_length) \r\nend", "def indent(str, amount=2)\n i = (\" \"*amount)\n (i + str.gsub(/\\n/, \"\\n#{i}\")).rstrip\n end", "def unexpected_indent_offset; end", "def indent(n)\n if n >= 0\n gsub(/^/, ' ' * n)\n else\n gsub(/^ {0,#{-n}}/, \"\")\n end\n end", "def recursive_print(array)\n\nend", "def indent(amount, indent_string = nil, indent_empty_lines = false)\n dup.tap { |_| _.indent!(amount, indent_string, indent_empty_lines) }\n end", "def indentize!(count, char = ' ')\n tap do |s|\n s.gsub!(/([^\\n]*)(\\n|$)/) do\n s1 = Regexp.last_match(1)\n s2 = Regexp.last_match(2)\n not_empty = s1 != '' || s2 != ''\n \"#{char * count}#{s1}#{s2}\" if not_empty\n end\n end\n end", "def format_line(arr)\n x = TTY::Screen.width - 2\n small_items = 12\n first_item = x - 5 * small_items\n\n output = \"\"\n arr.each_with_index do |l, i|\n if i == 0\n output << l.to_s[0..first_item].ljust(first_item)\n else\n output << l.to_s[0..small_items].ljust(small_items)\n end\n end\n output\n end", "def heredoc_indent_type(node); end", "def pretty_print(q = nil) #:nodoc:\n dim = @orientation == :row ? 1 : 0\n\n arr = (0...shape[dim]).inject(Array.new){ |a, i| a << self[i] }\n\n if q.nil?\n puts \"[\" + arr.join(\"\\n\") + \"]\"\n else\n q.group(1, \"\", \"\\n\") do\n q.seplist(arr, lambda { q.text \" \" }, :each) { |v| q.text v.to_s }\n end\n end\n end", "def indent(label=nil)\n iputs label if label\n old_indent = @indent_string\n @indent_string+=\" \"\n yield\n @indent_string = old_indent\n end", "def group_by_depth(arr)\n output = []\n\n nested = false\n arr.each do |x|\n\n if output.last\n\n last_line = output.last[-1]\n\n if line_depth(last_line) == line_depth(x)\n\n if x =~ /Features:/ && last_line =~ /Page: \\d/\n nested = true\n end\n\n if nested\n output.last << x\n else\n output << [x]\n end\n\n elsif line_depth(last_line) > line_depth(x)\n # we are outdenting\n nested = false\n output << [x]\n\n elsif line_depth(last_line) < line_depth(x)\n # we are indenting further\n nested = true\n output.last << x\n end\n else\n output << [x]\n end\n end\n\n output\n end", "def indent(str, spaces)\n str.split(\"\\n\").map { |s| (' ' * spaces) + s }.join(\"\\n\")\n end" ]
[ "0.75906587", "0.73141754", "0.73141754", "0.73141754", "0.73141754", "0.73141754", "0.7088003", "0.70174116", "0.68575186", "0.6846909", "0.65792507", "0.65792507", "0.6575111", "0.6570298", "0.65055305", "0.6497884", "0.6476519", "0.63873273", "0.63038856", "0.63005126", "0.62714434", "0.62617224", "0.6257396", "0.6203807", "0.60769874", "0.60555786", "0.60353345", "0.59808624", "0.595039", "0.5949881", "0.5944793", "0.5936242", "0.5929255", "0.5897859", "0.5896949", "0.5891909", "0.58632827", "0.58632827", "0.58632827", "0.58632827", "0.58632827", "0.5851611", "0.58330065", "0.58326715", "0.5822593", "0.57969314", "0.57946366", "0.57872456", "0.57861006", "0.5780037", "0.5776199", "0.5776199", "0.5763507", "0.5737808", "0.573758", "0.5729424", "0.57288164", "0.5717182", "0.5717182", "0.571209", "0.5706042", "0.5691705", "0.56885105", "0.56736135", "0.56736135", "0.56621253", "0.5660917", "0.5660156", "0.5648248", "0.56470424", "0.56319386", "0.5631065", "0.56281424", "0.5624879", "0.56161964", "0.5611544", "0.5611424", "0.5609113", "0.5595537", "0.5589198", "0.5586242", "0.5582992", "0.5578302", "0.55777204", "0.5561388", "0.5557202", "0.55569464", "0.5547534", "0.55438745", "0.554194", "0.5537628", "0.5532943", "0.552961", "0.5509226", "0.5501373", "0.549771", "0.5495467", "0.5484993", "0.54746294", "0.5471953" ]
0.793145
0
A method for building block level tag string array with class attribute
def tag_block tagname, children, **attr_map ch = a_indent(children) attr_str = mk_attr_str(attr_map) ["<#{tagname}#{attr_str}>", ch, "</div>"].flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_class_list\n tags = self.tags.collect{|tag| tag.slug}\n tags.join(\" \")\n end", "def attribute *array\n return self if guard *array\n r = self.clone\n a = array.flatten\n n_full_pairs, n_unpaired = a.length.divmod 2\n (1..n_full_pairs + n_unpaired).each do |i|\n r << '[' + a.shift\n r << '=' + a.shift unless i > n_full_pairs\n r << ']'\n end\n CssString.new r\n end", "def init_tags\n @attr_tags = [\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:BOLD), l(\"\\\\textbf{\"), l(\"}\")),\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:TT), l(\"\\\\texttt{\"), l(\"}\")),\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:EM), l(\"\\\\emph{\"), l(\"}\")),\n ]\n end", "def init_tags\n @attr_tags = [\n InlineTag.new(SM::Attribute.bitmap_for(:BOLD), \"<b>\", \"</b>\"),\n InlineTag.new(SM::Attribute.bitmap_for(:TT), \"<tt>\", \"</tt>\"),\n InlineTag.new(SM::Attribute.bitmap_for(:EM), \"<em>\", \"</em>\"),\n ]\n end", "def init_tags\n @attr_tags = [\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:BOLD), \"<b>\", \"</b>\"),\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:TT), \"<tt>\", \"</tt>\"),\n InlineTag.new(RDoc::Markup::Attribute.bitmap_for(:EM), \"<em>\", \"</em>\"),\n ]\n end", "def arrayize_html_class_key(value)\n case value\n when Hash\n arrayize_html_class_key(value[:class])\n when Array\n value.compact.map(&:to_s)\n when String\n value.split(' ')\n when Symbol\n [value.to_s]\n else\n []\n end\n end", "def get_tag(tag_class); end", "def get_tags\n [['pxb', 'PXB'], ['ind', 'Individuals'], ['bus', 'Businesses'], ['grp', 'Peer Groups']]\n end", "def classes(subnet)\n out = []\n subnet['classes'].each do |clas|\n out << %[ class \"#{clas['class']}\" {]\n out << raw_options(clas['raw_options'], 4)\n out << \" }\"\n out << ''\n end if subnet['classes']\n out << ''\n end", "def to_s\n \"#<#{classname}>\"\n end", "def body_class\n ssv = []\n ssv << 'home' if is_home?\n ssv << 'page' if is_page?\n ssv << 'entry' if is_entry?\n ssv << 'categories' if is_categories?\n ssv << 'tags' if is_tags?\n ssv.join(' ')\n end", "def comp_class\n @xml += '<class> '\n while @i < @tokens.length\n case @tokens[@i].val\n when 'static', 'field'\n comp_class_var_dec\n next\n when 'constructor', 'function', 'method'\n comp_subroutine\n next\n else\n comp_line\n end\n end\n @xml += '</class> '\n @xml\n end", "def css_class *a; CssString.new a.flatten.unshift(self).join '.' end", "def make_class(klass)\n %Q{\n <td class=\"class_item\" colspan=\"#{klass.intervals}\">\n <p>#{klass.name} - #{klass.location}</p>\n <p>#{klass.type}</p>\n </td>}\n end", "def _gestalt_build_tag(name, attr = {}, text = [])\n @out << \"<#{name}\"\n @out << attr.map{|(k,v)| %[ #{k}=\"#{_gestalt_escape_entities(v)}\"] }.join\n if text != [] or block_given?\n @out << \">\"\n @out << _gestalt_escape_entities([text].join)\n if block_given?\n text = yield\n @out << text.to_str if text != @out and text.respond_to?(:to_str)\n end\n @out << \"</#{name}>\"\n else\n @out << ' />'\n end\n end", "def to_tags\n arr = split_tags.map(&:add_at)\n if block_given?\n yield arr\n else\n arr\n end\n end", "def tag_list; []; end", "def build(node)\n\n # add <node.name to write_array\n @write_array << \"<#{node.name}\"\n\n # if node has classes, append them to last element of write array\n unless node.classes == nil\n @write_array[-1] = @write_array[-1] + \" classes=\\\"#{node.classes.join(\" \")}\\\"\"\n end\n\n # if node has id's, append them to last element of write array. else append closing bracket\n if node.id == nil\n @write_array[-1] = @write_array[-1] + \">\\n\"\n else\n @write_array[-1] = @write_array[-1] + \" id=\\\"#{node.id}\\\">\\n\"\n end\n\n # add tag text to array if available\n unless node.text == \"\"\n @write_array << node.text + \"\\n\"\n end\n\n # build children\n unless node.children == []\n node.children.each do |child|\n build(child)\n end\n else\n @write_array << \"</#{node.name}>\\n\"\n return\n end\n\n # add closing tag e.g. </html>\n @write_array << \"</#{node.name}>\\n\"\n\n end", "def class_instance_blocks\n @class_instance_blocks ||= []\n end", "def tag tag, text, classes = nil\n \"<#{tag} #{classes.nil? ? '': \"class='#{classes}'\"}'>#{text}</#{tag}>\"\nend", "def tagstring\n\tself.taglist.join ', '\n end", "def inspect\n if empty?\n class_name + \"[]\"\n else\n class_name + \"[\" + head.inspect +\n tail.foldl(\"\") {|x, y| x + \", \" + y.inspect } + \"]\"\n end\n end", "def yaml_tag_class_name\n self.name\n end", "def to_s; \"<Block #{length}>\"; end", "def hash_tags\n tags = \"\"\n object.data_types.each do |d|\n name = d.name\n tags = tags + h.content_tag( :span, '#' + name, class: 'scenario-tag data-type')\n end\n object.visualization_types.each do |d|\n name = d.name\n tags = tags + h.content_tag( :span, '#' + name, class: 'scenario-tag vis-type')\n end\n object.visualization_tasks.each do |d|\n name = d.name\n tags = tags + h.content_tag( :span, '#' + name, class: 'scenario-tag task')\n end\n return tags.html_safe\n end", "def class_attributes; end", "def tags() []; end", "def make_classy( line, file_identifier )\n\t\t# TODO: should add file name to end of class\n\t\tStayClassy::Builder::DEFAULT_CLASS_TAGS.each do |tag|\n\t\t\tif line.include?( \"<#{ tag }\" ) && !line.include?( \"class=\" )\n\t\t\t\tline = line.gsub( \"<#{ tag }\", \"<#{ tag } class=\\\"#{ @prefix }#{ tag }_#{ file_identifier }\\\"\" )\n\t\t\tend\n\t\tend\n\t\treturn line\n\tend", "def html_options\n { :class => attribute }\n end", "def tags=(_arg0); end", "def to_s\n each_with_object([]) do |(name, value), array|\n if value.is_a?(Component::Attr)\n # Flatten nested hashs and inject them unless empty\n value = value.to_s\n array << value unless value.empty?\n else\n name = [@prefix, name].compact.join(\"-\").gsub(/[\\W_]+/, \"-\")\n array << %(#{name}=\"#{value}\") unless value.nil?\n end\n end.sort.join(\" \")\n end", "def generate_class_tree_level(parent='')\n $all.map { |klass|\n if parent == klass['parentname']\n [\n klass['name'],\n \"classes/#{klass['fullname']}.html\", # klass.path, \n '',\n generate_class_tree_level(klass['fullname'])\n ]\n else\n nil\n end\n }.compact\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 to_tag\n self.class.to_s\n end", "def pack_template\n if self.to_s =~ /^.*<(.*):0x.*/\n clsname = $1\n else\n clsname = self.to_s\n end\n \n Util.pack_template_from( @struct_internal_format, clsname )\n end", "def classes=(ary)\n `for(var result=[],i=0,l=ary.length;i<l;++i){result.push(ary[i].__value__);}`\n `this.__native__.className=result.join(' ')`\n return ary\n end", "def tag_attributes_string\n tag_attributes.map{|k, v| \"#{k}=\\\"#{v}\\\"\"}.join(' ')\n end", "def begintag(name, attributes=[])\r\n\tattribs = \"\"\r\n\tif (!attributes.empty)\r\n\t\tattributes.each do |(key,value)| \r\n\t\t\tattribs = \" #{key.strip}=\\\"#{value.strip}\\\"\"\r\n\t\tend\r\n\tend\r\n\treturn \"<\" + name.strip + \" \" + attribs + \">\"\r\nend", "def tags_string\n tags.map(&:name).join(\" \")\n end", "def append_class(name); end", "def append_class(name); end", "def tags(class_name)\n eles_by_json(typeArray: [class_name], onlyVisible: true)\n end", "def reparse_code(array_structured_lines)\n result = Array.new\n array_structured_lines.each do |structured_line|\n if not structured_line.mapped_line.nil?\n if structured_line.mapped_line.type == \"Class\"\n string_code = create_code(structured_line,0)\n result.push string_code\n end\n end\n end\n return result.join(\"\\n\")\n end", "def tags(class_name)\n find_elements :class, class_name\n end", "def build_tags(method, options)\n options[:class] ||= \"\"\n options[:label] ||= method.to_s.humanize\n options[:label] << \" *\" if options[:required]\n content = setup_label_for(method, options[:label]) \n content = add_hint_to(options[:hint],content)\n return content\n end", "def get_instructions(source)\n elements = get_elements(source)\n text = \"\"\n instructions = Array.new\n elements.each do |child|\n if child[:tag]!=\"text\"\n text << \"Add the tag \" + child[:tag]\n text << \" in \" + child[:parent] if !child[:parent].nil?\n text << \" with an attribute '\" + child[:attribute] + \"' \" if !child[:attribute].nil?\n text << \" with value '\" + child[:value] + \"' \" if !child[:value].nil?\n else\n text << \" In \" + child[:parent]+ \" add the text '\" + child[:content] + \"' \" if !child[:content].nil?\n end\n instructions.push(text)\n text = \"\"\n end\n instructions\n end", "def build_item_class(i, options, active_ids)\n\n item_class = []\n\n item_class << options[:item_class]\n item_class << i.css_class\n\n if i.has_children?\n item_class << options[:item_with_children_class]\n else\n item_class << options[:item_without_children_class]\n end\n\n item_class << options[:active_class] if i.slug == params[:menu_id] || i.slug == request.original_fullpath.match(/(\\D+\\/{1}|\\D+)/)[0].gsub('/', '') || active_ids.include?(i.id)\n item_class.compact.join(\" \")\n end", "def initialize tag_str, obj, namespace=nil\n Tag.clear_tag obj\n @vtag = tag_str.derive_tag\n obj.namespace = namespace\n @@classes_with_tags[[namespace, @vtag.revert_tag]] = obj # The specific class and the specific tag are the key to looking up the obj \n end", "def container_attributes\r\n\t\t\t{ class: 'grapple' }\r\n\t\tend", "def cms_blocks_attributes\n self.cms_blocks.inject([]) do |arr, block|\n block_attr = {}\n block_attr[:label] = block.label\n block_attr[:content] = block.content\n block_attr[:id] = block.id\n arr << block_attr\n end\n end", "def initialize(tag_name, markup, tokens)\n self.array_attributes ||= []\n @attributes = Hash.new\n\n markup.scan(E9::Liquid::TagAttributes) do |key, value|\n parsed = value.split('|').delete_if(&:blank?).map(&:strip)\n\n unless parsed.blank? \n k = key.underscore.to_sym\n @attributes[k] = self.array_attributes.include?(k) ? parsed : parsed.first\n end\n end\n\n super\n end", "def inspect\n attributes = [\"seqid=\\\"#{@seqid}\\\"\", \"source=\\\"#{@source}\\\"\", \"type=\\\"#{@type}\\\"\", \"strand=\\\"#{@strand}\\\"\"]\n attributes += @attributes.map { |(attribute, value)| \"#{attribute}=\\\"#{value}\\\"\" }\n \n \"#<#{self.class} #{attributes.join(', ')}>\"\n end", "def format_as_block_html(name, attr, body, indent); end", "def tag_list\n\t\t# for an instance of Article, do this\n\t\t# invoke the given block once for each element of `self`\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \")\n\n\t\t# tags.join(\", \")\n\t\t# the `join` method converts each element in the array to a string, \n\t\t# separated by the given `separator`. But it calls the `to_s` method on our object `tags`\n\tend", "def class_name_parameters(class_def)\n\n\n\n # 32:7: '<' ( class_special_identifier[class_def] )* '>'\n match(:LEFT_ANGULAR_BRACKET)\n class_def.name += '<'\n # 33:7: ( class_special_identifier[class_def] )*\n while true\n alt5 = 2\n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_0 = look_ahead(1)\n if look_ahead5_0 == :RIGHT_ANGULAR_BRACKET \n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_1 = look_ahead(2)\n if look_ahead5_1 == :EXTENDS \n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_3 = look_ahead(3)\n if look_ahead5_3 == :IDENTIFIER \n # ()* loopback of 33:7: ( class_special_identifier[class_def] )*\n look_ahead5_5 = look_ahead(4)\n if (TOKENS[look_ahead5_5] >= 5 && TOKENS[look_ahead5_5] <= 6) || (TOKENS[look_ahead5_5] >= 25 && TOKENS[look_ahead5_5] <= 28) \n alt5 = 1\n end\n elsif look_ahead5_3 == :EXTENDS || (TOKENS[look_ahead5_3] >= 25 && TOKENS[look_ahead5_3] <= 28) \n alt5 = 1\n end\n elsif look_ahead5_1 == :IDENTIFIER || (TOKENS[look_ahead5_1] >= 25 && TOKENS[look_ahead5_1] <= 28) \n alt5 = 1\n end\n elsif (TOKENS[look_ahead5_0] >= 5 && TOKENS[look_ahead5_0] <= 6) || look_ahead5_0 == :LEFT_ANGULAR_BRACKET || (TOKENS[look_ahead5_0] >= 27 && TOKENS[look_ahead5_0] <= 28) \n alt5 = 1\n end\n case alt5\n when 1\n # 33:9: class_special_identifier[class_def]\n class_special_identifier(class_def)\n\n else\n break\n end\n end\n match(:RIGHT_ANGULAR_BRACKET)\n class_def.name += '>'\n\n\n\n end", "def model_tree(array, base_class = nil)\n return EMPTY_STRING if array.blank?\n\n options = { html_options: { class: 'dropdown-item' } }\n content_tag :ul, class: 'dropdown-menu', 'aria-labelledby': base_class do\n array.sort_by(&:name).each do |node|\n content = index_link(node.klass, options).try :<<, model_tree(node.children)\n concat content_tag(:li, content)\n end\n end\n end", "def tag_classes(tag)\n classes = [dom_id(tag)]\n \n classes << \"public\" if tag.public?\n \n if current_user.globally_excluded?(tag)\n classes << \"globally_excluded\"\n elsif current_user.subscribed?(tag)\n classes << \"subscribed\"\n elsif (current_user.id == tag.user_id) && tag.public\n classes << \"published\"\n end\n classes.join(\" \")\n end", "def tags_raw\n self.tags.join(\"\\n\") unless self.tags.nil?\n end", "def tags(name = T.unsafe(nil)); end", "def class_name(level)\n return \"lv#{level}\"\nend", "def to_string(pre=\"\")\n opts = get_modified_options\n returning Array.new do |output|\n unless cancelled?\n output << @prestring || \"\"\n \n if resources && !resources.empty?\n @cp = classpackage_with_self(self)\n output << @cp.to_string\n output << \"include #{@cp.name.sanitize}\"\n end\n \n unless virtual_resource?\n output << \"#{pre}#{class_type_name.downcase} {\"\n output << \"#{pre}\\\"#{self.key}\\\":\"\n output << opts.flush_out(\"#{pre*2}\").join(\",\\n\")\n output << \"#{pre}}\" \n end\n \n output << @poststring || \"\"\n end\n end.join(\"\\n\")\n end", "def append_class(block_name, appended_classes='')\n current_page_classes = current_page.data[block_name] || ''\n existing_classes_a = current_page_classes.split(' ')\n appended_classes_a = appended_classes.split(' ')\n classes = existing_classes_a.concat(appended_classes_a).reverse.join(' ')\n content_for(block_name, classes)\n end", "def supported_tags\n [\n # attributes\n\n # simple tags\n :attack_class, :attack_score, :attack_type, :attack_value, :capec,\n :cwe_id, :description, :dissa_asc, :normalized_url, :oval, :owasp2007,\n :owasp2010, :owasp2013, :recommendation, :vuln_method, :vuln_param,\n :vuln_type, :vuln_url, :web_site\n # nested tags\n ]\nend", "def create_array_tc(length, element_type)\n return CORBA::TypeCode::Array.new(element_type, length)\n end", "def add_class class_name\n each do |el|\n next unless el.respond_to? :get_attribute\n classes = el.get_attribute('class').to_s.split(\" \")\n el.set_attribute('class', classes.push(class_name).uniq.join(\" \"))\n end\n self\n end", "def element_init\n extend TagMaker\n methods = \"\"\n # - -\n for element in %w[ A TT I B U STRIKE BIG SMALL SUB SUP EM STRONG\n DFN CODE SAMP KBD VAR CITE FONT ADDRESS DIV center MAP\n APPLET PRE XMP LISTING DL OL UL DIR MENU SELECT table TITLE\n STYLE SCRIPT H1 H2 H3 H4 H5 H6 TEXTAREA FORM BLOCKQUOTE\n CAPTION ]\n methods += <<-BEGIN + nn_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n\n # - O EMPTY\n for element in %w[ IMG BASE BASEFONT BR AREA LINK PARAM HR INPUT\n ISINDEX META ]\n methods += <<-BEGIN + nOE_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n\n # O O or - O\n for element in %w[ HTML HEAD BODY P PLAINTEXT DT DD LI OPTION tr\n th td ]\n methods += <<-BEGIN + nO_element_def(element) + <<-END\n def #{element.downcase}(attributes = {})\n BEGIN\n end\n END\n end\n eval(methods)\n end", "def genFileContent(cls, bld)\r\n bld.startClass(\"class \" + getClassName(cls))\r\n\r\n bld.separate\r\n # Generate code for class variables\r\n eachVar(uevParams().wCls(cls).wBld(bld).wSeparate(true).wVarCb(lambda { |var| }))\r\n\r\n bld.separate\r\n # Generate code for functions\r\n render_functions(cls, bld)\r\n\r\n bld.endClass\r\n end", "def formatClass(theLines)\n\n\treplaceVoids(\t\ttheLines);\n\tspaceMethods(\t\ttheLines);\n\tindentMembers(\t\ttheLines);\n\talignParams(\t\ttheLines);\n\talignSpecifiers(\ttheLines);\n\nend", "def add_class(class_name)\n @fragment.children.each do |c|\n c['class'] = ((c['class']||'').split(' ') + [class_name]).join(' ')\n end\n end", "def tag_list\n\t\tself.tags.collect do |tag|\n\t\t\ttag.name\n\t\tend.join(\", \") #When we joined the array Ruby called the default #to_s method on every one of these Tag instances \n\tend", "def get_classes\n (attr['class'] || '').downcase.split(' ').sort\n end", "def class_decls; end", "def band_tags\n @band_tags ||= [\"inverted\", \"unfinished\", \"beginning only\", \"ending only\", \"middle only\", \"perfume\", \"tractor-beam\", \"techno\", \"dub\", \"drum & bass\"].collect{|de| Tag.find_or_create_by_name(de)}\n end", "def add_class c\n each do |q|\n str = q.get_attribute(\"class\")\n\n if str.empty?\n str = c.to_s\n else\n str = str+\" #{c}\"\n end\n \n q.set_attribute(\"class\",str)\n end\n end", "def attr_tag(text); 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 add_class(current_attributes, new_attributes)\n current_attributes ||= ''\n current_attributes.split(' ').push(new_attributes).join(' ')\n end", "def format_tag(tag, attributes, body)\n if body.size > 0\n [\"<#{tag}#{format_attributes(attributes)}>\", body, \"</#{tag}>\"]\n else\n [\"<#{tag}#{format_attributes(attributes)} />\"]\n end.join('')\n end", "def html_classes; end", "def add_class(class_name)\n @fragment.each_element do |c|\n c.attributes['class'] = ((c.attributes['class']||'').split(' ') + [class_name]).join(' ')\n end\n end", "def tag_names\n self.tags.map(&:name).join(\", \")\n #The & symbol is used to tell Ruby that the following argument\n #should be given as a block to the method. So the line:\n #self.tags.map(&.:name).join(\", \") is equal to\n #self.tags.map { |t| t.name.join(\", \")}\n #So the above will iterate over tyhe collection of elf.tags\n #and build an array with the resukts of the name method\n #called on every item\n end", "def binder_string_value(type)\n\n\t\tret_array = Array.new\n\n\t\t(@binder.tag.node_tags|@binder.tag.parent_tags).each do |tag|\n\t\t\tret_array << tag[\"title\"] if tag[\"type\"]==type\n\t\tend\n\n\t\treturn ret_array.join(' ')\n\n\tend", "def tags_partial(tags)\n \"tags = [#{tags.map { |name, value| \"\\\"#{name}-#{value}\\\"\" }.join(', ')}]\"\n end", "def tag_list\n tags.map { |tag| tag.name.include?(\" \") ? '\"' +\"#{tag.name}\" + '\"' : tag.name }.join(\" \")\n end", "def prefix\n '[' + self.class.to_s + '] '\n end", "def eval_string(klass, attrib)\n s = <<EOS\n class #{klass}\n def #{attrib}\n @#{attrib}\n end\n\n def #{attrib}=(value)\n @#{attrib} = value\n end\n end\nEOS\n return s\nend", "def tag_names #helper method\n # gets tag names in an array\n self.tags.map { |tag| tag.name }\n end", "def prettyify_array(gemspec_ruby, array_name); end", "def prepareAutokeyClass(charName, combos, specialMoves, finishingMoves)\n charName = clearCharacterName(charName) \n str = <<END\n class #{charName} extends MKTrilogyCharacter {\n ;;;;;; combos ;;;;;;;; #{combos}\n ;;;;;; special moves ;;;;;;; #{specialMoves}\n ;;;;;; finishing moves ;;;;; #{finishingMoves}\n }\nEND\n str\n end", "def tags_partial(tags)\n \"tags = [#{tags.map { |tag| \"\\\"#{tag}\\\"\" }.join(', ')}]\"\n end", "def genFileContent(cls, bld)\n bld.separate\n\n for inc in cls.includes\n bld.add(\"require '\" << inc.path << inc.name << \".\" << Utils.instance.getExtension(\"body\"))\n end\n\n bld.separate\n\n render_namespace_starts(cls, bld)\n\n inheritFrom = \"\"\n\n if cls.baseClasses.length > 0\n inheritFrom = \" < \" + Utils.instance.getClassTypeName(cls.baseClasses[0])\n end\n\n if cls.baseClasses.length > 1\n Log.error(\"Ruby doesn't support multiple inheritance\")\n end\n\n bld.startClass(\"class \" + getClassName(cls) + inheritFrom)\n\n accessors = Accessors.new\n # Do automatic static array size declairations at top of class\n process_var_accessors(accessors, cls, bld, cls.model.varGroup)\n\n add_accessors(\"attr_accessor\", accessors.both, bld)\n add_accessors(\"attr_attr_reader\", accessors.readers, bld)\n add_accessors(\"attr_attr_writer\", accessors.writers, bld)\n\n bld.separate\n\n # Do automatic static array size declairations at top of class\n process_var_group(cls, bld, cls.model.varGroup)\n\n bld.separate\n # Generate code for functions\n for fun in cls.functions\n process_function(cls, bld, fun)\n end\n\n bld.endClass\n render_namespace_ends(cls, bld)\n end", "def initialize_html_tags; end", "def new_blocks_attributes\n return [] if @new_blocks_attributes.empty?\n\n blocks_attributes = if @new_blocks_attributes.is_a?(Hash)\n @new_blocks_attributes.values\n else\n @new_blocks_attributes\n end\n\n if home_page? || footer?\n return blocks_attributes + include_srcset_block(blk_attrs: blocks_attributes)\n end\n\n convert_content_to_html(blocks_attributes)\n\n blocks_attributes\n end", "def attr_reader_tag(text); end", "def to_ruby\n res = []\n res.push global_code unless global_code.empty?\n res.push \"control #{id.inspect} do\"\n res.push \" title #{title.inspect}\" unless title.to_s.empty?\n res.push \" desc #{descriptions[:default].inspect}\" unless descriptions[:default].to_s.empty?\n res.push \" impact #{impact}\" unless impact.nil?\n tags.each do |t|\n res.push(\" #{t.to_ruby}\")\n end\n res.push control_code unless control_code.empty?\n res.push 'end'\n res.join(\"\\n\")\n end", "def child *a; CssString.new a.flatten.unshift(self).join ' > ' end", "def tag(name, content, attrs = {})\n # Convert every element of the hash to this --> \"href='example.com'\"\n # I need to do something for every element, I need a loop...\n # I can save all those string in an array...\n\n # If I want an array --> I will use map to iterate!\n attrs_arr = attrs.map do |key, value| \n \t\" #{key}='#{value}'\"\n end\n\n # I need a string --> I join the array\n attributes = attrs_arr.join\n\n # The last line is automatically returned\n \"<#{name}#{attributes}>#{content}</#{name}>\"\nend", "def new_block_el(*args); end", "def tag_list\n\t\tself.tags.map(&:name).join(\", \")\n\tend", "def bp_class class_param\n class_param.blank? ? '' : class_param.strip().html_safe\n end" ]
[ "0.6022381", "0.5720883", "0.5706275", "0.57003766", "0.56544256", "0.55647165", "0.5539287", "0.5517255", "0.54926705", "0.5465932", "0.5458295", "0.5454011", "0.5447236", "0.540648", "0.53982335", "0.5350301", "0.5341292", "0.53264374", "0.52685076", "0.523331", "0.5214022", "0.5209279", "0.5205106", "0.51949054", "0.5188062", "0.51584846", "0.5145301", "0.5138275", "0.5123829", "0.5122842", "0.5118409", "0.51167184", "0.5113661", "0.50890905", "0.5085093", "0.5083966", "0.5082518", "0.50759655", "0.50664616", "0.50603586", "0.50603586", "0.5050331", "0.50400937", "0.5035541", "0.50334233", "0.5025582", "0.5024309", "0.50148994", "0.50070816", "0.50065994", "0.50039726", "0.4996075", "0.49932978", "0.498779", "0.4978898", "0.49781474", "0.49713725", "0.4967987", "0.49492005", "0.49482453", "0.49460787", "0.4943087", "0.4942496", "0.4940921", "0.49313086", "0.49296603", "0.49290255", "0.4922622", "0.49157417", "0.49139813", "0.49095994", "0.48992547", "0.48925367", "0.48901197", "0.48866594", "0.4882738", "0.48807925", "0.4877103", "0.48752615", "0.48723117", "0.48720077", "0.4869771", "0.48689306", "0.48662958", "0.48659292", "0.48551872", "0.48540828", "0.48494735", "0.4848904", "0.4847472", "0.48453766", "0.48364845", "0.4830629", "0.48299643", "0.48299062", "0.48293966", "0.4825017", "0.4822679", "0.48220262", "0.48122102" ]
0.5765087
1
A method for building block level div string array
def div_block children, role tag_block('div', children, class: role) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_div_tags(number_of_tags)\n matched_div_tags = []\n generate_div_tags_from_prefix(number_of_tags, number_of_tags, \"\", matched_div_tags)\n matched_div_tags\nend", "def _block(color, text, size)\n\t\t\"#{_fmt(:white, '[')}#{_fmt(color, text, size)}#{_fmt(:white, ']')}\"\n\tend", "def blockinate(data)\n blocks = []\n i, j = 0, BLOCK_SIZE - 1\n n = (data.size / BLOCK_SIZE) + 1\n n.times do\n block = data[i..j]\n blocks << block\n i = j + 1\n j += BLOCK_SIZE\n end\n if blocks.last.size < BLOCK_SIZE\n n = BLOCK_SIZE - blocks.last.size\n n.times { blocks.last << ' ' }\n end\n @blocks = blocks\n end", "def blockinate(data)\n blocks = []\n i, j = 0, BLOCK_SIZE - 1\n n = (data.size / BLOCK_SIZE) + 1\n n.times do\n block = data[i..j]\n blocks << block\n i = j + 1\n j += BLOCK_SIZE\n end\n if blocks.last.size < BLOCK_SIZE\n n = BLOCK_SIZE - blocks.last.size\n n.times { blocks.last << ' ' }\n end\n @blocks = blocks\n end", "def to_s; \"<Block #{length}>\"; end", "def render(depth = 0, inblock = true)\n # Convert elements to strings\n @items.collect do |item|\n if item.is_a?(String)\n if inblock\n inblock = false\n ' '*depth + item\n else\n item\n end\n elsif item.nil?\n ''\n else\n item.render(depth,inblock)\n end\n end.join('')\n end", "def content\n @blocks.map {|b| b.render } * EOL\n end", "def split_blocks(array)\n array.inject( [ [] ] ) do |array_of_blocks, val|\n if val == -1\n array_of_blocks << [-1]\n array_of_blocks << [] \n else \n array_of_blocks[-1] << val\n end\n array_of_blocks\n end\nend", "def print\n grid_array = []\n @height.times do |r|\n grid_array << @grid[r * @width, @width].split('') * ' '\n end\n grid_array\n end", "def _HtmlBlockDiv\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_HtmlBlockOpenDiv)\n unless _tmp\n self.pos = _save\n break\n end\n while true\n\n _save2 = self.pos\n while true # choice\n _tmp = apply(:_HtmlBlockDiv)\n break if _tmp\n self.pos = _save2\n\n _save3 = self.pos\n while true # sequence\n _save4 = self.pos\n _tmp = apply(:_HtmlBlockCloseDiv)\n _tmp = _tmp ? nil : true\n self.pos = _save4\n unless _tmp\n self.pos = _save3\n break\n end\n _tmp = get_byte\n unless _tmp\n self.pos = _save3\n end\n break\n end # end sequence\n\n break if _tmp\n self.pos = _save2\n break\n end # end choice\n\n break unless _tmp\n end\n _tmp = true\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_HtmlBlockCloseDiv)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_HtmlBlockDiv unless _tmp\n return _tmp\n end", "def modified_sample_layout\n lyt = []\n make_modified_start_array(@group_size).each do |j|\n cols = Array.new(@columns) { |c| c }\n cols.each { |c| @group_size.times { |i| lyt << [i + j, c] } }\n end\n lyt\n end", "def tag_block tagname, children, **attr_map\n ch = a_indent(children)\n attr_str = mk_attr_str(attr_map)\n [\"<#{tagname}#{attr_str}>\", ch, \"</div>\"].flatten\n end", "def build_grouping_body\n arr = []\n data.each do |_,group| \n arr << render_group(group, options)\n end\n output << arr.join(\",\\n\")\n end", "def create_wrappers\n return if @elements_have_been_wrapped\n\n elements = fragment.children\n\n # The different groups of elements\n mapping = []\n\n # The current bucket of elements that is being\n # collected, will get reset whenever it runs into\n # an element that is a greater heading rank\n bucket = []\n\n current_level = Util.level(elements.first)\n\n elements.each_cons(2) do |element, next_element|\n bucket << element\n\n # We will have run into a greater header, so close up the bucket\n # and put it into the mapping\n if Util.is_header?(next_element) && Util.level(next_element) >= current_level\n mapping.push([current_level, bucket])\n bucket = []\n end\n\n if Util.is_header?(element)\n current_level = Util.level(element)\n end\n end\n\n # we never ended up reaching a header, so close up and move on\n if !mapping.include?(bucket)\n mapping.push([current_level, bucket])\n end\n\n base_fragment = Nokogiri::HTML.fragment(\"<div class='brief top level' />\")\n\n mapping.map! do |item|\n level, group = item\n group.reject! { |i| i.text == \"\\n\" }\n\n #puts \"Mapping! #{ level } group length: #{ group.length }\"\n\n if level == 0\n #puts \"== Condition A\"\n base_fragment = fragment = Nokogiri::HTML.fragment(\"<div class='brief top level'>#{ group.map(&:to_html).join('') }</div>\")\n elsif level <= lowest_level\n #puts \"== Condition B\"\n fragment = Nokogiri::HTML.fragment(\"<section>#{ group.map(&:to_html).join('') }</section>\")\n elsif level > lowest_level\n #puts \"== Condition C\"\n # should be able to look at the document section mappings and\n # apply custom css classes to these based on the name of the section\n fragment = Nokogiri::HTML.fragment(\"<article>#{ group.map(&:to_html).join('') }</article>\")\n end\n\n [level, [fragment]]\n end\n\n begin\n self.fragment = Brief::Document::Section::Builder.run(mapping, low: lowest_level, high: highest_level)\n rescue Brief::Document::Section::BuilderError\n ##puts \"== Error, returning default fragment: #{ $! }\"\n @fragment\n end\n end", "def build_pair_div value_pair, role_pair\n value_pair.zip(role_pair).map{|v,r|div_inline(v,r)}\n end", "def to_s\n temp_array = array.map(&:clone) # This is not optimal, but this is one of the most simple aproach.\n @current_tetrimino.block_points.each { |pt| temp_array[pt.y][pt.x] = Block.new(@current_tetrimino.color, pt) }\n (('*' * (@width + 2)) + \"\\n\") +\n temp_array.map { |y| '*' + y.map { |x| x.is_a?(Block) ? '█' : ' ' }.join + '*' }.join(\"\\n\") +\n (\"\\n\" + ('*' * (@width + 2)))\n end", "def initialize_content\n content = []\n num = 0\n (0..@size).each do\n num = 0 if (num != 0 && num % ((@size+1)/8) == 0)\n content << num.to_s(16)\n num+=1\n end\n content\n end", "def layout(layout_width)\n idx, str = 0, ''\n\n #layout_width = 4\n layout_length = object.length - (layout_remainder = object.length % layout_width)\n\n while idx < layout_length - 1 do\n generate_division(layout_width).each do | val |\n # [5, 5].each do | val |\n str += h.render partial: \"layouts/layout_#{val}\", locals: { posts: object.slice(idx, val)}\n idx += val\n end\n end\n\n if layout_remainder > 0\n str += h.render partial: \"layouts/layout_#{layout_remainder}\", locals: { posts: object.slice(idx, layout_remainder)}\n end\n\n str.html_safe\n end", "def get_block_cells block\n\t\tblock_cells = []\n\t\t(block / 3 * 3...block / 3 * 3 + 3).each do |r|\n\t\t\t(block % 3 * 3...block % 3 * 3 + 3).each do |c|\n\t\t\t\tblock_cells << r * 9 + c\n\t\t\tend\n\t\tend\n\treturn block_cells\n\n\tend", "def makeBlocks(days, startTimeString, endTimeString, info)\n\tblocks = []\n\tdays.split(\"\").each do |d|\n\t\tb = SCHBlock.new(d, startTimeString, endTimeString, info)\n\t\tblocks << b\n\tend\n\t(blocks)\nend", "def bob_left_span\n raw '<div class=\"row\">' \\\n ' <div class=\"large-8 medium-6 small-12 columns\">'\n end", "def div_elements(identifier)\n platform.divs_for(identifier.clone)\n end", "def represent\n # grid_array will be an array of strings that represent our grid in NxN format\n grid_array=[]\n @h.times{|r| grid_array<<@grid[r*@w,@w].split('')*' '}\n grid_array\n end", "def createTextOutput(tree, width, height, divisions)\n\tareaMap = [ ]\n\ttextOutput = [ ]\n\tfor x in 0..width \n\t\tareaMap[x] = [ ]\n\t\tfor y in 0..height \n\t\t\tareaMap[x][y] = '#'\n\t\tend\n\tend\n\tareaMap = tree.displayTree(areaMap)\n\tsaveTextOutput(1, areaMap, width, height, divisions)\nend", "def to_s\n [menu_start, \n self.map {|elem| elem_start << elem.to_s << elem_end}.join(\"\\n\"),\n menu_end].join(\"\\n\")\n end", "def parse_blocks(el, text = T.unsafe(nil)); end", "def generate_grouped_menu_content(nodes)\n i = 0\n res = []\n\n while i < nodes.length\n node = nodes[i]\n if node.is_a?(Group)\n res << node\n i += 1\n else\n inner = []\n j = i\n while node && !node.is_a?(Group)\n inner << node\n j += 1\n node = nodes[j]\n end\n\n res << Group.new(nil, inner)\n i = j\n end\n end\n\n @menu_content = res.map(&:menu_output).join\n end", "def topToBottomWraparound(grid, width, height)\n\n strings = topToBottom(grid, width, height)\n\n for string in strings do\n\n string << string\n\n end\n\n return strings\n\nend", "def render_block x,y,i,a=255\n boxsize = 30\n grid_x = (1280 - (@grid_w * boxsize)) / 2\n grid_y = (720 - ((@grid_h-2) * boxsize)) / 2\n @args.outputs.solids << [grid_x + (x*boxsize), (720-grid_y) - (y*boxsize),boxsize,boxsize,*@color_index[i],a]\n if i != 8\n @args.outputs.borders << [grid_x + (x*boxsize), (720-grid_y) - (y*boxsize),boxsize,boxsize,*@color_index[8],a]\n else\n @args.outputs.borders << [grid_x + (x*boxsize), (720-grid_y) - (y*boxsize),boxsize,boxsize,*@color_index[7],a]\n end\n end", "def build_spans on_range\n @spans = Array.new @size[1]\n\n @size[1].times do |y|\n spans = []\n left = (@size[1]-y-1)*@size[0]\n start = nil\n\n @size[0].times do |x|\n d = on_range.include?(@pixels[left+x])\n\n if !start && d\n start = x\n elsif start && !d\n spans << [start, x]\n start = nil\n end\n end\n\n spans << [start, @size[0]] if start\n @spans[y] = spans\n end\n end", "def build_pairs_div value_pairs, role_pair\n pairs = value_pairs.map{|pair|build_pair_div_wrap(pair, role_pair)}\n pairs_role = mk_pair_role(role_pair, true)\n div_block(pairs, pairs_role)\n end", "def render_boxes(array = [], options = {})\n boxes = \"\"\n\n template = {}\n\n if options[:template].class.to_s.eql?(\"Hash\")\n template = options[:template]\n end\n\n array.each do |individual_options|\n box_options = template\n box_options = template.merge(individual_options) unless individual_options.nil?\n r = render_box(box_options)\n\n unless individual_options[:link].blank?\n r = \"<a href='#{individual_options[:link]}' target='#{individual_options[:link_target]}' class='no_underline render_boxes'>#{r}</a>\"\n end\n\n boxes += r unless r.blank?\n end\n\n boxes_div = content_tag :div, boxes, :class => \"textboxes\", :style => options[:textboxes_style]\n\n clear_both_ = \"\"\n\n unless options[:noclear] === true\n clear_both_ = clear_both\n end\n\n boxes_div + clear_both_\n end", "def parse_block_html; end", "def render\n\t\tprint \"cl1 cl2 cl3 cl4 cl5 cl6 cl7 cl8 cl9 c10\\n\"\n\t\t(0..9).each do |row|\n\t\t\t(0..9).each do |col|\n\t\t\t\tif @grid[row][col].is_flagged\n\t\t\t\t\tprint \"FLG\"\n\t\t\t\telsif @grid[row][col].is_hidden\n\t\t\t\t\tprint \" \"\n\t\t\t\telsif @grid[row][col].surrounding_bombs > 0\n\t\t\t\t\tprint \" #{@grid[row][col].surrounding_bombs} \"\n\t\t\t\telsif @grid[row][col].has_bomb\n\t\t\t\t\tprint \"POW\"\t\t\t\t\t\n\t\t\t\telse print \"xxx\"\n\t\t\t\tend\n\t\t\t\tprint \"|\" unless col == 9\n\t\t\t\tprint \"row#{row + 1}\\n\" if col == 9\n\t\t\tend\n\t\tend\n\tend", "def content_blocks\n @content_blocks ||= Hash.new {|h,k| h[k] = [] }\n end", "def partlist(arr)\n len = arr.length\n i = 0\n masterArr = []\n while i < len - 1 do\n masterArr << [arr[0..i].join(\" \")] + [arr[i+1..len].join(\" \")]\n i += 1\n end\n masterArr\nend", "def get_search_result_body_html(record_arr)\n str_arr = []\n record_arr.each_with_index do |r, index|\n str_arr << %{<div class=\"search_item\" id=\"search_item_#{index}\">\n <h3 class=\"titbg\"><span class=\"title_ico\">&nbsp;</span>\n <a href=\"#{r.url}\" target=\"_blank\">#{r.title}</a>\n </h3>\n <a href=\"#{r.url}\" target=\"_blank\">#{r.url[0..79]}</a><br/>\n #{(r.summary).html_safe}\n </div>}\n end\n str_arr.join(\"\\n\")\n end", "def create_line_without_interrupt( up_var, collection)\n a = Array.new\n for i in 0..17 do\n a.push (link_to render_element(collection[i + up_var ] ), \n show_element_show_path(element: collection[i + up_var][:at_num]), \n {class: \"cell\"})\n end\n a.join.html_safe\n end", "def settings_group(nice_name, id, width, height, &block)\n res = [\"<div id='#{id}'>\"]\n res << \"<div class='dhtmlgoodies_aTab'>\"\n res << \"<table class='simple' width='100%'>\"\n res << capture(&block)\n res << \"</table>\"\n res << \"</div>\"\n res << \"</div>\"\n dtree_group_script(nice_name, id, width, height)\n concat(res.join(\"\\n\").html_safe).html_safe\n end", "def build_spans on_range\n # TODO: rewrite in terms of each_row\n @spans = Array.new @size[1]\n\n @size[1].times do |y|\n spans = []\n left = (@size[1]-y-1)*@size[0]\n start = nil\n\n @size[0].times do |x|\n d = on_range.include?(@pixels[left+x])\n\n if !start && d\n start = x\n elsif start && !d\n spans << [start, x]\n start = nil\n end\n end\n\n spans << [start, @size[0]] if start\n @spans[y] = spans\n end\n end", "def horz(divs)\n fail if divs <= 0\n segsize = 1.0 / divs\n divs.times do |i|\n l = new_item i * segsize, 0, segsize, 1\n yield l, i if block_given?\n end\n end", "def create\n for i in 1 .. (@canvas_height - 1) do\n @buffer.append(i, \" \" * (@canvas_width - 1))\n end\n end", "def format_as_block_html(name, attr, body, indent); end", "def _HtmlBlockInTags\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_HtmlAnchor)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockAddress)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockBlockquote)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockCenter)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDir)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDiv)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockFieldset)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockForm)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH1)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH2)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH3)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH4)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH5)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockH6)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockMenu)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockNoframes)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockNoscript)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockOl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockP)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockPre)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTable)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockUl)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDd)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockDt)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockFrameset)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockLi)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTbody)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTd)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTfoot)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTh)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockThead)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockTr)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockScript)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_HtmlBlockHead)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_HtmlBlockInTags unless _tmp\n return _tmp\n end", "def render\r\n if self.has_content?\r\n self.to_a.inject(''){|loop_str, i|\r\n loop_str += i.nodes.inject(''){|nodes_str, j|\r\n nodes_str += j.render\r\n }\r\n }\r\n else\r\n ''\r\n end\r\n end", "def render_at_block(data)\n data.map { |key, block| \"#{key} { #{render_block(block)} }\" }.join('')\n end", "def get_content()\r\n result=''\r\n if self.children.empty?\r\n result=self.content\r\n else\r\n # Display line by line them if it has childern, but no layout\r\n if self.content.nil? || self.content.empty?\r\n self.children.each do |w|\r\n result +=w.get_content()\r\n result +='</br>' # Each child takes a new line\r\n end\r\n end\r\n end\r\n result\r\n end", "def content_blocks\n @content_blocks ||= Hash.new {|h,k| h[k] = [] }\n end", "def bottomToTopWraparound(grid, width, height)\n\n strings = bottomToTop(grid, width, height)\n\n for string in strings do\n\n string << string\n\n end\n\n return strings\n\nend", "def build\n \n data = heading(:css_location => \"css/html-cutlist.css\").to_s\n \n data += page_title().to_s\n \n # Get all the parts in an array of part hashes.\n all_parts = @parts.grouped\n\n # # Sort parts.\n # all_parts = all_parts.sort { |a, b|\n # a['material'] <=> b['material']\n # # a['thickness'] <=> b['thickness']\n # # a['width'] <=> b['width']\n # # a['length'] <=> b['length']\n # }\n\n # Create an empty array of materials.\n materials = []\n\n # Put all the materials in the list\n all_parts.each { |p|\n materials.push(p['material']) \n }\n\n # Make sure there is only one of each material.\n materials = materials.uniq\n\n # Create a blank hash to put sorted parts into.\n grouped_parts = {}\n\n # Create a new list of hashes that represent the material and then the parts \n # that are of that material (a blank hash).\n materials.each { |m| \n grouped_parts[m] = {}\n }\n\n # Loop through each part, adding it to the right key in the sorted_list.\n all_parts.each { |p| \n\n # Go through the list of materials.\n materials.each { |m|\n\n if p['material'] == m\n \n # If the \"round_dimensions\" setting is on, round the dimension to \n # three decimal places so we don't have a lot of entries in the \n # grouped_parts list like \"3.750000001\", \"3.750000002\", etc... but \n # instead have one entry like \"3.750\". This way grouping behaves \n # as expected.\n rounded_thickness = @options['round_dimensions'] ? format(\"%0.3f\", p['thickness']).to_f : p['thickness']\n \n # Check to see if there is a key for this thickness and if there is \n # append the part to the array of parts.\n if grouped_parts[m][rounded_thickness]\n grouped_parts[m][rounded_thickness] += [p]\n # If there isn't a key for this thickness, create it now and add the \n # part array.\n else\n grouped_parts[m][rounded_thickness] = [p]\n end\n\n end\n\n }\n\n }\n \n # Sort by materials.\n parts_by_material = grouped_parts.sort { |a,b|\n a[0] <=> b[0]\n }\n\n # List all the parts, grouped.\n parts_by_material.each { |t| # t for thickness.\n\n # Sort thicknesses.\n parts_by_thickness = t[1].sort { |a,b|\n a[0] <=> b[0]\n }\n parts_by_thickness.reverse!\n\n # Go through each thickness key.\n parts_by_thickness.each { |p| # p for parts\n\n # Sort parts by width, then length.\n parts = p[1].sort { |a,b|\n a['width'] <=> b['width']\n # TODO: Get sub-sorting by length.\n # a['length'] <=> b['length']\n }\n parts.reverse!\n \n # Create a parts array to store the parts in.\n parts_array = []\n \n # Go through the parts that are of a specific thickness.\n parts.each { |part| \n \n # Check if part is a sheet good.\n if @options[\"show_sheets\"] && part['is_sheet']\n parts_array.push(part)\n end\n\n # Check if part is solid stock.\n if @options[\"show_solids\"] && part['is_solid']\n parts_array.push(part)\n end\n\n # Check if part is hardware.\n if @options[\"show_hardware\"] && part['is_hardware']\n parts_array.push(part)\n end\n # puts \"#{p['sub_assembly']} -- #{p['part_name']} -- #{p['quantity']} -- #{p['material']} -- Sheet? #{p['is_sheet']} -- Solid? #{p['is_solid']} -- Hardware? #{p['is_hardware']} -- #{p['width']} x #{p['length']} x #{p['thickness']}\"\n \n }\n \n # If there are items in the parts_array, then add the section heading \n # and the array of parts. If there are no parts, show nothing.\n if parts_array.length != 0\n data += section_heading(\"#{p[0].to_fraction(true)} #{t[0]}\")\n data += rows(parts_array)\n end\n \n # TODO: Put section footer here, if needed...\n \n }\n }\n \n data += footer().to_s\n \n # Return the results.\n data\n \n end", "def to_s\n result = ''\n for r in 0..height\n lines = Array.new(cell_height) { '' }\n for c in 0..width\n # Differentiate the behaviour based on the visibility state of four cells at a time\n c1, c2, c3, c4 = self[r-1, c-1], self[r-1, c], self[r, c-1], self[r, c]\n v1, v2, v3, v4 = (c1 and c1.visible), (c2 and c2.visible), (c3 and c3.visible), (c4 and c4.visible)\n if v4\n lines[0] << '#' * cell_width\n (1...cell_height).each do | i | lines[i] << '#' end\n else\n lines[0] << if v1 or v2 or v3\n '#'\n else\n ' '\n end\n lines[0] << if v2\n '#' * (cell_width - 1)\n else\n ' ' * (cell_width - 1)\n end\n if v3\n (1...cell_height).each do | i | lines[i] << '#' end\n else\n (1...cell_height).each do | i | lines[i] << ' ' end\n end\n end\n if v4\n if c4.empty\n lines[1] << c4.number.to_s.ljust(cell_width-1)\n (2...cell_height).each do | i | lines[i] << ' ' * (cell_width-1) end \n else\n (1...cell_height).each do | i | lines[i] << '#' * (cell_width-1) end \n end\n else\n (1...cell_height).each do | i | lines[i] << ' ' * (cell_width-1) end\n end\n end\n result << lines.join(\"\\n\") << \"\\n\"\n end\n result\n end", "def render_threads\n <<-HTML\n #{ @vm.thread_pcs.each_with_index.map { |thread_pc,thread_id|\n opcode_addr_prev = @vm.start_of_opcode_at(thread_pc - 1)\n opcode_addr_next = @vm.start_of_opcode_at(thread_pc + (@vm.disassemble_opcode_at(thread_pc).flatten.size))\n classes = []\n classes << \"current\" if thread_id == @vm.thread_id\n %(\n <tr>\n <td class=\"thread\">\n <h2>#{thread_id} #{@vm.thread_names[thread_id]}</h2>\n\n <h2>Local Vars</h2>\n <table class=\"local_vars\">\n </table>\n\n <h2>PC</h2>\n #{thread_pc}\n </td>\n <td>\n <h2>Opcode</h2>\n <table class=\"opcode_sequence\">\n <tr class=\"sequence_item inactive\"><td>\n #{opcode_addr_prev ? render_disassembly_at(opcode_addr_prev,:classes => %w(inactive)) : \"--\"}\n </td></tr>\n <tr class=\"sequence_item\"><td>\n #{render_disassembly_at(thread_pc)}\n </td></tr>\n <tr class=\"sequence_item inactive\"><td>\n #{opcode_addr_next ? render_disassembly_at(opcode_addr_next,:classes => %w(inactive)) : \"--\"}\n </td></tr>\n </table>\n </td>\n </tr>\n )}.join(\"\\n\")}\n HTML\n end", "def blocks_for_num_blocks\n # Don't create blocks if we have no words\n return [] if @single_block.empty?\n\n # Split the single block into the right size and return\n @single_block.in_groups(@num_blocks, false).each_with_object([]) do |b, ret|\n ret << Block.new(b, I18n.t('lib.frequency.block_count_dataset',\n num: ret.size + 1, total: @num_blocks))\n end\n end", "def prints_div_3and5(n)\r\n\r\n\tarray=[]\r\n\r\n\tfor i in (0..n-1) do\r\n\t\tcontents_ctr = i + 1\r\n\t\tif contents_ctr % 3 == 0 && contents_ctr % 5 == 0 \r\n\t\t\tarray[i] = \"Minedminds\"\r\n\t\telsif contents_ctr % 3 == 0 \r\n\t\t\tarray[i] = \"Minded\"\r\n\t\telsif contents_ctr % 5 == 0\r\n\t\t\tarray[i] = \"Minds\"\r\n\t\telse\r\n\t\t\tarray[i] = contents_ctr\r\n\t\tend\r\n\tend\t\r\nprint array\r\nreturn array\r\nend", "def new_block_el(*args); end", "def div_wrap tag, text\n \"<div class='#{tag}' markdown='1'>#{text}</div>\"\nend", "def render\n puts \" #{(0..8).to_a.join(\" \")}\"\n grid.each_with_index do |row, i|\n arr = []\n row.each do |tile|\n if tile.revealed == true\n arr << tile.display_value\n elsif tile.flagged == true\n arr << \"F\"\n else\n arr << \"*\"\n end\n end\n\n puts \"#{i} #{arr.join(\" \")}\"\n end\n end", "def rect(a, b, screen)\n screen[0...b].each do |row|\n row[0...a] = (\"#\"*a).split(\"\")\n end\n\n screen\nend", "def build_blocks\n new_blocks = []\n current_rotated_blocks.each do |block|\n block_actor = @stage.create_actor :block,\n x: block[0] * BLOCK_SIZE + @falling_piece.x,\n y: block[1] * BLOCK_SIZE + @falling_piece.y,\n grid_offset_x: block[0],\n grid_offset_y: block[1],\n image: @falling_piece.image\n\n new_blocks << block_actor\n end\n # Destroy ourselves, leaving only the blocks behind\n @falling_piece.remove\n\n new_blocks\n end", "def to_s\n build unless @built\n [\n self.class.header,\n initializer_function,\n map_div_html,\n marker_nodes_to_html\n ].compact.join(\" \")\n end", "def build_grid\n header = [\" \", \" a \", \" b \", \" c \", \" d \", \" e \", \" f \", \" g \", \" h \"]\n grid_display = @board.grid.map.with_index do |row, index|\n [8 - index] + build_row(row, index)\n end\n grid_display.unshift(header)\n end", "def print_in_box(str)\n sub_strings = sub_strings(str, 76)\n largest_sub_string = sub_strings.max_by { |str| str.size } # A bug caused by the fact\n # That an array may be \n # empty.\n size = largest_sub_string ? largest_sub_string.size : 0\n \n border_line = '+-' + ('-' * size) + '-+'\n empty_line = '| ' + (' ' * size) + ' |'\n \n puts border_line\n puts empty_line\n sub_strings.each do |str|\n puts '| ' + str.ljust(size) + ' |'\n end\n puts empty_line\n puts border_line\nend", "def header_init(width)\r\n display_arr = Array.new(width)\r\n count = width -1\r\n display_arr.each_with_index do\r\n |x, y|\r\n display_arr[y] = count\r\n count = count - 1\r\n end\r\n return display_arr\r\nend", "def array_paragraphs fragments\n [fragments]\n end", "def processSection0(section)\n string = '';\n buffer_array = [];\n text = section.inner_html;\n text.split('<br>').each do |info|\n buffer_array << info.strip().delete(',');\n end\n string += buffer_array.join(\",\");\n return string;\nend", "def add_divs (html)\n\thtml.gsub!(/^<p>\\[(.*?)\\/\\]/m, '<div class=\"\\1\"></div>')\n\thtml.gsub!(/^<p>\\[\\/(.*?)\\]/m, '</div>')\n\thtml.gsub!(/^<p>\\[(.*?)\\]/m, '<div class=\"\\1\">')\n\thtml\nend", "def child *a; CssString.new a.flatten.unshift(self).join ' > ' end", "def make_mini_layout\n divs = \"<div id='mini_layout'>\" \n places_holder.map { |position| divs += \"<div id='mini_#{position}' class='hover'>\n #{t(\"components.pos.#{position}\")} </div>\"} \n divs += \"</div>\" \n end", "def content_blocks\n @content_blocks ||= Hash.new { |h, k| h[k] = [] }\n end", "def split_simple_body(builder, data, cls)\n gen_cols = data.transpose.map { |col| col.join(\"\\n\") }\n\n builder.tr do\n builder.td(class: 'line-nr') do\n builder << (1..data.length).to_a.join(\"\\n\")\n end\n gen_cols.each do |col|\n builder.td(class: cls) do\n builder << CGI.escape_html(col)\n end\n end\n end\n end", "def news_list_to_html(news)\n H.section(:id => \"newslist\") {\n aux = \"\"\n news.each{|n|\n aux << news_to_html(n)\n }\n aux\n }\nend", "def render_div(line)\n render_tag('%div' + line)\n end", "def render_div(line)\n render_tag('%div' + line)\n end", "def build_base_component(type, args, &block)\n build_sub_component :div, type, args, &block\n end", "def render_block(content)\n nrows, ncols = winsize\n\n nlines = content.count(\"\\n\")\n row = [1, 1 + (nrows - nlines)/2].max\n \n width = width(content)\n col = [1, 1 + (ncols - width)/2].max\n \n content.gsub(/^/) do\n cursor_at(row, col).tap { row += 1 }\n end\nend", "def render_block(block)\n block.map do |prop, value|\n render_property prop, value\n end.join('')\n end", "def blocks_for_num_blocks\n # Don't create blocks if we have no words\n return [] if single_block.empty?\n\n # Split the single block into the right size and return\n single_block.in_groups(num_blocks, false).each_with_object([]) do |b, ret|\n ret << Block.new(words: b,\n name: I18n.t('lib.frequency.block_count_dataset',\n num: ret.size + 1, total: num_blocks))\n end\n end", "def towerBuilder(n_floors)\n layer = width = n_floors + (n_floors - 1)\n result = []\n\n while layer > 0\n result.unshift((\"*\" * layer).center(width))\n layer -= 2\n end\n result\nend", "def nest_array(board)\n nested_board = []\n 9.times { nested_board << board.slice!(0..8)}\n return nested_board\nend", "def initialize\n\t\t @grid = []\n\t\t 9.times { @grid << \" \" }\n\t\tend", "def render_section(content)\n nrows, ncols = winsize\n width = width(content)\n\n rfil = [1, width - 5].max/2\n lfil = [1, width - 5 - rfil].max\n fleuron = '─' * lfil + ' ❧❦☙ ' + '─' * rfil\n\n render_center(\"#{fleuron}\\n\\n#{content}\\n\\n#{fleuron}\\n\")\nend", "def blocks\n @blocks ||= []\n end", "def text_blocks\n pdf.each_object\n .select {|o| o.instance_of? Origami::ContentStream}\n .flat_map(&:instructions)\n .select {|i| i.operator == \"Tj\"}\n .map(&:operands)\n .map { |operands| operands.join(\" \") }\n end", "def append(str = nil, &blk)\n each { |x| x.html(x.children + x.make(str, &blk)) }\n end", "def render\n arr = Array.new(4) { Array.new(4) }\n # arr1 = Array.new(4) { Array.new(4) }\n # @grid.each_with_index do |row, i|\n # row.each_with_index do |card, j|\n # #arr[i][j] = card.face_up ? card.face_value : 0\n # arr1[i][j] = card.face_value\n # end\n # p arr1[i]\n # end\n\n @grid.each_with_index do |row, i|\n row.each_with_index do |card, j|\n arr[i][j] = card.face_up ? card.face_value : 0\n end\n p arr[i]\n end\n arr\n end", "def leftToRightWraparound(grid, width, height)\n\n strings = leftToRight(grid, width, height)\n\n for string in strings do\n\n string << string\n\n end\n\n return strings\n\nend", "def generate_square_boxes(row, drawings)\n content_tag :div, :class => \"drawing_section\" do\n 1.upto(row){|item| concat(generate_row(item, row,drawings))}\n end\n end", "def to_html_fragment\n to_markdown_slices.map do |tagged_markdown|\n tagged_markdown.to_html\n end.join(\"\\n\\n\")\n end", "def random_blocks(length, height, odds, kind)\n return unless rand(0..odds) == rand(0..odds)\n block = [[0, 0], [1, 0], [0, 1], [1, 1]]\n length = rand(length - 1)\n block.each do |xy|\n @elements << Element.new(kind, [length + xy[0], height + xy[1]], [0, 0], 1)\n end\n end", "def test_it_turns_strings_into_chunks\n markdown = \"a\\nbbca\\nbc\\n\"\n actual = Chisel.new(\"\").string_to_chunks(markdown)\n expected = [\"a\", \"bbca\", \"bc\"]\n\n assert_equal expected, actual\n end", "def build(node)\n\n # add <node.name to write_array\n @write_array << \"<#{node.name}\"\n\n # if node has classes, append them to last element of write array\n unless node.classes == nil\n @write_array[-1] = @write_array[-1] + \" classes=\\\"#{node.classes.join(\" \")}\\\"\"\n end\n\n # if node has id's, append them to last element of write array. else append closing bracket\n if node.id == nil\n @write_array[-1] = @write_array[-1] + \">\\n\"\n else\n @write_array[-1] = @write_array[-1] + \" id=\\\"#{node.id}\\\">\\n\"\n end\n\n # add tag text to array if available\n unless node.text == \"\"\n @write_array << node.text + \"\\n\"\n end\n\n # build children\n unless node.children == []\n node.children.each do |child|\n build(child)\n end\n else\n @write_array << \"</#{node.name}>\\n\"\n return\n end\n\n # add closing tag e.g. </html>\n @write_array << \"</#{node.name}>\\n\"\n\n end", "def processSection1(section)\n string = '';\n buffer_array = [];\n text = section.inner_html;\n text.split('<br>').each do |info|\n data = info.split(':')[1].strip().delete(','); #Extract data leaving out tags\n string += ',';\n string += data;\n end\n return string;\nend", "def add_s(array)\n new_array=[]\n array.each_with_index.collect {|widget, index| index != 1 ? widget += \"s\" : widget }\nend", "def get_children(children, level, array)\n return if children.nil?\n\n children.each do |child|\n \n blocked = (child.blocked == \"true\") ? \"BLOCKED\" : \"\" # syntax highlighting matches 'BLOCKED' word\n display_str = \" \" * (level*2) + \"#{child.formatted_i_d}: #{StringUtils.html2text(child.name)}\"\n array << \"#{display_str.rjust(display_str.length, ' ').ljust(65, ' ')} #{formatted_story_state(child.schedule_state).ljust(15, ' ')} #{blocked}\\n\"\n get_children(child.children, level+1, array)\n end\n end", "def to_s\n\t\t%Q(\n\t\t\t#{@layout[0][0]}|#{@layout[0][1]}|#{@layout[0][2]}\n\t\t\t-+-+-\n\t\t\t#{@layout[1][0]}|#{@layout[1][1]}|#{@layout[1][2]}\n\t\t\t-+-+-\n\t\t\t#{@layout[2][0]}|#{@layout[2][1]}|#{@layout[2][2]}\n\t\t\t)\n\tend", "def group_divider (array_of_names)\n\tcounter = 0\n\tgroup_num = 0\n\tgroup_storage = []\n\tif array_of_names == nil\n\t\treturn nil\n\telsif\n\t\tarray_of_names.length < 3\n\t\tp \"It's no fun in a group less than 3 people.\"\n\telsif array_of_names.length == 3\n\t\tp \"Group 1: \" + array_of_names.join(\", \")\n\telsif array_of_names.length % 4 != 0\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\t\tif group_storage[group_num].length == 2\n\t\t\t\tgroup_storage.last << group_storage.first.pop\n\t\t\telsif group_storage[group_num].length == 1\n\t\t\t\tgroup_storage.first << group_storage.pop.pop\n\t\t\tend\n\t\t\tgroup_num += 1\n\t\tend\n\telse\n\t\t\n\t\twhile counter < array_of_names.length \n\t\t\tgroup_storage << array_of_names[counter..counter + 3]\n\t\t\tcounter += 4\n\t\tend\n\t\t\n\tend\n\t\n\tgroup_name_assign = 1\n\twhile group_name_assign <= group_storage.length\n\t\tp \"Group #{group_name_assign}: \" + group_storage[group_name_assign - 1].join(\", \")\n\t\tgroup_name_assign += 1\n\tend\t\nend", "def blocks\n @blocks ||= []\n end", "def render( template, scope )\n\t\trawary = super\n\t\trary = []\n\n\t\trawary.each do |item|\n\t\t\tppstring = ''\n\t\t\tPP.pp( item, ppstring )\n\t\t\t\n\t\t\trary << ppstring.\n\t\t\t\tgsub( /&/, '&amp;' ).\n\t\t\t\tgsub( /</, '&lt;' ).\n\t\t\t\tgsub( />/, '&gt;' )\n\t\tend\n\t\t\n\t\treturn rary\n\tend", "def show_divs\r\n divs = Document.new(self).get_divs\r\n puts \"There are #{divs.length} divs\"\r\n index = 1\r\n divs.each do |l|\r\n puts \"div: name: #{l.name}\"\r\n puts \" id: #{l.id}\"\r\n puts \" class: #{l.className}\"\r\n puts \" index: #{index}\"\r\n index += 1\r\n end\r\n end", "def initialize(width, height)\n @width, @height = width, height\n @chars = Array.new(height) { Array.new(width, \" \") }\n end" ]
[ "0.6050492", "0.5981912", "0.5906518", "0.5906518", "0.5831002", "0.57794255", "0.5705502", "0.5645055", "0.56410474", "0.5599016", "0.5565931", "0.5537886", "0.55085135", "0.5503204", "0.5479593", "0.5477923", "0.5460344", "0.54287136", "0.5415869", "0.5384484", "0.53627443", "0.5351709", "0.53301024", "0.5328047", "0.52995217", "0.5288391", "0.5280754", "0.5275173", "0.5267236", "0.5262314", "0.5257976", "0.5257535", "0.5242896", "0.5237174", "0.522636", "0.5226064", "0.52254206", "0.5214811", "0.5197892", "0.5195842", "0.5194484", "0.5188739", "0.51848716", "0.5174613", "0.5173058", "0.5157317", "0.5156357", "0.51533324", "0.5147343", "0.5139753", "0.5135148", "0.51164466", "0.51095086", "0.51083845", "0.5101808", "0.51016116", "0.5101146", "0.5097619", "0.50874925", "0.5077616", "0.50754493", "0.50726855", "0.5067916", "0.50591606", "0.50590724", "0.50553817", "0.5052164", "0.5043064", "0.5040932", "0.50303787", "0.50282407", "0.50233", "0.50233", "0.50204885", "0.5019734", "0.50192785", "0.50031954", "0.49989828", "0.49922854", "0.4990021", "0.49843302", "0.4982241", "0.49805686", "0.49801236", "0.49762157", "0.49554244", "0.4953374", "0.49531245", "0.49488884", "0.49487904", "0.49482837", "0.49439704", "0.49435738", "0.49313945", "0.4926097", "0.4925513", "0.49243915", "0.49162066", "0.49093607", "0.490842" ]
0.52135354
38
A method for building pair from value/role pair
def build_pair_div value_pair, role_pair value_pair.zip(role_pair).map{|v,r|div_inline(v,r)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mk_pair_role rpair, plural=false\n suffix = plural ? 's' : ''\n \"#{rpair.join(UBAR)}_pair#{suffix}\"\n end", "def build_pair_div_wrap value_pair, role_pair\n pairs = build_pair_div(value_pair, role_pair)\n pair_role = mk_pair_role(role_pair)\n div_block(pairs, pair_role)\n end", "def build_pair *args\n args = args.to_a unless args.respond_to? :each_slice\n args.each_slice(2).map{|name,var| \"#{name} [#{var}]\" }.join(' ')\n end", "def build_pairs_div value_pairs, role_pair\n pairs = value_pairs.map{|pair|build_pair_div_wrap(pair, role_pair)}\n pairs_role = mk_pair_role(role_pair, true)\n div_block(pairs, pairs_role)\n end", "def name_and_role\n instructors.map do |instructors_hash|\n {instructors_hash[:name] => instructors_hash[:role]}\n end\nend", "def pair=(_arg0); end", "def to_marchash\n [@tag, @value]\n end", "def pair; end", "def make_nested_pairs(*args)\n if args.size == 0\n return nil\n end\n Pair.new(args[0], make_nested_pairs(*args[1..-1]))\n end", "def build_hash(key,val)\n hash = {}\n stanzas.each do |el|\n tv = el.tagvalues\n case val\n when nil\n hash[tv[key].first] = el\n when Symbol\n hash[tv[key].first] = (el.send(val))\n else\n hash[tv[key].first] = tv[val].first\n end\n end\n hash\n end", "def create_role_from(key, &block)\n roles.merge!(key => create_role_subclass_from(key, &block))\n end", "def claim_pair(key, value)\n new_key = key.to_s.downcase.split(\"_\").map{|l| l.capitalize.strip}.join(\"\")\n value = [value].flatten.uniq.join(\",\")\n [new_key, value.to_s].map{|s| CGI.escape(s)}.join(\"=\")\n end", "def challenger_tuple(i)\n {:people => i, :algorithm => \"chal#{i}\", :creation_time => Time.now}\n end", "def pair_params\n end", "def filter_value_convert_role(key, val)\n val = [\"customer\", \"writer\", \"editor\", \"administrator\", \"sysadmin\"][val.to_i] if key == :role && (val.class == Fixnum)\n return val\n end", "def to_h\n Hash[members.map(&:to_sym).zip(values)]\n end", "def build_map(value)\n { \"_type\" => type_key, \"_value\" => value }\n end", "def nyc_pigeon_organizer_two(data)\n# MAP will return a changed value, EACH will return original\n\n # coerce each name as the key in the hash\n #access all names\n #names - ['']\n # unique list of names\n names = data.values[0].values.flatten.uniq\n\n # use name as key in hash - fill in with scaffold hash\n initial_structure = names.each_with_object ({}) do |name, hash|\n hash[name] = {color: [], gender: [], lives:[]}\n end\n\n names.each_with_object(initial_structure) do |pigeon, my_initial_structure|\n attributes = data.keys\n attributes.each do |attribute|\n data[attribute].each do |value, names|\n if names.include?(pigeon)\n my_initial_structure[pigeon][attribute] << value.to_s\n end\n end\n end\n end\n\n\nend", "def parse_pair\n parse_string &&\n spaces &&\n must_see(\":\") &&\n spaces &&\n # We may have to fill in a rhs *null*.\n (parse_value || append('null'))\n end", "def create_managers managers_to_be\n \n i = 0 \n 1.upto(managers_to_be.length-1) do\n \n @managers[DEPTS[i].to_s.to_sym] = managers_to_be[i][0] #Eg. {:Finance => \"Simon Moffatt\"}\n \n i += 1 #move on to next value\n \n end \n \nend", "def generate_entry(hash,type)\n entry = []\n for group in hash.keys\n if(group == \"no_group\") #no_group means all choices are mandatory\n for child_comp in hash[group]\n entry.push(\"#{type}:#{child_comp.id}\")\n end\n else #otherwise choose one of the grouped members\n group_group = \"#{type}\"\n for child_comp in hash[group]\n if(!(type==\"v\" && hash[group].length == 1)) #manditory valuefields are not prepended with :\n group_group += \":\"\n end\n group_group += \"#{child_comp.id}\"\n end\n entry.push(group_group)\n end\n end\n #logger.info(\"\\n\\n\\n\\n\\n entry:#{entry} join:#{entry.join(\"|\")} \\n\\n\\n\\n\\n\\n\")\n entry.join(\"|\")\n end", "def prepare_value(value)\n {uuid => value}\n end", "def build_pairs_div_from_lines value_pair_lines, role_pair, rsep=CR, csep=BAR\n value_pairs = value_pair_lines.split(rsep).map{|row|row.split(csep, 2)}\n build_pairs_div(value_pairs, role_pair)\n end", "def mutate(aPair)\n\t\treturn MutateToken.new(aPair.keys.first, aPair.values.first)\n\tend", "def pairs\n Pair.with_member_id(id)\n end", "def add_role( xml, person, role )\n\n if user_role_exists?(xml, role)\n puts \"Would not add role to \" + person[:netids][0] + ' (' + person[:uin] + '), role already exists ' + role.to_s\n\n else\n puts \"Adding role, \" + role.to_s + \" to \" + person[:netids][0] + ' (' + person[:uin] + ')'\n role_node = xml.create_element( 'user_role' )\n\n role_node.add_child( xml.create_element 'status', 'ACTIVE' )\n role_node.add_child( xml.create_element 'scope', role[:scope] )\n role_node.add_child( xml.create_element 'role_type', role[:id] )\n\n if role[:parameters]\n\n parameters = xml.create_element( 'parameters')\n\n role[:parameters].each do |type,value|\n \n parameter = xml.create_element( 'parameter')\n \n parameter.add_child( xml.create_element 'type', type ) \n parameter.add_child( xml.create_element 'value', value ) \n\n parameters.add_child( parameter )\n \n end\n\n role_node.add_child( parameters )\n end\n\n user_roles = xml.xpath( '/user/user_roles' ).first.add_child( role_node )\n\n \n \n end\nend", "def build_key_values(qh)\n # @key_values = {}\n # @query_map = []\n # @counter = 0\n\n qh.each_with_index do |ha,i|\n ha[1] = ha[1].to_a\n query_tag = []\n ha[1].each do |v|\n @key_values[\"-q#{@counter}\"] = ha[0]\n @key_values[\"-q#{@counter}.value\"] = v\n query_tag << \"q#{@counter}\"\n @counter += 1\n end\n @query_map << query_tag\n end\n return @key_values, @query_map\n end", "def parse_pair(name_element, value_element)\n result = {}\n begin\n name_element_spec = get_spec(name_element) or return result\n value_element_spec = get_spec(value_element) or return result\n\n name_xpath = \"//#{name_element_spec['node']}\"\n name_nodes = xml_doc.xpath(name_xpath)\n\n name_nodes.each do |name_node|\n name_text = name_node.text rescue ''\n value_text = ''\n\n parent_node = name_node.parent\n\n parent_node.children.each do |child_node|\n if child_node.name == value_element_spec['node']\n value_text = child_node.text\n end\n end\n\n if !name_text.blank?\n result[name_text] = value_text \n end\n end\n rescue ArgumentError => err\n # warn \"Warn: in parse_pair: #{err}\"\n end\n\n result\n end", "def _reduce_6(val, _values, result)\n @handler.tag_pairs[val[1].downcase.to_sym] = val[2][1..-2] \n result\nend", "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 new_key_value_pair_at_top_level_of_school_hash(new_key, new_value, school)\n new_pair = {new_key.downcase.to_sym => new_value}\n ap new_pair.merge!(school)\nend", "def named_tuple(name, keys, values = keys)\n Struct.new(name, *keys.map(&:to_sym)).new(*values.map(&:to_s))\n end", "def solution2(pairs)\r\n # TODO: complete\r\n pairs.map{|k,v| \"#{k} = #{v}\"}.join(',')\r\nend", "def car_model(keys,values)\n combo = keys.zip(values)\n puts combo\nend", "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def perform(key, value)\n result = []\n key.each_with_index do |k, v|\n result << {k => (value)[v]} #On push dans l'array une portion de hash composer de: key = symbol_text et value = price_text[v] \n end\n puts result\n return result\nend", "def _reduce_9(val, _values, result)\n @handler.pair(val[0].to_sym, val[2]) \n result\nend", "def after_pair(node)\n key, value = value_stack.pop\n\n return unless key\n\n member = Definition::RubyObject.new(\n :name => key.value.to_s,\n :type => :member,\n :value => value\n )\n\n push_value(member)\n end", "def generate_membership\n Membership.create(taller_id: id, role_id: Role.propietario.id, usuario_id: owner_id, current: true)\n Role.administrador\n Role.operador\n Role.propietario\n end", "def role= val\n write_attribute(:role, val.to_s)\n end", "def role= val\n write_attribute(:role, val.to_s)\n end", "def parse_key_value\n to_transaction { to_h }\n end", "def party_role_kind_pairing\n errors.add(:party_role_kinds, \"must provide a specific role pair\") unless party_role_kinds.size == 2\n\n end", "def wrap_in_name_values_hash(name_hash_array)\n name_values_hash_array = []\n name_hash_array.each do |name_hash| \n name_values_hash_array << { name: type_name_from_slot(name_hash), values: [name_hash] } \n end\n name_values_hash_array\n end", "def apply(tuple)\n Tools.tuple_collect(tuple){|k,v| [@renaming[k] || k, v]}\n end", "def _reduce_589(val, _values, result)\n name = val[1].to_sym\n self.assignable name\n result = :\"**#{name}\"\n\n result\nend", "def create_attrib_item_values \n @base_attribs = []\n @attribs = params[:attrib]\n @attribs.keys.each do | key |\n @base_attribs << AttribItemValue.new(attrib_id: key, value: @attribs[key])\n #puts \"AttribItemValue: #{@base_attribs.last.attrib.id}, #{@base_attribs.last.value}\"\n end if @attribs\n #puts \"Attribs: #{@attribs}, @base_attribs: #{@base_attribs.size}\"\n modified_item_parms = item_params\n modified_item_parms[:attrib_values] = @base_attribs\n modified_item_parms\n end", "def build_value_for_element valueSet, value\n if value.nil?\n return {\n \"type\" => \"CD\",\n \"code_list_id\" => valueSet[\"id\"],\n \"title\" => valueSet[\"name\"],\n }\n else\n if value and value[\"type\"]\n if value[\"type\"] == \"present\"\n return {\"type\" => \"ANYNonNull\" }\n elsif value[\"type\"] == \"value\"\n return build_range_hash(false, value[\"operator\"], value[\"units\"][\"id\"], value[\"valueLow\"], value[\"valueHigh\"])\n end\n end\n end\n nil\n end", "def creator\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: creator_ordered, values: values )\n return values\n end", "def initialize(type, value)\n @value = Hash[type: type, value: value]\n end", "def build_symrec(num, name, value, seg, type)\n\t\tsym = Hash.new\n\t\t\n\t\tsym[:symno] = num\n\t\tsym[:name] = name\n\t\tsym[:value] = value\n\t\tsym[:seg] = seg\n\t\tsym[:type] = type\n\t\treturn sym\n\tend", "def transform_attr(key, value); end", "def _reduce_171(val, _values, result)\n result = @builder.assign(val[0], val[1], val[2])\n \n result\nend", "def create_single_attribute_value(label_attribute, att_value, l_object, l_type) \n \t\tAttributeValue.create(:label_attribute_id => label_attribute,\n :value => att_value ,\n :object_id => l_object.id ,\n :object_type => l_type)\n end", "def initialize string_args, value #this @value is a hash where the keys are monster, player, item, and maptype\r\n case string_args #will store the value of whatever is in that room at that moment\r\n when 'n' #will be in this order {monster: [], player: [], item: [], maptype: xxxx}\r\n self.north value #will start with default values\r\n when 's'\r\n self.south value\r\n when 'w'\r\n self.west value\r\n when 'e'\r\n self.east value\r\n when 'ne'\r\n self.northeast value\r\n when 'nw'\r\n self.northwest value\r\n when 'sw'\r\n self.southwest value\r\n when 'se'\r\n self.southeast value\r\n end\r\n end", "def _reduce_211(val, _values, result)\n result = @builder.assign(val[0], val[1], val[2])\n \n result\nend", "def createuser(clazz, info, gender, location, pass = 'webeng12')\n ret = clazz.new\n info.each_pair do |k, v|\n ret[k] = v\n end\n ret.gender = Gender.find_by_sex(gender)\n ret.location = Location.find_by_postal_code(location)\n ret.password, ret.password_confirmation = pass, pass \n ret\nend", "def build(tuple)\n tuple.keys.each do |k|\n (class << self; self; end).send(:define_method, k) do\n @tuple[k]\n end\n end\n end", "def _reduce_247(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n \n result\nend", "def build_userinfo\n @password_value ? \"#{@user_value}:#{@password_value}\" : @user_value if @user_value\n end", "def build(key_name, value={})\n kv = KeyValue.new(self, key_name)\n kv.value = value\n kv\n end", "def update_pair(pair)\n local_ant = pair[0]\n ph_value = pair[1]\n @state.transaction do\n until local_ant.size == 1\n @state[:trails][[local_ant[0], local_ant[1]]] += ph_value\n local_ant.shift\n end\n end\n end", "def _reduce_595(val, _values, result)\n name = val[1].to_sym\n self.assignable name\n result = :\"**#{name}\"\n\n result\nend", "def key_maker(hash, key, value)\n case\n when value.include?(\"true\")\n value = true\n when value.include?(\"false\")\n value = false\n when value.to_i > 0 && value.length < 4\n value = value.to_i\n when value == \"0\"\n value = value.to_i\n else\n value\n end\n hash.store(key.to_sym, value)\nend", "def _reduce_171(val, _values, result)\n result = @builder.assign(val[0], val[1], val[2])\n\n result\nend", "def _reduce_211(val, _values, result)\n result = @builder.assign(val[0], val[1], val[2])\n\n result\nend", "def user_tuple(i, encrypt_pass = false)\n {:id => i, \n :mail => \"testuser#{i}@stamina.chefbe.net\", \n :nickname => \"testuser#{i}\", \n :password => encrypt_pass ? md5(\"testuser#{i}\") : \"testuser#{i}\", \n :admin_level => 0, \n :activation => \"\"}\n end", "def new_top_level(school, key, value)\n school[key.to_sym] = value\nend", "def _reduce_518(val, _values, result)\n result = @builder.accessible(val[0])\n \n result\nend", "def finals_mapping(id, role, match_count)\n role = { home: 0, guest: 1 }[role] if role.is_a? Symbol\n id + match_count*role \n end", "def _reduce_593(val, _values, result)\n name = val[1].to_sym\n self.assignable name\n result = :\"**#{name}\"\n\n result\nend", "def _reduce_593(val, _values, result)\n name = val[1].to_sym\n self.assignable name\n result = :\"**#{name}\"\n\n result\nend", "def _reduce_587(val, _values, result)\n name = val[1].to_sym\n self.assignable name\n result = :\"**#{name}\"\n\n result\nend", "def associate_values\n\t\trequire 'yaml'\n\t\tcompany_values = YAML::load_file(\"#{RAILS_ROOT}/lib/company/company.yml\")\n\t\tcompany_values.each_pair do |key,val|\n\t\t\ttemp_arr = val.split(',')\n\t\t\ttemp_arr.each do |arr|\n\t\t\t\tunless Company.reflect_on_association(key.to_sym).macro == :has_one\n\t\t\t\t\t#Commented as on creation of a new company alvalues for only contact_stages was set and not for others. - Ketki\n\t\t\t\t\t# key == 'contact_stages' ? self.send(key).create(:lvalue=>arr.strip, :alvalue=>arr.strip) : self.send(key).create(:lvalue=>arr.strip)\n\t\t\t\t\tself.send(key).create(:lvalue=>arr.strip, :alvalue=>arr.strip)\n\t\t\t\telse\n\t\t\t\t\tkey == 'rating_type' ? eval(\"self.create_#{key}(:lvalue=>'#{arr.strip.to_s}', :alvalue => '#{arr.strip.to_s}')\") : eval(\"self.create_#{key}(:lvalue=>'#{arr.strip.to_s}')\")\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def create\n ActiveRecord::Base.transaction do\n @role, hash = fill_role(params[:role])\n\n respond_to do |format|\n if @role.save\n flash[:notice] = 'Role was successfully created.'\n format.html { redirect_to(@role) }\n format.xml { render :xml => @role, :status => :created, :location => @role }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def _reduce_196(val, _values, result)\n result = @builder.assign(val[0], val[1], val[2])\n \n result\nend", "def _reduce_196(val, _values, result)\n result = @builder.assign(val[0], val[1], val[2])\n \n result\nend", "def _reduce_196(val, _values, result)\n result = @builder.assign(val[0], val[1], val[2])\n \n result\nend", "def plist_key_value( sp, key, type, value )\n p = []\n p.push \"#{sp}<key>#{key.to_s}</key>\"\n p.push \"#{sp}<#{type}>#{value.to_s}</#{type}>\"\n return p\n end", "def _reduce_34(val, _values, result)\n result = new_assign val[0], val[1], s(:svalue, val[2])\n \n result\nend", "def _reduce_34(val, _values, result)\n result = new_assign val[0], val[1], s(:svalue, val[2])\n \n result\nend", "def _reduce_551(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def create_two_role_identifier(r1, r2)\n pc = @constellation.PresenceConstraint(\n :concept => :new,\n :vocabulary => @vocabulary,\n :name => r1.object_type.name+' '+r1.object_type.name+'PK',\n :role_sequence => [:new],\n :is_mandatory => true,\n :min_frequency => 1,\n :max_frequency => 1,\n :is_preferred_identifier => true\n )\n @constellation.RoleRef(:role_sequence => pc.role_sequence, :ordinal => 0, :role => r1)\n @constellation.RoleRef(:role_sequence => pc.role_sequence, :ordinal => 1, :role => r2)\n end", "def __to_catalog_tuple\n d = options[:default]\n {:namespace => relvar.namespace.name, \n :relvar => relvar.name, \n :name => name, \n :domain => domain.to_s,\n :default => d.nil? ? nil : domain.__rubyrel_to_physical_value(d)}\n end", "def _reduce_241(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n \n result\nend", "def _reduce_241(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n \n result\nend", "def _reduce_241(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n \n result\nend", "def _reduce_241(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n \n result\nend", "def _reduce_241(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n \n result\nend", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end" ]
[ "0.6371081", "0.6001294", "0.5729544", "0.55660665", "0.54193795", "0.5290515", "0.523177", "0.51891524", "0.51863986", "0.51336324", "0.5084742", "0.5064395", "0.5058741", "0.50543714", "0.5050385", "0.504562", "0.5023633", "0.49930632", "0.49166766", "0.48977584", "0.48893127", "0.48825943", "0.48565367", "0.48343018", "0.4832995", "0.48327303", "0.48124045", "0.479157", "0.47669715", "0.47545293", "0.47480252", "0.47453302", "0.47403318", "0.471595", "0.47155875", "0.47126415", "0.4695861", "0.46952292", "0.46869054", "0.46580833", "0.46580833", "0.465171", "0.46406406", "0.46209186", "0.45976844", "0.45659846", "0.4565302", "0.45614657", "0.45595634", "0.45583746", "0.4552306", "0.4548333", "0.4540587", "0.45348844", "0.4532069", "0.45236352", "0.4523395", "0.4522118", "0.45213702", "0.4518782", "0.45160067", "0.45138243", "0.45094", "0.44997513", "0.44951868", "0.4494242", "0.4489387", "0.44871294", "0.44868731", "0.4485904", "0.44831365", "0.44831365", "0.44829082", "0.4480569", "0.44728023", "0.44720832", "0.44720832", "0.44720832", "0.446273", "0.4458386", "0.4458386", "0.44515413", "0.4450374", "0.44496623", "0.44495177", "0.44495177", "0.44495177", "0.44495177", "0.44495177", "0.44486374", "0.44486374", "0.44486374", "0.44486374", "0.44486374", "0.44486374", "0.44486374", "0.44486374", "0.44486374", "0.44486374", "0.44486374" ]
0.5686944
3
A method for building pair role
def mk_pair_role rpair, plural=false suffix = plural ? 's' : '' "#{rpair.join(UBAR)}_pair#{suffix}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end", "def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end", "def setup_role \n if self.role_ids.empty? \n self.role_ids = [2] \n end\n end", "def generate_membership\n Membership.create(taller_id: id, role_id: Role.propietario.id, usuario_id: owner_id, current: true)\n Role.administrador\n Role.operador\n Role.propietario\n end", "def setup_role\n \tif self.role_ids.empty?\n \t self.role_ids = [3]\n \tend\n end", "def setup_role\n if self.role_ids.empty?\n self.role_ids = [2]\n end\n end", "def add_role\n role_name = \"network-#{name}\"\n unless Role.exists?(name: role_name)\n Rails.logger.info(\"Network: Adding role and attribs for #{role_name}\")\n bc = Barclamp.find_key \"network\"\n Role.transaction do\n create_auto_v6_range\n r = Role.find_or_create_by!(name: role_name,\n type: \"BarclampNetwork::Role\", # force\n jig_name: Rails.env.production? ? \"chef\" : \"test\",\n barclamp_id: bc.id,\n description: I18n.t('automatic_by', :name=>name),\n library: false,\n implicit: true,\n milestone: true, # may need more logic later, this is safest for first pass\n bootstrap: false, # don't bootstrap networks anymore.\n discovery: false ) # don't discovery networks anymore.\n RoleRequire.create!(:role_id => r.id, :requires => \"network-server\")\n # The admin net must be bound before any other network can be bound.\n RoleRequireAttrib.create!(role_id: r.id, attrib_name: 'network_interface_maps')\n RoleRequireAttrib.create!(role_id: r.id, attrib_name: 'network-current-config')\n RoleRequireAttrib.create!(role_id: r.id, attrib_name: 'network-wanted-config')\n # attributes for jig configuraiton\n Attrib.create!(:role_id => r.id,\n :barclamp_id => bc.id,\n :name => \"#{role_name}_addresses\",\n :description => \"#{name} network addresses assigned to a node\",\n :map => \"crowbar/network/#{name}/addresses\")\n Attrib.create!(:role_id => r.id,\n :barclamp_id => bc.id,\n :name => \"#{role_name}_targets\",\n :description => \"#{name} network addresses to be used as ping test targets\",\n :map => \"crowbar/network/#{name}/targets\")\n Attrib.create!(:role_id => r.id,\n :barclamp_id => bc.id,\n :name => \"#{role_name}_conduit\",\n :description => \"#{name} network conduit map for this node\",\n :map => \"crowbar/network/#{name}/conduit\")\n Attrib.create!(:role_id => r.id,\n :barclamp_id => bc.id,\n :name => \"#{role_name}_resolved_conduit\",\n :description => \"#{name} network interfaces used on this node\",\n :map => \"crowbar/network/#{name}/resolved_interfaces\")\n Attrib.create!(:role_id => r.id,\n :barclamp_id => bc.id,\n :name => \"#{role_name}_vlan\",\n :description => \"#{name} network vlan tag\",\n :map => \"crowbar/network/#{name}/vlan\")\n Attrib.create!(:role_id => r.id,\n :barclamp_id => bc.id,\n :name => \"#{role_name}_team_mode\",\n :description => \"#{name} network bonding mode\",\n :map => \"crowbar/network/#{name}/team_mode\")\n Attrib.create!(:role_id => r.id,\n :barclamp_id => bc.id,\n :name => \"#{role_name}_use_vlan\",\n :description => \"Whether the #{name} network should use a tagged VLAN interface\",\n :map => \"crowbar/network/#{name}/use_vlan\")\n Attrib.create!(:role_id => r.id,\n :barclamp_id => bc.id,\n :name => \"#{role_name}_use_team\",\n :description => \"Whether the #{name} network should bond its interfaces\",\n :map => \"crowbar/network/#{name}/use_team\")\n Attrib.create!(:role_id => r.id,\n :barclamp_id => bc.id,\n :name => \"#{role_name}_use_bridge\",\n :description => \"Whether #{name} network should create a bridge for other barclamps to use\",\n :map => \"crowbar/network/#{name}/use_bridge\")\n # attributes for hints\n # These belong to the barclamp, not the role.\n Attrib.create!(:barclamp_id => bc.id,\n :name => \"hint-#{name}-v4addr\",\n :description => \"Hint for #{name} network to assign v4 IP address\",\n :map => \"#{name}-v4addr\",\n :schema => {\n \"type\" => \"str\",\n \"required\" => true,\n \"pattern\" => '/([0-9]{1,3}\\.){3}[0-9]{1,3}/'})\n Attrib.create!(:barclamp_id => bc.id,\n :name => \"hint-#{name}-v6addr\",\n :description => \"Hint for #{name} network to assign v6 IP address\",\n :map => \"#{name}-v6addr\",\n :schema => {\n \"type\" => \"str\",\n \"required\" => true,\n \"pattern\" => '/[0-9a-f:]+/'})\n end\n end\n end", "def create_role_from(key, &block)\n roles.merge!(key => create_role_subclass_from(key, &block))\n end", "def party_role_kind_pairing\n errors.add(:party_role_kinds, \"must provide a specific role pair\") unless party_role_kinds.size == 2\n\n end", "def add_role( xml, person, role )\n\n if user_role_exists?(xml, role)\n puts \"Would not add role to \" + person[:netids][0] + ' (' + person[:uin] + '), role already exists ' + role.to_s\n\n else\n puts \"Adding role, \" + role.to_s + \" to \" + person[:netids][0] + ' (' + person[:uin] + ')'\n role_node = xml.create_element( 'user_role' )\n\n role_node.add_child( xml.create_element 'status', 'ACTIVE' )\n role_node.add_child( xml.create_element 'scope', role[:scope] )\n role_node.add_child( xml.create_element 'role_type', role[:id] )\n\n if role[:parameters]\n\n parameters = xml.create_element( 'parameters')\n\n role[:parameters].each do |type,value|\n \n parameter = xml.create_element( 'parameter')\n \n parameter.add_child( xml.create_element 'type', type ) \n parameter.add_child( xml.create_element 'value', value ) \n\n parameters.add_child( parameter )\n \n end\n\n role_node.add_child( parameters )\n end\n\n user_roles = xml.xpath( '/user/user_roles' ).first.add_child( role_node )\n\n \n \n end\nend", "def create_two_role_identifier(r1, r2)\n pc = @constellation.PresenceConstraint(\n :concept => :new,\n :vocabulary => @vocabulary,\n :name => r1.object_type.name+' '+r1.object_type.name+'PK',\n :role_sequence => [:new],\n :is_mandatory => true,\n :min_frequency => 1,\n :max_frequency => 1,\n :is_preferred_identifier => true\n )\n @constellation.RoleRef(:role_sequence => pc.role_sequence, :ordinal => 0, :role => r1)\n @constellation.RoleRef(:role_sequence => pc.role_sequence, :ordinal => 1, :role => r2)\n end", "def setup_role\n if self.role_ids.empty?\n self.role_ids = [2]\n end\n end", "def create_role(person_id)\n Role.new(\n :role_type_id => 20,\n :person_id => person_id,\n :organisation_id => 1,\n :contactinfo_id => 300,\n :role_title => 'Test role for person '+person_id.to_s,\n :general_note => 'Test note for person '+person_id.to_s\n )\n end", "def role; end", "def role; end", "def setup_role role_kind:, role:\n role_info = extract_role_attrs role: role\n role_name = role_info[:role_name]\n version = role_info[:version]\n created_at = role_info[:created_at]\n is_default = role_info[:is_default]\n is_composite = role_info[:is_composite]\n is_aggregable = role_info[:is_aggregable]\n aggregable_by = role_info[:aggregable_by]\n\n info \"-- Indexing [#{role_kind}] #{role_name}\"\n\n cache_aggregable_roles aggregable_by: aggregable_by, role_kind: role_kind, role_name: role_name\n\n namespace = role_kind == :Role ? role['metadata']['namespace'] : Krane::Rbac::Graph::Builder::ALL_NAMESPACES_PLACEHOLDER\n\n # caching role namespace scope\n @role_ns_lookup[role_name] = namespace if role_kind == :Role \n\n entry = {\n role_kind: role_kind,\n role_name: role_name\n }\n \n @defined_roles << entry # caching role as defined\n @default_roles << entry if is_default # cache default roles\n\n node :namespace, { name: namespace }\n node :role, { \n kind: role_kind, \n name: role_name, \n is_default: is_default, \n is_composite: is_composite,\n is_aggregable: is_aggregable, \n aggregable_by: aggregable_by.join(', '),\n version: version,\n created_at: created_at \n }\n edge :scope, { \n role_kind: role_kind, \n role_name: role_name, \n namespace: namespace \n }\n\n return if role_info[:rules].blank?\n\n # Iterating the Rules\n role_info[:rules].map {|rule| process_rule rule }.flatten.each do |rule|\n node :rule, { rule: rule }\n edge :grant, {\n role_kind: role_kind,\n role_name: role_name,\n rule: rule\n }\n edge :security, { rule: rule }\n end\n end", "def add_role\n person\n end", "def setup_role \n if self.role_ids.empty? \n self.role_ids = [Role.find_by_name(\"User\").id] \n end\n end", "def create\n @role = Role.new(role_params)\n @role.save\n \n if @role.has_pool\n \n @role.default_assignee_id = 1000000 + @role.id \n @person = Person.new\n @person.id = 1000000 + @role.id\n \n if @role.pool_display_name.length() > 0\n @person.first_name = @role.pool_display_name\n else\n @person.first_name = @role.code + \" Pool\"\n end\n @person.last_name = \"\"\n @person.save\n \n @people_role = PeopleRole.new\n @people_role.role_id = @role.id\n @people_role.person_id = 1000000 + @role.id\n @people_role.save\n end\n \n respond_to do |format|\n if @role.save\n format.html { redirect_to @role, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end", "def role_params\n {}\n end", "def create_user_role\n if self.role.blank?\n id = Role.select{|role| role.role_type == $roles[:user]}.map(&:id)\n self.update_attributes(:role_id => id[0])\n end\n end", "def create_role(role,ref_ids = nil)\n if has_role?(role)\n if ref_ids\n role = roles.where(name: Role::NAMES[role]).first\n role.ref_ids = (role.ref_ids + ref_ids).uniq\n role.save\n else\n roles.find_or_create_by(name: Role::NAMES[role])\n end\n else\n ref_ids.nil? ? roles.create(name: Role::NAMES[role]) : roles.create(name: Role::NAMES[role],ref_ids: ref_ids)\n end\n end", "def create\n abilities = []\n client_application = current_user.client_application_id.to_s\n @abilities = Role.get_method_names.sort\n @role = Role.new(role_params)\n params[:role][:role_abilities].each do |ability|\n abilities << ability.to_sym\n end\n @role.role_abilities = [{\"action\"=> abilities, \"subject\"=>[:api]}]\n @role.client_application_id = client_application\n respond_to do |format|\n if @role.save\n format.html { redirect_to roles_path, notice: 'Role was successfully created.' }\n format.json { render :index, status: :created, location: @role }\n else\n format.html { render :new }\n format.json { render json: @role.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n ActiveRecord::Base.transaction do\n @role, hash = fill_role(params[:role])\n\n respond_to do |format|\n if @role.save\n flash[:notice] = 'Role was successfully created.'\n format.html { redirect_to(@role) }\n format.xml { render :xml => @role, :status => :created, :location => @role }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create_role(name, owner_key, access_type)\n name ||= random_string 'test_role'\n perms = [{\n :owner => {:key => owner_key},\n :access => access_type,\n }]\n role = @cp.create_role(name, perms)\n\n # Only append to the list of things to clean up if the @roles exists.\n # This is so the method can be used in before(:all) blocks.\n @roles << role if not @roles.nil?\n return role\n end", "def make_member!\n make_role!(MemberRole)\n end", "def add_role(role_name)\n p = proposal\n r = Role.find_by_name role_name\n DeploymentRole.create :role_id=>r.id, :snapshot_id=>p.id\n end", "def new\n requires({'role' => ['admin','faculty']})\n end", "def create\n Statements::CreateRole.new(context: self)\n end", "def assign_role\n \tdefault_role = Role.where(name: 'LeadGenerator').last\n \t self.role_id = default_role.id if self.role_id.blank? && default_role.present?\t\t\t\n end", "def create_role(client:, **data)\n create_object(type: 'Role', root: url_for(client), data: data)\n end", "def create_roles\n Role.create_roles(self)\n end", "def create_guild_role(data)\n role_data = data['role']\n server_id = data['guild_id'].to_i\n server = @servers[server_id]\n new_role = Role.new(role_data, self, server)\n server.add_role(new_role)\n end", "def role( symbol, *args )\n if args.empty?\n @roles[ symbol.to_sym ]\n else\n @roles[ symbol.to_sym ] += args.flatten.compact\n end\n end", "def create_guild_role(data)\n role_data = data['role']\n server_id = data['guild_id'].to_i\n server = @servers[server_id]\n new_role = Role.new(role_data, self, server)\n existing_role = server.role(new_role.id)\n if existing_role\n existing_role.update_from(new_role)\n else\n server.add_role(new_role)\n end\n end", "def create_role_directory\n `cd #{self.project_root} && mkdir -p puppet/roles/#{self.name}/manifests`\n end", "def make_angler\n unless self.roles.include?(Role.find_by_name(\"angler\"))\n self.roles << Role.find_by_name(\"angler\")\n end\n end", "def accept_role role\n self.roles.push role\n end", "def assign_role\n if self.organization\n self.add_role :organization if self.roles.blank?\n else\n self.add_role :standard if self.roles.blank?\n end\n end", "def create_roles\n ['admin', 'lector', 'jefe_calidad', 'jefe_bodega', 'op_bodega'].each do |role_name|\n Role.create!(name: role_name)\n end\nend", "def build\n if roles.empty?\n debug \"Not building any RolePermit\"\n return [] if roles.empty?\n end\n roles.inject([]) do |permits, role|\n debug \"Building RolePermit for #{role}\"\n (permits << create_permit(role)) if valid?(role.to_sym)\n permits\n end.compact\n end", "def create_role(auth, server_id, name, color, hoist, mentionable, permissions, reason = nil)\n MijDiscord::Core::API.request(\n :guilds_sid_roles,\n server_id,\n :post,\n \"#{MijDiscord::Core::API::APIBASE_URL}/guilds/#{server_id}/roles\",\n { color: color, name: name, hoist: hoist, mentionable: mentionable, permissions: permissions }.to_json,\n Authorization: auth,\n content_type: :json,\n 'X-Audit-Log-Reason': reason\n )\n end", "def assign_role\n #self.role = Role.find_by name: '訪客' if self.role.nil?\n self.role = Role.find_by name: 'Guest' if self.role.nil?\n end", "def role(role, server)\n @roles[role] ||= []\n @roles[role] << server\n end", "def create\n logger.debug(\"Role create\")\n if params[:from] == 'organisation'\n @organisation = Organisation.find(params[:id])\n @role = Role.new(params[:role])\n @role.organisation_id = @organisation.organisation_id\n @from='organisation'\n else\n @person = Person.find(params[:id])\n @role = Role.new(params[:role])\n @role.person_id = @person.person_id\n @from='person'\n end\n \n @role.updated_by = get_user.login_id\n \n\t# if the editing user does have permission to publish CRM, set the role status to 'Pending'\n\t@role.status_id = Status::PENDING.status_id if !PrivilegesHelper.has_permission?(@login, 'CAN_PUBLISH_CRM')\n\t \n if @role.create_self(@login)\n \n\t # Role.crm_privileges_check(@login, @role)\n\t \n\t contact_name = ''\n # name of the contact\n if !@role.person.blank?\n contact_name = ' for ' + @role.person.full_name\n else\n contact_name = ' for ' + @role.organisation.organisation_list_name(true) unless @role.organisation.blank?\n end\n \n flash[:notice] = 'Role' + contact_name + ' was successfully created.'\n redirect_to :controller => 'role_contactinfos', :action => 'edit', :id => @role\n else\n render :action => 'new', :locals => {@from => params[:from]}\n end\n end", "def setup_role\n if self.role_ids.empty?\n self.role_ids = self.roles.find_by_name(:registered).id\n end\n end", "def add!(role, parents = nil)\n type_hint! Rend::Acl::Role, role, :is_required => true\n\n role_id = role.id\n raise Exception, \"Role id 'role_id' already exists in the registry\" if has?(role_id)\n\n role_parents = {}\n\n if parents\n Array(parents).each do |parent|\n begin\n role_parent_id = (parent.class <= Rend::Acl::Role) ? parent.id : parent\n role_parent = get!(role_parent_id)\n rescue Exception\n raise Exception, \"Parent Role id 'role_parent_id' does not exist\"\n end\n role_parents[role_parent_id] = role_parent\n roles[role_parent_id][:children][role_id] = role\n # roles[role_parent_id][:instance].children[role_id] = role # future\n end\n end\n\n # role.parents = role_parents -- future\n\n roles[role_id] = {\n :instance => role,\n :parents => role_parents,\n :children => {}\n }\n\n self\n end", "def data_for_role_new\n {}\n end", "def create_role(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateRole'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :assume_role_policy_document\n\t\t\targs[:query]['AssumeRolePolicyDocument'] = optional[:assume_role_policy_document]\n\t\tend\n\t\tif optional.key? :description\n\t\t\targs[:query]['Description'] = optional[:description]\n\t\tend\n\t\tif optional.key? :role_name\n\t\t\targs[:query]['RoleName'] = optional[:role_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def build_roles(role)\n results = @machines.reject { |m| [*m['role']].grep(role).empty? }\n rolesarray = []\n results.each do |machine|\n rolesarray.push(machine['name'])\n end\n rolesarray\n end", "def clone_rights_from(role_name)\n role=Role.find_by_name(role_name)\n if role\n self.rights << role.rights\n end\n end", "def create\n registered = true\n\n plan = Plan.find(role_params[:plan_id])\n @role = Role.new(plan: plan, access: role_params[:access])\n authorize @role\n\n message = ''\n if role_params[:user].present? &&\n role_params[:user].key?(:email) &&\n role_params[:user][:email].present? && plan.present?\n\n if @role.plan.owner.present? && @role.plan.owner.email == role_params[:user][:email]\n flash.now[:notice] = format(_('Cannot share plan with %{email} since that email matches\n with the owner of the plan.'),\n email: role_params[:user][:email])\n else\n user = User.where_case_insensitive('email', role_params[:user][:email]).first\n if user.present? &&\n Role.where(plan: @role.plan, user: user, active: true)\n .count\n .positive? # role already exists\n\n flash.now[:notice] = format(_('Plan is already shared with %{email}.'),\n email: role_params[:user][:email])\n else\n # rubocop:disable Metrics/BlockNesting\n if user.nil?\n registered = false\n # Attempt to determine the new Collaborator's org based on their email\n # if none is found user the is_other org or the current user's if that is not defined\n email_domain = role_params[:user][:email].split('@').last\n collaborator_org = Org.from_email_domain(email_domain: email_domain)\n collaborator_org = Org.where(is_other: true).first if collaborator_org.blank?\n\n # DMPTool customization\n User.invite!(\n inviter: current_user,\n plan: plan,\n params: { email: role_params[:user][:email], org_id: collaborator_org&.id }\n )\n # User.invite!({ email: role_params[:user][:email],\n # firstname: _(\"First Name\"),\n # surname: _(\"Surname\"),\n # org: current_user.org,\n # invitation_plan_id: @role.plan.id },\n # current_user)\n message = format(_('Invitation to %{email} issued successfully.'),\n email: role_params[:user][:email])\n user = User.where_case_insensitive('email', role_params[:user][:email]).first\n end\n\n message += format(_('Plan shared with %{email}.'), email: user.email)\n @role.user = user\n\n if @role.save\n if registered\n deliver_if(recipients: user, key: 'users.added_as_coowner') do |r|\n UserMailer.sharing_notification(@role, r, inviter: current_user)\n .deliver_now\n end\n end\n flash.now[:notice] = message\n else\n flash.now[:alert] = _('You must provide a valid email address and select a permission\n level.')\n end\n # rubocop:enable Metrics/BlockNesting\n end\n end\n else\n flash.now[:alert] = _('Please enter an email address')\n end\n redirect_to controller: 'contributors', action: 'index', plan_id: @role.plan.id\n end", "def give_role(name)\n r = Role.new(:name => name, :user => self)\n self.roles << r\n save(false)\n end", "def assignedVehicleRole _args\n \"assignedVehicleRole _args;\" \n end", "def role(*args)\n case args.size\n when 2\n role_module = args[0]\n obj = args[1]\n role_name = Util.underscore(role_module.name).to_sym\n when 3\n role_name = args[0]\n role_module = args[1]\n obj = args[2]\n else\n raise ArgumentError\n end\n\n self.roles[role_name] = RoleMapping.new(role_module, obj)\n\n if ::Brassbound::Context.current.equal?(self)\n # If we are already in the execute method, apply the role mapping.\n apply_role(role_name)\n end\n end", "def add_role(_role)\n if _role.is_a?(Array)\n update!(roles: roles + _role.map{|a| a.to_sym })\n else\n update!(roles: roles + [_role.to_sym])\n end\n end", "def build_resource(hash = nil)\n super(hash)\n resource.role = User::GROUP_MEMBER_ROLE\n end", "def create\n if params[:role] == \"merchant\"\n create_merchant #creating merchant in this method and sending response.\n elsif params[:role] == \"customer\"\n create_customer #creating customer in this method and sending response.\n end\n end", "def role= new_role\n @role = String new_role\n end", "def new\n @role = System::Role.new\n end", "def new\n @role = Role.new(vendor_id: @vendor.id)\n @role.build_user\n end", "def role(role)\n @roles = @roles | [@salticid.role(role)]\n end", "def Role(input, &block) # rubocop:disable Naming/MethodName\n result = case input\n when Sipity::Role\n input\n when String, Symbol\n Sipity::Role.find_or_create_by(name: input)\n end\n\n handle_conversion(input, result, :to_sipity_role, &block)\n end", "def create\n #\n # TODO confirm privledges are not compromised\n #\n user = User.find_by_email(params[:role][:user_attributes][:email])\n params[:role].delete(:user_attributes) if user.present?\n\n @role = Role.new(params[:role])\n if user.present?\n if @vendor.users.exists?(user)\n flash.now.alert = \"User already has a role at this vendor.\"\n redirect_to dashboard_vendor_vendor_roles_path(@vendor)\n return\n end\n @role.user = user\n end\n @role.vendor = @vendor\n\n if @role.save\n redirect_to dashboard_vendor_vendor_roles_path(@vendor), notice: 'User successfully added.'\n else\n render 'new'\n end\n end", "def guild_role_format\n {\n position: @position,\n permissions: @permissions,\n managed: false, # TODO: investigate what this is (probably integration stuff)\n id: @id.to_s,\n name: @name,\n hoist: @hoist,\n color: @colour # damn American spelling\n }\n end", "def build_roles\n if local_attr? :build\n slide.set_attr 'build-initiated', ''\n (local_attr :build).split('+').map {|type| BUILD_ROLE_BY_TYPE[type] }\n elsif option? :build\n if (_slide = slide).local_attr? 'build-initiated'\n ['build-items']\n else\n _slide.set_attr 'build-initiated', ''\n ['build', 'build-items']\n end\n else\n []\n end\n end", "def role_to_proposal(role, bc_name)\n proposal = {}\n proposal[\"id\"] = role.name.gsub(\"#{bc_name}-config-\", \"#{bc_name}-\")\n proposal[\"description\"] = role.description\n proposal[\"attributes\"] = role.default_attributes\n proposal[\"deployment\"] = role.override_attributes\n proposal\n end", "def create\n @group = @authorized_group\n @user = User.new(params[:user])\n @role_mapping = RoleMapping.new\n @role_mapping.group = @group\n @role_mapping.user = @user\n @role_mapping.role = \"\"\n @role_mapping.role_by_array = params[:role_by_array]\n\n respond_to do |format|\n if @user.save && @role_mapping.save\n flash[:notice] = \"ユーザ #{@user.login_name} を作成しました\"\n format.html { redirect_to group_users_url(@group) }\n format.xml { render :xml => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_role (role_name)\n self.update_attribute(:role_id,Role.find_or_create_by(name: role_name).id)\n end", "def add_role (role_name)\n self.update_attribute(:role_id,Role.find_or_create_by(name: role_name).id)\n end", "def create\n super do\n resource.role_id = 1\n resource.save\n end\n end", "def node_role(kind:, name:, version: nil, created_at: nil, defined: true, \n is_default: false, is_composite: false, is_aggregable: false, aggregable_by: '')\n label = make_label kind, name\n\n # build a hash attributes for the node automatically\n attrs = (local_variables - [:label, :attrs]).each_with_object({}) do |p, hsh|\n hsh[p] = binding.local_variable_get(p)\n end\n\n add_node :Role, label, attrs\n end", "def user_role(params)\n role = nil\n key = params.is_a?(String) ? params : (params && params.has_key?(:key) ? params[:key] : nil)\n\n unless key.blank?\n if self.moderator_key == key\n role = :moderator\n elsif self.attendee_key == key\n if BigbluebuttonRails.configuration.guest_support\n role = :guest\n else\n role = :attendee\n end\n end\n end\n role\n end", "def role_selection\n \"#{name}\"\n end", "def create\n create_role_directory\n generate_manifests_file\n end", "def get_role_chain_and_block(role, options)\n # detect if requested a 'run move single element'\n flagSingle = false\n if options.has_key?('single') && options['single'] == true\n flagSingle = true\n end\n flagAll = false\n if options.has_key?('all') && options['all'] == true\n flagAll = true\n end\n # build the chain for roles.\n if role.first == nil # not a chain\n return \"attemping a chain operatioin on an element that is not a chain\"\n end\n this_error = \"\"\n if role.is_a?(Tutrole)\n @role_chain = Tutrole.includes(:tutor, lesson: :slot)\n .where(block: role.block).where.not(first: nil)\n .order(\"slots.timeslot\")\n elsif role.is_a?(Role)\n #@role_chain = Role.where(first: role.first).includes([:student, lesson: :slot])\n @role_chain = Role.includes(:student, lesson: :slot)\n .where(block: role.block).where.not(first: nil)\n .order(\"slots.timeslot\")\n elsif role.is_a?(Lesson)\n @role_chain = Lesson.includes(:slot, roles: :student, tutroles: :tutor)\n .where(first: role.first)\n .order(\"slots.timeslot\")\n end\n # At this point, the chain contains all possible chain segments and each\n # entery in the chain is order by the slot timeslot - correct sequence order\n # for any processing.\n # For lessons, this will be a single chain with no fragments.\n #\n # Do a check on chain integity and buld an index\n # integity check - each element should point to the next one\n # unless it is a segment terminted by next = nil\n flagChainIssue = false\n flagCollectBlock = false\n @role_chain_index = Hash.new # indexes in chain\n @role_chain_index_id = Hash.new # index by id provides the object\n @role_chain_index_date = Hash.new # index by woy provides object\n @role_breakchainlast = nil # provides object in chain prevous to the block\n @role_prevtoblock = nil # ditto\n @role_postblock = nil # provides first role following block\n @block_roles = Array.new # provides chain segment (called block) of interest\n @role_chain.each_with_index do |o, i|\n @role_chain_index[o.id] = i\n @role_chain_index_id[o.id] = o\n if o.is_a?(Lesson)\n @role_chain_index_date[o.slot.timeslot.to_datetime.cweek] = o\n else\n @role_chain_index_date[o.lesson.slot.timeslot.to_datetime.cweek] = o\n end\n if i == @role_chain.length - 1 # last link in chain\n if o.next != nil # corrrupted - should be terminated with next = nil\n flagChainIssue = true\n this_error += role.is_a?(Tutrole) ? 'Tutrole' : 'Role' + \n \" chain issue id: #{o.id} with last linkage. \"\n end\n elsif i < @role_chain.length - 1 # normal chain links (should have next set or nil)\n if flagAll # need to collect rest of chain (e.g. run delete)\n # OK - once started collecting, just keep collecting\n elsif o.next == nil # ending a chain segment\n if @role_chain[i+1].first == o.first # broken linkage - should continue segment\n flagChainIssue = true\n this_error += role.is_a?(Tutrole) ? 'Tutrole' : 'Role' + \n \" chain issue id: #{o.id} with linkage broken within fragment. \"\n else\n # all OK\n end\n else # continueing a chain fragment\n if o.next == @role_chain[i+1].id # linkage is good\n # OK\n else # linkage incorrect\n flagChainIssue = true\n this_error += role.is_a?(Tutrole) ? 'Tutrole' : 'Role' + \n \" chain issue id: #{o.id} with linkages. \"\n end\n end\n end\n unless flagChainIssue\n @role_breakchainlast = o if o.next == role.id\n # Need something better to get prevous link to the block\n if i < @role_chain.length - 1 # not last link in chain\n if @role_chain[i+1].id == role.id # next link starts the block\n @role_prevtoblock = o\n end\n # as the fragment is set when making the call, then the .next == nil\n # is valid for finding the end of the current block.\n # After manipulation this may change as we may relink.\n if @role_chain[i].next == nil && # last link in the chain fragment\n o.first == role.first # in the block segment\n @role_postblock = @role_chain[i+1]\n end\n end\n flagCollectBlock = true if o.id == role.id\n if i < @role_chain.length - 1 && # something post block to break from\n flagCollectBlock && # collecting\n flagSingle # and only collecting one element\n @role_postblock = @role_chain[i+1]\n end\n if flagAll # need to collect rest of chain (e.g. run delete)\n # OK - just keep collecting - don't let it stop collecting\n elsif flagCollectBlock == true && # have been collecting the block\n o.first != role.first # but now just past the block\n flagCollectBlock = false # stop collecting the block \n end\n if flagCollectBlock == true # have been collecting the block\n @block_roles.push(o)\n if flagSingle # When 'run move single element' requested\n flagCollectBlock = false # limit to one element in block_roles\n end\n end\n end\n end\n if this_error.length > 0\n return this_error \n end\n # chain (all segments) is in good shape\n return \"\"\n end", "def build_user_roles(params)\n @roles.each do |role|\n role = role.tableize.singularize\n klass_name = \"Roles::#{role.classify}\"\n if (params[:user][:user_roles][role] == \"1\") &&\n !@user.user_roles.map(&:role_class_name).include?(klass_name)\n @user.user_roles.build(role_class_name: klass_name)\n elsif (params[:user][:user_roles][role] == \"0\") &&\n @user.user_roles.map(&:role_class_name).include?(klass_name)\n user_role = @user.user_roles.find_by_role_class_name(klass_name)\n user_role.destroy\n end\n end\n end", "def create_default_roles\n if self.root?\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Campus Coordinator', _(:position, :ministry_role) => 2)\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Ministry Leader', _(:position, :ministry_role) => 4, :description => 'a student who oversees a campus, eg LINC leader')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Missionary', _(:position, :ministry_role) => 3)\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Student Leader', _(:position, :ministry_role) => 5)\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Involved Student', _(:position, :ministry_role) => 6, :description => 'we are saying has been attending events for at least 6 months')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Student', _(:position, :ministry_role) => 7)\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Registration Incomplete', _(:position, :ministry_role) => 8, :description => 'A leader has registered them, but user has not completed rego and signed the privacy policy')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Approval Pending', _(:position, :ministry_role) => 9, :description => 'They have applied, but a leader has not verified their application yet')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Honourary Member', _(:position, :ministry_role) => 10, :description => 'not a valid student or missionary, but we are giving them limited access anyway')\n self.ministry_roles << ::MinistryRole.create(_(:name, :ministry_role) => 'Admin', _(:position, :ministry_role) => 1)\n end\n true # otherwise subsequent after_create calls will fail\n end", "def add_roleplayer role, entity, type=:workgroup\n xml=self.roleMetadata.ng_xml\n group='person'\n if type == :workgroup\n group='group'\n end\n nodes = xml.search('/roleMetadata/role[@type=\\''+role+'\\']')\n if nodes.length > 0\n group_node=Nokogiri::XML::Node.new(group, xml)\n id_node=Nokogiri::XML::Node.new('identifier', xml)\n group_node.add_child(id_node)\n id_node.content=entity\n id_node['type']=type.to_s\n nodes.first.add_child(group_node)\n else\n node=Nokogiri::XML::Node.new('role', xml)\n node['type']=role\n group_node=Nokogiri::XML::Node.new(group, xml)\n node.add_child group_node\n id_node=Nokogiri::XML::Node.new('identifier', xml)\n group_node.add_child(id_node)\n id_node.content=entity\n id_node['type']=type.to_s\n xml.search('/roleMetadata').first.add_child(node)\n end\n self.roleMetadata.content=xml.to_s\n end", "def assign_role(role)\n if role == 'cm'\n @player = 'codemaker'\n @computer = 'codebreaker'\n announce_role\n elsif role == 'cb'\n @player = 'codebreaker'\n @computer = 'codemaker'\n announce_role\n else\n puts \"Invalid Selection. Either choose 'cb' or 'cm'.\"\n choose_role\n end\n end", "def createAcl(roles)\n header = Nokogiri::XML('<?xml version = \"1.0\" encoding = \"UTF-8\" standalone =\"yes\"?>')\n builder = Nokogiri::XML::Builder.with(header) do |xml|\n xml.Policy('PolicyId' => 'mediapackage-1',\n 'RuleCombiningAlgId' => 'urn:oasis:names:tc:xacml:1.0:rule-combining-algorithm:permit-overrides',\n 'Version' => '2.0',\n 'xmlns' => 'urn:oasis:names:tc:xacml:2.0:policy:schema:os') {\n roles.each do |role|\n xml.Rule('RuleId' => \"#{role[:user]}_#{role[:permission]}_Permit\", 'Effect' => 'Permit') {\n xml.Target {\n xml.Actions {\n xml.Action {\n xml.ActionMatch('MatchId' => 'urn:oasis:names:tc:xacml:1.0:function:string-equal') {\n xml.AttributeValue('DataType' => 'http://www.w3.org/2001/XMLSchema#string') { xml.text(role[:permission]) }\n xml.ActionAttributeDesignator('AttributeId' => 'urn:oasis:names:tc:xacml:1.0:action:action-id',\n 'DataType' => 'http://www.w3.org/2001/XMLSchema#string')\n }\n }\n }\n }\n xml.Condition{\n xml.Apply('FunctionId' => 'urn:oasis:names:tc:xacml:1.0:function:string-is-in') {\n xml.AttributeValue('DataType' => 'http://www.w3.org/2001/XMLSchema#string') { xml.text(role[:user]) }\n xml.SubjectAttributeDesignator('AttributeId' => 'urn:oasis:names:tc:xacml:2.0:subject:role',\n 'DataType' => 'http://www.w3.org/2001/XMLSchema#string')\n }\n }\n }\n end\n }\n end\n\n return builder.to_xml\nend", "def setup_role\n #get_statuses(@role)\n #set_default_status(@role)\n end", "def create\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:role_id])\n access_right_hash = params[:access_right]\n \n if current_user.super_admin\n is_ok = true\n else\n current_user.roles.each { |r|\n r.access_rights.each { |ar|\n puts access_right_hash['model_name']\n if ar.model_name == access_right_hash['model_name'] && ar.action == access_right_hash['action']\n is_ok = true\n end\n }\n }\n end\n \n respond_to do |format|\n if is_ok\n @access_right = @role.access_rights.create(params[:access_right])\n @access_right.company_id = current_user.company_id\n @access_right.save\n format.html { redirect_to company_role_path(@company, @role) }\n else\n format.html { redirect_to company_role_path(@company, @role), notice: 'Usted no puede conceder este permiso.' }\n end\n end\n end", "def create\n submenu_item 'role_new'\n load_permissions\n ids=params[:permissions].select{|k,v| v=='1'}.map { |k,v| k.to_i } unless params[:permissions].nil?\n if ids.length > 0\n permissions=Permission.find(:all, :conditions => [\"id in (#{ids.join(',')})\"])\n params[:role][:permissions] = permissions\n @role = Role.new(params[:role])\n if @role.save\n flash[:notice] = \"创建角色成功\"\n redirect_to :action => 'index'\n else\n flash[:error] = \"创建角色失败\"\n render :action => 'new'\n end\n else\n flash[:error] = \"角色名或权限不能为空\"\n redirect_to :action => 'new'\n end\n\n end", "def role_params\n params.require(:role).permit(:name, :description, roles_rights_attributes: [ :id, :access_level, :right_id])\n end", "def assign_role\n store_roles.destroy_all\n \n case x_brokerstaff \n when \"Broker\"\n push_broker_storerole\n when \"Staff\"\n push_staff_storerole\n when \"Broker/Staff\"\n push_staff_storerole && push_broker_storerole\n end\n end", "def roleid\n [ account, kind, identifier ].join(':')\n end", "def generate_responsibilities\n set_positions\n set_team_members\n create_responsibilities\n\n\n\n assign_responsibilities\n\n # assign_team_members\n end", "def initialize(party, party_role_kind_key)\n \t@party = party\n \t@party_role_kind_key = party_role_kind_key\n\n\t\t\t@party_role_kind = nil\n \t@party_role = nil\n\n \tfind_party_role_kind\n \tbuild_party_role\n end", "def addrole\n\t\tself.add_role :Guest\n\tend", "def name_and_role\n instructors.map do |instructors_hash|\n {instructors_hash[:name] => instructors_hash[:role]}\n end\nend", "def role(rolekey, &block)\n raise \"role name must be a symbol\" unless rolekey.is_a?(Symbol)\n create_role_from(rolekey, &block)\n define_reader_for_role(rolekey)\n define_mate_roleplayers_readers_after_newrole(rolekey)\n end", "def create\r\n @role = Role.new(role_params)\r\n @role.save\r\n end", "def initialize(params)\n raise 'No companyid given' unless (params[:companyid] or params[:company])\n raise 'No name given' unless params[:name]\n\n super(params)\n\n # COPY role_ (roleid, companyid, classnameid, classpk, name, description, type_) FROM stdin;\n # +10151\t10109\t0\t0\tRegular role\tThis role is a test\t1\n\n self.classnameid ||= 0\n self.classpk ||= 0\n self.description ||= ''\n # Type: 1 = regular, 2 = community, 3 = organization\n self.type_ ||= 1\n\n self.save\n\n # Resource with code scope 1 is primkey'd to company.\n # Resource with code scope 4 is primkey'd to this role.\n\n # These are created regardless of what type_ is.\n\n # COPY resourcecode (codeid, companyid, name, scope) FROM stdin;\n # +29\t10109\tcom.liferay.portal.model.Role\t1\n # +30\t10109\tcom.liferay.portal.model.Role\t4\n\n [1,4].each do |scope|\n rc = self.resource_code(scope)\n unless rc\n ResourceCode.create(\n Company.primary_key => self.companyid,\n :name => self.liferay_class,\n :scope => scope\n )\n end\n end\n\n # COPY resource_ (resourceid, codeid, primkey) FROM stdin;\n # +33\t29\t10109\n # +34\t30\t10151\n\n self.get_resource(:scope => 1)\n r = self.get_resource(:scope => 4)\n\n # Permissions (given to administrators)\n\n # COPY permission_ (permissionid, companyid, actionid, resourceid) FROM stdin;\n # +70 10109 ASSIGN_MEMBERS 34\n # +71 10109 DEFINE_PERMISSIONS 34\n # +72 10109 DELETE 34\n # +73 10109 MANAGE_ANNOUNCEMENTS 34\n # +74 10109 PERMISSIONS 34\n # +75 10109 UPDATE 34\n # +76 10109 VIEW 34\n\n # COPY users_permissions (userid, permissionid) FROM stdin;\n # +10129\t70\n # +10129\t71\n # +10129\t72\n # +10129\t73\n # +10129\t74\n # +10129\t75\n # +10129\t76\n\n self.class.actions.each do |actionid|\n p = Permission.get(\n :companyid => self.companyid,\n :actionid => actionid,\n :resourceid => r.id\n )\n self.company.administrators.each do |user|\n user.permissions << p\n end\n end\n end", "def clone\n a_clone = super\n a_clone.send(:instance_variable_set, :@role_symbols, @role_symbols.clone) if @role_symbols\n a_clone\n end", "def makec\n @user.add_role :celebrity\n render nothing: true\n end", "def role(*args)\n cap_role(*args)\n puppet_role(*args)\n end", "def create\n chef_server_rest.post(\"roles\", self)\n self\n end", "def create\n #@payrole = Payrole.new(params[:payrole])\n @payrole = @shift.payroles.build(params[:payrole])\n\n respond_to do |format|\n if @payrole.save\n flash[:notice] = t('payrole.created')\n format.html { redirect_to user_shift_path(@user, @shift) }\n format.xml { render :xml => @payrole, :status => :created, :location => @payrole }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payrole.errors, :status => :unprocessable_entity }\n end\n end\n end", "def merge_roles\n combined_roles = secondary_roles << primary_role\n combined_roles.uniq\n end" ]
[ "0.62585205", "0.62585205", "0.62585205", "0.62133557", "0.6185055", "0.61586076", "0.6136967", "0.6100749", "0.60865206", "0.60797864", "0.60781956", "0.60495305", "0.6003415", "0.596219", "0.596219", "0.5944483", "0.59308213", "0.5923134", "0.59135056", "0.58353037", "0.5820721", "0.5810936", "0.5800894", "0.5781083", "0.5759373", "0.56892097", "0.5656686", "0.5631164", "0.56290764", "0.559261", "0.5591481", "0.55804104", "0.5564794", "0.5542556", "0.55421716", "0.55231047", "0.5517382", "0.5513509", "0.5504072", "0.5495533", "0.5492474", "0.54914343", "0.54771036", "0.54702294", "0.54698277", "0.54629564", "0.54576826", "0.5456693", "0.5454725", "0.5451063", "0.54472655", "0.54307765", "0.54189575", "0.54186684", "0.53773564", "0.5374384", "0.53682774", "0.53615016", "0.5353986", "0.53504485", "0.5341983", "0.5331958", "0.53262067", "0.53172165", "0.53108203", "0.531036", "0.53078634", "0.53074676", "0.5302559", "0.5302559", "0.52909297", "0.52852786", "0.52825564", "0.52749515", "0.5271834", "0.5270553", "0.52646154", "0.52565855", "0.5254985", "0.5253198", "0.5245527", "0.52454364", "0.52411854", "0.52382314", "0.5237785", "0.52342343", "0.5223437", "0.5220028", "0.521805", "0.5216184", "0.5216163", "0.5215834", "0.52144355", "0.5212352", "0.52102894", "0.51984113", "0.5197225", "0.51911706", "0.5191138", "0.51909053" ]
0.6964274
0
A method for building pair from value/role pair with wrapper
def build_pair_div_wrap value_pair, role_pair pairs = build_pair_div(value_pair, role_pair) pair_role = mk_pair_role(role_pair) div_block(pairs, pair_role) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mk_pair_role rpair, plural=false\n suffix = plural ? 's' : ''\n \"#{rpair.join(UBAR)}_pair#{suffix}\"\n end", "def build_pairs_div value_pairs, role_pair\n pairs = value_pairs.map{|pair|build_pair_div_wrap(pair, role_pair)}\n pairs_role = mk_pair_role(role_pair, true)\n div_block(pairs, pairs_role)\n end", "def pair=(_arg0); end", "def build_pair_div value_pair, role_pair\n value_pair.zip(role_pair).map{|v,r|div_inline(v,r)}\n end", "def create_role_from(key, &block)\n roles.merge!(key => create_role_subclass_from(key, &block))\n end", "def build_pair *args\n args = args.to_a unless args.respond_to? :each_slice\n args.each_slice(2).map{|name,var| \"#{name} [#{var}]\" }.join(' ')\n end", "def make_nested_pairs(*args)\n if args.size == 0\n return nil\n end\n Pair.new(args[0], make_nested_pairs(*args[1..-1]))\n end", "def build_map(value)\n { \"_type\" => type_key, \"_value\" => value }\n end", "def build_hash(key,val)\n hash = {}\n stanzas.each do |el|\n tv = el.tagvalues\n case val\n when nil\n hash[tv[key].first] = el\n when Symbol\n hash[tv[key].first] = (el.send(val))\n else\n hash[tv[key].first] = tv[val].first\n end\n end\n hash\n end", "def transform_attr(key, value); end", "def named_tuple(name, keys, values = keys)\n Struct.new(name, *keys.map(&:to_sym)).new(*values.map(&:to_s))\n end", "def to_marchash\n [@tag, @value]\n end", "def initialize(type, value)\n @value = Hash[type: type, value: value]\n end", "def build(key_name, value={})\n kv = KeyValue.new(self, key_name)\n kv.value = value\n kv\n end", "def pair; end", "def mutate(aPair)\n\t\treturn MutateToken.new(aPair.keys.first, aPair.values.first)\n\tend", "def after_pair(node)\n key, value = value_stack.pop\n\n return unless key\n\n member = Definition::RubyObject.new(\n :name => key.value.to_s,\n :type => :member,\n :value => value\n )\n\n push_value(member)\n end", "def parse_key_value\n to_transaction { to_h }\n end", "def initialize pairs, **options\n super **options\n @pairs = pairs.map { |k, v|\n [k, NRSER::Types.make( v )]\n }.to_h.freeze\n end", "def build(tuple)\n tuple.keys.each do |k|\n (class << self; self; end).send(:define_method, k) do\n @tuple[k]\n end\n end\n end", "def creator\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: creator_ordered, values: values )\n return values\n end", "def wrap_in_name_values_hash(name_hash_array)\n name_values_hash_array = []\n name_hash_array.each do |name_hash| \n name_values_hash_array << { name: type_name_from_slot(name_hash), values: [name_hash] } \n end\n name_values_hash_array\n end", "def wrap value, _message_hash, _label\n value\n end", "def prepare_value(value)\n {uuid => value}\n end", "def name_and_role\n instructors.map do |instructors_hash|\n {instructors_hash[:name] => instructors_hash[:role]}\n end\nend", "def to_h\n Hash[members.map(&:to_sym).zip(values)]\n end", "def pair_params\n end", "def with_authentication_hash(auth_type, auth_values); end", "def make_authentication_details(details)\n self.vendor_code = details['vendor_code']\n self.sync_applicable = details['sync_applicable']\n self.integration_id = details['integration_id']\n self.integration_vector = details['integration_vector']\n end", "def createuser(clazz, info, gender, location, pass = 'webeng12')\n ret = clazz.new\n info.each_pair do |k, v|\n ret[k] = v\n end\n ret.gender = Gender.find_by_sex(gender)\n ret.location = Location.find_by_postal_code(location)\n ret.password, ret.password_confirmation = pass, pass \n ret\nend", "def modify_values\n each_with_object self.class.new do |hash_pair, ꜧ|\n ꜧ[ hash_pair[0] ] = yield( hash_pair )\n end\n end", "def filter_value_convert_role(key, val)\n val = [\"customer\", \"writer\", \"editor\", \"administrator\", \"sysadmin\"][val.to_i] if key == :role && (val.class == Fixnum)\n return val\n end", "def _reduce_9(val, _values, result)\n @handler.pair(val[0].to_sym, val[2]) \n result\nend", "def add_to_hash hash = { }\n hash[self.class.value_name] = code\n if respond_to?(:uuid) \n hash[self.class.value_name_uuid] = initialize_uuid!\n end\n hash\n end", "def map_value(converted_value:)\n calling_mapper.for(\n Property.new(\n value.subject,\n value.key,\n converted_value,\n value.adapter,\n value.resource\n )\n ).result\n end", "def _reduce_544(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def _reduce_551(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def accessor_pair(init =nil)\r\n value = init\r\n getter = lambda { value }\r\n setter = lambda{|x| value = x}\r\n return getter,setter\r\nend", "def creator\n values = super\n values = MetadataHelper.ordered( ordered_values: self.creator_ordered, values: values )\n return values\n end", "def creator\n values = super\n values = MetadataHelper.ordered( ordered_values: self.creator_ordered, values: values )\n return values\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def build_from_hash(value)\n # We do not validate that the value is one of the enums set in the OpenAPI\n # file because we want to be able to add to our list of enums without\n # breaking this client library.\n value\n end", "def parse_pair\n parse_string &&\n spaces &&\n must_see(\":\") &&\n spaces &&\n # We may have to fill in a rhs *null*.\n (parse_value || append('null'))\n end", "def create_single_attribute_value(label_attribute, att_value, l_object, l_type) \n \t\tAttributeValue.create(:label_attribute_id => label_attribute,\n :value => att_value ,\n :object_id => l_object.id ,\n :object_type => l_type)\n end", "def build_userinfo\n @password_value ? \"#{@user_value}:#{@password_value}\" : @user_value if @user_value\n end", "def build_from_hash(attributes)\n\n end", "def with_values\n each_with_object self.class.new do |(k, v), hsh| hsh[ k ] = yield v end\n end", "def _reduce_554(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def _reduce_546(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def process_attribute(key, value)\n return super unless key == :value\n\n @built[:value] = value\n nil\n end", "def transform_attr(key, value)\n if value.is_a? Array\n sub_attrs = value.map do |sub_prop|\n sub_prop.map { |k, v| transform_attr(k, v) }\n end\n \"<w:#{key}>#{sub_attrs.join}</w:#{key}>\"\n elsif value.is_a? Hash\n props = value.map { |k, v| format('w:%s=\"%s\"', k, v) if v }\n \"<w:#{key} #{props.compact.join(' ')} />\"\n else\n value = format('w:val=\"%s\" ', value) if value\n \"<w:#{key} #{value}/>\"\n end\n end", "def transform_attr(key, value)\n if value.is_a? Array\n sub_attrs = value.map do |sub_prop|\n sub_prop.map { |k, v| transform_attr(k, v) }\n end\n \"<w:#{key}>#{sub_attrs.join}</w:#{key}>\"\n elsif value.is_a? Hash\n props = value.map { |k, v| format('w:%s=\"%s\"', k, v) if v }\n \"<w:#{key} #{props.compact.join(' ')} />\"\n else\n value = format('w:val=\"%s\" ', value) if value\n \"<w:#{key} #{value}/>\"\n end\n end", "def naked_tuple_from_row row, type\n\t\tnaked_tuple get_row_cells(row), type\n\tend", "def pair= pair\n protected_use_method(MM::Pairs.new, :@pair, pair)\n end", "def _wrapper_key; end", "def accessor_pair(initialvalue = nill)\n value = initialvalue\n getter = lambda { value }\n setter = lambda { |x| value = x }\n return getter,setter\nend", "def _reduce_546(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n\n result\nend", "def key_maker(hash, key, value)\n case\n when value.include?(\"true\")\n value = true\n when value.include?(\"false\")\n value = false\n when value.to_i > 0 && value.length < 4\n value = value.to_i\n when value == \"0\"\n value = value.to_i\n else\n value\n end\n hash.store(key.to_sym, value)\nend", "def each_pair(&block)\n return to_enum(__callee__) unless block_given?\n @parameters.each_pair do |key, value|\n yield [key, convert_hashes_to_parameters(key, value)]\n end\n\n self\n end", "def _reduce_552(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def cat_builder(name_str, color_str, age_num)\n return {\"name\" => name_str, \"color\" => color_str, \"age\" => age_num}\nend", "def my_hash_creator(key, value)\n # return a hash that includes the key and value parameters passed into this method\n {key => value}\nend", "def convert_value(value)\n case value\n when VividMash, AttrArray\n value\n when Hash\n VividMash.new(value, __root__, __node__, __precedence__)\n when Array\n AttrArray.new(value, __root__, __node__, __precedence__)\n else\n value\n end\n end", "def build_symrec(num, name, value, seg, type)\n\t\tsym = Hash.new\n\t\t\n\t\tsym[:symno] = num\n\t\tsym[:name] = name\n\t\tsym[:value] = value\n\t\tsym[:seg] = seg\n\t\tsym[:type] = type\n\t\treturn sym\n\tend", "def _reduce_6(val, _values, result)\n @handler.tag_pairs[val[1].downcase.to_sym] = val[2][1..-2] \n result\nend", "def dress(value, handler = DressHelper.new)\n handler.failed!(self, value) unless value.is_a?(Hash)\n\n # Uped values, i.e. tuple under construction\n uped = {}\n\n # Check the tuple arity and fail fast if extra attributes\n # (missing attributes are handled just after)\n if value.size > heading.size\n extra = value.keys.map(&:to_s) - heading.map{|attr| attr.name.to_s }\n handler.fail!(\"Unrecognized attribute `#{extra.first}`\")\n end\n\n # Up each attribute in turn now. Fail on missing ones.\n heading.each do |attribute|\n val = attribute.fetch_on(value) do\n handler.fail!(\"Missing attribute `#{attribute.name}`\")\n end\n handler.deeper(attribute.name) do\n uped[attribute.name] = attribute.type.dress(val, handler)\n end\n end\n\n uped\n end", "def pairs\n Pair.with_member_id(id)\n end", "def _reduce_589(val, _values, result)\n name = val[1].to_sym\n self.assignable name\n result = :\"**#{name}\"\n\n result\nend", "def _reduce_549(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def _reduce_550(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def new_value(value)\n AwesomeObject.new(self, value)\n end", "def _reduce_552(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n\n result\nend", "def to_h\n parent ? parent.to_h.merge(pairing) : pairing.dup\n end", "def construct_attribs_payload( orcid, oauth_access, oauth_renew, oauth_scope, user_types )\n h = {}\n\n h['orcid'] = orcid\n h['oauth_access_token'] = oauth_access\n h['oauth_refresh_token'] = oauth_renew\n h['user_types'] = user_types\n h['scope'] = oauth_scope\n\n #puts \"==> #{h.to_json}\"\n return h.to_json\n end", "def _reduce_518(val, _values, result)\n result = @builder.accessible(val[0])\n \n result\nend", "def value_helper_code(type, code, system, display)\n value_el = Ox::Element.new(:value)\n value_el['xsi:type'] = type\n value_el['code'] = code\n value_el['codeSystem'] = system\n value_el['displayName'] = display\n value_el\n end", "def claim_pair(key, value)\n new_key = key.to_s.downcase.split(\"_\").map{|l| l.capitalize.strip}.join(\"\")\n value = [value].flatten.uniq.join(\",\")\n [new_key, value.to_s].map{|s| CGI.escape(s)}.join(\"=\")\n end", "def build_payload\n return nil unless valid?\n\n model_wrapper = self.class.singular_name.to_sym\n payload = {}\n wrapper = payload[model_wrapper] = {}\n\n self.schema.each do |name, attribute|\n if attribute.write_access?(self)\n value = attribute.value_or_default(self)\n required = attribute.required?(self)\n\n if required or !value.nil?\n wrapper[name] = value\n end\n end\n end\n\n payload\n end", "def memorize_resource_value resource, attr\n klass, instance = parse_resource_args resource\n value = instance.send(attr)\n @_memorized ||= {}\n @_memorized[resource] ||= {}\n @_memorized[resource][attr] = value\n value\nend", "def key=(value); end", "def parse_pair(name_element, value_element)\n result = {}\n begin\n name_element_spec = get_spec(name_element) or return result\n value_element_spec = get_spec(value_element) or return result\n\n name_xpath = \"//#{name_element_spec['node']}\"\n name_nodes = xml_doc.xpath(name_xpath)\n\n name_nodes.each do |name_node|\n name_text = name_node.text rescue ''\n value_text = ''\n\n parent_node = name_node.parent\n\n parent_node.children.each do |child_node|\n if child_node.name == value_element_spec['node']\n value_text = child_node.text\n end\n end\n\n if !name_text.blank?\n result[name_text] = value_text \n end\n end\n rescue ArgumentError => err\n # warn \"Warn: in parse_pair: #{err}\"\n end\n\n result\n end", "def to_generate_tuple(&block_)\n if block_\n @gen_tuple = block_\n else\n @gen_tuple\n end\n end", "def get_attr_value(value, opts)\n case value\n when OvirtSDK4::List\n value.to_a\n when Array, Hash, DateTime\n value\n when OvirtSDK4::HighAvailability\n opts[:ha] = value.enabled\n value\n when OvirtSDK4::TemplateVersion\n OpenStruct.new(:version_name => value.version_name, :version_number => value.version_number)\n when OvirtSDK4::Mac\n value.address\n when OvirtSDK4::Cpu\n opts[:cores] = value.topology.nil? ? nil : value.topology.cores\n opts[:sockets] = value.topology.nil? ? nil : value.topology.sockets\n when OvirtSDK4::Display\n subject = value.certificate.subject if value.certificate\n {\n :type => value.type,\n :address => value.address,\n :port => value.port,\n :secure_port => value.secure_port,\n :keyboard_layout => value.keyboard_layout,\n :subject => subject,\n :monitors => value.monitors\n }\n when OvirtSDK4::Console\n { :enabled => value.enabled }\n else\n if value.class.respond_to?(:module_parent) && value.class.module_parent == OvirtSDK4\n value.id if value.respond_to?(:id)\n else\n value.to_s.strip\n end\n end\n end", "def key_coercions=(_arg0); end", "def __to_catalog_tuple\n d = options[:default]\n {:namespace => relvar.namespace.name, \n :relvar => relvar.name, \n :name => name, \n :domain => domain.to_s,\n :default => d.nil? ? nil : domain.__rubyrel_to_physical_value(d)}\n end", "def value(key, value)\n factory(key, -> { value })\n end", "def visit_wrap(attribute)\n name = attribute.name\n keys = attribute.tuple_keys\n\n compose do |ops|\n ops << t(:nest, name, keys)\n ops << visit_hash(attribute)\n end\n end", "def _reduce_595(val, _values, result)\n name = val[1].to_sym\n self.assignable name\n result = :\"**#{name}\"\n\n result\nend", "def new_top_level(school, key, value)\n school[key.to_sym] = value\nend", "def _reduce_593(val, _values, result)\n name = val[1].to_sym\n self.assignable name\n result = :\"**#{name}\"\n\n result\nend" ]
[ "0.59162253", "0.5388208", "0.53568834", "0.533363", "0.5213542", "0.5195389", "0.5173027", "0.5168893", "0.5117218", "0.5106408", "0.5083076", "0.50314116", "0.502287", "0.5006043", "0.49951914", "0.4966905", "0.49592146", "0.49050304", "0.48869196", "0.4883868", "0.487864", "0.48748842", "0.48733228", "0.48726922", "0.48648742", "0.485837", "0.48516074", "0.48192334", "0.47691798", "0.4759561", "0.4690948", "0.46856242", "0.4668402", "0.46540847", "0.46534255", "0.46489772", "0.4632854", "0.4630017", "0.46269214", "0.46269214", "0.46246728", "0.46246728", "0.46246728", "0.46246728", "0.46246728", "0.46246728", "0.46246728", "0.46246728", "0.46246728", "0.46246728", "0.46246728", "0.46230322", "0.46213907", "0.4618215", "0.461789", "0.4608681", "0.46064615", "0.4604053", "0.4597359", "0.457856", "0.45698947", "0.45698947", "0.4568955", "0.45663762", "0.45657575", "0.45630825", "0.45558846", "0.45500627", "0.4542989", "0.4541817", "0.45401186", "0.45385498", "0.4528507", "0.45284554", "0.45232528", "0.4511949", "0.450749", "0.45061505", "0.45020887", "0.4497055", "0.44896328", "0.4488744", "0.44832528", "0.4478921", "0.4477026", "0.44748813", "0.44732273", "0.4466164", "0.44647318", "0.44606665", "0.4459511", "0.4456579", "0.44565013", "0.4456151", "0.44560423", "0.4453381", "0.44530308", "0.44507098", "0.44483453", "0.4443378" ]
0.6228006
0
A method for building pairs from value/role pairs
def build_pairs_div value_pairs, role_pair pairs = value_pairs.map{|pair|build_pair_div_wrap(pair, role_pair)} pairs_role = mk_pair_role(role_pair, true) div_block(pairs, pairs_role) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_pair_div value_pair, role_pair\n value_pair.zip(role_pair).map{|v,r|div_inline(v,r)}\n end", "def name_and_role\n instructors.map do |instructors_hash|\n {instructors_hash[:name] => instructors_hash[:role]}\n end\nend", "def build_pair_div_wrap value_pair, role_pair\n pairs = build_pair_div(value_pair, role_pair)\n pair_role = mk_pair_role(role_pair)\n div_block(pairs, pair_role)\n end", "def build_pair *args\n args = args.to_a unless args.respond_to? :each_slice\n args.each_slice(2).map{|name,var| \"#{name} [#{var}]\" }.join(' ')\n end", "def mk_pair_role rpair, plural=false\n suffix = plural ? 's' : ''\n \"#{rpair.join(UBAR)}_pair#{suffix}\"\n end", "def nyc_pigeon_organizer_two(data)\n# MAP will return a changed value, EACH will return original\n\n # coerce each name as the key in the hash\n #access all names\n #names - ['']\n # unique list of names\n names = data.values[0].values.flatten.uniq\n\n # use name as key in hash - fill in with scaffold hash\n initial_structure = names.each_with_object ({}) do |name, hash|\n hash[name] = {color: [], gender: [], lives:[]}\n end\n\n names.each_with_object(initial_structure) do |pigeon, my_initial_structure|\n attributes = data.keys\n attributes.each do |attribute|\n data[attribute].each do |value, names|\n if names.include?(pigeon)\n my_initial_structure[pigeon][attribute] << value.to_s\n end\n end\n end\n end\n\n\nend", "def make_nested_pairs(*args)\n if args.size == 0\n return nil\n end\n Pair.new(args[0], make_nested_pairs(*args[1..-1]))\n end", "def build_pairs_div_from_lines value_pair_lines, role_pair, rsep=CR, csep=BAR\n value_pairs = value_pair_lines.split(rsep).map{|row|row.split(csep, 2)}\n build_pairs_div(value_pairs, role_pair)\n end", "def car_model(keys,values)\n combo = keys.zip(values)\n puts combo\nend", "def to_h\n Hash[members.map(&:to_sym).zip(values)]\n end", "def pair_params\n end", "def solution2(pairs)\r\n # TODO: complete\r\n pairs.map{|k,v| \"#{k} = #{v}\"}.join(',')\r\nend", "def challenger_tuple(i)\n {:people => i, :algorithm => \"chal#{i}\", :creation_time => Time.now}\n end", "def pair; end", "def organize_schools(schools)\n\n nyc = []\n sf = []\n chicago = []\n\n schools.each do |key, value|\n\n if value.values == [\"NYC\"]\n nyc << key\n elsif value.values == [\"SF\"]\n sf << key\n elsif value.values == [\"Chicago\"]\n chicago << key\n end\n\n end\n\n{\"NYC\" => nyc, \"SF\" => sf, \"Chicago\" => chicago}\nend", "def build_key_values(qh)\n # @key_values = {}\n # @query_map = []\n # @counter = 0\n\n qh.each_with_index do |ha,i|\n ha[1] = ha[1].to_a\n query_tag = []\n ha[1].each do |v|\n @key_values[\"-q#{@counter}\"] = ha[0]\n @key_values[\"-q#{@counter}.value\"] = v\n query_tag << \"q#{@counter}\"\n @counter += 1\n end\n @query_map << query_tag\n end\n return @key_values, @query_map\n end", "def build_groups\n groups = {}\n roles = %w[client server initial]\n roles.each do |role|\n groups[role] = build_roles(role)\n end\n groups\n end", "def reduce_list(args)\n args.reduce({}) do |memo, a|\n memo[a.name] = NAMED_VALUES.include?(a.value.class) ? a.value.name : a.value\n memo\n end\n end", "def create_managers managers_to_be\n \n i = 0 \n 1.upto(managers_to_be.length-1) do\n \n @managers[DEPTS[i].to_s.to_sym] = managers_to_be[i][0] #Eg. {:Finance => \"Simon Moffatt\"}\n \n i += 1 #move on to next value\n \n end \n \nend", "def build_hash(key,val)\n hash = {}\n stanzas.each do |el|\n tv = el.tagvalues\n case val\n when nil\n hash[tv[key].first] = el\n when Symbol\n hash[tv[key].first] = (el.send(val))\n else\n hash[tv[key].first] = tv[val].first\n end\n end\n hash\n end", "def triples\n requesters, approvers, observers = partitioned_roles\n requesters = requesters.map { |role| [role.user, \"Requester\", nil] }\n approvers = approvers.map { |role| [role.user, \"Approver\", nil] }\n observers = observers.map { |role| [role.user, nil, observation_for(role.user)] }\n\n requesters + approvers + observers\n end", "def perform(key, value)\n result = []\n key.each_with_index do |k, v|\n result << {k => (value)[v]} #On push dans l'array une portion de hash composer de: key = symbol_text et value = price_text[v] \n end\n puts result\n return result\nend", "def to_marchash\n [@tag, @value]\n end", "def nyc_pigeon_organizer(data)\n #get all the variables you need \n #use pry to check \n #set up what will be taking in your values \n #then use conditionals \"if this is the case give it if not ignore it\"\n new_hash = {}\n data.each do |attribute,attribute_hash| \n attribute_hash.each do |key, array_names| \n #info = purple..,male...,subway...\n array_names.each do |name|\n #array_names = [\"Alex\", \"Theo\"]\n new_hash[name] ||= {} #returns true if you already have a value assigned\n #does this name exist for a particular attribute if so set up its array?\n### We've made the list of bird names with empty hashes\n###those hashes will contain keyvalue pairs of color gender and lives \n### now we need to update new hash at each name with their value pairs \n new_hash[name][attribute] ||= [] \n if array_names.include?(name)\n new_hash[name][attribute] << key.to_s\n \n end\n end\n end\n end\n return new_hash\nend", "def pairs\n seq = to_a\n seq.zip([*seq[1..-1], unit.advance(to)])\n end", "def pairs\n Pair.with_member_id(id)\n end", "def label_value_pairs\n result = @defaults.values.select {|default| default.item_label}\n .map {|default| [\"#{default.item_label}:\", default.value_printable]}\n yield result if block_given?\n result\n end", "def get_pairs v1, v2\n [v1, v2].map {|x| @pair.call(x)}\n end", "def pair=(_arg0); end", "def to_pairs\n each_pair.to_a\n end", "def _reduce_6(val, _values, result)\n @handler.tag_pairs[val[1].downcase.to_sym] = val[2][1..-2] \n result\nend", "def each_pair(&block)\n return to_enum(__callee__) unless block_given?\n @parameters.each_pair do |key, value|\n yield [key, convert_hashes_to_parameters(key, value)]\n end\n\n self\n end", "def build_roles(role)\n results = @machines.reject { |m| [*m['role']].grep(role).empty? }\n rolesarray = []\n results.each do |machine|\n rolesarray.push(machine['name'])\n end\n rolesarray\n end", "def transform\n {\n 'name' => names,\n 'org' => org,\n 'other' => other_data,\n 'associates' => associates,\n 'xref' => xref,\n\n # these are lists with zero or more members; duplicates allowed; member order is arbitrary (so we pick\n # a standardized order for list comparison purposes)\n 'phones' => phones,\n 'addresses' => addresses,\n 'emails' => emails,\n 'links' => links\n }.reject {|k,v| v.nil? || v.empty?}\n end", "def generatePairs\n for i in 0...@parameters.paramsArr.length-1 do \n for j in i+1 ...@parameters.paramsArr.length do\n tmppairs = Pairs.new i,j\n for k in 0...@parameters.paramsArr[i].elementsArr.length do\n for h in 0...@parameters.paramsArr[j].elementsArr.length do \n tmppair = Pair.new k,h #there we store the index of value but not the true value\n @parameters.paramsArr[i].elementsArr[k].addTimes\n @parameters.paramsArr[j].elementsArr[h].addTimes\n tmppairs.addPair tmppair #temppairs just like ABpairs not all AB AC BC\n \n end\n end\n @pairs << tmppairs #@pairs is all the pairs like AB AC BC \n end\n end\n\n #if has limit then update the pairs with limit conditions\n if @haslimit\n \tputs \"update pairs with limit....\"\n updatePairsWithLimit\n end\n end", "def pairs(f1, f2)\r\n\t\ttemp = Array.new\r\n\t\t@parameters[f1].values.each do |value1|\r\n\t\t\t@parameters[f2].values.each do |value2|\r\n\t\t\t\ttemp << (Run.new.elements << value1 << value2)\r\n\t\t\tend\r\n\t\tend\r\n\t\ttemp\r\n\tend", "def _reduce_26(val, _values, result)\n result = s(:masgn, val[0], s(:to_ary, val[2]))\n \n result\nend", "def create_attrib_item_values \n @base_attribs = []\n @attribs = params[:attrib]\n @attribs.keys.each do | key |\n @base_attribs << AttribItemValue.new(attrib_id: key, value: @attribs[key])\n #puts \"AttribItemValue: #{@base_attribs.last.attrib.id}, #{@base_attribs.last.value}\"\n end if @attribs\n #puts \"Attribs: #{@attribs}, @base_attribs: #{@base_attribs.size}\"\n modified_item_parms = item_params\n modified_item_parms[:attrib_values] = @base_attribs\n modified_item_parms\n end", "def _reduce_9(val, _values, result)\n @handler.pair(val[0].to_sym, val[2]) \n result\nend", "def to_lazy_pairs(slots)\n slots.each_cons(2)\n end", "def cars(keys, values)\n\tkeys + values\nend", "def parse_pair(name_element, value_element)\n result = {}\n begin\n name_element_spec = get_spec(name_element) or return result\n value_element_spec = get_spec(value_element) or return result\n\n name_xpath = \"//#{name_element_spec['node']}\"\n name_nodes = xml_doc.xpath(name_xpath)\n\n name_nodes.each do |name_node|\n name_text = name_node.text rescue ''\n value_text = ''\n\n parent_node = name_node.parent\n\n parent_node.children.each do |child_node|\n if child_node.name == value_element_spec['node']\n value_text = child_node.text\n end\n end\n\n if !name_text.blank?\n result[name_text] = value_text \n end\n end\n rescue ArgumentError => err\n # warn \"Warn: in parse_pair: #{err}\"\n end\n\n result\n end", "def produce_info(hsh)\n info_arr = []\n\n hsh.each_value do |description|\n\n if description[:type] == \"fruit\"\n color_arr = description[:colors].map { |color| color.capitalize }\n info_arr << color_arr\n end\n\n if description[:type] == \"vegetable\"\n info_arr << description[:size].upcase\n end\n\n # description.each do |characteristic, adjective|\n # if adjective == \"fruit\"\n # puts \"found a fruit\"\n # end\n # if characteristic == :colors\n # color_arr = adjective.map { |color| color.capitalize }\n\n # info_arr << color_arr\n # end\n # end\n end \n\n info_arr\nend", "def generate_entry(hash,type)\n entry = []\n for group in hash.keys\n if(group == \"no_group\") #no_group means all choices are mandatory\n for child_comp in hash[group]\n entry.push(\"#{type}:#{child_comp.id}\")\n end\n else #otherwise choose one of the grouped members\n group_group = \"#{type}\"\n for child_comp in hash[group]\n if(!(type==\"v\" && hash[group].length == 1)) #manditory valuefields are not prepended with :\n group_group += \":\"\n end\n group_group += \"#{child_comp.id}\"\n end\n entry.push(group_group)\n end\n end\n #logger.info(\"\\n\\n\\n\\n\\n entry:#{entry} join:#{entry.join(\"|\")} \\n\\n\\n\\n\\n\\n\")\n entry.join(\"|\")\n end", "def wrap_in_name_values_hash(name_hash_array)\n name_values_hash_array = []\n name_hash_array.each do |name_hash| \n name_values_hash_array << { name: type_name_from_slot(name_hash), values: [name_hash] } \n end\n name_values_hash_array\n end", "def build_map(value)\n { \"_type\" => type_key, \"_value\" => value }\n end", "def apply(tuple)\n Tools.tuple_collect(tuple){|k,v| [@renaming[k] || k, v]}\n end", "def hash_to_pairs(hash)\n a = hash.keys\n b = hash.values\n \n print a.zip(b)\nend", "def pairs\n @pieces.combination(2).to_a\n end", "def pairs\n @pieces.combination(2).to_a\n end", "def make_hash(attrs)\n hashes = {}\n skip_next = false\n attrs.each_with_index do |attr, index|\n if skip_next\n skip_next = false\n next\n end\n if attr.class == Array and attr.size == 2\n hashes[attr[0]] = attr[1]\n else\n unless index == attrs.size-1\n hashes[attr] = attrs[index + 1]\n skip_next = true\n end\n end\n end\n hashes\n end", "def _reduce_612(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n result.sexp_type = :hash\n\n result\nend", "def _reduce_612(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n result.sexp_type = :hash\n\n result\nend", "def _reduce_612(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n result.sexp_type = :hash\n\n result\nend", "def assign_nested_parameter_attributes(pairs)\n pairs.each { |k, v| _assign_attribute(k, v) }\n end", "def assign_nested_parameter_attributes(pairs)\n pairs.each { |k, v| _assign_attribute(k, v) }\n end", "def compound(series, control, *keys)\n new_series = {}\n series.each do |uuid, name_series|\n new_series[uuid] = {}\n name_series.each do |name, subseries|\n # default to all subkeys of the compound value if no keys were specified by the user\n if keys.none? and FIELDS[name]\n nkeys = FIELDS[name]\n else\n nkeys = keys\n end\n\n # procs are defined above for exploding / translating compact lists into key/value pairs\n if TRANSLATE[name]\n new_subseries = {}\n subseries.each do |ts,val|\n new_subseries[ts] = TRANSLATE[name].call val\n end\n subseries = new_subseries\n\n # the list of keys is variable per-system, unless given a list of keys,\n # set the list of keys to match what was seen on the system\n nkeys = subseries.first.last.keys\n\n # but if the user has said which key they want, try to return just what they requested\n # only allow matching on the first field though, not the expanded fields\n # e.g. compound(cpu) is ok but compound(cpu.user) isn't\n if keys.any?\n nkeys = nkeys.select { |nk| keys.include?(nk.split('.')[-2]) or keys.include?(nk) }\n end\n end\n\n # now flatten the key/values into many series for output\n nkeys.each do |key|\n new_name = \"#{name}.#{key}\"\n new_series[uuid][new_name] = {}\n subseries.each do |ts,hash|\n # a bug in agent versions < 0.24 puts some fields in arrays that should be, fix on the fly\n # TODO(al) remove hack after 2012-10-01 or so\n new_series[uuid][new_name][ts] = hash[key].respond_to?(:pop) ? hash[key].pop : hash[key]\n end\n end\n end\n end\n return new_series, control\n end", "def _reduce_551(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def merge_player_info(keys,values)\n counter = 0\n players_hash = {}\n keys.each do |key|\n players_hash[key] = values[counter]\n counter += 1\n end\n players_hash\nend", "def merge_data(argu, argu2)\n names = argu[0]\n names2 = argu[1]\n\n argu2.each do |nested_hash|\n nested_hash.each do |name, hash|\n hash.each do |key, value|\n if name == \"blake\"\n names[key] = value\n elsif name == \"ashley\"\n names2[key] = value\n end\n end\n end\n end\n\n new_array = []\n new_array << names\n new_array << names2\n new_array\nend", "def embed_property_value_list( property_value_list )\n count = 1 \n property_value_list.each do |property_value_pair|\n PropertyValue.create(:item_id => self.id, \n :property_id => property_value_pair[:property_id],\n :value_id => property_value_pair[:value_id],\n :position => count)\n count += 1 \n end\n end", "def create_role_from(key, &block)\n roles.merge!(key => create_role_subclass_from(key, &block))\n end", "def sample_example__define_contexts\n define_contexts [\n {\n \"role\" => [\"role_3\", \"role_4\"],\n \"authenticate_as\"=> [\"role_1\", \"role_2\"],\n \"result\"=> [\n Proc.new { |h|\n \"#{h[\"authenticate_as\"]} ALLOWED to create #{h[\"role\"]}\"\n }\n ],\n },\n {\n \"role\" => [\"role_1\", \"role_2\", \"role_3\", \"role_4\"] - [\"role_3\", \"role_4\"],\n \"authenticate_as\"=> [\"role_1\", \"role_2\"],\n \"result\"=> [\n Proc.new { |h|\n \"#{h[\"authenticate_as\"]} NOT ALLOWED to create #{h[\"role\"]}\"\n }\n ],\n },\n ]\n end", "def reconstruct_inputs(chain)\n tested_inputs = Hash.new\n chain.scan(/([A-Z])=(\\S*)/).each do |item|\n if tested_inputs[item.first]\n tested_inputs[item.first] = [tested_inputs[item.first].first, item.last]\n else\n tested_inputs[item.first] = [item.last, nil]\n end\n end\n Hash[tested_inputs.values]\nend", "def create_amenities\n amenities_hash = {\n 'Additional Items' => [\"Additional Towels\", \"Additional Linens\", \"Extra Bed\", \"Vacuum Cleaner\", \"Rice Cooker\", \"Bluetooth Speaker\", \"Phone Charger\", \"Salt & Pepper\"],\n 'Essentials' => [\"Wifi\", \"Heating\", \"A/C\", \"First Aid Kit\"],\n 'Bed & Bath' => [\"Tooth Brush\", \"Comb\", \"Razor\", \"Washer\", \"Hairdryer\", \"Iron\", \"Towels & Linens\", \"Hangers\"],\n 'Kitchen' => [\"Dishwasher\", \"Pots & Pans\", \"Plates & Glassware\", \"Cutlery\"],\n 'Other' => [\"TV\", \"Desk & Chair\", \"Lobby Coffee Bar\", \"Slippers\"]\n }\n \n amenities_hash.each_pair do |category, amenities|\n amenities.each do |amenity|\n Amenity.create(\n name: amenity,\n category: category\n )\n end\n end\nend", "def each_pair(*) end", "def generate_course_memberships(section_rows, instructor_row)\n enrollments = []\n section_rows.each do |section_row|\n enrollments << {\n 'course_id' => section_row['course_id'],\n 'user_id' => instructor_row['user_id'],\n 'role' => 'teacher',\n 'section_id' => section_row['section_id'],\n 'status' => 'active'\n }\n end\n enrollments\n end", "def merge_players_info(keys,values_hash)\n\nplayers_hash = {}\nvalues_hash.each do |players, info|\n players_hash[players]= merge_player_info(keys,info)\nend\nplayers_hash\nend", "def process_pair_list list, hash\n list = list[1..-2] # Remove square brackets\n if list.class == NilClass\n list = \"\"\n end\n array = list.split /\\s*,\\s*\\(/\n array.each do |pair|\n pair.delete! \"(\"\n pair.delete! \")\"\n components = pair.split /\\s*,\\s*/\n hash[components[0]] = components[1]\n end\n end", "def triples\n requesters, approvers, observers = self.partitioned_roles\n requesters = requesters.map { |r| [r.user, \"Requester\", nil] }\n approvers = approvers.map { |r| [r.user, \"Approver\", nil] }\n observers = observers.map { |r| [r.user, nil, self.observation_for(r.user)] }\n\n requesters + approvers + observers\n end", "def category_key_value_pairs\n categories.collect{|k,v| [k,v['sCategory']]} rescue []\n end", "def hvals(key); end", "def hvals(key); end", "def _reduce_618(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n result.sexp_type = :hash\n\n result\nend", "def filter_value_convert_role(key, val)\n val = [\"customer\", \"writer\", \"editor\", \"administrator\", \"sysadmin\"][val.to_i] if key == :role && (val.class == Fixnum)\n return val\n end", "def create_sequence_word_pairs dict_words\n pairs_array = []\n\n dict_words.each do |original|\n derived_seqs = extract_sequences_from_original_word original\n\n derived_seqs.each do |seq|\n pair = [seq, original]\n pairs_array << pair\n end\n end\n\n pairs_array\n end", "def value_map\n value_pairs = tags.map { |t| [t.value, t.character] }\n mapping = new_hash_of_arrays\n value_pairs.each do |value, character|\n mapping[value] << character\n end\n mapping.map { |value, characters|\n [value, characters.sort_by { |c| c.name }]\n }.sort\n end", "def build_properties\n properties.each do |key,val|\n prop = listing_properties.find_or_initialize_by(key:key)\n prop.value = val\n\n end\n end", "def getRestaurantTuples()\n\t@cheesies = IDTuple.new('@CheesiesChicago', 'cheesies-pub-and-grub-chicago')\n\t@niusushi = IDTuple.new('@SushiNiu','niu-japanese-fusion-lounge-chicago')\n\t@bob = IDTuple.new('@thebaronbuena','bar-on-buena-chicago')\n\t#@michaels = IDTuple.new('','michaels-pizzeria-and-tavern-chicago-2') #Now here's a business thats not on twitter yet. Womp womp.\n\t@polkstreet = IDTuple.new('@PolkPub', 'polk-street-pub-chicago')\n\t@fatcat = IDTuple.new('@FatCatChicago', 'fat-cat-chicago')\n\treturn [@cheesies, @niusushi, @bob, @polkstreet, @fatcat]\nend", "def _reduce_721(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n result.sexp_type = :hash\n\n result\nend", "def _reduce_610(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n result.sexp_type = :hash\n\n result\nend", "def _reduce_211(val, _values, result)\n result = @builder.assign(val[0], val[1], val[2])\n \n result\nend", "def _reduce_613(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n result.sexp_type = :hash\n\n result\nend", "def _reduce_613(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n result.sexp_type = :hash\n\n result\nend", "def solution(pairs)\n puts pairs\n pairs.each.map{|k,v| \"#{k}: #{v}\"}.join(\",\")\nend", "def build_map\n\t\t\tfor i in(0..2)\n\t\t\t\tfor j in (0..2)\n\t\t\t\t\tnewcase = Case.new(i, j, nil)\n\t\t\t\t\tget_cases << newcase\n\t\t\t\t\tmap = get_map\n\t\t\t\t\tmap[[i, j]] = newcase\n\t\t\t\t\tset_map(map)\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def _reduce_544(val, _values, result)\n @static_env.declare val[1][0]\n\n result = [ @builder.kwrestarg(val[0], val[1]) ]\n \n result\nend", "def my_hash_splitting_method(hash, age)\n under_age = []\n over_age = []\n hash.each do |key, value|\n value <= age ? over_age << [key, value] : under_age << [key, value]\n end\n [over_age, under_age]\nend", "def finals_mapping(id, role, match_count)\n role = { home: 0, guest: 1 }[role] if role.is_a? Symbol\n id + match_count*role \n end", "def _reduce_247(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n \n result\nend", "def get_array_final(name,value)\n\thash_final = Hash[name.zip(value.map)]\n\treturn hash_final\nend", "def _reduce_619(val, _values, result)\n list = val[0].dup\n more = val[2].sexp_body\n list.push(*more) unless more.empty?\n result = list\n result.sexp_type = :hash\n\n result\nend", "def environment_item prefix, key, value\n {Oaf::Util.prepare_key(prefix, key) => Oaf::Util.flatten(value)}\n end", "def transform_values\n map_to_hash { |key, value| [key, yield(value)] }\n end", "def pairs(**)\n enumerations.dig(type, :pairs)\n end", "def each_pair\n @mset.each_pair do |key, group|\n case group\n when Array \n group.each do |value|\n yield key, value\n end\n else\n yield key, group\n end\n end\n end", "def make_option_list\n @data = @option.values\n if @data.is_a?(Hash)\n @keys = @data.keys\n @data = @data.values\n end\n end", "def make_option_list\n @data = @option.values\n if @data.is_a?(Hash)\n @keys = @data.keys\n @data = @data.values\n end\n end", "def claim_pair(key, value)\n new_key = key.to_s.downcase.split(\"_\").map{|l| l.capitalize.strip}.join(\"\")\n value = [value].flatten.uniq.join(\",\")\n [new_key, value.to_s].map{|s| CGI.escape(s)}.join(\"=\")\n end", "def _reduce_211(val, _values, result)\n result = @builder.assign(val[0], val[1], val[2])\n\n result\nend" ]
[ "0.5974998", "0.5954997", "0.5874744", "0.58200455", "0.57611865", "0.56762534", "0.5483481", "0.5413726", "0.5370455", "0.52961326", "0.52205336", "0.52002585", "0.5186629", "0.51411694", "0.5134376", "0.51082295", "0.50833225", "0.5066729", "0.50467646", "0.5042951", "0.5009941", "0.4983352", "0.49598885", "0.49585363", "0.49568623", "0.4948512", "0.49423638", "0.49390796", "0.4904513", "0.48971298", "0.4896072", "0.48924163", "0.4887367", "0.48630604", "0.4860822", "0.47812998", "0.47684768", "0.47625625", "0.47602138", "0.47536716", "0.47520357", "0.47485822", "0.47476405", "0.47387198", "0.4718789", "0.47051", "0.47031873", "0.46951756", "0.46923894", "0.46923894", "0.46888003", "0.46807787", "0.46807787", "0.46807787", "0.46728808", "0.46710122", "0.46680027", "0.46625912", "0.46587464", "0.46415406", "0.46411306", "0.46346885", "0.4633657", "0.4627634", "0.46218875", "0.46211648", "0.46128097", "0.46065706", "0.46063018", "0.46003598", "0.45999724", "0.45990646", "0.45990646", "0.45972094", "0.45949018", "0.45917487", "0.45906344", "0.45838925", "0.4583799", "0.45837274", "0.45822176", "0.45759994", "0.45722917", "0.45722917", "0.45686147", "0.45667842", "0.4562301", "0.45615053", "0.45570925", "0.45565283", "0.45479792", "0.45478025", "0.45463717", "0.45457944", "0.454271", "0.45418328", "0.45415875", "0.45415875", "0.45362228", "0.45354244" ]
0.61040854
0
A method for building pairs from value pairs string and role pairs
def build_pairs_div_from_lines value_pair_lines, role_pair, rsep=CR, csep=BAR value_pairs = value_pair_lines.split(rsep).map{|row|row.split(csep, 2)} build_pairs_div(value_pairs, role_pair) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mk_pair_role rpair, plural=false\n suffix = plural ? 's' : ''\n \"#{rpair.join(UBAR)}_pair#{suffix}\"\n end", "def build_pair *args\n args = args.to_a unless args.respond_to? :each_slice\n args.each_slice(2).map{|name,var| \"#{name} [#{var}]\" }.join(' ')\n end", "def name_and_role\n instructors.map do |instructors_hash|\n {instructors_hash[:name] => instructors_hash[:role]}\n end\nend", "def build_pairs_div value_pairs, role_pair\n pairs = value_pairs.map{|pair|build_pair_div_wrap(pair, role_pair)}\n pairs_role = mk_pair_role(role_pair, true)\n div_block(pairs, pairs_role)\n end", "def build_pair_div value_pair, role_pair\n value_pair.zip(role_pair).map{|v,r|div_inline(v,r)}\n end", "def build_pair_div_wrap value_pair, role_pair\n pairs = build_pair_div(value_pair, role_pair)\n pair_role = mk_pair_role(role_pair)\n div_block(pairs, pair_role)\n end", "def nyc_pigeon_organizer_two(data)\n# MAP will return a changed value, EACH will return original\n\n # coerce each name as the key in the hash\n #access all names\n #names - ['']\n # unique list of names\n names = data.values[0].values.flatten.uniq\n\n # use name as key in hash - fill in with scaffold hash\n initial_structure = names.each_with_object ({}) do |name, hash|\n hash[name] = {color: [], gender: [], lives:[]}\n end\n\n names.each_with_object(initial_structure) do |pigeon, my_initial_structure|\n attributes = data.keys\n attributes.each do |attribute|\n data[attribute].each do |value, names|\n if names.include?(pigeon)\n my_initial_structure[pigeon][attribute] << value.to_s\n end\n end\n end\n end\n\n\nend", "def solution2(pairs)\r\n # TODO: complete\r\n pairs.map{|k,v| \"#{k} = #{v}\"}.join(',')\r\nend", "def make_nested_pairs(*args)\n if args.size == 0\n return nil\n end\n Pair.new(args[0], make_nested_pairs(*args[1..-1]))\n end", "def organize_schools(schools)\n\n nyc = []\n sf = []\n chicago = []\n\n schools.each do |key, value|\n\n if value.values == [\"NYC\"]\n nyc << key\n elsif value.values == [\"SF\"]\n sf << key\n elsif value.values == [\"Chicago\"]\n chicago << key\n end\n\n end\n\n{\"NYC\" => nyc, \"SF\" => sf, \"Chicago\" => chicago}\nend", "def process_pair_list list, hash\n list = list[1..-2] # Remove square brackets\n if list.class == NilClass\n list = \"\"\n end\n array = list.split /\\s*,\\s*\\(/\n array.each do |pair|\n pair.delete! \"(\"\n pair.delete! \")\"\n components = pair.split /\\s*,\\s*/\n hash[components[0]] = components[1]\n end\n end", "def pair_params\n end", "def parse_pair\n parse_string &&\n spaces &&\n must_see(\":\") &&\n spaces &&\n # We may have to fill in a rhs *null*.\n (parse_value || append('null'))\n end", "def convert_attrs(str, attrs, exclusive = false)\n convert_attrs_matching_word_pairs(str, attrs, exclusive)\n convert_attrs_word_pair_map(str, attrs, exclusive)\n end", "def car_model(keys,values)\n combo = keys.zip(values)\n puts combo\nend", "def challenger_tuple(i)\n {:people => i, :algorithm => \"chal#{i}\", :creation_time => Time.now}\n end", "def reconstruct_inputs(chain)\n tested_inputs = Hash.new\n chain.scan(/([A-Z])=(\\S*)/).each do |item|\n if tested_inputs[item.first]\n tested_inputs[item.first] = [tested_inputs[item.first].first, item.last]\n else\n tested_inputs[item.first] = [item.last, nil]\n end\n end\n Hash[tested_inputs.values]\nend", "def create_sequence_word_pairs dict_words\n pairs_array = []\n\n dict_words.each do |original|\n derived_seqs = extract_sequences_from_original_word original\n\n derived_seqs.each do |seq|\n pair = [seq, original]\n pairs_array << pair\n end\n end\n\n pairs_array\n end", "def parse_pair(name_element, value_element)\n result = {}\n begin\n name_element_spec = get_spec(name_element) or return result\n value_element_spec = get_spec(value_element) or return result\n\n name_xpath = \"//#{name_element_spec['node']}\"\n name_nodes = xml_doc.xpath(name_xpath)\n\n name_nodes.each do |name_node|\n name_text = name_node.text rescue ''\n value_text = ''\n\n parent_node = name_node.parent\n\n parent_node.children.each do |child_node|\n if child_node.name == value_element_spec['node']\n value_text = child_node.text\n end\n end\n\n if !name_text.blank?\n result[name_text] = value_text \n end\n end\n rescue ArgumentError => err\n # warn \"Warn: in parse_pair: #{err}\"\n end\n\n result\n end", "def claim_pair(key, value)\n new_key = key.to_s.downcase.split(\"_\").map{|l| l.capitalize.strip}.join(\"\")\n value = [value].flatten.uniq.join(\",\")\n [new_key, value.to_s].map{|s| CGI.escape(s)}.join(\"=\")\n end", "def _reduce_6(val, _values, result)\n @handler.tag_pairs[val[1].downcase.to_sym] = val[2][1..-2] \n result\nend", "def build_groups\n groups = {}\n roles = %w[client server initial]\n roles.each do |role|\n groups[role] = build_roles(role)\n end\n groups\n end", "def build_key_values(qh)\n # @key_values = {}\n # @query_map = []\n # @counter = 0\n\n qh.each_with_index do |ha,i|\n ha[1] = ha[1].to_a\n query_tag = []\n ha[1].each do |v|\n @key_values[\"-q#{@counter}\"] = ha[0]\n @key_values[\"-q#{@counter}.value\"] = v\n query_tag << \"q#{@counter}\"\n @counter += 1\n end\n @query_map << query_tag\n end\n return @key_values, @query_map\n end", "def perform(key, value)\n result = []\n key.each_with_index do |k, v|\n result << {k => (value)[v]} #On push dans l'array une portion de hash composer de: key = symbol_text et value = price_text[v] \n end\n puts result\n return result\nend", "def transform\n {\n 'name' => names,\n 'org' => org,\n 'other' => other_data,\n 'associates' => associates,\n 'xref' => xref,\n\n # these are lists with zero or more members; duplicates allowed; member order is arbitrary (so we pick\n # a standardized order for list comparison purposes)\n 'phones' => phones,\n 'addresses' => addresses,\n 'emails' => emails,\n 'links' => links\n }.reject {|k,v| v.nil? || v.empty?}\n end", "def build_hash(key,val)\n hash = {}\n stanzas.each do |el|\n tv = el.tagvalues\n case val\n when nil\n hash[tv[key].first] = el\n when Symbol\n hash[tv[key].first] = (el.send(val))\n else\n hash[tv[key].first] = tv[val].first\n end\n end\n hash\n end", "def nyc_pigeon_organizer(data)\n #get all the variables you need \n #use pry to check \n #set up what will be taking in your values \n #then use conditionals \"if this is the case give it if not ignore it\"\n new_hash = {}\n data.each do |attribute,attribute_hash| \n attribute_hash.each do |key, array_names| \n #info = purple..,male...,subway...\n array_names.each do |name|\n #array_names = [\"Alex\", \"Theo\"]\n new_hash[name] ||= {} #returns true if you already have a value assigned\n #does this name exist for a particular attribute if so set up its array?\n### We've made the list of bird names with empty hashes\n###those hashes will contain keyvalue pairs of color gender and lives \n### now we need to update new hash at each name with their value pairs \n new_hash[name][attribute] ||= [] \n if array_names.include?(name)\n new_hash[name][attribute] << key.to_s\n \n end\n end\n end\n end\n return new_hash\nend", "def to_h\n Hash[members.map(&:to_sym).zip(values)]\n end", "def aai_strings one_way_aai, two_way_aai\n aai_strings = {}\n keys = (one_way_aai.keys + two_way_aai.keys).\n map { |key| key.sort }.uniq\n\n keys.each do |key|\n a_to_b_aai = one_way_aai[key] || \"NA\"\n b_to_a_aai = one_way_aai[key.reverse] || \"NA\"\n two_way = two_way_aai[key] || \"NA\"\n\n aai_strings[key] = [a_to_b_aai,\n b_to_a_aai,\n two_way]\n end\n\n aai_strings.map do |genome_pair, aais|\n [genome_pair, aais].flatten.join \"\\t\"\n end\n end", "def build_roles(role)\n results = @machines.reject { |m| [*m['role']].grep(role).empty? }\n rolesarray = []\n results.each do |machine|\n rolesarray.push(machine['name'])\n end\n rolesarray\n end", "def reconstruct_inputs(chain)\n tested_inputs = Hash.new\n chain.scan(/([A-Z])=\"?([^\\s\"]*)/).each do |item|\n if tested_inputs[item.first]\n tested_inputs[item.first] = [tested_inputs[item.first].first, item.last]\n else\n tested_inputs[item.first] = [item.last, nil]\n end\n end\n Hash[tested_inputs.values]\nend", "def apply(values)\n values = values.map do |key, value|\n key = key.upcase if uppercase_fields.include?(key)\n value = \"#{value}\".upcase if uppercase_fields.include?(\"#{key}\")\n\n [key, value]\n end\n\n formatted_string % Hash[values]\n end", "def wrap_in_name_values_hash(name_hash_array)\n name_values_hash_array = []\n name_hash_array.each do |name_hash| \n name_values_hash_array << { name: type_name_from_slot(name_hash), values: [name_hash] } \n end\n name_values_hash_array\n end", "def add_role( xml, person, role )\n\n if user_role_exists?(xml, role)\n puts \"Would not add role to \" + person[:netids][0] + ' (' + person[:uin] + '), role already exists ' + role.to_s\n\n else\n puts \"Adding role, \" + role.to_s + \" to \" + person[:netids][0] + ' (' + person[:uin] + ')'\n role_node = xml.create_element( 'user_role' )\n\n role_node.add_child( xml.create_element 'status', 'ACTIVE' )\n role_node.add_child( xml.create_element 'scope', role[:scope] )\n role_node.add_child( xml.create_element 'role_type', role[:id] )\n\n if role[:parameters]\n\n parameters = xml.create_element( 'parameters')\n\n role[:parameters].each do |type,value|\n \n parameter = xml.create_element( 'parameter')\n \n parameter.add_child( xml.create_element 'type', type ) \n parameter.add_child( xml.create_element 'value', value ) \n\n parameters.add_child( parameter )\n \n end\n\n role_node.add_child( parameters )\n end\n\n user_roles = xml.xpath( '/user/user_roles' ).first.add_child( role_node )\n\n \n \n end\nend", "def generate_entry(hash,type)\n entry = []\n for group in hash.keys\n if(group == \"no_group\") #no_group means all choices are mandatory\n for child_comp in hash[group]\n entry.push(\"#{type}:#{child_comp.id}\")\n end\n else #otherwise choose one of the grouped members\n group_group = \"#{type}\"\n for child_comp in hash[group]\n if(!(type==\"v\" && hash[group].length == 1)) #manditory valuefields are not prepended with :\n group_group += \":\"\n end\n group_group += \"#{child_comp.id}\"\n end\n entry.push(group_group)\n end\n end\n #logger.info(\"\\n\\n\\n\\n\\n entry:#{entry} join:#{entry.join(\"|\")} \\n\\n\\n\\n\\n\\n\")\n entry.join(\"|\")\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 label_value_pairs\n result = @defaults.values.select {|default| default.item_label}\n .map {|default| [\"#{default.item_label}:\", default.value_printable]}\n yield result if block_given?\n result\n end", "def create_managers managers_to_be\n \n i = 0 \n 1.upto(managers_to_be.length-1) do\n \n @managers[DEPTS[i].to_s.to_sym] = managers_to_be[i][0] #Eg. {:Finance => \"Simon Moffatt\"}\n \n i += 1 #move on to next value\n \n end \n \nend", "def pairs\n letters = split('')\n pairs = []\n letters.each.with_index do |letter, i|\n next_letter = letters[i + 1]\n pairs << letter + next_letter unless next_letter.nil?\n end\n pairs\n end", "def sample_example__define_contexts\n define_contexts [\n {\n \"role\" => [\"role_3\", \"role_4\"],\n \"authenticate_as\"=> [\"role_1\", \"role_2\"],\n \"result\"=> [\n Proc.new { |h|\n \"#{h[\"authenticate_as\"]} ALLOWED to create #{h[\"role\"]}\"\n }\n ],\n },\n {\n \"role\" => [\"role_1\", \"role_2\", \"role_3\", \"role_4\"] - [\"role_3\", \"role_4\"],\n \"authenticate_as\"=> [\"role_1\", \"role_2\"],\n \"result\"=> [\n Proc.new { |h|\n \"#{h[\"authenticate_as\"]} NOT ALLOWED to create #{h[\"role\"]}\"\n }\n ],\n },\n ]\n end", "def ldap_convert(attributes)\n attributes.reject { |param, value| value == :absent or param == :ensure }.inject({}) do |result, ary|\n value = (ary[1].is_a?(Array) ? ary[1] : [ary[1]]).collect { |v| v.to_s }\n result[ldap_name(ary[0])] = value\n result\n end\n end", "def build_relationship_token_map\n rel_map = HashExtra[Hash.new{|h,k| h[k] = Set.new}]\n my_name = name_sym.to_s # no leading module names\n relationships.each do |(rel_name,)|\n toks = (rel_name.split('_') - [my_name])\n toks.each{|tok| rel_map[tok].add(rel_name)}\n end\n rel_map\n end", "def value_map\n value_pairs = tags.map { |t| [t.value, t.character] }\n mapping = new_hash_of_arrays\n value_pairs.each do |value, character|\n mapping[value] << character\n end\n mapping.map { |value, characters|\n [value, characters.sort_by { |c| c.name }]\n }.sort\n end", "def filter_value_convert_role(key, val)\n val = [\"customer\", \"writer\", \"editor\", \"administrator\", \"sysadmin\"][val.to_i] if key == :role && (val.class == Fixnum)\n return val\n end", "def pair_and_hash_from_rdn( rdn )\n\t\tinitial, *trailing = rdn.split( '+' )\n\t\tinitial_pair = initial.split( /\\s*=\\s*/ )\n\t\ttrailing_pairs = trailing.inject({}) do |hash,pair|\n\t\t\tk,v = pair.split( /\\s*=\\s*/ )\n\t\t\thash[ k ] = v\n\t\t\thash\n\t\tend\n\n\t\treturn initial_pair + [ trailing_pairs ]\n\tend", "def solution(pairs)\n puts pairs\n pairs.each.map{|k,v| \"#{k}: #{v}\"}.join(\",\")\nend", "def token_tuples(type)\n results = get_tokens(type)\n results.map do |app_result|\n token_fields(type).map do |field|\n app_result[field]\n end.transpose\n end.flatten(1)\nend", "def normalize\n inject({}) do |hash, kv|\n k, v = kv\n v = v.is_a?(Array) ? v.join(',') : v.to_s\n hash[k.to_s.split('_').map {|w| w[0, 1] = w[0, 1].upcase; w }.join] = v\n hash\n end\n end", "def merge_data(argu, argu2)\n names = argu[0]\n names2 = argu[1]\n\n argu2.each do |nested_hash|\n nested_hash.each do |name, hash|\n hash.each do |key, value|\n if name == \"blake\"\n names[key] = value\n elsif name == \"ashley\"\n names2[key] = value\n end\n end\n end\n end\n\n new_array = []\n new_array << names\n new_array << names2\n new_array\nend", "def pair; end", "def meta_to_hash(str)\n key_pairs = str.split(',')\n h_kp = {}\n key_pairs.each do | kp |\n a_kp = kp.split('=')\n key = a_kp[0]\n val = a_kp[1]\n h_kp[key] = val if val != nil\n end\n return h_kp\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{\\n\" + pairs.join(\",\\n\") + \"\\n}\"\n end", "def produce_info(hsh)\n info_arr = []\n\n hsh.each_value do |description|\n\n if description[:type] == \"fruit\"\n color_arr = description[:colors].map { |color| color.capitalize }\n info_arr << color_arr\n end\n\n if description[:type] == \"vegetable\"\n info_arr << description[:size].upcase\n end\n\n # description.each do |characteristic, adjective|\n # if adjective == \"fruit\"\n # puts \"found a fruit\"\n # end\n # if characteristic == :colors\n # color_arr = adjective.map { |color| color.capitalize }\n\n # info_arr << color_arr\n # end\n # end\n end \n\n info_arr\nend", "def reduce_list(args)\n args.reduce({}) do |memo, a|\n memo[a.name] = NAMED_VALUES.include?(a.value.class) ? a.value.name : a.value\n memo\n end\n end", "def nested_values(attribute, hash)\n hash.inject('') do |all,(key,value)|\n attribute_with_name = \"#{attribute}-#{key.to_s.tr('_', '-')}\"\n all << if value.is_a?(Hash)\n nested_values(attribute_with_name, value)\n else\n %(#{attribute_with_name}=\"#{escape_value(value)}\" )\n end\n end\n end", "def comma_pair_list(hash)\n hash.inject([]) { |list, pair| list << \"#{pair.first} = #{pair.last}\" }.join(\", \")\n end", "def argumentos(args)\n\thash = Hash.new\n\targs.each do |arg| \n\t\thash[arg.split('=').first] = arg.split('=').second\n\tend \n\treturn hash\nend", "def party_role_kind_pairing\n errors.add(:party_role_kinds, \"must provide a specific role pair\") unless party_role_kinds.size == 2\n\n end", "def create_list(input_string)\n input_arr = input_string.split(\" \")\n new_shopping_list = Hash.new\n new_shopping_list = Hash[input_arr.collect{|item, | [item, 1]}]\nend", "def split_merged_tag_values!(key1, key2, seperator)\n if self[key1] =~ Regexp.new(\"([^#{seperator}]+)#{seperator}([^#{seperator}]+)\")\n self[key1],self[key2]= $1,$2\n end\n end", "def pair=(_arg0); end", "def apply(tuple)\n Tools.tuple_collect(tuple){|k,v| [@renaming[k] || k, v]}\n end", "def map_values(values)\n values = values.split(/,\\s*/) if values.is_a?(String)\n values.map do |value|\n yield value\n end.join(\",\") \n end", "def get_matching_rules(matching_rules)\n values = \"\"\n tags = \"\"\n\n matching_rules.each do |this_match|\n\n this_match.each do |key, value|\n\n if key == \"value\" then\n values = values + value + \",\"\n end\n\n if key == \"tag\" then\n if !value.nil? then\n tags = tags + value + \",\"\n end\n end\n end\n end\n\n return values.chomp(\",\"), tags.chomp(\",\")\n end", "def mixed_pairs\nend", "def hash_to_pairs(hash)\n a = hash.keys\n b = hash.values\n \n print a.zip(b)\nend", "def get_pairs v1, v2\n [v1, v2].map {|x| @pair.call(x)}\n end", "def mk_attr_str **attr_map\n attr_map.map{|k,v|\" #{k}='#{v}'\"}.join\n end", "def to_s\n pairs = inject([]) do |strs, (k, v)|\n strs << \"#{k.to_s} => #{v.to_s}\"\n end\n \"{#{pairs.join(\", \")}}\"\n end", "def build_literals(hsh)\n hsh.each_with_object({}) do |(key, value), output|\n next if key.end_with?(\"_lang\")\n next if key.end_with?(\"_type\")\n output[key] = SolrValue.for(Property.new(key, value, hsh)).result\n end\n end", "def search(roles_in, roles_out)\n\n# roles_in is a hash, keyed by the role names. Each hash value is the specifications for that role. These specs say, for\n# example, what values the attributes of each entity in that role must have for that entity to play that role in the\n# relationship. In general, these specs can be complicated, but for now (Jan 2010) we'll limit ourselves to simple\n# specs.\n\n# For now 3 types of specs are allowed, :key_single_value, :key_range, and :general.\n\n# Meaning (if quantifier for roles_in is :all for every input role): for every relationship in this relset such that\n# all the entities in the input roles satisfy the given constraints, output the entities in the roles_out specs.\n# For simplicity just allow 1 constraint, at most, per role right now!! To be generalized, of course.\n\n # Need a place to accumulate relationship objects\n relationships = Array.new\n\n first_role_considered = true\n roles_in.each_pair{|role_name, role_specs|\n # for each role, compute the entity set name and the entity set\n puts 'Processing role ' + role_name.to_s\n puts '@role_desc_hash is ' + @role_desc_hash.inspect\n esname = @role_desc_hash[role_name]\n puts 'esname = ' + esname\n es = @currentdb.hes[esname]\n if role_specs[:spec_type] == :key_single_value # single key value, but of course each key attrib must have a value\n if role_specs[:specs].class != Array # single spec\n puts 'Single spec for this role, which means KEY must have SINGLE ATTRIBUTE'\n puts 'Put it in an array of length 1 and proceed!'\n givenspecs = role_specs[:specs]\n role_specs[:specs] = Array.new\n role_specs[:specs].push givenspecs\n end\n # Now get to the entity based on the given key\n # Must first parse the given array elements for the key attributes!\n numkeys = @currentdb.hes[esname].keyattribnames.size\n puts \"number of key attributes is #{numkeys}\"\n if role_specs[:specs].size != numkeys\n puts \"ACHTUNG: size of role specs, #{role_specs[:specs].size}, is not equal to number of key attributes, quitting\"\n exit\n end\n \n # Find the entity keyed by the given key attributes, and find the array of all relationships in the relevant relset (self)\n # with this entity serving in this role!\n entity = es.hashofentities # entity will eventually refer to the entity keyed by the given attribute values\n role_specs[:specs].each{|spec| # the specs are just the values of the key attributes\n puts \"Processing spec = #{spec.to_s}\"\n entity = entity[spec]\n puts \"entity just became #{entity.to_s}\"\n } # each\n # ensure that the variable 'entity' points to an entity!\n puts \"Arrived at this entity: #{entity.to_s}\" \n if entity.class != Entity\n puts \"Something's wrong! The variable called entity points to an object of class #{entity.class.to_s}\"\n exit\n end # if, inner\n if first_role_considered\n first_role_considered = false\n if entity.relationships[self].class == Array\n puts 'Inaugurating the relationships array!'\n relationships = entity.relationships[self]\n else\n puts 'First role considered but entity.relationships[self] is not an Array'\n relationships.push (entity.relationships[self])\n end # if, inner\n \n puts \"Just made relationships array = #{relationships.to_s}\"\n else\n puts 'Must correct this part of the code because either operand of the & operator may not be an Array!'\n relationships = relationships & entity.relationships[self] # intersect existing relationship set (Array) with incoming one\n puts \"Hey, just made relationships array = #{relationships.to_s}\"\n end # if, inner\n\n else\n puts 'Role type not yet implemented, sorry!'\n exit\n end # if\n \n } # role_in.each_pair\n \n # Now do something with the relationship set obtained!!!\n puts 'Will have the code the part where we look at the output specs LATER!!'\n puts 'For now, here are the relationships obtained:'\n relationships.each_with_index{|r,i|\n puts \"Relationship number #{i}:\"\n r.show\n }\n end", "def _reduce_9(val, _values, result)\n @handler.pair(val[0].to_sym, val[2]) \n result\nend", "def property_values_to_solr(pairs)\n pairs.map do |(property, value)|\n [solr_field(property), value]\n end\n end", "def switchPairs(strings)\n highest_index = strings.length - 1\n i = 0\n until i == highest_index\n strings[i], strings[i + 1] = strings[i + 1], strings[i] if i % 2 == 0\n i += 1\n end\n return strings\nend", "def list_students\n #code here \n # First redo hash to list last name first\n # and format into array to get only name and email values\n s = []\n @students.each do |stu|\n \tn = ''\n stu.each do |k,v| \n # *** instead of this process stu[:name] & stu[:email] ***\n #puts \"**key = #{k}, value = #{v}\"\n if (k == :name) #want every other value (only names not emails)\n \tn = v.split(' ')\n tmp = n[0]\n n[0] = n[1]\n n[1] = tmp\n n = n.join(\" \")\n else\n #puts \"pushing #{n}, #{v}\"\n \t#s.push({name: n, email: v})\n \ts.push(n + \", \" + v)\n\t end\n end\n end\n\n #@students.reverse.sort_by {|n| n[:name] } #this sorts by 1st name given the original hash array\n return s.sort\nend", "def reqd_params_only_result\n combinations = []\n reqd_params = get_reqd_params_and_values\n # logger.info \"===============\"+reqd_params.to_s\n reqd_params.each do |k, v|\n if(!v.nil? || k.empty?) \n v.each do |i|\n v[v.index(i)] = k.to_s + \"=\" + v[v.index(i)]\n end\n end \n combinations << v\n end\n # @combinations = @combinations.first.product(*@combinations[1..-1]).map(&:join)\n variations(combinations) unless !combinations\nend", "def initialize string_args, value #this @value is a hash where the keys are monster, player, item, and maptype\r\n case string_args #will store the value of whatever is in that room at that moment\r\n when 'n' #will be in this order {monster: [], player: [], item: [], maptype: xxxx}\r\n self.north value #will start with default values\r\n when 's'\r\n self.south value\r\n when 'w'\r\n self.west value\r\n when 'e'\r\n self.east value\r\n when 'ne'\r\n self.northeast value\r\n when 'nw'\r\n self.northwest value\r\n when 'sw'\r\n self.southwest value\r\n when 'se'\r\n self.southeast value\r\n end\r\n end", "def header_pairs headers\n header_pairs = []\n headers.each do |header|\n header_pairs.append \"#{header[:name]}=#{header[:value]}\"\n end\n header_pairs.join \",\"\nend", "def create_list(starting_list)\n shopping_list = {}\n arry = starting_list.split(\" \")\n arry.each { |item_name| shopping_list[item_name] = 1}\n return shopping_list\nend", "def make_hash(attrs)\n hashes = {}\n skip_next = false\n attrs.each_with_index do |attr, index|\n if skip_next\n skip_next = false\n next\n end\n if attr.class == Array and attr.size == 2\n hashes[attr[0]] = attr[1]\n else\n unless index == attrs.size-1\n hashes[attr] = attrs[index + 1]\n skip_next = true\n end\n end\n end\n hashes\n end", "def assign_nested_parameter_attributes(pairs)\n pairs.each { |k, v| _assign_attribute(k, v) }\n end", "def assign_nested_parameter_attributes(pairs)\n pairs.each { |k, v| _assign_attribute(k, v) }\n end", "def finals_mapping(id, role, match_count)\n role = { home: 0, guest: 1 }[role] if role.is_a? Symbol\n id + match_count*role \n end", "def triples\n requesters, approvers, observers = partitioned_roles\n requesters = requesters.map { |role| [role.user, \"Requester\", nil] }\n approvers = approvers.map { |role| [role.user, \"Approver\", nil] }\n observers = observers.map { |role| [role.user, nil, observation_for(role.user)] }\n\n requesters + approvers + observers\n end", "def process_facets(values)\n map_values(values) do |value|\n k, v = split_value(value, ':')\n Array(v).map {|v| \"#{k}:#{v}\"}.join(',')\n end \n end", "def value_map(value)\n v = case value.class\n when Array\n value.join(',')\n when Range\n \"#{value.first}-#{value.last}\"\n when Hash\n if value.has_key?(:or)\n \"|#{value[:or].join(',')}\"\n elsif value.has_key?(:not)\n \"~#{value[:not].join(',')}\"\n end\n when TrueClass\n \"Y\"\n when FalseClass\n \"N\"\n else\n value\n end\n v\n end", "def to_marchash\n [@tag, @value]\n end" ]
[ "0.60146636", "0.5943397", "0.575267", "0.572605", "0.5680257", "0.5564565", "0.54091346", "0.5340504", "0.5201145", "0.5159632", "0.5139727", "0.5118471", "0.5089516", "0.50125086", "0.49925682", "0.49638548", "0.4951681", "0.4946927", "0.49455205", "0.4930701", "0.4896652", "0.48811612", "0.48752126", "0.48728952", "0.48525962", "0.48434353", "0.48247284", "0.48210368", "0.48186174", "0.4812585", "0.48072588", "0.47953546", "0.47936848", "0.47706226", "0.47629672", "0.47291642", "0.47037834", "0.4692331", "0.4689616", "0.46853998", "0.46795762", "0.46696088", "0.46684262", "0.46608078", "0.46597275", "0.46562666", "0.4649708", "0.46398637", "0.4627251", "0.46207547", "0.4615344", "0.459934", "0.459934", "0.459934", "0.459934", "0.459934", "0.459934", "0.459934", "0.459934", "0.459934", "0.459934", "0.459934", "0.459934", "0.459934", "0.45979396", "0.4590846", "0.45801073", "0.45714945", "0.45653734", "0.45570263", "0.45568535", "0.45547715", "0.4548635", "0.4547693", "0.45451906", "0.45447588", "0.45372584", "0.45363897", "0.4530002", "0.4527802", "0.45226407", "0.45165062", "0.45139876", "0.45092848", "0.4504913", "0.45022345", "0.44954252", "0.44918108", "0.44859383", "0.44847542", "0.4478974", "0.44749382", "0.44726503", "0.4468627", "0.44670063", "0.44664684", "0.44571438", "0.4456207", "0.44480217", "0.44411972" ]
0.5503896
6
GET /travel_agent_profiles/1 GET /travel_agent_profiles/1.json
def show @travel_agent_profile = TravelAgentProfile.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @travel_agent_profile } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_default_profile \n get(\"/profiles.json/default\")\nend", "def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end", "def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end", "def get_profile_configuration(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/configuration\", args)\nend", "def index\n @profiles = current_user.profiles\n end", "def index\n @profiles = current_user.profiles\n end", "def new\n @travel_agent_profile = TravelAgentProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @travel_agent_profile }\n end\n end", "def get_profile\n \n profil =\n Excon.get(\n 'https://eastus.api.cognitive.microsoft.com/speaker/identification/v2.0/text-independent/profiles',\n headers: {\n 'Content-Type' => 'application/json',\n 'Ocp-Apim-Subscription-Key' => \"3c43bca9ad884fe39518a5cf3925e707\"\n },\n body: JSON.generate(\"locale\": 'en-us')\n )\n return profil.body\n parsed = JSON.parse(profil.body)\n return parsed['profiles']\n rescue Excon::Error => e\n puts \"Error: #{e}\"\n\n end", "def get_profile\n path = self.api_root + '/register/profile'\n process_firecloud_request(:get, path)\n end", "def index\n @profiles = Profile.all\n @original_niche = get_subscriber_details(@profiles, \"niche\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def index\n authorize Profile\n @profiles = ProfilePolicy::Scope.new(current_user, @user.profiles).resolve\n render json: @profiles\n end", "def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end", "def index\n @skill_user_profiles = SkillUserProfile.all\n\n render json: @skill_user_profiles\n end", "def profile\n @profile ||= GATEWAY.get_profile_details(self.profile_id) unless profile_id.nil?\n end", "def profile_data(access_token)\n response = uphold_conn.get do |req|\n req.url UPHOLD_PROFILE_PATH\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers[:Authorization] = \"Bearer #{access_token}\"\n end\n JSON.parse(response.body, symbolize_names: true)\n end", "def profile\n service_response = UserManagement::ProfileDetail.new(params).perform\n render_api_response(service_response)\n end", "def index\n @profiles = Profile.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def profile\n render_json 0,\"ok\",current_member.as_profile\n end", "def show\n @profiles = @grab.profiles\n end", "def profile\n \n end", "def index\n @profiles = Profile.all\n respond_to do |format|\n format.html\n format.json do\n @profiles = Profile.near(\n [\n current_user.profile.latitude,\n current_user.profile.longitude\n ], params[:radius]\n ).distinct\n @profiles = @profiles.where.not(id: current_user.profile.id)\n @profiles = @profiles.min_age(params[:min_age]) if params[:min_age].present?\n @profiles = @profiles.max_age(params[:max_age]) if params[:max_age].present?\n @profiles = @profiles.by_gender(params[:gender]) if params[:gender].present?\n @profiles = @profiles.by_activity(params[:activity])\n\n render json: @profiles.map{|profile| profile.attributes.merge(image: profile.image.url(:medium))}\n end\n end\n end", "def profiles; end", "def show\n @profile = @user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n end", "def profile\n\n end", "def show\n profile = Profile.find(params[:id])\n render status: 200, json: profile\n end", "def profile\n p @user.as_json\n render json: @user.as_json\n end", "def index\n @profiles = Profile.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @profiles }\n end\n end", "def index\n @profiles = Profile.all\n @profile = Profile.find_by_id(params[:profile_id])\n end", "def list_arrays_assigned_to_profile(args = {}) \n get(\"/profiles.json/#{args[:profileId]}/arrays\", args)\nend", "def index\n @profiles = current_user\n end", "def profile; Profile.get(self.profile_id); end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_profiles }\n end\n end", "def profile\n check_auth :profile\n \n response = connection.post do |req|\n req.url '/user/profile'\n req.body = { :format => @format }\n end\n response.body[0]\n end", "def create\n @travel_agent_profile = TravelAgentProfile.new(params[:travel_agent_profile])\n\n respond_to do |format|\n if @travel_agent_profile.save\n format.html { redirect_to @travel_agent_profile, notice: 'Travel agent profile was successfully created.' }\n format.json { render json: @travel_agent_profile, status: :created, location: @travel_agent_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @travel_agent_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile(profile_name:)\n claim_url = \"#{@@profile_service_url}/profile/#{profile_name}/next\"\n response = Faraday.get claim_url\n profile = JSON.parse(response.body)\n raise \"No profile available for #{profile_name}\" unless profile\n profile\n end", "def show\n @profile = Profile.find(params[:id])\n render json: @profile.to_json(include_hash)\n end", "def retrieve_profile(id, content_type)\n call(:get, path(\"#{id}/profiles/#{content_type}/\"))\n end", "def index\n @client_profiles = ClientProfile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def index\n @profiles = Profile.all\n end", "def team_profile_get(options={})\n post(\"team.profile.get\", options)\n end", "def new\n @profile = Profile.new\n @goal = @user.goals.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def index\n @retailer_profiles = RetailerProfile.all\n end", "def profiles\n collection(\"profiles\", paged: true)\n end", "def index\n @seeker_profiles = SeekerProfile.all\n end", "def profile\n @property[:profile]\n end", "def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end", "def index \n @profiles = Profile.all\n end", "def profile(id, region, name)\r\n BnetApi.make_request(\"/sc2/profile/#{id}/#{region}/#{name}/\")\r\n end", "def index\n @profiles = Profile.all\n\n end", "def profile\n return nil unless user_loa3\n\n mvi_response&.profile\n end", "def show\n @waitlist = WaitList.find(params[:id])\n @person = Person.find(@waitlist.people_id)\n @profile = Profile.find_by_person_id(@waitlist.people_id)\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @waitlist }\n end\n end", "def show\n @profile = current_user.profile\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def index\n getProfile\n @consents = TherapistConsent.where('therapist_id = ? ', @therapist.id)\n respond_to do |format|\n format.html { render action: 'index' }\n format.json { render :status => 200, :json => { action: 'index', consents: @consents }}\n end\n end", "def index\n @profiles = Profile.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @monitor_profile = MonitorProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monitor_profile }\n end\n end", "def index\n @personal_profiles =current_user.personal_profile\n end", "def details\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n format.html # details.html.erb\n format.json { render json: @profile }\n end\n end", "def show\n @user_profile = UserProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_profile }\n end\n end", "def index\n @profiles = Profile.page(params[:page]).order(:updated_at => 'DESC')\n @json = @profiles.to_gmaps4rails\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def index\r\n @profiles = Profile.all\r\n end", "def index\r\n @profiles = Profile.all\r\n end", "def profile(user_id: '-')\n return get(\"#{API_URI}/#{PROFILE_API_VERSION}/user/#{user_id}/profile.json\")\n end", "def show\n @monitor_profile = MonitorProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @monitor_profile }\n end\n end", "def pull_profiles\n \tprofiles_from_api = self.client.profiles\n\t\tprofiles_array = []\n\t\tprofiles_from_api.each do |p|\n\t\t\tif p.service == \"twitter\"\n\t\t\t\tprofiles_array << p\n\t\t\tend\n\t\tend\n\t\tprofiles_array\n end", "def index\n @user_profiles = UserProfile.all\n end", "def index\n @user_profiles = UserProfile.all\n end", "def index\n @user_profiles = UserProfile.all\n end", "def index\n @user_profiles = UserProfile.all\n end", "def show\n @profile = current_user.profile\n\n # ToDo: error message if no profile is found for user\n\n puts 'Got profile='\n pp @profile\n \n\n puts 'got other_names='\n pp @profile.other_names\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @profile }\n format.json { render :json => @profile }\n end\n \n end", "def users_profile\n @usersProfile = User.find(params[:id]).to_json(:include => :user_connections)\n render json: { data: @usersProfile }\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 @profiles = Profile.all.paginate :page => params[:page], :per_page => 3\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @profiles }\n end\n end", "def index\n @userprofiles = Userprofile.all\n end", "def profile(token, secret)\n self.access_token = self.get_access_token(token, secret)\n req = self.access_token.request(:get, PAL_EPNTS['profile_url']+PAL_EPNTS['profile_fields'],{'x-li-format' => 'json','Content-Type'=>'application/json'})\n req.body\n end", "def get_profile\n begin\n client.profile(fields: PROFILE_FIELDS)\n rescue Exception => e\n logger.error \"Linkedin #get_profile error #{e}\"\n end\n end" ]
[ "0.67646885", "0.65680057", "0.6463444", "0.64419246", "0.62984014", "0.62984014", "0.6297298", "0.6274834", "0.61767066", "0.61541593", "0.6136203", "0.6127489", "0.6036603", "0.6014449", "0.5978605", "0.5976262", "0.59742224", "0.59692156", "0.5951449", "0.58936715", "0.5887789", "0.5886062", "0.58780766", "0.5877387", "0.5877387", "0.5877387", "0.5877387", "0.5877387", "0.5877387", "0.58678263", "0.5867739", "0.5857156", "0.5847524", "0.5844217", "0.5837533", "0.58349735", "0.5834349", "0.5830978", "0.58214575", "0.58133656", "0.57962036", "0.57960755", "0.57631123", "0.5749027", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.573868", "0.5735922", "0.5733197", "0.57318795", "0.5728893", "0.5727413", "0.5725603", "0.5721837", "0.57189476", "0.5717245", "0.57104677", "0.5707512", "0.5706697", "0.5698546", "0.5697989", "0.56935686", "0.5690383", "0.5672912", "0.5672912", "0.5672912", "0.56724966", "0.565887", "0.5658211", "0.56543964", "0.5651003", "0.56422424", "0.56422424", "0.56421757", "0.5635687", "0.5618744", "0.5614326", "0.5614326", "0.5614326", "0.5614326", "0.5613758", "0.5610671", "0.56081253", "0.56062573", "0.5602399", "0.5599284", "0.55952317" ]
0.7006424
0
GET /travel_agent_profiles/new GET /travel_agent_profiles/new.json
def new @travel_agent_profile = TravelAgentProfile.new respond_to do |format| format.html # new.html.erb format.json { render json: @travel_agent_profile } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @travel_agent_profile = TravelAgentProfile.new(params[:travel_agent_profile])\n\n respond_to do |format|\n if @travel_agent_profile.save\n format.html { redirect_to @travel_agent_profile, notice: 'Travel agent profile was successfully created.' }\n format.json { render json: @travel_agent_profile, status: :created, location: @travel_agent_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @travel_agent_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @profile = Profile.new\n @goal = @user.goals.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n profile_finish?\n\n if current_user && ( current_user.status == \"agent\" || current_user.status == \"admin\" )\n @vacancy = Vacancy.new\n @countries = Country.all\n @states = State.all\n @cities = City.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vacancy }\n end\n else\n root_path\n end\n end", "def new\n build_profile\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @profile }\n end\n end", "def new\n # @profile = Profile.new\n\n\n \n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @profile = Profile.new\n end", "def new\n @profile = Profile.new\n end", "def new\n @profile = Profile.new\n end", "def new\n @meetup_profile = MeetupProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meetup_profile }\n end\n end", "def new\n @user_profile = UserProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_profile }\n end\n end", "def new\n @user_profile = UserProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_profile }\n end\n end", "def new\n @user_profile = UserProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_profile }\n end\n end", "def new\n @profile_attribute = current_user.profile_attributes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile_attribute }\n format.json { render :json => @profile_attribute }\n end\n end", "def new\n @profilepage = Profilepage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profilepage }\n end\n end", "def new\n\t\t@profile = Profile.new\n\tend", "def new\n\t\t@profile = Profile.new\n\tend", "def new\n @profile = Profile.new\n end", "def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @profile = Profile.new\n @profile.build_user\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @ProfileType = ProfileType.new\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render json: @ProfileType }\n end\n end", "def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @monitor_profile = MonitorProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monitor_profile }\n end\n end", "def new\n @pay_profile = PayProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pay_profile }\n end\n end", "def new\n @monitor_profile = MonitorProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @monitor_profile }\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end", "def new\n # @profile = Profile.new\n # authorize! :new, @profile\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n getProfile\n @therapist_consent = TherapistConsent.new\n @therapist_consent.therapist_id = @therapist.id\n @therapist_consent.active = true\n @therapist_consent.version = 1\n respond_to do |format|\n format.html { render action: 'edit' }\n format.json { render :status => 200, :json => { action: 'new', therapist_consent: @therapist_consent}}\n end\n end", "def new\n @site = Site.new\n @profile_id = Profile.where(:username=>session[:username]).first.id\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site }\n end\n end", "def new\n \t@user_profile = UserProfile.new\n end", "def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end", "def new\n @web_profile = WebProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def new\n @profile = Profile.new\n @profile.user_id = session[:user_id]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def new\n @organization_profile = OrganizationProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @organization_profile }\n end\n end", "def new\n @private_profile = PrivateProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @private_profile }\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @agent_status = AgentStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agent_status }\n end\n end", "def new\n @connection = Crm::Connection.new\n @connection.agent = params[:agent_id].present? ? Usage::User.find(params[:agent_id]) : current_user\n @connection.profile = params[:profile_id] || @connection.agent.current_profile_id(cookies)\n _new_or_edit\n end", "def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end", "def new\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end", "def new\n super\n resource.build_profile\n end", "def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @filmmaker.build_profile\n @filmmaker = Filmmaker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filmmaker }\n end\n end", "def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @proficiency = Proficiency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proficiency }\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end", "def create\n @profile = current_user.build_profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @monitor_profile = MonitorProfile.new(params[:monitor_profile])\n\n respond_to do |format|\n if @monitor_profile.save\n format.html { redirect_to @monitor_profile, :notice => 'Monitor profile was successfully created.' }\n format.json { render :json => @monitor_profile, :status => :created, :location => @monitor_profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @monitor_profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @meal_profile = MealProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_profile }\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @retailer_profile = RetailerProfile.new(retailer_profile_params)\n @retailer_profile.user = current_user\n\n respond_to do |format|\n if @retailer_profile.save\n format.html { redirect_to root_path, notice: 'Your profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @retailer_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @retailer_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @profile = Profile.new(profile_params)\r\n\r\n respond_to do |format|\r\n if @profile.save\r\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\r\n format.json { render :show, status: :created, location: @profile }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def new\n @profesore = Profesore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesore }\n end\n end", "def new\n @followup = Followup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @followup }\n end\n end", "def new\n @travel_type = TravelType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @travel_type }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile }\n end\n end", "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @profile }\n end\n end", "def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @agency_type = AgencyType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @agency_type }\n end\n end", "def create\n @monitor_profile = MonitorProfile.new(params[:monitor_profile])\n\n respond_to do |format|\n if @monitor_profile.save\n format.html { redirect_to @monitor_profile, notice: 'Monitor profile was successfully created.' }\n format.json { render json: @monitor_profile, status: :created, location: @monitor_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monitor_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @protein = Protein.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protein }\n end\n end", "def new\n\t\t@person = Person.new\n\t\t# render json: @person #skips the view, and just renders out the json\n\tend", "def new\n @global_company = GlobalCompany.new\n @global_company.global_company_profiles.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @global_company }\n end\n end", "def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile\nend", "def new\n @personnage = Personnage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personnage }\n end\n end", "def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile.full_name = 'System'\n profile\nend", "def new\n\t\t@user = current_user\n\t\t@profile = @user.build_profile\n\tend", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.74394727", "0.70630705", "0.7032297", "0.7032297", "0.7032297", "0.7032297", "0.7032297", "0.7032297", "0.7032297", "0.7032297", "0.7032297", "0.7027311", "0.7001514", "0.69660693", "0.69137156", "0.6883795", "0.6868704", "0.6868704", "0.6868704", "0.6841565", "0.68229765", "0.68229765", "0.68229765", "0.6819258", "0.68191326", "0.6799081", "0.6799081", "0.6786833", "0.6776538", "0.6740529", "0.671459", "0.670984", "0.6702546", "0.6679705", "0.6639507", "0.66269433", "0.65921295", "0.6577799", "0.6577799", "0.6577799", "0.6577799", "0.6577799", "0.6577799", "0.6577799", "0.6553836", "0.65535057", "0.64777917", "0.6477454", "0.6476415", "0.6471104", "0.6469908", "0.64546376", "0.6450291", "0.6441093", "0.6435086", "0.6418981", "0.64142156", "0.64076346", "0.64076346", "0.64076346", "0.64076346", "0.64076346", "0.64076346", "0.64076346", "0.64076346", "0.64058495", "0.63998497", "0.639722", "0.6391254", "0.639101", "0.63901097", "0.63818276", "0.63807213", "0.63709044", "0.63651216", "0.63606983", "0.6354566", "0.6354562", "0.63511336", "0.63482976", "0.63417935", "0.63255864", "0.6320328", "0.63101107", "0.6303095", "0.62886643", "0.62819785", "0.62819785", "0.62819785", "0.62789965", "0.6277699", "0.62729245", "0.62699515", "0.6264671", "0.6260091", "0.6258521", "0.62557536", "0.6243774", "0.62387615", "0.62383634" ]
0.7776194
0
POST /travel_agent_profiles POST /travel_agent_profiles.json
def create @travel_agent_profile = TravelAgentProfile.new(params[:travel_agent_profile]) respond_to do |format| if @travel_agent_profile.save format.html { redirect_to @travel_agent_profile, notice: 'Travel agent profile was successfully created.' } format.json { render json: @travel_agent_profile, status: :created, location: @travel_agent_profile } else format.html { render action: "new" } format.json { render json: @travel_agent_profile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validator_captive_portal(args = {}) \n post(\"/profiles.json/captiveportal/\", args)\nend", "def new\n @travel_agent_profile = TravelAgentProfile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @travel_agent_profile }\n end\n end", "def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.create({\n name: params['profile']['name'],\n speciality: params['profile']['speciality'],\n city: params['profile']['city'],\n user_id: current_user['id']\n })\n @profile.save\n respond_with(@profile)\n end", "def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n if @profile.save\n render json: @profile, status: :created\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @user.profile = Profile.new(params[:profile])\n if params[:goal_worth]\n @goal = @user.goals.create do |g|\n g.goal_type = \"recurring\"\n g.started_on = Date.today\n g.name = \"What my time is worth\"\n g.goal_amount_score = params[:goal_worth].to_i\n end\n else\n @goal = nil\n end\n \n respond_to do |format|\n \n if @user.profile && @goal\n \n format.html { redirect_to user_profiles_path, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @driver_profile = DriverProfile.new(driver_profile_params)\n\n respond_to do |format|\n if @driver_profile.save\n format.html { redirect_to @driver_profile, notice: 'Driver profile was successfully created.' }\n format.json { render :show, status: :created, location: @driver_profile }\n post_request\n else\n flash[:error] = \"#{@driver_profile.errors.full_messages.to_sentence}\"\n format.html { render :new }\n format.json { render json: @driver_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # Buidles a profile in association witht eh user\n @user = User.find(current_user.id)\n @profile = @user.build_profile(params[:user])\n @profile.update_attributes(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def import_tax_profile() path = \"/api/v2/taxprofile\"\n post(path) end", "def create\n @response = HTTParty.get(\"https://travelbriefing.org/#{params[:name]}?format=json\",\n :headers => { 'Content-Type' => 'application/json', 'Accept' => 'application/json'})\n\n @response = JSON.parse(@response.parsed_response)\n\n destination = Destination.new\n destination.country = @response[\"names\"][\"name\"]\n destination.user = current_user\n destination.save\n redirect_to '/profiles'\n end", "def create\n logger.info(\"CREATE PROFILE #{params[:profile].inspect}\")\n @profile = Profile.new(params[:profile])\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profiles = current_user.profiles.new(profile_params)\n\n if @profiles.save\n redirect_to profiles_path, notice: 'Profile was successfully created.'\n else\n render :new\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.site_identifier = params[:profile][:site_identifier]\n\n respond_to do |format|\n if @profile.save\n# current_user.default_profile = @profile\n set_banner\n format.html do\n redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: profile_home_path(@profile.site_identifier) }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n profile_params=params[:profile]\n avatar_params=params[:profile][:avatar]\n if current_user.chef?\n location_params=params[:profile][:location]\n cover_params=params[:profile][:cover_image_url]\n profile_params.delete(\"location\")\n profile_params.delete(\"cover_image_url\")\n end\n profile_params.delete(\"avatar\")\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n @profile.create_avatar(:image=>avatar_params)\n if current_user.chef?\n @profile.save!\n @profile.covers.create(:image=>cover_params)\n @location = Location.new(location_params)\n @location.save!\n @profile.location_id=@location.id\n end\n @profile.save!\n #render json: @profile.to_json(include_hash)\n if current_user.chef?\n redirect_to new_event_path\n else\n redirect_to events_path\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: t('controller.profiles.create.success') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @retailer_profile = RetailerProfile.new(retailer_profile_params)\n @retailer_profile.user = current_user\n\n respond_to do |format|\n if @retailer_profile.save\n format.html { redirect_to root_path, notice: 'Your profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @retailer_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @retailer_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @representative_profile = RepresentativeProfile.new(representative_profile_params)\n\n respond_to do |format|\n if @representative_profile.save\n format.html { redirect_to @representative_profile, notice: 'Representative profile was successfully created.' }\n format.json { render :show, status: :created, location: @representative_profile }\n else\n format.html { render :new }\n format.json { render json: @representative_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @monitor_profile = MonitorProfile.new(params[:monitor_profile])\n\n respond_to do |format|\n if @monitor_profile.save\n format.html { redirect_to @monitor_profile, :notice => 'Monitor profile was successfully created.' }\n format.json { render :json => @monitor_profile, :status => :created, :location => @monitor_profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @monitor_profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n respond_to do |format|\n if @profile.save\n format.html do\n redirect_to @profile, notice:\n \"Profile was successfully created.\"\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json do\n render json: @profile.errors,\n status: :unprocessable_entity\n end\n end\n end\n end", "def create\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = @profile.trips.build(params.require(:trip).permit(:date, :time, :pickup_location, :destination, :price, :seats_available, :driver_id, :profile_id))\n if @trip.save\n redirect_to profile_trip_url(@profile, @trip)\n else\n render :action => \"new\"\n end\n end", "def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend", "def profile_params\n params.require(:profile).permit(:residence, :first_time, :expectancy,\n :agile_id, :agile_description,\n :hobbies, :bring, :proposal,\n :bio, :agileRelation_id,\n :gender_id, :size_id)\n end", "def create\n byebug\n @skill_user_profile = SkillUserProfile.new(skill_user_profile_params)\n\n if @skill_user_profile.save\n render json: @skill_user_profile, status: :created, location: @skill_user_profile\n else\n render json: @skill_user_profile.errors, status: :unprocessable_entity\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(params[:profile])\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t# Creating the profile for particular surgeon\n\t\tsurgeon_profile = current_user.setting.build_profile(speciality_name: params[:speciality_name],sub_speciality_name:params[:sub_speciality_name],:medical_school=>params[:medical_school],:residency=>params[:residency],:spe_training=>params[:spe_training],:my_favourite=>params[:my_favourite],:my_hobby=>params[:my_hobby],:more_about=>params[:more_about],:cover_image=>params[:cover_image],:profile_image=>params[:profile_image]) \n\t\t# Condition checking the profile is saved or not\n\t\tif surgeon_profile.save\n\t\t# response to the JSON\n\t\t render json: { success: true,message: \"Profile Successfully Created.\", response: surgeon_profile.as_json },:status=>200\n\t else\n\t render :json=> { success: false, message: surgeon_profile.errors },:status=> 203\n\t end\n\tend", "def create\n @monitor_profile = MonitorProfile.new(params[:monitor_profile])\n\n respond_to do |format|\n if @monitor_profile.save\n format.html { redirect_to @monitor_profile, notice: 'Monitor profile was successfully created.' }\n format.json { render json: @monitor_profile, status: :created, location: @monitor_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monitor_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @surgical_profile = SurgicalProfile.new(surgical_profile_params)\n\n # TODO: minimize into single query\n @patient = Patient.query_one_by_id(\n current_user, @surgical_profile.patient_id\n )\n @surgeon = User.find(@surgical_profile.user_id)\n\n respond_to do |format|\n if @surgical_profile.preprocess_and_save()\n format.html { redirect_to patient_surgical_profiles_path(@patient), notice: 'Surgical profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @surgical_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @surgical_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n \n \n @profile.artist = find_preferred_artist_id\n @profile.advisor = find_preferred_advisor_id\n\n respond_to do |format|\n if @profile.save\n current_user.update(clientstatus: \"free\")\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(req_params)\n if @profile.save\n redirect_to new_partnership_path(p_id: @profile.id)\n else\n flash[:profile_attempt] = req_params\n respond_with_submission_error(@profile.errors.messages, new_dummy_profile_path)\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.save\n \n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile(profile_contents)\n path = self.api_root + '/register/profile'\n process_firecloud_request(:post, path, profile_contents.to_json)\n end", "def create\n\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = @account.build_profile(profile_attributes)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to root_path, notice: 'Анкета успешно сохранена. Ваш магазин добавлен в очередь на оптимизацию.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n\n respond_to do |format|\n if @profile.save\n current_user.add_role :candidate\n # Send notification to new user that his candidate profile has been created\n RegistrationMailer.registration(@profile.user.id).deliver_now\n\n # Send notification to MOBEEAS Admin that a new candidate user has been created\n RegistrationMailer.new_user_notification(@profile.user.id).deliver_now\n\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @userprofile = Userprofile.new(userprofile_params)\n\n respond_to do |format|\n if @userprofile.save\n format.html { redirect_to @userprofile, notice: 'Userprofile was successfully created.' }\n format.json { render :show, status: :created, location: @userprofile }\n else\n format.html { render :new }\n format.json { render json: @userprofile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile_params\n params.require(:profile).permit(:name, :countries_visited, :favourite_countries, :bucket_list, :travel_buddy)\n end", "def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user_profile = UserProfile.new(params[:user_profile])\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render json: @user_profile, status: :created, location: @user_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @profile = Profile.new(profile_params)\r\n\r\n respond_to do |format|\r\n if @profile.save\r\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\r\n format.json { render :show, status: :created, location: @profile }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @profile.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def post_staging_profile(staging_profile)\n staging_profile = { \n \"name\"=>nil,\n \"repositoryTemplateId\"=>\"default_hosted_release\",\n \"repositoryType\"=>\"maven2\",\n \"targetGroups\"=>[\"public\"],\n \"finishNotifyRoles\"=>[],\n \"promotionNotifyRoles\"=>[],\n \"promoteRuleSets\"=>[],\n \"inProgress\"=> false,\n \"order\"=> 99,\n \"stagingRepositoryIds\"=> [],\n \"stagedRepositoryIds\"=> [],\n \"dropNotifyRoles\"=> [],\n \"mode\"=> \"DEPLOY\",\n \"finishNotifyCreator\"=> false,\n \"promotionNotifyCreator\"=> false,\n \"dropNotifyCreator\"=> false\n }.merge(staging_profile);\n request = {\"data\"=>staging_profile}\n post(\"#{url_base}/staging/profiles?#{dc}\", request)[\"data\"]\n end", "def create\n @profile = Profile.new(params[:profile])\n\n unless params[:profile][:city].nil?\n load_latlong_by_city(params[:profile][:city])\n params[:profile][:lat] = @lat\n params[:profile][:lng] = @lng\n end\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def profiles_post(options = {})\n\n=begin\n #add access token if it exists\n url = \"\"\n if options[:access_token]\n url = \"https://api.meetup.com/2/profile.json?access_token=#{options[:access_token]}\"\n #url = \"https://api.meetup.com/2/profile.json\"\n else\n url = \"https://api.meetup.com/2/profile.json\"\n end\n=end\n\n url = \"https://api.meetup.com/2/profile.json\"\n\n puts \"profiles post url #{url}\"\n\n response = post_response(url,options)\n\n if response == \"OK\"\n puts \"OK\"\n else\n puts response.to_yaml\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cleaners_profile = Cleaners::Profile.new(cleaners_profile_params)\n\n respond_to do |format|\n if @cleaners_profile.save\n format.html { redirect_to after_signup_path(:preference) }\n format.json { render action: 'show', status: :created, location: @cleaners_profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @cleaners_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def profiles \n personid = params[:id]\n @response = JSON.parse(current_user.access_token.token.get('/api/v0/aspects/profiles?ids=['+params[:id]+']'))\n respond_to do |format|\n format.html\n format.json {render :json=> @response, :callback=>params[:callback]}#{render json: @response}\n end\n end", "def create\n @user_agent = UserAgent.new(user_agent_params)\n\n if @user_agent.save\n render json: @user_agent, status: :created, location: @user_agent\n else\n render json: @user_agent.errors, status: :unprocessable_entity\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n @profile.birthdate = JalaliDate.to_gregorian(params[:ja_birth_yyyy],params[:ja_birth_mm],params[:ja_birth_dd])\n # @email = @profile.official_email.split(\"@\").first\n @tags = params[:tags].split(',')\n @tagged = []\n respond_to do |format|\n if @profile.save\n for tag in @tags\n if !tag.blank?\n @tag = Tag.where(title: tag).first\n if @tag.blank?\n @tag = Tag.create(title: tag, user_id: current_user.id)\n end\n @tagging = Tagging.create(taggable_id: @profile.user.id, taggable_type: 'User', tag_id: @tag.id)\n end\n end\n if params[:caller] == 'reg'\n format.html { redirect_to '/registeration_steps?step=2&name=' + @email}\n else\n format.html { redirect_to '/', notice: 'Profile was successfully created.' }\n end\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile_attribute = current_user.profile_attributes.new(params[:profile_attribute])\n @profile = Profile.find params[:profile_id]\n @profile.profile_attributes << @profile_attribute\n\n respond_to do |format|\n if @profile_attribute.save\n format.html { redirect_to(@profile_attribute, :notice => 'Profile attribute was successfully created.') }\n format.xml { render :xml => @profile_attribute, :status => :created, :location => @profile_attribute }\n format.json { render :json => @profile_attribute, :status => :created }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @profile_attribute.errors, :status => :unprocessable_entity }\n format.json { render :json => {:error => @profile_attribute.errors.full_messages} }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user=current_user\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n \n @profile.user_id = current_user.id\n @profile.full_name = @profile.first_name + @profile.last_name\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => t('alerts.profiles.create') }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.my_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profiles_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n profile = Payments::Profile.new(profile_params)\n profile.user = current_user\n\n respond_to do |format|\n if profile.save\n format.html {redirect_to payments_profiles_path}\n else\n format.html {redirect_to :back, flash: {error: \"Error saving payment profile\"}}\n end\n end\n end", "def create\n @university_profile = UniversityProfile.new(params[:university_profile])\n \n respond_to do |format|\n if @university_profile.save\n format.html { redirect_to @university_profile, notice: 'University profile was successfully created.' }\n format.json { render json: @university_profile, status: :created, location: @university_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @university_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = current_user.build_profile\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, :notice => 'Profile was successfully created.' }\n format.json { render :json => @profile, :status => :created, :location => @profile }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@equalizer_profile = current_user.equalizer_profiles.new(params[:equalizer_profile])\n\n\t\trespond_to do |format|\n\t\t\tif @equalizer_profile.save\n\t\t\t\tformat.html { redirect_to(@equalizer_profile, :notice => 'Equalizer profile was successfully created.') }\n\t\t\t\tformat.xml { render :xml => @equalizer_profile, :status => :created, :location => @equalizer_profile }\n\t\t\t\tformat.json { render :json => @equalizer_profile, :status => :created, :location => @equalizer_profile }\n\t\t\t\tformat.yaml { render :text => @equalizer_profile.to_yaml, :content_type => 'text/yaml', :status => :created, :location => @equalizer_profile }\n\t\t\telse\n\t\t\t\tformat.html { render :action => \"new\" }\n\t\t\t\tformat.xml { render :xml => @equalizer_profile.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.json { render :json => @equalizer_profile.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.yaml { render :text => @equalizer_profile.errors.to_yaml, :content_type => 'text/yaml', :status => :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n respond_to do |format|\n if @profile.save\n format.html { redirect_to manage_profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t@profile = Profile.new(profile_params)\n\n \trespond_to do |format|\n if @profile.save\n UserMailer.delay.registration_confirmation(@profile)\n format.json { render action: 'show', status: :create, location: @profile }\n else\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @profile = Profile.new\n @goal = @user.goals.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "def create\n @user_prof = UserProf.new(user_prof_params)\n\n respond_to do |format|\n if @user_prof.save\n format.html { redirect_to @user_prof, notice: 'User prof was successfully created.' }\n format.json { render :show, status: :created, location: @user_prof }\n else\n format.html { render :new }\n format.json { render json: @user_prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile_params\n params.require(:profile).permit(:phonenumber, :telegram, :country, :city, :state, :first_time,\n :expectancy, :agile_id, :agile_description, :hobbies, :bring, :proposal,\n :bio, :agileRelation_id, :gender_id, :size_id)\n end", "def create\n @prof = Prof.new(prof_params)\n\n respond_to do |format|\n if @prof.save\n format.html { redirect_to @prof, notice: 'Prof was successfully created.' }\n format.json { render :show, status: :created, location: @prof }\n else\n format.html { render :new }\n format.json { render json: @prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client_profile = ClientProfile.new(client_profile_params)\n\n respond_to do |format|\n if @client_profile.save\n format.json { render :show, status: :created, location: @client_profile }\n else\n format.json { render json: @client_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_profile\n new_profile = Profile.new\n new_profile.user_id = self.id\n new_profile.save!\n end", "def create\n @talent_profile = TalentProfile.new(talent_profile_params)\n\n respond_to do |format|\n if @talent_profile.save\n format.html { redirect_to @talent_profile, notice: 'Talent profile was successfully created.' }\n format.json { render :show, status: :created, location: @talent_profile }\n else\n format.html { render :new }\n format.json { render json: @talent_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @security_profile = Security::Profile.new(security_profile_params)\n @security_profile.user_created_id = current_user.id\n respond_to do |format|\n if @security_profile.save\n format.html { redirect_to security_profiles_path, notice: I18n.t('profiles.controller.create')}\n format.json { render :show, status: :created, location: @security_profile }\n else\n format.html { render :new }\n format.json { render json: @security_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_profile!\n bundle_id = Sigh.config[:app_identifier]\n name = Sigh.config[:provisioning_name]\n if !name\n name = Sigh.config[:app_identifier].gsub '.' ,''\n end\n\n UI.important \"Creating new provisioning profile for '#{Sigh.config[:app_identifier]}' with name '#{name}'\"\n profile = profile_type.create!(name: name,\n bundle_id: bundle_id)\n profile\n end", "def create\n @user_profile = UserProfile.new(user_profile_params)\n\n respond_to do |format|\n if @user_profile.save\n format.html { redirect_to @user_profile, notice: 'User profile was successfully created.' }\n format.json { render :show, status: :created, location: @user_profile }\n else\n format.html { render :new }\n format.json { render json: @user_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # TO DO: make this for just generic creation.\n @profile = Profile.find_by_email(params[:profile][:email])\n @profile.user_id = current_user.id\n\n if @profile.nil?\n @profile = Profile.new(params[:profile])\n add_to_list_niche(params[:profile][:fname], params[:profile][:email], params[:profile][:niche], list_id=ENV[\"MAILCHIMP_LISTID\"])\n @profile.save\n else\n @profile.update_attributes(params[:profile])\n end\n\n redirect_to profiles_path, notice: 'Profile was successfully created.' \n # format.json { render json: @profile, status: :created, location: @profile }\n end", "def create\n @personal_profile = PersonalProfile.new(personal_profile_params)\n @personal_profile.user_id=current_user.id\n respond_to do |format|\n if @personal_profile.save\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully created.' }\n format.json { render :show, status: :created, location: resume_path }\n else\n format.html { render :new }\n format.json { render json: @personal_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @accountant_profile = current_accountant.build_accountant_profile(accountant_profile_params)\n\n authorize @accountant_profile\n\n respond_to do |format|\n if @accountant_profile.save\n format.html { redirect_to @accountant_profile, notice: 'Accountant profile was successfully created.' }\n format.json { render :show, status: :created, location: @accountant_profile }\n else\n format.html { render :new }\n format.json { render json: @accountant_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n\n @profile.user = current_user\n \n respond_to do |format|\n if @profile.save\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create!(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6113214", "0.6041963", "0.60397077", "0.5972854", "0.593784", "0.59138227", "0.58222824", "0.5807287", "0.5774494", "0.5762147", "0.57022905", "0.5675208", "0.56469494", "0.56468195", "0.56266755", "0.56224835", "0.56202805", "0.5592046", "0.5587152", "0.5580588", "0.5568748", "0.5558851", "0.5553455", "0.5545354", "0.55290604", "0.5523591", "0.55218476", "0.55218476", "0.55218476", "0.55218476", "0.55218476", "0.55218476", "0.55218476", "0.5517006", "0.5517006", "0.5517006", "0.5517006", "0.5517006", "0.5517006", "0.5517006", "0.5517006", "0.55077666", "0.5506683", "0.55066097", "0.549157", "0.5486426", "0.5485735", "0.54856366", "0.54814374", "0.54762423", "0.5472227", "0.54696244", "0.54676294", "0.545832", "0.5450629", "0.5450629", "0.5450629", "0.5450425", "0.54459035", "0.5439476", "0.5437334", "0.54356194", "0.5434976", "0.5434976", "0.54294527", "0.54294527", "0.5426143", "0.54221106", "0.54174066", "0.5415487", "0.54144037", "0.5411562", "0.5409049", "0.54089934", "0.53781307", "0.5376751", "0.53759843", "0.5374403", "0.5373186", "0.5372172", "0.5367426", "0.5366599", "0.53566414", "0.53515965", "0.5348504", "0.53475124", "0.53456664", "0.5339965", "0.5337997", "0.5336845", "0.5327447", "0.53270644", "0.53246665", "0.53215176", "0.5318969", "0.5315348", "0.5314847", "0.5314042", "0.53062767", "0.5305347" ]
0.7092358
0
PUT /travel_agent_profiles/1 PUT /travel_agent_profiles/1.json
def update @travel_agent_profile = TravelAgentProfile.find(params[:id]) respond_to do |format| if @travel_agent_profile.update_attributes(params[:travel_agent_profile]) format.html { redirect_to @travel_agent_profile, notice: 'Travel agent profile was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @travel_agent_profile.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_default_profile(args = {}) \n put(\"/profiles.json/#{args[:profileId]}/default\", args)\nend", "def update_profile(body={})\n perform_post(\"/account/update_profile.json\", :body => body)\nend", "def create\n @travel_agent_profile = TravelAgentProfile.new(params[:travel_agent_profile])\n\n respond_to do |format|\n if @travel_agent_profile.save\n format.html { redirect_to @travel_agent_profile, notice: 'Travel agent profile was successfully created.' }\n format.json { render json: @travel_agent_profile, status: :created, location: @travel_agent_profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @travel_agent_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile(params)\n post('/account/update_profile.json', params)\n end", "def update_profile(params)\n post 'account/update_profile', :post => params\n end", "def create_or_update_profile_configuration(args = {}) \n id = args['profileId']\n temp_path = \"/profiles.json/{profileId}/configuration\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"profileId\")\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_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end", "def update\n current_user.profile.update_attributes(profile_params)\n redirect_to '/profiles'\n end", "def update\n\t\t# Updating the details according the that particular profile\n\t\t@profile.update_attributes(profile_params)\n\t\t# Redirect to the particular surgeon profile show page\n\t\tredirect_to profile_path(@profile)\n\tend", "def update\n @profiles = current_user.profiles.find(params[:id])\n\n respond_to do |format|\n if @profiles.update(profile_params)\n format.html { redirect_to profiles_path, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profiles }\n else\n format.html { render :edit }\n format.json { render json: @profiles.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n \n \n @profile.artist = find_preferred_artist_id\n @profile.advisor = find_preferred_advisor_id\n\n respond_to do |format|\n if @profile.save\n current_user.update(clientstatus: \"free\")\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend", "def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name] })\n if response.status.success?\n responseObj = JSON.parse(response.body)\n queried_profile_list = responseObj[\"data\"]\n if queried_profile_list.length() > 0\n profile = queried_profile_list[0]\n end\n else\n Asca::Tools::Log.error(response.body)\n return\n end\n \n if !profile\n Asca::Tools::Log.error(\"No profile named #{options[:name]} found\")\n return\n end\n # create new profile\n profile_type = profile[\"attributes\"][\"profileType\"]\n \n # get bundle id\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"bundleId\"][\"links\"][\"self\"])\n bundle_id = JSON.parse(response.body)[\"data\"][\"id\"]\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"certificates\"][\"links\"][\"self\"])\n certificate_ids = JSON.parse(response.body)[\"data\"].map { |cer| cer[\"id\"] }\n \n # get all device ids\n device_ids = Asca::REST::Provisioning::Devices.list_devices.map { |device|\n device[\"id\"]\n }\n \n # delete old prifile\n delete_profile :name => options[:name]\n \n if profile_type.include? 'APP_STORE'\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :certificate_ids => certificate_ids\n else\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :device_ids => device_ids, :certificate_ids => certificate_ids\n end\n \n return true\n end", "def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\t@profile.update_columns(profile_params)\n\t\trespond_with @profile \n\tend", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find_by_user_id(current_user.id)\n @trip = Trip.find(params[:id])\n if @trip.update_attributes(params.require(:trip).permit(:date, :time, :pickup_location, :destination, :price, :seats_available, :driver_id, :profile_id))\n redirect_to profile_trip_url(@profile, @trip)\n else\n render :action => \"edit\"\n end\n end", "def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tag_profile\n # body = {\n # cmd: \"update_tag_profile\"\n # }\n\n end", "def update_profile\n @profile = Profile.find(params[:id])\n @profile.update_attribute(:field_name,params[:field_name])\n @profile.update_attribute(:field_type,params[:field_type])\n redirect_to(\"/profiles/create_profile/#{@profile.structure_component_id}\")\n end", "def update\n @profile.update(profile_params)\n respond_with(@profile)\n end", "def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end", "def set_profile\n @profile = current_user.profiles.find(params[:id])\n end", "def update\n new_properties = params[:d]\n profile = Profile[params[:id]]\n profile.update_with(new_properties)\n\n respond_with(profile) do |format|\n format.json { render json: profile.stripped }\n end\n end", "def update\n @meetup_profile = MeetupProfile.find(params[:id])\n\n respond_to do |format|\n if @meetup_profile.update_attributes(params[:meetup_profile])\n format.html { redirect_to meetup_profile_path(@meetup_profile.id), notice: 'Meetup profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meetup_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_vet_profile\n @vet_profile = VetProfile.find(params[:id])\n end", "def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end", "def update\n @survivor = Survivor.find(params[:id])\n @profile = @survivor.profile\n \n @survivor.location = Location.find(params[:survivor][:location_id]); params[:survivor].delete(:location_id)\n \n respond_to do |format|\n if @survivor.update_attributes(params[:survivor]) and @profile.update_attributes(params[:profile])\n flash[:notice] = 'Survivor was successfully updated.'\n format.fbml { redirect_to(@survivor) }\n format.xml { head :ok }\n else\n format.fbml { render :action => \"edit\" }\n format.xml { render :xml => @survivor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_profile(profile_contents)\n path = self.api_root + '/register/profile'\n process_firecloud_request(:post, path, profile_contents.to_json)\n end", "def update_profile(options={})\n perform_post(\"account/update_profile.#{Twitter.format}\", options)\n end", "def update_profile\n @profile = @account.employee\n \n if params[:profile].present?\n @profile.assign_attributes(profile_params)\n @profile.save\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {success: 'Profile has been updated successfully.'}\n else\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {error: 'Profile update failed. Please try again!'}\n end\n end", "def set_profile\n @profile = Profile.find(params[:profile_id])\n end", "def test_should_update_profile\n # login_as(:patrick)\n # put :update, :id => profiles(:profile_00006).id, :profile => { }\n # assert_redirected_to profile_path(assigns(:profile))\n end", "def update!(**args)\n @profile = args[:profile] if args.key?(:profile)\n @type = args[:type] if args.key?(:type)\n end", "def update_profile(profile)\n @type = Type::CIM_UPDATE_PROFILE\n @fields.merge!(profile.to_hash)\n make_request\n end", "def update!(**args)\n @profile_name = args[:profile_name] if args.key?(:profile_name)\n @profile_photo_url = args[:profile_photo_url] if args.key?(:profile_photo_url)\n @profile_url = args[:profile_url] if args.key?(:profile_url)\n @takedown_url = args[:takedown_url] if args.key?(:takedown_url)\n end", "def add_profile(post, profile)\n post[:profile] = profile\n post[:profileupdate] = 'Y'\n end", "def update!(**args)\n @app_profiles = args[:app_profiles] if args.key?(:app_profiles)\n @failed_locations = args[:failed_locations] if args.key?(:failed_locations)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def set_profile\n @profile = Profile.find(params[:profile_id])\n end", "def update\n respond_to do |format|\n if @talent_profile.update(talent_profile_params)\n format.html { redirect_to @talent_profile, notice: 'Talent profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @talent_profile }\n else\n format.html { render :edit }\n format.json { render json: @talent_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_person_profile\n @person_profile = PersonProfile.find(params[:id])\n end", "def set_profile\n end", "def update\n @profile = Profile.find(params[:id])\n logger.debug(\"UPDATE PROFILE @profile = #{@profile.inspect}\")\n logger.debug(\"UPDATE PROFILE params = #{params[:profile].inspect}\")\n logger.debug(\"UPDATE PROFILE update_attributes #{@profile.update_attributes(params[:profile]).inspect}\")\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = @user.profile \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(current_user.profile), notice: t('controller.profiles.update.success') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile\n id = params[:id]\n @profile = Profile.find(id)\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # puts \"profile_params: #{profile_params[:sport_ids]}\"\n\n respond_to do |format|\n begin\n if current_user != @profile.user\n performing_follow?\n @profile.user.toggle_followed_by(current_user)\n # the next two lines are all about the redirecting or the 'resheshing' of a page so that you can see the result of follow and unfollow without having to refresh.\n format.html { redirect_to @profile.user }\n format.json { render :show, status: :ok, location: @profile }\n end\n\n @profile.update(profile_params)\n # add skill objects and save to db\n # profile_params[:sport_ids].each do |sport_id|\n # Skill.create!(profile_id: @profile.user.id, sport_id: sport_id)\n # end\n format.html { redirect_to profile_url, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n rescue\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n #format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n #format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def create\n @profile = Profile.new(profile_params)\n @profile.user = current_user\n @profile.site_identifier = params[:profile][:site_identifier]\n\n respond_to do |format|\n if @profile.save\n# current_user.default_profile = @profile\n set_banner\n format.html do\n redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: profile_home_path(@profile.site_identifier) }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n userprofile = Userprofile.find_by(\"id\" => params[\"id\"])\n userprofile.update(\"name\" => params[\"full_name\"], \"photo_url\" => params[\"url\"])\n redirect_to \"/userprofiles\"\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vet_profile.update(vet_profile_params)\n require \"open-uri\"\n format.html { redirect_to @vet_profile, notice: 'Vet profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @vet_profile }\n\n result = JSON.load(open(\"https://developers.onemap.sg/commonapi/search?searchVal=#{@vet_profile.postalcode}&returnGeom=Y&getAddrDetails=Y\"))\n vetLat = result[\"results\"][0][\"LATITUDE\"]\n vetLong = result[\"results\"][0][\"LONGITUDE\"]\n address = result[\"results\"][0][\"ADDRESS\"]\n @vet_profile.update(:address => address, :vetLat => vetLat, :vetLong => vetLong)\n else\n format.html { render :edit }\n format.json { render json: @vet_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile! (data = {})\n check_auth :update\n \n response = connection.put do |req|\n req.url '/user/update'\n req.body = { :format => @format }.merge(data)\n end\n response\n end", "def create\n @profile = current_user.profiles.build(profile_params)\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to @profile, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @profile }\n else\n format.html { render action: 'new' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @representative_profile.update(representative_profile_params)\n format.html { redirect_to @representative_profile, notice: 'Representative profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @representative_profile }\n else\n format.html { render :edit }\n format.json { render json: @representative_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:profile][:tag_list] = params[:profile][:tag_list]\n @profile = Profile.new(profile_params)\n @profile.user_id = current_user.id\n\n # Store friendly profile URI\n current_user.profile_uri = getUniqueURI(current_user) \n current_user.save\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to profile_path(@profile), notice: 'Profile was successfully created.' }\n format.json { render :show, status: :created, location: @profile }\n else\n format.html { render :new }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile\r\n @profile = Profile.find(params[:id])\r\n end", "def update\n @skill_user_profile = SkillUserProfile.find(params[:id])\n\n if @skill_user_profile.update(skill_user_profile_params)\n head :no_content\n else\n render json: @skill_user_profile.errors, status: :unprocessable_entity\n end\n end", "def set_profile\n @profile = Profile.friendly.find(params[:id])\n end", "def set_profile\n @profile = Profile.friendly.find(params[:id])\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @security_profiles = args[:security_profiles] if args.key?(:security_profiles)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n Rails.logger.info(\"PARAMS: #{profile_params}\")\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile\r\n @profile = Profile.find(params[:id])\r\n end", "def create\n @profile = Profile.new(params[:profile])\n @profile.profile_id = UUIDTools::UUID.timestamp_create().to_s\n @profile.user_id = current_user.id\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_created) }\n format.json { render json: @profile, status: :created, location: @profile }\n else\n format.html { render action: \"new\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n @profile.photo.data.blank? ? @profile.photo.update_attributes(photo_type: 2) : @profile.photo.update_attributes(photo_type: 1)\n\n current_user.user_tries.last.state_machine.transition_to(:pending)\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to (user_profile_path(current_user)), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n # This must be update_attributes, to do validations\n if @profile.update(profile_params)\n format.html { redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end", "def set_profile\n @profile = Profile.find(params[:id])\n end" ]
[ "0.6809385", "0.65529245", "0.6258866", "0.6257898", "0.6222667", "0.6146836", "0.6144338", "0.5987374", "0.5947935", "0.59297425", "0.58937323", "0.5876602", "0.5825414", "0.57946503", "0.577177", "0.576238", "0.5761962", "0.5757594", "0.5747021", "0.57361066", "0.56923133", "0.5690445", "0.5689227", "0.5654787", "0.56470865", "0.56455946", "0.5644597", "0.5644395", "0.5640572", "0.56267977", "0.5613297", "0.560511", "0.55984074", "0.55671394", "0.5547645", "0.5542421", "0.55384433", "0.55374974", "0.5519601", "0.5512337", "0.55114585", "0.55094796", "0.5509436", "0.55048066", "0.5486925", "0.5479765", "0.5476977", "0.5475535", "0.547175", "0.5449614", "0.5449614", "0.5449614", "0.5449614", "0.5449614", "0.5449614", "0.5448205", "0.54454213", "0.54440016", "0.54440016", "0.54440016", "0.5442931", "0.5441073", "0.543766", "0.5436406", "0.5435667", "0.54262877", "0.54238075", "0.5422118", "0.5422118", "0.5421256", "0.54179305", "0.5417413", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.5412475", "0.54104173", "0.540246", "0.5400937", "0.5398284", "0.53982407", "0.539366", "0.539366", "0.539366", "0.539366", "0.539366", "0.539366", "0.539366", "0.539366" ]
0.69785553
0
DELETE /travel_agent_profiles/1 DELETE /travel_agent_profiles/1.json
def destroy @travel_agent_profile = TravelAgentProfile.find(params[:id]) @travel_agent_profile.destroy respond_to do |format| format.html { redirect_to travel_agent_profiles_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @meetup_profile = MeetupProfile.find(params[:id])\n @meetup_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to request.referer }\n format.json { head :no_content }\n end\n end", "def clear_default_profile \n put(\"/profiles.json/default/clear\")\nend", "def destroy\n @vet_profile.destroy\n respond_to do |format|\n format.html { redirect_to vet_profiles_url, notice: 'Vet profile was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @monitor_profile = MonitorProfile.find(params[:id])\n @monitor_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to monitor_profiles_url }\n format.json { head :ok }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url }\n format.json { head :ok }\n end\n end", "def destroy\n # @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @retailer_profile.destroy\n respond_to do |format|\n format.html { redirect_to retailer_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, :notice => t('alerts.profiles.destroy') }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_profile.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = current_user.profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n end", "def destroy\n @recurring_profile = RecurringProfile.find(params[:id])\n @recurring_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to recurring_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_path, :notice => \"profile was successfully delete.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n raise params.inspect\n @user_profile = UserProfile.find(params[:id])\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :ok }\n end\n end", "def destroy\n @profile.destroy\n @profile.requests.destroy_all\n @profile.member.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'El perfil fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pay_profile = PayProfile.find(params[:id])\n @pay_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to pay_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile_detail.destroy\n respond_to do |format|\n format.html { redirect_to profile_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n end", "def destroy\n @user_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @client_profile\n \n @client_profile.destroy\n respond_to do |format|\n format.html { redirect_to client_profiles_url, notice: 'Client profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile.destroy\n redirect_to '/'\n end", "def destroy\n # @profile = Profile.find(params[:id])\n # authorize! :destroy, @profile\n\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @personal_profile.destroy\n respond_to do |format|\n format.html { redirect_to resume_path, notice: 'Personal profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to partnerships_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @surgical_profile.destroy\n respond_to do |format|\n format.html { redirect_to patient_surgical_profiles_path(@patient) }\n format.json { head :no_content }\n end\n end", "def destroy\n @android_profile = @user.android_profile\n @android_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to new_user_android_profile_url, :flash => { success: 'Successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @climber_profile.destroy\n respond_to do |format|\n format.html { redirect_to climber_profiles_url, notice: 'Climber profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @representative_profile.destroy\n respond_to do |format|\n format.html { redirect_to representative_profiles_url, notice: 'Representative profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # Delete profile\n @profil.destroy\n respond_to do |format|\n format.html { redirect_to profils_url, notice: 'Profil was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @talent_profile.destroy\n respond_to do |format|\n format.html { redirect_to talent_profiles_url, notice: 'Talent profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Profile was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n \t@profile.destroy\n\n \trespond_to do |format|\n \t\tprofiles = Profile.all\n \t\tformat.json { render json: profiles}\n \tend\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: '*Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @prof.destroy\n respond_to do |format|\n format.html { redirect_to profs_url, notice: 'Prof was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gear_profile.destroy\n respond_to do |format|\n format.html { redirect_to gear_profiles_url, notice: 'Gear profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @agent = @business.agents.find(params[:id])\n @agent.destroy\n\n respond_to do |format|\n format.html { redirect_to business_agents_url(@business) }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = @user.profile\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(@user) }\n format.json { head :no_content }\n end\n #redirect_to user_path(@user)\n end", "def destroy\n @meal_profile = MealProfile.find(params[:id])\n @meal_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_profiles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @patient_profile.destroy\n respond_to do |format|\n format.html { redirect_to patient_profiles_url, notice: 'Patient profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile.destroy\n respond_to do |format|\n\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @profile = Profile.find(params[:id])\n @profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @profile.destroy\r\n respond_to do |format|\r\n format.html { redirect_to profiles_url, notice: 'Profile was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @profile.destroy\n respond_with(@profile)\n end", "def destroy\n @reward_profile = RewardProfile.find(params[:id])\n @reward_profile.destroy\n\n respond_to do |format|\n format.html { redirect_to(reward_profiles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user.profile.destroy\n respond_to do |format|\n format.html { redirect_to(profiles_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.67685544", "0.676346", "0.67612046", "0.67481005", "0.67427397", "0.67247474", "0.6685766", "0.66673857", "0.66657686", "0.6653946", "0.6629549", "0.6627992", "0.66132647", "0.6612785", "0.6612785", "0.6582248", "0.6581526", "0.6581526", "0.6581526", "0.6575101", "0.6575101", "0.65662116", "0.65662116", "0.65662116", "0.65662116", "0.65662116", "0.65662116", "0.65662116", "0.65662116", "0.65378124", "0.65224415", "0.6512085", "0.6511272", "0.65060234", "0.64956456", "0.64954", "0.6491799", "0.6486386", "0.6475947", "0.6467414", "0.6467414", "0.6462134", "0.6454919", "0.6446934", "0.6438836", "0.6426264", "0.6421059", "0.6407352", "0.64042497", "0.64005226", "0.63988227", "0.6395144", "0.63945764", "0.6393986", "0.63936514", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.6393625", "0.63902867", "0.6386114", "0.6383876", "0.6383604", "0.6374952", "0.637348", "0.6365815", "0.63612276", "0.636027", "0.636027", "0.636027", "0.636027", "0.636027", "0.63556933", "0.634315", "0.6341812", "0.633782" ]
0.7679896
0
Turns an array into a frequency hash, sorted by the most frequently occurring elements
def analyze_data(ary) frequency = count_frequency(ary) sort_hash(frequency) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def freq(array)\n hash = Hash.new(0)\n array.each{|key| hash[key] += 1}\n hash\nend", "def count_freq(array)\n array.each_with_object(Hash.new(0)) { |obj, counts| counts[obj] += 1 }\n end", "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 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 consolidate_by_frequency(array)\n array.group_by{|x| x}.values.sort_by{|group| group.count}.reverse.flatten(1).uniq\nend", "def mode (array)\n hash = Hash.new (0)\n array.each { |item|\n hash[item] += 1}\n hash\n\n frequency = hash.values.max\n new_array = []\n\n hash.each { |key, value|\n if frequency == value\n new_array.push(key)\n end}\n new_array\nend", "def my_uniq(arr)\n #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 appears_most_times(array)\n hash = {}\n max = 0\n key_max = array[0]\n array.each do |num|\n if hash[num].nil?\n hash[num] = 1\n else\n hash[num] += 1\n end\n if hash[num] > max\n max = hash[num]\n key_max = num\n end\n end\n key_max\nend", "def mode(array)\n freq = Hash.new(0)\n\n array.each do |i|\n freq[i] += 1\n end\n\n temp = Array.new\n largest = 0\n\n freq.each do |k, v|\n if(v > largest)\n temp.clear\n temp.push(k)\n largest = v\n elsif(v == largest)\n temp.push(k)\n end\n end\n\n return temp\nend", "def mode(array)\n instance = Hash.new(0)\n array.each do |item|\n instance[item] += 1\n end\n most_frequent = instance.values.max\n p instance.collect { |k, v| k if v == most_frequent }.compact\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 mode(array)\n\thash = Hash.new(0)\n \t\tarray.each do |i|\n \t\thash[i] += 1\n \tend\n\tfinal_array = []\n \tn = 0\n \tfrequent_value = hash.values[0]\n \twhile n < hash.length\n\t\tif frequent_value < hash.values[n]\n \t\tfrequent_value = hash.values[n]\n \tend\n \tn += 1\n \tend\n \thash.each do |key, val|\n \tif val == frequent_value\n \t\tfinal_array.push(key)\n \tend\n \tend\n \tp final_array\nend", "def mode (array) \n# creates a hash(tracker) with items as keys and frequencies as values\n tracker = {} \n array.each do |x| \n if tracker.has_key?(x) \n tracker[x] += 1\n else\n tracker[x] = 1\n end \n end \n# finds the highest value (frequency)\n final_values = tracker.values\n highest = 0 \n final_values.each do |x|\n if x > highest\n highest = x\n end \n end\n# adds each key (item) with the highest value to the output array\n output = []\n tracker.each do |key, value|\n if value == highest\n output << key\n end\n end\n return output\nend", "def 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 count_freq\n hash = Hash.new(0)\n self.each do |element|\n hash[element] +=1\n end\n return hash\n end", "def mode(array)\n frequency = Hash.new\n array.each do |x|\n array.count(x)\n frequency[x] = array.count(x)\n end\n\n most_frequent = Array.new\n max = frequency.max_by { |x, y| y}\n min = frequency.min_by { |x, y| y}\n if min == max\n frequency.each do |x,y| \n most_frequent = most_frequent.push(x)\n end\n else\n most_frequent[0] = max[0]\n end\n return most_frequent\nend", "def mode(array)\n count = Hash.new 0\n array.each do |n|\n count[n] += 1\n end\n\n frequency = count.values.max\n \n x = []\n count.each do |k, v|\n if frequency == v \n x.push k\n end\n end\n x\nend", "def mode (array) \n# creates a hash(tracker) with items as keys and frequencies as values\n tracker = {} \n array.each do |x| \n if tracker.has_key?(x) \n tracker[x] += 1\n else\n tracker[x] = 1\n end \n end \n\n# adds each key (item) with the max value to the output array\n output = []\n tracker.each do |key, value|\n if value == tracker.values.max\n output << key\n end\n end\n\n return output\nend", "def mode(array)\n new = Hash.new()\n array.each do |item|\n if new.has_key?(item)\n new[item] +=1\n else\n new[item] = 1\n end\n end\n mode = []\n freq = new.values.max\n new.each do |key,value|\n if freq==value\n mode.push(key)\n end\n end\n return mode\nend", "def mode(array)\n freq = {}\n array.each do |item|\n if freq.include?(item)\n freq[item] += 1\n else\n freq[item] = 1\n end\n end\n \n return freq.select{|k,v| v==freq.values.max}.keys\nend", "def array_mode(array)\n new_array = Array.new\n freq = Hash.new\n max_count = 1\n\n array.each do |i|\n if freq.include? (i)\n freq[i] += 1\n if freq[i] > max_count\n max_count = freq[i]\n end\n else\n freq[i] = 1\n end\n end\n freq.each {|k,v| new_array.push(k) if v == max_count}\n new_array\nend", "def mode(array)\n\tfrequency = Hash.new\n\n\tfor i in array\n\t\tfrequency[i] = array.count(i)\n\tend\n\n\tmost_frequent_key = frequency.values.max\n\tmode_list = []\n\n\tfor key, value in frequency\n\t\tif value == most_frequent_key\n\t\t\tmode_list << key\n\t\tend\n\tend\n\treturn mode_list\nend", "def mode(array)\n new_array = []\n words_freq = {}\n max = 0\n array.each do |i|\n if words_freq.include?(i)\n words_freq[i] += 1\n else\n words_freq[i] = 1\n end\n\n if max < words_freq[i]\n max = words_freq[i]\n end\n end\n\n words_freq.each do |key, value|\n new_array << key if value == max\n end\n return new_array\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(arr)\n\th = {}\n\tarr.each do |x| \n\t\th [x] = arr.count(x)\n\tend\n\tarr = h.values.sort\n highest_count = arr.last\n h.select {|k,v| v == highest_count}.keys\nend", "def mode(array)\n table = Hash.new(0)\n for a in array\n table[a] = table[a] + 1\n end\n highest_freq = 0\n table.each do |k, v|\n if v > highest_freq\n highest_freq = v\n end\n end\n modes_hash = table.select{|k, v| highest_freq == v}\n modes = modes_hash.keys\nend", "def mode(array)\n frequencies = Hash.new(0)\n new_array = []\n array.each do |num|\n frequencies[num] += 1\n end\n frequencies = frequencies.sort_by {|a, b| b }.to_h\n modes = frequencies.values.last\n frequencies = frequencies.select {|k, v| v == modes}\n frequencies.each do |key, value|\n new_array.push(key)\n end\n new_array = new_array.sort\n p new_array\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 mode(array)\n freq = Hash.new\n array.each do |x|\n if freq[x].nil?\n freq[x] = 1\n else freq[x] += 1\n end\n end\n max = 0\n freq.each do |x, y|\n if y >= max\n max = y\n end\n end\n most = freq.select {|x, y| y == max}\n most.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 find_most_frequent_integer(arr)\n count_hash = arr.each_with_object (Hash.new(0)) { |element, counts| counts[element] += 1 }\n count_hash.each { |key, value| return key if value == count_hash.values.max }\nend", "def mode(array)\n new_hash = Hash.new\n array.uniq.each {|x| new_hash[x] = 1}\n new_hash.each {|element, value| new_hash[element] = array.count(element)}\n max = 0\n new_hash.each {|key, value| max = value if value > max}\n new_hash.select! {|key, value| value == max}\n return new_hash.keys\nend", "def mode array\n freq = Hash.new(0)\n array.each do |num|\n freq.store(num, freq[num]+1)\n end\n target = []\n freq.each do |k,v|\n if v == freq.values.max\n target << k\n end\n end\n target\n \nend", "def mode(array)\n hash = Hash.new(0)\n new_array = []\n\n array.each do |i|\n hash[i] += 1\n end\n\n hash = hash.sort_by { |key, value| value }.reverse.to_h\n\n hash.each do |key, value|\n if value == hash.values[0]\n new_array << key\n end\n end\n p new_array\nend", "def mode(array)\n freq = Hash.new\n array.each do |x|\n if freq[x].nil?\n freq[x] = 1\n elsif freq[x] >= 1\n freq[x] += 1\n end\n end\n max = 0\n freq.each do |x, y|\n if y != nil && y >= max\n max = y\n end\n end\n most = freq.select {|x, y| y == max}\n most.keys\nend", "def mode(array)\n frequencies = array.each_with_object(Hash.new(0)) { |word, count| count[word] += 1 }\n mode_array = frequencies.select { |frequent_words, frequent_counts| frequent_counts == frequencies.values.max }.keys\n return mode_array\nend", "def sort_by_occurrence_h(input)\n output = input.each_with_object(Hash.new(0)){ |tag, counts| counts[tag] += 1 }\n output = Hash[output.sort_by{ |tags, counts| counts}.reverse]\n return output\n end", "def 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 mode(arr)\n count = Hash.new(0)\n arr.each { |value| count[value] += 1 }\n count = count.sort_by { |key, value| value }\n count.reverse!\n high = count[0][1]\n count.select! { |key, value| value == high } \n result = count.collect(&:first)\n result.sort!\nend", "def mode(array)\n\tfrequencies = Hash.new(0)\n\tarray.each { |array_object| frequencies[array_object]+=1 }\n\tfrequencies = frequencies.select { |key,value| value>= frequencies.values.max }\n\tmode_array = []\n\tfrequencies.each_key {|key| mode_array << key}\n\treturn mode_array\nend", "def mode(array)\n\n data = Hash.new\n\n while array.length > 0\n frequency = array.count(array[0])\n\n data[array[0]] = frequency\n array.delete(array[0])\n end\n# p array\n data\n data.each do |k, v|\n array << k if v == data.values.max\n end\n p array\nend", "def my_uniq(arr)\n hashed = arr.map {|value| [value, arr.count(value)]}.flatten\n return Hash[*hashed].keys\nend", "def frequencies\n inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end", "def mode(array)\n hash = Hash.new(0)\n num_a = []\n final_a = Array.new\n\n array.each do |value|\n hash[value] += 1\n end\n\n num_a = hash.values.sort\n\n hash.each do |k,v|\n if v == num_a[-1]\n final_a << k\n end\n end\n\n return final_a\nend", "def 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 mode(array)\n frequency = Hash.new(0)\n array.each do |x|\n frequency[x] += 1\n end\n mode_array = []\n frequency.each do |y, z|\n if z == frequency.values.max\n mode_array << y\n end\n end\n mode_array.sort\nend", "def mode(array)\n container = []\n final = []\n h = Hash.new(0)\n array.each {|object| h[object] += 1}\n h.each do |key, value|\n container << value\n end \n highest = container.max\n h.each do |key, value| \n if value == highest\n final << key\n end\n end\n final\nend", "def mode(array)\n count = Hash.new(0)\n array.each {|element| count[element] += 1}\n max = count.values.max\n count.keep_if {|key,value| value == max}\n count.keys\nend", "def count_occurrences(array)\n occurrences = {}\n\n array.uniq.each do |element|\n occurrences[element] = array.count(element)\n end\n\n occurrences.each do |element, count|\n puts \"#{element} => #{count}\"\n end\nend", "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 mode (array)\n\tcounter = Hash.new(0)\n\tarray.each do |element| \n\t\tcounter[element] += 1\n\tend\n\n\tcounter.keep_if do |element,count| \n\t\tcount == counter.values.max \n\tend\n\n\treturn counter.keys\nend", "def mode(array)\n frequency = {}\n array.each do |item|\n if frequency.has_key?(item)\n frequency[item] = frequency[item] + 1\n else\n frequency[item] = 1\n end\n end\n\nmax_value = 0\nfrequency.each_value do |value|\n if value > max_value\n max_value = value\n end\nend\nmax = []\nmax_key = \"\"\nmax_freqency = []\nfrequency.each do |key, value|\n if value >= max_value\n max_value = value\n max_key = key\n max_freqency << max_key\n end\nend\nmax_freqency\nend", "def find_most_frequent_integer(arr)\n empty = {}\n max = {}\n num = nil\n \n i = 0 \n while i < arr.length\n if empty.has_key?(arr[i]) == true\n empty[arr[i]] += 1\n else\n empty[arr[i]] = 1\n end\n i+=1\n end\n \n empty.each do |key,value|\n if value == empty.values.max\n max[key] = value\n num = key\n end\n end\n \n max.length > 1 ? nil : num\n \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 sort(arr)\n word_count = {}\n arr.each do |word|\n if word_count[word.length]\n word_count[word.length] << word\n else\n word_count[word.length] = [word]\n end\n end\n word_count.sort.map{|set|set.last.sort}.flatten\nend", "def find_most_frequent_integer(arr)\n most = []\n freq = Hash.new(0)\n arr.each do |i|\n freq[i] += 1\n end\n freq.each do |k,v|\n if v == freq.values.max\n most.push(k)\n end\n end\n if most.count > 1\n nil\n else return most[0]\n end\nend", "def mode(array)\n hash = Hash.new {|hash,key| hash[key] =0}\n array.each do |item|\n hash[item] = array.count(item)\n end\n array2 = []\n hash.each do |k, v|\n if v == hash.values.max\n array2 << k\n end\n end\n array2\nend", "def array_to_count_hash(arr)\n h = {}\n arr.each do |el|\n if h.has_key?(el)\n h[el] += 1\n else\n h[el] = 1\n end\n end\n return h\n end", "def mode(array)\n count = Hash.new(0) \n array.each do |x| count[x] += 1 end #counts number of occurences and stores in count hash\n \n if array == array.uniq # if array values occur equally, return array\n array\n else\n array.keep_if{\n \t|x| array.count(x) >= count.values.max #keep all values that occur same number of times as highest count{} frequency\n \t}.uniq!\n end\nend", "def mode(array)\n hash = Hash.new {|hash,key| hash[key] =0}\n array.each do |item| \n hash[item] = array.count(item)\n end\n array2 = []\n hash.each do |k, v| \n if v == hash.values.max\n array2 << k\n end\n end\n p array2\n end", "def weighted_uniq(array)\n weighted_hash = array.each_with_object({}) do |v, acc|\n acc[v] ||= 0\n acc[v] += 1\n end\n n = 0\n (weighted_hash.sort_by do |x|\n n += 1\n [-x[1], n]\n end).to_h\n end", "def equalizeArray(arr)\n hash = {}\n arr.sort.each { |h| hash.store(h, 0) }\n arr.each do |d|\n hash[d] = hash[d] + 1 if hash.key?(d)\n end\n max = 0\n hash.each { |_k, v| v > max ? max = v : max }\n\n arr.length - max\nend", "def count_hash(arr)\n count = {}\n arr.each {|e|\n count[e] ||= 0\n count[e] += 1\n }\n count\n end", "def mode(arr)\n hash = Hash[arr.map {|x| [x, 0]}]\n arr.each do |item|\n if hash.has_key?(item)\n hash[item] += 1\n end\n end\n max = hash.values.max\n new_hash = Hash[hash.select { |k, v| v == max}]\n return new_hash.keys\nend", "def mode(array) \n\th = Hash.new(0)\n\tarray.each do |x| \n\t\th[x] = h[x] + 1 \n\tend\n\th.select { |k,v| v == h.values.max }.keys\nend", "def mode(arr)\n hash = arr.inject(Hash.new(0)) {|h, v| h[v] += 1; h}\n output = []\n hash.each {|k, v| output << k if v == hash.values.max}\n return output\nend", "def mode(arr)\n hash = arr.inject(Hash.new(0)) {|h, v| h[v] += 1; h}\n output = []\n hash.each {|k, v| output << k if v == hash.values.max}\n return output\nend", "def find_most_frequent_integer(arr)\n highest_value = Hash.new(0)\n store_integer = Array.new\n arr.each do |x|\n highest_value[x] += 1\n end\n highest_value.each do |key,value|\n if value == highest_value.values.max \n store_integer.push(key) #need to put the highest value somewhere, so an array it will have to be! This was the hardest step for me. I could figure out how to return the key from the above step, but that wasn't helpful since one couldn't directly compare the keys (but putting them in an array worked.)\n end\n end \n if store_integer.length == 0 or store_integer.length >= 2 #This will return nil if there is no most frequent integer (like in the case of an empty hash), or if there are several of the most frequent integer amount\n return nil\n else\n return store_integer[0] \n end \n \nend", "def mode(array)\n h = array.each_with_object(Hash.new(0)) do |item, list|\n list[item] += 1\n end\n a = []\n h.each {|k, v| a.push(k) if v == h.values.max}\n a\nend", "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 mode(array)\n hash = Hash.new(0)\n array.each { |key| hash[key] += 1}\n max_value = hash.values.max\n output_array = hash.select { |key, value| value == max_value }.keys\n output_array\nend", "def mode(array)\n frequency = Hash.new(0)\n\tarray.each do |key|\n\t\tfrequency[key] +=1\n\tend\n\tmode = []\n\tfrequency.each do |k, v|\n if k == frequency.values.max\n mode << v\n end\n end\n\treturn mode\nend", "def count_occurrences(array)\n hash = {}\n array.each do |element|\n if hash.has_key?(element)\n hash[element] += 1\n else\n hash[element] = 1\n end\n end\n hash.each { |key, value| puts \"#{key} => #{value}\" }\nend", "def mode(array)\n h = Hash.new(0)\n array.each do |i| \n h[i] += 1\n end\n h.sort_by {|key, value| p value}\n key = h.keys[0]\n p key\n p Array.new(1, key)\n \nend", "def most_frequent(nums)\n hash = {}\n max_occurence = 0\n\n nums.each do |num|\n if !hash.has_key?(num.to_s)\n hash[num.to_s] = 1\n else\n hash[num.to_s] += 1\n if max_occurence < hash[num.to_s] \n max_occurence = hash[num.to_s]\n end\n end\n end\n\n hash.select { |key, value| value == max_occurence }\n .map { |key, value| key.to_i} \nend", "def mode(array)\n counter = array.inject(Hash.new(0)) {|hash, key| hash[key] += 1; hash }\n new_array = []\n counter.each do |k, v|\n if v == counter.values.max\n new_array << k\n end\n end\n return new_array\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 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 mode (array)\n # -make a hash to keep track of each item's frequecy\n tracker = {}\n# -iterate through the input array\n array.each do |x|\n# -create a key for each different thing in the input array\n if tracker.has_key?(x) # use the value to keep track of how often each thing shows up\n #increment the value up by 1\n tracker[x] += 1\n puts \"#{x} is incrementing\"\n else\n #add it\n tracker[x] = 1\n puts \"#{x} is being set\"\n end \n # -check the most frequent value \n \n puts \"tracker hash is like this: #{tracker}\"\n \n end \n puts \"array.each part done\"\n \n final_values = tracker.values\n highest = 0\n final_values.each do |x|\n if x > highest\n highest = x\n end \n \n end\n puts \"highest is #{highest}\"\n \n \n # find all the highest values and put em in an array\n output = []\n tracker.each do |key, value|\n if value == highest\n output << key\n end\n \n end\n return output\nend", "def mode(array)\n y = Hash.new(0)\n array.each do |x|\n y[x] += 1\n end\n\n new_array = y.select{|a, b| b == y.values.max}.keys\nend", "def most_common_number(array)\n #var\n numbers_and_count = Hash.new 0\n \n array.each do |num|\n \tnumbers_and_count[num] += 1\n end\n #var\n most = numbers_and_count.sort_by { |key, value| value }.reverse\n \n top = Hash[*most.first]\n top.select { |k,v| p k }\n\nend", "def mode(array)\n mode_hash = Hash.new\n array.each {|x| mode_hash[x] = 0}\n mode_hash.each do |k,v| \n mode_hash[k] = array.count(k)\n end \n new_array = []\n mode_hash.each do |k, v|\n if v == mode_hash.values.max; new_array << k\n end\n end\n return new_array\nend", "def mode(array)\r\n new_hash = Hash.new(0)\r\n output = []\r\n \r\n array.each do |i|\r\n new_hash[i] += 1\r\n end\r\n \r\n new_hash.each do |i, j| \r\n if new_hash.values.max == j\r\n output << i\r\n end\r\n end\r\n output\r\nend", "def mode(array)\n hash = Hash.new(0)\n array.each {|item| hash[item] += 1}\n answer = hash.max_by {|key, value| value}\n p answer\nend", "def mode(array)\n hash = {}\n\n for i in 0...array.length\n count = 0\n current_element = array[i]\n for i in 0...array.length\n if current_element == array[i]\n count += 1\n else\n end\n hash[current_element] = count\n end\n end\n max_array = []\n hash.each {|key, value| (max_array.push(key)) if value == hash.values.max }\n return max_array\n\nend", "def my_uniq(arr)\n count = Hash.new(0)\n arr.each {|ele| count[ele]+= 1}\n count.keys\nend", "def count_occurrences(array)\n count = Hash.new\n counter = 0\n array.each { |i| \n if count[i] == nil\n count[i] = 1\n else\n count[i] = count[i] += 1\n end\n counter += 1\n }\n count.each_pair { |k, v| puts \"#{k} => #{v}\"}\nend", "def mode(array)\n hash = {}\n array.each do |x| \n if !hash.has_key?(x)\n \thash[x] = 1\n else\n hash[x] += 1\n end \n end\n array_new = []\n max_value = hash.values.max\n hash.each do |key, value|\n if value == max_value\n array_new.push(key)\n end \n end\n return array_new\nend", "def unique_elements(array)\n hash = Hash.new(0)\n array.each { |ele| hash[ele] += 1 }\n\n hash.keys\nend", "def gem_stones array\n\n gem_list = []\n\n array.map! do |x|\n x.chars.uniq.sort\n end\n\n sum_of_array = array.flatten\n freq = Hash.new(0)\n sum_of_array.each do |key|\n freq.store(key, freq[key]+1)\n end\n freq.each do |key, value|\n if value == array.size\n gem_list << key\n end\n end\n gem_list \nend", "def mode(array)\n hash = Hash.new(0)\n array.each do |x|\n if hash.has_key?(x) == true\n hash[x] += 1\n else\n hash[x] = 1\n end\n end\n hash.select{|k,v| v == hash.values.max}.keys\nend", "def find_most_frequent_integer(arr)\n #use a Hash to keep track of the number of duplicates\n new_hash = Hash.new(0)\n #iterate through each element in the array\n arr.each do |element|\n #add all elements to the new_hash and add one to the key's value if there's a duplicate\n new_hash[element] += 1\n end\n #make sure that the Array passed in contained something\n if new_hash.empty?\n return nil\n end\n #create empty array to add the key(s) with the \"highest value\" value(s)\n comparison_array = []\n #iterate through each key and value in new_hash\n new_hash.each do |x, y|\n #compare each value to the \"max\" value of the hash\n if y == new_hash.values.max\n #add any keys that match the \"highest value\" value in the \n #hash to the new array\n comparison_array.push(x)\n end\n end\n #check if more than one key was added to the new array\n if comparison_array.count > 1\n #if the array contains more than one element then there was more than one\n #repeated integer\n return nil\n else\n #if the array contains only one element then that element is the most\n #frequent integer\n return comparison_array[0]\n end\nend", "def mode(input_array)\n counts = Hash.new\n input_array.each do |element|\n if counts.has_key?(element)\n counts[element] += 1\n else\n counts[element] = 1\n end\n end\n\n max = 0\n counts.each do |key, value|\n if value > max\n max = value\n end\n end\n\n output_array = Array.new\n counts.each do |word, count|\n if count == max\n output_array.push(word)\n end\n end\n return output_array\nend", "def analysis\n hash = {}\n @array.each do |item|\n chars = item.chars.to_a - @used_chars\n\n chars.each do |char|\n if hash[char] == nil\n hash[char] = 1\n else\n hash[char] += 1\n end\n end\n end\n\n hash.sort_by { |_, v| -v }\n end", "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", "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 hash = Hash.new(0)\n array.each do |x|\n hash[x] += 1\n end\n new_array=Array.new\n hash.each do |key, value|\n if value == hash.values.max\n new_array << key\n end\n end\n return new_array\nend", "def count_occurrences(arr)\n answer = Hash.new(0)\n arr.each { |item| answer[item] += 1}\n answer.each {|key, value| puts \"#{key} => #{value}\" }\nend", "def find_unique_elements(arr)\n freq = Hash.new #hash to count integers in using key as integer and value as count\n answer = Array.new #array to store the answer to be returned in\n\n \n arr.each {|a| #loop through every element in array \n if freq[a] != nil #check to see if hash value exists\n freq[a] = freq[a] + 1 #add 1 to the hash value\n else \n freq[a] = 1 #create the hash value\n end\n }\n\n\n freq.each {|key, value| #loop through all key and value combinations in hash\n if value == 1 #If the value is 1 it is unique so add it to the answer array to be returned\n answer << key\n end\n } \n return answer\n\nend", "def count_occurrences_improved(arr)\n counts = Hash.new { |h, k| h[k] = 0 }\n arr.each { |element| counts[element] += 1 }\n counts.each { |element, count| puts \"#{element} => #{count}\" }\nend" ]
[ "0.77981555", "0.7663397", "0.753327", "0.75237584", "0.74856526", "0.7475636", "0.74359256", "0.73970824", "0.73486996", "0.73171914", "0.72864336", "0.7269778", "0.72477657", "0.7234242", "0.72316027", "0.722736", "0.7224914", "0.7210071", "0.71697426", "0.71290445", "0.71283907", "0.7112715", "0.7105058", "0.708003", "0.70724356", "0.70681673", "0.7025258", "0.7023261", "0.7011201", "0.6996018", "0.6975782", "0.6946695", "0.6940272", "0.6936421", "0.6929191", "0.69245046", "0.69231933", "0.6919071", "0.69107825", "0.68926835", "0.6889313", "0.6888416", "0.6870949", "0.68659866", "0.6856639", "0.6837968", "0.6834803", "0.6833694", "0.6831356", "0.68167335", "0.6811089", "0.6778918", "0.6777587", "0.67643815", "0.67500055", "0.6736181", "0.6733405", "0.6730635", "0.67257273", "0.6724224", "0.6721188", "0.6693612", "0.6686894", "0.6661519", "0.66589355", "0.66540015", "0.66540015", "0.66489416", "0.6648791", "0.6645684", "0.66433966", "0.66390806", "0.6635456", "0.6630714", "0.6621308", "0.6610454", "0.6603217", "0.6599606", "0.6592766", "0.65917677", "0.65904945", "0.6582319", "0.6580867", "0.65635157", "0.6553358", "0.655261", "0.6542578", "0.65364915", "0.6527687", "0.6523717", "0.65236545", "0.6516918", "0.64976907", "0.6491692", "0.6487459", "0.648709", "0.64785105", "0.64773756", "0.64751214", "0.6469708" ]
0.709044
23
We can only retrieve one invoice body at a time, hence Body is excluded from the query fields, but is populated using the `find` class method
def body remote[:body] || reload.remote[:body] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def invoice\n @invoice ||= Invoice.find(params[:id])\n end", "def set_body\n @body = Body.find(params[:id])\n end", "def invoice\n SalesEngine::Invoice.find_by_id(self.invoice_id)\n end", "def invoice_items\n invoice_items = engine.invoice_item_repository.parse\n invoice_items.select {|invoice_item| invoice_item.item_id == id}\n end", "def index\n @invoicedetails = Invoicedetail.limit(100).all\n end", "def get_invoice(company, invoice_id, options = {})\n res = self.class.get(\"/#{company}/OE/OEInvoices(#{invoice_id})\", {query: options})\n Sage300Kit::Object.new(res)\n end", "def invoice_items\n SalesEngine::InvoiceItem.find_all_by_item_id(self.id)\n end", "def invoices\n Invoice.where(email: email)\n end", "def body\n self.read_body\n self.get_body\n end", "def set_businessdocument\n # find any invoice.type by using Businessdocument as object class\n # so that search for STI object is NOT used\n @businessdocument = Billing::Businessdocument.find(params[:id])\n end", "def set_invoice\n @invoice = Invoice.where(:invoice_id => params[:id])\n # @invoice = Invoice.find(params[:id])\n end", "def index\n @invoice_items = @invoice.invoice_items\n end", "def body\n fetch\n @body\n end", "def body\n self[:body]\n end", "def get_item_from_body(body)\n get_item_from_result(body.fetch('Item', {}))\n end", "def find_soap_body\n envelope = self[self.keys.first] || {}\n body_key = envelope.keys.find { |key| /.+:Body/ =~ key } rescue nil\n body_key ? envelope[body_key].map_soap_response : {}\n end", "def invoice(id)\n self.invoices.detect { |i| i.id == id }\n end", "def index\n @invoice_rows = @invoice.invoice_rows\n end", "def set_invoicedetail\n @invoicedetail = Invoicedetail.find(params[:id])\n end", "def invoice_item\n Zapi::Models::InvoiceItem.new\n end", "def body\n @body ||= process_text(@raw_body)\n end", "def msg_body; @msg_body ||= BsonBody.new; end", "def set_invoice\n @invoice = Mjbook::Invoice.where(:id => params[:id]).first\n end", "def body\n read_attribute(:body) || ''\n end", "def body\n part('body')\n end", "def body\n self['body']\n end", "def set_pln_invoice\n @pln_invoice = PlnInvoice.find(params[:id])\n @pln_invoice_items = @pln_invoice.pln_invoice_items\n @prices = @pln_invoice_items.where.not(price_netto: nil).first\n end", "def getBody\n @body\n end", "def invoice\n params['invoice']\n end", "def invoice\n params['invoice']\n end", "def body\n @body || \"\"\n end", "def index\n @raw_material_invoice_items = RawMaterialInvoiceItem.all\n end", "def set_invoice\n p Invoice.last\n p Invoice.last.id\n p params[:id]\n p params[:id].class\n p params[:id].to_i\n p params[:id].to_i.class\n @invoice = Invoice.find(118)\n end", "def find_or_initialize_invoice\n @invoice = Invoice.find_or_initialize_by_survey_id(@survey.id)\n end", "def body\n @body ||= reader_doc.content(true).strip\n end", "def body_attributes\n {}\n end", "def body_attributes\n {}\n end", "def body\n @body ||= Page.convert_raw_to_html(raw_body)\n end", "def get_invoice_by_id(invoice_id)\n get_invoice(invoice_id)\n end", "def po_items\n # po_items = self.po_headers.joins(:po_lines).select(\"po_lines.item_id\").where(\"po_headers.organization_id = ?\",self.id).order(\"po_lines.created_at DESC\")\n po_items = PoLine.includes(:po_header).where('po_headers.organization_id = ?', id).order('po_headers.created_at DESC')\n po_items = po_items.collect(& :item_id)\n Item.where(id: po_items)\n end", "def body\n return @body\n end", "def get_body_params\n return @_get_body_params ||= begin\n fields = self.get_allowed_parameters || self.get_fields\n\n # Filter the request body.\n body_params = request.request_parameters.select { |p| fields.include?(p) }\n\n # Add query params in place of missing body params, if configured.\n if self.class.accept_generic_params_as_body_params\n (fields - body_params.keys).each do |k|\n if (value = params[k])\n body_params[k] = value\n end\n end\n end\n\n # Filter primary key if configured.\n if self.class.filter_pk_from_request_body\n body_params.delete(self.get_model&.primary_key)\n end\n\n # Filter fields in exclude_body_fields.\n (self.class.exclude_body_fields || []).each { |f| body_params.delete(f.to_s) }\n\n body_params\n end\n end", "def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end", "def body\n if defined? @body\n @body\n else\n Null\n end\n end", "def body\n return @final if @final\n\n @final = {}\n @final.merge! query_body if @query && @query.any?\n @final.merge! sort_body\n @final.merge! filter_body if @filters.any?\n\n @final[:from] = (@current_page - 1) * @page_size if @current_page\n @final[:size] = @page_size if @page_size\n\n @final[:explain] = true\n\n @final\n end", "def index\n @bodydata = Bodydatum.all\n end", "def body\n @attributes[:body]\n end", "def body()\n #This is a stub, used for indexing\n end", "def find_by_id(id)\n invoices.find { |invoice| invoice.id == id }\n end", "def body\n return @body\n end", "def body\n return @body\n end", "def body\n return @body\n end", "def body\n return @body\n end", "def show\n # retrieve the invoice\n @invoice = Invoice.to_adapter.get(params.require(:id))\n # respond 404 when invoice was not found\n head(:not_found) unless @invoice\n end", "def show\n @invoices = Invoice.all\n @invoice = Invoice.find(params[:id])\n end", "def unique_body\n return @unique_body\n end", "def invoice_params\n # params[:invoice]\n end", "def raw_body\n @attributes[:raw_body]\n end", "def invoice\n @ipn['invoice']\n end", "def sales_invoice\n sales_invoices.order(:date, :id).first\n end", "def body body=nil\n @response.body = body if body\n @response.body\n end", "def body=(value)\n @body = value\n end", "def invoice\n \t\t\tZapi::Models::Invoice.new\n \tend", "def invoice_id\n @invoice_id if @invoice_id\n end", "def body_raw\n @body_raw ||= body(true).read\n @body_raw\n end", "def invoice_items_by_id_collection(collection)\n FinderClass.match_by_data(@invoice_items.all, collection, :id)\n end", "def invoice_messages\n @invoice_messages ||= Harvest::API::InvoiceMessages.new(credentials)\n end", "def set_invoice\n # @invoice = Invoice.find(params[:id])\n end", "def body_contains\n return @body_contains\n end", "def convert_to_active_record\n if invoice = ::Invoice.where(:freshbooks_id => self.invoice_id).first # TODO - still need verification that documents are the same\n return invoice\n end\n\n invoice = ::Invoice.new\n\n self.schema_definition.members.each do |key, key_info|\n # begin\n if key_info[:type] != :array\n new_key, new_value = convert_key(key)\n next if new_key == '[NEXT]'\n invoice.send(new_key + '=', new_value)\n else\n # Item lines\n self.send(key).each do |line|\n next if quantity == 0.0 # Freshbooks sends blank lines too\n new_line = invoice.invoice_lines.new\n\n # If line.type == 'Item', find or create company item by name (verify by unit_cost)\n # new_line.item_id = found_item.id\n # new_line.quantity = line.quantity\n\n # line.schema_definition.members.each do |line_key, line_key_info|\n # new_line_key, new_line_value = convert_line_key(line, line_key)\n # next if new_key == '[NEXT]'\n # invoice.send(new_line_key + '=', new_line_value)\n # end\n end\n end\n # rescue => e\n # puts e.inspect\n # end\n end\n\n # TODO - verify totals\n return invoice\n end", "def load_voices\n # TODO\n end", "def body\n if @parsed_body\n parsed_body.to_s\n else\n @body\n end\n end", "def article_body\n respond_to?(:body) ? body : ''\n end", "def set_article\n @article = Article.find(params[:id])\n @article_bodies=ArticleBody.find(params[:id])\n end", "def body\n @body_io.read.tap { @body_io.rewind }\n end", "def body_or_subject_contains\n return @body_or_subject_contains\n end", "def body=(value)\n @body = value\n end", "def body=(value)\n @body = value\n end", "def body=(value)\n @body = value\n end", "def body=(value)\n @body = value\n end", "def body\n @document.to_s\n end", "def body_id\n @body_id = (action_name == 'index') ? resource_collection_name : resource_instance_name\n end", "def body\n @note.content\n end", "def invoice\n\tparams['invoice']\n end", "def read\n\t\t\t\t\t@body.read\n\t\t\t\tend", "def invoices_by_id_collection(collection)\n FinderClass.match_by_data(@invoices.all, collection, :id)\n end", "def body\n @body ||= @request.body.read\n end", "def set_invoice\n if params[:invoice_id]\n @invoice = Invoice.find(params[:invoice_id])\n else\n @invoice = Invoice.find(params[:id])\n end\n end", "def body\n render text: fetch_email(params[:id]).body, content_type: 'text/html'\n end", "def body_retrieve\n ret = Hash.new\n ret[:access_token] = self.access_token\n ret[:type] = self.institution\n ret[:email] = self.email\n ret.merge(body)\n end", "def set_body\n self.body = \"\" unless body\n body\n end", "def set_body\n self.body = \"\" unless body\n body\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 set_bodydatum\n @bodydatum = Bodydatum.find(params[:id])\n end", "def set_incominginvoice\n @incominginvoice = Incominginvoice.find(params[:id])\n end", "def body\n process_message_body if !@body\n @body\n end", "def set_invoice\n @invoice = Invoice.find(params[:id])\n end", "def set_invoice\n @invoice = Invoice.find(params[:id])\n end", "def set_invoice\n @invoice = Invoice.find(params[:id])\n end", "def set_invoice\n @invoice = Invoice.find(params[:id])\n end", "def set_invoice\n @invoice = Invoice.find(params[:id])\n end" ]
[ "0.5794716", "0.5673328", "0.55782247", "0.5555924", "0.5503112", "0.5411917", "0.5398467", "0.53151846", "0.52824", "0.5280424", "0.52706444", "0.52585274", "0.5214671", "0.5208622", "0.51925343", "0.5191807", "0.5182178", "0.5181957", "0.5157521", "0.515243", "0.51515514", "0.5143004", "0.5128995", "0.5126496", "0.51172024", "0.50933164", "0.5093186", "0.5088284", "0.503012", "0.503012", "0.5026556", "0.50259906", "0.501952", "0.5006929", "0.5002798", "0.4998536", "0.4998536", "0.49962547", "0.49834663", "0.49774885", "0.49767396", "0.49767056", "0.49632952", "0.49614105", "0.49471626", "0.4932528", "0.49255392", "0.49191853", "0.4912092", "0.4908204", "0.4908204", "0.4908204", "0.4908204", "0.49081257", "0.48970732", "0.48919412", "0.48896608", "0.48863688", "0.48836243", "0.48777986", "0.48744664", "0.48707357", "0.48669085", "0.4865486", "0.4864694", "0.48554412", "0.48552155", "0.48448187", "0.48399603", "0.48307082", "0.48274216", "0.48268628", "0.48242652", "0.48204932", "0.481992", "0.4813808", "0.48024172", "0.48024172", "0.48024172", "0.48024172", "0.4796555", "0.47931132", "0.47928676", "0.47902292", "0.47888872", "0.47833434", "0.47819477", "0.47649682", "0.47612852", "0.47582388", "0.4755501", "0.4755501", "0.47459206", "0.4744633", "0.47370237", "0.47366956", "0.4729278", "0.4729278", "0.4729278", "0.4729278", "0.4729278" ]
0.0
-1
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: Add values to each item in the list set default quantity print the list to the console [can you use one of your other methods here?] output: [what data type goes here, array or hash?] We would use a hash over here Method to add an item to a list input: item name and optional quantity steps: Add variable inside the method output: New item will be added with a new quantity Method to remove an item from the list input: Use delete to delete an item from the list steps: Use .delete to delete a specific item output: Removes any unwanted item from the list Method to update the quantity of an item input: Will take two parameters item and quantity steps: Will update items as needed output: Specific item will be updated on the list Method to print a list and make it look pretty input: Print the list to the console steps: Use p to print output: List will be printed
def create_list(items) grocery_list_array = items.split(" ") grocery_list = Hash.new grocery_list_array.each {|item| grocery_list[item] = 1} grocery_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(list, item, quantity=1)\r\n# input: item name and optional quantity\r\n# steps: \r\n # Use shopping list as input\r\n # Use the item to be added as 2nd input\r\n # Use the item quantity as a 3rd input (look up whether optional input is possible)\r\n # Add the item and quantity to the shopping list\r\n list[item] = quantity\r\n# output: shopping list with the added item and quantity\r\n printlist(list)\r\nend", "def add_item(list, add_item, add_quantity=1)\n# steps:\n # Add item as key and quantity as value to final_list hash(item and quantity will be user inputs)\n list[add_item] = add_quantity\n # Return updated hash\n list\nend", "def add_item(my_list, item, quantity)\r\n #input: a string seperated by an integer \r\n #steps: use a method that adds an item and quantity to the hash.\r\n my_list.store(item, quantity)\r\n # use a hash or store method hash.merge!(key => value) \r\n #output = hash with the updated item/quantity. \r\n my_list\r\n \r\nend", "def add_item(list, item, quantity = 1)\r\n# input: list, item name, and optional quantity\r\n# steps: \r\n # check for optional quantity. if not present, set to default (1)\r\n list[item] = quantity\r\n # update list with input\r\n puts \"#{item.upcase} has been added to your grocery list!\"\r\n p list\r\n# output: complete list, updated\r\nend", "def create_list(user_list)\n# input: string of items separated by spaces (example: \"carrots apples cereal pizza\")\n# puts \"\"\n# steps:\n # [fill in any steps here]\n list_array = user_list.split(\",\")\n # set default quantity\n quanity = 1\n # print the list to the console [can you use one of your other methods here?]\n p list_array.collect { |item| [item, quanity] }\n $list_hash = Hash[list_array.collect { |item| [item, quanity] } ]\n# output: [what data type goes here, array or hash?] Print result in hash\n p $list_hash\n $list_hash\nend", "def add_item(list_name, item, quantity=1)\r\n# input: list, item name, and optional quantity\r\n# steps: add item and its quantity to the hash\r\n list_name.store(item, quantity)\r\n# output: hash with new item\r\n p list_name\r\nend", "def add_item(list, name, quantity = 1) \r\n# input: item name and optional quantity\r\n# steps: \r\n# create add method with name and optional quantity arguments\r\n# add name and quantity to hash\r\n list[name] = quantity\r\n# output: print \"your item has been added to the hash\"\r\n return list\r\nend", "def update_item(list, item, quantity)\r\n add_item(list, item, quantity)\r\n# input: Shopping list, item to be updated, new quantity\r\n# steps:\r\n # Use shopping list as input\r\n # Use item to be updated as input\r\n # Use new quantity to be updated as input\r\n # Update the quantity of the item on the list\r\n # list[item] = quantity\r\n# output: shopping list with updated quantity\r\n # printlist(list)\r\nend", "def create_list_items(input_string)\n \n hsh = {}\n \n # create an array containing each item \n array_input = input_string.split(' ')\n \n # create a hash from the array (iterate), containing the information of key/value pairs \n array_input.each do |item|\n # set default quantity as value\n hsh[item] = 0\n end \n \n # print the list to the console (we will use the last method)\n print_list(hsh)\n \n # output: hash data structure of key/value pairs\n return hsh\nend", "def add_item(list, item_name, optional_quantity)\n\nlist[item_name] = optional_quantity\n\n# input: list, item name, and optional quantity\n# steps:\n # Add new hash key based on item name\n # Tell method there may or may not be a argument passed in for quantity\n # assign quantity to 'optional-quantity' argument in method definition\n # Access method that contains initialized hash def add_item(create_list, item_name, quantity = 3)\n# output:\n # updated grocery list\nend", "def update_quanity(list, item, quantity)\r\n# input: list, item and quantity to be updated to\r\n# steps:\r\n # check if item exists\r\n # update quantity\r\n list[item] = quantity\r\n # print success \"your cart has been updated!\"\r\n puts \"The quantity for #{item.upcase} has been updated in your grocery list!\"\r\n p list\r\n# output: updated list with new quantity\r\nend", "def create_list(string)\n puts \"What is the default item quantity?\"\n default_quantity = gets.chomp.to_s\n list_array = string.split(' ')\n list_hash = {}\n list_array.each do |item|\n list_hash[item] = default_quantity\n end\n\n print_list(list_hash)\n\n list_hash\nend", "def create_grocery_list(shopping_items)\n # steps:\n # create an empty hash\n grocery_list = {}\n # add items\n # convert input into separate items\n shopping_items = shopping_items.split\n # add items to hash and set default quantity\n shopping_items.each do |item_name|\n grocery_list[item_name.to_sym] = 1\n end\n # print the list to the console [can you use one of your other methods here?]\n print_grocery_list(grocery_list)\n# output: explicit return the hash\n grocery_list\nend", "def create_list(input)\n grocery_list = {}\n # convert items in string to hash keys:\n input_array = input.split\n # convert string into array using\n # iterate through array assign each string item to a hash key with default value of x\n # set default quantity\n # iteration loop\n # grocery_list[\"key_name1\"] => 3\n input_array.each do |i|\n grocery_list[i] = 3\n end\n # print the list to the console [can you use one of your other methods here?]\n # call the method for printing a list *below*\n # output: [what data type goes here, array or hash?]\n # make output return hash\n # grocery_list, call the hash so that the last evaluated item is the hash.. and then that is returned\n grocery_list\nend", "def add_item(grocery,item_name,quantity)\n # input: list, item name, and optional quantity\n # steps: insert item_name as a key and quantity as a value to the hash \n grocery[item_name] = quantity\n # output:display the latest list\n display_list(grocery)\nend", "def input (list, item, quantity)\n\tlist[item] = quantity\nend", "def createlist(str)\r\n# steps:\r\n# break the string into an array\r\n items = str.split\r\n item_list = {}\r\n\r\n\t# iterate through array and build hash\r\n items.each do |item|\r\n\r\n\t\t# iterate through array and build hash\r\n\t\t# set default quantity to 1\r\n \titem_list[item] = 1\r\n end\r\n # print the list to the console [the last method that print a list and make it look pretty]\r\n print_list(item_list)\r\n\r\n # output: the hash\r\n return item_list\r\nend", "def additem(list, item, number = 1)\n# input: hash, item name and optional quantity\n# steps: push an item into the hash\n list.store(item, number)\nend", "def add(input_list, item, quantity)\n input_list[item] = quantity\nend", "def create_list(input_string)\n grocery_list = {}\n items = input_string.split(' ')\n items.each do |item|\n add_item_to_list(grocery_list, item, 1)\n end\n\n print_list(grocery_list)\n\n add_item_to_list(grocery_list, \"milk\", 1)\n update_item_from_list(grocery_list, \"Lemonade\", 2)\n update_item_from_list(grocery_list, \"Tomatoes\", 3)\n update_item_from_list(grocery_list, \"Onions\", 10)\n update_item_from_list(grocery_list, \"iceCream\", 20)\n\n print_list(grocery_list)\n\n remove_item_from_list(grocery_list, \"IceCream\")\n\n print_list(grocery_list)\n\nend", "def add_item(list, item, quantity)\n\n\tlist[item] = quantity\n\tlist\n\nend", "def grocery_list(grocery_items)\n # input: string of items separated by spaces (example: \"carrots apples cereal pizza\") \n # steps: \n # Create a new empty data structure (Hash) \n grocery = {}\n # Convert the string parameter into an array of words.\n item = grocery_items.split(\" \")\n # Iterate through the array and get the element.\n item.each do |product|\n # Store the element as a key in the hash.\n # set default quantity an integer with value 3. This is the default value of the keys in the hash.\n grocery[product] = 3\n display_list(grocery)\n end\n # print the list to the console [can you use one of your other methods here?]\n # output: Hash \n grocery\nend", "def add_item(item,amount=1,the_lists)\r\n\t# steps: accept 2 arguments. Item name and Quantity (with default)\r\n\tif the_lists[item] != nil\r\n\t puts \"Item is already on the List !\"\r\n\t puts \"Added amount to the quantity\"\r\n\t the_lists[item] += amount\r\n\telse\r\n the_lists[item] = amount\r\n\tend\r\n\r\n\tprint_list(the_lists)\r\nend", "def add_item(list, item, quantity)\n list[item] = quantity\n p list\nend", "def add_item(item, quantity, list)\n\t# steps: \n\t# if the item is already in the list\n\tif list[item.to_sym] \n\t\t# add to the quantity\n\t\t#list[item.to_sym] = list[item.to_sym] + quantity\n\t\tlist[item.to_sym] += quantity\n\t# otherwise\n\telse\n\t\t# make a new key with the input quantity\n\t\tlist[item.to_sym] = quantity\n\tend\n\t# output:\n\t\t# updated list\n\tlist\nend", "def add_item(item, quantity, list)\r\n list[item] = quantity\r\n p list\r\n list\r\nend", "def add_item(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend", "def shopping_list(items)\n\t# separate the items into an array\n\titems = items.split\n\tputs \"Here are the items you entered.\"\n\tputs items\t\n\t# create the list to add items into.\n\t$list = Hash.new\n\t# enter quantity of each item.\n\titems.each_index do |x|\n\t\tputs \"Enter quantity with no spaces for #{items[x]}.\"\n\t\tquantity = gets.chomp\n\t\t# assign each quantity to the item and add to list\n\t\t$list[:\"#{items[x]}\"] = quantity\n\tend\n\tputs \"Here is your shopping list.\"\n\tputs $list\nend", "def list_add(list, item_name, quantity=1)\n list[item_name] = quantity\n p list\nend", "def create_list(title, list_arr)\n # grocery_list will be a string from user\n # assign an empty hash (will eventually be the list)\n final_list = {}\n # use split method to get list items\n list_arr = list_arr.split\n # Iterate through the elements of the array and insert to hash\n # set default quantity\n list_arr.each { |item| final_list[item]=1}\n # print the list to the console [can you use one of your other methods here?]\n puts print_list(title,final_list)\n final_list\nend", "def add_item(hash_list, new_item, quantity = 1)\n hash_list[new_item] = quantity\n p hash_list\nend", "def update_quantity(list_name, item, value)\r\n# input: list, item name, new quantity\r\n# steps: find item in the hash and change quantity to new quantity\r\n list_name[item] = value\r\n# output: updated hash with new value for item key\r\n p list_name\r\nend", "def create_list(items_string)\r\n\tdefault_quantity = 1\r\n\r\n\tgrocery_list = Hash.new{|hash, key| hash[key] = default_quantity}\r\n\titems_array = items_string.split(\" \")\r\n\t\r\n\titems_array.each do |item| \r\n\t\tgrocery_list[item.to_sym]\r\n\tend\r\n\tprint_list(grocery_list)\r\n\tgrocery_list\r\nend", "def add_item(list, item, quantity=1)\n list[item] = quantity\n p list\nend", "def add_item(list, item, quantity)\n list[item] = quantity\n list\nend", "def list_of_items(userinput)\n itemlist = []\n final_list = {}\n itemlist = userinput.split(' ')\n p itemlist\n quantity = 1\n itemlist.each do |value|\n final_list[value] = 1\n end\n puts final_list\n final_list\nend", "def add_new_items(list, item_name, quantity=1)\n list[item_name] = quantity\n list\nend", "def add_to_grocery_list(grocery_list, item_name, quantity=1)\n # steps: add item to hash and set quantity\n grocery_list[item_name.to_sym] = quantity\n # output: explicit return updated hash\n grocery_list\nend", "def add_item(list, item, qty)\n list[item] = qty\n p list\nend", "def add_item(name, quantity, list)\n list[name] = quantity\n p list\n return list\nend", "def add_change_items(list, item, quantity)\r\n\t#NOTE if changing item make sure to type in 'item' correctly\r\n list[item] = quantity\r\n p list\r\nend", "def add_item_to_list(list_name,item_to_add,quantity_to_add = 1)\n#create a hash element with the item name and the quantity, if specified\n#if no quantity is specified, default value = 1\n new_item = { \n item_name: item_to_add,\n quantity: quantity_to_add\n }\n# insert the hash into array \n list_name.push(new_item)\n new_item\nend", "def add_to_list(list, item, quantity = 1)\n list[item] = quantity\n p list\nend", "def add(list, item, quantity)\r\n\tlist[item] = quantity\r\n\tlist\r\nend", "def list_add(list, item_name, quantity=1)\r\n list[item_name] = quantity\r\n p list\r\nend", "def add_item_to_list(list, new_food, quantity)\n list[new_food] = quantity\n list\nend", "def add_items(list, item_name, quantity=0)\r\n\tlist[item_name] = quantity\r\n\tlist\r\nend", "def add_item(list, item, quantity=0)\n list[item] = quantity\n list\nend", "def create_list(str, default_quantity=1)\n list = {}\n item_array = str.split\n item_array.each do |item|\n list[item] = default_quantity\n end\n print_list(list)\n return list\nend", "def add(list, item, quantity)\r\n list[item] = quantity\r\n list\r\n\r\nend", "def add_item(item,quantity,list)\n\tlist[item] = quantity\nend", "def add_list(list,new_item,quantity=1)\n list[new_item] = quantity\n list\nend", "def add_item(existing_list, new_item, item_integer)\n\t# input: item name and optional quantity\n\t# steps: pass in item name as key and assign value\n\texisting_list[new_item] = item_integer\n\t# output: hash\n\tp existing_list\nend", "def add_item(list, item, quantity)\n #list = item.push\n list[item] = quantity.to_i\n list\nend", "def add_item(list, item, quantity=1)\r\n\tlist[item] = quantity\r\n#\tp list\r\nend", "def print_list(list)\r\n# input: completed list\r\n# steps:\r\n # iterate over list and print formatted list\r\n puts \"Your Grocery List\"\r\n list.each do |item, quantity|\r\n puts \"#{item}, qty: #{quantity}\"\r\n end\r\n # format: each item with its own line\r\n # \"item - quantity\"\r\n# output: implicit return of list\r\nend", "def add_item(new_list, item_name, quantity=1)\r\n \r\n new_list[item_name] = quantity\r\n \r\nend", "def update_quantity(grocery,item_name,new_quantity)\n # input:list, item name, and new_quantity\n # steps: change old value of item_name with the new_quantity\n grocery[item_name] = new_quantity\n # output: display the latest list\n display_list(grocery)\nend", "def update(item, quantity, list)\n\t# steps: if the item is in the list\n\tif list.include? item.to_sym\n\t\t# update the quantity\n\t\tlist[item.to_sym] = quantity\n\telse \n\t\tadd_item(item, quantity, list)\n\tend\n\t# output: return the updated list\n\tlist\nend", "def add_item(list,item,quantity=1)\r\n list[item] = quantity\r\n list\r\nend", "def add_item(item, quantity, list)\n\tlist[item] = quantity\n\titem\nend", "def add_list(item_name, item_list, quantity = 1)\n item_list[item_name] = quantity\nend", "def add(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend", "def add_item(list, item, qty)\n list[item] = qty\n list\nend", "def add_an_item(list_hash,item_name)\n puts 'Adding the item: #{item_name}.'\n puts 'Specify a quantity or type \"default\".'\n quantity = gets.chomp.to_s\n\n if quantity.downcase == 'default'\n quantity = '1'\n end\n\n puts list_hash\n\n if !list_hash[item_name]\n puts 'Added the item: #{item_name}.'\n list_hash[item_name] = quantity\n else\n puts 'Item already exists.'\n end\n\n list_hash\n\nend", "def add_item(list, item, qty=1)\n list[item] = qty\n p \"#{item} : #{list[item]}\"\nend", "def update_quantity(list, item_name, quantity)\n # steps:\n # check IF item is included in list\n # update the item’s quantity\n # ELSE, print a message to the user\n list.include?(item_name) ? list[item_name] = quantity : puts(\"No #{item_name} on the list.\")\n\n # output: return the updated hash or the original hash\n list\nend", "def add_item(list, item, quantity=0)\n\tlist[item] = quantity\n\tlist\nend", "def add_to_list(item,quantity,list)\n list[item]=quantity\nend", "def update_list(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend", "def add(list)\n puts \"add which item?\"\n item=gets.chomp\n puts \"how many\"\n qty=gets.chomp\n list[item]=qty\n return list\nend", "def add_item(item, list, quantity)\n list[item] = quantity\nend", "def add(list, item, quantity)\r\n# input: item name and optional quantity\r\nlist.include?(item) ? list[item] += quantity : list[item] = quantity\r\np list\r\nend", "def adding_item(list,item,quantity = 1)\r\n# if quantity == nil\r\n# quantity = 1\r\n# end\r\n list[item] = quantity\r\n list\r\nend", "def add_item_to_list(string, quantity, hash)\n\thash[string.to_sym] = (hash[string.to_sym] || 0) + quantity\n\tp hash\nend", "def add_item(list, item, quantity)\n list[item] = quantity\n return list\nend", "def add_item(list, item, quantity = 1)\n list[item] = quantity\n list\nend", "def add_to_list(list, item, quantity)\n #method to add items\n list[item] = quantity\nend", "def add_item(list, food_item, quantity_of_food = 1)\n list[food_item] = quantity_of_food\n list\nend", "def update_quantity(list, item, quantity)\n list[item] = quantity\n p list\nend", "def add_item(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list \nend", "def print_list(my_list)\r\n# input: \r\n \r\n# steps:\r\n# print to screen: iterate through hash item - quantity\r\n puts '------'\r\n puts \"Grocery list:\"\r\n my_list.each do |item, qty|\r\n puts \"#{item} - #{qty}\"\r\n end\r\n puts '-------'\r\n# output: each k,v pair printed surrounded by dashes\r\nend", "def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend", "def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend", "def update_list(list, item_name, quantity=1)\r\n list[item_name] = quantity\r\n list\r\nend", "def update_list(list, item_name, quantity)\n list[item_name.to_sym] = quantity\n list\n\nend", "def list_add(hash_items, item_name, quantity = 1)\n hash_items [item_name] = quantity\n return hash_items\nend", "def update_quantity(list, upd_item, new_quantity)\n# steps:\n # reassign key (item) a new value (quantity)\n list[upd_item] = new_quantity\n # return list\n list\nend", "def create_list(items, qty=1)\n items = items.split(\" \")\n list = Hash.new\n\n items.each do |item|\n if list.has_key?(item)\n list[item] += qty\n elsif\n list[item] = qty\n end\n end\n\n return list.each {|k,v| puts \"#{k}: #{v}\"}\nend", "def create_list(list, grocery_hash={})\n\tlist_array = list.split(\" \")\n\tquantity = 0\n\tlist_array.each do |item|\n\t\tgrocery_hash[item]=quantity\n\tend\n\tprint_list(grocery_hash)\n\treturn grocery_hash\nend", "def add (list, item, quantity)\n\tlist[item] = quantity\nend", "def create_list(items)\n\titem_list = {}\n\titem_array = items.split(\" \")\n\tdefault_quantity = 1\n\titem_array.each do |item|\n\t\titem_list[item] = default_quantity\n\tend\n\tpretty_list(item_list) \nend", "def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend", "def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend", "def add_item(list, item_name, quantity = 1)\n\tlist[item_name] = quantity\n\tlist\nend", "def make_list (list, quantity = $default_quantity)\r\n list_arr = list.split\r\n list_arr.each do |list_item|\r\n $grocery_list[list_item] = quantity\r\n end\r\nend", "def printlist(list)\r\n# input: shopping list\r\n# steps:\r\nlist.each {|item, quantity| puts \"Please buy #{quantity} #{item}\"}\r\n # Print each item on the shopping list in a readable fashion\r\nend", "def add_item(list, item, quantity)\n list[item] = quantity\nend", "def add_item(list, item, quantity)\n list[item] = quantity\nend", "def update_quantity(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend", "def add_item(list, item_name_string, quantity=1)\r\n\titem_key = item_name_string.to_sym\r\n\tlist[item_key] = quantity\r\n\treturn list\r\nend" ]
[ "0.85272187", "0.818455", "0.8133308", "0.80784243", "0.8056772", "0.7997297", "0.79753566", "0.7817071", "0.7805368", "0.7744283", "0.7712055", "0.77006155", "0.76822174", "0.76587677", "0.76575917", "0.7643096", "0.7615407", "0.7542262", "0.7506298", "0.7502542", "0.7438476", "0.7436668", "0.7428044", "0.7416075", "0.7406269", "0.7400478", "0.7382128", "0.73695403", "0.7361016", "0.73554605", "0.7350803", "0.73312193", "0.7325722", "0.7324468", "0.73240787", "0.73186916", "0.7310534", "0.7300104", "0.7292354", "0.72892195", "0.72877795", "0.72833717", "0.7280432", "0.7278365", "0.727221", "0.72693706", "0.72689784", "0.7266466", "0.7263015", "0.72610706", "0.7254022", "0.72531986", "0.72478586", "0.72437465", "0.7241961", "0.7231273", "0.72215027", "0.72198457", "0.7217889", "0.72159564", "0.7215501", "0.72154975", "0.72129655", "0.72107667", "0.7205597", "0.71987975", "0.71953183", "0.71920276", "0.7191138", "0.71895957", "0.7185898", "0.7184816", "0.7181708", "0.71816206", "0.71810555", "0.7179023", "0.7177228", "0.71740216", "0.71704483", "0.7168255", "0.71673644", "0.7165773", "0.7163225", "0.7163225", "0.71629614", "0.7159439", "0.71544945", "0.7150837", "0.7141257", "0.7136405", "0.7129214", "0.7121541", "0.71039915", "0.71032965", "0.71032965", "0.710094", "0.70974165", "0.70957255", "0.70957255", "0.709516", "0.7094369" ]
0.0
-1
Creates CSV report with NET and server benchmarks
def report! # Fulfill batches array with 1 second step timestamps # batches = [] @min_time = Time.at(@min_time.to_f.truncate + 0.999) batches << @min_time (@max_time - @min_time).to_i.times { batches << batches.last + 1.second } batches << batches.last + 1.second @keys = @stats.keys.sort.each(&:to_sym) @keys.delete(:disconnect) CSV.open(File.expand_path("results/report.csv"), 'w') do |csv| head = [] @keys.each_with_index {|stat_name, index| head << "N #{stat_name}"; head << stat_name; head << "Server" } csv << ["Time"] + head + ["Connections"] # Calculate active connections per second net_bm = {} net_bm_count = {} net_bm_index = {} serv_bm = {} serv_bm_count = {} serv_bm_index = {} @keys.each { |stat_name| net_bm_index[stat_name] = 0; serv_bm_index[stat_name] = 0 } connections_index = 0 batches.each_with_index do |batch, index| active_connections = 0 for i in connections_index..(@connections_deltas.size - 1) do if @connections_deltas[i][:time].to_f <= batch.to_f active_connections += @connections_deltas[i][:delta] else connections_index = i break end if i == @connections_deltas.size-1 connections_index = i + 1 break end end @keys.each do |stat_name| net_bm[stat_name] = 0 net_bm_count[stat_name] = 0 for i in net_bm_index[stat_name]..(@stats[stat_name].size - 1) do if @stats[stat_name][i][:time].to_f <= batch.to_f net_bm[stat_name] += @stats[stat_name][i][:benchmark] net_bm_count[stat_name] += 1 else net_bm_index[stat_name] = i break end if i == @stats[stat_name].size - 1 net_bm_index[stat_name] = i + 1 break end end end @keys.each do |stat_name| serv_bm[stat_name] = 0 serv_bm_count[stat_name] = 0 for i in serv_bm_index[stat_name]..(@server_stats[stat_name].size - 1) do if @server_stats[stat_name][i][:time].to_f <= batch.to_f serv_bm[stat_name] += @server_stats[stat_name][i][:benchmark] serv_bm_count[stat_name] += 1 else serv_bm_index[stat_name] = i break end if i == @server_stats[stat_name].size - 1 serv_bm_index[stat_name] = i + 1 break end end end if index > 0 @connections << active_connections + @connections[index - 1] else @connections << active_connections end result = [] @keys.each_with_index do |stat_name, index| net_average = 0 serv_average = 0 net_average = (net_bm[stat_name] / net_bm_count[stat_name]) if net_bm_count[stat_name] > 0 serv_average = (serv_bm[stat_name] / serv_bm_count[stat_name]) if serv_bm_count[stat_name] > 0 result += ["#{net_bm_count[stat_name]}", "%3.4f"% net_average] result += ["%3.4f"% serv_average] end csv << [batch.strftime("%H:%M:%S")] + result.flatten + [@connections[index]] end head = [] @keys.each_with_index {|stat_name, index| head << "N #{stat_name}"; head << stat_name; head << "Server" } csv << [" "] + head + ["Connections"] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def server_report_csv(filename)\n puts 'Creating the VMs report'\n CSV.open(\"#{filename}\", 'w') do |csv|\n csv << %w(VM_List)\n csv << %w(Host_Name LPAR_Name LPAR_State OS_Status LPAR_Health Machine_Name VM_IPaddress VM_Flavor VM_CPU VM_Memory VM_CPU_Utilization VM_CPU_Mode VM_OS VM_CPU_Pool \\\n VM_Share_Weight VM_Proc_Compatibility_Mode)\n server_report\n csv_array(@server_csv_array, csv)\n end\n puts 'Done'\n end", "def server_report\n get_resource_list('compute', 'servers', 'servers')\n @server_csv_array = []\n @server_print_array = []\n @resource_id_list.each do |serverid|\n server = rest_get(\"#{@resource_url}/servers/#{serverid}\", @token_id)\n server_array = JSON.parse(server)['server']\n server_name = server_array['name']\n server_lpar_name = server_array['OS-EXT-SRV-ATTR:instance_name']\n server_lpar_state = server_array['OS-EXT-STS:vm_state']\n server_state = server_array['status']\n server_health = server_array['health_status']['health_value']\n server_host = server_array['OS-EXT-SRV-ATTR:host']\n server_addresses = JSON.parse(server)['server']['addresses']\n @server_ipaddress = ''\n unless server_addresses.empty? || server_state != 'ACTIVE'\n @server_ipaddress = server_addresses.values[0][0]['addr']\n end\n server_flavor = server_array['flavor.original_name']\n server_cpus = server_array['cpus']\n server_memory = server_array['memory_mb']\n server_cpu_util = server_array['cpu_utilization']\n server_cpu_mode = server_array['vcpu_mode']\n server_os = server_array['operating_system']\n server_cpu_pool = server_array['shared_proc_pool_name']\n server_cpu_share_weight = server_array['shared_weight']\n server_compat_mode = server_array['desired_compatibility_mode']\n @server_csv_array << [server_name, server_lpar_name, server_lpar_state, server_state, server_host, server_health, @server_ipaddress, server_flavor, server_cpus, \\\n server_memory, server_cpu_util, server_cpu_mode, server_os, server_cpu_pool, server_cpu_share_weight, server_compat_mode]\n @server_print_headers = %w(Host_Name LPAR_Name LPAR_State OS_Status Machine_Name LPAR_Health IPaddress Template CPU Memory CPU_Util CPU_Mode CPU_Pool Share_Weight)\n @server_print_array << [server_name, server_lpar_name, server_lpar_state, server_state, server_host, server_health, @server_ipaddress, server_flavor, server_cpus, \\\n server_memory, server_cpu_util, server_cpu_mode, server_cpu_pool, server_cpu_share_weight]\n end\n end", "def report\n\t\t dir = \"./report/\"\n File.open(dir + \"method.mmd\", \"w\") do |f|\n f.puts \"# Methods #\"\n Dir[\"./experiments/*/*.rb\"].each do |desc|\n if File.basename(desc) == File.basename(File.dirname(desc)) + \".rb\"\n File.read(desc).split(\"\\n\").each do |line|\n if m = line.match(/^\\# (.+)/)\n f.puts m[1]\n else\n break\n end\n end\n f.puts\n f.puts\n end\n end\n end\n require 'csv'\n require \"yaml\"\n require File.dirname(__FILE__) + \"/stats\"\n CSV.open(dir + \"/data.csv\", \"w\") do |csv|\n data = {}\n Dir[\"./results/*/results.yaml\"].each do |res|\n d = YAML::load_file(res)\n da = {}\n d.each do |k, vals|\n da[k.to_s + \" mean\"], da[k.to_s + \" sd\"] = Stats::mean(vals), Stats::standard_deviation(vals)\n vals.each_with_index do |v, i|\n da[k.to_s + \" cv:\" + i.to_s] = v\n end\n end\n array_merge(data, da)\n end\n data.keys.map do |key| \n \t\t # calculate stats\n \t\t a = data[key]\n \t\t [key] + a\n \t\t end.transpose.each do |row|\n \t\t csv << row\n \t\t end\n end\n\t\t\n\t\tend", "def month_by_month_csv\n CSV.generate do |csv|\n report_details.each { |a| csv.add_row(a) }\n csv.add_row [] # Blank row\n csv.add_row ['VIEWS']\n month_by_month_table(Statistic::VIEW).each { |a| csv.add_row(a) }\n csv.add_row [] # Blank row\n csv.add_row ['DOWNLOADS']\n month_by_month_table(Statistic::DOWNLOAD).each { |a| csv.add_row(a) }\n end\n end", "def generateReport\n filePath = \"#{@reportFolder}/report.csv\"\n file = File.open(filePath, 'w')\n file.puts ['Screen', 'Description', 'Automation Message', 'Status'].join(',')\n @report.each do |result|\n file.puts result.join(',')\n end\n file.close\n end", "def generate_report\n self.consume_stdin\n self.data_sorter\n\n @drivers.each do |driver|\n driver.total_duration\n driver.distance_calculator\n driver.average_speed\n end\n\n self.compile_report\n end", "def build_report\n puts \"building performance test comparison report...\"\n puts\n\n # load template\n report = File.read(@template_path)\n\n # metrics result\n result_comparison_table = extract_table_from_csv2html_output(@result_comparison_path)\n\n # atop summary\n atop_summary_comparison_table = extract_table_from_csv2html_output(@atop_summary_comparison_path)\n\n # atop detail\n # TODO: enable\n # atop_detail_comparison_table = extract_table(@atop_detail_comparison_path)\n\n # replace tables (do this first since table data may include parameters)\n report = report.gsub(\"$RESULT_COMPARISON_TABLE\", result_comparison_table)\n report = report.gsub(\"$ATOP_SUMMARY_COMPARISON_TABLE\", atop_summary_comparison_table)\n\n # TODO: enable\n # report = report.gsub(\"$ATOP_DETAIL_TABLE\", atop_detail_table)\n\n # replace parameters\n report = replace_parameters(report)\n\n # write report\n puts \"writing report to #{@output_path}\"\n\n File.write(@output_path, report)\nend", "def html_report_stats\n @report << '<div id=\"title\"> General Statistics</div>'\n stat_tab = Ruport::Data::Table(%w[Stat Value])\n stat_tab << ['Number of servers Seen', @num_servers]\n stat_tab << ['Number of clients Seen', @num_clients]\n @num_by_cipher.each do |cipher, num|\n stat_tab << ['Encryption: ' + cipher, num]\n end\n @report << stat_tab.to_html\n @report << '<br /><br />'\n end", "def format_output_with_CSV()\r\n\t\theadings = [] << \"Run\"\r\n\t\trows = []\r\n\t\t@actual_parameters.each {|t| headings << t[0]}\r\n\t\t@runs.each_with_index do |run,i|\r\n\t\t\ttemp = [\"#{i+1}\"];\r\n\t\t\trun.each_with_index do |r,i|\r\n\t\t\t\ttemp << @actual_parameters[i][Integer(run[i][1])]\r\n\t\t\tend\r\n\t\t\trows << temp\r\n\t\tend\r\n\t\t@output_table = Terminal::Table.new :title => \"IPO Algorithm tests output\", :headings => headings, :rows => rows\r\n\tend", "def run_scenario(benchmarks, log_all = true)\n # Outputs = \"<total # running>/<specific combination>/<benchmark>/*.csv\"\n log_directory = OUTPUT_DIRECTORY + benchmarks.size.to_s + \"/\"\n names = benchmarks.map{|b| b.name}\n combo = names.sort.each_with_object(Hash.new(0)) {|v, h| h[v] += 1}\n combo = combo.to_a.sort{|a, b| a[0] <=> b[0]}\n combo = combo.map{|v| v[1].to_s + \"_\" + v[0]}.join(\"_\")\n puts \"Running scenario #{combo}\"\n log_directory += combo + \"/\"\n cpu_count = `nproc`.to_i\n cpu_core = 1\n benchmark_count = Hash.new(1)\n pids = []\n to_return = []\n benchmarks.each do |benchmark|\n # Determine the log directory and create it if it doesn't exist.\n log_location = log_directory + benchmark.name + \"/\"\n `mkdir -p #{log_location}`\n log_location += benchmark_count[benchmark].to_s + \".csv\"\n if !log_all && (benchmark_count[benchmark] > 1)\n log_location = \"/dev/null\"\n to_return << \"\"\n else\n to_return << log_location\n end\n # Spawn new processes for each benchmark.\n # TODO: Run vmstat before and after each benchmark program.\n puts \" Running #{benchmark.executable} on CPU #{cpu_core.to_s}\"\n pids << Process.fork do\n # Set the CPU core for this process and its children.\n `taskset -c -p #{cpu_core.to_s} $$`\n # Execute the command, redirecting to the log, skipping OS buffering\n `stdbuf -oL #{benchmark.command()} > #{log_location}`\n end\n cpu_core = (cpu_core + 1) % cpu_count\n benchmark_count[benchmark] += 1\n end\n pids.each {|pid| Process.wait(pid)}\n to_return\nend", "def summary(args, options)\n\n experiments = options.experiments.split(',')\n machines = options.machines.split(',')\n\n data = Ppbench::load_data(args)\n filtered_data = Ppbench::filter(\n data,\n experiments: experiments,\n machines: machines\n )\n aggregated_data = Ppbench::aggregate(filtered_data)\n\n rows = []\n aggregated_data.each do |experiment, machines|\n machines.each do |machine, data|\n mtr = data.map { |e| e[:transfer_rate] }.median / 1000 # median transfer rate\n tpr = data.map { |e| e[:tpr] }.median # median round trip latency\n rps = 1000 / tpr # median request per second\n\n rows << [experiment, machine, data.count, \"%.2f\" % mtr, \"%.2f\" % rps, \"%.2f\" % tpr]\n end\n rows << :separator\n end\n rows.pop\n\n print(\"We have data for: \\n\")\n table = Terminal::Table.new(:headings => ['Experiment', 'Machine', 'Samples', 'Transfer (kB/s)', \"Requests/sec\", \"Latency (ms)\"], :rows => rows)\n table.align_column(2, :right)\n table.align_column(3, :right)\n table.align_column(4, :right)\n table.align_column(5, :right)\n print(\"#{table}\\n\")\nend", "def dumpCsvSpeed()\n CSV.open(csvFilenameSpeed(), \"w\", { :col_sep => csvColSepChar() }) { |csv|\n csv << AnalyzerExpA.genCsvTitleRow() ;\n genCsvSpeed().each{|row|\n csv << row ;\n }\n }\n end", "def print_detailed_report\n @req = []\n @bucket.keys.sort.map do |time|\n @req << @bucket[time].length\n date = Time.at(time)\n ms = calc_response(@bucket[time])\n\n @csvexport.add_row([date, @bucket[time].length, ms]) unless @csv.nil?\n\n puts sprintf('%-30s %-10s %-20s',\n date, @bucket[time].length, ms) unless @detailed.nil?\n end\n end", "def network_report\n get_resource_list('network', 'v2.0/networks', 'networks')\n @network_csv_array = []\n @network_print_array = []\n @resource_id_list.each do |networkid|\n network = rest_get(\"#{@resource_url}/v2.0/networks/#{networkid}\", @token_id)\n network_array = JSON.parse(network)['network']\n network_name = network_array['name']\n network_status = network_array['status']\n network_vlanid = network_array['provider:segmentation_id']\n network_physnet = network_array['provider:physical_network']\n network_mtu = network_array['mtu']\n subnet_id = network_array['subnets']\n unless subnet_id.empty?\n subnet_id.each do |subnetid|\n subnet_rest = rest_get(\"#{@resource_url}/v2.0/subnets/#{subnetid}\", @token_id)\n subnet_array = JSON.parse(subnet_rest)['subnet']\n @subnet_enable_dhcp = subnet_array['enable_dhcp']\n @subnet_dns_server = subnet_array['dns_nameservers']\n @subnet_startip = subnet_array['allocation_pools'][0]['start']\n @subnet_endip = subnet_array['allocation_pools'][0]['end']\n @subnet_gateway = subnet_array['gateway_ip']\n @subnet_cidr = subnet_array['cidr']\n end\n end\n @network_csv_array << [network_name, network_status, network_vlanid, network_physnet, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, \\\n @subnet_gateway, @subnet_cidr]\n @network_print_headers = %w(Network_Name Network_VLANid Network_MTU Network_enable_dhcp Network_DNS_Servers Network_Start_IP Network_End_IP Network_Gateway Network_CIDR)\n @network_print_array << [network_name, network_vlanid, network_mtu, @subnet_enable_dhcp, @subnet_dns_server, @subnet_startip, @subnet_endip, @subnet_gateway, @subnet_cidr]\n end\n end", "def benchmark_header\n \"\\nRunning test:\"\n end", "def exported_report\n #The folder where the filename points to, is actually in the ~/rails/Forester because of capistrano as\n # the Apache point to ~/rails/Forester/current symlinkfolder and capistrano updates the them. \n @filename = \"quarterly_report_#{params[:year]}_#{params[:quarter]}.csv\"\n @file_path = \"#{Rails.root}/../../shared/system/exports/\"\n if params[:quarter] == \"1\"\n @tickets = Ticket.find(:all, :conditions => \"delivery_date>'#{(params[:year].to_i-1)}-12-31' AND delivery_date<'#{params[:year]}-04-01'\")\n else\n if params[:quarter] == \"2\"\n @tickets = Ticket.find(:all, :conditions => \"delivery_date>'#{params[:year]}-03-31' AND delivery_date<'#{params[:year]}-07-01'\")\n else\n if params[:quarter] == \"3\"\n @tickets = Ticket.find(:all, :conditions => \"delivery_date>'#{params[:year]}-06-30' AND delivery_date<'#{params[:year]}-10-01'\")\n else\n if params[:quarter] == \"4\" then\n @tickets = Ticket.find(:all, :conditions => \"delivery_date>'#{params[:year]}-09-30' AND delivery_date<'#{(params[:year].to_i+1)}-01-01'\")\n end\n end\n end\n end\n \n #Writing to file starts with empty line.\n File.open(\"#{@file_path}#{@filename}\", 'w') do |writer|\n writer.puts(\"\\n\")\n end\n \n #From the tickets delivered in the given quarter, the job ids are gathered here\n @job_ids = @tickets.collect {|i| i.job_id }\n @jobs = Job.find(@job_ids)\n \n #To have less DB calls, all specie records are put into an instance variable\n @species = Specie.all\n \n #Goes through all the jobs, for each sums up all the mbf and tonnages and writes them into the file\n # per specie.\n @jobs.each do |k|\n @my_tickets = []\n @tickets.each do |l|\n if l.job_id == k.id\n @my_tickets.push(l)\n end\n end\n \n @amounts = []\n \n @species.length.times do\n @amounts.push([0, 0])\n end\n \n @total_pulp = 0\n \n @my_tickets.each do |i|\n i.load_details.each do |j|\n if i.wood_type == 3 || j.species_id == 0 #wood type 3 & species_id 0 == pulp\n @total_pulp = @total_pulp + j.tonnage\n next #If load is pulp, it has only one load detail so program jups to next loop\n end\n #Amounts of mbf/tonnage are summed up here per ticket according to their specie.\n @amounts[j.species_id-1][0] = @amounts[j.species_id-1][0] + j.mbfss #This and triple-n tonnage in next are helper methods. See their documentation.\n @amounts[j.species_id-1][1] = @amounts[j.species_id-1][1] + j.tonnnage\n end\n end\n \n #Finally, the values calculated above are written into the file.\n File.open(\"#{@file_path}#{@filename}\", 'a') do |writer|\n writer.puts \"Job, #{k.name}\"\n writer.puts \"Category, MBF, Tonnage\"\n @species.each do |i|\n writer.puts \"#{i.code}, #{round_to(@amounts[i.id-1][0].to_f, 2)}, #{round_to(@amounts[i.id-1][1].to_f, 2)}\"\n end\n writer.puts \"Pulp, ,#{round_to(@total_pulp.to_f, 2)}\"\n writer.puts(\"\\n\")\n end\n end\n \n #The file created is opened in 'r' (== read) mode and send to user\n @file = File.open(\"#{@file_path}#{@filename}\", 'r')\n \n send_data(@file.read, :type => \"csv\", :filename => @filename)\n end", "def generate_report\n CSV.generate(write_headers: false, headers: headers) do |csv|\n # Don't want to rely on `write_headers: true` since we want still\n # header row in the CSV file even when there is no data.\n csv << headers\n records.each do |record|\n csv << method_names.map { |method_name| record.public_send method_name }\n end\n end\n end", "def network_report_csv(filename)\n puts 'Creating the Networks report'\n CSV.open(\"#{filename}\", 'ab') do |csv|\n csv << [\"\\n\"]\n csv << %w(Network_List)\n csv << %w(Network_Name Network_Status Network_VLANid Network_Phys_Net Network_MTU Network_enable_dhcp Network_DNS_Servers Network_Start_IP Network_End_IP Network_Gateway Network_CIDR)\n network_report\n csv_array(@network_csv_array, csv)\n end\n puts 'Done'\n end", "def csv_export_chrono\n csv_string = CSV.generate do |csv|\n\n csv << [ \"Plaque\", \"Equipe\", \"Nom VTT\", \"Prenom VTT\", \"ADN VTT\", \"Nom Route\", \"Prenom Route\", \"ADN Route\", \"Categorie\"]\n\n Team.order_by(:plate).each do |t|\n cat = t.category\n next unless cat\n\n cname = cat.map { |v| v.capitalize }.join('-')\n csv << [ t.plate, t.name, \n t.vtt.profile.name.upcase, t.vtt.profile.surname.capitalize, t.vtt.profile.birth.year, \n t.route.profile.name.upcase, t.route.profile.surname.capitalize, t.route.profile.birth.year, cname]\n end\n end\n\n respond!(csv_string, 200, 'Content-Type' => 'text/csv')\n end", "def report_benchmark_list(list)\n if list.size <= MAX_BENCHMARKS_TO_LIST\n list.join(\", \")\n else\n \"#{list.size} individual benchmarks affected\"\n end\nend", "def write_report filename=nil\n\t\toutput_string = ''\t\t\n\t\tself.sort_drivers_by_miles.each do |key,driver|\n\t\t\toutput_string += \"#{driver.trip_report_str} \\n\"\n\t\tend\n\t\tunless filename.nil?\n\t\t\tFile.write(filename, output_string)\n\t\tend\n\t\tputs output_string\n\t\toutput_string\n\tend", "def export_serverir\n line = ['Server Name', 'ITDR State', 'Logical Resource Name', 'Logical Resource Type', 'Service', 'Purpose', 'Operating Mode', 'Site', 'Site Type', 'OS Class', 'OS Version', 'CPU Capacity', 'Memory', 'Base Power', 'Power Increment', 'Rack Unit Equivalents', 'Vendor', 'Model', 'Processor Family', 'Clock Speed', 'Number of Processors', 'Number of Cores', 'Number of Logical CPUs', 'L2 Cache', 'L3 Cache', 'Collector', 'Configuration Collector', 'Description', 'Serial Number', 'VM Architecture', 'VM Mode', \"\\n\"]\n csvdoc = [line.join(',')]\n Node.all.each do |node|\n results = make_serverir_line(node)\n csvdoc << results.join(',') if results\n end\n fname = \"public/csvexports/#{Time.now.strftime(\"%d%m%Y-%H:00\")}.gz\"\n File.open(fname, 'w') do |f|\n gz = Zlib::GzipWriter.new(f)\n gz.write csvdoc\n gz.close\n end\n end", "def to_csv\n initialize_generator\n csv_report_generator.records = pull_join\n csv_report_generator.generate_report\n end", "def export_data\r\n folder = \"\\data\"\r\n FileUtils.mkdir_p folder\r\n CSV.open(File.join(folder, @output_stats_name), 'wb') do |csv|\r\n csv << @global_bests\r\n csv << @average_global_bests\r\n @neighbourhoods_list[0].report_particles.each do |x|\r\n csv << x\r\n end\r\n end\r\n end", "def generate_csv\n @project = Project.find(params[:id])\n \n content_type = if request.user_agent =~ /windows/i\n ' application/vnd.ms-excel '\n else\n ' text/csv '\n end\n \n project_net = @project.find_all_connections(friend = true, follower = false) \n \n CSV::Writer.generate(output = \"\") do |csv|\n csv << [\"DL n=\" + @project.persons.count.to_s ]\n csv << [\"format = edgelist1\"]\n csv << [\"labels embedded:\"]\n csv << [\"data:\"]\n project_net.each do |entry|\n csv << [entry[0], entry[1], \"1\"]\n end\n @project.persons.each do |person|\n csv << [person.username]\n end\n end\n send_data(output,\n :type => content_type,\n :filename => @project.name.to_s + \"_FF_SNA.csv\")\n end", "def print_test_suites(options={})\n\n # Heading\n print \"TEST_SUITE, \"\n print \"#{@ts_data_types.join(\", \")}\\n\"\n\n # CSV data\n @test_suites.each do |test_suite|\n print \"#{test_suite[:name]}, \"\n @ts_data_types.each do |datatype|\n unless datatype == @ts_data_types.first\n print \", \"\n end\n print \"#{test_suite[datatype.to_sym]}\"\n end\n print \"\\n\"\n end\nend", "def flavor_report_csv(filename)\n puts 'Creating the Flavors report'\n CSV.open(\"#{filename}\", 'ab') do |csv|\n csv << [\"\\n\"]\n csv << %w(Compute_Template_List)\n csv << %w(Template_Name VCPU Memory Min_VCPU Max_VCPU Min_EC Desired_EC Max_EC Dedicated_CPU Min_Mem Max_Mem Proc_Compatibility_Mode CPU_Pool_Name Shared_CPU_Weight SRR_Capability)\n flavor_report\n csv_array(@flavor_print_array, csv)\n end\n puts 'Done'\n end", "def atop_csv\n \"#{@archive_root}/#{master.hostname}/atop_log_#{@gatling_scenario.downcase.gsub('.', '_')}.csv\"\n end", "def period_csv\n CSV.generate do |csv|\n report_details.each { |a| csv.add_row(a) }\n csv.add_row [] # Blank row\n time_period_table.each { |a| csv.add_row(a) }\n end\n end", "def scg_report\n @scg_csv_array = []\n get_resource_list('compute', 'storage-connectivity-groups', 'storage_connectivity_groups', name = 'display_name', id = 'id')\n @resource_id_list.each do |scgid|\n scg = rest_get(\"#{@resource_url}/storage-connectivity-groups/#{scgid}\", @token_id)\n scg_array = JSON.parse(scg)['storage_connectivity_group']\n scg_name = scg_array['display_name']\n scg_auto_add_vios = scg_array['auto_add_vios']\n scg_fc_storage_access = scg_array['fc_storage_access']\n scg_ports_per_fabric_npiv = scg_array['ports_per_fabric_npiv']\n @scg_host_list = []\n @scg_host_array = scg_array['host_list']\n @scg_host_array.each do |host|\n @scg_host_list.push(host['name'])\n end\n @scg_vios_array = scg_array['host_list'][0]['vios_list']\n @scg_vios_names = []\n @scg_vios_array.each do |vios|\n @scg_vios_names.push(vios['name'])\n end\n @scg_csv_headers = %w(SCG_Name SCG_Auto_Add_VIOs SCG_FC_Storage_Access SCG_Ports_per_Fabric SCG_Host_List SCG_VIOs_List)\n @scg_csv_array << [scg_name, scg_auto_add_vios, scg_fc_storage_access, scg_ports_per_fabric_npiv, @scg_host_list, @scg_vios_names]\n end\n end", "def genCsvSpeed()\n csv = [] ;\n to_a.each{|analyzer|\n csv.push(analyzer.genCsvRowSpeed()) ;\n }\n return csv ;\n end", "def html_report_inf\n @report << '<div id=\"title\">Infrastructure Networks</div><br /><br />'\n @log.debug(\"Starting reporting Infrastructure networks there were \" + @infrastructure_networks.length.to_s + \" networks to list\")\n @infrastructure_networks.each do |ssid,bssid|\n tab = Ruport::Data::Table(%w[bssid num_clients channel cipher cloaked? manufacturer first_seen last_seen max_signal_dbm])\n ssid = \"Hidden or Blank\" if ssid.length < 1\n @report << '<div id=\"title\">SSID: ' + ssid + ' </div>'\n bssid.each do |net,info|\n if @options.gps_data[net]\n point = net\n @log.debug(\"attempting to add link\")\n link_info = '+(' + ssid + ' | Ciphers: ' + info['cipher'] + ' | Channel: ' + info['channel'] + ')'\n url = 'http://maps.google.co.uk/maps?q=' + @options.gps_data[point]['lat'].to_s + ',' + @options.gps_data[point]['lon'].to_s + link_info\n net = '<a href=\"' + url + '\">' + point + '</a>'\n end\n tab << [net, info['clients'].length.to_s, info['channel'], info['cipher'], info['cloaked'], info['manufacturer'], info['first_seen'], info['last_seen'], info['max_signal_dbm']]\n end\n @report << tab.to_html\n @report << \"<br /> <br />\"\n end\n end", "def collect_all_stats()\n\n begin\n\n time = Time.now\n\n medusaLogWriter = nil\n if (@enable_medusa == true)\n medusaLogger = Logger.new(File.new(@medusa_log_file, File::WRONLY | File::CREAT | File::TRUNC))\n # Ruby logger.formatter supports four input parameters : |severity, datetime, progname, msg|, here, we only need to pass msg into the proc.\n medusaLogger.formatter = proc { |_s, _d, _p, msg| \"#{msg}\\n\" }\n medusaLogWriter = MedusaLogWriter.new(medusaLogger)\n end\n\n graphiteWriter = nil\n if (@graphite_hosts != nil)\n # @environment holds the environment_profile, eg: dev/ prod/ qa/stg\n # @environment_name holds the user defined environment name. eg: datacenter name in ms-df-solrcloud prod clusters\n graphiteWriter = GraphiteWriter.new(@prefix, @environment, @node_ip, @graphite_hosts, @datacenter, @environment_name)\n graphiteWriter.open_tcp_sockets\n end\n\n # keeping both the node status metrics and jmx metrics separately since our JMX metrics scripts could stop working for any reason\n # (eg, metric names changes with diff solr versions etc).\n # If it breaks, telegraf will block all metrics that comes from jmx metrics file.\n # So better to keep node status metrics separately from JMX metrics. Telegraf will read from both at any point of time provided jmx_metrics are enabled.\n if (@enable_rest_metrics == \"true\" || @enable_jmx_metrics == \"true\")\n get_solr_node_status(time, medusaLogWriter, graphiteWriter)\n end\n\n if (@enable_rest_metrics == \"true\")\n # Get the metrics from Solr REST APIs\n SolrClusterSummaryStats.get_stats(@hostname, @port, time, medusaLogWriter, graphiteWriter, @solr_version, @collections)\n end\n\n if (@enable_jmx_metrics == \"true\")\n jmx_medusaLogWriter = nil\n if (@enable_medusa == true)\n jmx_medusaLogger = Logger.new(File.new(@jmx_medusa_log_file, File::WRONLY | File::CREAT | File::TRUNC))\n # Ruby logger.formatter supports four input parameters : |severity, datetime, progname, msg|, here, we only need to pass msg into the proc.\n jmx_medusaLogger.formatter = proc { |_s, _d, _p, msg| \"#{msg}\\n\" }\n jmx_medusaLogWriter = MedusaLogWriter.new(jmx_medusaLogger)\n end\n mbean_sum_stat_obj = SolrMBeanSummaryStats.new(jmx_medusaLogWriter, graphiteWriter, @metric_level, @jolokia_port, @solr_jmx_port, @solr_version, time)\n mbean_sum_stat_obj.collect_jmx_metrics()\n end\n\n rescue Exception => e\n puts \"collect_all_stats:exception: #{e}\"\n ensure\n if (@graphite_hosts != nil)\n graphiteWriter.close_tcp_sockets\n end\n end\n\n end", "def export_results\n paths = []\n export_dir = File.join(Hailstorm.root, Hailstorm.reports_dir, \"SEQUENCE-#{self.id}\")\n FileUtils.rm_rf(export_dir)\n FileUtils.mkpath(export_dir)\n self.client_stats.each do |cs|\n export_file_path = cs.write_jtl(export_dir)\n paths.push(export_file_path)\n end\n\n paths\n end", "def print_csv_results\n FileUtils.mkdir_p(\"data\")\n File.open(\"data/results.csv\", \"w\") do |f|\n @data.sort_by{|id, values| values[\"sum_dose\"]}.each do |id, values|\n f.puts \"%s\\t%d\\t%.4f\" % [id, values[\"ddays\"], dose_unit(values[\"sum_dose\"])]\n end\n end\n end", "def raw_export\n return unless has_permission :can_do_billing\n case request.method\n when :get\n @page_title = 'Generate Raw Data Report'\n @from = Time.now.beginning_of_month\n @to = @from.next_month\n when :post\n from = Date.new(params[:from][:year].to_i,params[:from][:month].to_i)\n to = Date.new(params[:to][:year].to_i,params[:to][:month].to_i)\n @records = BillingCharge.find(:all,:conditions=>['billing_charges.created_at > ? and billing_charges.created_at < ?',from,to],\n :order=>['billing_charges.id'],:include=>[:pilot,:instructor,:aircraft])\n report = StringIO.new\n CSV::Writer.generate(report, ',') do |csv|\n csv << %w(Timestamp Pilot Amount Total Type Note Aircraft Aircraft_Rate Instructor Instructor_Rate Hobbs_Start Hobbs_End Tach Ground_Instruction)\n @records.each do |r|\n csv << [r.created_at, r.pilot.full_name_with_id, r.charge_amount, r.running_total, \n r.type.to_s == 'FlightRecord' ? 'flight/ground instruction' : r.type, r.notes, r.aircraft_id.nil? ? nil : r.aircraft.identifier, \n r.aircraft_rate, r.instructor_id.nil? ? nil : r.instructor.full_name_with_id,\n r.instructor_rate, r.hobbs_start, r.hobbs_end, r.tach_end, r.ground_instruction_time]\n end\n end\n\n report.rewind\n send_data(report.read,\n :type => 'text/csv; charset=iso-8859-1; header=present',\n :filename => 'report.csv')\n end\nend", "def report_results( timings )\n t = timings.first\n output.puts \n output.puts \" Total files read : #{\"%12d\" % t.value_stats.count}\"\n output.puts \" Total bytes read : #{\"%12d\" % t.value_stats.sum}\"\n output.puts \" Minimum filesize : #{\"%12d\" % t.value_stats.min}\"\n output.puts \" Average filesize : #{\"%16.3f\" % t.value_stats.mean}\"\n output.puts \" Maximum filesize : #{\"%12d\" % t.value_stats.max}\"\n output.puts \" Stddev of sizes : #{\"%16.3f\" % t.value_stats.stddev}\"\n output.puts\n\n output.puts [\"%28s\" % \"read order\", \"%20s\" % \"Elapsed time (sec)\", \"%22s\" % \"Read rate (bytes/sec)\" ].join(\" \")\n output.puts \"-\" * 72\n timings.each do |timing|\n p = [ ]\n p << \"%28s\" % timing.name\n p << \"%20.3f\" % timing.timed_stats.sum\n p << \"%22.3f\" % timing.rate\n output.puts p.join(\" \")\n end\n output.puts\n end", "def benchmark_result(command, input, value)\n File.open(\"#{command}.csv\", 'a') do |f|\n f.write \"#{input},#{value}\\n\"\n end\nend", "def export_csofeed\n # Create header row #\n header = ['Record Type', 'Device Key', 'IP Addresses', 'MAC Addresses', 'System Name', 'FQDN', 'Status', 'Function', 'Runs MOTS/PRISM Apps', 'MOTS/PRISM IDs', 'Runs Non-MOTS/PRISM Apps', 'Internet Facing', 'Device Criticality', 'Device Owner', 'Operating System', 'Operating System Version', 'Administrator\\'s ATTUID', 'Support Group', 'Serial Number', 'Asset Tag Number', 'Location', 'Location CLLI', 'Comments' \"\\n\"]\n csvdoc = [header.join(',')]\n Node.all.each do |node|\n result = make_csoline(node)\n csvdoc << result.join(',') if result\n end\n fname = \"public/csvexports/csofeed_#{Time.now.strftime(\"%d%m%Y\")}.csv.gz\"\n File.open(fname, 'w') do |f|\n gz = Zlib::GzipWriter.new(f)\n gz.write csvdoc\n gz.close\n end\n end", "def generate_test_data()\n CSV.open(\"testdata.csv\", \"w\") do |csv|\n (1..1_000_000).each do |i|\n csv << [rand(100), rand(10_000), rand(100_000)]\n end\n end\nend", "def generate_csv\n\n fields = @resource[:class].typus_fields_for(:csv).collect { |i| i.first }\n\n require 'csv'\n if CSV.const_defined?(:Reader)\n # Old CSV version so we enable faster CSV.\n begin\n require 'fastercsv'\n rescue Exception => error\n raise error.message\n end\n csv = FasterCSV\n else\n csv = CSV\n end\n\n filename = \"#{Rails.root}/tmp/export-#{@resource[:self]}-#{Time.now.utc.to_s(:number)}.csv\"\n\n options = { :conditions => @conditions, :batch_size => 1000 }\n\n csv.open(filename, 'w', :col_sep => ';') do |csv|\n csv << fields\n @resource[:class].find_in_batches(options) do |records|\n records.each do |record|\n csv << fields.map { |f| record.send(f) }\n end\n end\n end\n\n send_file filename\n\n end", "def record_performance\n File.open('.specjour/performance', 'w') do |file|\n ordered_specs = profiler.to_a.sort_by {|test, data| -data[0].to_f}.map do |test, data|\n file.puts \"%6f:%s:%s\" % [data[0], test, data[1]]\n end\n end\n end", "def create_report(links, protocol, host_url)\n CSV.open('link_details.csv', 'w+') do |csv|\n links.each do |link_name, link_path|\n insert_record(csv, link_name, link_path, protocol, host_url)\n end\n end\n end", "def render_csv\n report = report_for_rendering\n filename = filename_timestamp(report.title)\n disable_client_cache\n send_data(report.to_csv, :filename => \"#{filename}.csv\")\n end", "def write_report\n\n end", "def report_lister\n \"Name: #{@name}\\nType: #{@type}\\nRate: #{@rate}\\nCategory: #{@category}\"\n # \"Report run on: \" + Time.now.to_s\n end", "def output(machine, records)\n # expecting position, sku, dispense qty, unit price, pkg qty, currency\n CSV.open('./docs/output', 'a') do |csv|\n records.each do |pos, sku, d_qty, cost, p_qty, curr|\n # attempt to fix erroneous dispense qtys on lockers\n d_qty = 1 if pos.to_i >= 70 and d_qty.to_i > 12\n csv << [machine['companyName'], machine['deviceName'], sku, (d_qty.to_i * p_qty.to_i), cost]\n end\n end\nend", "def member_stats_to_csv mbox\n stats = extract_member_stats mbox\n \n rows = []\n rows << [\"Name\", \"Total Msg Count\", \"New Msg Count\", \"Msg Reply Count\"]\n stats.each { |r| rows << [r[0], r[1].msg_total_count.to_s, r[1].msg_new_count.to_s, r[1].msg_reply_count.to_s] }\n\n data_to_csv rows\n end", "def send_reports(type, reports)\n dir = File.join(\"/tmp\", type, \"#{@start_date.strftime(\"%Y-%m\")}_to_#{@end_date.strftime(\"%Y-%m\")}\")\n FileUtils.mkdir_p dir\n reports.each do |name, report|\n file = File.join(dir, name)\n File.write(file, CounterReporterService.csv(report))\n Rails.logger.info(\"[ROYALTY REPORTS] wrote #{file}\")\n end\n rescue StandardError => e\n \"[ROYALTY REPORTS] Error: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end", "def run_benchmark(num_itrs_hint)\n times = []\n total_time = 0\n num_itrs = 0\n\n loop do\n time = time_itr { yield }\n num_itrs += 1\n\n # NOTE: we may want to avoid this as it could trigger GC?\n time_ms = (1000 * time).to_i\n puts \"itr \\##{num_itrs}: #{time_ms}ms\"\n\n # NOTE: we may want to preallocate an array and avoid append\n # We internally save the time in seconds to avoid loss of precision\n times << time\n total_time += time\n\n if num_itrs >= $WARMUP_ITRS + $MIN_BENCH_ITRS and total_time >= $MIN_BENCH_TIME\n break\n end\n end\n\n # Write each time value on its own row\n CSV.open($out_csv_path, \"wb\") do |csv|\n csv << times\n end\nend", "def run\n\t\tmy_credentials = {\"user\" => \"test.api\", 'password' => '5DRX-AF-gc4', 'client_id' => 'Test', 'client_secret' => 'xIpXeyMID9WC55en6Nuv0HOO5GNncHjeYW0t5yI5wpPIqEHV'}\n\t\taccess_token = self.class.post('http://testcost.platform161.com/api/v2/access_tokens/', { query: my_credentials })['token']\n\t\theaders = {:headers => {'PFM161-API-AccessToken' => access_token}}\n\t\tadvertiser_reports = self.class.post('https://testcost.platform161.com/api/v2/advertiser_reports/', headers )\n\t\tcreate_local_report advertiser_reports['id']\n\t\tcampaign = self.class.get('https://testcost.platform161.com/api/v2/campaigns/' + campaign_id.to_s, headers )\n\t\tif advertiser_reports['results'] && advertiser_reports['results'].select { |campaign| campaign['campaign_id'] == campaign_id }.present?\n\t\t\tadvertiser_report = advertiser_reports['results'].select { |campaign| campaign['campaign_id'] == campaign_id }\n\t\t\tReportGeneratorCsvBuilder.new({advertiser_report: advertiser_report, campaign: campaign}).build\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend", "def assign_csv_report\n unless @csv.nil?\n csv_header = ['Time', 'Req/s', 'Avg. resp. (ms)']\n @csvexport = Ralphttp::CsvExport.new(csv_header)\n end\n end", "def output_csv(datastore)\n CSV.open(OUTPUT_CSV, \"wb\") do |csv|\n csv << \t[\"Period\", \"First Use In\", \"Engaged Users\"]\n\n datastore.keys.sort.each do |date_key|\n pretty_date = Date.parse(date_key.split(\"_\")[0]).strftime(\"%Y-%m-%d\")\n datastore[date_key].keys.sort.each do |cohort_key|\n pretty_cohort= Date.parse(cohort_key.split(\"_\")[0]).strftime(\"%Y-%m-%d\")\n csv << [ pretty_date, pretty_cohort,\tdatastore[date_key][cohort_key]['total_users']]\n end\n end\n end\nend", "def stg_provider_report_csv(filename)\n puts 'Creating the Storage Providers report'\n CSV.open(\"#{filename}\", 'ab') do |csv|\n csv << [\"\\n\"]\n csv << %w(Storage_Providers_List)\n csv << %w(Storage_Provider_Name Storage_Provider_Type Storage_Provider_Health Storage_Provider_Total_Cap Storage_Provider_Free_Cap)\n stg_provider_report\n csv_array(@stg_provider_csv_array, csv)\n end\n puts 'Done'\n end", "def generate_CSV\n CSV.open(\"./veterans.csv\", \"w\", \n write_headers: true,\n headers: [\"login\", \"name\", \"location\", \"repo count\"]\n ) do |csv|\n @top_ten.each { |row| csv << row }\n end\n end", "def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => @@default_sort\n collection = @@model.find :all, :order => @sort, :conditions => session[:conditions]\n # Creation of the file\n file_name = \"#{@@param_name}_export_\" + current_user.id.to_s + \".csv\"\n \n csv_string = CSV.generate({:col_sep => ';', :encoding => \"ISO-8859-15\" }) do |csv|\n csv << @@name_print.map{|n| n.trn}\n collection.each do |element|\n csv << @@field_print.map{|f| element[f]}\n end\n end\n send_data Iconv.conv('iso-8859-1//IGNORE', 'utf-8', csv_string), :filename => file_name, :disposition => 'attachment', :type => 'text/csv; charset=iso-8859-1; header=present'\n end", "def save_report\n\n # Parse the result with Nokogiri\n response = connect\n\n # Add the column headers to the file\n write_column_headers\n\n # Append the first batch of data to the file\n write_batch_data\n\n # Save the token for successive calls\n token = \"&token=\" + response[:token] || \"\"\n\n # Loop until the end of the query\n until response[:is_finished] === \"true\"\n response = connect(token)\n write_batch_data\n end\n\n end", "def genCsvSummary()\n csv = [] ;\n to_a.each{|analyzer|\n csv.push(analyzer.genCsvRowSummary()) ;\n }\n return csv ;\n end", "def print_as_csv\n file_data = []\n file_data << headers\n @case_data_by_date_map.each do |_, elements|\n file_data += elements.shuffle\n end\n\n file_data.each do |element|\n puts element.join(',')\n end\n end", "def climate_dump\r\n\ttableMetadata = LsrsClimate.where(:WarehouseName=>params[:table]).first\r\n\toutputCsvFile = File.open(\"/development/data/climate/#{params[:table]}.txt\", 'w')\r\n\toutputCsvFile.puts '--- #YAML'\r\n\toutputCsvFile.puts 'Title: \"' + tableMetadata.Title_en + '\"'\r\n\toutputCsvFile.puts 'Geography: \"Polygons\"'\r\n\toutputCsvFile.puts 'Framework: \"' + tableMetadata.PolygonTable + '\"'\r\n\toutputCsvFile.puts 'Timeframe: \"???\"'\r\n\toutputCsvFile.puts 'Origin: \"Observations???\"'\r\n\toutputCsvFile.puts 'Description: \"???\"'\r\n\toutputCsvFile.puts '--- #TSV'\r\n\toutputCsvFile.puts \"id\tlong\tlat\telev\ttmax01\ttmax02\ttmax03\ttmax04\ttmax05\ttmax06\ttmax07\ttmax08\ttmax09\ttmax10\ttmax11\ttmax12\ttmin01\ttmin02\ttmin03\ttmin04\ttmin05\ttmin06\ttmin07\ttmin08\ttmin09\ttmin10\ttmin11\ttmin12\tptot01\tptot02\tptot03\tptot04\tptot05\tptot06\tptot07\tptot08\tptot09\tptot10\tptot11\tptot12\"\r\n\trecords = eval(params[:table].capitalize).all\r\n\tfor r in records do\r\n\t\toutputCsvFile.puts \"#{r.id}\t#{r.long}\tlat\telev\ttmax01\ttmax02\ttmax03\ttmax04\ttmax05\ttmax06\ttmax07\ttmax08\ttmax09\ttmax10\ttmax11\ttmax12\ttmin01\ttmin02\ttmin03\ttmin04\ttmin05\ttmin06\ttmin07\ttmin08\ttmin09\ttmin10\ttmin11\ttmin12\tptot01\tptot02\tptot03\tptot04\tptot05\tptot06\tptot07\tptot08\tptot09\tptot10\tptot11\tptot12\"\r\n\tend\r\n\toutputCsvFile.close\r\n\t\t\r\n\t\r\nend", "def index\n require_user\n stats=Tracker.where('uid=?',user).pluck(\"comp\")\n @ontime=stats.count(\"On Time\")\n @delay=stats.count(\"> ETA\")\n @early=stats.count(\"< ETA\")\n @trackers = Tracker.where('uid=?',user).order(created_at: :desc)\n respond_to do |format|\n format.html\n format.csv { send_data @trackers.to_csv}\n format.xls# { send_data @trackers.to_csv(col_sep: \"\\t\")}\n end\n \n end", "def print_test_suites_full(options={})\n\n # Heading\n print \"TEST_SUITE, \"\n @ts_data_types.each do |datatype|\n unless datatype == :override_testf\n print \"#{datatype.to_s}, \"\n end\n end\n print \"TM class, \"\n print \"TM limits, \"\n print \"TM parameters \"\n print \"\\n\"\n\n test_suites_sorted = @test_suites.sort_by { |k| k[:name] }\n\n # CSV data\n test_suites_sorted.each do |test_suite|\n print \"#{test_suite[:name]}, \"\n @ts_data_types.each do |datatype|\n unless datatype == :override_testf\n print \"#{test_suite[datatype.to_sym]}, \"\n end\n end\n # get associated test method data\n if @test_methods.has_key?(test_suite[:override_testf].to_sym)\n test_method = @test_methods[test_suite[:override_testf].to_sym]\n print \"#{test_method[:class]}, \"\n print \"#{test_method[:limits]}, \"\n print \"#{test_method[:parameters]}\"\n else\n print \"ERROR: could not find test method data for '#{test_suite[:override_testf]}'!!\"\n end\n print \"\\n\"\n end\nend", "def format_output_without_CSV\r\n\t\theadings = [] << \"Run\"\r\n\t\trows = []\r\n\t\t@parameters.each_with_index {|p,i| headings << \"F#{i+1}\"}\r\n\t\t@runs.each_with_index {|r,i| temp = [\"#{i+1}\"]; temp += r; rows << temp}\r\n\t\t@output_table = Terminal::Table.new :title => \"IPO Algorithm tests output\", :headings => headings, :rows => rows\r\n\tend", "def csv_download\n @stats = Hyrax::WorkUsage.new(params[:id])\n filename = params[:id] + \"_stats.csv\"\n #This is an example that worked\n #send_data @stats.to_csv, :type => 'text/csv; charset=utf-8; header=present', :disposition => 'attachment; filename=payments.csv'\n target = \"attachment`; filename=#{filename}\"\n send_data @stats.to_csv, :type => 'text/csv; charset=utf-8; header=present', :disposition => target\n end", "def create_scale_results_csv_file(scale_results_parent_dir)\n CSV.open(\"#{scale_results_parent_dir}/PERF_SCALE_#{@scale_timestamp}.csv\", \"wb\") do |csv|\n headings = [\"agents\",\n \"ok\",\n \"ko\",\n \"combined mean\",\n \"catalog mean\",\n \"filemeta plugins mean\",\n \"filemeta pluginfacts mean\",\n \"locales mean\",\n \"node mean\",\n \"report mean\",\n \"average CPU %\",\n \"average memory\"]\n\n csv << headings\n end\n end", "def data_report(options={})\n puts \"\\n\\n\"\n puts \"**********************************\\n\"\n puts \"**********************************\"\n puts @last_log\nend", "def measure_code(model,runner)\n measure_folder = \"#{File.dirname(__FILE__)}/\"\n baseline_spreadsheet = \"#{File.dirname(__FILE__)}/baseline.csv\"\n #Note: place output folder locally to run faster! (e.g. your C drive)\n output_folder = \"#{File.dirname(__FILE__)}/tests/output\"\n create_models = true\n simulate_models = true\n create_annual_outputs = true\n create_hourly_outputs = true\n #This creates the measures object and collects all the csv information for the\n # measure_id variant.\n csv_measures = BTAP::Measures::CSV_OS_Measures.new(\n baseline_spreadsheet,\n measure_folder#script root folder where all the csv relative paths are used.\n )\n csv_measures.create_cold_lake_vintages(output_folder) unless create_models == false\n BTAP::SimManager::simulate_all_files_in_folder(output_folder) unless simulate_models == false\n BTAP::Reporting::get_all_annual_results_from_runmanger(output_folder) unless create_annual_outputs == false\n #convert eso to csv then create terminus file.\n BTAP::FileIO::convert_all_eso_to_csv(output_folder, output_folder).each {|csvfile| BTAP::FileIO::terminus_hourly_output(csvfile)} unless create_hourly_outputs == false\n\n end", "def lifetime_csv\n CSV.generate do |csv|\n report_details(period_covered: 'Lifetime').each { |a| csv.add_row(a) }\n csv.add_row [] # Blank row\n lifetime_table.each { |a| csv.add_row(a) }\n end\n end", "def create_report\n print_sales_report_ASCII\n print_date\n print_products_ASCII\n print_brands_ASCII\n end", "def index\n authorize! :view, Measurement\n\n @measurements = Measurement.all\n\n @sites = Site.all\n @instruments = Instrument.all\n \n respond_to do |format|\n format.html\n format.csv { send_data @measurements.to_csv }\n end\n end", "def to_csv(function_list, tests)\n function_list.map { |function_name|\n v = tests[\"#{function_name} function\"]\n if v\n positive_tests = count_tests_in(v['groups']['success'])\n negative_tests = count_tests_in(v['groups']['failure'])\n pending_tests =\n count_pending_tests_in(v['groups']['failure']) +\n count_pending_tests_in(v['groups']['failure'])\n else\n positive_tests = 0\n negative_tests = 0\n pending_tests = 0\n end\n '%-25s, %-9d, %-9d, %-9d' % [function_name, positive_tests, negative_tests, pending_tests]\n }.compact\nend", "def display_results\n print_header\n print_detailed_report\n write_csv_report\n display_status\n end", "def student_all_report\n @user = User.find(params[:id])\n report = StringIO.new\n CSV::Writer.generate(report, ',') do |csv|\n #Get Words\n @words = @user.word_answers.find(:all, :order => \"question_id ASC\")\n csv << %w(question answer date)\n @words.each do |answer|\n csv << [answer.word.value, answer.value, answer.created_at]\n end\n #Get Situations\n @situation_answers = @user.completion_answers.find(:all, :order => \"question_id ASC\")\n @situation_answers.each do |answer|\n csv << [answer.completion.value, answer.value, answer.created_at]\n end\n #Get Scenarios\n @scenario_answers = @user.scenario_answers.find(:all, :order => \"question_id ASC\")\n @scenario_answers.each do |answer|\n csv << [answer.scenario.value, answer.value, answer.created_at]\n end\n \n #Get posts\n @posts = @user.posts.find(:all, :order => \"created_at DESC\")\n @posts.each do |post|\n csv << [post.topic.title, post.body, post.created_at]\n end\n end\n export_as_csv(report,@user.whole_name+\"-all\")\n end", "def export\n result = Urlmaster.all\n head = 'EF BB BF'.split(' ').map{|a|a.hex.chr}.join()\n exportFile = CSV.generate(csv = head) do |writer|\n writer << [\"mapId\", \"venueName\", \"floor\", \"typeMap\", \"venueFloorMapImageUrl\", \"venueFloorMapUrl\"]\n result.each do |r|\n writer << [r[:mapId], r[:venueName], r[:floor], r[:typeMap], r[:venueFloorMapImageUrl], r[:venueFloorMapUrl]]\n end\n end\n send_data exportFile, filename: \"MapCrawler-#{Time.now.in_time_zone(\"Asia/Tokyo\").strftime(\"%y%m%d%H%M%S\")}.csv\", type: \"text/csv\"\n # redirect_to crawler_path\n end", "def reporters; end", "def reporters; end", "def reporters; end", "def reporters; end", "def reporters; end", "def main\n Puppet.initialize_settings\n metrics_collector_setup\n\n output_file = Time.now.utc.strftime('%Y%m%dT%H%M%SZ') + '.json'\n\n @hosts.each do |host|\n timestamp = Time.now\n dataset = { 'timestamp' => timestamp.utc.iso8601, 'servers' => {} }\n hostkey = host.tr('.', '-')\n dataset['servers'][hostkey] = { @metrics_type => {} }\n url = \"https://#{host}:#{@port}\"\n\n # Puma based services use a different status endpoint and have an additional GC endpoint\n if ['ace', 'bolt'].include?(@metrics_type)\n status_url = URI(\"#{url}/admin/status\")\n\n gc_url = URI(\"#{url}/admin/gc_stat\")\n gc_status_output = get_endpoint(gc_url)\n else\n status_url = URI(\"#{url}/status/v1/services?level=debug\")\n end\n\n status_output = get_endpoint(status_url)\n dataset['servers'][hostkey][@metrics_type] = status_output\n dataset['servers'][hostkey][@metrics_type]['gc_stats'] = gc_status_output if gc_status_output\n\n unless @additional_metrics.empty?\n metrics_array = retrieve_additional_metrics(URI(\"#{url}/metrics/v2/read\"), @metrics_type, @additional_metrics)\n\n metrics_array.each do |metric_hash|\n metric_name = metric_hash['name']\n metric_data = metric_hash['data']\n dataset['servers'][hostkey][@metrics_type][metric_name] = metric_data\n end\n end\n\n dataset['servers'][hostkey][@metrics_type]['error'] = @errors\n dataset['servers'][hostkey][@metrics_type]['error_count'] = @errors.count\n dataset['servers'][hostkey][@metrics_type]['api-query-start'] = timestamp.utc.iso8601\n dataset['servers'][hostkey][@metrics_type]['api-query-duration'] = Time.now - timestamp\n\n filtered_dataset = filter_metrics(dataset, @excludes)\n json_dataset = JSON.generate(filtered_dataset)\n\n unless @output_dir.nil?\n Dir.chdir(@output_dir) do\n Dir.mkdir(host) unless File.exist?(host)\n File.open(File.join(host, output_file), 'w') do |file|\n file.write(json_dataset)\n end\n end\n end\n\n next unless @print\n # Use puts so that data gatherd from each host is written to stdout\n # with a newline separator. This enables parsing of multiple datasets\n # as the output stream is in line-delimited JSON form.\n STDOUT.puts(json_dataset)\n end\nrescue StandardError => e\n STDERR.puts \"Failed to collect #{@metrics_type} metrics: #{e.message}\"\n STDERR.puts e.backtrace\n nil\nend", "def export_comparisons\n begin\n study = Study.find(params[:study_id])\n \n if study.user_id == session[:user_id] && study.active\n headers['Content-Disposition'] = \"attachment; filename=\\\"comparisons_#{params[:study_id]}\\\"\"\n headers['Content-Type'] ||= 'text/csv'\n \n rawcomparisons = Comparison.where(study_id: params[:study_id])\n @comparisons = []\n salt = SecureRandom.hex(24)\n \n if study.n_way == 3\n @headers = ['User', 'Time', 'Item ID 1', 'Rank 1', 'Item ID 2', 'Rank 2', 'Item ID 3', 'Rank 3']\n \n rawcomparisons.each do |rawcomparison|\n ranks = Rank.where(comparison_id: rawcomparison.id)\n if ranks.size == 3 && Item.find(ranks[0].item_id) && Item.find(ranks[1].item_id) && Item.find(ranks[2].item_id)\n first = 0\n second = 1\n third = 2\n if ranks[first].rank > ranks[second].rank\n temp = first\n first = second\n second = temp\n end\n if ranks[second].rank > ranks[third].rank\n temp = second\n second = third\n third = temp\n end\n if ranks[first].rank > ranks[second].rank\n temp = first\n first = second\n second = temp\n end\n @comparisons << [(rawcomparison.user_id.to_s + salt).hash,\n rawcomparison.time,\n Item.find(ranks[first].item_id).id,\n ranks[first].rank,\n Item.find(ranks[second].item_id).id,\n ranks[second].rank, \n Item.find(ranks[third].item_id).id, \n ranks[third].rank]\n end\n end\n else\n @headers = ['User', 'Time', 'Item ID 1', 'Rank 1', 'Item ID 2', 'Rank 2']\n \n rawcomparisons.each do |rawcomparison|\n ranks = Rank.where(comparison_id: rawcomparison.id)\n if ranks.size == 2 && Item.find(ranks[0].item_id) && Item.find(ranks[1].item_id)\n first = 0\n last = 1\n if ranks[0].rank > ranks[1].rank\n first = 1\n last = 0\n end\n @comparisons << [(rawcomparison.user_id.to_s + salt).hash,\n rawcomparison.time,\n Item.find(ranks[first].item_id).id,\n ranks[first].rank,\n Item.find(ranks[last].item_id).id,\n ranks[last].rank]\n end\n end\n end\n else\n redirect_to(manage_study_path)\n end\n rescue\n redirect_to(manage_study_path)\n end\n end", "def performance(index)\n puts \"\\n#{@testcase.name}\\n\"\n puts \" %-10s %-20s %-8s %s \" % [\"#{@response.runtime.to_s[0..6]}s\", \"[#{result_case}]\", @testcase.request['method'], @response.fully_qualified_path]\n end", "def main()\n request_url = \"#{$canvas_url}/api/v1/users/#{$canvas_user_id}/page_views?per_page=100&start_time=#{$start_time}&end_time=#{$end_time}\"\n method = \"get\"\n options = {}\n data = canvasApiRequest(method,request_url,options)\n compiledHash = []\n data.each do |hash|\n hashData = flattenHash(hash)\n compiledHash.push(hashData)\n end\n outputToCSV(compiledHash)\nend", "def to_csv(options = {})\n if [\"html\", \"pdf\", \"xml\", \"combined\"].include? options[:format]\n view = \"counter_#{options[:format]}_views\"\n else\n view = \"counter\"\n end\n\n service_url = \"#{ENV['COUCHDB_URL']}/_design/reports/_view/#{view}\"\n\n result = get_result(service_url, options.merge(timeout: 1800))\n if result.blank? || result[\"rows\"].blank?\n Alert.create(exception: \"\", class_name: \"Faraday::ResourceNotFound\",\n message: \"CouchDB report for Counter could not be retrieved.\",\n source_id: id,\n status: 404,\n level: Alert::FATAL)\n return \"\"\n end\n\n if view == \"counter\"\n CSV.generate do |csv|\n csv << [\"pid_type\", \"pid\", \"html\", \"pdf\", \"total\"]\n result[\"rows\"].each { |row| csv << [\"doi\", row[\"key\"], row[\"value\"][\"html\"], row[\"value\"][\"pdf\"], row[\"value\"][\"total\"]] }\n end\n else\n dates = date_range(options).map { |date| \"#{date[:year]}-#{date[:month]}\" }\n\n CSV.generate do |csv|\n csv << [\"pid_type\", \"pid\"] + dates\n result[\"rows\"].each { |row| csv << [\"doi\", row[\"key\"]] + dates.map { |date| row[\"value\"][date] || 0 } }\n end\n end\n end", "def csvexport_all_tables\n @wires = Wire.all.sort_by {|obj| obj.kabeltyp}\n @switchgears_einbau = Switchgear.all.sort_by {|obj| obj.kennung}\n @switchgears = Switchgear.where(:typ => 1).sort_by {|obj| obj.kennung}\n @assemblies = Assembly.all.sort_by {|obj| obj.kennung}\n @electrical_installations = ElectricalInstallation.all.sort_by {|obj| obj.kennung}\n @drives = Drive.all.sort_by {|obj| obj.kennung}\n @devices = Device.all.sort_by {|obj| obj.definition}\n @iogroups = Iogroup.all.sort_by {|obj| obj.name}\n @switchgearcombinations = Switchgearcombination.all.sort_by {|obj| obj.name}\n @offertpositions = Offertposition.where(:subsubproject_id => params[:subsubproject_id]).sort_by {|obj| obj.name}\n @subsubproject = Subsubproject.find(params[:subsubproject_id])\n @subsubprojects = @subsubproject.subproject.subsubprojects.sort_by {|obj| obj.name}\n @subsystems = @subsubproject.subproject.project.subsystems.all.sort_by {|obj| obj.name}\n @units = Unit.where(:subsystem_id => @subsystems.pluck(:id)).sort_by {|obj| obj.name}\n\n CSV.open(\"export_all_tables#{Time.now.strftime(\"%Y-%m-%d-%H-%M\")}.csv\", \"wb\", {:headers => true, :encoding => \"iso-8859-1\", :col_sep => \";\"}) do |csv|\n csv << ['Geraetetypen', '']\n @devices.each do |entry| csv << [entry.id, entry.definition] end\n csv << ['SPS-Modultypen', '']\n @assemblies.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Frequenzumrichtertypen', '']\n @drives.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Kabeltypen', '']\n @wires.each do |entry| csv << [entry.id, entry.kabeltyp] end\n csv << ['Elektroinstallationstypen', '']\n @electrical_installations.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschranktypen', '']\n @switchgears.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltschrankeinbautypen', '']\n @switchgears_einbau.each do |entry| csv << [entry.id, entry.kennung] end\n csv << ['Schaltgeraetekombinationen', '']\n @switchgearcombinations.each do |entry| csv << [entry.id, entry.name] end\n csv << ['IO-Gruppen', '']\n @iogroups.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Offertpositionen', '']\n @offertpositions.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Teilanlagen', '']\n @subsystems.each do |entry| csv << [entry.id, entry.name] end\n csv << ['TeilanlagenUnits', '']\n @units.each do |entry| csv << [entry.id, entry.name] end\n csv << ['Projektversionen', '']\n @subsubprojects.each do |entry| csv << [entry.id, entry.name] end\n end\n\n redirect_to settings_path, :notice => \"Export wurde unter \" + Rails.root.to_s + \"/ abgelegt!\"\n end", "def stg_provider_report\n @stg_provider_csv_array = []\n get_storage_providers\n @stg_providers_id_list.each do |stgprovider|\n stg_provider = rest_get(\"#{@volume_url}/storage-providers/#{stgprovider}\", @token_id)\n stg_provider_array = JSON.parse(stg_provider)['storage_provider']\n stg_provider_name = stg_provider_array['service']['host_display_name']\n stg_provider_type = stg_provider_array['backend_type']\n stg_provider_health = stg_provider_array['health_status']['health_value']\n stg_provider_tot_cap = stg_provider_array['total_capacity_gb']\n stg_provider_free_cap = stg_provider_array['free_capacity_gb']\n @stg_provider_csv_headers = %w(Storage_Provider_Name Storage_Provider_Type Storage_Provider_Health Storage_Provider_Total_Cap Storage_Provider_Free_Cap)\n @stg_provider_csv_array << [stg_provider_name, stg_provider_type, stg_provider_health, stg_provider_tot_cap, stg_provider_free_cap]\n end\n end", "def scg_report_csv(filename)\n puts 'Creating the Storage Connectivity Groups report'\n CSV.open(\"#{filename}\", 'ab') do |csv|\n csv << [\"\\n\"]\n csv << %w(Storage_Connectivity_Groups_List)\n csv << %w(SCG_Name SCG_Auto_Add_VIOs SCG_FC_Storage_Access SCG_Ports_per_Fabric SCG_Host_List SCG_VIOs_List)\n scg_report\n csv_array(@scg_csv_array, csv)\n end\n puts 'Done'\n end", "def csv_header\n header = CSV.generate_line([\"Application Path\", \"Report Generation Time\", \"Checks Performed\", \"Rails Version\"])\n header << CSV.generate_line([File.expand_path(tracker.app_path), Time.now.to_s, checks.checks_run.sort.join(\", \"), rails_version])\n \"BRAKEMAN REPORT\\n\\n\" + header\n end", "def donation_report_csv\n if date_format_check\n\n filter_by_account, account_id = account_filter\n\n csv_string = FasterCSV.generate do |csv|\n\n if filter_by_account\n filter_conditions = \"AND finance_transaction_receipt_records.fee_account_id #{account_id == nil ? 'IS' : '='} ?\"\n filter_values = [account_id]\n else\n filter_conditions = \"\"\n filter_values = []\n end\n\n category_id = FinanceTransactionCategory.find_by_name(\"Donation\").id\n @donations = FinanceDonation.all(:joins => {:transaction => :transaction_receipt},\n :order => 'finance_transactions.transaction_date desc',\n :conditions => [\"(finance_transactions.transaction_date BETWEEN ? AND ?) AND category_id = ?\n #{filter_conditions}\", @start_date, @end_date, category_id] + filter_values,\n :select => \"finance_donations.*, CONCAT(IFNULL(transaction_receipts.receipt_sequence, ''),\n transaction_receipts.receipt_number) AS receipt_no,\n finance_transactions.voucher_no\")\n\n csv << [t('donations')]\n csv << [t('start_date'), format_date(@start_date)]\n csv << [t('end_date'), format_date(@end_date)]\n csv << [t('fee_account_text'), \"#{@account_name}\"] if @accounts_enabled\n csv << \"\"\n cols = [t('donor'), ('amount'), t('receipt_or_voucher_no'), t('date_text')]\n csv << cols\n\n total = 0\n\n @donations.each do |d|\n csv << [d.donor, precision_label(d.amount.to_f), d.receipt_no.nil? ? d.voucher_no : d.receipt_no,\n format_date(d.transaction_date)]\n total += d.amount.to_f\n end\n\n csv << [t('net_income'), precision_label(total)]\n end\n\n filename = \"#{t('donations')}-#{format_date(@start_date)}-#{format_date(@end_date)}.csv\"\n send_data(csv_string, :type => 'text/csv; charset=utf-8; header=present', :filename => filename)\n end\n end", "def to_csv\n [@name, @description, @prep_time, @done]\n end", "def modeler_description\n return \"Exports all available hourly timeseries enduses to csv, and uses them for utility bill calculations.\"\n end", "def modeler_description\n return \"Exports all available hourly timeseries enduses to csv, and uses them for utility bill calculations.\"\n end", "def csv_report\n tire_cols = params[:tire] || {}\n ar_cols = params[:activerecord] || {}\n assocs_to_include = params[:assoc][:include] || {}\n params[:assoc][:max] ||= {}\n klass = model_class.constantize\n @filename = \"#{model_class.humanize}.csv\"\n\n response.headers['Content-Type'] ||= 'text/plain'\n response.headers['Content-Disposition'] = \"attachment; filename=#{@filename}\"\n response.headers['Content-Transfer-Encoding'] = 'binary'\n response.headers['Last-Modified'] = Time.now.to_s\n\n # Right, try to define a header:\n header = []\n tire_cols.keys.each { |x| header.push(x.humanize) }\n ar_cols.keys.each { |x| header.push(x.humanize) }\n assocs_to_include.keys.each do |assoc|\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n header.push params[:assoc][assoc.to_sym].keys.first\n elsif params[:assoc][:max][assoc] # has_many\n (1 .. (params[:assoc][:max][assoc].to_i)).each do |i|\n params[:assoc][assoc.to_sym].keys.each do |k|\n header.push(\"#{assoc.singularize.humanize} #{i} #{k.humanize}\")\n end\n end\n else # has_a\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n header.push \"#{assoc.humanize} #{k.humanize}\"\n end\n end\n end\n\n results = klass.search({ per: TireSearch::INFINITY }, 1, '')\n self.response_body = Enumerator.new do |y|\n results.each_with_index do |result, i|\n y << header.to_csv if i == 0\n\n line = []\n tire_cols.keys.each { |x| line.push(result[x]) }\n\n result = result.load if ar_cols.count > 0 || assocs_to_include.keys.count > 0\n\n ar_cols.keys.each { |x| line.push(result.send(x)) } if ar_cols.count > 0\n\n assocs_to_include.keys.each do |assoc|\n related = result.send(assoc)\n if params[:assoc][:max][assoc] == 'join' # Is a has_many with only one real column\n col = params[:assoc][assoc.to_sym].keys.first\n line.push related.map { |x| x.send(col) }.join(' // ')\n elsif params[:assoc][:max][assoc]\n (0 .. (params[:assoc][:max][assoc].to_i - 1)).each do |j|\n params[:assoc][assoc.to_sym].keys.each do |k|\n line.push(related[j] ? related[j].send(k) : nil)\n end\n end\n else\n params[:assoc][assoc.to_sym].keys.each do |k| # Each key requested from the associated record\n line.push related ? related.send(k) : nil\n end\n end\n end\n y << line.to_csv\n GC.start if i % 500 == 0\n end\n end\n end", "def generate_csv\n\n fields = @resource.typus_fields_for(:csv)\n\n require 'csv'\n if CSV.const_defined?(:Reader)\n # Old CSV version so we enable faster CSV.\n begin\n require 'fastercsv'\n rescue Exception => error\n raise error.message\n end\n csv = FasterCSV\n else\n csv = CSV\n end\n\n filename = Rails.root.join(\"tmp\", \"export-#{@resource.to_resource}-#{Time.now.utc.to_s(:number)}.csv\")\n\n options = { :conditions => @conditions, :batch_size => 1000 }\n\n csv.open(filename, 'w', :col_sep => ';') do |csv|\n csv << fields.keys\n @resource.find_in_batches(options) do |records|\n records.each do |record|\n csv << fields.map do |key, value|\n case value\n when :transversal\n a, b = key.split(\".\")\n record.send(a).send(b)\n when :belongs_to\n record.send(key).to_label\n else\n record.send(key)\n end\n end\n end\n end\n end\n\n send_file filename\n\n end", "def generate_report()\n system(\"java -cp emma.jar emma report -r html -in coverage.em,coverage.ec\")\nend", "def dumpCsvSummary()\n CSV.open(csvFilenameSummary(), \"w\", { :col_sep => csvColSepChar() }) { |csv|\n csv << AnalyzerExpA.genCsvTitleRow() ;\n genCsvSummary().each{|row|\n csv << row ;\n }\n }\n end", "def as_csv(*)\n populate_carriers!\n\n CSV.generate do |csv|\n csv << [\n 'key', 'primary_co2_emission',\n *primary_carriers.map { |c| \"primary_demand_of_#{c} (MJ)\" },\n *final_carriers.map { |c| \"final_demand_of_#{c} (MJ)\" }\n ]\n\n @graph.group_nodes(:application_group).each do |node|\n csv << node_row(node)\n end\n end\n end", "def to_csv(options = {})\n if [\"html\", \"pdf\", \"xml\", \"combined\"].include? options[:format]\n view = \"#{options[:name]}_#{options[:format]}_views\"\n else\n view = options[:name]\n end\n\n # service_url = \"#{ENV['COUCHDB_URL']}/_design/reports/_view/#{view}\"\n\n result = get_result(service_url, options.merge(timeout: 1800))\n if result.blank? || result[\"rows\"].blank?\n message = \"CouchDB report for #{options[:name]} could not be retrieved.\"\n Notification.where(message: message).where(unresolved: true).first_or_create(\n exception: \"\",\n class_name: \"Faraday::ResourceNotFound\",\n source_id: id,\n status: 404,\n level: Notification::FATAL)\n return \"\"\n end\n\n if view == options[:name]\n CSV.generate do |csv|\n csv << [\"pid_type\", \"pid\", \"html\", \"pdf\", \"total\"]\n result[\"rows\"].each { |row| csv << [\"doi\", row[\"key\"], row[\"value\"][\"html\"], row[\"value\"][\"pdf\"], row[\"value\"][\"total\"]] }\n end\n else\n dates = date_range(options).map { |date| \"#{date[:year]}-#{date[:month]}\" }\n\n CSV.generate do |csv|\n csv << [\"pid_type\", \"pid\"] + dates\n result[\"rows\"].each { |row| csv << [\"doi\", row[\"key\"]] + dates.map { |date| row[\"value\"][date] || 0 } }\n end\n end\n end", "def show\n results = db.grouped_metrics\n # todo: this is now in an erb\n metric_names = results[results.keys.first].keys.map { |m| m.gsub(/(init_|run_)/,'') }.uniq\n # would like to sort metric_names by ips (just for one)\n\n puts \"var data = [{\"\n results.each_with_index do |(sha, metrics), i|\n puts \" ]}, {\" if i > 0\n date = metrics.first[1].first[:date] #.split(\"T\").first\n puts \" name: \\\"#{sha}\\\", date: \\\"#{date}\\\", values: [\"\n\n metric_names.each_with_index do |bench, j|\n metric = metrics[bench] || metrics[\"run_#{bench}\"]\n metric = metric.first\n\n init_metric = metrics[\"init_#{bench}\"]\n init_metric = init_metric.first if init_metric\n puts \",\" if j > 0\n print \" {bench: %-20s, ips: %-8s, sd: %-8s\" %\n [\"\\\"#{bench}\\\"\",metric[:ips], metric[:ips_sd]]\n if init_metric\n print \", init_ips: %-8s, init_sd: %-8s\" %\n [init_metric[:ips], init_metric[:ips_sd]]\n end\n print \"}\"\n end\n puts\n end\n puts \"]}];\"\n end", "def transactions\n csv_string = \"\"\n checks.each_with_index do |check, index|\n csv = \"\"\n check_klass = OutputCsv.class_for(\"Check\", check.batch.facility)\n puts \"Applying class #{check_klass}\" if index == 0\n check_obj = check_klass.new(check, index)\n csv = check_obj.generate\n csv_string = csv_string + csv\n # For the first iteration, inorder to execute both header creation and first row writing, generate method is called once more\n if index == 0\n check_obj = check_klass.new(check, 1)\n csv = check_obj.generate\n csv_string = csv_string + csv\n end\n end\n return csv_string\n end" ]
[ "0.6961577", "0.6871197", "0.63045365", "0.6281409", "0.6250315", "0.61898154", "0.61358714", "0.61084414", "0.6084353", "0.6054181", "0.6031395", "0.6022267", "0.6002168", "0.59988534", "0.5985953", "0.59391624", "0.59238267", "0.59213936", "0.59070647", "0.5891289", "0.5875402", "0.5855966", "0.58253425", "0.58090055", "0.5807907", "0.57894915", "0.57553613", "0.57516044", "0.5746088", "0.5744676", "0.57339126", "0.57131666", "0.5700202", "0.5694298", "0.56848925", "0.5670631", "0.5660023", "0.56566554", "0.5650033", "0.5636126", "0.56359553", "0.56208557", "0.5619084", "0.5617942", "0.56173277", "0.56160027", "0.56153977", "0.5605399", "0.5605077", "0.5604778", "0.55948603", "0.5585297", "0.55800337", "0.55781", "0.5571691", "0.55581", "0.55569077", "0.5556536", "0.5550768", "0.5546226", "0.55449206", "0.5543786", "0.55260396", "0.5521302", "0.5520826", "0.55073774", "0.5506474", "0.549422", "0.548351", "0.5483371", "0.5472112", "0.5470769", "0.54691494", "0.5461555", "0.54572964", "0.54572964", "0.54572964", "0.54572964", "0.54572964", "0.54504544", "0.5447304", "0.54402184", "0.54362744", "0.5434045", "0.54325837", "0.5428853", "0.5428024", "0.5411442", "0.54108995", "0.54108226", "0.54093206", "0.54093206", "0.5406519", "0.5397247", "0.53967756", "0.5391699", "0.53820485", "0.53747696", "0.5371789", "0.5369579" ]
0.69748455
0
def reduce_to_total(array, alpha = 0) THE DO WHILE DOESN'T APPEAR TO WORK, WILL EXAMINE LATER total_amount = alpha; counter = 0; loop do total_amount += array[counter]; counter = counter + 1; break if counter < array.length; end return(total_amount); end
def reduce_to_total(array, alpha = 0) total_amount = alpha; counter = 0; while counter < array.length do total_amount += array[counter]; counter = counter + 1; end return(total_amount); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_to_total(array)\n total = 0 \n count = 0 \n while count < array.length do\n total = total + array[count]\n count += 1\n end\n total\nend", "def reduce_to_total(array,starting_point=0)\n total = starting_point\n counter = 0 \n while counter < array.size do \n total += array[counter]\n counter += 1\n end\n total\nend", "def total(array)\n\tx = array.length\n\tsum = 0\n\t\twhile x > 0\n\t\t\tsum += array[x-1]\n\t\t\tx -= 1\n\t\tend\n\n\treturn sum\n\nend", "def total(array)\n a = 0\n for i in 0...array.length\n a = a + array[i]\n end\n return a\nend", "def total(array)\n sum = 0\n array.inject(:+)\nend", "def total(array)\n sum = 0\n array.inject(:+)\nend", "def total(array)\n\tarray.inject(0) {|sum, num| sum += num}\nend", "def total(array)\n sum = 0\n array.each do |number|\n sum = sum += number\n end\n sum\nend", "def total(array)\nsum = 0 \n\tarray.each do |num|\n\tsum += num \n\tend \n\treturn sum\nend", "def reduce_to_total(source_array, starting_point = 0 )\n \n new_total = starting_point\n i = 0\n while i < source_array.length do\n new_total += source_array[i]\n i += 1\n end\n return new_total\n \n end", "def total(array)\n sum = 0\n array.each {|x| sum += x}\n return sum\nend", "def total(array)\n sum = 0\n array.each do |num|\n sum += num\n end\n return sum\nend", "def total(array)\n\tsum = 0\n\tsum = array.inject {|sum, i| sum + i}\nend", "def total(array)\n sum = 0\n array.each { |i| sum += i}\n return sum\nend", "def total(array)\n \tsum = 0\n \tarray.each do |num|\n sum += num\n end\t\n return sum\n end", "def total (array)\n\tindex = 0\n\tsum = 0\n\twhile index < array.length\n\t\tsum = sum + array[index]\n\t\tindex += 1\n\tend\n\treturn sum\nend", "def total(array)\n index = 0\n sum = 0\n until index == array.length\n sum += array[index]\n index += 1\n end\nreturn sum\nend", "def total(array)\n sum = 0\n array.each { |i| sum += i }\n return sum\nend", "def total(array)\n \n len = array.length\n i = 0\n sum = 0\n \n while i < len do\n sum = sum + array[i]\n i = i + 1\n end\n return sum\nend", "def total(array)\n\tsum = 0\n\tarray.each { |x| sum += x }\t\n\tsum\nend", "def total (array)\n sum = 0\n for x in array\n sum += x\n end\n return sum\nend", "def total (array)\n array.inject {|m, v| m += v}\nend", "def total (array)\n total = 0\n array.each do |i|\n total += i\nend\nreturn total\nend", "def running_total(array)\n # new_array = []\n sum = 0\n array.inject([]) do |arr, val| \n sum += val\n arr << sum \n arr\n end\nend", "def total(array)\n array[0..-1].reduce(:+)\nend", "def total(array)\n sum = 0\n array.each do |x|\n sum += x\nend\nsum\nend", "def total(array)\n\tsum = array.inject(0, :+)\nend", "def total(array)\n sum = 0\n array.each do |n|\n sum += n\n end\n sum\nend", "def total(array)\n total = 0\n array.each do |number|\n total += number\n end\n total\nend", "def total(array)\n sum = 0\n array.each{ |x| sum += x }\nend", "def total(array)\n sum = 0\n array.each{ |x| sum += x }\nend", "def total(array)\n i = 0\n answer = 0\n\n while i < array.length\n answer += array[i]\n i += 1\n end\n return answer\nend", "def total(array)\n i = 0\n answer = 0\n\n while i < array.length\n answer += array[i]\n i += 1\n end\n return answer\nend", "def reduce_to_total(source_array, starting_point=0)\n temp = starting_point\n i = 0\n while i < source_array.length do\n temp += source_array[i]\n i += 1\n end\n return temp\nend", "def total(array)\n\tsum = 0\n\tarray.each { |a| sum += a }\n\treturn sum\nend", "def total (array)\n x = 0 \n sum = 0\n while x <= array.length-1\n sum += array[x]\n x += 1\n end\n return sum \nend", "def total (array)\n x = 0 \n sum = 0\n while x <= array.length-1\n sum += array[x]\n x += 1\n end\n return sum \nend", "def total(array) \n\tsum = 0\n\ti = 0\n\tfor i in 0.. array.length\n\tarray.each { |i| sum += i}\n\treturn sum\nend\nend", "def total(array) \n number = 0\n array.each do |i|\n number += i\n end\n number\nend", "def total(array)\n\tarray.inject {|sum,n| sum + n}\n\tend", "def total(array) \n\tsum = 0\n\tfor i in 0.. array.length\n\tarray.each { |i| sum += i}\n\treturn sum\nend\nend", "def total (array)\n\tsum=0\n\tarray.each do |n| sum += n\n\tend\n\treturn sum\nend", "def total(array)\n\tarray.inject(0) {|sum,x| sum + x}\nend", "def reduce_to_total(source_array, starting_point=0)\n i = 0\n total = starting_point\n while i < source_array.length do\n total = total + source_array[i]\n i += 1\n end\n total\nend", "def total(array)\n\tsum = 0\n\tarray.each do |i|\n\t\tsum += i\n\tend\n\treturn sum\nend", "def total(array)\n\tsum = 0\n\tarray.each {|number| sum += number}\n\tsum\nend", "def total(array)\n sum = 0\n array.each do |x|\n sum = sum + x\n end\n sum\nend", "def total_of_array(array)\n # iterate through array\n # have a sum variable keeping track\n # add to sum variable each time\n sum = 0\n array.each {|x|\n sum += x\n }\n sum\nend", "def cust_red(array)\n total = 0 \n array.each_with_index do |el, i|\n total += el \n end \n total\nend", "def reduce_to_total(source_array, starting_point = 0)\n #source_array.reduce(starting_point) {|sum, n| sum + n}\n i = 0\n sum = starting_point\n while i < source_array.length do\n sum = sum + source_array[i]\n i += 1\n end\n return sum\nend", "def total(array)\n\tarray.inject {|sum, a| a + sum}\nend", "def total(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal += x\n\tend\n\treturn total\nend", "def total(array)\n\tarray.inject(:+)\nend", "def total(array)\n\ttotal = 0\n\tarray.each do |n|\n\t\ttotal += n \n\tend\n\treturn total\nend", "def total (array)\n\tarray.inject { |sum, n| sum + n }\nend", "def total(array)\n sum = 0\n array.inject(0) {|sum, i|\n sum + i}\n end", "def total(array)\n array.inject(0) {|sum, i| sum + i }\nend", "def running_total(array)\n sum = 0\n running_total = []\n\n array.each do |element|\n sum += element\n running_total << sum\n end\n\n running_total\nend", "def total(array)\n\tarray.inject do |sum, i| sum + i\n\tend\nend", "def total (array)\n sum = 0\n array.each do |i|\n sum + i\n end\n return sum\nend", "def running_total(array)\n result = []\n\n array.inject(0) do |sum, num|\n result << sum += num\n sum # have to return sum\n end\n result\nend", "def running_total(array)\n sum = 0\n new_array = []\n array.each do |num|\n sum += num\n new_array << sum\n end\n new_array\nend", "def total(array)\n array.inject(0) {|total, i| total + i }\nend", "def total(array)\n array.inject(:+)\nend", "def total(array)\n sum = array.inject(:+)\n sum\nend", "def total(array)\n\treturn array.inject { |sum, x| sum + x }\nend", "def total(array)\n sum = 0.0\n result = 0.0\n if array.length > 0 then\n array.each do |item|\n sum += item\n end\n result = sum \n end\n return result\nend", "def sum(array)\n array.reduce(0, :+)\n=begin\n res =0\n array.each { |a| res += a }\n res.to_i\n=end\nend", "def total(arr)\n total = 0\n arr.each {|i| total += i}\n return total\nend", "def total(array)\n\tlength = array.length\n\tsum = 0 \n\tfor i in 0...length\n\tsum = sum + array[i]\n\tend\n\tsum\nend", "def running_total(array)\n\n\treturn array if array.empty?\n\n\ttotal = 0\n\n\tarray.map! do |num|\n\t\ttotal += num\n\tend\n\nend", "def running_total(array)\n new_array = []\n i = 0\n while i <= array.length - 1\n new_array << array[0..i].reduce(:+)\n i += 1\n end\n new_array\nend", "def total(array)\n i = 0\n array.each { |a| i += a.to_i }\n return i\nend", "def total(array)\n\tarray.inject { |sum, x| sum + x }\nend", "def total(array)\n array.inject {|sum, a| sum + a }\nend", "def total(array)\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\tsum\nend", "def total(array)\n if array.size !=0\n total_num = 0\n for n in 0...array.size\n value = array[n]\n total_num += value\n end\n return total_num\n end\nend", "def running_total(array)\n run_total = []\n \n index = 1\n while index <= array.length\n element = array.slice(0,index)\n run_total << element.inject(:+)\n index += 1\n end\n run_total\nend", "def total (array)\n\tsum = 0\n\n\tarray.each {|x| sum = sum + x}\n\treturn sum\nend", "def running_total(array)\n total = 0\n new_array = []\n while array.size > 0\n total += array.shift\n new_array << total\n end\n new_array\nend", "def total array\n array.inject(0){|sum,x| sum + x }\nend", "def running_total(array)\n p array.each_with_index { |_, index| array[0..index].reduce(:+) }\nend", "def total(array)\n\tarray.inject{|sum,x| sum + x }\nend", "def total(arr)\n output = 0\n arr.each do |x|\n output += x\n end\n output\nend", "def total(arr)\nnumber = 0\narr.each { |x| number += x}\n return number\nend", "def total(arr)\n return arr.inject(:+)\nend", "def running_total3(array)\n sum = 0\n array.map do |num|\n sum = [sum, num].inject(:+)\n end\nend", "def total(array)\n array.inject { |sum, n| sum + n}\nend", "def running_total1(array)\n r_total = 0\n array.map { |n| r_total += n }\nend", "def total(array)\n array.inject {|sum, x| sum + x}\nend", "def total(array)\n array.inject {|sum, x| sum + x}\nend", "def reduce_to_total(source_array, starting_point = 0)\n total = starting_point\n index = 0\n while index < source_array.size do\n total += source_array[index]\n index += 1\n end\n total\nend", "def running_total(array)\n result = []\n sum = 0\n index = 0\n\n while array.size > index\n result << sum += array[index]\n index += 1\n end\n result\nend", "def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend", "def total(arr)\n\t output = 0\n\t arr.each do |x|\n\t output += x\n\t end\n\t output\nend", "def total(array)\n x = 0\n while x < array.length\n array.each do |n|\n x += n\n end\n end\n return x\nend", "def total(arr)\n\tarr.inject(0) { |x, y| x + y }\nend", "def total(array)\n\tarray.inject{|result, element|result+element}\nend", "def total(array)\n\tanswer=array.inject(0){\n\t\t|sum,i| sum+i\n\t}\n\treturn answer\nend", "def sum_of_sums(array)\n total = 0\n until array.size == 0\n total += array.reduce(:+)\n array.pop\n end\n total\nend" ]
[ "0.84213156", "0.81451094", "0.8005651", "0.7984552", "0.7935845", "0.7935845", "0.79302746", "0.7877407", "0.78555954", "0.7849903", "0.784916", "0.784501", "0.78441554", "0.78409505", "0.7840298", "0.78377235", "0.7830708", "0.7821809", "0.7820845", "0.7810847", "0.7799043", "0.7795446", "0.77944005", "0.7792647", "0.7786702", "0.77844256", "0.77839804", "0.7774067", "0.77514553", "0.7748912", "0.7748912", "0.7745959", "0.7745959", "0.77455425", "0.7743116", "0.7741744", "0.7741744", "0.7737925", "0.77275664", "0.77264917", "0.7723865", "0.77211547", "0.77162534", "0.7710317", "0.7701401", "0.7699679", "0.7698545", "0.76966614", "0.7696297", "0.7692581", "0.76883674", "0.7684043", "0.7682094", "0.76793754", "0.7679034", "0.76772475", "0.76764095", "0.7676057", "0.7673066", "0.7666592", "0.7657687", "0.7652393", "0.7651712", "0.7651477", "0.76495147", "0.764801", "0.76385444", "0.7638088", "0.7631067", "0.763", "0.7629859", "0.7627564", "0.7626073", "0.7625272", "0.7623565", "0.76214164", "0.76210415", "0.76178575", "0.76155376", "0.76064384", "0.76023215", "0.7591509", "0.7589265", "0.75853235", "0.7575469", "0.75718015", "0.7571798", "0.75593233", "0.75519407", "0.7551708", "0.7551708", "0.75495434", "0.7546751", "0.7540621", "0.7540621", "0.7536283", "0.75226074", "0.7515332", "0.7509416", "0.75084054" ]
0.9670998
0
def reduce_to_all_true(array) THE DO WHILE DOESN'T APPEAR TO WORK, WILL EXAMINE LATER counter = 0; loop do run following block until condition is met... return false if array[counter] == array[counter]; ...return false if any elements is a false value... return false if array[counter] == !array[counter]; ...return false if any elements is a false value... return false if array[counter]; ...return false if any elements is a false value... return false if !array[counter]; ...return false if any elements is a false value... counter += 1; ...increment counter and... break if counter < array.length; ...stop executing block if this condition is true... end true; ...however if we reach here, then all array elements are true, thus return true. end
def reduce_to_all_true(array) counter = 0; while counter < array.length do return false if !array[counter]; counter += 1; end return(true); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce_to_all_true(source_array)\n i = 0\n\n while i < source_array.length do\n if source_array[i] == false\n return false\n end\n i += 1\n end\n \n return true\nend", "def reduce_to_all_true(array)\n if array.include? false\n false\n elsif array.each.include? true\n true\n end\nend", "def reduce_to_all_true(source_array)\n i = 0\n while i < source_array.length do\n return false if !source_array[i]\n i += 1\n end\n return true\nend", "def reduce_to_all_true(source_array) \n i = 0\n while i < source_array do\n return false if !source_array[i]\n i += 1\n end\nend", "def reduce_to_all_true(source_array)\n index = 0 \n result = true \n while index < source_array.length do \n if source_array[index]\n result\n else\n result = false\n end\n index += 1 \n end\n result\nend", "def reduce_to_any_true(source_array)\n i = 0 \n while i < source_array.length do\n if source_array[i] == true \n return true\n end\n i += 1 \n end\n return false\nend", "def reduce_to_any_true(source_array)\n counter = -1 \n while counter < source_array.length\n counter += 1\n while source_array[counter]\n if source_array[counter] == true\n return true\n else\n counter += 1\n end\n end\n end\n return false\nend", "def reduce_to_any_true(source_array)\n i = 0\n\n while i < source_array.length do\n if source_array[i] == true\n return true\n end\n i += 1\n end\n \n return false\nend", "def reduce_to_any_true(source_array)\n i = 0 \n while i < source_array.length do\n return true if source_array[i]\n i += 1 \n end\nend", "def reduce_to_all_true(array)\n i=0 \n while i < array.length do\n if array[i] == false \n #puts \" #{array[i]} is truthy\"\n return false\n end\n #puts \"This is second #{array[i]}\"\n i += 1 \n end\n #puts \"after while #{array[i]}\"\n return true \n \n\nend", "def reduce_to_all_true(source_array)\nend", "def reduce_to_all_true(source_array)\n return source_array.all? {|word| word}\nend", "def areAllTrue(boolean_array)\r\n\tboolean_array.each do |x|\r\n\t\tif !x \r\n\t\t\treturn false\r\n\t\tend\r\n\tend\r\n\treturn true\r\nend", "def reduce_to_any_true(source_array)\n return source_array.any? {|word| word}\nend", "def all?(arr)\n arr.each { |el| return false if yield(el) == false}\n true\nend", "def only_true(array)\n array.reject{|element| element == false || element == nil}\nend", "def array_42(arr)\n arr.map{|x| x== 42}.count{|x| x == true} == 1 ? true : false\nend", "def all?(array)\n i = 0\n score = 0\n\n while i < array.length\n if yield(array[i])\n score += 1\n end\n i += 1\n end\n\n score == array.length\nend", "def my_all?(collection)\n i = 0\n block_return_values = []\n while i < collection.length\n block_return_values.push(yield(collection[i]))\n #Three steps\n #First we add yield keyword to yield each element of the block\n #Second we, save the the return values to an array which we declare\n #before the while loop\n i = i + 1\n end\n #Third, we want the final to be true or false for each element in\n #our block_return_values as that is what all? returns\n if block_return_values.include?(false)\n false\n else\n true\n end\nend", "def my_all?(collection)\n i = 0\n return_value = []\n while i < collection.length\n return_value << yield(collection[i])\n i += 1\n end\n\n # check to see if the return values from yielding contains a false\n if return_value.include?(false)\n false\n else\n true\n end\n\nend", "def single_cycle_check(array)\n numElementsVisited = 0\n currentIdx = 0\n while numElementsVisited < array.length\n if numElementsVisited > 0 & currentIdx == 0\n return false\n end\n numElementsVisited += 1\n currentIdx = getNextIdx(currentIdx, array)\n end\n return currentIdx == 0\nend", "def sum_to_zero(array)\n array_of_nums = array.map {|i| i.abs}\n duplicates = array_of_nums.select {|i| array_of_nums.count(i) > 1}\n return true if duplicates.uniq.length > 0\n false\nend", "def proctition(arr, &prc)\n true_arr = []\n false_arr = []\n\n arr.each do |ele|\n if prc.call(ele)\n true_arr << ele\n else\n false_arr << ele\n end\n end\n true_arr.concat(false_arr)\nend", "def valid_array(input_array)\n test = input_array.detect do |digit|\n (digit != 1) and (digit != 0) and (digit != \"1\") and (digit != \"0\") and (digit != true) and (digit != false)\n end\n !test\nend", "def my_all?(collection)\n i = 0 \n block_return_values = []\n while i < collection.length\n \n # declare our array & yield each element in the collection\n \n block_return_values << yield(collection[i])\n i = i + 1 \n end\n \n # add an ' #include? ' method to determine the return value of the my_all? method.\n \n if block_return_values.include?(false)\n false \n else \n true \n end\nend", "def no_consecutive_repeats?(arr)\n return true if arr.length == 1\n arr.inject do |acc, el| \n if acc == el\n return false\n else\n el \n end \n end\n true\nend", "def proctition(arr, &prc)\n true_arr = []\n false_arr = []\n\n arr.each do |ele|\n if prc.call(ele)\n true_arr << ele\n else\n false_arr << ele\n end\n end\n\n true_arr + false_arr\nend", "def my_all?(collection)\n i = 0\n block_return_values = []\n #the array will store multiple data values\n while i < collection.length\n block_return_values << yield(collection[i])\n #When this code is run and it hits the yield line,\n #it is going to send whatever is passed in as the argument to the block.\n\n #shovel the return value of the block into the array\n i = i + 1\n end\n\n #Now have access to an array of return values block_return_values.\n #We have to determine whether the array contains any false elements.\n if block_return_values.include?(false)\n false\n else\n true\n end\nend", "def every?(arr, &prc)\n\n arr.each do |ele|\n return false if !(prc.call(ele))\n end\n\n true\nend", "def all_else_equal(arr)\n sum_num = 0\n\n arr.each do |num|\n sum_num = num\n if sum_num == sum_elements_except_me(arr, num)\n return sum_num\n end\n end\n\n return false\n\nend", "def is_magic_three(array)\n # Your code goes here\n if array == [0]\n true\n else\n sumas = array.combination(3).to_a.collect { |item| item.inject(0, :+) }\n\n puts sumas\n check = sumas.collect { |item| true if item == 0 }\n puts check\n check.include? true\n end\nend", "def my_all?(collection)\n #our counter\n i = 0\n block_return_values = [ ]\n while i < collection.length\n block_return_values << yield(collection[i])\n # yield(collection[i]) go throughe each element in the index.\n i = i + 1\n #i += 1 does the same thing. Use this if it's easier for you.\n\n end\n\n if block_return_values.include?(false)\n false\n else\n true\n end\nend", "def array_42(array)\n a = false\n\tarray.each {|i| if i == 42 then a = true end}\n return a \nend", "def my_all?(arr, &prc)\n arr.each do |ele|\n return false if !prc.call(ele)\n end\n true\nend", "def f_all\n C.curry.(\n ->(f, xs) {\n !any.(->(x) { x == false }, map.(f, xs))\n }\n )\n end", "def got_three? (array)\n arr=[]\n(1..array.length-2).each{|x| arr.push(true) if array[x-1]== array[x] && array[x+1]== array[x] }\narr.include?(true)\nend", "def every?(arr, &blck)\n # arr.all? { |el| blck.call(el) }\n arr.each do |el|\n if !blck.call(el)\n return false\n end\n end\n return true\nend", "def _reduce_36(val, _values, result)\n result = logical_op :and, val[0], val[2]\n \n result\nend", "def _reduce_36(val, _values, result)\n result = logical_op :and, val[0], val[2]\n \n result\nend", "def any?(array)\n return false if array.empty?\n result = nil\n\n array.each do |element|\n result = yield(element)\n return result if result == true\n end\n\n result\nend", "def every?(arr, &prc)\n count = 0\n arr.each do |ele| \n if prc.call(ele)\n count += 1\n end\n end\n count == arr.length\nend", "def my_all?( proc_argument = nil )\n result = []\n\n my_each do |element|\n if block_given? \n result << element if yield(element)\n else\n result << element if proc_argument.call(element)\n end\n end\n\n # If the new array has the same number of true elements as the original array, we know that all elements satisfied the condition\n self.size == result.size ? true : false\n end", "def all_else_equal(arr)\n\n sum = 0\n arr.each do |n|\n sum += n \n end \n return sum\n\nend", "def faster_cont_sum(arr)\n # debugger\n sum = arr[0]\n bool = true\n run_tot = arr[0]\n arr[1..-1].each do |e|\n if bool == false && e > sum\n sum = e\n bool = true\n run_tot = e\n elsif bool == true && e + sum > sum\n sum += e\n run_tot += e\n elsif bool == true && e > sum\n sum = e\n else \n bool = false\n run_tot += e\n end \n end \n sum >= run_tot ? sum : run_tot\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def yes_mutate(arr)\n arr.uniq!\nend", "def all_else_equal(arr)\n\nend", "def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def all_odd?(array)\n\t\n\tif array.all? {|i| i % 2 != 0} \n\t puts \"true\"\n else\n \tputs \"false\"\n end\nend", "def got_three? array\n three = false\n array.each_cons(3) do |a, b, c|\n three = true if (a == b && a == c)\n end\n three\nend", "def make_sum?(num, game_array) \n\tarray_of_sums = []\n\n\tgame_array.each do |i|\n\t\tarray_of_sums << i + num\n\tend\n\tif (array_of_sums & game_array).length > 0\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_41(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def no_consecutive_repeats?(array)\n (0...array.length-1).each do |idx|\n return false if array[idx] == array[idx+1]\n end\n\n true\nend", "def Superincreasing(arr)\n total = 0\n arr.each do |i|\n if i <= total\n return false\n end\n total += i\n end\n\n true\nend", "def truthTest\r\n truth = [true, false]\r\n truth.each do |t|\r\n if (t)\r\n return true\r\n end\r\n end\r\n return false\r\nend", "def random_boolean_array(elements)\r\n remaining = elements\r\n arr = []\r\n while remaining > 0\r\n arr.push random_boolean\r\n remaining -= 1\r\n end\r\n return arr\r\n end", "def long_planeteer_calls( array )\n array.map do |call|\n if call.size > 4\n return true\n else\n return false\n end\n end\nend", "def my_all?(collection)\n i = 0\n block_return_values = []\n while i < collection.length\n block_return_values << yield(collection[i]) #or .push, in this case shove is being used.\n i = i + 1 #i += does the same thing. Use this if it's easier for you.\n end\n\n if block_return_values.include?(false)\n false\n else\n true\n end\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def got_three?(array)\n\noutcome =false\ni = 0\n\tuntil i == array.length\n\t\toutcome = true if array[i] == array[i + 1] && array[i + 1] == array[i + 2]\n\t\ti += 1\n\tend\n\treturn outcome\nend", "def no_consecutive_repeats?(array)\n (0...array.length - 1).each {|index| return false if array[index] == array[index + 1] }\n true\nend", "def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_47(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_49(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def remove_nils_and_false_from_array(array)\n array.select {|i| i != nil && i != false }\nend", "def no_consecutive_repeats?(array)\n (0...array.length - 1).each do |i|\n return false if array[i] == array[i+1]\n end\n true\nend", "def solution(array)\n result = Array.new(array.length, 0)\n\n array.each do |element|\n if result[element - 1]\n result[element - 1] += 1\n else\n result[element - 1] = 1\n end\n end\n\n result.uniq.size == 1 ? 1 : 0\nend", "def _reduce_51(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_51(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_51(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def nondupes(array)\n array.map do |elem| \n array.count(elem) == 1\n \n end\n \nend", "def _reduce_34(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def _reduce_46(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n\n result\nend", "def my_all?(&block)\n counter = 0\n my_each do |elem|\n counter += 1 if block.call(elem) == true\n end\n return true if counter == size\n\n false\n end", "def preconditions arr\n arr.each {|i|\n if (i.is_bool? && i==false) || (i.is_a?(Proc) && (i.call==false))\n return false\n end\n }\n return true\nend", "def my_all?\n\t\t#if any element is false return false\n\t\tmy_each do | element |\n\t\t\tif yield( element )\n\t\t\t\tnext\n\t\t\telse\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\t# returns true when all iterations pass\n\t\treturn true\n\n\tend", "def one?(arr)\n counter = 0\n arr.each do |el|\n counter += 1 if yield(el) == true\n return false if counter > 1\n end\n counter == 1\nend", "def remove_nils_and_false_from_array(array)\n\tn = ['a', 'b', nil, nil, false, 'c', nil]\n\tn.keep_if { |letter| letter != nil && letter != false }\nend", "def array_addition(arr)\n max = arr.max\n arr.delete(max)\n (2..arr.length).each do |i|\n combinations = arr.combination(i)\n combinations.each do |comb|\n if comb.inject(:+) == max\n return true\n break\n end\n end\n end\n return false\nend", "def any?(array)\n array.each do |element|\n return true if yield(element)\n end\n \n false\nend", "def magic?(arr)\n n = arr.size / 2\n (0...n).map { |i| (arr[i] + arr[i + 1 < n ? i + 1 : 0] + arr[n + i]) }.reduce { |s, memo| s == memo ? memo : false }\nend", "def countSheeps array\n count = 0\n array.each do |x|\n x == true ? count += 1 : next\n end\n count\nend", "def remove_nils_and_false_from_array(array)\n array.reject{|element|!element}\nend", "def two_sum(array, target)\n arr_a = array.pop()\n var = false \n array.each { |x| \n return true if arr_a + x == target\n }\n return false \nend", "def all_else_equal(arr)\n sum = 0\n arr.each do |num|\n sum += num\n end\n\n sum_div_2 = sum / 2\n\n arr.each do |x|\n if x == sum_div_2\n return x\n end\n end\n return false\n\nend", "def no_consecutive_repeats?(arr)\n (0...arr.length-1).each do |idx|\n # if arr[idx] == arr[idx + 1]\n # return false\n # end\n return false if arr[idx] == arr[idx + 1]\n end\n\n true\nend", "def check_array_for_sum(arr, goal)\n arr.product(arr).reject{|pair| pair.first == pair.last}.map{ |pair| pair.reduce(0, :+)}.include?(goal)\nend", "def _reduce_58(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def two_sum_zero(array)\n \n i = 0\n while i < array.length - 1\n \n j = i + 1\n while j < array.length\n if array[i] + array[j] == 0\n return true\n end\n \n j += 1\n end\n \n i += 1\n end\n return false\nend", "def zero_sum?(array)\n (0...array.length).each do |index1|\n (index1 + 1...array.length).each do |index2|\n return true if array[index1] + array[index2] == 0\n end\n end\n false\nend", "def no_consecutive_repeats?(arr)\n i = 0\n return true if arr.length == 1\n\n while i < arr.length - 1\n return false if arr[i] == arr[i + 1]\n i += 1\n end\n true\nend" ]
[ "0.89380896", "0.8789797", "0.8729243", "0.8697152", "0.8646781", "0.8555913", "0.85452944", "0.8528212", "0.8238819", "0.8236844", "0.79818934", "0.7497042", "0.7421525", "0.6779499", "0.66319364", "0.6573199", "0.6474536", "0.6460325", "0.6430437", "0.62981606", "0.62504196", "0.62073135", "0.6193154", "0.6190222", "0.618493", "0.6175824", "0.6160043", "0.6152333", "0.61521506", "0.60974926", "0.6095774", "0.60847336", "0.60784864", "0.6041957", "0.60242146", "0.6003982", "0.6001987", "0.5997432", "0.5997432", "0.5995061", "0.59812677", "0.5976782", "0.5910701", "0.59103906", "0.59096223", "0.59096223", "0.59096223", "0.59061563", "0.5888145", "0.5888145", "0.5885898", "0.5861078", "0.58606464", "0.58449066", "0.58449066", "0.58449066", "0.58449066", "0.583731", "0.583693", "0.5831323", "0.58289826", "0.5826178", "0.58253413", "0.58225715", "0.5818264", "0.5818264", "0.5818264", "0.5817553", "0.58102506", "0.57997364", "0.57948774", "0.57948774", "0.5791168", "0.57879126", "0.57872194", "0.5783959", "0.57738596", "0.57738596", "0.57738596", "0.5771141", "0.5764172", "0.5763105", "0.5761425", "0.575977", "0.57521933", "0.57462937", "0.57393366", "0.57278025", "0.57276875", "0.57248706", "0.5716477", "0.571022", "0.570319", "0.5696984", "0.569697", "0.5688157", "0.56830126", "0.56804305", "0.56794107", "0.56757194" ]
0.93043333
0
Returns options for ActionController::ConditionalGetstale?
def to_h { etag: etag, last_modified: nil }.tap do |h| unless last_modified_opt.nil? h[:last_modified] = StaleOptions.time?(last_modified_opt) ? last_modified_opt : last_modified h[:last_modified] = h[:last_modified]&.utc end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_conditional_get(true_or_false)\n use_etag(true_or_false)\n use_last_modified(true_or_false)\n end", "def use_conditional_get(true_or_false)\n use_etag(true_or_false)\n use_last_modified(true_or_false)\n end", "def options ; @options ||= get(:options) end", "def find_options_for_open_rewarded(options={})\n {:conditions => [\"kases.status IN (?) AND kases.price_cents > 0 AND kases.template != ?\", [\"open\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def get options\n rest_request({ method: :get }.merge(options))\n end", "def get options\n rest_request({ method: :get }.merge(options))\n end", "def get_options; end", "def enable_get\n add option: \"-get=true\"\n end", "def options\n self.class.options(url)\n end", "def _whitestone_options()\n { :filter => @options.filter, :full_backtrace => @options.full_backtrace }\n end", "def query_options; end", "def http_options; end", "def maintenance_options\n data[:maintenance_options]\n end", "def find_options_for_recent(options={})\n {:conditions => [\"kases.status NOT IN (?)\", [\"created\", \"suspended\", \"deleted\", \"closed\", \"resolved\"]],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def find_options_for_open(options={})\n {:conditions => [\"kases.status IN (?) AND kases.template != ?\", [\"open\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def get_options\n @options\n end", "def options\n self[:options] || {}\n end", "def legacy_options\n {\n :conditions => options[:where],\n :include => options[:includes],\n :limit => options[:limit],\n :order => options[:order],\n :offset => options[:offset],\n :select => options[:select],\n :group => options[:group],\n }.delete_blanks\n end", "def blog_options\n blog_controller.options\n end", "def url_options\n {}\n end", "def request_options(opts = {})\n opts\n end", "def find_options_for_alive(options={})\n {:conditions => [\"kases.status NOT IN (?) AND kases.template != ?\", [\"suspended\", \"deleted\", \"closed\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def find_options_for_visible(options={})\n {:conditions => [\"reputations.status IN (?)\", ['active', 'cashed']]}.merge_finder_options(options)\n end", "def get_full_options\n options_hash = self.get_runtime_options\n [:task_list, :version, :_exponential_retry, :prefix_name, :return_on_start, :manual_completion, :data_converter].each do |attribute|\n options_hash.merge!(attribute => self.send(attribute)) if self.send(attribute)\n end\n options_hash\n end", "def options\n\t\treturn {\n\t\t\tdomain: self.domain,\n\t\t\tpath: self.path,\n\t\t\tsecure: self.secure?,\n\t\t\thttponly: self.httponly?,\n\t\t\texpires: self.expires,\n\t\t\tmax_age: self.max_age,\n\t\t\tversion: self.version,\n\t\t}\n\tend", "def query_options\n @query_options\n end", "def options\n @object.try(:options) || DEFAULT_OPTIONS\n end", "def options\n return @options\n end", "def url_options; end", "def fresh(options)\n conditional_get = ConditionalGet.new(@_env, options)\n\n headers.merge!(conditional_get.headers)\n\n conditional_get.fresh? do\n halt 304\n end\n end", "def options\n validate_or_get_results :options\n end", "def options\n self[:options] || {}\n end", "def options \n self.merge!(@config.opts)\n end", "def rufus_options\n opts = {}\n [:first_at, :last_at, :number_of_times].each do |opt|\n opts[opt] = self.send(opt) if self.send(opt).present?\n end\n\n # rufus gives an error if first_at is in the past, so drop it\n opts.delete(:first_at) if opts[:first_at].present? ? Rufus::Scheduler.parse(opts[:first_at]) < Time.now : false \n\n # set a skip flag if last_at is in the past\n if opts[:last_at].present?\n opts[:_skip] = true if Rufus::Scheduler.parse(opts[:last_at]) < Time.now\n end\n\n opts\n end", "def options\n @scope.options\n end", "def options\n\t\t# we don't support sending a payload in options' body.\n\t\treq = Net::HTTP::Options.new(@uri.path)\n\t\tdo_http req\n\tend", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def get_options\n {\n :cssOptimize => cssOptimize,\n :optimize=> optimize,\n :cssImportIgnore=>cssImportIgnore,\n :internStrings=>internStrings\n }\n end", "def common_options(opts); end", "def options\n @options\n end", "def options\n @options\n end", "def options\n @options ||= {}\n @options\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def reload\n current_options = executed_requests['GET']['options'] rescue {}\n stale!\n self.load(current_options.merge(:reload => true))\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n Http::Options.new(self, @options).invoke\n end", "def options\n @options || {}\n end", "def opts_for_cache_proxy\n combined_options.reject { |k,v| !OPTIONS_FOR_CACHE_PROXY.include?(k) }\n end", "def query_opts!(q_opts = nil)\n return self if q_opts.nil?\n [:snapshot, :max_scan, :show_disk_loc].each do |k|\n q_opts[k].nil? ? @opts.delete(k) : @opts.merge!(k => q_opts[k])\n end\n self\n end", "def try_options\n\t\t\treturn unless request.http_method == :OPTIONS\n\n\t\t\tallow = available_endpoint&.allow\n\t\t\thalt 404 unless allow\n\t\t\tresponse.headers['Allow'] = allow\n\t\tend", "def find_options_for_active(options={})\n {:conditions => [\"kases.status NOT IN (?)\", [\"created\", \"suspended\", \"deleted\", \"closed\", \"resolved\"]],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def options\n # figure out our options for this request\n add_ssl_options(\n # for GETs, we pass the params to Faraday to encode\n {params: get_args}.merge(HTTPService.http_options).merge(raw_options)\n )\n end", "def options\n @options ||= Launchr::OrderedHash.new\n @options\n end", "def combined_options(options)\n resp = @options\n resp[:query].merge! options\n resp\n end", "def options\n return @options\n end", "def options\n @criteria_hash.options\n end", "def gather_options\n @_options\n end", "def options\n @options\n end", "def options\n @options\n end", "def options\n self.class.instance_variable_get(:@__options) || []\n end", "def options\n @options\n end", "def options\n return @data.options\n end", "def query_options\n # todo: support more options?\n options = {}\n options.merge!({:limit => limit_value.to_json}) if limit_value\n options.merge!({:skip => @options[:skip].to_json}) if @options[:skip]\n options.merge!({:reversed => reversed?.to_json}) if reversed?\n options.merge!({:order => @options[:order]}) if @options[:order]\n options.merge!({:cursor => @options[:cursor]}) if @options[:cursor]\n options\n end", "def default_request_options\n {:timeout => 0, :head => {}}\n end", "def find_options_for_visible(options={})\n {:conditions => [\"kases.status NOT IN (?) AND kases.template != ?\", [\"created\", \"suspended\", \"deleted\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end", "def options\n @options ||= self.class.options\n end", "def options\n Properties[self.class] ||= {}\n return Properties[self.class][:opts] || []\n end", "def get(options = {})\n end", "def find_options_for_visible(options={})\n {:conditions => [\"responses.status NOT IN (?)\", [\"created\", \"suspended\", \"deleted\"]],\n :order => \"responses.updated_at DESC\"}.merge_finder_options(options)\n end", "def options\n config.options\n end", "def get_all\n return @options.clone\nend", "def get_full_options\n result = {}\n usable_properties = self.class.held_properties\n usable_properties.delete(:from_class)\n usable_properties.each do |option|\n result[option] = self.send(option) if self.send(option) && self.send(option) != \"\"\n end\n result\n end", "def options\n @_options ||= {}\n end", "def options\n @options\n end", "def crawl options\n\n OutriderTools::Crawl::site( @config, ->(page, uri){\n unless( page.css('.story_landing').text.strip.empty? )\n #p page.css('.story_landing .story__dateline span').empty?\n unless page.css('.story_landing .story__dateline span').empty?\n clean_date = DateTime.strptime( page.css('.story_landing .story__dateline span')[0][\"content\"], '%a %b %d %H:%M:%S %Z %Y').to_s \n else\n return { :status => 'rejected' }\n end\n \n return {\n :url => uri.to_s,\n :title_raw => page.css('.story_content_top h1').text.strip,\n :author => page.css('.story__byline span[itemprop=\"name\"]').text.strip,\n :content_raw => page.css('.story_landing > p').map{ |paragraph| paragraph.text.strip }.to_json,\n :date_published_raw => page.css('.story_landing .story__dateline span')[0][\"content\"],\n :date_published_timestamp => clean_date,\n :status => 'scraped'\n }\n else\n return { :status => 'rejected' }\n end\n })\n \n end", "def options\n @options.dup.freeze\n end", "def find_options options={}\r\n con = conditions\r\n par = parameters\r\n inc = includes\r\n cond_ary = nil\r\n if conditions\r\n cond_ary=[con]\r\n cond_ary += par if par\r\n end\r\n options[:conditions] = cond_ary if cond_ary\r\n options[:include] = includes if includes\r\n options \r\n end", "def request_options\n {\n open_timeout:,\n timeout: read_timeout\n }\n end", "def options\n unless params[:cancel] == \"true\"\n @per_page = @current_user.pref[:customfields_per_page] || Customfield.per_page\n @outline = @current_user.pref[:customfields_outline] || Customfield.outline\n @sort_by = @current_user.pref[:customfields_sort_by] || Customfield.sort_by\n @sort_by = Customfield::SORT_BY.invert[@sort_by]\n end\n end", "def options\n @options ||= self.class.inversion_options(node, new_resource)\n end", "def options\n data[:options]\n end", "def options\n @options ||= Options.new\n end", "def options\n @options ||= Options.new\n end", "def options(url); end", "def find_options_for_visible(options={})\n {:conditions => [\"comments.status NOT IN (?)\", [\"created\", \"suspended\", \"deleted\"]],\n :order => \"comments.updated_at DESC\"}.merge_finder_options(options)\n end", "def cache_opt(env)\n options ||= {}\n url = request_url(env)\n expiry =\n case url\n when %r{/authservice/rest/uidauth} then 30.minutes # NOTE: 0% coverage for this case\n when %r{/edsapi/rest/Info} then 24.hours\n when %r{/edsapi/rest/Search\\?} then 30.minutes\n when %r{/edsapi/rest/Retrieve\\?} then 30.minutes\n end\n unless expiry == @expires_in\n log(\"expires in #{expiry} for #{url}\")\n options = options.merge(expires_in: expiry)\n end\n options\n end", "def options\n self.class.options\n end", "def options\n @options ||= { include: %i[reviews] } \n end", "def homepage_options\n homepage_report_options + homepage_book_options\n end", "def options; @opts end", "def wgetOpts(node, refresh)\n u = node['daris']['download_user']\n p = node['daris']['download_password']\n opts = \"--user=#{u} --password=#{p} \" +\n \"--no-check-certificate --secure-protocol=SSLv3\"\n if refresh then\n opts += \" -N\"\n end\n return opts\n end", "def options\n if @store and @store.rdoc then\n @store.rdoc.options\n else\n RDoc::Options.new\n end\n end", "def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end", "def get_json_opts\n @json_opts\n end", "def faraday_options\n cfg_get(:faraday_options)\n end", "def get_options_with_http_info(symbol, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OptionsApi.get_options ...\"\n end\n # verify the required parameter 'symbol' is set\n if @api_client.config.client_side_validation && symbol.nil?\n fail ArgumentError, \"Missing the required parameter 'symbol' when calling OptionsApi.get_options\"\n end\n if @api_client.config.client_side_validation && opts[:'type'] && !['call', 'put'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of call, put'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 10000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling OptionsApi.get_options, must be smaller than or equal to 10000.'\n end\n\n # resource path\n local_var_path = \"/options/{symbol}\".sub('{' + 'symbol' + '}', symbol.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'type'] = opts[:'type'] if !opts[:'type'].nil?\n query_params[:'strike'] = opts[:'strike'] if !opts[:'strike'].nil?\n query_params[:'strike_greater_than'] = opts[:'strike_greater_than'] if !opts[:'strike_greater_than'].nil?\n query_params[:'strike_less_than'] = opts[:'strike_less_than'] if !opts[:'strike_less_than'].nil?\n query_params[:'expiration'] = opts[:'expiration'] if !opts[:'expiration'].nil?\n query_params[:'expiration_after'] = opts[:'expiration_after'] if !opts[:'expiration_after'].nil?\n query_params[:'expiration_before'] = opts[:'expiration_before'] if !opts[:'expiration_before'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'next_page'] = opts[:'next_page'] if !opts[:'next_page'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['ApiKeyAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ApiResponseOptions')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OptionsApi#get_options\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.6222175", "0.6222175", "0.6169611", "0.6101613", "0.6051409", "0.6051409", "0.58947855", "0.5884164", "0.5840682", "0.58124405", "0.5787676", "0.5730864", "0.5695988", "0.56161046", "0.5603937", "0.560068", "0.5580195", "0.556225", "0.5555547", "0.5553147", "0.55486786", "0.55478793", "0.55466646", "0.5536999", "0.5536518", "0.5528328", "0.5524793", "0.5524148", "0.5522781", "0.5521481", "0.5518851", "0.5513815", "0.5466753", "0.54463995", "0.54409873", "0.54390854", "0.54380393", "0.54380393", "0.54380393", "0.5415031", "0.54140306", "0.5405125", "0.5405125", "0.5400497", "0.5395626", "0.5395626", "0.5391214", "0.53883743", "0.53883743", "0.53883743", "0.5382756", "0.5378908", "0.53728586", "0.53609496", "0.5342632", "0.5339502", "0.53311396", "0.53250206", "0.53240395", "0.53236395", "0.531669", "0.5309268", "0.53080285", "0.53080285", "0.5296867", "0.52949905", "0.529214", "0.5286788", "0.5285373", "0.52852535", "0.52815497", "0.52752113", "0.52668524", "0.5248991", "0.5240409", "0.5239991", "0.52372557", "0.5233621", "0.523234", "0.5227472", "0.5225677", "0.52218944", "0.5220952", "0.5218982", "0.5218058", "0.52163154", "0.5214781", "0.5214781", "0.51926434", "0.5177568", "0.51715", "0.5171103", "0.51624453", "0.51589936", "0.5156302", "0.51562554", "0.5144403", "0.5141891", "0.5139223", "0.5138175", "0.51360965" ]
0.0
-1
%var:image100x100 lang_id is not used!
def build_image_size_variables(src, lang_id, var_hash) is_admin = var_hash[:admin_view?] == true src.gsub(/%image[\w]*:[\w\-\"_\']+/) { |r| resulted_value = "" image_size_attr = /%image(\w+)/.match(r) image_size = image_size_attr.nil? ? nil : image_size_attr[1].split("x") image_name = /:([\w_\-\"\']+)/.match(r)[1] image_source = Source.where(:type => SourceType::IMAGE, :name => image_name).first image_size_specified = image_size ? true : false image_styles_attr = " style='font-size: 10px' " unless image_source.blank? if image_size image_width_attr = "width='#{image_size[0]}' " image_height_attr = "height='#{image_size[1]}' " image_styles_attr = " style='font-size: 10px; height:#{image_size[1]}px!important' " if is_admin end else # specify height and width for alternative text visibility: image_width_attr = " width='100px' " image_height_attr = " height='30px' " end image_class = " class='changeable-image' " if is_admin image_id = " id='#{image_source.get_id}' " if image_source && is_admin width, height = image_source.get_image_size if image_size if image_size[0] != width.to_s || image_size[1] != height.to_s image_source = nil end end resulted_value = "<img #{image_id} src='#{image_source ? image_source.get_image_path : '#'}' #{image_class.to_s} #{image_width_attr.to_s} #{image_height_attr.to_s} alt='#{image_source ? image_source.name : image_name}#{image_size_attr[1] if image_size_attr}' #{image_styles_attr} data-hardsize='#{image_size_specified}'/>" resulted_value } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_normal_image\n return \"Pictures/pcn%04d.png\" % (80 + id)\n end", "def localized_image_filename (source)\n localized_filename = get_language_filename( source, true )\n language_filename = get_language_filename( source, false )\n if language_image_exists?(localized_filename)\n return localized_filename\n elsif language_image_exists?(language_filename)\n return language_filename\n else\n return source\n end\n end", "def find_home_image\n return \"Pictures/pct%04d.png\" % (80 + id)\n end", "def image_uid\n @dicom_image_uid || @image_uid\n end", "def image; end", "def check_our_images!\n self.gsub!(/!image (\\w+\\/)?(\\d+)!/) do\n size, id = $1, $2\n size ||= 'thumb/'\n '\"!%s/%s%d.jpg!\":%s/image/show_image/%d' %\n [IMAGE_DOMAIN, size, id, HTTP_DOMAIN, id]\n end\n end", "def check_our_images!\n self.gsub!(/!image (\\w+\\/)?(\\d+)!/) do\n size, id = $1, $2\n size ||= 'thumb/'\n '\"!%s/%s%d.jpg!\":%s/image/show_image/%d' %\n [IMAGE_DOMAIN, size, id, HTTP_DOMAIN, id]\n end\n end", "def image\n 0\n end", "def interface_image(filename)\n if interface_exist?(filename_with_language = filename + ($options&.language || 'en')) ||\n interface_exist?(filename_with_language = filename + 'en')\n filename = filename_with_language\n end\n load_image(@interface_cache, filename, Interface_Path, @interface_data, Image)\n end", "def get_localized_image_tag( source, options = {}, submit = true )\n # two options: either the language (es) or locale (pt_BR) may have an image\n localized_filename = get_language_filename( source, true )\n language_filename = get_language_filename( source, false )\n\n # try locale override first, then use the default for language\n chosen_string = \"\"\n if language_image_exists?(localized_filename)\n chosen_string = localized_filename\n elsif language_image_exists?(language_filename)\n chosen_string = language_filename\n else\n return chosen_string\n end\n if submit\n return image_submit_tag( chosen_string, options)\n else\n return image_tag( chosen_string, options)\n end\n end", "def images; end", "def image_asset_id\n item_code_name_cd&.delete('IMG_').to_i\n end", "def get_image(id)\n val = @var_table[id]\n raise \"not an image\" if val.nil?\n val\n end", "def server_image_id(s)\n s.respond_to?('image_id') ? s.image_id : 'no_image'\n end", "def image_error_num( max ); \"每則日誌最多可貼 #{max} 張圖片\"; end", "def image(link, title, alt_text)\n if link =~ /^(.+?)\\s*=+(\\d+)(?:px|)$/\n # ![alt](url.png =100px)\n # ![alt](url.png =100)\n %(<img src=\"#{$1}\" style=\"width: #{$2}\" alt=\"#{alt_text}\">)\n elsif link =~ /^(.+?)\\s*=+(\\d+)(?:px|)x(\\d+)(?:px|)$/\n # ![alt](url.png =30x50)\n %(<img src=\"#{$1}\" style=\"width: #{$2}; height: #{$3};\" alt=\"#{alt_text}\">)\n else\n %(<img src=\"#{link}\" title=\"#{title}\" alt=\"#{alt_text}\">)\n end\n end", "def diswimage(image_text)\n image_options = image_text.gsub(/#/, '').gsub(/diswimage:/, '').split(':')\n image_title = image_options[0]\n image_extension = image_options[1]\n option_count = image_options[2]\n image_width = image_options[3]\n return \"!{width: #{image_width}px}http://doitidiot.s3.amazonaws.com/#{image_title}-#{rand(option_count)+1}.#{image_extension}!\"\n end", "def image(hash={})\n\t\tif hash['id'] =~ /nsys|Hand|Arm|Leg|Eye|back|abdomen|chest|head|neck/o\n\t\t\tStatus.sf_update(hash['id'], hash['name'])\n\t\tend\n\tend", "def display_alternative_text_image(image)\n # Interface method\n end", "def show_image_number\n @druid=params[:id]\n @image_number=params[:image_number].to_i\n @document = SolrDocument.find(@druid)\n render :partial=>'annotate_image', :locals=>{:image_number=>@image_number}\n end", "def embed_image(src, label)\n id = \"img_#{@img_id}\"\n @img_id += 1\n if @io.respond_to?(:path) and File.file?(src)\n out_dir = Pathname.new(File.dirname(File.absolute_path(@io.path)))\n src = Pathname.new(File.absolute_path(src)).relative_path_from(out_dir)\n end\n # removing home dir\n src = URI::encode(src.gsub(\"#{Dir.home}\", ''))\n @builder.span(:class => 'embed') do |pre|\n pre << %{<a href=\"\" onclick=\"img=document.getElementById('#{id}'); img.style.display = (img.style.display == 'none' ? 'block' : 'none');return false\">#{label}</a><br>&nbsp;\n <img id=\"#{id}\" style=\"display: none\" src=\"#{src}\"/>}\n end\n end", "def image_gel gel, image_name\n show do\n title \"Image gel #{gel}\"\n check \"Clean the transilluminator with ethanol.\"\n check \"Put the gel #{gel} on the transilluminator.\"\n check \"Turn off the room lights before turning on the transilluminator.\"\n check \"Put the camera hood on, turn on the transilluminator and take a picture using the camera control interface on computer.\"\n check \"Check to see if the picture matches the gel before uploading.\"\n check \"Rename the picture you just took exactly as <b>#{image_name}</b>.\"\n end\n end", "def img_params\n\n end", "def image_name\n path = \"sets/#{set}/#{dimension}_#{polarity}_#{verbal}\"\n # Rails.application.assets.find_asset(path).nil? ? 'placeholder' : path\n path\n end", "def image_hash; end", "def convert_image(catalog_vapp_template, account_name)\n name = catalog_vapp_template['name']\n #much fudging ensues\n #arch = name.scan(/(36|24).bit/).first\n #k enuf o'that now!\n arch = \"n/a\" #Leaving out entirely as we don't get one from terremark (could parse but its a fudge)\n Image.new( {\n :id => catalog_vapp_template['href'].split('/').last,\n :name => catalog_vapp_template['name'],\n :architecture => arch,\n :owner_id => account_name,\n :description => catalog_vapp_template['name']\n })\n end", "def default_image\n end", "def to_tex\n q_url = \"http://dream.misasa.okayama-u.ac.jp/?q=\"\n basename = File.basename(image.name,\".*\")\n lines = []\n lines << \"\\\\begin{overpic}[width=0.49\\\\textwidth]{#{basename}}\"\n lines << \"\\\\put(1,74){\\\\colorbox{white}{(\\\\sublabel{#{basename}}) \\\\href{#{q_url}#{image.global_id}}{#{basename}}}}\"\n lines << \"%%(\\\\subref{#{basename}}) \\\\nolinkurl{#{basename}}\"\n lines << \"\\\\color{red}\"\n\n surface.surface_images.each do |osurface_image|\n oimage = osurface_image.image\n #image_region\n opixels = oimage.spots.map{|spot| [spot.spot_x, spot.spot_y]}\n worlds = oimage.pixel_pairs_on_world(opixels)\n pixels = image.world_pairs_on_pixel(worlds)\n oimage.spots.each_with_index do |spot, idx|\n length = image.length\n height = image.height\n x = \"%.1f\" % (pixels[idx][0] / length * 100)\n y = \"%.1f\" % (height.to_f / length * 100 - pixels[idx][1] / length * 100)\n line = \"\\\\put(#{x},#{y})\"\n line += \"{\\\\footnotesize \\\\circle{0.7} \\\\href{#{q_url}#{spot.target_uid}}{#{spot.name}}}\"\n line += \" % #{spot.target_uid}\" if spot.target_uid\n line += \" % \\\\vs(#{(\"%.1f\" % worlds[idx][0])}, #{(\"%.1f\" % worlds[idx][1])})\"\n lines << line\n end\n end\n\n width_on_stage = image.transform_length(image.width / image.length * 100)\n scale_length_on_stage = 10 ** (Math::log10(width_on_stage).round - 1)\n scale_length_on_image = image.transform_length(scale_length_on_stage, :world2xy).round\n lines << \"%%scale #{(\"%.0f\" % scale_length_on_stage)}\\ micro meter\"\n lines << \"\\\\put(1,1){\\\\line(1,0){#{(\"%.1f\" % scale_length_on_image)}}}\"\n\n lines << \"\\\\end{overpic}\"\n\n lines.join(\"\\n\")\n end", "def image_id(val=nil)\n from_setting_or_image_info :image_id, val\n end", "def language_image_exists?( filename )\n return ((!filename.blank?) and FileTest.exists?(\"#{RAILS_ROOT}/public/#{filename}\"))\n end", "def image(link, title, alt_text)\n if link =~ /^(.+?)\\s*=+(\\d+)(?:px|)$/\n # ![alt](url.png =100px)\n # ![alt](url.png =100)\n %(<img src=\"#{$1}\" style=\"max-width: #{$2}px;\" alt=\"#{alt_text}\">)\n elsif link =~ /^(.+?)\\s*=+(\\d+)(?:px|)x(\\d+)(?:px|)$/\n # ![alt](url.png =30x50)\n %(<img src=\"#{$1}\" style=\"max-width: #{$2}px; max-height: #{$3}px;\" alt=\"#{alt_text}\">)\n elsif link =~ /^(.+?)\\s*=+(\\d+)%$/\n # ![alt](url.png =50%)\n %(<img src=\"#{$1}\" style=\"max-width: #{$2}%;\" alt=\"#{alt_text}\">)\n elsif link =~ /^(.+?)\\s*=+(\\d+)%x(\\d+)%$/\n # ![alt](url.png =50%x50%)\n %(<img src=\"#{$1}\" style=\"max-width: #{$2}%; max-height: #{$3}%;\" alt=\"#{alt_text}\">)\n else\n %(<img src=\"#{link}\" title=\"#{title}\" alt=\"#{alt_text}\">)\n end\n end", "def image _args\n \"image _args;\" \n end", "def image_for(document)\n master_file_id = document[\"section_id_ssim\"].try :first\n\n video_count = document[\"avalon_resource_type_ssim\"].count{|m| m.start_with?('moving image'.titleize) } rescue 0\n audio_count = document[\"avalon_resource_type_ssim\"].count{|m| m.start_with?('sound recording'.titleize) } rescue 0\n\n if master_file_id\n if video_count > 0\n thumbnail_master_file_path(master_file_id)\n elsif audio_count > 0\n asset_path('audio_icon.png')\n else\n nil\n end\n else\n if video_count > 0 && audio_count > 0\n asset_path('hybrid_icon.png')\n elsif video_count > audio_count\n asset_path('video_icon.png')\n elsif audio_count > video_count\n asset_path('audio_icon.png')\n else\n nil\n end\n end\n end", "def image(key, image_path)\n # Idea from here http://itext.ugent.be/library/question.php?id=31 \n # Thanks Bruno for letting me know about it.\n img = @image_class.getInstance(image_path)\n img_field = @form.getFieldPositions(key.to_s)\n\n \n rect = @rectangle.new(img_field[1], img_field[2], img_field[3], img_field[4])\n img.scaleToFit(rect.width, rect.height)\n img.setAbsolutePosition(\n img_field[1] + (rect.width - img.getScaledWidth) / 2,\n img_field[2] + (rect.height - img.getScaledHeight) /2\n )\n\n cb = @stamp.getOverContent(img_field[0].to_i)\n cb.addImage(img)\n end", "def icone_plmtype(plmtype)\n\t\tret = \"/images/#{plmtype}.png\"\n\t\tunless File.exist?(\"#{config.root}/public#{ret}\")\n\t\t\tret = \"\"\n\t\tend\n\t\tret\n\tend", "def casein_config_logo\n \t'/images/logo_ss.jpg'\n end", "def currentEdition\n img :src => $imgHostURL + \"/\" + $currentImg\n end", "def validate_images_alt_present\n errors.add('body', I18n.t('drgcms.img_alt_not_present')) unless DcPage.images_alt_present?(self.body)\nend", "def img_file\n return \"map_\" + symbol.to_s + \"_full\"\n end", "def img_name\n \"#{@function}_#{@side.to_s[0,1]}\"\n end", "def page_image_template\n \"#{slug}-p{page}-{size}.gif\"\n end", "def logo=(_arg0); end", "def image(criteria = T.unsafe(nil)); end", "def img!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 21 )\n\n type = IMG\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 348:7: 'img'\n match( \"img\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 21 )\n\n end", "def lnbPicture _obj, _args\n \"_obj lnbPicture _args;\" \n end", "def image_id\n data[:image_id]\n end", "def scanned_image_id\n scanned_eligibility_id\n end", "def interface(filename, _hue = 0)\n if interface_exist?(filename_with_language = filename + ($options&.language || 'en')) ||\n interface_exist?(filename_with_language = filename + 'en')\n filename = filename_with_language\n end\n load_image(@interface_cache, filename, Interface_Path, @interface_data)\n end", "def name\n I18n.t('gallery.image')\n end", "def logo_tag\n image_tag \"rails.png\", :alt => @page_title\n end", "def locale_image_path(locale)\n country = locale.region || LANGUAGES_FOR_COUNTRIES_HASH[locale.iso639]\n\n return nil unless country\n return nil unless Rails.root.join('app', 'assets', 'images', 'country-flags', country.downcase + '.png')\n\n image_path \"country-flags/#{country.downcase}.png\"\n end", "def img(*) # :nodoc:\n raise \"no!\"\n end", "def display_all_alternative_text_images\n # Interface method\n end", "def update_image_source(img)\n @content.gsub!(img, \"/images/\" << img.gsub(@base.gsub(\"weblog\",\"\"), \"\").gsub(\".a/\", \"\") << \".jpg\")\n end", "def tip_pic(id, key, text)\n string = sprintf('<key_pic: %s, %s>', key, text)\n bitmap_picture(id, string)\n end", "def change_image\n\n response_str = \"NG\"\n url = root_url + \"admin_data/klass/image/\"\n\n news_id = Integer(params[:news_id])\n news = News.find(news_id)\n\n if(news != nil)\n images = Image.find_by_news_id(news_id)\n url += (images.id).to_s\n url += \"/edit\"\n\n response_str = url\n end\n\n respond_to do |format|\n format.html { render :inline => response_str }\n end\n\n\n end", "def image_alt(src)\n File.basename(src, '.*').sub(/-[[:xdigit:]]{32,64}\\z/, '').tr('-_', ' ').capitalize\n end", "def keyImage _args\n \"keyImage _args;\" \n end", "def unique_text_name\n title = all_subjects.map(&:text_name).uniq.sort.join(\" & \")\n if title.blank?\n :image.l + \" ##{id || \"?\"}\"\n else\n title + \" (#{id || \"?\"})\"\n end\n end", "def open_lid_image\n image_path(image_name: params[:open_lid_image])\n end", "def uml(picture_name, contents, width_slide, width_plain)\n new_width = calculate_width(width_slide)\n formats = %w[pdf eps]\n img_path = super(picture_name, contents, width_slide, width_plain, 'pdf')\n image(img_path, formats, '', '', new_width, new_width)\n end", "def image alt_text, href\n \"!\" + link_to(alt_text, href)\n end", "def image url, alt=url\n \"![#{alt}](#{url})\"\n end", "def caption\n image_iptc[\"Caption\"]\n end", "def set_element pic\n controller_name == 'temp_listings' ? get_pixi_image(pic) : get_pixi_image(pic, 'large')\n end", "def image hash = {}\n hash = { :id => hash} if hash.is_a? String\n home hash.update :action => 'image', :trailing_slash => false\n end", "def fix_casting_cost(node)\n node.search('//x:img', 'x' => 'http://www.w3.org/1999/xhtml').each do |img|\n symbol = case img['alt']\n when 'Red' then \"R\"\n when 'Green' then 'G'\n when 'White' then 'W'\n when 'Black' then 'B'\n when 'Blue' then 'U'\n else\n img['alt']\n end\n \n puts self.multiverse_id\n pp img\n \n img.replace \"[#{symbol}]\"\n end\n \n return node\n end", "def cloudinary_imgs_cara(key,instance)\n cl_image_tag(key, :quality=>\"auto\", :fetch_format=>:auto, :crop=>\"fit\", :class=>\"d-block mx-auto img-fluid rounded\", :alt=>\"#{instance.name}\")\n end", "def country_imgcode\n COUNTRIES[@country].img_code\n end", "def set_image\n # @image = Image.find_by(id: params[:id],site_id: @site.id)\n @image = Image.find(params[:id])\n redirect_to admin_errors_url(error_template: '403') unless @image\n end", "def uml(picture_name, contents, width_slide, width_plain)\n new_width = calculate_width(width_plain)\n formats = %w(pdf eps)\n img_path = super(picture_name, contents, width_slide, width_plain, 'pdf')\n image(img_path, formats, '', '', new_width, new_width)\n end", "def default_image_id\n region_name = config[:compute_provider][\"#{config[:compute_provider][:name]}_region\".to_sym]\n region_map = images.fetch('regions', {}).fetch(region_name, {})\n image_id = region_map && region_map[instance.platform.name]\n\n if image_id.nil?\n error(\"Could not determine default image_id in #{region_name} region for platform #{instance.platform.name}\")\n end\n\n image_id\n end", "def setup_plate_layout_image\n image_path(image_name: params[:setup_plate_layout_image])\n end", "def glider_image_swap\n image = PropertyImage.find(params[:image_id])\n render :partial => 'glider_image_swap',\n :layout => false,\n :locals => { :image => image }\n end", "def unique_format_name\n title = all_subjects.map(&:format_name).uniq.sort.join(\" & \")\n if title.blank?\n :image.l + \" ##{id || \"?\"}\"\n else\n title + \" (#{id || \"?\"})\"\n end\n end", "def image\n end", "def image\n end", "def set_img\n\n end", "def display id\n get_image(id).display\n end", "def retrieve_image_id\n name = config['image_name']\n\n img_data = connection.image_list.body[\"DATA\"].find { |i| i[\"LABEL\"] == name }\n if img_data.nil?\n names = connection.image_list.body[\"DATA\"].map { |i| i[\"LABEL\"] }.join(\", \")\n add_error \"There is no image named #{name}. \" \\\n \"Options are: #{names}\"\n else\n id = img_data[\"IMAGEID\"]\n end\n id\n end", "def fix_casting_cost(node)\n node.search('//x:img', 'x' => 'http://www.w3.org/1999/xhtml').each do |img|\n symbol = case img['alt']\n when 'Red' then \"R\"\n when 'Green' then 'G'\n when 'White' then 'W'\n when 'Black' then 'B'\n when 'Blue' then 'U'\n else\n img['alt']\n end\n \n #puts self.multiverse_id\n #pp img\n \n img.replace \"[#{symbol}]\"\n end\n \n return node\n end", "def _parse_image_uri row\n row./('td[2]/a').first[:href] =~ /multiverseid=(\\d+)/\n $1\n end", "def image_uri_from_id= id\n self.image_uri = Image_URI % id\n end", "def image_location\n src || ''\n end", "def url_logo(coin: T.unsafe(nil)); end", "def show\n #@document = Document.find(params[:id])\n #\n # Above line is unnecesary because there is this magic before_action :set_document ... hell yeah\n #\n @documentImages = @document.document_images.load\n case @document.doc_type\n when 'registration_certificate'\n case @document.language\n when 'English'\n @translation = @document.english_registration_certificate\n #appid = CGI.escape(\"Seeker of words in documents\")\n #passss = CGI.escape(\"IGP0S5KYsUi7WpYCiTa8refF\")\n #\n # Here comes the EACH loop over all the images stored in @documentImages objects - probablu mulpile request :: submitImage\n #\n #filename = @document.image.current_path\n #language = \"English\"\n #url = \"http://#{appid}:#{passss}@cloud.ocrsdk.com\"\n @document.translation\n end\n else\n @translation = EnglishRegistrationCertificate.new()\n end\n end", "def get_image\n\n begin\n office_map = OfficeMap.find(params[:id])\n rescue\n office_map = nil\n end\n\n if office_map.nil?\n render(:text => '')\n return\n end\n\n=begin\n# Too much restriction\n if !office_map.group_id.nil? and (office_map.group_id != 0)\n unless User.belongs_to_group?(@login_user, office_map.group_id, true)\n render(:text => 'ERROR:' + t('msg.need_auth_to_access'))\n return\n end\n end\n=end\n response.headers[\"Content-Type\"] = office_map.img_content_type\n response.headers[\"Content-Disposition\"] = \"inline\"\n render(:text => office_map.img_content)\n end", "def id_to_image_path(id)\n return nil if id.blank?\n raise ArgumentError.new(\"Wrong image id : #{id}\") if Frame.images_paths(id).empty?\n image_path = \"webcomic/#{id}\"\n ActionController::Base.helpers.asset_path(image_path)\n end", "def page_variables(image)\n\t\tif page == frames[0] || page == frames[1]\n\t\t\t num = image.date_taken.strftime(\"%d\").to_i/7 \n\t\t\t @beg_week = image.date_taken.beginning_of_month+num.weeks \n\t\t\t @end_week = @beg_week+6.days \n\t\telsif page == frames[2]\n\t\t\t @beg_year = image.date_taken.beginning_of_year \n\t\t\t @end_year = image.date_taken.end_of_year \n\t\t\t beg_month = image.date_taken.beginning_of_month.strftime(\"%Y-%m-%d\") \t \n\t\tend\n\t\tget_dimensions(image.id, page) \n\t\tget_positions(image.id, page) \n\tend", "def software_image\n super\n end", "def edit\n @image = Image.find_by_id_and_site_id(params[:id], @site.id)\n if @image.nil?\n respond_to do |format|\n format.html { redirect_to(index_url, \n :notice => I18n.t(\"not_found\", :scope => TRANSLATION_SCOPE)) }\n format.xml { render :xml => @image.errors, \n :status => :unprocessable_entity }\n end\n return\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image }\n end\n end", "def image(name)\n File.expand_path(\"tex/#{name}\", File.dirname(__FILE__))\nend", "def image(size: T.unsafe(nil), search_terms: T.unsafe(nil), match_all: T.unsafe(nil)); end", "def close_lid_image\n image_path(image_name: params[:close_lid_image])\n end", "def giant_path\n \"g_#{image_path}\"\n end", "def image\n\n end", "def view_image\n \n @image = Productimage.find(params[:id])\n #@page_title = \"Large Image - \" + @image.product.title\n @page_title = \"View Large Image\"\n render(:file => \"#{RAILS_ROOT}/app/views/templates/#{Shop.def_template_name}/frontend/#{action_name}.html.erb\", \n :layout => false)\n rescue\n render :layout=>nil, :inline=>\"ERROR CODE: 8807.\"\n end", "def cntrl_settg; det.image(:id, 'imgCtrlSettings'); end", "def image(local=1)\n unless cururl.index(Internet_path)\n fail \"You can only do this on a Researchr wikipage\"\n end\n wiki = cururl[22..-1]\n w,dummy = wiki.split(\"?\")\n wikipage = w.gsubs({:all_with => \"_\"}, \":\", \"%3A\", \"%20\").downcase\n\n if local==1\n curfile = File.last_added(\"#{Home_path}/Desktop/Screen*.png\") # this might be different between different OSX versions\n else\n dir = File.last_added_dir(Photostream_path) # this might be different between different OSX versions\n curfile = File.last_added(dir+\"*.JPG\")\n end\n if curfile == nil\n growl(\"No screenshots available\")\n exit\n end\n\n newfilename, pagenum = filename_in_series(\"#{Wiki_path}/data/media/pages/#{wikipage}\",\".png\")\n p newfilename\n if File.exists?(newfilename)\n pbcopy(\"\")\n fail(\"File already exists, aborting!\")\n end\n puts %Q(mv \"#{curfile.strip}\" \"#{newfilename}\")\n `mv \"#{curfile.strip}\" \"#{newfilename}\"`\n if defined?(dir) # if from iCloud\n `rm -rf \"#{dir}\"`\n `sips --resampleWidth 487 #{newfilename}`\n end\n `touch \"#{newfilename}\"` # to make sure it comes up as newest next time we run filename_in_series\n\n pbcopy(\"{{pages:#{wikipage}#{pagenum}.png}}\")\nend", "def set_loc_image\n @loc_image = LocImage.find(params[:id])\n end" ]
[ "0.5947765", "0.59059095", "0.5654585", "0.564201", "0.5637659", "0.5630375", "0.5630375", "0.5627135", "0.5600323", "0.5548378", "0.5513843", "0.54922014", "0.5466331", "0.5441538", "0.54127264", "0.54046285", "0.53986764", "0.5385347", "0.5360364", "0.5355604", "0.53525263", "0.5341273", "0.5341265", "0.53368384", "0.53308994", "0.5330717", "0.5330648", "0.5328367", "0.5325569", "0.5318106", "0.53124195", "0.53071374", "0.53063536", "0.53036183", "0.52967507", "0.5292476", "0.52673453", "0.5266024", "0.524232", "0.52418876", "0.52413255", "0.5229387", "0.5228309", "0.52282983", "0.5218454", "0.52056205", "0.52026415", "0.5197388", "0.51896596", "0.5183858", "0.5167944", "0.51665556", "0.5163483", "0.51624805", "0.51572514", "0.5156724", "0.5155985", "0.5141314", "0.5135971", "0.51326245", "0.51241", "0.5117105", "0.5116568", "0.5115074", "0.51129246", "0.510811", "0.5101793", "0.5101196", "0.50980675", "0.5093934", "0.5091239", "0.50893563", "0.5086436", "0.50848025", "0.50785094", "0.5068509", "0.5068509", "0.50661993", "0.5065967", "0.5063904", "0.5056211", "0.50505286", "0.50472933", "0.5043715", "0.50413066", "0.5038714", "0.50368124", "0.5032431", "0.5030859", "0.50253016", "0.5015141", "0.50144917", "0.50142586", "0.5006028", "0.50044006", "0.50012577", "0.49907923", "0.49904457", "0.49902752", "0.4987551" ]
0.6486931
0
TODO fragment or abstract this
def test_to_table_continous assert_equal Fixture::CONTINOUS_TABLE, @statistic.to_table!(:continous) assert_equal Fixture::CONTINOUS_TABLE, @statistic.result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def schubert; end", "def implementation; end", "def implementation; end", "def custom; end", "def custom; end", "def suivre; end", "def formation; end", "def refutal()\n end", "def weber; end", "def fragment?; end", "def fragment?; end", "def who_we_are\r\n end", "def strategy; end", "def processor; end", "def extra; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def methods() end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def isolated; end", "def isolated; end", "def operations; end", "def operations; end", "def internal; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def param; end", "def param; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def wrapper; end", "def call\n # implement in subclasses\n end", "def private_method\n end", "def main\n super\n return self\n end", "def r; end", "def r; end", "def villian; end", "def initialize\n \n end", "def initialize\n super\n end", "def initialize\n super\n end", "def eplore\n end", "def get()\n \n end", "def identify; end", "def verdi; end", "def handle; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end" ]
[ "0.75226384", "0.6454244", "0.6454244", "0.6454244", "0.6454244", "0.6440201", "0.6420529", "0.6351392", "0.6351392", "0.630508", "0.630508", "0.6296929", "0.6283499", "0.62103945", "0.61070657", "0.6071251", "0.6071251", "0.6060764", "0.60297245", "0.59779453", "0.5962461", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5919503", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5878764", "0.5878764", "0.58574045", "0.58574045", "0.5857345", "0.58262455", "0.58262455", "0.5819983", "0.5819983", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5806265", "0.5806265", "0.5806265", "0.5806265", "0.57949454", "0.57701665", "0.5759315", "0.5758292", "0.57562405", "0.57562405", "0.5753747", "0.57489175", "0.57459617", "0.57459617", "0.57279503", "0.57189447", "0.5717239", "0.57172054", "0.57149494", "0.5702699", "0.5702699", "0.5702699", "0.5702699", "0.5702699", "0.5702699", "0.5702699" ]
0.0
-1
TODO fragment or abstract this
def test_to_table_discrete assert_equal Fixture::DISCRETE_TABLE, @statistic.to_table!(:discrete) assert_equal Fixture::DISCRETE_TABLE, @statistic.result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def schubert; end", "def implementation; end", "def implementation; end", "def custom; end", "def custom; end", "def suivre; end", "def formation; end", "def refutal()\n end", "def weber; end", "def fragment?; end", "def fragment?; end", "def who_we_are\r\n end", "def strategy; end", "def processor; end", "def extra; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def context; end", "def methods() end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def content; end", "def isolated; end", "def isolated; end", "def operations; end", "def operations; end", "def internal; end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def param; end", "def param; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def wrapper; end", "def call\n # implement in subclasses\n end", "def private_method\n end", "def main\n super\n return self\n end", "def r; end", "def r; end", "def villian; end", "def initialize\n \n end", "def initialize\n super\n end", "def initialize\n super\n end", "def eplore\n end", "def get()\n \n end", "def identify; end", "def verdi; end", "def handle; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end" ]
[ "0.75226384", "0.6454244", "0.6454244", "0.6454244", "0.6454244", "0.6440201", "0.6420529", "0.6351392", "0.6351392", "0.630508", "0.630508", "0.6296929", "0.6283499", "0.62103945", "0.61070657", "0.6071251", "0.6071251", "0.6060764", "0.60297245", "0.59779453", "0.5962461", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5961647", "0.5919503", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5900816", "0.5878764", "0.5878764", "0.58574045", "0.58574045", "0.5857345", "0.58262455", "0.58262455", "0.5819983", "0.5819983", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5818212", "0.5806265", "0.5806265", "0.5806265", "0.5806265", "0.57949454", "0.57701665", "0.5759315", "0.5758292", "0.57562405", "0.57562405", "0.5753747", "0.57489175", "0.57459617", "0.57459617", "0.57279503", "0.57189447", "0.5717239", "0.57172054", "0.57149494", "0.5702699", "0.5702699", "0.5702699", "0.5702699", "0.5702699", "0.5702699", "0.5702699" ]
0.0
-1
Updates backup job tables with backup processes info
def backup_finished!(info) bs = backup_state || build_backup_state bs.finished! info # Email member 1st time there is data for timeline if bs.first_time_data_available? # Send email in background spawn { BackupNotifier.deliver_timeline_ready(self) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_jobs!\n @jobs.each_value do |job|\n name = job[:name]\n changes = nil\n # Search the generator for changes\n @generator[:jobs].each do |gen|\n changes = gen[name.to_sym] if gen.is_a?(Hash) && gen.keys[0] == name.to_sym\n end\n # Apply changes\n Utils.hash_merge!(job[:value], changes) unless changes.nil?\n end\n end", "def monitor_jobs\n @job_pids.each do |job_id, pid|\n # Check if alive\n line = `ps -www -o rss,state -p #{pid}`.split(\"\\n\")[1]\n rss = state = nil\n running = true\n if line\n rss, state = line.split ' '\n log.debug \"Process #{pid} for job #{job_id} in state #{state}, uses #{rss}k mem\"\n else\n # Missing process, which means something went very wrong.\n # TODO: report it!\n log.debug \"Process #{pid} for job #{job_id} is missing!\"\n running = false\n end\n \n # Now check if finished, which means it will be in Z (zombie) status\n # TODO: should we use EventMachine#watch_process ?\n # UPDATE: we are not collecting process status, so we should never see zombie processes.\n if state =~ /Z/\n # Process completed, collect information\n pid, status = Process.wait2 pid\n log.debug \"Process #{pid} for job #{job_id} exited with status #{status.exitstatus}\"\n running = false\n end\n \n job = MongoJob.find_job job_id\n \n if running\n # Still running, so ping database\n # One more thing to check - if the job does not exist, we are killing the process.\n if job\n job.ping\n else\n log.info \"Job #{job_id} for process #{pid} is missing, killing\"\n Process.kill 'KILL', pid\n end\n else\n # Process not running\n # Check the status of the job - if it is still marked as \"working\", we should set its\n # status to \"failed\"\n if job\n if job.status == 'working'\n job.fail \"Process died.\"\n else\n log.info \"Process #{pid} for job #{job_id} ended.\"\n end\n end\n # For sure we are not working on it anymore, so remove from the stack\n finish_job job_id\n end\n \n end\n end", "def backup_jobs\n totals = Hash.new(0)\n errors = Hash.new(0)\n members_data = {}\n sources = []\n members = []\n source_failures = Hash.new(0)\n source_errors = {}\n all_errors = Hash.new(0)\n \n jobs = BackupJob.by_date Date.yesterday\n totals[:group_backup_jobs] = jobs.size\n # Group by member\n jobs.reject{|j| j.member.nil?}.each do |job|\n members << job.member.id\n source_jobs = job.backup_source_jobs\n sources << source_jobs.map(&:backup_source_id)\n totals[:source_backup_jobs] += source_jobs.size\n \n # Save per-backup source stats\n source_jobs.each do |s|\n if s.backup_source.consecutive_failed_backup_jobs > 100\n source_failures[s.backup_source_id] += 1\n end\n if s.successful? \n totals[:successful_source_jobs] += 1\n elsif s.has_errors?\n totals[:failed_source_jobs] += 1\n s.error_messages.each do |e|\n err = short_error(e) # truncate error string\n \n source_errors[s.backup_source_id] ||= {}\n unless source_errors[s.backup_source_id][err]\n all_errors[err] += 1\n else\n source_errors[s.backup_source_id][err] = 1\n end \n end\n end\n end\n # Save every kind of error\n if job.error_messages\n job.error_messages.each do |err|\n errors[short_error(err.to_s)] += 1\n end\n end\n end\n totals[:members] = members.uniq.size\n totals[:backup_sources] = sources.uniq.size\n totals[:backup_sources_failed_at_least_100_times] = source_failures.size\n \n report = {:totals => totals, :job_errors => errors, :source_errors => all_errors}\n #ActionMailer::Base.delivery_method = :sendmail\n BackupReportMailer.deliver_daily_jobs_report(report)\n end", "def update_status\r\n self.reload\r\n jobs = self.jobs\r\n complete_jobs = get_complete_jobs(jobs, JobStatus::COMPLETED, ProcessorStatus::COMPLETED) \r\n incomplete_jobs = get_complete_jobs(jobs, JobStatus::INCOMPLETED, ProcessorStatus::INCOMPLETED) unless self.facility.client.name == 'UNIVERSITY OF PITTSBURGH MEDICAL CENTER'\r\n incomplete_jobs = get_upmc_incomplete_jobs(jobs, JobStatus::INCOMPLETED) if self.facility.client.name == 'UNIVERSITY OF PITTSBURGH MEDICAL CENTER'\r\n complete_output_ready_jobs = get_output_ready_jobs(jobs, JobStatus::COMPLETED, ProcessorStatus::COMPLETED, QaStatus::COMPLETED) \r\n incomplete_output_ready_jobs = get_output_ready_jobs(jobs, JobStatus::INCOMPLETED, ProcessorStatus::INCOMPLETED, QaStatus::INCOMPLETED)\r\n\r\n excluded_jobs = jobs.select do |job|\r\n job.job_status.upcase == JobStatus::EXCLUDED\r\n end\r\n \r\n new_jobs = jobs.select do |job|\r\n job.job_status == JobStatus::NEW\r\n end\r\n\r\n allocated_jobs = jobs.select do |job|\r\n job.job_status == JobStatus::PROCESSING\r\n end\r\n\r\n excluded_processing_or_new_jobs = jobs.select do |job|\r\n ((job.job_status == JobStatus::NEW || job.job_status == JobStatus::PROCESSING) &&\r\n job.is_excluded == true)\r\n end\r\n\r\n previous_status = self.status\r\n if jobs.size == new_jobs.size or jobs.size == 0\r\n self.status = BatchStatus::NEW\r\n self.completion_time = nil\r\n elsif jobs.size == (complete_output_ready_jobs.size + excluded_jobs.size +\r\n incomplete_output_ready_jobs.size + excluded_processing_or_new_jobs.size)\r\n self.completion_time = Time.now\r\n self.status = BatchStatus::OUTPUT_READY\r\n elsif jobs.size == (complete_jobs.size + excluded_jobs.size +\r\n incomplete_jobs.size + excluded_processing_or_new_jobs.size)\r\n self.completion_time = Time.now\r\n self.status = BatchStatus::COMPLETED\r\n else\r\n self.status = BatchStatus::PROCESSING\r\n self.completion_time = nil\r\n end\r\n if previous_status == BatchStatus::NEW && self.status == BatchStatus::PROCESSING &&\r\n self.processing_start_time.blank?\r\n self.processing_start_time = Time.now\r\n end\r\n if previous_status == BatchStatus::PROCESSING && self.status == BatchStatus::COMPLETED\r\n self.processing_end_time = Time.now\r\n end\r\n set_qa_status\r\n self.save \r\n end", "def process_updates(table_name, field, rows)\n ActiveRecord::Base.transaction do\n mass_import(rows)\n mass_update(table_name, field)\n end\n end", "def update_incomplete_jobs\r\n job_ids = params[:ids]\r\n selected_batch = Job.find(job_ids[0]).batch\r\n job_ids.each do |job_id|\r\n Job.find(job_id).update_attributes(:processor_comments => params[:job][:processor_comments],:rejected_comment => params[:job][:processor_comments],\r\n :job_status => \"#{JobStatus::INCOMPLETED}\", :processor_status => \"#{ProcessorStatus::INCOMPLETED}\")\r\n end\r\n selected_batch.expected_completion_time = Time.now if selected_batch.expected_completion_time.blank?\r\n previous_batch_status = selected_batch.status\r\n selected_batch.status = BatchStatus::PROCESSING\r\n if previous_batch_status == BatchStatus::NEW && selected_batch.status == BatchStatus::PROCESSING &&\r\n selected_batch.processing_start_time.blank?\r\n selected_batch.processing_start_time = Time.now\r\n end\r\n selected_batch.save\r\n end", "def schedule_jobs(jobs)\n scheduler = Rufus::Scheduler.start_new\n \n jobs.each do |job|\n Mongolicious.logger.info(\"Scheduled new job for #{job['db'].split('/').last} with interval #{job['interval']}\")\n scheduler.every job['interval'] do\n backup(job)\n end\n end \n \n scheduler.join\n end", "def update_jobs_webb(jobs, only_these)\n only_these.each do |o|\n # 'DETECT' RETURNS THE HASH ELEMENT ITSELF\n j = jobs.detect {|h| h['link'] == o}\n job = Job.where(link: o)\n job[0].title = j['title']\n job[0].salary = j['salary']\n job[0].department = j['department']\n job[0].city = 'Laredo'\n job[0].origin = 'Webb County'\n job[0].link = j['link']\n job[0].save\n end\n puts \"Total of #{jobs.size} updated successfully.\"\n end", "def update_job_status(status)\n @csv_report_job.status = status\n @csv_report_job.save!\n end", "def update!(**args)\n @failed_jobs = args[:failed_jobs] if args.key?(:failed_jobs)\n @job = args[:job] if args.key?(:job)\n end", "def update_process(job_id:, step:, status:, msg:)\n HTTParty.get(\"#{@host}/api/process/#{job_id}\", query: {\n process_code: @process_code,\n step: step,\n status: status,\n msg: msg,\n api_key: @api_key\n })\n end", "def update_job job\n job.check_number = '0' if job.check_number.blank?\n job.pages_from = 1\n job.payer = Payer.find_by_payer(\"No Payer\")\n return job\n end", "def update_job job\n job.check_number = '0' if job.check_number.blank?\n job.pages_from = 1\n job.payer = Payer.find_by_payer(\"No Payer\")\n return job\n end", "def update_job_progress\n defaults = AnalysisJobsItem::AVAILABLE_ITEM_STATUS.product([0]).to_h\n statuses = AnalysisJobsItem.where(analysis_job_id: id).group(:status).count\n statuses[:total] = statuses.map(&:last).reduce(:+) || 0\n\n statuses = defaults.merge(statuses)\n\n self.overall_progress = statuses\n self.overall_progress_modified_at = Time.zone.now\n\n { overall_progress:, overall_progress_modified_at: }\n end", "def update(job)\n mass_assign(job)\n self\n end", "def after_perform_increment_jobs_processed(*)\n @registry.hincrby key, 'jobs_processed', 1\n end", "def update!(**args)\n @failed_main_jobs = args[:failed_main_jobs] if args.key?(:failed_main_jobs)\n @failed_pre_caching_check_jobs = args[:failed_pre_caching_check_jobs] if args.key?(:failed_pre_caching_check_jobs)\n @main_job = args[:main_job] if args.key?(:main_job)\n @pre_caching_check_job = args[:pre_caching_check_job] if args.key?(:pre_caching_check_job)\n end", "def update_modules processes = @options.process # {{{\n processes.each do |config_file|\n\n config_filename = @config.config_dir + \"/\" + config_file + \".yaml\"\n config = read_config( config_filename )\n\n # Require module\n load \"modules/#{config.module.to_s}/Main.rb\"\n\n # Create instance and get new data\n instance = eval( \"#{config.module.capitalize.to_s}.new( @options, @log, config, @config.db_type, @config.db_path )\" )\n amount = config.download_amount\n\n # Do we need to wait?\n sleep_time = sleep?( config.module.to_s, config.refresh_delay )\n unless( sleep_time == 0 )\n @log.message :warning, \"Sleeping for #{sleep_time.to_s} seconds (#{config.module.to_s}) due to mandatory refresh delay\"\n sleep sleep_time \n end\n\n # Update DB that we update the website now\n website = Website.first( :name => config.module.to_s )\n website.last_access = Time.now\n website.save!\n\n # Update\n instance.update!( amount )\n\n @log.message :success, \"Finished processing of #{config_filename.to_s}\"\n end # of @options.process.each\n end", "def update!(**args)\n @import_jobs = args[:import_jobs] if args.key?(:import_jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def finished!(info={})\n self.in_progress = false\n self.last_backup_finished_at = Time.now\n self.last_backup_job_id = info[:job_id]\n \n if info[:errors].nil? || info[:errors].empty?\n self.last_successful_backup_at = Time.now\n self.last_messages = info[:messages] if info[:messages]\n self.last_errors.clear if self.last_errors\n else\n self.last_failed_backup_at = Time.now\n self.last_errors = info[:errors]\n end\n # Do one time calculation of backup data items available & save\n unless self.items_saved\n @first_time_backup_data_available = self.items_saved = has_data?\n else\n @first_time_backup_data_available = false\n end\n save!\n end", "def update_finished_jobs_on_host(timestamp, finished_jobs_on_host)\n # finished_jobs_on_host is a set of unique HostJobKeys <cluster_name, host_name, job_id>\n return if finished_jobs_on_host.nil? || finished_jobs_on_host.size == 0\n\n finished_jobs_on_host.each do |host_job_key|\n job_on_host_task_status_counters = get_tasks_map_with_key(host_job_key)\n\n # Without the check signals might be send to hosts that have jobs on \"REQUESTED\" state\n # - With the check on inconsistencies appear (ex: Busy hosts = 4 and running job status\n # counters=0) but they will be fixed when all object are updated at the end of the timestamp\n\n @logger.debug \"#{timestamp}: job_done_on_host signal\n #{host_job_key.job_id}\n on #{host_job_key.host_name}\n of #{host_job_key.cluster_name}\"\n host_job_key.print if @logger.debug?\n @logger.debug \"counters:\"\n job_on_host_task_status_counters.print if @logger.debug?\n\n if (@clusters[host_job_key.cluster_name].jobs[host_job_key.job_id].augmented)\n @logger.debug \"augmented job\"\n end\n\n @clusters[host_job_key.cluster_name].job_done_on_host_signal( @last_processed_timestamp,\n host_job_key.job_id,\n host_job_key.host_name,\n job_on_host_task_status_counters)\n job_on_host_task_status_counters.reset_counters # Reset world counters for this key\n end\n end", "def update!(**args)\n @model_deployment_monitoring_jobs = args[:model_deployment_monitoring_jobs] if args.key?(:model_deployment_monitoring_jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def list_jobs(args)\n Morpheus::Cli::BackupJobsCommand.new.list(args)\n end", "def update\n\n tables_availables = @reservation.tables\n\n if params[:reservation][:status] == 'process'\n @reservation.status = params[:reservation][:status]\n @reservation.save!\n tables_availables.each do |table_available|\n table_available.available = 0\n table_available.save\n end\n else\n\n tables_availables.each do |table_available|\n table_available.available = 1\n table_available.save\n end\n respond_to do |format|\n\n if @reservation.update(reservation_params)\n flash.now[:notice] = \"La reserva a nombre #{@reservation.title} fue actualizada correctamente\"\n format.html { redirect_to @reservation }\n format.json { render :show, status: :ok, location: @reservation }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @reservation.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end\n end", "def notify_workers\n PgJob.connection.execute \"NOTIFY pg_jobs_#{queue_name}\"\n end", "def update_job! changed_job\n jobs.where(id: changed_job[:id]).update(changed_job)\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end", "def setup\n setup_connection\n\n unless tables.count == 0\n puts \"Aborting! Job already has tables attached. Setup requires a new job.\"\n return\n end\n source_tables = source_connection.tables\n source_tables = source_tables.reject { |table| \n exclude_table_names.include?(table) || table.starts_with?('tmp_') \n }\n\n source_tables.each do |table_name|\n copy_table_schema(table_name)\n end\n\n puts \"Done setup!\"\n puts \"Warning! Table settings have been guessed but you can do extra configuration such as setting the insert_only flag on tables to further increase speed of loading.\"\n end", "def populate\n AgentProcess.all.each { |a| update(a.name, a) }\n end", "def update\n min_processing_nodes = @jobs_queue.min_processing_nodes\n respond_to do |format|\n if @jobs_queue.update_attributes(params[:jobs_queue])\n @jobs_queue.set_visibility(@jobs_queue.owner, params)\n @jobs_queue.save_aws_key(@jobs_queue.owner, params[:aws_credentials]) if params[:jobs_queue][:is_autoscalable] and (params[:jobs_queue][:is_autoscalable] != '0') and params[:jobs_queue][:aws_key_id] and (params[:jobs_queue][:aws_key_id] == 'new_key')\n @jobs_queue.update_processing_nodes(current_user, min_processing_nodes) if @jobs_queue.is_autoscalable and ((min_processing_nodes < @jobs_queue.min_processing_nodes) or (@jobs_queue.max_processing_nodes < @jobs_queue.processing_nodes.size))\n flash[:notice] = 'JobsQueue was successfully updated.'\n format.html { redirect_to((current_user and current_user.is_site_admin? and current_user != @jobs_queue.owner) ? by_user_jobs_queues_path(:user_id => @jobs_queue.owner.id) : @jobs_queue) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @jobs_queue.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_compute_batch(vm_json)\n ActiveRecord::Base.transaction do\n update_compute(vm_json)\n end\n end", "def update_tables\n @old_ethereum_address = @user_extended_details.ethereum_address\n\n @user_extended_details.ethereum_address = @encrypted_ethereum_address\n @user_extended_details.save!\n\n update_user_md5_extended_details\n\n @edit_kyc_request.status = GlobalConstant::EditKycRequest.processed_status\n @edit_kyc_request.save!\n\n @user_kyc_detail.last_acted_by = @admin_id\n @user_kyc_detail.last_acted_timestamp = Time.now.to_i\n @user_kyc_detail.save!\n\n log_activity\n\n success\n end", "def update_player_skills_tbl\n\t\t\tbegin\n\t\t\t\t@player_data_db.execute (\"DELETE from player_skills\")\n\t\t\trescue\n\t\t\t\tputs \"Searching for jobs\"\n\t\t\tend\n\t\t\t# Execute inserts\n\t\t\t#[ db_name, name, descrip, sp_cost, d_dmg, p_dmg, mh_dmg, a_pen]\n\t\n\t\t\t[\t\t\t\t\n\t\t\t\t[\"focused_force\",\"Focused Force\",\"Focus your power to deal 10% more damage\",1,0,0.1,0,0]\n\t\t\t\t\n\t\t\t].each do |dbn,n,d,sp,dd,pd,mhd,ap|\n\t\t\t\t@player_data_db.execute \"insert into player_skills values (?, ?, ?, ?, ?, ?, ?, ?, ?)\", nil,dbn,n,d,sp,dd,pd,mhd,ap\n\t\t\tend\n\t\tend", "def migrate(table_arr)\n table_arr.each do |table_name|\n self.task_queue << {:name=>:migrate_table,:args=>[table_name]}\n end\n end", "def update\n @approval_process.update(approval_process_params)\n @approval_processes = ApprovalProcess.all\n @approval_process = ApprovalProcess.new\n end", "def split_job() \n number_of_real_process = @cores * 2\n number_of_columns_to_render = @job.ending_column - @job.starting_column\n\n number_of_jobs_that_we_want_to_create = number_of_real_process\n if((number_of_columns_to_render/number_of_real_process) < 1) \n number_of_jobs_that_we_want_to_create = number_of_columns_to_render\n end\n\n @subjobs = generate_subjobs(number_of_jobs_that_we_want_to_create) \n end", "def save_pid\n @deployment.pid = Process.pid\n @deployment.save!\n end", "def save_pid\n @deployment.pid = Process.pid\n @deployment.save!\n end", "def process\n check_github_token\n config.base_jobs.each do |base_job_name|\n if branch_deleted?\n Job.delete!(base_job_name, branch)\n else\n Job.find_or_create_copy(base_job_name, branch).run!\n end\n end\n end", "def on_backup_complete(info={})\n unless info[:errors]\n # Reset error notification count after succesful backups\n update_attributes(:error_notifications_sent => 0, :auth_error => nil)\n end\n update_last_backup_times\n \n member.backup_finished!(info)\n end", "def recreate_batched_jobs(id)\n batched_jobs(id).each do |job|\n job.recreate\n end.size\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def create_job_record(job_id)\n if @dbh[:progress_bars].filter(:id => job_id).first\n @dbh[:progress_bars].filter(:id => job_id).\n update(:progress_text => 'queued...', \n :progress_percent => 0,\n :job_start => Time.now,\n :last_updated => Time.now,\n :job_finish => nil)\n else\n @dbh[:progress_bars].\n insert(:id => job_id, \n :progress_text => 'queued...', \n :job_start => Time.now, \n :last_updated => Time.now)\n end\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @patch_job_instance_details = args[:patch_job_instance_details] if args.key?(:patch_job_instance_details)\n end", "def update_audit_tables\n tables.each(&:update_audit_table)\n end", "def processes\n request('getAllProcessInfo')\n end", "def update!(**args)\n @job = args[:job] if args.key?(:job)\n @status = args[:status] if args.key?(:status)\n end", "def update_pids\n # memory isn't recorded with exceptions. need to set #last_memory_reading+ to -1 as\n # the memory used could have changed. for the next request the memory change will not be recorded.\n #\n # NOTE - the failure regex was not matching with a Rails Development log file.\n if has_line_type?(:failure) and processing = has_line_type?(:processing)\n pid_memory[:last_memory_reading] = -1\n elsif mem_line = has_line_type?(:memory_usage)\n memory_reading = mem_line[:memory]\n pid_memory[:current_memory_reading] = memory_reading\n # calcuate the change in memory\n unless pid_memory[:current_memory_reading] == -1 || pid_memory[:last_memory_reading] == -1\n # logged as kB, need to convert to bytes for the :traffic Tracker\n memory_diff = (pid_memory[:current_memory_reading] - pid_memory[:last_memory_reading])*1024\n if memory_diff > 0\n self.attributes[:memory_diff] = memory_diff\n end # if memory_diff > 0\n end # unless\n \n pid_memory[:last_memory_reading] = pid_memory[:current_memory_reading]\n pid_memory[:current_memory_reading] = -1\n end # if mem_line\n return true\n end", "def do_backed_up\n self.update_attributes(:needs_initial_scan => false)\n update_last_backup_times\n end", "def update_busy\n minutes = 0\n self.subprocesses.each do |subprocess|\n minutes = minutes + (subprocess.minutes+subprocess.setup_time)\n end\n self.update(busy:minutes,available:self.minutes-minutes)\n end", "def load_job_submit\n location = Location.find_by_location_barcode(self.pdt_screen_def.get_input_control_value(\"location\"))\n self.set_temp_record(:location, location)\n if !location\n result_screen = PDTTransaction.build_msg_screen_definition(\"location does not exist\",nil,nil,nil)\n return result_screen\n end\n\n if !location.current_job_reference_id\n result_screen = PDTTransaction.build_msg_screen_definition(\"job not created , create new job\",nil,nil,nil)\n return result_screen\n end\n job = Job.find_by_id(location.current_job_reference_id)\n \n if !job\n result_screen = PDTTransaction.build_msg_screen_definition(\"job not created , create new job\",nil,nil,nil)\n return result_screen\n end\n\n if job.job_type_code.upcase != \"RECOOLING\"\n result_screen = PDTTransaction.build_msg_screen_definition(\"this is not a recooling job\",nil,nil,nil)\n return result_screen\n end\n\n if job.current_job_status.upcase != \"JOB_CREATED\"\n result_screen = PDTTransaction.build_msg_screen_definition(\"job[\" + job.job_number + \"] status must be 'created'\",nil,nil,nil)\n return result_screen\n end\n\n pallet_probes = PalletProbe.find_all_by_job_id(job.id)\n if (pallet_probes.length() == 0)\n error = [\"NO PROBES ALLOCATED\"]\n result_screen = PDTTransaction.build_msg_screen_definition(nil, nil, nil, error)\n return result_screen\n end\n\n ActiveRecord::Base.transaction do\n job.update_attribute(:current_job_status, \"JOB_LOADED\")\n\n self.set_transaction_complete_flag\n end\n\n self.set_transaction_complete_flag\n result_screen = PDTTransaction.build_msg_screen_definition(\"job loaded succesfully\",nil,nil,nil)\n return result_screen\n end", "def backup(job)\n path = @filesystem.get_tmp_path\n s3 = @storage.parse_location(job['location'])\n db = @db.get_opts(job['db'])\n \n Mongolicious.logger.info(\"Starting job for #{db[:host]}:#{db[:port]}/#{db[:db]}\")\n\n @db.dump(db, path)\n @filesystem.compress(path) \n \n key = \"#{s3[:prefix]}_#{Time.now.strftime('%m%d%Y_%H%M%S')}.tar.bz2\"\n @storage.upload(s3[:bucket], key, path)\n \n @filesystem.cleanup(path)\n @storage.cleanup(s3[:bucket], s3[:prefix], job['versions'])\n \n Mongolicious.logger.info(\"Finishing job for #{db[:host]}:#{db[:port]}/#{db[:db]}\") \n end", "def jobs\r\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @metadata = args[:metadata] if args.key?(:metadata)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @total_size = args[:total_size] if args.key?(:total_size)\n end", "def update!(**args)\n @nas_jobs = args[:nas_jobs] if args.key?(:nas_jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def update_status\n return nil if !@on_status\n rows_count = Knj::Locales.number_out(@rows_count, 0)\n rows_count_total = Knj::Locales.number_out(@rows_count_total, 0)\n percent = (@rows_count.to_f / @rows_count_total.to_f) * 100\n percent_text = Knj::Locales.number_out(percent, 1)\n @on_status.call(:text => \"Dumping table: '#{@table_obj.name}' (#{rows_count}/#{rows_count_total} - #{percent_text}%).\")\n end", "def update\n respond_to do |format|\n if @repair.update(repair_params)\n format.html { redirect_to @repair, notice: 'Repair was successfully updated.' }\n format.json { render :show, status: :ok, location: @repair }\n \n if @repair.jobs.count == @repair.jobs.done.count\n @repair.update(done: true)\n end\n\n update_parts(@repair)\n @bus= Bus.find(@repair.bus_id)\n bus_update(@bus)\n\n else\n format.html { render :edit }\n format.json { render json: @repair.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @backup_info = args[:backup_info] if args.key?(:backup_info)\n @name = args[:name] if args.key?(:name)\n @optimize_table_operation_name = args[:optimize_table_operation_name] if args.key?(:optimize_table_operation_name)\n @progress = args[:progress] if args.key?(:progress)\n @source_type = args[:source_type] if args.key?(:source_type)\n end", "def restore_files_to(to_db, jobs)\n [\n restore_pg_dump_file(to_db, %w(pre-data data), jobs),\n *restore_table_copy_files(to_db),\n restore_pg_dump_file(to_db, %w(post-data), jobs)\n ]\n end", "def set_db_job_status\n @db_job_status = DbJobStatus.find(params[:id])\n end", "def update_jobs_lcc(jobs, only_these)\n only_these.each do |o|\n # 'DETECT' RETURNS THE HASH ELEMENT ITSELF\n j = jobs.detect {|h| h['link'] == o}\n job = Job.where(link: o)\n job[0].title = j['title']\n job[0].salary = j['salary']\n job[0].department = j['department']\n job[0].city = 'Laredo'\n job[0].origin = 'Laredo Community College'\n job[0].link = j['link']\n job[0].save\n end\n puts \"Total of #{jobs.size} updated successfully.\"\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @jobs = args[:jobs] if args.key?(:jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @unreachable = args[:unreachable] if args.key?(:unreachable)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @processes = args[:processes] if args.key?(:processes)\n end", "def update!(**args)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n @processes = args[:processes] if args.key?(:processes)\n end", "def process\n # self.update_attributes(state: 'processing')\n interactor = \"::#{self.handler.class.name}::#{self.action_name.camelcase}\".constantize\n context = interactor.call({\n product_instance: self.product_instance,\n handler: self.handler,\n job: self,\n })\n if context.failure?\n self.error_messages ||= []\n self.error_messages << context.errors if context.errors.present?\n self.save\n end\n context\n end", "def update_task(id, pid, priority, description, status)\n x = []\n data.each_pair do|k, v|\n x << \"#{k} = #{v}\"\n end\n\n str = x.join(\",\")\n\n command = @db.exec(%Q[\n UPDATE tasks\n SET #{str}\n WHERE id = #{data[\"id\"]};\n ])\n TM::Task.new(command)\n end", "def processing\n jobs_index(Job.processing)\n end", "def save_process_framework\r\n \r\n #project update model\r\n remove_model_help(@project)\r\n @project.model_id = params[:selected_model]\r\n @project.if_config_pf = true\r\n @project.save\r\n default_settings = Setting.plugin_redmine_process_frameworks\r\n #activities_save\r\n sys_activities = ProcessModel.find(@project.model_id).activities\r\n sys_activities.each do |a|\r\n if params[:\"activity_#{a.id}\"]==\"yes\" then\r\n ver = Version.find(:first,:conditions=>[\"name=? and project_id=?\",a.name,@project.id])\r\n if ver.nil? # not exsits:save\r\n activities_version_save(a)\r\n ver = Version.find(:first,:conditions=>[\"name=? and project_id=?\",a.name,@project.id])\r\n else #else update\r\n ver.save\r\n end\r\n #actions_save \r\n sys_actions = a.actions \r\n sys_actions.each do |ac| \r\n if params[:\"action_#{ac.id}\"]==\"yes\" then\r\n act = Issue.find(:first,:conditions=>[\"subject=? and fixed_version_id=?\",ac.name,ver.id])\r\n if act.nil?\r\n actions_issue_save(ac,ver.id, default_settings) \r\n act = Issue.find(:first,:conditions=>[\"subject=? and fixed_version_id=?\",ac.name,ver.id])\r\n else\r\n act.author_id = User.current.id\r\n act.save\r\n end\r\n #tasks_save\r\n sys_tasks=ac.pf_tasks\r\n sys_tasks.each do |t|\r\n if params[:\"task_#{t.id}\"]==\"yes\" then\r\n ta = Issue.find(:first,:conditions=>[\"subject=? and parent_id=?\",t.name,act.id])\r\n if ta.nil?\r\n tasks_issue_save(t,ver.id,act.id, default_settings) \r\n ta = Issue.find(:first,:conditions=>[\"subject=? and parent_id=?\",t.name,act.id])\r\n else\r\n ta.author_id = User.current.id\r\n ta.save\r\n end\r\n end\r\n end\r\n end\r\n end\r\n end\r\n end \r\n redirect_to :controller=>'init_select',:action=>'view_process_framework',:project_id => @project \r\n end", "def edit_backup_info\n backup = `barman list-backup main`\n latest_backup = backup[5,15]\n backup_info = \"/data/pgbarman/barman/main/base/#{latest_backup}/backup.info\"\n text = File.read(backup_info)\n new_contents = text.gsub(/oltp/, \"db\\/barmanrestored\")\n File.open(backup_info, \"w\") {|file| file.puts new_contents }\nend", "def determine_processes\n procs = @shell.query('PROCESSES', 'ps aux')\n @info[:processes] = procs.gsub(/\\r/, '').split(/\\n/)\n end", "def run_backup_job(&block)\n MessageQueue.start(MessageQueue.connect_params(AMQP_BACKUP_CONFIG)) do\n block.call\n MessageQueue.stop\n end\n end", "def update!(**args)\n @postgresql_tables = args[:postgresql_tables] if args.key?(:postgresql_tables)\n @schema = args[:schema] if args.key?(:schema)\n end", "def sync_jobs(jobs)\n Job.sync_jobs!(@context, jobs)\n end", "def perform\n self.status = STATUS_DONE\n self.save\n job.update_status\n end", "def perform(batch_id)\n # Rails.logger.debug \"\\033[31m UpdateActiveTrayPlansJob: #{batch_id} \\033[0m\"\n # Find the corresponding batch\n batch = Cultivation::Batch.find(batch_id)\n # Find all 'phase' tasks\n phases = Cultivation::QueryBatchPhases.call(batch).booking_schedules\n # Find all tray locations in database\n locations = QueryReadyTrays.call(batch.facility_id).result\n # Find all existing TrayPlans\n tray_plans = Cultivation::TrayPlan.where(batch_id: batch_id)\n # Culculate number of Active Plants, capacity that needs to be booked.\n phases.each do |phase_info|\n plant_groups, total = group_plants_by_location(batch_id, phase_info.phase)\n # p \"total: #{total}\"\n plant_groups.each do |location_id, location_plants|\n tray = locations.detect { |a| a.tray_id.to_s == location_id.to_s }\n if !location_plants.empty?\n quantity = location_plants.length\n # Find existing TrayPlan for this location & phase\n phase_plans = tray_plans.where(phase: phase_info.phase,\n tray_id: location_id)\n # Delete existing Tray Plans\n phase_plans.delete_all if !phase_plans.empty?\n # Create Tray Plan(s)\n recreate_tray_plans(batch_id, phase_info, quantity, tray)\n # Update batch's growth stage\n batch.current_growth_stage = phase_info.phase\n end\n end\n # Update info back to batch\n batch.quantity = total\n batch.save!\n end\n end", "def check_backend_jobs\n running = `pgrep -f jobs:work`.split(\"\\n\").count.positive?\n\n return if running\n\n alert_msg = 'The backend processes for setting up tests and performing measure calculations are not running.\n Please refer to the Cypress installation manual for instructions on starting the processes.'\n flash[:backend_job_warning] = alert_msg\n end", "def run_batch(command_string,job_params,jobscript_path,autodelete)\n @env.log(\"Creating batch file for command: #{command_string}\",:info)\n\n if ( autodelete )\n # command_string<<\";rm #{jobscript_path}\"\n end\n\n jobid=job_params[:jobid]\n if ( job_params[:vmem]==nil)\n job_params[:vmem]=\"900mb\"\n end\n if (job_params[:queue] ==nil )\n job_params[:queue]=\"lowmem\"\n end\n\n job_script=\"#!/bin/bash\n #PBS -N #{jobid}\n #PBS -e pbs.#{jobid}.err \n #PBS -o pbs.#{jobid}.log\n #PBS -l nodes=1:ppn=1,vmem=#{job_params[:vmem]}\n #PBS -q #{job_params[:queue]}\n #{command_string}\"\n\n p File.open(jobscript_path, 'w') {|f| f.write(job_script) }\n\n self.run_local(\"qsub #{jobscript_path}\")\n \n end", "def set_tasks\n @b_task = backup.b_task.find(params[:id])\n end", "def update_jobs_city(jobs, only_these)\n only_these.each do |o|\n # 'DETECT' RETURNS THE HASH ELEMENT ITSELF\n j = jobs.detect {|h| h['link'] == o}\n job = Job.where(link: o)\n job[0].title = j['title']\n job[0].salary = j['salary']\n job[0].department = j['department']\n job[0].city = 'Laredo'\n job[0].origin = 'City of Laredo'\n job[0].link = j['link']\n job[0].save\n end\n puts \"Total of #{jobs.size} updated successfully.\"\n end", "def set_job_progress\n @job_progress = JobProgress.find(params[:id])\n end", "def upd\n @upd_procs.call('Updating')\n self\n end", "def save_job_list\n @saved_job_list = jobs\n end", "def index\n @job_progresses = JobProgress.all\n end", "def run_backups\n puts \"Starting backups...\" if options[:verbose]\n for database in database_list\n Dir.chdir(temp_directory)\n name, user, pass = database.split(\",\")\n password = pass.strip.empty? ? '' : \"-p#{pass.strip}\"\n tgz_filename = \"#{name}.#{DATE}.#{TIME}.tgz\"\n # stop the slave if necessary\n puts \"Stopping the slave...\" if options[:verbose] && options[:slave]\n `mysql -u #{user} #{password} --execute='stop slave;'` if options[:slave]\n \n # switch to the current database and backup each table\n tables = `echo 'show tables' | mysql -u #{user} #{password} #{name} | grep -v Tables_in_`\n for table in tables\n table.strip!\n puts \"Backing up table #{table}...\" if options[:verbose]\n filename = \"#{table}.#{DATE}.#{TIME}.sql\"\n `mysqldump --add-drop-table --allow-keywords -q -c -u #{user} #{password} #{name} #{table} > #{filename}`\n end\n \n # restart the slave if necessary\n puts \"Restarting the slave...\" if options[:verbose] && options[:slave]\n `mysql -u #{user} #{password} --execute='start slave;'` if options[:slave]\n \n # zip it up and move it to the backup directory\n puts \"Completed backups, zipping it up...\" if options[:verbose]\n `tar -zcvf #{backup_directory}/#{tgz_filename} *`\n puts \"Cleaning up...\" if options[:verbose]\n Dir.chdir(backup_directory)\n `rm -rf #{temp_directory}`\n \n # copy it to any remote hosts if needed\n scp_results(tgz_filename) unless scp_hosts.empty?\n puts \"And we're done!\" if options[:verbose]\n end\n end", "def job_status_invoices_submitted\n # self.confirmed_interpreters.each do |confirmed_interpreter|\n # self.complete_job(confirmed_interpreter)\n # self.confirmed_interpreters.delete(confirmed_interpreter)\n # end\n \n update_attribute(:invoice_submitted, true)\n update_attribute(:invoice_submitted_at, Time.zone.now)\n \n @interpreter_invoices = self.interpreter_invoices\n @interpreter_invoices.each do |interpreter_invoice|\n interpreter_invoice.job_complete\n end\n end", "def process db\n #verify if table exists\n table = EMMConfig[\"DB_TABLE_#{$opts[:table]}\"]\n sql=\"UPDATE #{table} SET processed=1 WHERE file_name IN \"\n sql << \"(\" << $files.map{ |k| \"'#{File.basename(k)}'\" }.join(',') << \");\"\n puts sql if $opts[:v]\n db.query(sql)\nend", "def update_real_url_and_filesize\n ItemJob.perform_later id\n end", "def process(obj)\n if obj.is_a?(Hash)\n obj.each do |key,value|\n if value.is_a?(String)\n if value =~ /___WAITING_JOB:[0-9]+___/\n job_id = value.scan(/___WAITING_JOB:([0-9]+)___/).first.first\n res = get_job_result(job_id.to_i)\n \n obj[key] = res if res\n end\n else\n process(value)\n end\n end\n end\n end", "def update!\n scheduling.total_runs = scheduling.total_runs.to_i + qjob.stats['releases']\n scheduling.last_run = Time.now\n end", "def update\n job = Job.find(params[:id])\n\n Job.storage_fields.each do |field|\n job[field.to_sym] = params[field.to_sym]\n end\n\n respond_with job.save\n end", "def bulk_insert_jobs(objects)\n records = objects.map do |object|\n object.attributes.filter_map do |(name, value)|\n next if name == ::Delayed::Job.primary_key\n\n if (type = ::Delayed::Job.attribute_types[name]).is_a?(::ActiveRecord::Type::Serialized)\n value = type.serialize(value)\n end\n [name, value]\n end.to_h\n end\n return if records.empty?\n\n keys = records.first.keys\n\n connection = ::Delayed::Job.connection\n quoted_keys = keys.map { |k| connection.quote_column_name(k) }.join(\", \")\n\n connection.execute \"DROP TABLE IF EXISTS delayed_jobs_bulk_copy\"\n connection.execute \"CREATE TEMPORARY TABLE delayed_jobs_bulk_copy\n (LIKE #{::Delayed::Job.quoted_table_name} INCLUDING DEFAULTS)\"\n connection.execute \"COPY delayed_jobs_bulk_copy (#{quoted_keys}) FROM STDIN\"\n records.map do |record|\n connection.raw_connection.put_copy_data(\"#{keys.map { |k| quote_text(record[k]) }.join(\"\\t\")}\\n\")\n end\n connection.clear_query_cache\n connection.raw_connection.put_copy_end\n result = connection.raw_connection.get_result\n begin\n result.check\n rescue => e\n raise connection.send(:translate_exception, e, \"COPY FROM STDIN\")\n end\n connection.execute \"INSERT INTO #{::Delayed::Job.quoted_table_name} (#{quoted_keys})\n SELECT #{quoted_keys} FROM delayed_jobs_bulk_copy\n ON CONFLICT (singleton) WHERE singleton IS NOT NULL AND locked_by IS NULL DO NOTHING\"\n result.cmd_tuples\n end", "def update_quest_tbl\n\t\t\tbegin\n\t\t\t\t@player_data_db.execute (\"DELETE from quests\")\n\t\t\trescue\n\t\t\t\tputs \"Searching for jobs\"\n\t\t\tend\n\t\t\t# Execute inserts\n\t\t\t#[ db_name, quest_name, descrip, k_g_goal, k_g_name, exp_reward, silver_reward, gold_reward, loot_reward, k_g_count, q_status] ** q_tatus A = Active, C = Completed, D = Dropped\n\t\n\t\t\t[\t\t\t\t\n\t\t\t\t#[\"kill_rats\", \"eRATicate\", \"Kill 10 small rats\",1, \"small_rat\",25,0,3,\"apple_basket\",0,\"A\"],\n\t\t\t\t[\"get_wood\", \"Woody\", \"Gather 15 soft wood\",1, \"soft_wood\",25,0,3,\"none\",0,\"A\"]\n\t\t\t\t\n\t\t\t].each do |dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs|\n\t\t\t\t@player_data_db.execute \"insert into quests values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", nil,dbn,n,d,kgg,kgn,exp,sr,gr,loot,kgc,qs\n\t\t\tend\n\t\tend", "def update\n \n if !job_params[:predecessor_id].nil? && job_params[:predecessor_id]!=\"\"\n @predecessor = Job.find(job_params[:predecessor_id]) \n @job.predecessor_id=@predecessor.id\n @predecessor.successor_id=@job.id\n @predecessor.save\n end\n\n if !job_params[:successor_id].nil? && job_params[:successor_id]!=\"\"\n @successor = Job.find(job_params[:successor_id])\n @job.successor_id=@successor.id\n @successor.predecessor_id=@job.id\n @successor.save\n end\n\n respond_to do |format|\n if @job.update(job_params)\n format.html { redirect_to @job, notice: 'Job was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def info_hash\n puts \"monitor{#@id} - jobs statuses: \"\n @j_hash.each do |key, value|\n puts \"#{key} : #{value}\"\n end\n puts \"-------------------------------\"\n end", "def update_all_skills_tbl\n\t\t\tbegin\n\t\t\t\t@player_data_db.execute (\"DELETE from all_skills\")\n\t\t\trescue\n\t\t\t\tputs \"Searching for jobs\"\n\t\t\tend\n\t\t\t# Execute inserts\n\t\t\t#[ db_name, name, descrip, sp_cost, d_dmg, p_dmg, mh_dmg, a_pen, s_class]\n\t\n\t\t\t[\t\t\t\t\n\t\t\t\t[\"focused_force_I\",\"Focused Force I\",\"Focus your power to deal 10% more damage\",1,0,0.1,0,0,\"all\"],\n\t\t\t\t[\"focused_force_II\",\"Focused Force II\",\"Focus your power to deal 20% more damage\",2,0,0.2,0,0,\"all\"],\n\t\t\t\t[\"focused_force_III\",\"Focused Force III\",\"Focus your power to deal 30% more damage\",4,0,0.3,0,0,\"all\"],\n\t\t\t\t[\"focused_force_IV\",\"Focused Force IV\",\"Focus your power to deal 40% more damage\",8,0,0.4,0,0,\"all\"],\n\t\t\t\t[\"focused_force_V\",\"Focused Force V\",\"Focus your power to deal 50% more damage\",16,0,0.5,0,0,\"all\"],\n\t\t\t\t[\"bone_crasher\",\"Bone Crusher\",\"Attack with great force dealing damage equal to 20% of your foes HP\",6,0,0,0.2,0,\"warrior\"],\n\t\t\t\t[\"lacerate\",\"Lacerate\",\"Slice your foe dealing 20 armor ignoring damage.\",8,20,0,0,1,\"warrior\"],\n\t\t\t\t[\"doom_blade\",\"Doom Blade\",\"Conjure doom upon your weapon dealing 35% of your foes health that ignores armor.\",12,0,0,0.35,1,\"warrior\"],\n\t\t\t\t[\"final_blow\",\"Final Blow\",\"Attack with all of your strength to deal double damage\",18,0,1,0,0,\"warrior\"],\n\t\t\t\t[\"backstab\",\"Backstab\",\"Stab your foe in the back dealing 10 direct damage\",6,10,0,0,0,\"rogue\"],\n\t\t\t\t[\"glass_dagger\",\"Glass Dagger\",\"Cause a deep wound to your target that deals damage equal to 20% of their current health.\",8,0,0,0.3,0,\"rogue\"],\n\t\t\t\t[\"dancing_knives\",\"Dancing Knives\",\"Slice at your foe quickly dealing 20 armor ignoring damage\",12,20,0,0,1,\"rogue\"],\n\t\t\t\t[\"poison_blades\",\"Poison Blades\",\"Poison your foe dealing double damage\",18,0,1,0,0,\"rogue\"],\n\t\t\t\t[\"magic_surge\",\"Magic Surge\",\"Strike your foe with a burst of magic damage dealing 10% of your foes health, which ignores armor\",6,0,0,0.1,1,\"mage\"],\n\t\t\t\t[\"fire_ball\",\"Fire Ball\",\"Shoot a fireball at your foe dealing 15 direct damage\",8,15,0,0,0,\"mage\"],\n\t\t\t\t[\"magic_missle\",\"Magic Missle\",\"Shoot a magic Missle at your foe dealing 30% of your foes health.\",12,0,0,0.3,0,\"mage\"],\n\t\t\t\t[\"doom_orb\",\"Doom Orb\",\"Surround your foe with an orb of doom. Dealing tripple damage\",18,0,2,0,0,\"mage\"]\n\t\t\t\t\n\t\t\t].each do |dbn,n,d,sp,dd,pd,mhd,ap,sc|\n\t\t\t\t@player_data_db.execute \"insert into all_skills values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)\", nil,dbn,n,d,sp,dd,pd,mhd,ap,sc\n\t\t\tend\n\t\tend", "def action_update\n if job_exists\n post_job(job_url)\n else\n post_job(new_job_url)\n end\nend", "def update!(**args)\n @data_labeling_jobs = args[:data_labeling_jobs] if args.key?(:data_labeling_jobs)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def jobs\n db[TABLE_NAME]\n rescue ::Sequel::DatabaseError => e\n retry if on_error e\n end" ]
[ "0.53641075", "0.514995", "0.5135971", "0.50589067", "0.50500214", "0.501807", "0.50043446", "0.4994661", "0.4969358", "0.494651", "0.4879462", "0.4869844", "0.4869844", "0.48647133", "0.48298055", "0.48183316", "0.48032683", "0.4798184", "0.4788128", "0.4786424", "0.47748014", "0.4774773", "0.47609013", "0.4753526", "0.47515833", "0.46877152", "0.46788242", "0.46741915", "0.46486735", "0.4643613", "0.4643529", "0.4627785", "0.46246162", "0.45997024", "0.45980373", "0.4585609", "0.4585609", "0.45714822", "0.45712492", "0.45649838", "0.45633957", "0.45633957", "0.45633957", "0.45564908", "0.455443", "0.45371586", "0.45357943", "0.45319864", "0.45311445", "0.4527936", "0.45271733", "0.45211294", "0.45203772", "0.4516496", "0.45112467", "0.45112467", "0.45097744", "0.45079958", "0.45070657", "0.45058143", "0.45033625", "0.45030278", "0.44994402", "0.44950312", "0.44950312", "0.44921026", "0.44921026", "0.44728217", "0.4472513", "0.44717768", "0.44670603", "0.44637102", "0.44631916", "0.44606882", "0.4459839", "0.4455609", "0.44534189", "0.44533396", "0.44460827", "0.44415483", "0.44403392", "0.44342166", "0.44339755", "0.4433726", "0.4431513", "0.4428377", "0.44259414", "0.44245183", "0.44238102", "0.44131088", "0.44089475", "0.4408735", "0.44080696", "0.44052538", "0.44025975", "0.44019616", "0.43994975", "0.43935868", "0.43934685", "0.43849167", "0.43817163" ]
0.0
-1
Has this member setup their account yet?
def need_backup_setup? backup_sources.active.empty? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meetup_auto_create_account?\n self.meetup_auto_create_account\n end", "def have_account?\n false\n end", "def member?\n @member = UserSubscription.where(account_id: self.account_id, currently_active: true)\n if !@member.blank?\n return true\n else\n return false\n end\n end", "def koala_auto_create_account?\n self.koala_auto_create_account\n end", "def allow_sign_up?\n @allow_sign_up\n end", "def has_auth?\n !current_person.nil?\n end", "def is_ready_to_start?\n self.is_owner? ? self.ack_get_started_owner : ack_get_started_user\n end", "def is_registered?\n # keep track of where we are: if no password in db\n # it means we still are at the registration step\n\n # Note that we use the \"_was\" suffix here (AR::Dirty) to check\n # the value of the field before the update\n !crypted_password_was.blank?\n end", "def member?\n client.organization_member? org_id, user.login\n end", "def registered?\n !new_record? && !anonymous?\n end", "def requires_user_existence!\n if not e.user_exists?\n error \"You have to setup your user before you can perform this action.\"\n exit\n end\n end", "def available?\n begin\n head(\"v1/account/#{@email}\")\n return false\n rescue JustGiving::NotFound\n return true\n end\n end", "def member?\n client.organization_member? org_id, github_user.login\n end", "def registered?\n begin\n self.get_registration\n true\n rescue => e\n # any error should be treated as the user not being registered\n false\n end\n end", "def added_fb_account?\n !self.external_user_id.nil?\n end", "def registered?\n !guest?\n end", "def pending?\n !hashed_password && !reviewer?\n end", "def provisional?\n registered? && @provisional\n end", "def is_pending_activation?\n ! self.activated? and self.verification_key ? true : false\n end", "def member?\n member.present?\n end", "def oauth2_auto_create_account?\n self.oauth2_auto_create_account\n end", "def can_activate?\n self.person && self.person_match? && self.has_not_expired?\n end", "def not_account_owner_in_signup\n enterprise.blank? || !enterprise.id.nil?\n end", "def exists?\n username && api_key\n end", "def can_activate?\n self.person && self.email_match?\n end", "def not_account_owner\n not_account_owner_in_signup && !is_account_owner? \n end", "def started?\n start + signup_duration < Time.current\n end", "def has_user?(member)\n self[:users].member? member\n end", "def initialized?\n server.present? && username.present? && api_token.present?\n end", "def registration_complete?\n self.address.present?\n end", "def ready?\n !has_expired?\n end", "def in_progress?\n started? && start + signup_duration + duration > Time.current\n end", "def authenticated?\n !account.nil?\n end", "def on_users_account\n true\n end", "def member?\n has_role_requirement? MemberRole\n end", "def meetup_connected?\n self.send(:\"#{self.class.meetup_uid_field}\").present?\n end", "def self_signup?\n user_id == author_id\n end", "def member_logged_in?\n !current_library_member.nil?\n end", "def current_user_signed_up?\n logged_in? && !current_user_is_host? && @game.players.include?(current_user)\n end", "def record_has_two_factor_auth_required_and_uncompleted?\n record&.get_two_factor_auth_enabled && !two_factor_auth_completed?\n end", "def complete_signup\n if self.habitats_count < 1\n self.errors.add(:habitats, \"User not done if they don't have a habitat\")\n false\n else\n self.completed_signup_at ||= Time.now\n if self.save\n self.generate_confirmation_token!\n enqueue_welcome_email\n true\n else\n false\n end\n end\n end", "def set?\n @auth.any?\n end", "def sex_offender_check_pending?\n !background_check_authorized_at.nil? && (!passed_sex_offender_check? && sex_offender_check_run_at.nil?)\n end", "def just_set_up?\n AppConfig[:just_set_up] == true\n end", "def create_attempted?\n create_attempted\n end", "def has_member?(user)\n members.exists?(user)\n end", "def doing_trial?\n active_subscription && active_subscription.trial?\n end", "def team_result?\n registration_id.nil?\n end", "def requested_account_authorized?\n session[:_bookingsync_account_id].blank? ||\n session[:_bookingsync_account_id] == session[:account_id]\n end", "def signed_up?(person)\n shifts.collect{|shift| shift.signed_up?(person)}.include?(true)\n end", "def ready?\n @connected && @logged_in\n end", "def has_members?\n self.members.count > 0\n end", "def claimable?\n # can this invite be confirmed!\n ( pending? or declined? ) and !roster.full?\n end", "def member?(person)\n memberships.find_by(activity_member: person.activity_object).present?\n end", "def registration_required?\n not hosted?\nend", "def registration_required?\n not hosted?\nend", "def check_if_needs_approval\r\n self.suspended_at = Time.now if Setting.user_signup == :needs_approval && !self.admin\r\n end", "def has_an_approved_account_set?\n all_monetary_processor_accounts.was_verified.any?\n end", "def require_account\n get_current_account_and_membership\n return user_not_authorized unless @current_account\n end", "def registered?\n !push_id.nil?\n end", "def has_account\n @attributes[:has_account]\n end", "def account_exists?(email)\n dealer_dao.account_exists?(email)\n end", "def allow_member?\n true\n end", "def check_accounts\n\t\t( @participant.facebook_account != nil && @participant.facebook_account != \"\" ) ||\n\t\t( @participant.twitter_account != nil && @participant.twitter_account != \"\" ) ||\n\t\t( @participant.github_account != nil && @participant.github_account != \"\" ) ||\n\t\t( @participant.google_plus_account != nil && @participant.google_plus_account != \"\" )\n\tend", "def users_joined?\n true\n end", "def is_activated?\n self.activation_token.nil?\n end", "def has_profile?\n return self.profile.present?\n end", "def claimed?\n !claimant.nil?\n end", "def has_access_to_current_account\n return if self.padma.try(:current_account).nil?\n\n if self.enabled_accounts.nil?\n # nil means error in connection\n self.errors.add(:current_account_id, I18n.t('user.couldnt_connect_to_check_current_account'))\n else\n unless self.padma.current_account_name.in?(self.enabled_accounts.map{|ea|ea.name})\n self.errors.add(:current_account_id, I18n.t('user.invalid_current_account'))\n end\n end\n\n end", "def organization_membership_confirmed?\n system_confirmed? || manually_confirmed?\n end", "def account_created\n URI.escape(@response) == URI.escape(Registration.validate_registration(@screen_id)) ? true : false\n end", "def customer_is_registered?\n @customer.present?\n end", "def membership_active?\n active_at?(Time.now)\n end", "def is_pending_recovery?\n self.activated? and self.verification_key ? true : false\n end", "def do_you_owe_checker (record)\n\t\tRegister.register_for_payment(record.receiver_id, record.user_id).first.nil?\n end", "def finish_signed_up_but_email_not_confirmed?\n @identity.update(identity_params) && !@identity.confirmed?\n end", "def pending?\n (status == ConfigCenter::User::PENDING)\n end", "def new?\n self.account.nil?\n end", "def account_confirmed?\n confirmed?\n end", "def ready?\n self.class.ready?(@cloud_id, credentials: @credentials)\n end", "def member_is_this_member?(id)\n requested_member = member_exists? id\n if requested_member.nil?\n return false\n end\n if requested_member != session[:member]\n return false\n end\n return true\n end", "def isExistingMember( member )\n #Validate if member already exists\n\n @validatemember = Member.find(:all, :conditions => [\"firstname = ? AND lastname = ? AND emailid = ?\", member.firstname, member.lastname, member.emailid\n ])\n if @validatemember.length == 0\n return false\n else\n member.id = @validatemember[0].id\n return true\n end\n\n end", "def asf_member?\n ASF::Member.status[name] or ASF.members.include? self\n end", "def authed_user?\n return true unless @data['hasPhone'].nil?\n\n false\n end", "def profile_complete?\n\t\t!self.fname.blank? and !self.lname.blank? and !self.email.blank? and !self.company_name.blank? and !self.country.blank? and !self.locale.blank?\n\tend", "def check_org_member_email\n @user = User.includes(:profile).find_by_email(params[:email])\n\n # If user account exists, send signup link email\n if @user\n # If a user has previously set a password,\n # Redirect them to the sign in page.\n # Else send the users a sign up link\n # TODO: May want to change dashboard_registered to password_registered ?\n if @user.profile.dashboard_registered \n flash[:alert] = 'Your membership has already been activated. Try logging in.'\n render json: {\n message: 'User has already signed up.',\n status: 400\n }, status: 400\n return\n else\n message = \"account exists\"\n @user.email_signup_link\n end\n else\n message = \"no account exists\"\n end\n\n render json: {\n message: message,\n status: 200\n }, status: 200\n end", "def require_activation?\n !self.enabled? and !self.activation_code.blank?\n end", "def owned?\n user.present?\n end", "def has_users?\n\t\tself.users.size > 0\n\tend", "def activated?\n activation_token && activation_token.confirmed?\n end", "def ensure_conversation_members\n convo = Conversation.where(availability_id: id).first\n if convo\n convo.conversation_members.create(user: user, admin: admin) if convo.conversation_members.where(user: user).first.nil?\n end\n end", "def confirmed?\n live?\n end", "def pending?\n\t\t\treturn account_life_cycle_status == PENDING \n\t\tend", "def profile_filled?\n !((created_at.to_s == updated_at.to_s) && provider)\n end", "def active?\n # the existence of an activation code means they have not activated yet\n activation_code.nil?\n end", "def stored_offsite?\n (@trustee == true || (! billing_key.blank? && !changed?))\n end", "def active?\n\t\t@activation_count > 0\n\tend", "def account_has_no_service?\n account = Account.find(current_user)\n account.no_services?\n end", "def can_add_member?(team_name,member)\n true\n end", "def ballot_registered?\n @ballot_registered\n end", "def github_account?\n !github_user.nil? and !github_token.nil?\n end" ]
[ "0.7343587", "0.7248861", "0.70242125", "0.66520345", "0.66156495", "0.6562734", "0.6543326", "0.6540512", "0.65218353", "0.652143", "0.65178007", "0.6509836", "0.64983624", "0.6493881", "0.6481122", "0.64548576", "0.6432049", "0.64139795", "0.64101684", "0.6409886", "0.6368492", "0.63551736", "0.63521075", "0.63484323", "0.6327274", "0.63252354", "0.63157", "0.6291592", "0.62829953", "0.627935", "0.62643784", "0.62593746", "0.6248345", "0.624801", "0.6246014", "0.62234074", "0.6222411", "0.6220455", "0.6219657", "0.62082887", "0.6207717", "0.62044215", "0.61957115", "0.61947954", "0.6177465", "0.61718124", "0.6167531", "0.61659545", "0.6159671", "0.61581737", "0.6156246", "0.61503285", "0.61479187", "0.6143552", "0.61429286", "0.61429286", "0.6137179", "0.6135365", "0.6133252", "0.6123629", "0.61039096", "0.61023486", "0.6097416", "0.60910755", "0.60799646", "0.60762584", "0.606728", "0.60633814", "0.6062312", "0.6061992", "0.60542667", "0.6054123", "0.6053646", "0.6052395", "0.6049366", "0.60485", "0.6048499", "0.604769", "0.6046053", "0.603817", "0.6033949", "0.6032772", "0.6029623", "0.60283303", "0.602788", "0.6014265", "0.6014216", "0.60128456", "0.60064995", "0.6005713", "0.60041845", "0.5999601", "0.5996343", "0.59954023", "0.5994283", "0.59914887", "0.59860736", "0.59838736", "0.59823155", "0.59821516", "0.59812516" ]
0.0
-1
Returns all used categories
def all_categories stories.map(&:category).delete_if {|c| c.nil?}.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_categories\n @mutex.synchronize do\n @categories.keys\n end\n end", "def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend", "def all_categories\n end", "def categories\n category_keys.collect(&:to_s)\n end", "def categories\n []\n end", "def categories\n category\n end", "def all_categories\n\t\t@categories = Category.all\n\tend", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def getCategories()\n\t\tcat = Array.new\n\t\tcat.push(\"heroku\")\n\t\tcat.push(\"go\")\n\t\tcat.push(\"github\")\n\t\tcat.push(\"docker\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"apache\")\n\t\tcat.push(\"html\")\n\t\tcat.push(\"bootstrap\")\n\t\tcat.push(\"java ee\")\n\t\tcat.push(\"javafx\")\n\t\tcat.push(\"java\")\n\t\tcat.push(\"jquery\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"c++\")\n\t\tcat.push(\"laravel\")\n\t\tcat.push(\"linux\")\n\t\tcat.push(\"opengl\")\n\t\tcat.push(\"sml\")\n\t\tcat.push(\"javascript\")\n\t\tcat.push(\"mongo db\")\n\t\tcat.push(\"c\")\n\t\tcat.push(\"yacc\")\n\t\tcat.push(\"circuit\")\n\t\tcat.push(\"php\")\n\t\tcat.push(\"mysql\")\n\t\tcat.push(\"node js\")\n\t\tcat.push(\"photoshop\")\n\t\tcat.push(\"rails\")\n\t\tcat.push(\"postgres\")\n\t\tcat.push(\"ruby\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"mac osx\")\n\t\tcat.push(\"sass\")\n\t\tcat.push(\"ubuntu\")\n\t\tcat.push(\"bower\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"hosted\")\n\t\tcat.push(\"python\")\n\t\tcat.push(\"maven\")\n\t\tcat.push(\"maven mojo\")\n\t\tcat.push(\"composer\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"gulp\")\n\t\tcat.push(\"grunt\")\n\t\tcat.push(\"phpstorm\")\n\t\tcat.push(\"react\")\n\t\tcat.push(\"swift\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"tomcat\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"travis\")\n\t\treturn cat\n\tend", "def categories_list\n self.categories.collect{|c| c.name}\n end", "def categories\n return @categories\n end", "def categories\n return @categories\n end", "def categories\n return @categories\n end", "def get_categories\n @cards.each do |card|\n if !@categories.include?(card.category)\n @categories << card.category\n end\n end\n @categories\n end", "def categories\n return @categories\n end", "def categories\n categories = []\n @deck.cards.map do |turn|\n categories << turn.category\n end\n categories.uniq!\n end", "def all_categories(shortlist = false)\n\t\tall = shortlist ? GLOBAL_CATEGORIES[0..3] : GLOBAL_CATEGORIES\n\t\t#all << 'An extra category'\n\tend", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def categories\n @categories ||= wayfinder.decorated_vocabularies.sort_by(&:label)\n end", "def categories\n rpg_shop.handled_categories\n end", "def categories\n stories.map(&:category).delete_if {|c| c.nil? or c.global}.uniq\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def category_names\n self.categories.map do |category|\n category.name\n end\n end", "def category_names\n @category_names || categories.map(&:name).join(' ')\n end", "def categories_list\n @categories = Category.all.collect { |p| [p.name, p.id] }\n end", "def category_names\n categories.map {|category| CategoryCode[category]}\n end", "def get_categories\n @categories = Category.all\n end", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def chosen_categories\n return chosen_options.collect &:category\n end", "def categories\n return [] if @categories.blank?\n @categories.records.map {|c| c.display_name}\n end", "def categories\n raw_categories.to_hashugar\n end", "def categories_items\n all_items = self.all_active_items\n categories_given_items(all_items)\n end", "def category_types\n @category_types.each\n end", "def categories\n add_to_query restrict_kind: 'category'\n end", "def retrieve_distinct_categories\n if @distinct_categories\n categories = @distinct_categories\n else\n categories = []\n @team.season_types.each do |season_type|\n season_type.seasons.sort_season_by_begin_date\n .last\n .category_types.are_not_relays\n .sort_by_age.each do |category_type|\n categories << category_type unless categories.rindex { |e| e.code == category_type.code }\n end\n end\n end\n categories\n end", "def find_categories\n categories = @deck.cards.group_by do |card|\n card.category\n end\n categories.keys\n end", "def categories\n Category.position_sorted\n end", "def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end", "def fetch_all_categories\n everything = @@news_api.get_everything(\n language: 'en',\n sources:'techcrunch,talksport,the-next-web,\n national-geographic, al-jazeera-english,\n crypto-coins-news',\n page: 1\n )\n end", "def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end", "def categories\n @categories = FinanceTransactionCategory.all(:conditions => {:deleted => false}, :order => 'name asc')\n @categories = @categories.select { |x| x.accessible? }\n @category_ids = @categories.map { |cat| cat.id if FinanceTransaction.find_by_category_id(cat.id).present? }.compact\n @multi_config = FinanceTransactionCategory.get_multi_configuration\n @fee_category_present = FinanceFeeCategory.first\n # @fixed_categories = @categories.reject { |c| !c.is_fixed }\n # @other_categories = @categories.reject { |c| c.is_fixed }\n end", "def get_all_category_select_options()\n o = []\n Category.where(:category_id => nil).each do |c|\n get_category_select_options(c).each do |c_option|\n o << c_option\n end\n end\n return o\n end", "def getCategoryList\n categoryDump = @course.assessment_categories\n categories = {}\n for cat in categoryDump do\n categories[cat.name] = cat.id\n end\n return categories\n end", "def categories_without_update\n ((fspath + '@categories').read rescue '').lines.\n map { |l| site.page_for l.chomp rescue nil }.\n select { |p| p.is_a? Category }.to_set\n end", "def categories\n taxonomies.all :conditions => { :classification => :category }\n end", "def user_available_categories\n Category.select('name').\n where(\"user_id = ?\", current_user.id).\n pluck(:name)\n end", "def categories\n return @todo_container.keys\n end", "def categories(options = {})\n options = options.merge(:facets => 'category', :facet_num_results => 100, :num_results => 0)\n search('*:*', options).facets['category'].values\n end", "def fetchCats(dataDir, minConfidence)\n return NellELoad.allCategories(dataDir, minConfidence, NellE::STRICT_TRAINING_CAT_FILENAMES)\nend", "def all_category_ids\n end", "def categories\n # {{{\n if !@categories then\n inherited_cats = []\n if respond_to?(:parent_groups) then\n inherited_cats = parent_groups.map { |g| g.categories }.flatten\n end\n own_cats = User_Category.all_with(User_Category.user_group_id == user_group_id).sort_by(:category_name, :asc)\n @categories = inherited_cats + own_cats.to_a\n end\n @categories\n end", "def set_all_categories\n @all_categories = Category.all.order_by_name\n end", "def set_categories\r\n @categories = Category.where('courses_count > 0').order(:name)\r\n end", "def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEXP.match href\n key = Waymarking::Utils.parameterize(cat.text)\n unless m.nil? then\n ile +=1\n raise DuplicatedCategory if cache.has_key? key\n\n cache[key] = m[1]\n #puts \"#{ile} #{key} #{cat.text} #{m[1]}\"\n else\n puts href\n end\n\n end\n\n cache2 = {}\n cache.keys.each do |key|\n @web.get(\"http://www.waymarking.com/cat/details.aspx?f=1&guid=#{cache[key]}&exp=True\") do |page2|\n begin\n cat = Waymarking::Category.from_html(page2)\n cache2[key] = cat\n rescue\n puts key\n end\n end\n end\n\n File.open('categories.yml', 'w') do |f|\n f.write YAML::dump(cache2)\n end\n end\n end", "def categories\n Hash[self.class.catalogs.map { |fld, klass|\n name = fld.gsub(/_id$/, '_name');\n [fld, {:id => self.send(fld), :name => self.send(name)}] rescue nil\n }.reject {|cat| cat.nil?}]\n end", "def categories\n data['JobCategory'] || []\n end", "def get_categories\n @redis.smembers category_collection_key\n end", "def source_result_category_names\n category_names\n end", "def categories(args={})\n res = api_request('private.request.getCategories', 'GET')\n res = JSON.parse(res)['category'] rescue []\n\n unless args[:include_deleted] and args[:include_deleted] == true\n res.reject!{|k, v| v['fDeleted'] == '1'} rescue []\n end\n \n return res\n end", "def categories\n @transactions.empty? ? nil : @transactions.delete_if{ |t| t.category.nil? }.collect(&:category).uniq\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def category_sets(category)\n category.curriculum_category_sets.map do |category_set|\n complete[category][category_set] = category_set.courses & taken_courses\n\n get_incomplete_from_set(category, category_set)\n end\n end", "def get_known_categories\n rKnownCategories = {}\n\n @MySQLConnection.query('SELECT name, id, value_type FROM stats_categories').each do |iRow|\n iCategoryName, iCategoryID, iValueType = iRow\n rKnownCategories[iCategoryName] = [ iCategoryID.to_i, iValueType.to_i ]\n end\n\n return rKnownCategories\n end", "def categories_for(race)\n [ race.category ] + race.category.descendants\n end", "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def category categories\n categories = categories.to_a if !categories.is_a? Array\n categories.collect { |i| calendars.find_by_title i.to_s }.compact\n end", "def categories\n categories = Array.new\n unless self.category.nil?\n categories << self.category\n categories += self.category.ancestors\n end # unless\n categories.reverse\n end", "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "def categories\n get('venues/categories').categories\n end", "def index\n @all_categories = CateItem.all\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def potential_categories\n if categories.length > 0\n Category.all(:conditions => \"id NOT IN (#{category_ids})\")\n else\n Category.all\n end\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def index\n @categories = collections_config.values\n end", "def main_categories\n categories.to_a[0..3]\n end", "def categories\n if self.channel.generator == 'Twitter'\n return @item.title.scan(/#([^#\\s]+)/).flatten\n end\n return [] if @item.categories.empty?\n @item.categories.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def category_keys\n @backend.category_keys\n end", "def categories\n if @categories.nil?\n @categories = []\n category_nodes =\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"category\",\n \"dc:subject\"\n ])\n unless category_nodes.nil?\n for category_node in category_nodes\n category = FeedTools::Category.new\n category.term = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@term\",\n \"text()\"\n ], :select_result_value => true)\n category.term.strip! unless category.term.blank?\n category.label = FeedTools::XmlHelper.try_xpaths(\n category_node, [\"@label\"],\n :select_result_value => true)\n category.label.strip! unless category.label.blank?\n category.scheme = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@scheme\",\n \"@domain\"\n ], :select_result_value => true)\n category.scheme.strip! unless category.scheme.blank?\n @categories << category\n end\n end\n end\n return @categories\n end", "def multiple_categories\n @categories = Category.all\n end", "def categories()\n db = connect()\n db.execute('SELECT * FROM categories')\n end", "def categories\n return [] if @feed.channel.categories.empty? && @feed.channel.dc_subjects.empty?\n [@feed.channel.categories, ((@feed.channel.dc_subjects.empty?) ? nil : @feed.channel.dc_subjects)].flatten.uniq.compact.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end", "def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end", "def categories\n if nodes = @node.xpath(\"category\")\n nodes.map { |node| RSSCategory.new(node) }\n end\n end", "def categories\n nodes = @doc.xpath(\"atom:feed/atom:category\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomCategory.new(node) }\n end", "def set_categories\n @categories = Category.order(:name).pluck(:name, :id)\n end", "def index\n\t\t@categories = Category.all\n\tend", "def index\n @categories = Category.all\n end", "def analyze\n @categories = Violation.unique_categories\n end", "def categories\n notify Category.all(:order => \"name ASC\").collect {|c| c.name_with_id }.join(\"\\n\")\n end", "def set_categories\n\t\t@categories = Category.all\t\n\tend", "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end", "def index\n @gt_categories = GtCategory.all\n end", "def index\n # @categories = current_user.categories\n @categories = Category.accessible_by(current_ability).all\n end", "def categories\n pages = page.children.all(\n :conditions => { :class_name => 'ShopCategoryPage' },\n :order => 'pages.position ASC'\n ).map(&:shop_category)\n end", "def index\n\t@categories = Category.all\n\tend", "def _tags\n tags = []\n categories.find_each do |category|\n tags << category.self_and_ancestors.pluck(:name)\n end\n tags.flatten.uniq\n end", "def all_news_category_names\n categorizations = NewsItemCategorization.where(news_item_id: id)\n category_names = NewsCategory.where(id: categorizations.pluck(:news_category_id)).pluck(:name).join(', ')\n end", "def categories\n parsed_json['data']\n end", "def categories\n expose Metadata.categories(@oauth_token)\n end" ]
[ "0.8080514", "0.7871337", "0.77789575", "0.7742139", "0.76994085", "0.7656549", "0.76434135", "0.76183885", "0.76160675", "0.76135933", "0.75819594", "0.75819594", "0.75819594", "0.75781137", "0.75755996", "0.75744355", "0.7533475", "0.7469555", "0.7463095", "0.74515647", "0.73567027", "0.7320003", "0.7309392", "0.7305019", "0.72457176", "0.724182", "0.72392124", "0.72376215", "0.72315806", "0.7224433", "0.721232", "0.7208118", "0.7198773", "0.71901125", "0.7165346", "0.71363163", "0.7136187", "0.70899564", "0.7023091", "0.6997652", "0.698395", "0.69770736", "0.6970831", "0.69563335", "0.69394225", "0.6925781", "0.69212943", "0.69149417", "0.6912245", "0.6910736", "0.690328", "0.6898223", "0.68968993", "0.68885505", "0.6885171", "0.6883658", "0.68827325", "0.6880795", "0.6840384", "0.6833675", "0.6831048", "0.68118596", "0.6810999", "0.6796562", "0.6789478", "0.6778006", "0.67734605", "0.67685556", "0.6763211", "0.6737793", "0.67377245", "0.67204934", "0.6719328", "0.6705797", "0.66903836", "0.66863424", "0.6680096", "0.6679213", "0.6651511", "0.6651299", "0.6644158", "0.66369796", "0.663311", "0.6616832", "0.6609015", "0.6606643", "0.66031116", "0.65970534", "0.6596375", "0.65880907", "0.6578667", "0.65769696", "0.6560111", "0.65599406", "0.6558118", "0.65569824", "0.6556159", "0.6547704", "0.65463275", "0.65429926" ]
0.7253151
24
Returns all membercreated categories
def categories stories.map(&:category).delete_if {|c| c.nil? or c.global}.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def categories_list\n self.categories.collect{|c| c.name}\n end", "def categories_list\n @categories = Category.all.collect { |p| [p.name, p.id] }\n end", "def all_categories\n end", "def index\n\t\tcreator_categories\n\tend", "def categories\n []\n end", "def get_categories\n @categories = Category.all\n end", "def categories\n category\n end", "def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend", "def category_names\n self.categories.map do |category|\n category.name\n end\n end", "def all_categories\n\t\t@categories = Category.all\n\tend", "def categories\n return @categories\n end", "def categories\n return @categories\n end", "def categories\n return @categories\n end", "def get_categories\n @cards.each do |card|\n if !@categories.include?(card.category)\n @categories << card.category\n end\n end\n @categories\n end", "def categories\n return @categories\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def all_categories\n @mutex.synchronize do\n @categories.keys\n end\n end", "def index\n @categories = current_user.categories\n end", "def channel_categories\n build :channel_categories, :using => data_for(:channel_categories)\n end", "def categories\n return [] if @categories.blank?\n @categories.records.map {|c| c.display_name}\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def index\n @moment_categories = MomentCategory.all\n end", "def categories\n # {{{\n if !@categories then\n inherited_cats = []\n if respond_to?(:parent_groups) then\n inherited_cats = parent_groups.map { |g| g.categories }.flatten\n end\n own_cats = User_Category.all_with(User_Category.user_group_id == user_group_id).sort_by(:category_name, :asc)\n @categories = inherited_cats + own_cats.to_a\n end\n @categories\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def categories\n get('venues/categories').categories\n end", "def crew\n crew_categories.map{ |category| parse_crew(category) }.flatten\n end", "def get_categories\n @redis.smembers category_collection_key\n end", "def list\n @categories = current_user.categories.where locked: false\n end", "def categories\n if @categories.nil?\n @categories = []\n category_nodes =\n FeedTools::XmlHelper.try_xpaths_all(self.channel_node, [\n \"category\",\n \"dc:subject\"\n ])\n unless category_nodes.nil?\n for category_node in category_nodes\n category = FeedTools::Category.new\n category.term = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@term\",\n \"text()\"\n ], :select_result_value => true)\n category.term.strip! unless category.term.blank?\n category.label = FeedTools::XmlHelper.try_xpaths(\n category_node, [\"@label\"],\n :select_result_value => true)\n category.label.strip! unless category.label.blank?\n category.scheme = FeedTools::XmlHelper.try_xpaths(category_node, [\n \"@scheme\",\n \"@domain\"\n ], :select_result_value => true)\n category.scheme.strip! unless category.scheme.blank?\n @categories << category\n end\n end\n end\n return @categories\n end", "def category_list_builder\n categories = API.get_categories\n categories.each do |cat|\n Category.new(cat)\n end\n end", "def index\n # @categories = current_user.categories\n @categories = Category.accessible_by(current_ability).all\n end", "def set_categories\n @categories = Category.order(:name).pluck(:name, :id)\n end", "def category_names\n @category_names || categories.map(&:name).join(' ')\n end", "def _build_category_list\n raw_categories = CatAPI.get_categories\n category_list = raw_categories.map {|category| category['name']}.sort\n # the \"kittens\" category is empty, and never returns photos\n category_list.delete(\"kittens\")\n return category_list.unshift(\"your favorites\")\nend", "def categories\n category_keys.collect(&:to_s)\n end", "def categories\n raw_categories.to_hashugar\n end", "def multiple_categories\n @categories = Category.all\n end", "def index\n @message_categories = current_user.message_categories\n end", "def categories\n categories = []\n @deck.cards.map do |turn|\n categories << turn.category\n end\n categories.uniq!\n end", "def user_available_categories\n Category.select('name').\n where(\"user_id = ?\", current_user.id).\n pluck(:name)\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def meal_categories\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/list.php?c=list\n content = api_call('list.php?c=list')\n validate(content)\n content\n end", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def all_news_category_names\n categorizations = NewsItemCategorization.where(news_item_id: id)\n category_names = NewsCategory.where(id: categorizations.pluck(:news_category_id)).pluck(:name).join(', ')\n end", "def category_types\n @category_types.each\n end", "def categories\n @categories ||= (@doc/\"Category\").collect { |it| Element.new(it) }\n end", "def categories\n return [] if @feed.channel.categories.empty? && @feed.channel.dc_subjects.empty?\n [@feed.channel.categories, ((@feed.channel.dc_subjects.empty?) ? nil : @feed.channel.dc_subjects)].flatten.uniq.compact.collect{|c| c.content}.reject{|c| c == '' || c.match(/^\\s+$/)}\n end", "def index\n @categories = Category.where(user_id: current_user.id)\n end", "def categories\n add_to_query restrict_kind: 'category'\n end", "def index\n @all_categories = CateItem.all\n end", "def categories\n Category.categories_for_movie self\n end", "def fetch_all_categories\n everything = @@news_api.get_everything(\n language: 'en',\n sources:'techcrunch,talksport,the-next-web,\n national-geographic, al-jazeera-english,\n crypto-coins-news',\n page: 1\n )\n end", "def categories\n rpg_shop.handled_categories\n end", "def index\n @categories = Category.all\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 getCategories()\n\t\tcat = Array.new\n\t\tcat.push(\"heroku\")\n\t\tcat.push(\"go\")\n\t\tcat.push(\"github\")\n\t\tcat.push(\"docker\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"apache\")\n\t\tcat.push(\"html\")\n\t\tcat.push(\"bootstrap\")\n\t\tcat.push(\"java ee\")\n\t\tcat.push(\"javafx\")\n\t\tcat.push(\"java\")\n\t\tcat.push(\"jquery\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"c++\")\n\t\tcat.push(\"laravel\")\n\t\tcat.push(\"linux\")\n\t\tcat.push(\"opengl\")\n\t\tcat.push(\"sml\")\n\t\tcat.push(\"javascript\")\n\t\tcat.push(\"mongo db\")\n\t\tcat.push(\"c\")\n\t\tcat.push(\"yacc\")\n\t\tcat.push(\"circuit\")\n\t\tcat.push(\"php\")\n\t\tcat.push(\"mysql\")\n\t\tcat.push(\"node js\")\n\t\tcat.push(\"photoshop\")\n\t\tcat.push(\"rails\")\n\t\tcat.push(\"postgres\")\n\t\tcat.push(\"ruby\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"mac osx\")\n\t\tcat.push(\"sass\")\n\t\tcat.push(\"ubuntu\")\n\t\tcat.push(\"bower\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"css\")\n\t\tcat.push(\"hosted\")\n\t\tcat.push(\"python\")\n\t\tcat.push(\"maven\")\n\t\tcat.push(\"maven mojo\")\n\t\tcat.push(\"composer\")\n\t\tcat.push(\"mips\")\n\t\tcat.push(\"gulp\")\n\t\tcat.push(\"grunt\")\n\t\tcat.push(\"phpstorm\")\n\t\tcat.push(\"react\")\n\t\tcat.push(\"swift\")\n\t\tcat.push(\"wordpress\")\n\t\tcat.push(\"tomcat\")\n\t\tcat.push(\"redis\")\n\t\tcat.push(\"travis\")\n\t\treturn cat\n\tend", "def categories\n notify Category.all(:order => \"name ASC\").collect {|c| c.name_with_id }.join(\"\\n\")\n end", "def categories(args={})\n res = api_request('private.request.getCategories', 'GET')\n res = JSON.parse(res)['category'] rescue []\n\n unless args[:include_deleted] and args[:include_deleted] == true\n res.reject!{|k, v| v['fDeleted'] == '1'} rescue []\n end\n \n return res\n end", "def categories()\n @web.get('http://www.waymarking.com/cat/categorydirectory.aspx') do |page|\n ile = 0\n #puts page.parser.to_html.to_s\n cache = {}\n\n page.parser.css('div#content div.gutter a').each do |cat|\n href = cat.attr('href')\n m = Category::GUID_REGEXP.match href\n key = Waymarking::Utils.parameterize(cat.text)\n unless m.nil? then\n ile +=1\n raise DuplicatedCategory if cache.has_key? key\n\n cache[key] = m[1]\n #puts \"#{ile} #{key} #{cat.text} #{m[1]}\"\n else\n puts href\n end\n\n end\n\n cache2 = {}\n cache.keys.each do |key|\n @web.get(\"http://www.waymarking.com/cat/details.aspx?f=1&guid=#{cache[key]}&exp=True\") do |page2|\n begin\n cat = Waymarking::Category.from_html(page2)\n cache2[key] = cat\n rescue\n puts key\n end\n end\n end\n\n File.open('categories.yml', 'w') do |f|\n f.write YAML::dump(cache2)\n end\n end\n end", "def index\n\t\t@post_categories = SpudPostCategory.grouped\n\t\trespond_with @post_categories\n\tend", "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end", "def categories\n nodes = @doc.xpath(\"atom:feed/atom:category\", ::AtomFeed::NS) || []\n nodes.map { |node| AtomCategory.new(node) }\n end", "def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end", "def set_categories\r\n @categories = Category.where('courses_count > 0').order(:name)\r\n end", "def categories\n @categories = FinanceTransactionCategory.all(:conditions => {:deleted => false}, :order => 'name asc')\n @categories = @categories.select { |x| x.accessible? }\n @category_ids = @categories.map { |cat| cat.id if FinanceTransaction.find_by_category_id(cat.id).present? }.compact\n @multi_config = FinanceTransactionCategory.get_multi_configuration\n @fee_category_present = FinanceFeeCategory.first\n # @fixed_categories = @categories.reject { |c| !c.is_fixed }\n # @other_categories = @categories.reject { |c| c.is_fixed }\n end", "def index\n\t\t@categories = Category.all\n\tend", "def categories\n if nodes = @node.xpath(\"category\")\n nodes.map { |node| RSSCategory.new(node) }\n end\n end", "def index\n @category_to_categories = CategoryToCategory.all\n end", "def index\n @mcategories = Mcategory.all\n end", "def index\n @admin_categories = Admin::Category.all\n end", "def populate_items\n items = {}\n Game::current.crowd_members['category'].keys.each do |crowd_member|\n items[\"crowd_members.category.\"+crowd_member] = crowd_member.humanize\n end\n items\n end", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def all_categories\n stories.map(&:category).delete_if {|c| c.nil?}.uniq\n end", "def index\n @mk_categories = MkCategoria.all\n end", "def index\n @categories = Category.roots\n end", "def getCategoryList\n categoryDump = @course.assessment_categories\n categories = {}\n for cat in categoryDump do\n categories[cat.name] = cat.id\n end\n return categories\n end", "def index\n\t@categories = Category.all\n\tend", "def budget_categories_data\n # @budget.budget_items.collect { |budget_item| budget_item.category.name.to_s }.to_json\n categories = Category.for_budget.to_a\n categories << Category.find_by_name(\"Miscellaneous\")\n return categories.collect { |category| category.name.to_s }.to_json\n end", "def categories_as_basic_with_all(returned = [])\r\n returned << categories.map { |x| { id: x.id, name: x.name }}\r\n returned.insert(0, { id: 0, name: \"All Categories\" })\r\n\r\n returned.flatten(1)\r\n end", "def crew_categories\n array = []\n full_credits.css('h4.dataHeaderWithBorder').reject{ |h| h['id'] == 'cast' }.map do |node|\n array << (node.children.size > 1 ? node.children.first.text.strip_whitespace : node.children.text.strip_whitespace)\n end\n\n array\n end", "def categories\n @categories ||= wayfinder.decorated_vocabularies.sort_by(&:label)\n end", "def fresh_categories\n # these are the categories that will be displayed by default\n # in the html view\n return {\n \"speakerData\" => {\"label\" => \"Character Direct Speech\", \"data\" => []},\n \"indirectData\" => {\"label\" => \"Character Indirect Diction\", \"data\" => []},\n \"traitData\" => {\"label\" => \"Trait: Character Type\", \"data\" => []}, \n \"genderData\" => {\"label\" => \"Trait: Character Sex\", \"data\" => []},\n \"maritalStateData\" => {\"label\" => \"Trait: Character Marriage Status\", \"data\" => []},\n \"socecStatusData\" => {\"label\" => \"Trait: Character Class Status\", \"data\" => []},\n \"ageData\" => {\"label\" => \"Trait: Character Age\", \"data\" => []},\n \"occupationData\" => {\"label\" => \"Trait: Character Occupation\", \"data\" => []},\n }\nend", "def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end", "def index\n @categories = Category.includes(:user).all\n end", "def index\n @admin_categories = Category.all\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def categories_items\n all_items = self.all_active_items\n categories_given_items(all_items)\n end", "def index\n @forum_categories = ForumCategory.all\n end", "def all_category_ids\n end", "def list\n categories = Meal.distinct.pluck(:category)\n meal_list = []\n categories.each { |category|\n obj = {\n groupName: category.capitalize,\n options: Meal.where(category: category).select(:id, :name)\n }\n meal_list.push(obj)\n }\n\n render json: meal_list\n end", "def categories\n categories = Array.new\n unless self.category.nil?\n categories << self.category\n categories += self.category.ancestors\n end # unless\n categories.reverse\n end", "def readable_categories\n # {{{\n if !@readable_categories then\n parent_group_ids = []\n if respond_to?(:parent_groups) then\n parent_group_ids = parent_groups.map { |g| g.user_group_id }\n end\n if is_registered? then\n @readable_categories = Category.select { |c| \n c.where((Category.public_readable == 't') | \n (Category.registered_readable == 't') | \n (Category.category_id.in(User_Category.select(User_Category.category_id) { |ucid|\n ucid.where((User_Category.user_group_id.in(parent_group_ids + [ user_group_id ])) &\n (User_Category.read_permission == 't'))\n })\n ))\n c.order_by(:category_name, :asc)\n }.to_a\n else\n @readable_categories = Category.select { |c| \n c.where((Category.public_readable == 't') |\n (Category.category_id.in(User_Category.select(User_Category.category_id) { |ucid|\n ucid.where((User_Category.user_group_id.in(parent_group_ids + [ user_group_id ])) &\n (User_Category.read_permission == 't'))\n })\n ))\n c.order_by(:category_name, :asc)\n }.to_a\n end\n end\n @readable_categories\n end", "def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend", "def category_names\n categories.map {|category| CategoryCode[category]}\n end", "def category_members(category, options = {})\n titles = []\n apfrom = nil\n begin\n form_data = options.merge(\n {'action' => 'query',\n 'list' => 'categorymembers',\n 'apfrom' => apfrom,\n 'cmtitle' => category,\n 'cmlimit' => @options[:limit]})\n res, apfrom = make_api_request(form_data, '//query-continue/categorymembers/@apfrom')\n titles += REXML::XPath.match(res, \"//cm\").map { |x| x.attributes[\"title\"] }\n end while apfrom\n titles\n end", "def new_objects\n @gadget = Gadget.new\n \n @allCategories = Category.order(\"id asc\").all.map{|u| [u.name, u.id]}\n end", "def set_all_categories\n @all_categories = Category.all.order_by_name\n end", "def generate_categories\n Category.destroy_all\n\n puts 'Generating categories'\n\n Category.create(name: 'photo')\n Category.create(name: 'type')\n # Category.create(name: 'effectiveness')\nend", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def set_categories\n @categories = Category.all\n end" ]
[ "0.70732063", "0.6997297", "0.6969978", "0.6944401", "0.69091105", "0.68944246", "0.68920505", "0.67822933", "0.67502624", "0.66614443", "0.66363066", "0.66168374", "0.66168374", "0.66168374", "0.6612657", "0.658876", "0.6573312", "0.65683186", "0.6555905", "0.6533568", "0.65282094", "0.65250474", "0.65161633", "0.65102994", "0.6479788", "0.64478546", "0.6447146", "0.6435141", "0.6416058", "0.6412982", "0.64020956", "0.63997734", "0.63927186", "0.6381837", "0.6363998", "0.6359883", "0.633944", "0.63315123", "0.63289803", "0.6317222", "0.6287382", "0.6285109", "0.627492", "0.62726897", "0.62655205", "0.625935", "0.6255374", "0.625349", "0.62504435", "0.62436956", "0.62393296", "0.62374204", "0.62230015", "0.62228614", "0.61987984", "0.61908484", "0.6186215", "0.61857575", "0.61705893", "0.616554", "0.61653435", "0.6163789", "0.6160285", "0.61500734", "0.6149403", "0.6143629", "0.6131616", "0.61278313", "0.6125703", "0.6119596", "0.6114358", "0.6111137", "0.61006683", "0.6094618", "0.6092608", "0.60925865", "0.6092459", "0.60784286", "0.6059324", "0.6054623", "0.6050555", "0.6041779", "0.6041521", "0.6040884", "0.60371125", "0.6028576", "0.6023507", "0.6022122", "0.6018664", "0.60172254", "0.6016596", "0.60152113", "0.60104245", "0.600715", "0.6006979", "0.6006866", "0.59937996", "0.59930503", "0.5987228", "0.597447", "0.5968007" ]
0.0
-1
Returns all circles = (global + user's)
def all_circles (circles + Circle.globals).uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users\n @circle.keySet.to_a\n end", "def current_circle(host_id = self.current_host_id)\n if host_id and (rel = relationships.find_by_user_id(host_id))\n rel.circle\n else\n circles.first\n end\n end", "def list_people_by_circle(params = {})\n return false unless check_required_params(params, ['circleId'])\n\n execute_with_api({\n :args => [\n @plus_api.people.list_by_circle,\n params\n ]\n })\n end", "def sub_circles\n Circle.where(super_circle_id: id)\n end", "def circle_nodes(width=@width, height=@height, nodeset=@nodes)\n center = Vector[width/2, height/2]\n radius = [width,height].min/2\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = Vector[\n center[0] + (radius * Math.sin(Math::PI/4+2*Math::PI*i/nodeset.length)), \n center[1] - (radius * Math.cos(Math::PI/4+2*Math::PI*i/nodeset.length))] if !nodeset[key].static}\n end", "def points_on_circle(center, normal, radius, numseg)\r\n # Get the x and y axes\r\n axes = Geom::Vector3d.new(normal).axes\r\n center = Geom::Point3d.new(center)\r\n xaxis = axes[0]\r\n yaxis = axes[1]\r\n \r\n xaxis.length = radius\r\n yaxis.length = radius\r\n\r\n # compute the points\r\n da = (Math::PI * 2) / numseg\r\n pts = []\r\n for i in 0...numseg do\r\n angle = i * da\r\n cosa = Math.cos(angle)\r\n sina = Math.sin(angle)\r\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\r\n pts.push(center + vec)\r\n end\r\n \r\n # close the circle\r\n pts.push(pts[0].clone)\r\n\r\n pts\r\nend", "def mycircles\n #iau cercurile userului\n @circles = current_user.circles\n \n #redundant, dar trebuie\n @circles.each do |circle|\n circle.joined = current_user.already_joined?(circle.id)\n end\n\n @hide_invite_button = true\n \n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @circles, :include => :city }\n format.json { render json: {\n 'html' => render_to_string( partial: \"circle_header\", :as => :circle, :collection => @circles, formats: [:html])\n }, status: :created, location: @gossip }\n end\n end", "def friend_circles(matrix)\nend", "def points_for_circle(x, y, r)\n cur_page.points_for_circle(x, y, r)\n end", "def circle radius, foreground, background\n coords = [-radius, -radius, radius, radius]\n \"oval#{coords.join(\",\")},fc:#{foreground},oc:#{background}\"\nend", "def _generate_circle\n total_weight = 0\n \n @nodes.each do |node|\n total_weight += @weights[node.to_s] || 1\n end\n\n @nodes.each do |node|\n weight = @weights[node.to_s] || 1\n factor = ((40 * @nodes.length * weight) / total_weight.to_f).floor.to_i\n\n factor.times do |j|\n b_key = self._hash_digest(\"#{node}-#{j}\")\n\n 3.times do |i|\n key = self._hash_val(b_key) { |x| x+(i*4) }\n @ring[key] = node\n @_sorted_keys.push(key)\n end\n end\n end\n\n @_sorted_keys.sort!\n end", "def find_all_gym_users\n self.gym_user_instances.map{|user| user.name } \n end", "def index\n @circle = current_user.circle\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @circle }\n end\n end", "def bresenham_circle_coordinates\n coordinates = []\n\n populate_symmetric = -> (x, y) {\n coordinates << [x, y]\n coordinates << [x, -y]\n coordinates << [-x, -y]\n coordinates << [-x, y]\n coordinates << [y, x]\n coordinates << [y, -x]\n coordinates << [-y, -x]\n coordinates << [-y, x]\n }\n\n # start from the upper point of the circle\n x = 0\n y = @r\n\n delta = 3 - 2 * y\n\n while x <= y do\n populate_symmetric[x, y]\n\n if delta < 0\n delta += 4 * x + 6\n else\n delta += 4 * (x - y) + 10\n y -= 1\n end\n\n x += 1\n end\n\n # move circle to proper center position\n coordinates.uniq.map { |x, y| [x + @x, y + @y] }\n end", "def circle\n @followers = @customer.followers\n @followeds = @customer.followeds\n # follow activity on pages\n # we keep track of the current customer in impressions\n @current_user = current_customer\n impressionist(@customer)\n end", "def all_users\n\t\tshared_users.map(&:id).join(\", \")\n\tend", "def find_root(circles=nil, roles=nil)\n circles ||= self.get :circles\n roles ||= self.get :roles\n Glassfrog::Graph.root(circles, roles)\n end", "def user_graph\n set = self.personal_account? ? {} : self.company.cached_users\n set.merge! self.recognition_graph \n return set\n end", "def circle(radius)\n pixels = []\n \n @width.times do |x|\n row = Array.new(@height, nil)\n \n @height.times do |y|\n pixel = 0\n @density.times do |i|\n xx = (x + i.to_f/@density) - @x_offset\n yy = f_halfcircle(xx, radius)\n yt = yy + @y_offset\n yb = -yy + @y_offset\n\n if (yt >= y && yt < y + 1) || (yb >= y && yb < y + 1)\n pixel = 1\n end\n end\n row[y] = pixel\n end\n pixels << row\n end\n \n PNM.create(pixels.transpose.reverse!, {:type => :pbm})\n end", "def cur_oaths\n BloodOath.all.select {|bloodoath| bloodoath.cult == self}\n end", "def list_activities_by_circle(params = {})\n return false unless check_required_params(params, ['circleId'])\n\n execute_with_api({\n :args => [\n @plus_api.activities.list_by_circle,\n params\n ]\n })\n end", "def cur_oaths\n BloodOath.all.select {|bloodoath| bloodoath.follower == self}\n end", "def circle_info(radius)\n {:area => Math::PI * (radius * radius),\n :perimeter => Math::PI * (2 * radius),\n :sphere_volume => ((4/3)* Math::PI * (radius ** 3)),\n :sphere_surface_area => (4* (Math::PI * (radius * radius)))}\nend", "def roots_global_or_owned_by(user)\n find(:all, :conditions => ['property_types.parent_id = 1 AND (property_types.is_global = 1 OR property_types.user_id = ?)', user.id], :order => 'property_types.created_at ASC')\n end", "def getAllClassmates\n # get all user courses and for each course get all the classmates, remove duplicates and the self user from the array before sending it back\n allClassmates = []\n courses = Course.where(\"user_id = '#{self.id}'\")\n courses.each do |course|\n course.getClassmates.each do |classmate|\n allClassmates.push(classmate)\n end\n end\n return (allClassmates - [self]).uniq\n end", "def index\n if current_user.role == \"admin\"\n @user_role_change = true\n @users = User.all\n elsif current_user.member.category == \"kore\" \n @user_role_change = false\n circle = Circle.where(:id => current_user.member.main_circle).first\n members = circle.members\n @users = []\n members.each do |m|\n @users << m.user if m.user\n end\n puts @users\n else\n redirect_to root_path\n end\n end", "def incircle\n # Circle.new(self.incenter, self.inradius)\n end", "def nearby\n if current_user.lat\n dist = 1.5\n minlat = current_user.lat - dist\n maxlat = current_user.lat + dist\n minlon = current_user.lon - dist\n maxlon = current_user.lon + dist\n @users = DrupalUsers.find(:all, :conditions => [\"lat != 0.0 AND lon != 0.0 AND lat > ? AND lat < ? AND lon > ? AND lon < ?\",minlat,maxlat,minlon,maxlon])\n end\n end", "def index\n # show overview of users (both walkers and non-walkers)\n # allow user to filter on (non-)walkers\n # position of these people should be shown on a map (aprox. not exact)\n\n # start with 10 users\n # radius = 10km\n LoadNearbyUsers(10, false, current_user.id);\n end", "def active_copoolers\n sql = \"SELECT DISTINCT ON (u.id) u.* FROM users u JOIN pools p ON p.user_id = u.id\n WHERE p.is_active = true\n AND p.user_id != :uid\n AND p.trip_id in (:tids)\"\n vars = {uid: id, tids: trips.ids}\n @active_copoolers = User.find_by_sql [sql,vars]\n end", "def generate_all_connections!\n organisation_level_connections = []\n\n self.has_members.each do |member_uri|\n member = Person.find(member_uri)\n organisation_level_connections << member.get_connections!\n end\n\n organisation_level_connections.flatten\n end", "def user_ring\n\t user.ring\n\tend", "def bmp_circle(color = Color.new(255,255,255), r = (self.width/2), tx = (self.width/2), ty = (self.height/2), hollow = false)\n # basic circle formula\n # (x - tx)**2 + (y - ty)**2 = r**2\n for x in 0...self.width\n f = (r**2 - (x - tx)**2)\n next if f < 0\n y1 = -Math.sqrt(f).to_i + ty\n y2 = Math.sqrt(f).to_i + ty\n if hollow\n self.set_pixel(x, y1, color)\n self.set_pixel(x, y2, color)\n else\n self.fill_rect(x, y1, 1, y2 - y1, color)\n end\n end\n end", "def users\n User.where(network_id: context[:current_network]&.id)\n end", "def cur_followers\n self.cur_oaths.map {|bloodoath| bloodoath.follower}\n end", "def iterate\n self.mec ||= Circle.new\n # Handle degenerate cases first\n if @points.size == 1\n self.mec.center = @points.to_a[0]\n self.mec.radius = 0\n elsif @points.size == 2\n a = @points.to_a\n self.mec.center = a[0].center(a[1])\n self.mec.radius = a[0].distance(self.mec.center)\n else\n puts \"points = #{@points.map{|p| p.to_s}.join(\", \")}\" if @debug\n a = convex_hull\n puts \"convex hull = #{a.map{|p| p.to_s}.join(', ')}\" if @debug\n point_a = a[0]\n point_c = a[1]\n while (true)\n point_b = nil\n best_theta = 180.0;\n for point in @points\n if point != point_a && point != point_c\n theta_abc = point.angle_between(point_a, point_c)\n puts \"a: #{point_a} c: #{point_c} p: #{point} best_theta: #{best_theta} theta_abc: #{theta_abc}\" if @debug\n if theta_abc < best_theta\n point_b = point\n best_theta = theta_abc\n end\n end\n end\n puts \"Found best theta: #{best_theta}, a = #{point_a}, b = #{point_b}, c = #{point_c}\" if @debug\n if best_theta >= 90.0 || point_b.nil?\n self.mec.center = point_a.center(point_c)\n self.mec.radius = point_a.distance(self.mec.center)\n return self.mec\n end\n ang_bca = point_c.angle_between(point_b, point_a)\n ang_cab = point_a.angle_between(point_c, point_b)\n puts \"ang_bca = #{ang_bca}, ang_cab = #{ang_cab}\" if @debug\n if ang_bca > 90.0\n point_c = point_b\n elsif ang_cab <= 90.0\n puts \"breaking ...\" if @debug\n break\n else\n point_a = point_b\n end\n end\n ch1 = (point_b - point_a).scale(0.5)\n ch2 = (point_c - point_a).scale(0.5)\n n1 = ch1.normal_left\n n2 = ch2.normal_left\n ch1 = point_a + ch1\n ch2 = point_a + ch2\n self.mec.center = Point.inf_line_intersection(ch1, n1, ch2, n2)\n self.mec.radius = self.mec.center.distance(point_a)\n end\n self.mec\n end", "def find_radi(xy, cluster)\n north = north_radius(xy, cluster)\n south = south_radius(xy, cluster)\n east = east_radius(xy, cluster)\n west = west_radius(xy, cluster)\n ne = ne_radius(xy, cluster)\n nw = nw_radius(xy, cluster)\n se = se_radius(xy, cluster)\n sw = sw_radius(xy, cluster)\n\n all = [north, south, east, west, ne, nw, se, sw]\n return all\n end", "def circle_nodes_at_point(nodeset=@nodes, center=Vector[@width/2,@height/2], radius=[@width,@height].min/2, reverse=false, offset=0)\n nodeset.each_with_index{|(key, node), i| nodeset[key].location = Vector[\n center[0] + (radius * Math.sin(offset+2*Math::PI*i/nodeset.length)), \n center[1] - (radius * Math.cos(offset+2*Math::PI*i/nodeset.length))]}\n end", "def sp_points_on_circle(center, normal, radius, numseg, rotAngle)\n # Get the x and y axes\n axes = Geom::Vector3d.new(normal).axes\n center = Geom::Point3d.new(center)\n xaxis = axes[0]\n yaxis = axes[1]\n xaxis.length = radius\n yaxis.length = radius\n rotAngle = 0.0 unless rotAngle.is_a?(Numeric)\n # Compute the points\n da = (Math::PI*2) / numseg\n pts = []\n for i in 0...numseg do\n angle = rotAngle + (i * da)\n cosa = Math.cos(angle)\n sina = Math.sin(angle)\n vec = Geom::Vector3d.linear_combination(cosa, xaxis, sina, yaxis)\n pts.push(center + vec)\n end\n # Close the circle\n pts.push(pts[0].clone)\n pts\n end", "def all_oaths\n Bloodoath.all.select {|oath| oath.cult == self}\n #can call .cult because of attr reader in bloodoath\n end", "def all_degrees_of_separation(entity)\n if entity.is_a?(Sociographer::Entity)\n # @@neo = Neography::Rest.new\n self_node = self.get_node\n entity_node = entity.get_node\n if self_node && entity_node\n paths = []\n self_node.all_simple_paths_to(entity_node).incoming(:friends).depth(5).nodes.each do |path|\n # path << node.object_type.safe_constantize.find(node[\"object_id\"])\n in_between = path.map{|n| begin {entity_type: n.object_type, entity_id: n[:object_id]} rescue Exception end }\n path = {length: path.size-1, users: in_between}\n paths << path\n # puts \"#{(path.size - 1)} degrees: \" + path.map{|n| begin n.object_type.safe_constantize.find(n[:object_id]).name rescue Exception end }.join(\" => friends =>\") \n end\n return paths\n else\n false\n end\n else\n false\n end\n end", "def circle x, y, r, c, fill = false\n screen.draw_circle x, y, r, color[c], fill, :antialiased\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def users\n if @group\n @users ||= @group.users.tracking_enabled.with_waypoints.order(:name)\n else\n @users ||= User.tracking_enabled.with_waypoints.order(:name)\n end\n end", "def get_arc_points(cx,cy,radius, beg_angle, end_angle, degree_inc = 1.0)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n deg = beg_angle\r\n degree_inc = degree_inc.abs\r\n ares = Array.new\r\n while (deg < end_angle)\r\n #print \"(deg = \", deg, \")\\n\"\r\n cp = calc_point_from_angle(cx,cy, deg, tradius)\r\n ares.append(cp)\r\n deg += degree_inc\r\n end #while\r\nend", "def circle(option={})\n set RGhost::Circle.new(options)\n end", "def org_users\n synchronize { return @org_users if @org_users }\n\n users = {}\n orgs = settings.github_orgs || []\n orgs.each do |org|\n octokit.organization_members(org).each do |user|\n if users.has_key?(user.login)\n users[user.login][:orgs] << org\n else\n users[user.login] = user.to_h\n users[user.login][:mfa_enabled] = true\n users[user.login][:orgs] = [org]\n end\n end\n end\n orgs.each do |org|\n octokit.organization_members(org, filter: '2fa_disabled').each do |user|\n users[user.login][:mfa_enabled] = false\n end\n end\n\n synchronize { @org_users = users }\n end", "def users\n return @canonical_user_pool if @canonical_user_pool\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Retrieving all users\"\n check_retval @user_pool.info!\n\n @canonical_user_pool = []\n @user_pool.each { |user| @canonical_user_pool << canonical_user(user) }\n @canonical_user_pool\n end", "def guess_as_circle(x)\n if @guess_switch == 0\n @colors_as_circles = []\n end\n x.map { |c| convert_to_circle(c) }\n end", "def circle_of_blocks pass, xoffset, yoffset, angleoffset, blocksize, distance\n numblocks = 10\n\n for i in 1..numblocks do\n angle = ((360 / numblocks) * i) + angleoffset\n radians = angle * (Math::PI / 180)\n x = (xoffset + (distance * Math.cos(radians))).round\n y = (yoffset + (distance * Math.sin(radians))).round\n pass.solids << [ x, y, blocksize, blocksize, 255, 255, 0 ]\n end\nend", "def create_circles(num)\n circle_image = circle_image()\n circles = []\n num.times do\n body = CP::Body.new(1, CP::moment_for_circle(1.0, 10,10, CP::Vec2.new(0, 0))) # mass, moment of inertia\n body.p = CP::Vec2.new(rand(SCREEN_WIDTH), rand(40) - 50)\n shape = CP::Shape::Circle.new(body, 10, CP::Vec2.new(0, 0))\n shape.e = 0.4\n shape.u = 0.4\n circles << AObject.new(circle_image, body)\n @space.add_body(body)\n @space.add_shape(shape) \n end\n return circles\n end", "def cults \n oaths = BloodOath.all.find_all {|oath| oath.follower == self}\n oaths.map {|oath| oath.cult}\n # oaths = BloodOath.all.find_all do |oath| \n # oath.follower == self\n # end\n\n # oaths.map do|oath| \n # oath.cult\n # end \n end", "def singleton_nodes\n all_node_ids = Node_Query.new(analysis_window: aw).run.first[:objects].collect{|n| n.id}.uniq\n all_nodes_in_ways = Way_Query.new(analysis_window: aw).run.first[:objects].collect{|w| w.nodes}.flatten.uniq\n # all_nodes_in_rels = Relation_Query.new(analysis_window: aw).run.first[:objects].collect{|r| r.nodes}.flatten.uniq\n nodes_not_in_ways_or_rels = (all_node_ids - all_nodes_in_ways).length\n puts \"Total Nodes: #{all_node_ids.length}, Nodes not in ways or relations: #{nodes_not_in_ways_or_rels}\"\n puts \"Percentage: #{nodes_not_in_ways_or_rels.to_f / all_node_ids.length.to_f}\"\n end", "def managed_working_groups circle\n if can?(:manage, circle)\n circle.working_groups\n else\n circle.working_groups.select{|wg| can?(:manage, wg)}\n end\n end", "def index\n if current_user\n @evaluations = current_user.readable_evaluations\n else\n @circle = Circle.where(name: 'Public').try(:first)\n @evaluations = @circle.present? ? @circle.evaluations : []\n end\n user_ids = @evaluations.map(&:created_by_id)\n @users = User.in(id: user_ids)\n @users = @users.index_by(&:id)\n end", "def gym_memberships\n self.my_memberships.map {|membership_instance| membership_instance.gym}.uniq\n end", "def getAsCircle\n @node\n end", "def circle x, y, r, c, fill = false\n screen.draw_circle x, h-y, r, color[c], fill, :antialiased\n end", "def draw_force_circle(context, center, radius)\n rectangle = CGRectMake(center.x - radius, center.y - radius, radius*2, radius*2)\n CGContextSetStrokeColorWithColor(context,UIColor.redColor.CGColor)\n CGContextSetLineWidth(context, 5)\n CGContextAddEllipseInRect(context, rectangle)\n CGContextStrokePath(context)\n end", "def nine_point_circle\n # Circle.new(*self.medial.vertices)\n end", "def current_holders\n badge_nominations.select{ |bn| bn.accepted? }.map{ |bn| bn.user }\n end", "def check_marked_circles \n circles.each do |circle|\n if circle.marked?\n update_count_of_marked_circles(circle.position_x, circle.position_y) \n end\n end\n end", "def index\n @circles = Circle.all\n end", "def friends\n @user ||= auth_user\n friends = ::User.search_users_in_circle(@user).results\n following_user_ids = ::Stores::Following.where(user_id: @user.id).collect(&:follower_user_id) # others following user\n followings = ::Stores::Following.where(follower_user_id: @user.id).includes(:user).order('last_traded_at desc, id desc') # user following others, already ordered newest to oldest\n followed_user_ids = Set.new # for excluding the non-followers\n both_side_followers = []\n one_side_followers = []\n bound = :circle\n user_ids_to_exclude = []\n auth_user.boundaries.group_by(&:type).each do|btype, blist|\n case btype\n when 'Users::ChildCircleOption'\n case blist.first.content_keyword\n when 'GRADE_ONLY'\n bound = :grade\n when 'CLASS_ONLY'\n bound = :class\n end\n when 'Users::UserBlock'\n user_ids_to_exclude = user_ids_to_exclude + ::Users::Boundary.extract_content_values_from_list(blist)\n end\n end\n followings.each do|following|\n user = following.user\n is_mutual = following_user_ids.include?(following.user_id) # y is also following user\n user.is_follower = true\n user.is_mutual_friend = is_mutual\n if is_mutual\n both_side_followers << user.as_more_json({}, auth_user.id)\n else\n if bound.eql? :circle and ::Schools::SchoolGroup.grades_around(auth_user.grade).include?(user.grade)\n one_side_followers << user.as_more_json({}, auth_user.id)\n elsif bound.eql? :grade and auth_user.grade.eql?(user.grade)\n one_side_followers << user.as_more_json({}, auth_user.id)\n elsif bound.eql? :class and auth_user.teacher.eql? user.teacher\n one_side_followers << user.as_more_json({}, auth_user.id)\n end\n end\n logger.debug \" | %20s | %1s | %10d\" % [user.user_name, is_mutual ? 'B' : 's', following.id]\n followed_user_ids << following.user_id\n end\n non_followers = friends.find_all {|friend| !followed_user_ids.include?(friend.id) }.sort{|x,y| y.id <=> x.id } # newest registered friends\n logger.debug \"-------- #{both_side_followers.size} both side, #{one_side_followers.size} one side, #{non_followers.size} non-followers\"\n @friends = both_side_followers + one_side_followers + non_followers.as_json\n #if they're blocked, remove them regardless.\n result = @friends.map do |friend|\n if not user_ids_to_exclude.include?(friend['id'])\n friend\n else\n nil\n end\n end\n result = result.compact\n respond_to do|format|\n format.json { render json:{ success: true, users: result} }\n format.html\n end\n end", "def c_radius \n Math.sqrt((@x*@x)+(@y*@y))\n end", "def point_list\n @user_point = UserPoint.find_by_user_id(current_user.id)\n end", "def index\n @pigeons = current_user.pigeons\n @shared_pigeons = current_user.shared_pigeons\n end", "def find_all_organizations\n get_url(\"https://api.github.com/users/#{current_user.username}/orgs\")\n end", "def all_users\n Skype.find_users_of_type \"ALL_USERS\"\n end", "def get_all_user_repos\n user = User.find_by(uuid: params[:uuid])\n\n client = Octokit::Client.new(:access_token => user.password)\n repo_list = []\n client.repositories(:user => user.gh_username).each { |repo|\n repo_list.push(repo.name)\n }\n render :json => {:repos => repo_list}\n end", "def draw(r)\n (-radius..radius).each do |x|\n (-radius..radius).each do |y|\n print distance_from_center(x,y).round == radius ? '#' : '.'\n end\n puts\n end\n end", "def userSpecificProjects\n #@specific_user = User.find(6) #TEMPORARY: REMOVE LATER\n @specific_user = current_user\n @specific_user_groups = @specific_user.groups\n @specific_user_projects = []\n\n @specific_user_groups.find_each(:batch_size => 5000) do |group|\n group.projects.find_each(:batch_size => 5000) do |project|\n @specific_user_projects << project\n end\n end\n end", "def all_unique_city_values\n sparql = \"\n SELECT DISTINCT ?city\n WHERE \n {\n GRAPH <http://data.artsapi.com/graph/organisations> {\n ?org <http://data.artsapi.com/def/arts/locationCity> ?city .\n }\n }\"\n\n results = User.current_user.within { Tripod::SparqlClient::Query.select(sparql) }\n\n results.map { |r| r[\"city\"][\"value\"] }\n end", "def stack_circles\n classes = Settings.needed_for_win.times.map { |index| @stack.size >= index ? :me : :you }\n content = classes.map { |css_class| content_tag(:div, \"\", class: \"circle #{css_class}\") }\n content_tag(:div, safe_join(content), class: 'circles')\n end", "def calculate_circle_area(radius)\nend", "def calculate_circle_area(radius)\nend", "def set_circle_user\n @circle_user = CircleUser.find(params[:id])\n end", "def circleArea(r)\n PI * r ** 2 \nend", "def calculate_coordinates\n bresenham_circle_coordinates\n end", "def facebook_neighbors(depth = 2)\n User.where(:external_user_id => facebook_neighbors_ids(depth))\n end", "def all_cops?; end", "def get_users\n @get_users = Rails.cache.fetch(\"get_aside_users\", :expires_in => 1.hours) do\n if @current_user.present?\n Core::User.active.where(\"verified = 1 AND id != #{@current_user.id}\").order(position: :desc, created_at: :desc).limit(10).sample(3)\n else\n Core::User.active.where(\"verified = 1\").order(position: :desc, created_at: :desc).limit(10).sample(3)\n end\n end\n end", "def index\n\n min_tolerance = 0.1\n max_tolerance = 2 # ~200km\n tolerance = min_tolerance\n \n if params[:tag]\n # search by tags\n @circles = Circle.tagged_with(params[:tag]).paginate(:page => params[:circle_page], :per_page => 100)\n\n else\n # search by location\n client_ip = request.remote_ip\n @c = GeoIP.new('data/GeoLiteCity.dat').city(client_ip) #iau orasul\n if @c != nil\n # daca am gasit localitatea dupa IP\n # caut cercuri in orase tot mai indepartate, pana gasesc vreun cerc sau pana depasesc o limita de distanta\n while true do\n @city_id = City.find(:all, :select => 'id', :conditions => [\"abs(latitude - ?) < ? AND abs(longitude - ?) < ?\", @c.latitude, tolerance, @c.longitude, tolerance] )\n @circles = Circle.where(:city_id => @city_id).paginate(:page => params[:circle_page], :per_page => 100)\n\n if @circles.count > 0 || tolerance > max_tolerance\n break\n end\n\n tolerance = tolerance * 2\n end\n else\n # altfel, ii dau orasului id=0, adica nu am gasit orasului\n @city_id = 0 \n @circles = Circle.where(:city_id => @city_id).paginate(:page => params[:circle_page], :per_page => 100)\n @location_unknown = true\n end\n end\n\n if (@location_unknown.nil? || !@location_unknown) && @circles.count == 0 \n # known location, but no results\n @no_circles = true\n end\n\n @hide_invite_button = true\n refresh_notifications\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: {\n 'html' => render_to_string( partial: \"circle_header\", :as => :circle, :collection => @circles, formats: [:html])\n }, status: :created, location: @gossip }\n end\n end", "def my_followers_mottos \n BloodOath.all.map{|bloodoath|bloodoath.follower.life_motto}\n end", "def all_followers\n cult = Bloodoath.all.select{|bo| bo.cult == self}\n followers = cult.map{|cult| cult.follower}\n end", "def all_gyms\n Membership.all.map do |membership| \n if membership.lifter == self\n membership.gym\n end\n end\n end", "def my_followers\n cult_blood_oaths = BloodOath.all.select {|b_o_instance| b_o_instance.cult == self}\n cult_followers = cult_blood_oaths.map {|b_o_instance| b_o_instance.follower}\n cult_followers.uniq\n end", "def users\n recipe_rc = RecipeCard.all.select {|rc| rc.recipe == self}\n # recipe_rc.map {|rc| rc.user}\n end", "def owners_of_cars_serviced\n self.personal_mechanic_of.map{|owner_obj| owner_obj.name}\nend", "def friends\n active_friends + passive_friends\n end", "def get_user_connections\n request(Route.new(:GET, '/users/@me/connections'))\n end", "def users\n users = []\n if current_user.lead?\n users = object.users.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n elsif current_user.dev?\n vms_v = object.vms.select { |vm| vm.is_jenkins }\n users = vms_v.flat_map(&:user).uniq.select { |u| u.id != current_user.id }\n users = users.unshift(current_user)\n else\n users <<= current_user\n end\n users.map { |u| u.id }\n end", "def index\n @jam_circles = @user.jam_circles\n #@jam_circle = JamCircle.new\n end", "def radius\n end", "def circle_to_s(c)\n get_circle(c).collect { |p| p.to_abrv }.join(',')\n end", "def gym_user_instances\n user_names = []\n self.exercise_instances.each do |user|\n user_names << User.all.find {|user_instance| user_instance.id == user.user_id}\n end\n user_names\n \n end", "def calculate_circle_area(radius)\n area = PI * radius**2\n return area\nend", "def get_circle(location, r)\n\t\t\tstartY = location.y - r\n\t\t\t\n\t\t\tstartX = 0\n\t\t\tendX = 0\n\t\t\tif startY % 2 == 0\n\t\t\t\tstartX = location.x - (r / 2.0).floor\n\t\t\t\tendX = location.x + r;\n\t\t\telse\n\t\t\t\tstartX = location.x - (r / 2.0).floor\n\t\t\t\tendX = location.x + r;\n\t\t\t\tif r % 2 == 0\n\t\t\t\t\tstartX+=1; endX+=1;\n\t\t\t\tend\n\t\t\tend\t\n\t\t\t\n\t\t\tendY = location.y + r;\n\t\t\tcircle_width = 2 * r + 1;\n\t\t\tdelta_y_odd = -1;\n\t\t\tdelta_y_even = -1;\n\t\t\toffset = 0;\n\t\t\tcircle = Array.new;\n\t\t\tfor y in Range.new(startY, endY)\n\t\t\t\tlength = circle_width - (y - location.y).abs;\n\t\t\t\t\n\t\t\t\tif (y % 2 == 0)\n\t\t\t\t\tif (delta_y_even == -1)\n\t\t\t\t\t\tdelta_y_even = (y - location.y).abs;\n\t\t\t\t\tend\n\t\t\t\t\toffset = ((y - location.y).abs - delta_y_even) / 2;\n\t\t\t\t\t\n\t\t\t\t\tif ((location.y - r) % 2 != 0)\n\t\t\t\t\t\toffset-=1;\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tif (delta_y_odd == -1)\n\t\t\t\t\t\tdelta_y_odd = (y - location.y).abs;\n\t\t\t\t\tend\n\t\t\t\t\toffset = (((y - location.y).abs - delta_y_odd) / 2.0).floor - 1;\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tstart = startX + offset;\n\t\t\t\t#trace(\"y = \" + y + \"location = \" + location.y + \" : \" + length);\n\t\t\t\t\n\t\t\t\ts = \"\";\n\t\t\t\tfor x in Range.new(start, start + length - 1)\n\t\t\t\t\ts += x.to_s + \" \";\n\t\t\t\t\t\t\tcircle.push(Location.new(x,y));\n\t\t\t\tend\n\t\t\t\t#trace(s);\n\t\t\tend\n\t\t\treturn circle;\n\t\tend", "def all_cops\n @all_cops ||= `#{options[:cmd]} --show-cops --force-default-config`.lines.select { |l| l.match(/^\\w/) }\n end", "def circle_area(circle)\n circle.radius**2*Math::PI\nend" ]
[ "0.6532954", "0.612669", "0.58640915", "0.5796346", "0.5792323", "0.5639843", "0.5616303", "0.5605043", "0.5553211", "0.5519368", "0.547997", "0.5476148", "0.5463248", "0.5450114", "0.542147", "0.54202247", "0.53717935", "0.5331097", "0.53182536", "0.5306966", "0.53065443", "0.530156", "0.5294799", "0.5288189", "0.5259244", "0.5247929", "0.52473074", "0.52330863", "0.52324545", "0.5141344", "0.51409817", "0.51359195", "0.51260555", "0.51228887", "0.51222754", "0.5104458", "0.5094851", "0.5072717", "0.5068536", "0.5062362", "0.5060993", "0.5017105", "0.498499", "0.49805441", "0.49795443", "0.4972534", "0.49678314", "0.49648288", "0.49609008", "0.49554417", "0.49306676", "0.49209714", "0.49175593", "0.4915655", "0.4907711", "0.4906222", "0.49060228", "0.4900685", "0.4900206", "0.48988536", "0.48958272", "0.489576", "0.48777497", "0.4876245", "0.48757738", "0.48547956", "0.4852457", "0.48506626", "0.4847495", "0.48466256", "0.483426", "0.4833019", "0.48322377", "0.48312408", "0.4830582", "0.4830582", "0.4826475", "0.48243648", "0.48239017", "0.48229316", "0.48208442", "0.48084202", "0.47927943", "0.47915667", "0.47849023", "0.47753304", "0.47735158", "0.4769294", "0.4767897", "0.47669852", "0.47634077", "0.47623265", "0.47617546", "0.47584215", "0.47566915", "0.47535172", "0.47511315", "0.47484496", "0.47480425", "0.474626" ]
0.7935558
0
Adds relationship for guest
def add_guest(guest, circle = guest.circle) # Adds authorization plugin role: 'guest' of user # guests can identify their hosts with: # guest.is_guest_of_what => Array of Members # and member can identify their guests with: # member.has_guests? => true/false # member.has_guests => Array of Guests # # Things to watch out for: # g.has_role? 'guest' => false # g.has_role? 'guest, member => ArgumentError guest.is_guest_of self # Adds relationship: guest + circle relationships.create!(:guest => guest, :circle => circle) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_relationship(rel_attr); end", "def add_guest(person)\n @guests.push(person)\n end", "def add_guest(guest_to_be_added)\n @guests << guest_to_be_added\n end", "def add_as_client \n Event.create( \n :event_type => 'invitation',\n :detail_i1 => guest.id,\n :user_id => self.case.author.id\n ) \n self.case.author.add_client(guest) || true\n end", "def addrole\n\t\tself.add_role :Guest\n\tend", "def attach_relationship(data) #FIXME: Method doesn't work, RelationshipManager cannot access to id attribute.\n return @client.raw(\"post\", \"/config/relationships/attach\", nil, data)\n end", "def relationship=(value)\n @relationship = value\n end", "def one_relationship(name)\n end", "def relation_user_route event\n return if event.nil? or event.route.nil?\n\n self.user.routes << event.route\n event.route.save\n end", "def add_guests_to_room(guest)\n for person in guest\n guests.push(person)\n end\n end", "def set_guest_session_association\n @guest_session_association = GuestSessionAssociation.new(user_id:session[:user_id],jam_session_id:params[:id],player:params[:player])\n @guest_session_association.save!\n end", "def make_friendship!(other_user)\n relationship.create!(friend_id: other_user.id)\n other_user.relationship.create!(friend_id: self.id)\n return true\n end", "def add_relationship ( user , country_list, rel_type )\n country_list.each do |country_node|\n rel_instance = get_rel_instance rel_type\n rel_instance.from_node = user\n rel_instance.to_node = country_node\n rel_instance.save\n end\n end", "def set_relationship\n #find relationship\n @relationship = Relationship.find_by_id(params[:id])\n end", "def add_edge(source, target = nil, label = nil)\n @reversal = nil\n if target\n edge = Puppet::Relationship.new(source, target, label)\n else\n edge = source\n end\n [edge.source, edge.target].each { |vertex| setup_vertex(vertex) unless vertex?(vertex) }\n @vertices[edge.source].add_edge :out, edge\n @vertices[edge.target].add_edge :in, edge\n @edges << edge\n true\n end", "def add_relationship(parent_rel = nil)\n clear_relationships_cache\n all_relationships.create!(\n :relationship => (parent_rel.nil? ? relationship_type : parent_rel.relationship),\n :parent => parent_rel\n )\n end", "def foreign_object(*attributes)\n self.foreign_objects += attributes\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def set_relationship\n @relationship = Relationship.find(params[:id])\n end", "def configure_relation\n end", "def one_to_many_relationship(rel_name, definition)\n @relationships << OneToManyRelationship.new(rel_name, definition)\n end", "def has_many(name, *args, **opt)\n add_collection_property(name, *args, **opt)\n set_relation_field(name, args.first)\n end", "def add_relation(relation)\n @relations[relation.id.to_i] = relation\n relation.db = self\n end", "def attach_facet! f, resolver\n f.attach_relationship! self\n end", "def create_relationship_to_participant\n relationship_code = params[:relationship_code]\n if @participant && relationship_code\n ParticipantPersonLink.create(:participant => @participant, :person => @person,\n :relationship_code => params[:relationship_code])\n end\n end", "def create\n @guest = @wedding.guests.new(guest_params)\n\n respond_to do |format|\n if @guest.save\n\n @guest.evt.create! wedding: @wedding,\n state: 'new',\n headline: \"#{current_user.name} added #{@guest.name} to the guest list\"\n\n format.html { redirect_to wedding_guestlist_path(@wedding), notice: \"#{@guest.name} #{@guest.total_guests > 1 ? \"have\" : \"has\"} been added to the list.\" }\n format.json { render json: @guest, status: :created, location: @guest }\n else\n errors = @guest.errors.full_messages.map do |message|\n \"<li>#{message}</li>\"\n end.join\n\n format.html { redirect_to wedding_guestlist_path(@wedding), alert: \"Guest had problems: <ul>#{errors}</ul>\" }\n\n format.json { render json: @guest.errors, status: :unprocessable_entity }\n end\n end\n end", "def child_relation; end", "def startup_relationship\n Relationship.between(self.user, self.startup)\n end", "def add_edge(source, target, edge = Edge.new)\n _clear_cache\n @pathway.append(Bio::Relation.new(source, target, edge))\n edge\n end", "def set_guest\n @guests = Guest.find(params[:id])\n end", "def create_relationship(destiny, label, bidirectional=true, active=false)\n return false if destiny.nil? or destiny == self\n edge_class = ModelFabric.get_class(SocialFramework.edge_class)\n\n edge = edge_class.where([\"(origin_id = :origin_id AND destiny_id = :destiny_id OR \n destiny_id = :origin_id AND origin_id = :destiny_id) AND label = :label\",\n { origin_id: self.id, destiny_id: destiny.id, label: label }]).first\n\n if edge.nil?\n edge = edge_class.create origin: self, destiny: destiny, active: active,\n bidirectional: bidirectional, label: label\n\n return (not edge.nil?)\n end\n\n return false\n end", "def relationship(rel_class)\n @relationship = rel_class\n self\n end", "def create\n #create the guest\n @guest = Guest.new(guest_params)\n\n #save the guest and create the invitation\n if @guest.save\n @inv = Invitation.new()\n @inv.guest_id = @guest.id\n @inv.event_id = Event.find_by(id:request.headers['EventId'].to_s).id\n @inv.user_id = User.find_by(auth_token:request.headers['AuthorizationToken'].to_s).id\n else\n render json: @guest.errors, status: :unprocessable_entity\n end\n\n #save the invitation and return the guest\n if @inv.save\n render json: @guest, status: :created, location: @guest\n else\n render json: @inv.errors, status: :unprocessable_entity\n end\n end", "def stores_foreign_key?; true; end", "def create\n @guest = Guest.new(guest_params)\n @guest.party_id = params[:party][:id] if params[:party].present?\n\n respond_to do |format|\n if @guest.save\n addGroups\n format.html { redirect_to @guest, notice: 'Guest was successfully created.' }\n format.json { render :show, status: :created, location: @guest }\n else\n format.html { render :new }\n format.json { render json: @guest.errors, status: :unprocessable_entity }\n end\n end\n end", "def foreign_key(*attributes)\n self.foreign_keys += attributes\n end", "def trust(other)\n active_relationships.create(trusted_by_id: other.id)\n end", "def add\n association.build\n end", "def register_relation(klass)\n @relation_classes << klass\n end", "def register_relation(klass)\n @relation_classes << klass\n end", "def create\n @ingredient = Ingredient.new(ingredient_params)\n @ingredient.recipe = Recipe.find(ingredient_params[:recipe])\n @ingredient.recipe.ingredients << @ingredient\n save_relations\n \n respond_to do |format|\n if @ingredient.save\n format.html { redirect_to @ingredient.recipe, notice: 'Ingredient was successfully added.' }\n format.json { render :show, status: :created, location: @ingredient }\n else\n format.html { render :new }\n format.json { render json: @ingredient.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def set_guest\n @guest = Guest.find(params[:id])\n end", "def setup_associations; end", "def connect(venue)\n ContactVenueRelationship.create(contact_id: id,\n venue_id: venue.id)\n end", "def initialize(relationship=\"relationship\", *args)\n @relationship = relationship\n super\n end", "def new(other)\n @decl_rel.create_relationship_to(@node, other)\n end", "def set_guest\n @guest = Guests.find(params[:id])\n end", "def make_related(parent, child, resource_config)\n proc = resource_config[:relation][:create]\n proc.call(parent, child) if proc\n child\n end", "def register_relation(klass)\n boot.register_relation(klass) if boot\n end", "def create\n @relationship = current_user.relationships.build(relationship_params)\n\n respond_to do |format|\n if @relationship.save\n format.html { redirect_to @relationship, notice: 'Relationship was successfully created.' }\n format.json { render :show, status: :created, location: @relationship }\n else\n format.html { render :new }\n format.json { render json: @relationship.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_relationships(invitation)\n @invitor = Person.where(\"email = ? AND status = 'active mobile'\", invitation.invitor_email).first\n @invitee = Person.where(\"email = ? AND status = 'active mobile'\", invitation.invitee_email).first\n logger.debug(\"debug point alpha\")\n @invitor.person_connections.build(:person_a_id => @invitor.id, :person_b_id => @invitee.id,\n :category => invitation.category, :invitation_id => invitation.id, :status => 'active')\n logger.debug(\"debug point beta\")\n\n # create the second (reverse) person_connection \n @invitee.person_connections.build(:person_a_id => @invitee.id, :person_b_id => @invitor.id,\n :category => @invitation.category, :invitation_id => @invitation.id, :status => 'active')\n logger.debug(\"debug point gamma\")\n\n # add caretaker row for each pet owned by the invitor\n @invitor.caretakers.each do |ct|\n if ct.primary_role.eql?('Owner')\n if @invitation.category.eql?('Spouse-Partner')\n p_role = 'Owner'\n else\n p_role = @invitation.category\n end\n @invitee.caretakers.build(:pet_id => ct.pet_id, :primary_role => p_role, :status => 'active', :started_at => Time.now)\n end\n logger.debug(\"debug point delta\")\n end\n @invitor.save && @invitee.save\n \n end", "def create\n @guest_name = params[:meal][:guest_name]\n params[:meal].delete :guest_name\n @guest = Guest.where(:name => @guest_name).first\n if (@guest.nil?)\n @guest = Guest.new\n @guest.name = @guest_name\n end\n\n @meal = Meal.new(params[:meal])\n @meal.guest = @guest\n\n respond_to do |format|\n if @meal.save\n format.html { redirect_to @meal, :notice => 'Le repas a été créé avec succès.' }\n format.json { render :json => @meal, :status => :created, :location => @meal }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @meal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def relationship_related_link(attribute_name); end", "def model_relationships; end", "def relationship(rel_class)\n @relationship = rel_class\n self\n end", "def place(direct, preposition, target, detail = 'default')\n ItemRelationship.create!(\n source: direct,\n target: target,\n detail: detail,\n preposition: preposition\n )\nend", "def update\n @event, @guest = Event.find(params[:event_id]), Guest.find(params[:id])\n @plusone = @guest.plusones[0]\n @rel_manager = RelationshipManager.new(@guest, @event, params[:guest][:relationship])\n @rel_manager.check_for_custom_relationship\n @g_p_mgr = GuestAndPlusoneManager.new(@guest, @plusone, @event)\n to_do = @g_p_mgr.edit_guest(guest_params, plusone_params)\n if !to_do.nil?\n redirect_to @event\n else\n @errors = @event.errors.full_messages\n @relationships = @event.relationships\n @plusone = Plusone.new if @plusone.nil?\n render action: 'edit'\n end\n end", "def create_guest\n params.require(:guest).permit(:email, :name)\n end", "def relationship_constraint(operator, lhs_operand, rhs_operand, options = {}, &block)\n constraint = RelationshipConstraint.new(self, operator, lhs_operand, rhs_operand, options, &block)\n add_unique_to_set(\"relationship\", constraint, @relationship_constraints)\n end", "def add_edge(object_1, object_2)\n node_1 = check_object(object_1)\n node_2 = check_object(object_2)\n node_1.adjacents << node_2\n node_2.adjacents << node_1\n end", "def add_relationships\n actor_stack.update\n rescue StandardError => e\n message = \"failed to add relationships work #{@work.pid}, #{e.message}\"\n Rails.logger.error message\n raise StandardError, message\n end", "def associated\n end", "def set_user_relationship\n @user_relationship = UserRelationship.find(params[:id])\n end", "def create_associations\n self.associates.each do |associate|\n self.add_associated(associate)\n end\n end", "def add_child_object(child, relation, info = nil)\n\t relation.add_relation(self, child, info)\n\tend", "def create\n relationship = Relationship.new(\n sender_id: current_user.id,\n recipient_id: params[:recipient_id]\n )\n if relationship.save\n render json: relationship\n else\n render json: { errors: relationship.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def has_many(*args, **opt)\n add_collection_property(*args, **opt)\n end", "def add\n\n # if the show doesn't already exist in the db, add and then create relation\n if Show.where(shid: params[:shID]).present? == false\n aShow = Show.new(shid: params[:shID], poster: params[:shPoster])\n aShow.save\n\n cUser = current_user\n cUser.shows << aShow\n cUser.save\n\n # if the show exists already in the db, check if it has a relation\n # with the user, and create the relation if not\n else\n aShow = Show.where(shid: params[:shID])[0]\n\n if current_user.show_ids.include?(aShow.id) == false\n cUser = current_user\n cUser.shows << aShow\n cUser.save\n end\n end\n\n end", "def set_relationshipneighbor\n @relationshipneighbor = Relationshipneighbor.find(params[:id])\n end", "def create\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n unless relationship\n current_user.add_friend(User.find(params[:user_two_id]))\n relationship = Relationship.between(current_user.id, params[:user_two_id]).first\n relationship.status = 1\n relationship.save\n end\n friend = User.find_friend(current_user, relationship)\n redirect_to friendlist_path\n end", "def relationship_links(source)\n {}\n end", "def adding_plan_relation(transaction, parent, child, relations, info); end", "def create(work)\n super\n if work.env[:work_members_attributes].blank?\n @message = NO_CHILD\n add_relationships_succeeded\n else\n call_service\n end\n rescue StandardError => e\n add_relationships_failed\n log(\"failed while adding relationships work: #{e.message}\")\n end", "def stores_foreign_key?; false; end", "def stores_foreign_key?; false; end", "def relationship_set_property id, name, value\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n\n put_request 'relationship/' + id + '/properties/' + name, value, headers\n end", "def confirm_relationship(user, label)\n return false if user.nil? or user == self\n\n edge = self.edges.select { |edge| edge.origin == user and edge.label == label }.first\n\n unless edge.nil? \n edge.active = true\n return edge.save\n end\n\n return false\n end", "def <<(other)\n @decl_rel.create_relationship_to(@node, other)\n self\n end", "def ensure_relation(remote_node, attributes = nil)\n if rel = @storage.to_other(remote_node).first\n rel.attributes= attributes if attributes\n rel\n else\n relate(remote_node, attributes)\n end\n end", "def relation\n Proxy\n end", "def relation\n Proxy\n end", "def relation\n Proxy\n end", "def add_relation\n #add relation\n @word.word_roots.create(@word_root)\n respond_to do |format|\n format.js\n end\n end", "def promote_guest_to_user(user)\n # What should be done here is take all that belongs to user with lazy_id matching current_user's uuid cookie...\n # then associate them with current_user\n\n # Copy the subscription data from the guest user to the newly created user:\n # For example:\n # guest_comments = guest_user.comments.all\n # guest_comments.each do |comment|\n # comment.user_id = current_user.id\n # comment.save\n # end\n\n if !cookies[:uuid].nil?\n #user.subscriptions = guest_user.subscriptions.dup\n true\n else\n false\n end\n\n # When we promote a guest to a user, the guest should be destroyed (This includes deleting the cookie)\n destroy_guest_user\n\n end" ]
[ "0.6899112", "0.6477152", "0.63384116", "0.6084839", "0.6051174", "0.60344386", "0.58669955", "0.5799434", "0.57757974", "0.57613236", "0.5701113", "0.5688169", "0.5688021", "0.557391", "0.5539246", "0.55299026", "0.55043316", "0.5503145", "0.5503145", "0.5503145", "0.5503145", "0.5503145", "0.5503145", "0.5503145", "0.5503145", "0.5503145", "0.5488783", "0.5460314", "0.5444866", "0.5417398", "0.5391419", "0.539004", "0.5381111", "0.5378687", "0.53665286", "0.5365912", "0.5363701", "0.53600717", "0.53495175", "0.53321123", "0.53146285", "0.5308682", "0.53043133", "0.5303317", "0.5302323", "0.53019357", "0.53019357", "0.5260265", "0.5257281", "0.5257281", "0.5257281", "0.5257281", "0.5252728", "0.5243639", "0.5243639", "0.5243639", "0.5243639", "0.5243639", "0.5236723", "0.52326554", "0.5227187", "0.52203286", "0.5211614", "0.52055687", "0.5203958", "0.5186633", "0.51796377", "0.5179402", "0.51696074", "0.5167187", "0.5165985", "0.5164618", "0.5163518", "0.5159848", "0.5159834", "0.5157308", "0.5146077", "0.51403046", "0.5136593", "0.5122597", "0.512151", "0.5113668", "0.5109474", "0.5107439", "0.50969756", "0.50956017", "0.5093924", "0.50914365", "0.50647646", "0.50635934", "0.50635934", "0.5062871", "0.5056114", "0.5052662", "0.50510967", "0.50510377", "0.50510377", "0.50510377", "0.50508994", "0.5050709" ]
0.71395254
0
Populates member profile info from facebook profile data structure Returns success if both updates succeed
def sync_with_facebook_profile(fb_user) fb_info = FacebookUserProfile.populate(fb_user) address_book.sync_with_facebook(fb_user, fb_info) && profile.sync_with_facebook(fb_user, fb_info) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_profile_info\n info = provider_class.profile_info\n self.update_attributes(info)\n end", "def updateProfile\r\n errors ||= Array.new\r\n\t\tdataHash = {\r\n user_id: params[:user].id,\r\n asset_id: params[:asset_id],\r\n\t\t\tfname: params[:fname],\r\n\t\t\tlname: params[:lname],\r\n\t\t\tgender: params[:gender],\r\n\t\t\tbio: params[:bio],\r\n\t\t\tfamilyStatus: params[:familyStatus],\r\n\t\t\tbdate: params[:bdate]\r\n\t\t}\r\n\t\terrors = Api::Init.MembersControl.checkProfileParams(dataHash)\r\n\t\tif errors.count != 0 \r\n\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['profile_errors'],I18n.t(\"errors.messages.users.profile_errors\"), errors).to_json\r\n else\r\n \tuserProfileObject = UsersProfile.byUser(params[:user].id).first\r\n userProfileObject.updateProfile(dataHash)\t\r\n self.default_response\r\n end\r\n\tend", "def user_profile(json_info, &block)\n join_key = json_info['key']\n match_key = json_info['match_key']\n profile_info = json_info['profile']\n match_url = json_info['url']\n\n # TODO: database create\n new_user = User.new(key: join_key, match_key: match_key,\n profile_info: profile_info, match_url: match_url)\n\n # TODO: this goes in the db's response block\n @users[join_key] ||= new_user\n block.call\n end", "def profile\n @profile ||= @request.do_request { FacebookUserProfile.populate(user) }\n end", "def update\n @profile = self.current_member.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to [self.current_member, @profile] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end", "def update_linkedin\n profile = self.get_profile\n self.update(\n headline: profile.headline,\n industry: profile.industry,\n profile_url: profile.public_profile_url\n )\n self.profile.present? ? self.profile.from_omniauth(profile) : self.build_profile.from_omniauth(profile)\n end", "def profile\n render_json 0,\"ok\",current_member.as_profile\n end", "def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\t@profile.update_columns(profile_params)\n\t\trespond_with @profile \n\tend", "def create_profile\n Profile.create!(member_id:self.id) if self.profile.nil?\n end", "def update\n begin\n @profile.update!(metadata_profile_params)\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @profile.errors.any? ? @profile : e },\n status: :bad_request\n else\n toast!(title: \"Profile updated\",\n message: \"The metadata profile \\\"#{@profile.name}\\\" has been \"\\\n \"updated.\")\n render \"shared/reload\"\n end\n end", "def update_members\n unless self.list_members.blank?\n #create new members\n self.list_members.each do |api_member|\n member_params = {}\n api_member.each_pair do |key, value|\n unless key == \"id\"\n if Member.attribute_names.include? key\n member_params[key] = value\n end\n end\n end\n #member already exists\n temp = Member.find_by guid: member_params[\"guid\"]\n if !!temp\n temp.attributes = member_params\n if temp.valid? \n temp.save\n else\n return \"problem updating existing member\"\n end\n else\n member = Member.new(member_params)\n if member.valid?\n member.save\n else\n return \"problem with member params\"\n end\n end\n #delete denied members\n if api_member[\"connection_status\"] != \"CONNECTED\"\n Member.find_by(guid: member_params[\"guid\"]).delete\n Member.delete_member(self.guid, member_params[\"guid\"])\n end\n end\n end\n end", "def update_profile\n @profile = @account.employee\n \n if params[:profile].present?\n @profile.assign_attributes(profile_params)\n @profile.save\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {success: 'Profile has been updated successfully.'}\n else\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {error: 'Profile update failed. Please try again!'}\n end\n end", "def update\n @profile = current_user.profile\n assign_params_to_attributes\n if @profile.update_attributes(params[:profile])\n if params[:profile][:zip].present?\n current_user.update_attribute(:zip, params[:profile][:zip])\n end\n flash[:notice] = I18n.t('profile.update.notice')\n # redirect_to user_path(current_user)\n redirect_to edit_user_profile_path(current_user, @profile)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.update.error')\n render :action => \"edit\"\n end\n end", "def update_profile(params = {})\n response = post('account/update_profile.json', params)\n Croudia::Object::User.new(response)\n end", "def public_profile\n if params['form_profile']\n CsApi::Member.update(current_access_token, @current_user.username, params['form_profile'])\n Resque.enqueue(UpdateBadgeVillePlayer, current_access_token, @current_user.username, 'name,first_name,last_name,profile_pic,badgeville_id') unless ENV['BADGEVILLE_ENABLED'].eql?('false')\n flash.now[:notice] = 'Your profile information has been updated.'\n # get the updated account\n get_account \n end\n @page_title = 'Public Profile'\n end", "def update\n current_user.update(user_params_with_profile_picture)\n\n expose current_user\n end", "def add_profile(post, profile)\n post[:profile] = profile\n post[:profileupdate] = 'Y'\n end", "def import_profile_from_twitter\n self.profile.first_name = @credentials['name']\n self.profile.website = @credentials['url']\n self.profile.federated_profile_image_url = @credentials['profile_image_url']\n self.profile.save\n end", "def update\n respond_to do |format|\n if @full_profile.update(social_profile_params)\n format.html { redirect_to @current_user, notice: 'Social profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @current_user }\n else\n format.html { render :edit }\n format.json { render json: @full_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if user_signed_in?\n if @profile.update(profile_params)\n render json: @profile, status: :ok\n else\n render json: @profile.errors, status: :unprocessable_entity\n end\n end\n end", "def updateProfile(data)\r\n self.bio = data[:bio].to_s\r\n self.birthDate = Date.strptime( data[:bdate], '%m/%d/%Y')\r\n self.lname = data[:lname]\r\n self.fname = data[:fname]\r\n self.gender = data[:gender]\r\n self.image_id = data[:asset_id].to_i\r\n self.family_gender_id = data[:familyStatus].to_i\r\n self.save\r\n end", "def update_profile! (data = {})\n check_auth :update\n \n response = connection.put do |req|\n req.url '/user/update'\n req.body = { :format => @format }.merge(data)\n end\n response\n end", "def update_profile!(caller_id, access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/#{caller_id}/user/{{client_id}}/profile\"\n request[:request_body] = to_hash\n end.execute!\n\n json[:user_guid]\n end", "def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username']\n\t\t# self.save\n\t\t# self.user.username = facebook_data['username'] if self.user.username.blank?\n\t\t# self.user.image = \"http://graph.facebook.com/\" + self.username + \"/picture?type=large\" if self.user.image.blank?\n\t\t# self.user.location = facebook_data['location'] if self.user.location.blank?\n\t\t# self.user.save\n\t\tself.user.has_facebook = true\n\t\tself.user.save\n\tend", "def merge_social_profiles(other)\n other.social_profiles.each { |profile| profile.update_with_identity(self) }\n end", "def save_or_create_profile\n if profile.present?\n profile.actor_id = id\n profile.save!\n else\n create_profile\n end\n end", "def update_with_meetup(auth)\n self.name = auth[\"user_info\"][\"name\"]\n self.location = auth[\"user_info\"][\"location\"]\n self.image_url = auth[\"user_info\"][\"image\"]\n self.profile_url = auth[\"user_info\"][\"urls\"][\"profile\"]\n end", "def set_social_profile\n @full_profile = SocialProfile.find(params[:id])\n end", "def update\n profile_picture = member_params[:profile_picture]\n departments_hash = member_params[:depart]\n home_address_hash = member_params[:home_addr]\n work_address_hash = member_params[:work_addr]\n emergency_contact_hash = member_params[:emergency_cont]\n emergency_contact_address_hash = member_params[:emergency_cont][:addr] \n \n if profile_picture.present?\n File.delete(Rails.root.join('public', 'uploads', @member.profile_picture_url)) if File.exist?(Rails.root.join('public', 'uploads', @member.profile_picture_url))\n File.open(Rails.root.join('public', 'uploads', profile_picture.original_filename), 'wb') do |file|\n file.write(profile_picture.read)\n @uniq_path = Rails.root.join('public', 'uploads', @member.id.to_s + DateTime.now.to_s + File.extname(file))\n File.rename(file, @uniq_path)\n @member.profile_picture_url = @member.id.to_s + DateTime.now.to_s + File.extname(file)\n @member.save\n end\n end\n MemberDepartment.where(member_id: @member.id).collect { |d| d.destroy }\n if departments_hash.present? \n dispatch_items = departments_hash.collect { |d| MemberDepartment.create({member_id: @member.id, department_id: d, created_by: current_user.id })}\n end\n\n home_address = Address.find_by_id(@member.home_address_id)\n home_address.modified_by = current_user.id\n home_address.update(home_address_hash)\n\n work_address = Address.find_by_id(@member.work_address_id)\n work_address.modified_by = current_user.id\n work_address.update(work_address_hash)\n\n emergency_contact_map = emergency_contact_hash.except(:addr)\n emergency_contact = EmergencyContact.find_by_id(@member.emergency_contact_id)\n emergency_contact.modified_by = current_user.id\n emergency_contact.update(emergency_contact_map)\n\n emergency_contact_address = Address.find_by_id(emergency_contact.address_id)\n emergency_contact_address.modified_by = current_user.id\n emergency_contact_address.update(emergency_contact_address_hash)\n\n member_map = member_params.except(:depart, :home_addr, :work_addr, :emergency_cont, :profile_picture)\n\n respond_to do |format|\n if @member.update(member_map) \n format.html { redirect_to @member, notice: 'Member was successfully updated.' }\n format.json { render :show, status: :ok, location: @member }\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile\n @user = current_user\n @profile = @user.profile\n end", "def update_profile(params)\n post('/account/update_profile.json', params)\n end", "def profile\n current_user.update(user_params)\n current_user.avatar.attach(params[:user][:avatar]) if params[:user][:avatar].present?\n end", "def update\n $lovedone = nil\n @family_member = User.find(params[:id])\n params = family_member_params\n profile_params = params[:profile_attributes]\n\n profile = Profile.find(@family_member.profile.id)\n params[:profile_attributes][:user_type] = '1'\n\n respond_to do |format|\n if profile.update(profile_params)\n\n # check if lovedone_id is changed now...\n if request.params[:prev_lovedone_id]!=family_member_params_for_lovedone[:lovedones]\n follower = Follower.find_by(user_id: @family_member.id,\n lovedone_id: request.params[:prev_lovedone_id])\n follower.destroy unless follower.nil?\n\n unless family_member_params_for_lovedone[:lovedones].blank?\n follower = Follower.new user_id: @family_member.id, request_status: \"invited\", \n lovedone_id: family_member_params_for_lovedone[:lovedones]\n follower.save\n end\n end\n\n if params.include?(:email)\n @family_member.skip_confirmation!\n @family_member.skip_confirmation_notification!\n @family_member.confirm!\n @family_member.update_attribute(:email, params[:email])\n @family_member.save\n end\n\n\n\n format.html { redirect_to familymembers_path, notice: 'Family member was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_member }\n else\n format.html { render :edit }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_user_profile\n @user_profile = @user.user_profile\n @user_profile = @user.create_user_profile if @user_profile.nil?\n end", "def update\n respond_to do |format|\n if @member.update(member_params)\n @member.avatar.attach(member_params[:avatar]) unless member_params[:avatar].nil?\n format.html { redirect_to my_profile_path, notice: 'Member was successfully updated.' }\n format.json {}\n else\n format.html { render :edit }\n format.json { render json: @member.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_friends\n if self.friends_last_updated_at.nil? || ((self.friends_last_updated_at + 1.day) < DateTime.now)\n self.friends = profile.friends(:fields => 'gender,name').map{|f| {\"label\" => f.name, \"value\" => f.identifier, \"gender\" => f.gender}}\n self.friends_last_updated_at = DateTime.now\n save(:validate => false)\n end\n end", "def build_the_profile\n\tself.build_profile\n\tself.profile.user_id = self.id\n end", "def update_profile\n self.resource = resource_class.to_adapter.get!(send(:\"current_#{resource_name}\").to_key)\n prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email)\n\n resource.avatar.attach(account_update_params[:avatar]) if account_update_params[:avatar]\n resource_updated = resource.update_without_password(account_update_params)\n yield resource if block_given?\n\n if resource_updated\n bypass_sign_in resource, scope: resource_name\n render json: resource, status: 200\n else\n clean_up_passwords resource\n set_minimum_password_length\n respond_with resource\n end \n end", "def set_user_and_profile\n @user = User.find(params[:id])\n @profile = @user.profile\n end", "def set_user_profile(display_name: nil, avatar_url: nil, reason: nil)\n return nil unless display_name || avatar_url\n\n data = client.api.get_membership(id, client.mxid)\n raise \"Can't set profile if you haven't joined the room\" unless data[:membership] == 'join'\n\n data[:displayname] = display_name unless display_name.nil?\n data[:avatar_url] = avatar_url unless avatar_url.nil?\n\n client.api.set_membership(id, client.mxid, 'join', reason || 'Updating room profile information', data)\n true\n end", "def save\n\t\tbegin\n\t\t\tuser_profile = self.profile\n\t\t\tUser.create(\n\t\t\t\t:user_id => id,\n\t\t\t\t:login_name => username,\n\t\t\t\t:email => email,\n\t\t\t\t:join_tsz => created,\n\t\t\t\t:transaction_buy_count => user_profile.transaction_buy_count,\n\t\t\t\t:transaction_sold_count => user_profile.transaction_sold_count,\n\t\t\t\t:is_seller => user_profile.is_seller,\n\t\t\t\t:location => user_profile.lon ? [user_profile.lon, user_profile.lat] : nil,\n\t\t\t\t:image_url => user_profile.image,\n\t\t\t\t:country_id => user_profile.country_id,\n\t\t\t\t:gender => user_profile.gender,\n\t\t\t\t:oauth_token => nil,\n\t\t\t\t:oauth_token_secret => nil,\n\t\t\t\t:authenticated => false,\n\t\t\t\t:shop_id => @shop_id\n\t\t\t)\n\t\trescue NoMethodError\n\t\t\t# fairly rare at this point.\n\t\t\tputs \"associated_profile bug\"\n\t\tend\n\tend", "def update!(**args)\n @profile_name = args[:profile_name] if args.key?(:profile_name)\n @profile_photo_url = args[:profile_photo_url] if args.key?(:profile_photo_url)\n @profile_url = args[:profile_url] if args.key?(:profile_url)\n @takedown_url = args[:takedown_url] if args.key?(:takedown_url)\n end", "def update_profile(options={})\n perform_post(\"account/update_profile.#{Twitter.format}\", options)\n end", "def ensure_user_has_profile(user)\n unless user.person && user.person.profile.present?\n account = Account.to_adapter.get!(user.id)\n update_status = account.update_with_password({ \"name\" => user.username })\n end\n end", "def update\n\n if @usertype == 'dataentry'\n dataentry = Dataentry.find_by_authentications_id(@id)\n dataentry.firstname = params['firstname']\n dataentry.lastname = params['lastname']\n dataentry.profile = params['profile']\n dataentry.institution = params['institution']\n dataentry.save\n redirect_to '/profile'\n #TODO: Update the flash message to show that the profile is updated or not.\n else\n redirect_to '/'\n end\n end", "def update\n # render :text => \"<pre>#{params.to_yaml}</pre>\" and return\n @profile = Profile.find(params[:id])\n # @profile = Profile.find_or_create_by_user_id(@user.id)\n unless params.empty?\n @profile.update_attributes(params[:profile])\n @profile.user.update_attributes(params[:user])\n end\n respond_to do |format|\n if @profile.errors.empty? && @profile.user.errors.empty?\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors + @profile.user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_profile(body)\n post(\"user/#{user_id}/profile.json\", body)\n end", "def update_sms_profile \n logger.info \"Loading MemberUser update_sms_profile action\"\n @member = current_resource\n logger.debug \"Member attributes hash: #{@member.attributes.inspect}\" \n if @member.update_attributes(params[:member])\n logger.debug \"Member saved and updated successfully - attributes hash: #{@member.attributes.inspect}\"\n logger.debug \"Sending delayed welcome email to new member...\"\n MemberMailer.delay.welcome_mail_new_member(@member.id)\n logger.debug \"Member email has been sent successfully\"\n flash[:success] = t(:success, :scope => [:business_messages, :web_profile])\n redirect_to root_path\n else\n logger.debug \"Validation errors. Loading complete_sms_profile with errors\"\n render 'complete_sms_profile' \n end\n end", "def update!\n data = Steam::API.user(steam_id).first\n update(\n name: data[:personaname],\n avatar_url: data[:avatarfull],\n last_updated: Time.now\n )\n end", "def update_profile\n response = HTTParty.get('https://api.github.com/orgs/' + org_name, :body=> {\n :username => \"9e8c7f5bb19cf14c39e38fe17c14e6d3b161f738\"\n } )\n data = response.parsed_response\n self.html_url = data['html_url']\n self.public_repos = data['public_repos']\n self.save\n end", "def edit_identity\n if request.post?\n #OPTIMIZE: presently, one database save per field. Take it all in one go.\n begin\n [ :feed_real_name,\n :feed_aliases,\n :feed_preferred_calling_name,\n :profile_status_message,\n :feed_description,\n :feed_gender,\n :feed_birth_time_pref,\n :feed_email,\n :feed_show_email,\n :feed_country_living_code\n ].each { |e|\n @profile_user[e] = params[e]\n }\n rescue ActiveRecord::RecordInvalid => e\n flash.now[:notice] = e.message\n return\n end\n\n @profile_user[:feed_birth_time] = DateTime.new(params[:feed_birth_time]['(1i)'].to_i,\n params[:feed_birth_time]['(2i)'].to_i, params[:feed_birth_time]['(3i)'].to_i)\n #better method exists?\n #{}.index or {}.rassoc(Ruby 1.9), but we need a case insenstive search!\n #Create new method city_list_downcased and use like this?\n #<tt>city_list_downcased.index params[:feed_city].downcase</tt>\n @profile_user[:feed_city_has_code] = \"no\"\n city_list.each { |k,v| #60,000 rounds in worst case!!\n if v.to_s.downcase == params[:feed_city].downcase\n @profile_user[:feed_city] = k.to_s #From symbol\n @profile_user[:feed_city_has_code] = \"yes\"\n break\n end\n }\n @profile_user[:feed_city] = params[:feed_city] if @profile_user[:feed_city_has_code] == \"no\"\n flash[:highlight] = \"Profile updated!\" if flash[:notice].blank?\n redirect_to @kopal_route.home\n end\n end", "def update_profile(options = {}) \n # query profile info\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(URI_PROFILES, :params => { 'filter[name]' => options[:name] })\n if response.status.success?\n responseObj = JSON.parse(response.body)\n queried_profile_list = responseObj[\"data\"]\n if queried_profile_list.length() > 0\n profile = queried_profile_list[0]\n end\n else\n Asca::Tools::Log.error(response.body)\n return\n end\n \n if !profile\n Asca::Tools::Log.error(\"No profile named #{options[:name]} found\")\n return\n end\n # create new profile\n profile_type = profile[\"attributes\"][\"profileType\"]\n \n # get bundle id\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"bundleId\"][\"links\"][\"self\"])\n bundle_id = JSON.parse(response.body)[\"data\"][\"id\"]\n response = HTTP.auth('Bearer ' + Asca::Tools::Token.new_token).get(profile[\"relationships\"][\"certificates\"][\"links\"][\"self\"])\n certificate_ids = JSON.parse(response.body)[\"data\"].map { |cer| cer[\"id\"] }\n \n # get all device ids\n device_ids = Asca::REST::Provisioning::Devices.list_devices.map { |device|\n device[\"id\"]\n }\n \n # delete old prifile\n delete_profile :name => options[:name]\n \n if profile_type.include? 'APP_STORE'\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :certificate_ids => certificate_ids\n else\n create_new_profile :name => options[:name], :type => profile_type, :bundle_id => bundle_id, :device_ids => device_ids, :certificate_ids => certificate_ids\n end\n \n return true\n end", "def update\n logger.debug '> Users: update'\n Accounts.new.update(params.merge(remember_token: rem_tokgen)) do |tmp_account|\n sign_in tmp_account\n @success = \"#{Accounts.typenum_to_s(params[:myprofile_type])} updated successfully.\"\n @error = 'Oops! Please contact support@megam.io'\n end # if current_password_ok? #removed it for now. does not work otherwise. need to come back.\n @msg = { title: 'Profiles', message: \"#{Accounts.typenum_to_s(params[:myprofile_type])} updated successfully!.\", redirect: '/', disposal_id: 'app-1' }\n respond_to do |format|\n format.js do\n respond_with(@msg, @success, @error, account: current_user, api_key: current_user.api_key, myprofile_type: params[:myprofile_type], layout: !request.xhr?)\n end\n end\n end", "def set_profiledetail\n @profiledetail = current_user.profiledetail\n end", "def update\n current_user.profile.update_attributes(profile_params)\n redirect_to '/profiles'\n end", "def update\n respond_to do |format|\n if @profile.update_attributes params[:profile]\n @profile.user.index!\n format.html { redirect_to get_stored_location, :notice => t('profile.profile_updated') }\n else\n format.html { render :action => :edit }\n end\n end\n end", "def set_profile\n @profile = if params[:id]\n Profile.find_by!(user_id: params[:id])\n else\n Profile.find_by(user: current_user)\n end\n end", "def set_profile\n @profile = @user.profile\n end", "def manage_profile\n begin\n @has_link_access = true\n if @actor.is_fan? # in case of fan profile login\n @user = @actor\n @additional_info = current_user.additional_info\n get_user_associated_objects\n render :template =>\"/fan/manage_profile\" and return\n elsif @actor.is_artist? # in case of artist profile login\n @user = current_user\n @artist = @actor\n @artist_user = ArtistUser.for_user_and_artist(current_user, @artist).first || ArtistUser.new\n get_artist_objects_for_right_column(@artist)\n render :template =>\"/artist/edit\" and return\n elsif @actor.is_venue? # in case of venue profile login\n @user = current_user\n @venue = @actor\n @venue_user = VenueUser.for_user_and_venue(current_user, @venue).first || VenueUser.new\n get_venue_objects_for_right_column(@venue)\n render :template =>\"/venue/edit\" and return\n end\n rescue =>exp\n logger.error \"Error in User#ManageProfile :=> #{exp.message}\"\n render :nothing => true and return\n end\n respond_to do |format|\n format.js\n format.html\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n \n # Get photos directly from the params and save them to the database one by one\n if params[:profile][:photos]\n params[:profile][:photos].each { |photo|\n ProfilePhoto.create(profile: @profile, photo: photo)\n }\n end\n \n format.html { redirect_to @profile, notice: 'profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_profile_photo_and_photo_id_status\n self.profile_photo_status = SadhakProfile.profile_photo_statuses.pp_pending\n self.photo_id_status = SadhakProfile.photo_id_statuses.pi_pending\n end", "def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # puts \"profile_params: #{profile_params[:sport_ids]}\"\n\n respond_to do |format|\n begin\n if current_user != @profile.user\n performing_follow?\n @profile.user.toggle_followed_by(current_user)\n # the next two lines are all about the redirecting or the 'resheshing' of a page so that you can see the result of follow and unfollow without having to refresh.\n format.html { redirect_to @profile.user }\n format.json { render :show, status: :ok, location: @profile }\n end\n\n @profile.update(profile_params)\n # add skill objects and save to db\n # profile_params[:sport_ids].each do |sport_id|\n # Skill.create!(profile_id: @profile.user.id, sport_id: sport_id)\n # end\n format.html { redirect_to profile_url, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n rescue\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user_info = User.find(params[:id])\n if !user_info.points\n @user[:points] = 100\n end\n if !user_info.image\n @user[:image] = 'https://graph.facebook.com/'+user_info.uid.to_s+'/picture?width=360&height=210'\n end\n respond_to do |format|\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 else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def profiel\n if request.post? and params[:user]\n\n if @me.update_attributes(params[:user])\n # website stuff!\n if params[:user][:profile_website]\n if params[:user][:profile_website][0..6] != \"http://\" and !params[:user][:profile_website].blank?\n @me.update_attribute('profile_website', 'http://' + params[:user][:profile_website])\n end\n end\n flash.now[:notice] = \"Profiel gewijzigd\"\n end\n end\n \n end", "def set_profile\n @user = User.find(params[:id])\n @profile = @user.profile\n end", "def profile\r\n if request.post?\r\n @customer.update_attributes :email => params[:customer][:email], :phone => params[:customer][:phone]\r\n @store_user.my_account_log(@customer,\"Update Profile Email: #{@customer.email} Phone: #{@customer.phone}\")\r\n @customer.update_ax\r\n end\r\n end", "def set_profile\n @profile = Profile.find_by(user_id: current_user.id)\n end", "def complete_sms_profile\n logger.info \"Loading MemberUser complete_sms_profile action\"\n token = params[:token]\n if token.present?\n logger.debug \"Token is present - #{token.inspect}\"\n logger.debug \"Continue trying to lookup member record...\"\n @member = Member.find_by_access_key(params[:token])\n if @member.nil?\n logger.debug \"Error: Member does not exist with that token\"\n flash[:alert] = t(:member_not_exist, :scope => [:business_messages, :web_profile])\n redirect_to root_path\n elsif @member.complete\n logger.debug \"Error: Member profile already completed\"\n flash[:alert] = t(:already_finished, :scope => [:business_messages, :web_profile])\n redirect_to root_path\n else\n logger.debug \"Everything OK. We can load form to allow the member to complete profile\"\n logger.debug \"Set validation mode to web and build user record association\"\n #Set validation mode and build user object\n @member.validation_mode = \"web\"\n @member.build_user()\n end\n else\n logger.debug \"Error: No token is present in request\"\n logger.fatal \"Error: No token is present in request\"\n flash[:alert] = t(:security_error, :scope => [:business_messages, :web_profile])\n redirect_to root_path\n end\n end", "def update_from_provider!(auth)\n last_updated = auth[\"extra\"][\"raw_info\"][\"updated_at\"] rescue nil\n return nil if last_updated && Time.parse(last_updated) < person.resource_cache_updated_at\n avatar_image_url = auth[\"info\"][\"image\"] || auth[\"extra\"][\"raw_info\"][\"profile_image_url_https\"] rescue nil\n person.update_attributes({\n :display_name => auth[\"info\"][\"name\"],\n :firstname => auth[\"info\"][\"first_name\"],\n :lastname => auth[\"info\"][\"last_name\"],\n :email => auth[\"info\"][\"email\"],\n :avatar_image_url => avatar_image_url,\n :resource_cache_updated_at => Time.now\n })\n end", "def set_current_user_profile\n @profile = custom_find do\n current_v1_user.profiles.find(params[:profile_id])\n end\n end", "def apply_member_updates(pak, choices)\n rc = false\n content_profile = ContentProfile.find_by(person_authentication_key: pak)\n return false unless content_profile\n\n delete_storage_object(pak)\n\n user_options_list = choices.shift\n if choices.empty?\n content_profile.content_profile_entries.clear\n return true # early exit if nothing to do\n end\n\n ActiveRecord::Base.transaction do\n\n cpes = []\n rc = false\n choices.each do |choice|\n things = []\n things = ContentProfileEntry.where(topic_type: choice[2], content_type: choice[0]).select do |s|\n choice[3].eql?(s.topic_value) and choice[1].eql?(s.content_value)\n end.compact\n\n if things.present?\n cpes << things.first # only need one\n else\n cdesc = ContentType.find_by(name: choice.first).try(:description)\n tdesc = TopicType.find_by(name: choice[2]).try(:description)\n desc = \"#{cdesc} for #{choice[2]}\"\n cpes << ContentProfileEntry.create!({\n description: desc,\n content_value: choice[1],\n content_type: choice[0],\n content_type_description: cdesc,\n topic_value: choice[3],\n topic_type: choice[2],\n topic_type_description: tdesc\n })\n end\n end\n\n rc = content_profile.content_profile_entries = cpes.flatten\n if rc.present? and !!defined?(user_options_list)\n user_profile = get_page_user(content_profile.username)\n user_profile.update_user_options!( user_options_list )\n end\n\n true\n end # end transaction\n\n Rails.logger.debug \"#{self.class.name}.#{__method__}() saving: #{choices.size} entries returned #{rc.present?}\"\n\n rc.present?\n end", "def update_using_auth o\n\t\tself.user_id = o.info.user_id\n\t\tself.login_name = o.info.profile.login_name\n\t\tself.email = o.info.email\n\t\tself.join_tsz = o.info.profile.join_tsz\n\t\tself.transaction_buy_count = o.info.profile.transaction_buy_count\n\t\tself.transaction_sold_count = o.info.profile.transaction_sold_count\n\t\tself.is_seller = o.info.profile.is_seller\n\t\tself.location = o.info.profile.lon ? [o.info.profile.lon, o.info.profile.lat] : nil\n\t\tself.image_url = o.info.profile.image_url_75x75\n\t\tself.country_id = o.info.profile.country_id\n\t\tself.gender = o.info.profile.gender\n\t\tself.oauth_token = o.extra.access_token.token\n\t\tself.oauth_token_secret = o.extra.access_token.secret\n\t\tsave\n\t\tself\n\tend", "def update\n # @profile = Profile.find(profile_params[:id])\n @user = current_user\n @profile = @user.profile\n # @user.profile = @profile\n # redirect_to(profile_path)\n\n # @user.update(user_params) #from the private method below - whitelist check\n\n \n\n respond_to do |format|\n if @profile.update(profile_params)\n\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def profile\n unless @profile\n if associated_profile\n @profile = Profile.new(associated_profile)\n else\n options = {:fields => 'user_id', :includes => 'Profile'}\n options = options.merge(:access_token => token, :access_secret => secret) if (token && secret)\n tmp = User.find(username, options)\n @profile = Profile.new(tmp.associated_profile)\n end\n end\n @profile\n end", "def update\n if @profile.update_attributes(profile_params)\n begin\n response_bank = Pagarme::CreateBankAccountService.new(profile: @profile).call\n rescue\n return redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.'\n end\n if response_bank.id.present?\n @profile.reload.update(bank_id: response_bank.id)\n if @profile.recipient_id.blank?\n response_recipient = Pagarme::CreateRecipientService.new(profile: @profile).call\n else\n response_recipient = Pagarme::UpdateRecipientService.new(profile: @profile).call\n end\n if response_recipient.id.present?\n @profile.reload.update(recipient_id: response_recipient.id)\n return redirect_to edit_client_profile_path(@profile), notice: 'Perfil atualizado com sucesso.'\n end\n end\n redirect_to edit_client_profile_path(@profile), notice: 'Houve um problema para salvar o perfil.'\n else\n redirect_to edit_client_profile_path(@profile), notice: 'Houve um problema para salvar o perfil.'\n end\n end", "def update\n @profile.update(profile_params)\n respond_with(@profile)\n end", "def update\n\n if param_user[:email_work] != user.login\n param_user[:login] = param_user[:email_work]\n end\n @selected_profiles = param_user[:profile_ids]\n\n respond_to do |format|\n if user.update_attributes(param_user)\n @message = \"#{@user.full_name} has been modified.\"\n\t Resque.enqueue(Finforenet::Jobs::CheckPublicProfiles, @user.id) if @user.is_public\n if !request.xhr?\n format.html { redirect_to users_path({:page=>params[:page]}), :notice => @message }\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr?}\n end\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr? }\n end\n end\n end", "def set_user_profile\n UserProfile.find_or_initialize_by(user: current_user) do |userprofile|\n @user_profile = userprofile\n @user_profile.save\n end\n if @user_profile == nil\n @user_profile = UserProfile.find_by_user_id(current_user.id)\n end\n end", "def update_profile(profile)\n @type = Type::CIM_UPDATE_PROFILE\n @fields.merge!(profile.to_hash)\n make_request\n end", "def show\n profile = Profile.where(\"account_id = ?\", @friend.friend_account_id).first\n \n # Copy details to friend attr_accessor\n @friend.first_name = profile.first_name\n @friend.last_name = profile.last_name\n @friend.photo = profile.photo\n end", "def update_profile\n \t@user = User.find_by_id(params[:id])\n \tif @user.nil?\n render :json => {:message => \"User not exists\"}, :status => :not_acceptable\n else\n \tbegin\n\t @user.update_attributes(params[:user])\n\t @user.save!\n\t render :json => {:success => true, :message => \"User updated\", :user =>@user}, :status => :ok\n\t rescue Exception => e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n end\n end", "def profile\n raw = client.get @json['user']['links']['self']\n client.factory.create(GoodData::Profile, raw)\n end", "def set_profile\n\t\t\tredirect_to profile_friends_path(current_user) and return unless params[:profile_id]\n\t\t\tbegin\n\t\t\t\t@profile = User.find(params[:profile_id])\n\t\t\trescue\n\t\t\t\tredirect_to profiles_path, :alert => \"User not found\" and return\n\t\t\tend\n\t\tend", "def update_profile(user)\n create_feed(user, {:title => 'Profile changed', :description => \"#{create_link(user)}'s changed his profile\"})\n end", "def set_profile\n @profile = Profile.where(user_id: current_user).first\n end", "def update\n @profile = Profile.find(current_user.id)\n @profile.update_attributes(params[:profile])\n respond_with @profile\n end", "def create\n @admin_profile = Admin::Profile.new(admin_profile_params)\n\n respond_to do |format|\n if @admin_profile.save\n unless params[:admin_profile][:avatar].blank?\n preloaded = Cloudinary::Uploader.upload(params[:admin_profile][:avatar], :use_filename => true, :public_id => \"profiles/#{@admin_profile.id}\")\n end\n\n unless params[:admin_profile][:profile_skills_attributes].blank?\n params[:admin_profile][:profile_skills_attributes].each do |skill|\n admin_skill = Admin::ProfileSkill.create({profile_id: @admin_profile.id, name: skill[1][:name], skill: skill[1][:skill]})\n admin_skill.save\n end\n end\n\n unless params[:admin_profile][:profile_hobbies_attributes].blank?\n params[:admin_profile][:profile_hobbies_attributes].each do |hobby|\n admin_hobby = Admin::ProfileHobby.create({profile_id: @admin_profile.id, name: hobby[1][:name]})\n admin_hobby.save\n end\n end\n\n format.html { redirect_to admin_root_path, notice: 'Profile was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_profile }\n else\n format.html { render action: 'new'}\n format.json { render json: @admin_profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_profile(profile_contents)\n path = self.api_root + '/register/profile'\n process_firecloud_request(:post, path, profile_contents.to_json)\n end", "def update_user_info(opts)\n opts[:birthday] = format_date(opts[:birthday]) if opts[:birthday]\n post(\"/user/#{@user_id}/profile.json\", opts)\n end", "def update_memberinfo(st, member_id, email)\n # No email - should roll back the entire transaction. Check prior.\n st.execute(member_id, @email_data_key, email)\n end", "def set_facebook_info omni\n info = omni['info']\n self.email = info['email']\n self.first_name = info['first_name']\n self.last_name = info['last_name']\n\n # Get the large size image. Omniauth returns 'square' by default and thats\n # too small to use.\n if info['image'].present?\n self.remote_profile_image_url = info['image'].gsub(\"square\", \"large\")\n end\n end", "def set_profile\n @profile = current_user\n end", "def set_profile\n if params[:id].to_i != 0\n @profile = Profile.find(params[:id])\n # @user = User.find(params[:id])\n else\n @user = User.find_by_profile_uri(params[:id])\n end\n end", "def set_profile\n @profile = Profile.find_by(user_id: current_user.id)\n end", "def update\n @profile = Profile.find_by_id(params[:id])\n @updateFor = params[:type]\n @message = \"Update successfully...\"\n if @updateFor==\"ProfileInformation\"\n @profile_update=profile_params\n @profile_update[:dob] = Date.strptime(@profile_update[:dob], '%m/%d/%Y')\n \n @profile_update[:height] = CustomMethods.convert_to_float(@profile_update[:height])\n user_type=current_user.position\n if user_type != \"Member\" && @profile.gender != @profile_update[:gender]\n ProfileMatch.delete_other_user_matches(current_user.id)\n ProfileMatch.delete_matches(current_user.user_id)\n end\n #@profile_update[:height]= convert_to_float(profile_params[:height],params[:height_inch])\n if @profile.update(@profile_update)\n \n @profile.user.first_name=user_params[\"first_name\"]\n @profile.user.last_name=user_params[\"last_name\"]\n @profile.user.region=user_params[\"region\"]\n photos= @profile.user.photos\n if photos.present?\n photos.update_all(:private_pic=>@profile.photo)\n end\n @profile.user.save \n #after updation report admin\n role=UserRole.get_roles(current_user)\n else\n @message = \"Something went wrong\"\n end\n elsif @updateFor==\"OnlyProfile\"\n @profile_update=profile_params\n if @profile.update(@profile_update) \n puts 'updated profile'\n else\n @message = \"Something went wrong\"\n end\n elsif @updateFor==\"OnlyRegion\"\n @profile.user.region=user_params[\"region\"]\n @profile.user.save \n elsif @updateFor == \"PartnerPreferences\"\n @partner_preferences = PartnerPreference.find_by_user_id @profile.user_id\n @partner_preferences_update=partner_preferences_params\n @partner_preferences_update[:height_from] = CustomMethods.convert_to_float(@partner_preferences_update[:height_from])\n @partner_preferences_update[:height_to] = CustomMethods.convert_to_float(@partner_preferences_update[:height_to])\n if !@partner_preferences.present?\n @partner_preferences = PartnerPreference.new(@partner_preferences_update)\n @partner_preferences.user_id = @profile.user_id\n @deal_breaker = DealBreaker.new\n if @partner_preferences.save\n @deal_breaker.partner_preference_id = @partner_preferences.id\n @deal_breaker.save\n end\n end\n @partner_preferences = PartnerPreference.find_by_user_id @profile.user_id\n if @partner_preferences.update(@partner_preferences_update)\n @deal_breaker = DealBreaker.find_by_partner_preference_id @partner_preferences.id \n if @deal_breaker.present?\n @deal_breaker.update(deal_breaker_params)\n end\n end \n end\n @profile=Profile.find_by(id: @profile.id)\n User.update_elastic(@profile.user)\n render json: {\n status: 200,\n message: @message,\n profile:@profile\n }.to_json\n end", "def set_profile\n\t\t@profile = current_user.profile\n\tend", "def update\n\t\t# Updating the details according the that particular profile\n\t\t@profile.update_attributes(profile_params)\n\t\t# Redirect to the particular surgeon profile show page\n\t\tredirect_to profile_path(@profile)\n\tend", "def new_profile?\n @profile = Profile.new(params[:profile])\n @profile.user = current_user\n @profile.email = current_user.email\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n @profile.photo.data.blank? ? @profile.photo.update_attributes(photo_type: 2) : @profile.photo.update_attributes(photo_type: 1)\n\n current_user.user_tries.last.state_machine.transition_to(:pending)\n format.html { redirect_to root_path, notice: 'Profile was successfully created.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.69915974", "0.68040013", "0.65659535", "0.6480926", "0.63532126", "0.63348275", "0.6327844", "0.6301545", "0.6291561", "0.62879205", "0.6284522", "0.623852", "0.62377363", "0.62341356", "0.623156", "0.62219757", "0.6218091", "0.62030363", "0.61972296", "0.61942303", "0.61941546", "0.6165079", "0.61650205", "0.6138877", "0.6138792", "0.6124485", "0.61167634", "0.6106085", "0.610172", "0.6091104", "0.6084884", "0.60836494", "0.6078371", "0.6068543", "0.6060698", "0.60603744", "0.60590434", "0.6040968", "0.60400766", "0.6030992", "0.60307354", "0.6015381", "0.6009253", "0.6004283", "0.6003386", "0.60024923", "0.599147", "0.59855515", "0.59723026", "0.594985", "0.5949265", "0.5948384", "0.59209913", "0.5912435", "0.5908967", "0.5908699", "0.58995014", "0.58962905", "0.5885379", "0.58698314", "0.58614707", "0.5854461", "0.5845652", "0.5839476", "0.58369374", "0.58301", "0.582965", "0.5826315", "0.5824409", "0.58195925", "0.5816844", "0.58107907", "0.58076763", "0.5805771", "0.5803687", "0.580035", "0.57972646", "0.5794617", "0.5787512", "0.5787343", "0.57871795", "0.57854193", "0.5781614", "0.5780076", "0.5779725", "0.57770085", "0.577275", "0.5742683", "0.57418", "0.57406753", "0.5739456", "0.5737675", "0.57361114", "0.57310957", "0.57297695", "0.5728699", "0.57286245", "0.57271034", "0.57243073", "0.5723283" ]
0.6220067
16
Returns of bytes used by backup data
def s3_storage_used bytes = contents.sum(:size) backup_sources.gmail.each do |gmail| bytes += gmail.backup_emails.sum(:size) end # TODO: move size calculations to each source backup_sources.blog.each do |blog| blog.feed.entries.each do |entry| if entry.feed_content bytes += entry.feed_content.size end end end bytes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bytes_used\n bytes_total - bytes_free\n end", "def num_bytes\n return @num_bytes\n end", "def total_bytes\n (wired + active + inactive + free) * pagesize\n end", "def bytes\n members.reduce(0) { |sum, gf| sum + gf.file_size.first.to_i }\n end", "def size_used\n info[\"size-used\"]\n end", "def memused\n @memtotal - @memfree\n end", "def bytes\n @bytes = 0\n @files.each do |file|\n @bytes += File.new(\"#{file}\").size\n end\n @bytes\n end", "def bytes_total\n blocks * block_size\n end", "def disk_usage_mb \n return disk_usage \n end", "def bytesize\n @fd.stat.size\n end", "def used_bytes\n size = 0\n unless empty?\n actual_node = @tail_node\n while actual_node != nil do\n size += actual_node.value.value.length\n actual_node = actual_node.next_node\n end\n end\n size\n end", "def bytes\n members.reduce(0) { |sum, gf| sum + gf.content.size.to_i }\n end", "def available_bytes\n available * pagesize\n end", "def used\n data.used\n end", "def memsize\n end", "def bytes_synced\n @attributes[:bytes_synced]\n end", "def total_bytes\n Integer @gapi.total_bytes_processed\n rescue\n nil\n end", "def used\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tmemory = IO.foreach('/proc/meminfo').first(3)\n\t\t\t\tmemory[0].split[1].to_i - memory[2].split[1].to_i\n\t\t\tend", "def byte_size\n inject(0){ |sum, path| sum + FileTest.size(path) }\n end", "def space_available\n used = 0\n if recordings.any?\n used = recordings.map(&:full_size).reduce(:+) \n end\n\n total_space - used\n end", "def block_count\n @disk.block_count - @data_start\n end", "def byte_size(); @data.byte_size + 4; end", "def get_remaining_bytes\n @length-@position\n end", "def d_size\n @diskObj.info[:capacity]\n end", "def wal_retained_bytes\n typed_exec(<<-SQL).to_a\n SELECT\n pg_wal_lsn_diff(pg_current_wal_insert_lsn(), restart_lsn) AS retained_bytes,\n slot_name::TEXT\n FROM\n pg_replication_slots\n WHERE\n plugin = 'pgoutput'\n SQL\n end", "def data_len_bytes()\n 1\n end", "def size\n storage.size\n end", "def bytes_remaining\n @data.bytesize - @pos\n end", "def get_usage\n\t\t\t@storage.fetch(:usage).to_i\n\t\tend", "def used_space\n size - free_space\n end", "def size\n\t\treturn @storage.size\n\tend", "def block_size\n @disk.block_size\n end", "def getBytesTransferred\n downloaded, uploaded = Nil.getDeviceBytes(@nic)\n\n output =\n {\n 'downloaded' => downloaded,\n 'uploaded' => uploaded,\n 'timestamp' => Time.now.utc.to_f\n }\n\n return output\n end", "def zettabytes\n self * ZETTABYTE\n end", "def bytes()\n #This is a stub, used for indexing\n end", "def size_in_bytes\n to_i description['SizeInBytes']\n end", "def size\n @data.bytesize\n end", "def byte_size()\n if @record and RECORD_INFO[@record.type].size > 0 then\n RECORD_INFO[@record.type].size * @value.length\n else\n sum = 0\n @value.each do |val|\n sum += (val.length % 2 == 0) ? val.length : val.length + 1\n end\n sum\n end\n end", "def total_size\n self._total_size(self, 0)\n end", "def total_bytes\n self.files.map {|file| file[:size].to_i}.reduce(:+) # to_i handles any nil file sizes\n end", "def pending_data_size\n get_outbound_data_size + @pending_size\n end", "def cache_current_size\n\n @cache.size\n end", "def size_in_bytes\n ( file_length * 16 ) / 8\n end", "def entry_size; BLOCK_SIZE; end", "def entry_size; BLOCK_SIZE; end", "def active_bytes\n active * pagesize\n end", "def data_len_bytes()\n 2\n end", "def data_len_bytes()\n 2\n end", "def data_len_bytes()\n 2\n end", "def size\n @real_time_memory.size + @user_memory.size\n end", "def free\n df = DiskFree.new(@dir.path)\n df.total - df.used\n end", "def required_space\n # Start with our cached default generated size\n space = cached_size\n\n # EXITFUNK 'thread' is the biggest by far, adds 29 bytes.\n space += 29\n\n # Reliability adds some bytes!\n space += 44\n\n space += uuid_required_size if include_send_uuid\n\n # The final estimated size\n space\n end", "def terabytes\n self * TERABYTE\n end", "def calculate_disk_usage\n user_own_maps = self.own_maps #saves 4 calls\n\n files = user_own_maps.map{|m| m.unwarped_filename if File.exist? m.unwarped_filename} + user_own_maps.map{| m | m.masked_src_filename if File.exist? m.masked_src_filename} + user_own_maps.map{|m | m.warped_filename if File.exist? m.warped_filename} + user_own_maps.map{|m| m.warped_png_filename if File.exist? m.warped_png_filename}\n files.compact!\n\n total_size = files.inject(0) {| result, file | result + File.size(file) }\n\n return total_size\n end", "def exabytes\n self * EXABYTE\n end", "def backed_up()\n cnt = @queue.size() + (@current_req.nil? ? 0 : 1)\n return 0 if 0 == cnt\n if @max_queue_count.nil? || 0 == @max_queue_count\n cnt = 80 if 80 < cnt\n cnt\n else\n cnt * 100 / @max_queue_count\n end\n end", "def storage_throughput\n data[:storage_throughput]\n end", "def d_size\n @capacity / @blockSize\n end", "def disk_current_size\n\t\treturn 1024\n\tend", "def usageThisBillingPer profile_name, interface\n stats= TCD::Storage.readStats(profile_name, interface) {|path| TCD::Profiles.PathInCurrentCycle?(profile_name, interface, path) }\n bytes_in=0\n bytes_out=0\n stats[:in].each {|size, date| bytes_in+=size}\n stats[:out].each{|size, date| bytes_out+=size}\n bytes_in+bytes_out\n end", "def current_size\n @data.size\n end", "def bytes_consumed\n self.bytesize# + 1\n end", "def size\n\t\t\t@storage.size\n\t\tend", "def part_size_in_bytes\n data.part_size_in_bytes\n end", "def filesize; end", "def data_size\n File.size(file_path)\n end", "def data_size\n File.size(file_path)\n end", "def get_size\n\t\tend", "def compressed_size; end", "def compressed_size; end", "def size\n stats[:dataSize]\n end", "def size\n stats[:dataSize]\n end", "def size\n\t\treturn 0 if @setup.secure or @setup['no_cache'] or not FileTest::exist?( @setup['cache_path'] )\n\n\t\tFileTest.size( @setup['cache_path'] )\n\tend", "def total\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tIO.foreach('/proc/meminfo').first.split[1].to_i\n\t\t\tend", "def decompressed_size; end", "def bytes\n @number\n end", "def blksize() end", "def memory_footprint\n BULK_APIS.keys.map do |key| \n size = nil\n if redis.exists(redis_key(key))\n size = redis.debug(\"object\", redis_key(key)).match(/serializedlength:(\\d+)/)[1].to_i / 1024.0\n end\n [key, size]\n end.to_h.compact\n end", "def cache_accounts_above_disk_free_percentage\n return @cache_accounts_above_disk_free_percentage\n end", "def swapused\n @swaptotal - @swapfree\n end", "def size\n read.bytesize\n end", "def current_table_size\n @table.inject(0) { |r, (k, v)| r + k.bytesize + v.bytesize + 32 }\n end", "def free_block_count\n dev_stat ? dev_stat.blocks_free / (Block.size / dev_stat.block_size) : 0\n end", "def available_copies\n copies.count(&:available?)\n end", "def byte_size()\n @value.length * 4\n end", "def byte_size()\n @value.length * 4\n end", "def length\n do_num_bytes\n end", "def size\n\t\tstat[:size]\n\tend", "def size\n\t\tstat[:size]\n\tend", "def inactive_bytes\n inactive * pagesize\n end", "def getFileSize()\n getRealFileSize(file) / MEGABYTE\n end", "def size\r\n @pack.size\r\n end", "def length\n @storage.length\n end", "def size\n @contents.bytes.size\n end", "def size\n return @usrData.size\n end", "def _size\n @allocated.length + @available_connections.length\n end", "def rss_bytes\n if ENV['OS'] == 'Windows_NT'\n 0\n else\n `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes\n end\n end", "def percent_used\n 100 - (100.0 * bytes_free.to_f / bytes_total.to_f)\n end", "def fetch_disk_size\n total_size = 0\n total_size = `lsblk -b --output SIZE -d -n | paste -s -d + - | bc`\n number_to_human_size total_size\n end", "def free_blocks\n free_space / BLOCK_SIZE\n end" ]
[ "0.75247806", "0.7246485", "0.7090979", "0.700487", "0.693468", "0.6873506", "0.685306", "0.68505424", "0.68375874", "0.6824555", "0.6806502", "0.6796714", "0.6729013", "0.668996", "0.6667818", "0.66670495", "0.66430736", "0.6638221", "0.6628052", "0.66216385", "0.6593814", "0.6564851", "0.6551924", "0.65463907", "0.6519514", "0.65050334", "0.6494834", "0.64911735", "0.64879584", "0.6465999", "0.6464389", "0.64531326", "0.6444138", "0.6444058", "0.6437911", "0.6435846", "0.6416249", "0.6408359", "0.63828194", "0.6378754", "0.6376865", "0.6364423", "0.6362835", "0.6359462", "0.6359462", "0.6358175", "0.6353093", "0.6353093", "0.6352906", "0.6348625", "0.63432366", "0.6343117", "0.6325612", "0.63226223", "0.63129586", "0.63117", "0.6310488", "0.6310128", "0.63043237", "0.6297297", "0.62966424", "0.6279245", "0.6250989", "0.62508655", "0.6249292", "0.6241686", "0.6241686", "0.62349033", "0.6209386", "0.6209386", "0.62034154", "0.62034154", "0.6203278", "0.61914426", "0.6191231", "0.6168066", "0.6161011", "0.61608654", "0.6157024", "0.6152256", "0.61512715", "0.615031", "0.61471415", "0.6137253", "0.6134072", "0.6134072", "0.6130483", "0.6127637", "0.6127637", "0.612648", "0.6123312", "0.61214066", "0.6113679", "0.61105686", "0.61096907", "0.61071396", "0.60781026", "0.60749924", "0.60729086", "0.6069041" ]
0.7317086
1
as a calendar DB redord
def to_ics_string # LastNote or mhc is assumed. if @wrapped_record.respond_to?(:to_ics_string) result = @wrapped_record.to_ics_string return result end # HTTP::Response from caldav server is assumed. if @wrapped_record.respond_to?(:body) return @wrapped_record.body end return nil # Nil or unsupport object class. XXX donot put. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_database\n DATA[:calendars].each do |calendar|\n CalendarCoordinator::Calendar.create(calendar).save\n end\n\n calendar = CalendarCoordinator::Calendar.first\n DATA[:events].each do |event|\n calendar.add_event(event)\n end\n end", "def calendar\n @calendars = Calendar.all.where(:UserId => [current_user.id, nil]).order(:start_time)\n end", "def get_calendar opt = {}\n calendar = RiCal.Calendar\n subjects = []\n events_list = []\n if opt[:space].nil?\n #Crea la lista de id's de materias que corresponden a la carrera en un año dado\n Materia.find(:all, :conditions => {:codigo_carrera => opt[:career], :anio => opt[:year]}).each do |m|\n subjects << m.codigo.to_i\n end\n #Lo de buscar no reccurrentes diferenciando de los recurrentes es algo que quedo de la vieja busqueda y deberia ser adaptado todo\n # al nuevo objetivo de esta busqueda. Deberia verse que no pertenece a ninguna materia.\n if opt[:all]\n events_list = Evento.find :all, :conditions => \"dtstart > '#{opt[:date]}' AND '#{opt[:date] + 1.day}' > dtstart AND reccurrent = 'f'\"\n events_list += Evento.find :all, :conditions => { :reccurrent => true, :byday => opt[:date].strftime(\"%a\").upcase[0..1]}\n events_list += Evento.find :all, :conditions => \"reccurrent = 't' AND rdate <> ''\"\n events_list += Evento.find :all, :conditions => \"reccurrent = 't' AND exdate <> ''\"\n else\n events_list = Evento.find :all, :conditions => \"dtstart > '#{opt[:date]}' AND '#{opt[:date] + 1.day}' > dtstart AND reccurrent = 'f'\" if opt[:year] == 0\n events_list += Evento.find :all, :conditions => { :reccurrent => true, :byday => opt[:date].strftime(\"%a\").upcase[0..1]}\n events_list += Evento.find :all, :conditions => \"reccurrent = 't' AND rdate <> ''\"\n events_list += Evento.find :all, :conditions => \"reccurrent = 't' AND exdate <> ''\"\n end\n else\n # Buscar eventos segun un espacio\n events_list = Evento.find(:all, :conditions => \"dtstart > '#{opt[:date]}' AND '#{opt[:date] + 1.day}' > dtstart AND reccurrent = 'f' AND espacio_id = #{opt[:space]}\")\n events_list += Evento.find(:all, :conditions => { :reccurrent => true, :byday => opt[:date].strftime(\"%a\").upcase[0..1], :espacio_id => opt[:space]})\n events_list += Evento.find :all, :conditions => \"reccurrent = 't' AND rdate <> ''\"\n events_list += Evento.find :all, :conditions => \"reccurrent = 't' AND exdate <> ''\"\n\n end\n\n # Elimina duplicados\n events_list.uniq!\n\n # Carga al calendario\n events_list.each do |event|\n new_event = RiCal.Event\n new_event.description = event.description || ''\n new_event.dtstart = event.dtstart.strftime '%Y%m%dT%H%M00'\n new_event.dtend = event.dtend.strftime '%Y%m%dT%H%M00'\n new_event.location = event.espacio_id.to_s\n new_event.rrule = \"FREQ=\" + event.freq + \";BYDAY=\" + event.byday + \";INTERVAL=\" + event.interval.to_s + \";UNTIL=\" + event.renddate.strftime('%Y%m%dT%H%M00') if event.reccurrent\n new_event.exdates = event.exdate.to_a\n new_event.rdates = event.rdate.split(',').collect{|e| DateTime.parse e} || ''\n new_event.comment = event.id.to_s\n\n # Analisis de ocurrencia\n if event.reccurrent\n occurrence = new_event.occurrences :count => 1, :starting => opt[:date], :before => opt[:date] + 1\n if occurrence.count > 0\n if event.materia_id.nil? or opt[:all]\n # Agregar el evento sin materia\n calendar.add_subcomponent occurrence[0]\n else\n # Agregar el evento si coincide con alguna materia en subjects\n calendar.add_subcomponent occurrence[0] if subjects.include? event.materia_id #new_event\n end\n end\n else\n if event.materia_id.nil? or opt[:all]\n # Agregar el evento sin discriminarlo\n calendar.add_subcomponent new_event if Date.parse(event.dtstart.year.to_s + '/' + event.dtstart.month.to_s + '/' + event.dtstart.day.to_s) == opt[:date]\n else\n # Agregar el evento si coincide con alguna materia en subjets\n calendar.add_subcomponent new_event if Date.parse(event.dtstart.year.to_s + '/' + event.dtstart.month.to_s + '/' + event.dtstart.day.to_s) == opt[:date] and subjects.include? event.materia_id\n end\n end\n end\n return calendar\n end", "def schedule(db, date, patient_id, time)\n\tdb.execute(\"INSERT INTO calendar (date, patient_id, time) VALUES (?, ?, ?)\", [date, patient_id, time])\nend", "def index\n @calendar = Calendar.find(1)\n end", "def insert_calendar(opts = {})\n end", "def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end", "def calendar(date=nil)\n date ||= Date.today\n time = date.to_time \n start_at = time.since(1.month).at_end_of_month\n end_at = time.ago(1.month).at_beginning_of_month\n\n Rails.cache.fetch(\"calendar_#{self.id}_#{self.entries_count}_#{start_at.to_i}_#{end_at.to_i}\", :expires_in => 1.day) do\n calendar = Entry.find_by_sql(['SELECT id, created_at, DATE_FORMAT(created_at, \"%d-%m-%y\") day, count(*) as count FROM entries WHERE user_id = ? AND is_private = 0 AND created_at < ? AND created_at > ? GROUP BY day ORDER BY created_at ASC', self.id, start_at.to_s(:db), end_at.to_s(:db)])\n calendar.group_by { |entry| entry.created_at.month }.sort_by { |a| a }\n end\n end", "def calendar\n get '/gtfs/calendar'\n end", "def calendar\n\t @videos = Video.all\n\tend", "def init_calendar\n @cal = Icalendar::Calendar.new\n @cal.prodid = \"DoC Timetable\"\n set_calendar_name\n set_calendar_timezones\n end", "def mini_calendar\n if request.request_uri == '/'\n params[:id] = Time.now.strftime('%Y-%m-%d')\n end\n \n @calendars = Calendar.all\n \n selection = DateTime.strptime(\"#{params[:id]}T00:00:00+00:00\")\n \n prev_month = selection.advance :months => -1\n next_month = selection.advance :months => 1\n \n calendar( :month => selection.strftime(\"%m\").to_i,\n :year => selection.strftime(\"%Y\").to_i,\n :show_today => true,\n :abbrev => (0..0),\n :previous_month_text => (link_to \"#{image_tag '/images/left_arrow.gif', :alt => 'Previous Month'}\", \"/calendar_list/#{prev_month.strftime('%Y-%m-%d')}\"),\n :next_month_text => (link_to \"#{image_tag '/images/right_arrow.gif', :alt => 'Next Month'}\", \"/calendar_list/#{next_month.strftime('%Y-%m-%d')}\")) do |d|\n cell_text = \"#{d.mday}<br />\"\n cell_attrs = {:class => 'day'}\n @calendars.each do |e|\n #if (e.start_date.day == d.day) || ( e.start_date <= d && e.end_date >= d )\n if ((e.start_date.year == d.year) && (e.start_date.month == d.month) && (e.start_date.day == d.day)) || ( e.start_date <= d && e.end_date >= d )\n cell_attrs[:class] = 'specialDay'\n cell_text = link_to \"#{d.mday}<br />\", \"/daily_event/#{d}\"\n end\n end\n [cell_text, cell_attrs]\n end\n end", "def calendar\n\t\t@pagenumber=154\n\t\tdata=params\n\t\tsession[:referer] = nil\n\t\tget_report_favourites\n\t\tset_date_and_month_for_calendar(data)\n\t\t@calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), :month)\n\t\tget_receiver_and_provider\n\t\t@calendar.time_entries = Physical::Timeandexpenses::TimeEntry.find(:all,:conditions => ['employee_user_id = ? and (time_entry_date BETWEEN ? and ? ) and matter_people_id is null', @receiver.id, @calendar.startdt, @calendar.enddt ])\n\t\tif request.xhr?\t\t\t\n\t\t\trender :partial=> \"content\"\n\t\telse\n\t\t\trender :layout => \"left_with_tabs\"\n\t\tend\n\tend", "def main_calendar\n if params[:id]\n @time_now = \"#{params[:id]}\"\n else\n @time_now = \"#{Time.now.strftime('%Y-%m-%d')}\"\n end\n \n selection = DateTime.strptime(\"#{@time_now}T00:00:00+00:00\") \n\n prev_month = selection.advance :months => -1\n next_month = selection.advance :months => 1\n\n calendar( :month => selection.strftime(\"%m\").to_i,\n #:month => params[:mo].to_i,\n :year => selection.strftime(\"%Y\").to_i,\n :show_today => true,\n :previous_month_text => (link_to \"#{image_tag '/images/left_arrow.gif', :alt => 'Previous Month'}\", \"#{prev_month.strftime('%Y-%m-%d')}\"),\n :next_month_text => (link_to \"#{image_tag '/images/right_arrow.gif', :alt => 'Next Month'}\", \"#{next_month.strftime('%Y-%m-%d')}\")) do |d|\n\n cell_text = \"<p class=\\\"num\\\">#{d.mday}</p><br />\"\n cell_attrs = {:class => 'day'}\n @events.each do |e|\n if ((e.start_date.year == d.year) && (e.start_date.month == d.month) && (e.start_date.day == d.day)) || ( e.start_date <= d && e.end_date >= d )\n cell_attrs[:class] = 'specialDay' \n cell_text += link_to \"#{e.event}\", \"/calendars/show/#{e.id}\", :rel => 'facebox', :class => \"text\"\n cell_text += \"<br />\"\n end\n end\n [cell_text, cell_attrs]\n end\n end", "def index\n @events = Event.order(:time).order(:date)\n \n fetch_calendar 'tgbgmclhk5gegn8t95fvqov0s8@group.calendar.google.com'\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def events_as_ical\n\n calendar = RiCal.Calendar do |cal|\n events.each do |e|\n cal.event do |event|\n event.summary = e.name\n event.dtstart = e.starts_at.getutc\n event.dtend = e.ends_at.getutc\n end\n end\n end\n\n calendar.to_s\n \n end", "def find_calendar\n @calendar = @node.content\n end", "def index\n create_calendar_props\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def create\n \n @org_calendars= current_user.organization.calendars(:order=>'created_at ASC')\n puts @org_calendars.inspect\n @org_last_calendar=@org_calendars.find(:last)\n puts \"#########################\"\n puts @org_last_calendar.inspect\n puts \"*****************************\"\n if !@org_calendars.blank? && !@org_last_calendar.blank?\n y= @org_last_calendar.cal_num.gsub!(\"CAL-\",\"\")\n \n m=y.to_i\n m = m +1\n x = (\"CAL-%0.4d\" %m.to_i).to_s\n\n params[:calendar][:cal_num] = x\n \n @calendar = Calendar.new(params[:calendar])\n @calendar.organization = current_user.organization\n @calendar.user = current_user\n else \n m = 1\n x = (\"CAL-%0.4d\" %m.to_i).to_s\n params[:calendar][:cal_num] = x\n @calendar = Calendar.new(params[:calendar])\n @calendar.organization = current_user.organization\n @calendar.user = current_user\n end\n \n @calendar.entry_date = change_date_format(params[:calendar][:entry_date]) if !(params[:calendar][:entry_date]).blank?\n respond_to do |format|\n if @calendar.save\n format.html { redirect_to calendars_url, notice: 'Calendar was successfully created.' }\n format.json { render json: @calendar, status: :created, location: @calendar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @calendar.errors, status: :unprocessable_entity }\n end\n end\n end", "def calendar\n selectedShots=Shot.all\n if (params[:shotType].present?)\n selectedShots=Shot.where(:shottype_id => params[:shotType].to_i).to_a\n end\n @shots=selectedShots\n @date=params[:month] ? Date.parse(params[:month]) : Date.today\n @formData=params\n @pageTitle=\"Shot calendar\"\n end", "def iCal\n \n @task = Task.find(params[:id])\n # Create a calendar with an event (standard method)\n cal = Icalendar::Calendar.new\n cal.event do |e|\n e.dtstart = Icalendar::Values::Date.new(@task.date)\n e.summary = \"#{@task.category} #{@task.title}\"\n e.ip_class = \"PRIVATE\"\n end\n\n cal.publish\n render text: cal.to_ical, content_type: 'text/calendar'\n \nend", "def calendar_list\r\n logger.info(\"-- calendar list st --\") if logger\r\n auth unless @auth\r\n uri = URI.parse(CALENDAR_LIST_PATH)\r\n res = do_get(uri, {})\r\n logger.info(\"-- calendar list en(#{res.message}) --\") if logger\r\n res\r\n end", "def set_calendar\n @calendar = Calendar.find(params[:id])\n end", "def index\n @calendar_dates = CalendarDate.all\n end", "def index\n @calendar_days = CalendarDay.all\n end", "def view_all_date(db)\n db.execute(\"SELECT * FROM lifts ORDER BY date DESC\")\nend", "def set_calendar\n @calendar = @hairdresser.calendars.find(params[:calendar_id])\n end", "def display_calendar screen,from,to\n store = Persistent::DiskStore.new(CALENDAR_FILE)\n screen.clear\n screen.print_screen( _print_calendar(store, from,to ))\n screen.status( _print_status_line(from,to))\nend", "def insert_calendar_list(opts = {})\n end", "def index\n @calendars = Event.all\n end", "def index\n @calendars = Calendar.all\n end", "def index\n @calendars = Calendar.all\n end", "def calendar_open\n\t\tcal=Calendar.where(:anio => Date.parse(desde.to_s).year,:department_id => Employee.find(employee_id).department.id).first\n\t\tif cal.nil? || cal.status!=true\n\t\t\t\terrors.add(:desde,\"El calendario para las fechas seleccionadas esta cerrado por su auditor.\")\n\t\tend\n\tend", "def get_calendar \n\t\t@calendar = @current_user.calendar \n\t\ttodays_date_for_user = (Time.current.utc + @current_user.time_zone_offset.minutes).to_date\n\n\t\tif @calendar\n\t\t\ttodays_schedule = {}\n\t\t\ttomorrows_schedule = {}\n\n\t\t\t@calendar.schedule.each do |time, status|\n\t\t\t\t# get time and convert all times used to users time zone before doing anything \n\t\t\t\tusers_time = DateTime.parse(time) + @current_user.time_zone_offset.minutes\n\t\t\t\t\n\t\t\t\t# users actual date in their time zone and formatted time in schedule to users time zone \n\t\t\t\tdate = users_time.to_date \n\t\t\t\tformatted_time = users_time.strftime(\"%-I:%M%p\").downcase\n\t\t\t\t\n\t\t\t\tif date == todays_date_for_user\n\t\t\t\t\ttodays_schedule[formatted_time] = status \n\t\t\t\telsif date == (todays_date_for_user + 1.day)\n\t\t\t\t\ttomorrows_schedule[formatted_time] = status \n\t\t\t\telse \n\t\t\t\t\t# if outdated, remove from schedule and place in archive \n\t\t\t\t\t@calendar.schedule.except!(time)\n\t\t\t\t\t@calendar.archive[time] = status \n\t\t\t\tend\n\t\t\tend\n\n\t\t\tselected = todays_schedule.length + tomorrows_schedule.length == 0 ? false : true \n\t\t\t\n\t\t\trender json: {is_success: true, todays_schedule: todays_schedule, tomorrows_schedule: tomorrows_schedule, selected: selected}\n\t\t\t\n\t\t\t@calendar.save \t\n\t\t\t@calendar.touch \n\n\t\telse\n\t\t\tCalendar.new(\n\t\t\t\tuser: @current_user, \n\t\t\t\tschedule: {},\n\t\t\t\tarchive: {}\n\t\t)\n\t\t@current_user.calendar.save \n\t\trender json: {is_success: true, todays_schedule: {}, tomorrows_schedule: {}, selected: false }, status: :ok \n\t\tend\n\n\tend", "def create_database\n DATA[:accounts].each do |account|\n CalendarCoordinator::AccountService.create(data: account).save\n end\n\n account = CalendarCoordinator::Account.first\n DATA[:calendars].each do |calendar|\n account.add_owned_calendar(calendar)\n end\n end", "def home\n\n @events = Event.limit(4)\n @events_calendar = Event.all\n\nend", "def clear_calendar\n end", "def enter_calories(db, day, amt_burned, member_id) \n month = Time.now.strftime(\"%m\") \n db.execute(\"INSERT INTO calories (day, month, amt_burned, member_id) VALUES (?, ?, ?, ?)\", [day, month, amt_burned, member_id]) \nend", "def calendar_view\n return @calendar_view\n end", "def index\n @calender_events = CalenderEvent.all\n end", "def to_ical_event(set_alarm = true)\n $version = \"0214.2\"\n e = Icalendar::Event.new\n k=0\n evt_url = \"https://riclife.palladius.eu/events/#{id}\"\n my_description = # \"[repetition_magic_string: '#{repetition_magic_string}']\" + \n \"#evt_url: #{evt_url}\"\n begin\n e.summary = ical_summary() # \"[#{calendar.abbrev rescue '_BOH_'}] #{summary}\"\n e.dtstart = DateTime.parse(tstart.to_s)\n e.dtend = DateTime.parse(tend.to_s) \n e.location = venue.address rescue \"(Venue Unknown)\"\n e.klass = self.private ? \"PRIVATE\" : \"PUBLIC\"\n e.ip_class = e.klass\n e.description = full_description(my_description) rescue \"Err rendering full_description: #{$!}\"\n attendees.each{ |x| \n k += 1\n e.add_attendee( x.full_mail(\" (Attendee #{k})\") ) rescue nil\n } # attendee\n e.add_attendee( creator.full_mail(\" (Creator)\") ) rescue nil\n e.alarm do # allarme funge!!!\n action \"DISPLAY\" # This line isn't necessary, it's the default\n summary \"Alarm notification Riccardo\"\n trigger \"-P1DT0H0M0S\" # 1 day before\n end if set_alarm\n e.geo = Icalendar::Geo.new(venue.lat , venue.lng) if (defined?(venue.lat) && defined?(venue.lng) )\n e.url = evt_url\n if repeats # repeats, per comodita lo faccio weekly...\n puts(\"Aggiungo una rrule..\")\n e.add_recurrence_rule(repetition_magic_string()) \n end\n rescue\n e.description = \"Event.to_ical_event(ver=#{$version}) Some exception:\\nMsgErr= ''#{$!}'' \\n\\nMsgCall='''#{caller.join(\"\\n -- \")}'''\"\n end\n return e\n end", "def as_json(*)\n CalendarJSON.rent(self)\n end", "def calendar (id)\n @config.calendars.push(id)\n end", "def calendar\n\t\t@course = Course.find(params[:id])\n\t\t@date = params[:month] ? Date.parse(params[:month]) : Date.today\n\t\t@assignments = @course.assignments.where(\"due_date\")\n\tend", "def calendar_id\t\t\n \t\t# calendar id returns nil if user doesn't exist\n \t\tcalendar unless !has_calendar? \n \tend", "def orm; end", "def set_calendar_date\n @calendar_date = CalendarDate.find(params[:id])\n end", "def index\n @events = Event.upcoming.order(:start_time)\n @events_cal = Event.ical(@events) if params[:format] == 'ics'\n end", "def get_google_calendar\n result = Gandalf::GoogleApiClient.get_google_calendar(self.apps_cal_id)\n result.data\n end", "def browse_by_day\n # Checkeo de parametros. El parametro date contiene la fecha seleccionada, pero puede venir tambien star_date,\n # con el mismo uso. Hay dos, porque el weekly_viewer usa start_date, pero habria que unificarlo.\n # Si hay algo en esos parametros se usa eso, y si no se usa la fecha de hoy.\n if params[:date].nil?\n if params[:start_date].nil?\n @search_by_date = Date.today\n else\n @search_by_date = params[:start_date].to_date\n end\n else\n if @search_by_date.nil?\n begin\n @search_by_date = Date.parse(params[:date][:year] + '-' + params[:date][:month] + '-' + params[:date][:day])\n rescue => e\n @search_by_date = Date.today\n end\n end\n end\n\n @events = []\n if params.include? :business_hours\n @business_hours = params[:business_hours]\n end\n if not params[:carrera].nil?\n @carrera_selected = params[:carrera][:carrera_id]\n end\n\n # busqueda de los eventos por año, los del año \"0\" son los eventos no recurrentes en este momento, pero eso esta mal, deberian ser los que no estan\n # asignados a una materia. Lo de que sean recurrentes o no recurrentes, ya no es tan asi en esta busqueda y debemos cambiarlo, pero me termino de avivar recien\n # y ya es tarde\n @free_spaces = Espacio.all\n 6.times do |an|\n @calendar = nil\n @calendar = get_calendar :date => @search_by_date, :career => (params.include? :carrera) ? params[:carrera][:carrera_id] : nil, :year => an\n @calendar.events.each do |event|\n\n temp = SimpEvent.new\n temp.starts_at = event.dtstart\n temp.ends_at = event.dtend\n temp.name = event.description + ' - ' + Espacio.find(:first, :conditions => {:id => event.location.to_i}).codigo\n temp.original_id = event.comment[0].to_i\n temp.anio = an\n @events.push temp\n\n @free_spaces.delete(Espacio.find_by_id event.location.to_i) if DateTime.now.strftime('%H%M').to_i.between? event.dtstart.strftime('%H%M').to_i, event.dtend.strftime('%H%M').to_i\n end\n end\n @ver_horas = params[:ver_horas] == \"1\" ? false : true\n redirect_to \"/eventos/browse_by_day?business_hours=#{@ver_horas}&start_date=#{@search_by_date}\" unless params[:ver_horas].nil?\n end", "def create_google_calendar\n unless self.apps_cal_id\n result = Gandalf::GoogleApiClient.insert_google_calendar({\n \"summary\" => self.name\n })\n self.apps_cal_id = result.data.id\n self.save!\n end\n end", "def dates\n end", "def create_calendar(name, opts={})\n opts[:name] = name\n\n cal = GCalendar::Calendar.new(:opts=>opts)\n\n calendars << cal\n cal.sync\n save\n end", "def calendar(text='Select a Date', height=0, width=0, day=Date.today.mday, month=Date.today.mon, year=Date.today.year)\n command = %(--calendar \"#{text}\" #{height.to_i} #{width.to_i} #{day.to_i} #{month.to_i} #{year.to_i})\n call_and_capture command do |value|\n Date::civil *value.split('/').collect(&:to_i).reverse\n end\n end", "def get_reminders(date)\r\n d = date_checker(date)\r\n new_date = normalize_date(d)\r\n get = <<-SQL\r\n SELECT * FROM reminders WHERE date = ?\r\n SQL\r\n $DB.execute(get, [new_date])\r\n #puts selected_reminders\r\nend", "def add_event(doc, n, *args)\r\n# p 'Add event ' + args[1][0..199]\r\n new_event = CalendarEvent.find_or_initialize_by_pageextsourceID(:pageextsourceID => doc.xpath(\"//item//id\")[n].text, \r\n :event_type => 'ce', :event_title => args[1][0..199],\r\n :cbody => doc.xpath(\"//item//description\")[n].text, \r\n :postdate => DateTime.parse(doc.xpath(\"//item//pubDate\")[n].text),\r\n :eventstartdate => args[2], :eventstarttime => args[2], :eventenddate => args[3], :eventendtime => args[3],\r\n :contentsourceURL => args[5][0..99], \r\n :location => doc.xpath(\"//item//xCal:location\")[n].text,\r\n :mapplacename => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-venue-name\")[n].text[0..59],\r\n :mapstreet => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-street\")[n].text[0..39],\r\n :mapcity => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-city\")[n].text[0..39],\r\n :mapstate => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-region\")[n].text[0..24],\r\n :mapzip => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-postalcode\")[n].text[0..9],\r\n :mapcountry => doc.xpath(\"//item//xCal:adr//xCal:x-calconnect-country\")[n].text[0..39],\r\n :contactphone => doc.xpath(\"//item//phone\")[n].text[0..14],\r\n :contentsourceID => args[4], :localGMToffset => args[6], :endGMToffset => args[6],\r\n :subscriptionsourceID => args[4]) \r\n new_event.longitude, new_event.latitude = doc.xpath(\"//item//geo:long\")[n].text.to_f, doc.xpath(\"//item//geo:lat\")[n].text.to_f \r\n new_event.imagelink = doc.xpath(\"//item//images//url\")[n].text rescue nil\r\n new_event.save(:validate=>false)\r\n end", "def update_calendar(opts = {})\n end", "def show\n if @connection.notion?\n @databases = @connection.client.list_databases\n else\n calendar_service = Google::Apis::CalendarV3::CalendarService.new\n calendar_service.authorization = Google::Auth::UserRefreshCredentials.new(\n client_id: Rails.application.credentials.google_client_id,\n client_secret: Rails.application.credentials.google_client_secret,\n scope: @connection.scope,\n access_token: @connection.access_token,\n refresh_token: @connection.refresh_token,\n # expires_at: data.fetch(\"expiration_time_millis\", 0) / 1000\n )\n\n @calendars = calendar_service.list_calendar_lists()\n end\n end", "def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end", "def set_calender\n @calender = Calender.find(params[:id])\n end", "def set_calendar\n @calendar = Hash.new {|h, date| h[date] = Array.new}\n\n # Itera sobre cada evento y lo añade en la fecha en que se celebra si es que no está ya metido\n # EventDecorator.decorate_collection(events).each do |event|\n events.each do |event|\n unless @calendar[event.date].include? event\n @calendar[event.date] << event\n end\n end\n\n @calendar = @calendar.sort.to_h\n end", "def cwday\n end", "def set_calendar_day\n @calendar_day = CalendarDay.find(params[:id])\n end", "def set_calendar_day\n @calendar_day = CalendarDay.find(params[:id])\n end", "def create_reminder(date, reminder)\r\n norm_date = normalize_date(date)\r\n $DB.execute(\"INSERT INTO reminders (date, reminder) VALUES (?,?)\",\r\n [norm_date, reminder])\r\nend", "def get_calendar\n\t# 日付情報を格納する配列を宣言\n\tcal_data = Array.new(0)\n\n\t(1..@wday.length - 1).each do |day|\n\t\t# 曜日がnilになったら月が終わりなのでbreak\n\t\tif @wday[day] == nil\n\t\t\tbreak\n\t\tend # if\n\n\t\t# 日付と曜日番号をひとつの配列にする\n\t\tday_data = [\"#{day}\", @wday[day]]\n\n\t\t# 日付情報に日付と曜日番号の配列を追加\n\t\tcal_data << day_data\n\tend # each\n\n\t# 日付情報を返却\n\treturn cal_data\nend", "def index\n url = 'https://churchofjesuschrist.org/church-calendar/services/lucrs/ical/group/b03afe3544134ca59a839688d454fb2b'\n \n begin\n raw_file = URI.parse(url).read\n calendar = Calendar.create_or_find_by(url: url)\n calendar.update(raw: raw_file)\n rescue OpenURI::HTTPError => e\n logger.debug e\n raw_file = Calendar.find_by(url: url).raw\n end\n\n ical = Icalendar::Calendar.parse(raw_file).first\n\n events_by_month = ical.events.reverse.inject({}) do |by_month, event|\n month = DateTime::MONTHNAMES[event.dtstart.to_datetime.month]\n by_month[month] ? by_month[month] << event : by_month[month] = [event]\n by_month\n end\n\n @icalendar = OpenStruct.new(\n events: ical.events,\n events_by_month: events_by_month\n )\n end", "def get_calendar_list()\n\t\tif(!@client.nil?)\n\t\t\tresponse = @client.execute(api_method: @service.calendar_list.list)\n\t\t\tcalendars = JSON.parse(response.body)\n\t\telse\n\t\t\tputs \"Client No Calendar boi\"\n\t\tend\n\tend", "def index\n @default_line_calendars = DefaultLineCalendar.all\n end", "def index\n @default_line_calendars = DefaultLineCalendar.all\n end", "def lifts_by_date(db, date)\n db.execute(\"SELECT * FROM lifts WHERE date = '#{date}'\")\nend", "def index\n @month_now = (Time.zone || Time).now.month.to_i\n @year_now = (Time.zone || Time).now.year.to_i\n @month = (params[:month] || (Time.zone || Time).now.month).to_i\n @year = (params[:year] || (Time.zone || Time).now.year).to_i\n @day = (params[:day] || (Time.zone || Time).now.day).to_i\n @last_month_start = Date.new(@year_now, @month_now-1).to_time\n @month_start = Date.new(@year, @month).to_time\n @month_end = Date.new(@year, @month+1).to_time\n @next_year_end = Date.new(@year_now+2, 1).to_time\n\n @shown_month = Date.civil(@year, @month)\n\n @events = Event.where(\"end_at BETWEEN :month_start AND :month_end OR start_at BETWEEN :month_start AND :month_end\", {:month_start => @month_start, :month_end => @month_end})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n\t \tformat.ics do\n\t\t\t\tsend_data(\texport_ical_range(@last_month_start,@next_year_end).export,\n\t\t\t\t\t\t\t\t\t\t:filename=>\"reisebuero_events.ics\",\n\t\t\t\t\t\t\t\t\t\t:disposition=>\"inline; filename=reisebuero_events.ics\",\n\t\t\t\t\t\t\t\t\t\t:type=>\"text/calendar\")\n\t\t\tend\n end\n end", "def get_current_calendar\n session[:cal_time] ||= Time.now\n Entry.find(:all,\n :conditions => [ 'created_at > ? and created_at < ?',\n\t\t session[:cal_time].at_beginning_of_month,\n\t\t session[:cal_time].next_month.at_beginning_of_month ]\n\t ).collect { |e|\n e.created_at.day\n }.uniq\n end", "def default_calendar_id\n @calendar_id ||= editable_calendars.first.calendar_id\n end", "def calendar_events(calendar_id)\n records \"/calendars/#{calendar_id}/calendar_events.xml\", :method => :get\n end", "def create_chronics\n\t\tcreate_influenza_data\n\tend", "def set_update_calendar_string\n if (@multi_dates_id)\n list_events = Event.where(multi_dates_id: @multi_dates_id)\n else\n list_events = []\n end\n\n calendar_string_tab = []\n list_events.each do |event|\n calendar_string_tab << I18n.l(event.begin_at, format: '%d/%m/%Y')\n end\n\n calendar_string = calendar_string_tab.reverse!.join(',')\n\n list_events.each do |event|\n event.calendar_string = calendar_string\n @delete_is_ok &&= event.save\n end\n end", "def calendar\n @reservations= Reservation.all\n @reservations_by_date = @reservations.group_by { |e| e.date.strftime('%Y-%m-%d') }\n @date = params[:date] ? Date.parse(params[:date]) : Date.today\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reservations }\n end\n end", "def index\n\t@events = @calendar.events(:order => 'created_at ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n end\n end", "def create_events(db: EventSourcery::Postgres.config.event_store_database,\n table_name: EventSourcery::Postgres.config.events_table_name)\n db.run 'CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\"'\n db.create_table(table_name) do\n primary_key :id, type: :Bignum\n column :uuid, :uuid, null: false, default: Sequel.lit('uuid_generate_v4()')\n column :aggregate_id, :uuid, null: false\n column :type, :varchar, null: false, size: 255\n column :body, :json, null: false\n column :version, :bigint, null: false\n column :correlation_id, :uuid\n column :causation_id, :uuid\n column :created_at, :'timestamp without time zone', null: false, default: Sequel.lit(\"(now() at time zone 'utc')\")\n index [:aggregate_id, :version], unique: true\n index :uuid, unique: true\n index :type\n index :correlation_id\n index :causation_id\n index :created_at\n end\n end", "def dateselection\nend", "def process_calendar(all_activities)\n result = <<PAGESRC\n <p>\n <em>Dette er et automatisk uttrekk fra NAF-kalenderen, se <a href=\\\"http://aikido.no/kalender\\\">aikido.no</a> for mer utfyllende informasjon.</em>\n </p>\n\n <table border=\"0\" id=\"scraped-calendar\">\n \t<tr><th>Tidspunkt</th><th>Sted</th><th>Aktivitet</th><th>Kontakt</th></tr>\n \t#{create_table_rows(all_activities)}\n </table>\nPAGESRC\n end", "def sdb\n StudentCalendarQuarter.find(\"0#{year.to_s}#{quarter_code_id.to_s}\")\n end", "def all_day ; true ; end", "def db; end", "def db; end", "def day() end", "def get_calendar(calendar_id = 'primary')\n execute(:api_method => service.calendars.get, :parameters => { 'calendarId' => calendar_id }).data\n end", "def view_existing_list(database, date)\n\ttime1AM = database.execute(\"SELECT schedules.'1:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime2AM = database.execute(\"SELECT schedules.'2:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime3AM = database.execute(\"SELECT schedules.'3:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime4AM = database.execute(\"SELECT schedules.'4:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime5AM = database.execute(\"SELECT schedules.'5:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime6AM = database.execute(\"SELECT schedules.'6:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime7AM = database.execute(\"SELECT schedules.'7:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime8AM = database.execute(\"SELECT schedules.'8:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime9AM = database.execute(\"SELECT schedules.'9:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime10AM = database.execute(\"SELECT schedules.'10:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime11AM = database.execute(\"SELECT schedules.'11:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime12PM = database.execute(\"SELECT schedules.'12:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime1PM = database.execute(\"SELECT schedules.'1:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime2PM = database.execute(\"SELECT schedules.'2:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime3PM = database.execute(\"SELECT schedules.'3:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime4PM = database.execute(\"SELECT schedules.'4:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime5PM = database.execute(\"SELECT schedules.'5:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime6PM = database.execute(\"SELECT schedules.'6:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime7PM = database.execute(\"SELECT schedules.'7:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime8PM = database.execute(\"SELECT schedules.'8:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime9PM = database.execute(\"SELECT schedules.'9:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime10PM = database.execute(\"SELECT schedules.'10:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime11PM = database.execute(\"SELECT schedules.'11:00PM' FROM schedules WHERE schedules.day=(?)\",[date])\n\ttime12AM = database.execute(\"SELECT schedules.'12:00AM' FROM schedules WHERE schedules.day=(?)\",[date])\n\n\tputs \"\\n1:00AM - #{time1AM[0][0]}\"\n\tputs \"2:00AM - #{time2AM[0][0]}\"\n\tputs \"3:00AM - #{time3AM[0][0]}\"\n\tputs \"4:00AM - #{time4AM[0][0]}\"\n\tputs \"5:00AM - #{time5AM[0][0]}\"\n\tputs \"6:00AM - #{time6AM[0][0]}\"\n\tputs \"7:00AM - #{time7AM[0][0]}\"\n\tputs \"8:00AM - #{time8AM[0][0]}\"\n\tputs \"9:00AM - #{time9AM[0][0]}\"\n\tputs \"10:00AM - #{time10AM[0][0]}\"\n\tputs \"11:00AM - #{time11AM[0][0]}\"\n\tputs \"12:00PM - #{time12PM[0][0]}\"\n\tputs \"1:00PM - #{time1PM[0][0]}\"\n\tputs \"2:00PM - #{time2PM[0][0]}\"\n\tputs \"3:00PM - #{time3PM[0][0]}\"\n\tputs \"4:00PM - #{time4PM[0][0]}\"\n\tputs \"5:00PM - #{time5PM[0][0]}\"\n\tputs \"6:00PM - #{time6PM[0][0]}\"\n\tputs \"7:00PM - #{time7PM[0][0]}\"\n\tputs \"8:00PM - #{time8PM[0][0]}\"\n\tputs \"9:00PM - #{time9PM[0][0]}\"\n\tputs \"10:00PM - #{time10PM[0][0]}\"\n\tputs \"11:00PM - #{time11PM[0][0]}\"\n\tputs \"12:00AM - #{time12AM[0][0]}\"\nend", "def load_calendar agency_id=nil\n expanded_calendar = {}\n\n #=========GET SERVICE_IDs, ASSOCIATE THEM WITH INTs=====\n sid_numbers = load_service_ids\n\n #=========FIGURE OUT THE SERVICE DAY BOUNDS=============\n\n day_bounds = conn.exec <<-SQL\n select min(departure_time), max(arrival_time) from gtf_stop_times\n SQL\n\n #convert day_bounds to seconds since beginning of local midnight\n sid_start = GoogleTransitFeed::parse_time( day_bounds[0][0] )\n sid_end = GoogleTransitFeed::parse_time( day_bounds[0][1] )\n\n #pop an error if service days overlap\n #if sid_end-sid_start > SECONDS_IN_DAY then raise \"Service day spans #{day_bounds[0][0]} to #{day_bounds[0][1]}; Service days may not overlap\" end\n\n #=========GET TIMEZONE INFORMATION======================\n if agency_id then\n timezone = conn.exec \"SELECT agency_timezone FROM gtf_agency WHERE agency_id='#{agency_id}'\"\n else\n timezone = conn.exec \"SELECT agency_timezone FROM gtf_agency\"\n end\n timezone = TZInfo::Timezone.get( timezone[0][0] ) #convert timezone string (eg \"America/New York\") to timezone\n tz_offset = timezone.current_period.utc_offset #number of seconds offset from UTC (eg -18000)\n dst_offset = timezone.current_period.std_offset #number of seconds changed during daylight savings eg 3600\n\n #=========EXPAND calendar TABLE INTO HASH===============\n dates = conn.exec <<-SQL\n SELECT service_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, start_date, end_date from gtf_calendar\n SQL\n\n #for each service_id in the calendar table\n dates.each do |service_id, mon, tue, wed, thu, fri, sat, sun, start_date, end_date|\n #convert to boolean daymask\n daymask = [mon.to_i, tue.to_i, wed.to_i, thu.to_i, fri.to_i, sat.to_i, sun.to_i].collect do |day| day == 1 end\n\n #Find the UTC date, as if we're in London\n i = GoogleTransitFeed::parse_date( start_date.to_s ) #date as parsed to UTC\n n = GoogleTransitFeed::parse_date( end_date.to_s ) #end date is inclusive\n\n #the expanded calendar is a hash with the dates where services run as keys and\n #the service_ids of particular services running each day as values, grouped in arrays\n #for each day in the service_id date range\n while i <= n do\n if daymask[ i.wday ] then\n expanded_calendar[i] ||= []\n expanded_calendar[i] << sid_numbers[service_id]\n end\n\n i += SECONDS_IN_DAY\n end\n end\n\n #=========APPLY EXCEPTIONS FROM calendar_dates TO expanded_calendar HASH=============\n single_dates = conn.exec <<-SQL\n SELECT service_id, date, exception_type from gtf_calendar_dates\n SQL\n\n single_dates.each do |service_id, date, exception_type|\n #returns UTC date, as if we're in London\n i = GoogleTransitFeed::parse_date( date.to_s )\n expanded_calendar[i] ||= []\n\n if exception_type.to_i == 1 then\n expanded_calendar[i] << sid_numbers[service_id]\n elsif exception_type.to_i == 2 then\n expanded_calendar[i].delete sid_numbers[service_id]\n end\n end\n\n #========CONVERT EXPANDED CALENDAR TO SORTED ARRAY===================================\n expanded_calendar = expanded_calendar.to_a\n expanded_calendar.sort! do |a,b|\n a.first <=> b.first\n end\n\n #========CONVERT SORTED ARRAY INTO CALENDAR OBJECT===================================\n ret = Calendar.new\n expanded_calendar.each do |day, service_ids|\n local_daystart = day.to_i-tz_offset\n #if daylight savings is in effect\n if timezone.period_for_utc( day.to_i ).dst? then\n local_daystart -= dst_offset\n daylight_savings = dst_offset\n else\n daylight_savings = 0\n end\n\n ret.append_day( local_daystart+sid_start, local_daystart+sid_end, service_ids, daylight_savings )\n end\n\n return ret.rewind!\n end", "def drawcalendar(list, year, month, maildays)\n\t\tdebug(\"Where's the calendar?\")\n\t\toff=Date.new(year, month, 01).wday-1 #Offset, can't remember why I need the -1 here, but I do.\n\t\tmdays=(Date.new(year, 12, 31) << (12-month)).day #Days in the month\n\t\trows=((mdays+off+1).to_f/7.0).ceil #Number of rows in calendar, plus 1 to compensate for -1 above. Have confused myself\n\t\tdays = %w{Su Mo Tu We Th Fr Sa}\n\t\t@messagelist.clear\n\t\t@stack_cal.clear{\n\t\tdays.each do |column|\n\t\t\ti = days.index(column)\n\t\t\trow = 0\n\t\t\tstack :left => i*40, :top => 10 do\n\t\t\t\tpara column\n\t\t\t\tuntil row == rows do\n\t\t\t\t\tcalday = i-off+7*row\n\t\t\t\t\tif (1..mdays) === calday #Only want to draw if greater than zero and less than max days\n\t\t\t\t\t\tif calday.to_s.length == 1\n\t\t\t\t\t\t\tcaldaystr = \"0\"+calday.to_s #need \"0\" in front of single digits\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tcaldaystr = calday.to_s\n\t\t\t\t\t\tend\n\t\t\t\t\t\tif maildays.include?(caldaystr+\"/\") \n\t\t\t\t\t\t\tpara make_date_link(list, year, month, calday)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tpara calday\n\t\t\t\t\t\tend\n\t\t\t\t\telse \n\t\t\t\t\t\tpara \"\"\n\t\t\t\t\tend\n\t\t\t\t\trow += 1\n\t\t\t\tend\n\t\t\tend\n\t\tend}\n\tend", "def index\n verify_owner(params[:gcal_id])\n\n calendar_list = @current_user.calendar_list\n calendar = calendar_list.calendars.find_or_create_by(gcal_id: params[:gcal_id])\n calendar.sync!(@current_user.access_token) if not calendar.synced?\n\n render json: calendar.json_data\n end", "def from_google\n @calendars = get_calendar(current_user).to_a\n @calendar_days = @calendars.group_by {|e| \n if e.start.date_time != nil \n e.start.date_time.strftime(\"%Y-%m-%d\").to_time\n end\n }\n @today = Time.now.strftime(\"%Y-%m-%d\").to_time\n @tomorrow = Time.now.tomorrow.strftime(\"%Y-%m-%d\").to_time\n end", "def print_daily_list(db, day)\r\n\tputs \"Chores for #{day}\"\r\n\tprint_chores = db.execute(\"SELECT chores.name, family.name FROM chores, family WHERE chores.complete_by_day = ? AND chores.family_id = family.id\", [day])\r\n\tprint_chores.each do |x|\r\n\t\tputs \"#{x[1]} : #{x[0]}\"\r\n\tend\r\nend" ]
[ "0.6424451", "0.6241097", "0.62382174", "0.6193696", "0.6118175", "0.60520196", "0.6018068", "0.59020257", "0.5891128", "0.58765596", "0.58763486", "0.584211", "0.5829215", "0.58201945", "0.57821494", "0.57356244", "0.5729992", "0.5725412", "0.5705762", "0.5685538", "0.5685538", "0.5685538", "0.5685538", "0.5685538", "0.5685538", "0.5673489", "0.5665431", "0.5663767", "0.562655", "0.5623893", "0.5614485", "0.5603835", "0.55914396", "0.5586056", "0.5579945", "0.5566848", "0.5545468", "0.5529788", "0.55282736", "0.5524625", "0.5518995", "0.5516183", "0.5498574", "0.54874", "0.5479977", "0.54644835", "0.54634774", "0.54584306", "0.5456555", "0.5454399", "0.5447899", "0.54464424", "0.5446165", "0.5442172", "0.5441859", "0.54357797", "0.54255396", "0.5424524", "0.5416039", "0.5411779", "0.5409293", "0.53950065", "0.5392524", "0.5390016", "0.5385718", "0.53806406", "0.5361939", "0.5355461", "0.53547215", "0.5351421", "0.5351421", "0.5335551", "0.53289044", "0.5322453", "0.5310676", "0.5303885", "0.5303885", "0.5303175", "0.5298939", "0.5295652", "0.52930987", "0.52910924", "0.52857465", "0.52801615", "0.52799284", "0.5264342", "0.52598405", "0.5247256", "0.52450705", "0.52428544", "0.52358586", "0.52353233", "0.52353233", "0.5234167", "0.5227487", "0.52262676", "0.5221914", "0.52205616", "0.52159643", "0.52147573", "0.5209098" ]
0.0
-1
Creates a reference to a source code repository.
def initialize(url) @url = url freeze end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_repo\n Rugged::Repository.init_at(repo_path, :bare).tap do |repo|\n repo.remotes.create('origin', \"git@github.com:#{project.gh_path}\")\n repo.remotes.add_fetch_refspec('origin', GITHUB_PULLS_REFSPEC)\n end\n end", "def repository!\n Repository.find_or_create_by!(url: repository_url) do |repo|\n repo.organization_id = org_id\n repo.name = repository_name\n end\n end", "def source\n \"#{source_repo}/#{source_branch}\"\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n\n source_paths.unshift(tempdir = Dir.mktmpdir(DIR_NAME + '-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n run(\"git clone --quiet #{GITHUB_PATH.shellescape} #{tempdir.shellescape}\")\n\n if (branch = __FILE__[%r{#{DIR_NAME}/(.+)/bridgetown.automation.rb}, 1])\n Dir.chdir(tempdir) { system(\"git checkout #{branch}\") }\n @current_dir = File.expand_path(tempdir)\n end\n else\n source_paths.unshift(DIR_NAME)\n end\nend", "def create_git_repository_location(address)\n GitRepositoryLocation.new(address)\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"siderail-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n YARG_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{siderail/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"vine-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/bmartel/vine.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{vine/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n if __FILE__.match?(%r{\\Ahttps?://})\n require 'shellwords'\n require 'tmpdir'\n\n source_paths.unshift(temp_dir = Dir.mktmpdir('jt_tools-'))\n at_exit { FileUtils.remove_entry(temp_dir) }\n git clone: [\n '--quiet',\n 'https://github.com/jetthoughts/jt_tools.git',\n temp_dir\n ].map { |args| Shellwords.escape(args) }\n .join(' ')\n\n if (branch = __FILE__[%r{jt_tools/(.+)/template.rb}, 1])\n Dir.chdir(temp_dir) { git checkout: branch }\n end\n else\n source_paths.unshift(__dir__)\n end\nend", "def repo; end", "def repo; end", "def repo; end", "def repo; end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('herewego-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/Sanchezdav/herewego.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{herewego/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def create\n display 'Create a new Unfuddle repository'\n \n repo = Unfuddle::Resources::Repository.create(\n :repository => {\n :title => ask('Name', :required => true),\n :abbreviation => ask('Slug', :required => true),\n :system => 'git',\n :projects => {\n :project => {\n :id => 24468 \n }\n }\n }\n )\n end", "def stanford(name, ref = 'master')\n gitrepo \"code.stanford.edu\", name, ref\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(temp_dir = Dir.mktmpdir('jumpstart-'))\n at_exit { FileUtils.remove_entry(temp_dir) }\n git clone: [\n '--quiet',\n 'https://github.com/drgcms/drg-portal-jumpstart.git',\n temp_dir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(temp_dir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def giturl(project_name, repo_name) ; end", "def repo!(name='blah')\n path = File.join(PATH, name.to_s)\n FileUtils::mkdir_p(path)\n delete!(name)\n\n @repos ||= {}\n @current_repo = name.to_sym\n @repos[@current_repo] = SvnRepos.create(path)\n end", "def create(project_name, repo_name, description) ; end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n require 'fileutils'\n require 'shellwords'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-template-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/shota-yamashita/rails-template.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstarter-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/whatapalaver/jumpstarter.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstarter/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n if __FILE__.match?(%r{\\Ahttps?://})\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/natsumi/rails-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"ngrok_rails_template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/captproton/ngrok_rails_template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{ngrok_rails_template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/RYLabs/rails-devcontainer-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-devcontainer-template/(.+)/rails-postgres.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n template_dir =\n if __FILE__ =~ %r{\\Ahttps?://}\n clone_repo\n else\n File.dirname(__FILE__)\n end\n\n source_paths.unshift(template_dir)\n puts \"*** source_paths: (#{source_paths.join(\" \")})\"\n puts \"*** template_dir: (#{template_dir})\"\n template_dir\nend", "def add_template_repository_to_source_path\n template_dir =\n if __FILE__ =~ %r{\\Ahttps?://}\n clone_repo\n else\n File.dirname(__FILE__)\n end\n\n source_paths.unshift(template_dir)\n puts \"*** source_paths: (#{source_paths.join(\" \")})\"\n puts \"*** template_dir: (#{template_dir})\"\n template_dir\nend", "def add_template_repository_to_source_path\n if __FILE__.match? %r{\\Ahttps?://}\n require 'tmpdir'\n tempdir = Dir.mktmpdir 'jumpstart-'\n source_paths.unshift tempdir\n at_exit { FileUtils.remove_entry tempdir }\n git(clone: [\n '--quiet',\n 'https://github.com/cj/jumpstart.git',\n tempdir,\n ].map(&:shellescape).join(' '))\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift File.dirname(__FILE__)\n end\nend", "def repository\n @repository ||= Repository::Content.new(@base_dir)\n end", "def create_managed_repository\n OpenProject::Revisions::Git::GitoliteWrapper.update(:add_repository, self)\n rescue => e\n Rails.logger.error(\"Error while adding repository #{repository_identifier}: #{e.message}\")\n raise OpenProject::Scm::Exceptions::RepositoryBuildError.new(\n I18n.t('repositories.gitolite.cannot_add_repository')\n )\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/biximilien/rails-template.git\",\n tempdir,\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/sikandartariq1/jumpstart.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def create_repo(options)\n options = options.dup\n Repo.new(connection, post(\"/repos/create\", options)['repository'])\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n \"https://github.com/sherllochen/rails-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) {git checkout: branch}\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n PROJECT_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) {git checkout: branch}\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def github(name, ref = 'master')\n gitrepo \"github.com\", name, ref\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-template-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/leikir/rails-template.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def gitrepo(repo, name, ref = 'master')\n mod name.split('/').join('-'),\n :git => \"https://#{repo}/#{name}.git\",\n :ref => ref\nend", "def github(repository, owner = 'siimple')\n \"https://github.com/#{owner}/#{repository}.git\"\n end", "def add_template_repo_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"springer-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/troyizzle/springer.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{springer/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def initialize(source_url)\n @source_url = source_url\n @token = Figaro.env.github_access_token\n @github_regexp = %r{\n \\A(https?:\\/\\/(w{3}\\.)?)? # protocol and www optional at start\n github\\.com\\/ # domain name\n (?<owner>[\\w\\-\\.]+)\\/ # owner of repo\n (?<name>[\\w\\-\\.]+)\\/?\\z # name of repo at end\n }x\n\n @repo = @source_url ? parse_repo : nil\n @repo_data = @repo ? request_repo_data : nil\n end", "def create_repository_from_template(repo, name, options = {})\n options.merge! :name => name\n options = ensure_api_media_type(:template_repositories, options)\n post \"#{Repository.path repo}/generate\", options\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-app-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n \"https://github.com/andersklenke/rails-app-template.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def create_repository(name, dbmod)\n c = Class.new\n mod1 = if Repository.constants.include?(name)\n Repository.const_get(name)\n else\n mod = Module.new\n Repository.const_set(name, mod)\n mod\n end\n dbmod.const_set name, c\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n TEMPLATE_REPO,\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def github_url(ruby_doc)\n version, file, line = ruby_doc.source_location.split(\":\")\n\n if version == MASTER\n path = File.join version, file\n else\n github_version = version.tr(\".\", \"_\")\n path = File.join \"v#{github_version}\", file\n end\n\n URI.join(GITHUB_REPO, path, \"#L#{line}\").to_s\n end", "def initialize(name, repository, reference, submodules = false)\n super repository\n\n @name = name\n @repository = repository\n @reference = reference\n @need_submodules = submodules\n\n @remote = true\n @root_dir = Gem.dir\n @git = ENV['git'] || 'git'\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n p \"!!!!!!!!!!!!!!!!!!!!\"\n p \"!!!!!!!!!!!!!!!!!!!!\"\n p \"!!!!!!!!!!!!!!!!!!!!\"\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n \"https://github.com/velpradeep/react-rails-template-app.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git :checkout => branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git :clone => [\n \"--quiet\",\n \"https://github.com/damienlethiec/modern-rails-template\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def repository; end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-tailwinded-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/beyode/rails-tailwinded.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-tailwinded/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def source_repo\n \"#{@user}/#{@repo}\"\n end", "def repo=(_arg0); end", "def repo=(_arg0); end", "def repo=(_arg0); end", "def repo=(_arg0); end", "def create_repository name, admin_password: nil, project_code: nil\n admin_password = SecureRandom.hex(20) if admin_password.nil? || admin_password.empty?\n\n repo = Fossil::Repo.create fossilify(name), username: username\n\n repo.repository_db do |db|\n # little bit of security, prevents someone on the server from accessing\n # the web ui without credentials\n db[:config].where(name: \"localauth\").update(value: 1)\n\n # Set the project name, on new repos this doesn't seem to exist so lets\n # insert it and I'll worry about problems later. This could be expanded\n # to include other data too in the future such as the description and\n # logo too perhaps?\n db[:config].insert(name: \"project-name\", value: name, mtime: Time.now)\n\n next if project_code.nil? || project_code.empty?\n\n # Change the project code if provided. This allows you to push an\n # existing repository up.\n db[:config].where(name: \"project-code\").update(value: project_code)\n end\n\n # Note: changing the password has to happen after the project-code is\n # changed, as it seems fossil uses the project-code to salt it's password\n # hashes to some extent\n repo.change_password username: username, password: admin_password\n\n [admin_password, repo]\n end", "def repository\n @repository ||= Github::Repository.find user: user, name: name\n end", "def add_template_repository_to_source_path # rubocop:disable Metrics/AbcSize, Metrics/MethodLength\n if __FILE__.match?(%r{\\Ahttps?://})\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template-pdf-rendering\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/ackama/rails-template-pdf-rendering.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{rails-template/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def repo() \n\t\treturn @repo if @repo != nil\n\t\t@repo = Grit::Repo.new(self[:path])\n\tend", "def repo(user_name, repo_name)\n Github::Repo.new @access_token, user_name, repo_name\n end", "def target_repo\n # TODO: Enable possibility to manually override this and set arbitrary repositories.\n source_repo\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('rails-templates'))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n '--quiet',\n 'https://github.com/brightoctopus/rails-templates.git',\n tempdir\n ].map(&:shellescape).join(' ')\n\n if (branch = __FILE__[%r{rails-templates/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def repository(repo, options = {})\n get Repository.path(repo), options\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n tempdir = Dir.mktmpdir(\"template-tmp\")\n source_paths.unshift(tempdir + \"/rails/muffi_template\")\n at_exit {FileUtils.remove_entry(tempdir)}\n git clone: [\n \"--quiet\",\n \"https://github.com/abtion/guidelines.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def init_repo\n @logger.info \"repository url: #{@repository[:url]}\"\n\n if FileTest.exist?(@repository[:path])\n @logger.info \"repository path exists: #{@repository[:path]}\"\n @rgit = Git.open(@repository[:path], :log => @logger)\n @logger.info @rgit.fetch\n else\n @logger.info \"repository path doesn't exist: #{@repository[:path]}\"\n # Create LogDevice to log to websocket message\n @rgit = Git.clone(@repository[:url], @repository[:name],\n :path => @work_dir,\n :log => @logger)\n end\n end", "def create\n @repository = @project.repositories.new(params[:repository])\n @repository.path = '/home/git/repositories'\n @repository.repo_name = @repository.name.downcase.gsub(\" \",\"_\")\n respond_to do |format|\n if @repository.save\n flash[:notice] = 'Repository was successfully created.'\n format.html { redirect_to([@project,@repository]) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def git\n @git ||= Grit::Repo.new(path)\n end", "def git\n @git ||= Grit::Repo.new(path)\n end", "def repository\n repo = RepositoryManager.for(repository_key)\n return repo unless repo.nil?\n # we haven't got a key lets try and make one\n begin\n RepositoryManager.create(repository_key)\n rescue NameError\n raise NameError, \"Could not create #{repository_key}\", caller[2..-1]\n end\n end", "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"jumpstart-\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n git clone: [\n \"--quiet\",\n \"https://github.com/sleekr/rails_kickstart.git\",\n tempdir\n ].map(&:shellescape).join(\" \")\n\n if (branch = __FILE__[%r{jumpstart/(.+)/template.rb}, 1])\n Dir.chdir(tempdir) { git checkout: branch }\n end\n else\n source_paths.unshift(File.dirname(__FILE__))\n end\nend", "def create_repository\n case scm\n when GIT_SCM\n self.class.delay.create_git_repository(full_path)\n when SVN_SCM\n self.class.delay.create_svn_repository(full_path)\n else\n raise UnsupportedSCMError\n end\n end", "def create_repo(name)\n response = Faraday.post \"https://api.github.com/user/repos\", {name: \"#{name}\" }.to_json, {'Authorization'=>\"token #{self.access_token}\", 'Accept' => 'application/json'}\n end", "def repository(uri, client)\n repo = client.repo uri\n repo\n rescue Octokit::InvalidRepository\n raise gem.to_s + ' didnt have github repo'\n end", "def create_repository(name, options = {})\n opts = options.dup\n organization = opts.delete :organization\n opts.merge! :name => name\n if opts.include? :is_template\n opts = ensure_api_media_type(:template_repositories, opts)\n end\n\n if organization.nil?\n post 'user/repos', opts\n else\n post \"#{Organization.path organization}/repos\", opts\n end\n end", "def repo_dir; end", "def create(source:)\n resp = connection.post do |req|\n req.url workspace_path\n req.params['source'] = source\n end\n raise_exception_based_on_response!(resp, object_identifier) unless resp.success?\n end", "def setup\n info \"Setting up repository for #{name} in #{location}\"\n Repository.new(self).setup\n end", "def url\n \"http://github.com/#{repo.owner.login}/#{repo.name}/#{name}\"\n end", "def repository_created(identifier, vendor, url)\n project = Project.find_by_identifier(identifier)\n # Do not create the repository if the project has already one\n return 0 unless project && project.repository.nil?\n logger.debug \"Repository for #{project.name} was created\"\n repository = Repository.factory(vendor, :project => project, :url => url)\n repository.save\n repository.id || 0\n end", "def create\n final_params = repository_params\n languages = Language.where(name: repository_params[:languages])\n final_params[:languages] = languages\n \n @repository = Repository.new(final_params)\n @uri = URI(@repository.repo_location)\n @repository.secret_path = SecureRandom.hex.to_s + @uri.path.split(\"/\").last.to_s\n @secret_path_to_clone_to = @repository.secret_path\n \n respond_to do |format|\n if @repository.save\n Git.clone(@uri, @secret_path_to_clone_to, :path => Rails.root.join(\"storage\", \"repositories\"))\n format.html { redirect_to @repository, notice: 'Repository was successfully created.' }\n format.json { render :show, status: :created, location: @repository }\n else\n format.html { render :new }\n format.json { render json: @repository.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_repo(project)\n return 'https://github.com/NuCivic/' + project\n end", "def repo_make(name)\n path = repo_path(name)\n path.mkpath\n Dir.chdir(path) do\n Pod::Executable.capture_command!('git', %w(init))\n Pod::Executable.capture_command!('git', %w(checkout -b main))\n repo_make_readme_change(name, 'Added')\n Pod::Executable.capture_command!('git', %w(add .))\n Pod::Executable.capture_command!('git', %w(commit -nm Initialized.))\n end\n path\n end", "def create(*args)\n params = args.extract_options!\n normalize! params\n filter! VALID_REPO_OPTIONS + %w[ org ], params\n assert_required_keys(%w[ name ], params)\n\n # Requires authenticated user\n post_request(\"/1.0/repositories/\", DEFAULT_REPO_OPTIONS.merge(params))\n end", "def repo\n @repository\n end", "def repo\n if @repo == NRSER::NO_ARG\n @repo = QB::Repo.from_path root_path\n end\n \n @repo\n end", "def create_remote_repo\n `git init --bare #{REMOTE_PATH}/#{@name}.git`\n\n # Connect local repository to remote and push local master branch to remote.\n Dir.chdir(\"#{LOCAL_PATH}/#{@name}\") do\n `git remote add #{UPSTREAM_NAME} #{REMOTE_PATH}/#{@name}.git && git push -u #{UPSTREAM_NAME} master`\n end\n end", "def create_repository(name, proxy, url, id, policy, provider)\n json = if proxy\n create_proxy_repository_json(name, url, id, policy, provider)\n else\n create_hosted_repository_json(name, id, policy, provider)\n end\n response = nexus.post(nexus_url(\"service/local/repositories\"), :body => json, :header => DEFAULT_CONTENT_TYPE_HEADER)\n case response.status\n when 201\n return true\n when 400\n raise CreateRepsitoryException.new(response.content)\n else\n raise UnexpectedStatusCodeException.new(response.status)\n end\n end", "def repository(project)\n Grit::Repo.new(project.folder)\n end", "def repo\n @repo ||= OctocatHerder::Repository.new(@raw['repo'], connection)\n end", "def regenerate_git_repository\n logger.info `curl --user #{CONFIG[Rails.env][\"git_user_pass\"]} https://api.bitbucket.org/1.0/repositories/ --data name=#{CONFIG[Rails.env][:repo_prefix]}-#{self.uuid} --data is_private=true`\n\n sleep 1\n\n logger.info `mkdir #{directory}\n cp -r #{template_directory}/* #{directory}\n cp config/book_gitignore #{directory}/.gitignore\n cd #{directory}\n git init\n git remote add origin #{CONFIG[Rails.env][\"git\"]}/#{CONFIG[Rails.env][:repo_prefix]}-#{self.uuid}.git`\n\n input_files = \"\"\n self.texts.order(\"-position DESC\").each do |text|\n text.to_file\n input_files << \"\\\\input{#{text.short_filename}}\\n\"\n end\n\n input_text = File.join(directory,'INPUTS.tex')\n File.open(input_text,'w') {|io| io.write(input_files) }\n\n input_commands = File.join(directory,'fichatecnica.sty')\n File.open(input_commands,'w') {|io| io.write(self.book_data.to_file) }\n\n logger.info `cd #{self.directory}\n git add .\n git commit -a -m \"regenerate git repository from database\"\n git push -u origin master`\n\n logger.info \"regenerate git repository from database for book, id #{self.id}\"\n\n end", "def create_ips_repo\n shellout!(\"pkgrepo create #{repo_dir}\")\n log.info(log_key) { \"Created IPS repo: #{repo_dir}\" }\n end", "def sources\n @sources ||= ApiFactory.new 'Repos::Sources'\n end", "def create_repository(opts = {})\n data, _status_code, _headers = create_repository_with_http_info(opts)\n data\n end", "def add_template_repository_to_source_path\n source_paths.unshift(File.dirname(__FILE__))\nend", "def create_repo(org, repo_name)\n if Commitchamp::Repo.find_by(name: repo_name, organization: org) == nil\n repo = @github.get_single_repo(org, repo_name)\n Commitchamp::Repo.find_or_create_by(name: repo['name']) do |r|\n r.organization = repo['organization']['login']\n r.full_name = repo['full_name']\n end\n end\n Commitchamp::Repo.find_by(name: repo_name, organization: org)\n end", "def setup_repo\n status(2) {\n setup_path\n if @type == 'full'\n Repository::Git.clone(@repo, @type)\n end\n Repository::Git.pull(@repo, @type)\n }\n end", "def repo\n @repo\n end", "def git_sources=(_arg0); end", "def git_sources=(_arg0); end", "def remote_repository\n \"http://www.aQute.biz/repo\"\n end", "def init(location = \".\")\n @grit = Mercurial::Repository.create(location)\n end" ]
[ "0.67636", "0.6707248", "0.65631646", "0.6524786", "0.64664716", "0.6454301", "0.64419556", "0.63730633", "0.6355509", "0.6355509", "0.6355509", "0.6355509", "0.6331307", "0.6269762", "0.6257461", "0.6238533", "0.6220375", "0.6204888", "0.6198514", "0.6184207", "0.6182776", "0.61818415", "0.6174692", "0.61694545", "0.6161582", "0.6161582", "0.61499196", "0.6118191", "0.6110174", "0.6104448", "0.61030537", "0.6094954", "0.60938144", "0.60917884", "0.6085956", "0.60857093", "0.60794735", "0.6075177", "0.60693055", "0.6067807", "0.6054081", "0.60516936", "0.6044178", "0.604033", "0.6030073", "0.6023935", "0.6019183", "0.5995801", "0.59896266", "0.5987297", "0.598512", "0.5985016", "0.5985016", "0.5985016", "0.5985016", "0.5979972", "0.59760433", "0.5963724", "0.5945653", "0.5928344", "0.59165204", "0.5915873", "0.5907557", "0.59053725", "0.5894286", "0.58903587", "0.5877059", "0.5877059", "0.58764744", "0.5872071", "0.5831225", "0.58247566", "0.5823985", "0.58229995", "0.58198565", "0.5807307", "0.5805479", "0.57920504", "0.5791722", "0.57806855", "0.5780369", "0.57746965", "0.57697004", "0.57652235", "0.5759127", "0.5757965", "0.575052", "0.57502484", "0.5724216", "0.57142085", "0.5704597", "0.5703552", "0.5681761", "0.567906", "0.56782883", "0.565977", "0.5654103", "0.56458706", "0.56458706", "0.56392914", "0.5637743" ]
0.0
-1
Test parsing of slides from text into objects
def test_slide_parsing presentation = Domain::Presentation.new('DE', 'Title1', 'Title2', 3, 'Section 3', '(c) 2014', 'Thomas Smits', 'java', 'Test Presentation', 'WS2014', false, nil) parser = Parsing::Parser.new(5, Parsing::ParserHandler.new(true)) parser.parse_lines(lines(test_text), 'testfile.md', 'java', presentation) assert_equal('DE', presentation.slide_language) assert_equal('Thomas Smits', presentation.author) assert_equal('Title1', presentation.title1) assert_equal('Title2', presentation.title2) assert_equal('Section 3', presentation.section_name) assert_equal(3, presentation.section_number) assert_equal('(c) 2014', presentation.copyright) assert_equal('java', presentation.default_language) assert_equal('Test Presentation', presentation.description) chapter1 = presentation.chapters[0] assert_equal('Chapter 1', chapter1.title) slides = chapter1.slides check_slide(slides[0], 'Slide 1.1', false, false, [ Domain::Text, Domain::UnorderedList, Domain::Text ], [ 'Text before the list', '', 'Text after the list' ] ) do |e| assert_equal('Item 1', e[1].entries[0].to_s) assert_equal('Item 2', e[1].entries[1].to_s) assert_equal('Item 2.1', e[1].entries[2].entries[0].to_s) assert_equal('Item 2.2', e[1].entries[2].entries[1].to_s) end check_slide(slides[1], 'Slide 1.2', true, false, [ Domain::Source ], [ "int i = 7;\ni++;" ]) { |e| assert_equal('java', e[0].language) } check_slide(slides[2], 'Slide 1.3', true, false, [ Domain::Source ], [ "int k = 9;\nk++;" ]) { |e| assert_equal('java', e[0].language) } check_slide(slides[3], 'Slide 1.4', false, true) check_slide(slides[4], 'Slide 1.5', false, false, [ Domain::Quote ], [ "Quote Line 1\nQuote Line 2" ]) check_slide(slides[5], 'Slide 1.6', false, false, [ Domain::Important, Domain::Question ], [ "Important Line 1\nImportant Line 2", "Question Line 1\nQuestion Line 2" ]) check_slide(slides[6], 'Slide 1.7', false, false, [ Domain::Text, Domain::Comment ], [ 'Some text' ]) { |e| assert_equal('Comment line', e[1].elements[0].to_s) } check_slide(slides[7], 'Slide 1.8', true, false, [ Domain::Source, Domain::VerticalSpace, Domain::Source ], [ 'int i = 0;', '', 'int k = 17;' ]) check_slide(slides[8], 'Slide 1.9', false, false, [ Domain::OrderedList ]) do |e| assert_equal('Item 1', e[0].entries[0].to_s) assert_equal('Item 2', e[0].entries[1].to_s) assert_equal('Item 2.1', e[0].entries[2].entries[0].to_s) assert_equal('Item 2.2', e[0].entries[2].entries[1].to_s) end check_slide(slides[9], 'Slide 1.10', false, false, [ Domain::Script ], [ "alert('Javascript goes here!');" ]) chapter2 = presentation.chapters[1] slides = chapter2.slides assert_equal('Chapter 2', chapter2.title) check_slide(slides[0], 'Slide 2.1', false, false, [ Domain::HTML ], [ '<b>Bold</b>' ]) check_slide(slides[1], 'Slide 2.2', false, false, [ Domain::ButtonLinkPrevious, Domain::ButtonLiveCSS, Domain::ButtonLivePreview, Domain::ButtonLivePreviewFloat, Domain::Button, Domain::ButtonWithLog, Domain::ButtonWithLogPre ]) check_slide(slides[2], 'Slide 2.3', false, false, [ Domain::Heading, Domain::Heading, Domain::Heading ], [ 'Heading 3', 'Heading 4', 'Heading 5' ]) do |e| assert_equal(3, e[0].level) assert_equal(4, e[1].level) assert_equal(5, e[2].level) end check_slide(slides[3], 'Slide 2.4', false, false, [ Domain::Image, Domain::Image, Domain::Image ], %w(img/file.png img/file.png img/file.png )) do |e| assert_equal('10%', e[0].width_slide) assert_equal('30%', e[0].width_plain) assert_equal('', e[0].alt) assert_equal('', e[0].title) assert_equal('10%', e[1].width_slide) assert_nil(e[1].width_plain) assert_equal('', e[1].alt) assert_equal('', e[1].title) assert_nil(e[2].width_slide) assert_nil(e[2].width_plain) assert_equal('', e[2].alt) assert_equal('', e[2].title) assert_equal('10%', e[3].width_slide) assert_equal('0%', e[3].width_plain) assert_equal('10%', e[4].width_slide) assert_equal('0', e[4].width_plain) end check_slide(slides[4], 'Slide 2.5', false, false, [ Domain::Image, Domain::Image, Domain::Image ], %w(img/file.png img/file.png img/file.png )) do |e| assert_equal('10%', e[0].width_slide) assert_equal('30%', e[0].width_plain) assert_equal('', e[0].alt) assert_equal('Title of image', e[0].title) assert_equal('10%', e[1].width_slide) assert_nil(e[1].width_plain) assert_equal('', e[1].alt) assert_equal('Title of image', e[1].title) assert_nil(e[2].width_slide) assert_nil(e[2].width_plain) assert_equal('', e[2].alt) assert_equal('Title of image', e[2].title) end check_slide(slides[5], 'Slide 2.6', false, false, [ Domain::Image, Domain::Image, Domain::Image ], %w(img/file.png img/file.png img/file.png )) do |e| assert_equal('10%', e[0].width_slide) assert_equal('30%', e[0].width_plain) assert_equal('Alt title of image', e[0].alt) assert_equal('Alt title of image', e[0].title) assert_equal('10%', e[1].width_slide) assert_nil(e[1].width_plain) assert_equal('Alt title of image', e[1].alt) assert_equal('Alt title of image', e[1].title) assert_nil(e[2].width_slide) assert_nil(e[2].width_plain) assert_equal('Alt title of image', e[2].alt) assert_equal('Alt title of image', e[2].title) end check_slide(slides[6], 'Slide 2.7', false, false, [ Domain::Image, Domain::Image, Domain::Image ], %w(img/file.png img/file.png img/file.png )) do |e| assert_equal('10%', e[0].width_slide) assert_equal('30%', e[0].width_plain) assert_equal('Alt title of image', e[0].alt) assert_equal('Title of image', e[0].title) assert_equal('10%', e[1].width_slide) assert_nil(e[1].width_plain) assert_equal('Alt title of image', e[1].alt) assert_equal('Title of image', e[1].title) assert_nil(e[2].width_slide) assert_nil(e[2].width_plain) assert_equal('Alt title of image', e[2].alt) assert_equal('Title of image', e[2].title) end check_slide(slides[7], 'Slide 2.8', false, false, [ Domain::UML ]) do |e| assert_equal('100%', e[0].width_slide) assert_equal('70%', e[0].width_plain) end check_slide(slides[8], 'Slide 2.9', false, false, [ Domain::Equation ], [ '\sum_{i=0}^N{P(X = i)} = 1' ]) check_slide(slides[9], 'Slide 2.10', true, false, [ Domain::Source ], [ " 0011 3 1101 -3 0111 7\n" + "+ 0010 + 2 + 1110 + -2 + 1011 + -5\n" + "------ --- ------ ---- ------ ----\n" + '= 0101 = 5 = 1011 = -5 = 0010 = 2' ], false) check_slide(slides[10], 'Slide 2.11', false, false, [ Domain::UnorderedList, Domain::Text, Domain::UnorderedList ]) do |e| assert_equal('Item 1', e[0].entries[0].to_s) assert_equal('Item 2', e[0].entries[1].to_s) assert_equal('Example', e[1].to_s) assert_equal('Item 3', e[2].entries[0].to_s) assert_equal('Item 4', e[2].entries[1].to_s) end check_slide(slides[11], 'Slide 2.12', false, false, [ Domain::OrderedList, Domain::Text, Domain::OrderedList ]) do |e| assert_equal('Item 1', e[0].entries[0].to_s) assert_equal('Item 2', e[0].entries[1].to_s) assert_equal(1, e[0].start_number) assert_equal('Item 1', e[0].entries[0].to_s) assert_equal('Item 2', e[0].entries[1].to_s) assert_equal('Item 3', e[0].entries[2].to_s) assert_equal('Text', e[1].to_s) assert_equal(4, e[2].start_number) assert_equal('Item 4', e[2].entries[0].to_s) assert_equal('Item 5', e[2].entries[1].to_s) assert_equal('Item 6', e[2].entries[2].to_s) end check_slide(slides[12], 'Slide 2.13', false, false, [ Domain::OrderedList ]) do |e| assert_equal(4, e[0].start_number) assert_equal('Item 4', e[0].entries[0].to_s) assert_equal('Item 5', e[0].entries[1].to_s) assert_equal('Item 6', e[0].entries[2].to_s) end check_slide(slides[13], 'Slide 2.14', false, false, [ Domain::OrderedList ]) do |e| assert_equal(1, e[0].start_number) assert_equal('Item 1', e[0].entries[0].to_s) assert_equal('Item 2', e[0].entries[1].to_s) assert_equal('Item 2.1', e[0].entries[2].entries[0].to_s) assert_equal(1, e[0].entries[2].start_number) assert_equal('Item 2.2', e[0].entries[2].entries[1].to_s) assert_equal('Item 3', e[0].entries[3].to_s) assert_equal('Item 4', e[0].entries[4].to_s) end check_slide(slides[14], 'Slide 3.1', true, false, [ Domain::Source ], [ "THIS IS SOURCE CODE\nAT LEAST SOME" ], false) do |e| assert_equal("THIS IS SOURCE CODE\nAT LEAST SOME", e[0].to_s) assert_equal("AT LEAST SOME", e[1].to_s) assert_equal("THIS IS SOURCE CODE\nAT LEAST SOME", e[2].to_s) assert_equal("Java", e[2].language) assert_equal("AT LEAST SOME", e[3].to_s) assert_equal("Java", e[3].language) end check_slide(slides[15], 'Slide 4.1', false, false, [ Domain::Text, Domain::MultipleChoiceQuestions ], [], false) do |e| assert_equal(false, e[1].inline) assert_equal("Some text", e[0].to_s) assert_equal("A question", e[1].questions[0].text) assert_equal(false, e[1].questions[0].correct) assert_equal("A correct question", e[1].questions[1].text) assert_equal(true, e[1].questions[1].correct) assert_equal("A question", e[1].questions[2].text) assert_equal(false, e[1].questions[2].correct) assert_equal("Some text at the end", e[2].to_s) end check_slide(slides[16], 'Slide 4.2', false, false, [ Domain::Text, Domain::MultipleChoiceQuestions ], [], false) do |e| assert_equal(true, e[1].inline) assert_equal("Some text", e[0].to_s) assert_equal("A question", e[1].questions[0].text) assert_equal(false, e[1].questions[0].correct) assert_equal("A correct question", e[1].questions[1].text) assert_equal(true, e[1].questions[1].correct) assert_equal("A question", e[1].questions[2].text) assert_equal(false, e[1].questions[2].correct) assert_equal("Some text at the end", e[2].to_s) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_slide_parsing\n presentation = Domain::Presentation.new('DE', 'Title1', 'Title2', 3, 'Section 3', '(c) 2014',\n 'Thomas Smits', 'java', 'Test Presentation', 'WS2014',\n false, nil)\n\n parser = Parsing::Parser.new(5, Parsing::ParserHandler.new(true))\n\n parser.parse_lines(lines(test_text), 'testfile.md', 'java', presentation)\n\n parser.second_pass(presentation)\n\n assert_equal('DE', presentation.slide_language)\n assert_equal('Thomas Smits', presentation.author)\n assert_equal('Title1', presentation.title1)\n assert_equal('Title2', presentation.title2)\n assert_equal('Section 3', presentation.section_name)\n assert_equal(3, presentation.section_number)\n assert_equal('(c) 2014', presentation.copyright)\n assert_equal('java', presentation.default_language)\n assert_equal('Test Presentation', presentation.description)\n\n chapter1 = presentation.chapters[0]\n\n assert_equal('Chapter 1', chapter1.title)\n\n slide_index = 0\n\n slides = chapter1.slides\n\n check_slide(slides[slide_index], 'Slide 1.1', false, false,\n [Domain::Text, Domain::UnorderedList, Domain::Text],\n ['Text before the list', '', 'Text after the list']) do |e|\n\n assert_equal('Item 1', e[1].entries[0].to_s)\n assert_equal('Item 2', e[1].entries[1].to_s)\n assert_equal('Item 2.1', e[1].entries[2].entries[0].to_s)\n assert_equal('Item 2.2', e[1].entries[2].entries[1].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 1.2', true, false,\n [Domain::Source],\n [\"int i = 7;\\ni++;\"]) { |e| assert_equal('java', e[0].language) }\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 1.3', true, false,\n [Domain::Source],\n [\"int k = 9;\\nk++;\"]) { |e| assert_equal('java', e[0].language) }\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 1.4', false, true)\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 1.5', false, false,\n [Domain::Quote],\n [\"Quote Line 1\\nQuote Line 2\"])\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 1.6', false, false,\n [Domain::Important,\n Domain::Question],\n [\"Important Line 1\\nImportant Line 2\",\n \"Question Line 1\\nQuestion Line 2\"])\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 1.7', false, false,\n [Domain::Text,\n Domain::Comment],\n ['Some text']) { |e| assert_equal('Comment line', e[1].elements[0].to_s) }\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 1.8', true, false,\n [Domain::Source,\n Domain::VerticalSpace,\n Domain::Source],\n ['int i = 0;', '', 'int k = 17;'])\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 1.9', false, false,\n [Domain::OrderedList]) do |e|\n\n assert_equal('Item 1', e[0].entries[0].to_s)\n assert_equal('Item 2', e[0].entries[1].to_s)\n assert_equal('Item 2.1', e[0].entries[2].entries[0].to_s)\n assert_equal('Item 2.2', e[0].entries[2].entries[1].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 1.10', false, false,\n [Domain::Script],\n [\"alert('Javascript goes here!');\"])\n\n chapter2 = presentation.chapters[1]\n\n slides = chapter2.slides\n\n assert_equal('Chapter 2', chapter2.title)\n\n slide_index = 0\n check_slide(slides[slide_index], 'Slide 2.1', false, false,\n [Domain::HTML],\n ['<b>Bold</b>'])\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.2', false, false,\n [Domain::ButtonLinkPrevious,\n Domain::ButtonLiveCSS,\n Domain::ButtonLivePreview,\n Domain::ButtonLivePreviewFloat,\n Domain::Button,\n Domain::ButtonWithLog,\n Domain::ButtonWithLogPre])\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.3', false, false,\n [Domain::Heading, Domain::Heading, Domain::Heading],\n ['Heading 3', 'Heading 4', 'Heading 5']) do |e|\n assert_equal(3, e[0].level)\n assert_equal(4, e[1].level)\n assert_equal(5, e[2].level)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.4', false, false,\n [Domain::Image, Domain::Image, Domain::Image],\n %w[img/file.png img/file.png img/file.png]) do |e|\n assert_equal('10%', e[0].width_slide)\n assert_equal('30%', e[0].width_plain)\n assert_equal('', e[0].alt)\n assert_equal('', e[0].title)\n\n assert_equal('10%', e[1].width_slide)\n assert_nil(e[1].width_plain)\n assert_equal('', e[1].alt)\n assert_equal('', e[1].title)\n\n assert_nil(e[2].width_slide)\n assert_nil(e[2].width_plain)\n assert_equal('', e[2].alt)\n assert_equal('', e[2].title)\n\n assert_equal('10%', e[3].width_slide)\n assert_equal('0%', e[3].width_plain)\n\n assert_equal('10%', e[4].width_slide)\n assert_equal('0', e[4].width_plain)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.5', false, false,\n [Domain::Image, Domain::Image, Domain::Image],\n %w[img/file.png img/file.png img/file.png]) do |e|\n assert_equal('10%', e[0].width_slide)\n assert_equal('30%', e[0].width_plain)\n assert_equal('', e[0].alt)\n assert_equal('Title of image', e[0].title)\n\n assert_equal('10%', e[1].width_slide)\n assert_nil(e[1].width_plain)\n assert_equal('', e[1].alt)\n assert_equal('Title of image', e[1].title)\n\n assert_nil(e[2].width_slide)\n assert_nil(e[2].width_plain)\n assert_equal('', e[2].alt)\n assert_equal('Title of image', e[2].title)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.6', false, false,\n [Domain::Image, Domain::Image, Domain::Image],\n %w[img/file.png img/file.png img/file.png]) do |e|\n assert_equal('10%', e[0].width_slide)\n assert_equal('30%', e[0].width_plain)\n assert_equal('Alt title of image', e[0].alt)\n assert_equal('Alt title of image', e[0].title)\n\n assert_equal('10%', e[1].width_slide)\n assert_nil(e[1].width_plain)\n assert_equal('Alt title of image', e[1].alt)\n assert_equal('Alt title of image', e[1].title)\n\n assert_nil(e[2].width_slide)\n assert_nil(e[2].width_plain)\n assert_equal('Alt title of image', e[2].alt)\n assert_equal('Alt title of image', e[2].title)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.6b', false, false,\n [Domain::Image, Domain::Image, Domain::Image],\n %w[img/file.png img/file.png img/file.png]) do |e|\n assert_equal('10%', e[0].width_slide)\n assert_equal('30%', e[0].width_plain)\n assert_equal('Alt title of image', e[0].alt)\n assert_equal('Alt title of image', e[0].title)\n\n assert_equal('10%', e[1].width_slide)\n assert_nil(e[1].width_plain)\n assert_equal('Alt title of image', e[1].alt)\n assert_equal('Alt title of image', e[1].title)\n\n assert_nil(e[2].width_slide)\n assert_nil(e[2].width_plain)\n assert_equal('Alt title of image', e[2].alt)\n assert_equal('Alt title of image', e[2].title)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.7', false, false,\n [Domain::Image, Domain::Image, Domain::Image],\n %w[img/file.png img/file.png img/file.png]) do |e|\n assert_equal('10%', e[0].width_slide)\n assert_equal('30%', e[0].width_plain)\n assert_equal('Alt title of image', e[0].alt)\n assert_equal('Title of image', e[0].title)\n\n assert_equal('10%', e[1].width_slide)\n assert_nil(e[1].width_plain)\n assert_equal('Alt title of image', e[1].alt)\n assert_equal('Title of image', e[1].title)\n\n assert_nil(e[2].width_slide)\n assert_nil(e[2].width_plain)\n assert_equal('Alt title of image', e[2].alt)\n assert_equal('Title of image', e[2].title)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.7b', false, false,\n [Domain::Image, Domain::Image, Domain::Image],\n %w[img/file.png img/file.png img/file.png]) do |e|\n assert_equal('10%', e[0].width_slide)\n assert_equal('30%', e[0].width_plain)\n assert_equal('Alt title of image', e[0].alt)\n assert_equal('Title of image', e[0].title)\n\n assert_equal('10%', e[1].width_slide)\n assert_nil(e[1].width_plain)\n assert_equal('Alt title of image', e[1].alt)\n assert_equal('Title of image', e[1].title)\n\n assert_nil(e[2].width_slide)\n assert_nil(e[2].width_plain)\n assert_equal('Alt title of image', e[2].alt)\n assert_equal('Title of image', e[2].title)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.8', false, false,\n [Domain::UML]) do |e|\n assert_equal('100%', e[0].width_slide)\n assert_equal('70%', e[0].width_plain)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.9', false, false,\n [Domain::Equation],\n ['\\sum_{i=0}^N{P(X = i)} = 1'])\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.10', true, false,\n [Domain::Source],\n [\" 0011 3 1101 -3 0111 7\\n\" \\\n \"+ 0010 + 2 + 1110 + -2 + 1011 + -5\\n\" \\\n \"------ --- ------ ---- ------ ----\\n\" \\\n '= 0101 = 5 = 1011 = -5 = 0010 = 2'],\n false)\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.11', false, false,\n [Domain::UnorderedList, Domain::Text, Domain::UnorderedList]) do |e|\n assert_equal('Item 1', e[0].entries[0].to_s)\n assert_equal('Item 2', e[0].entries[1].to_s)\n\n assert_equal('Example', e[1].to_s)\n\n assert_equal('Item 3', e[2].entries[0].to_s)\n assert_equal('Item 4', e[2].entries[1].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.12', false, false,\n [Domain::OrderedList, Domain::Text, Domain::OrderedList]) do |e|\n assert_equal('Item 1', e[0].entries[0].to_s)\n assert_equal('Item 2', e[0].entries[1].to_s)\n\n assert_equal(1, e[0].start_number)\n assert_equal('Item 1', e[0].entries[0].to_s)\n assert_equal('Item 2', e[0].entries[1].to_s)\n assert_equal('Item 3', e[0].entries[2].to_s)\n\n assert_equal('Text', e[1].to_s)\n\n assert_equal(4, e[2].start_number)\n assert_equal('Item 4', e[2].entries[0].to_s)\n assert_equal('Item 5', e[2].entries[1].to_s)\n assert_equal('Item 6', e[2].entries[2].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.13', false, false,\n [Domain::OrderedList]) do |e|\n\n assert_equal(4, e[0].start_number)\n assert_equal('Item 4', e[0].entries[0].to_s)\n assert_equal('Item 5', e[0].entries[1].to_s)\n assert_equal('Item 6', e[0].entries[2].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 2.14', false, false,\n [Domain::OrderedList]) do |e|\n\n assert_equal(1, e[0].start_number)\n assert_equal('Item 1', e[0].entries[0].to_s)\n assert_equal('Item 2', e[0].entries[1].to_s)\n assert_equal('Item 2.1', e[0].entries[2].entries[0].to_s)\n assert_equal(1, e[0].entries[2].start_number)\n assert_equal('Item 2.2', e[0].entries[2].entries[1].to_s)\n assert_equal('Item 3', e[0].entries[3].to_s)\n assert_equal('Item 4', e[0].entries[4].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 3.1', true, false,\n [Domain::Source],\n [\"THIS IS SOURCE CODE\\nAT LEAST SOME\"],\n false) do |e|\n\n assert_equal(\"THIS IS SOURCE CODE\\nAT LEAST SOME\", e[0].to_s)\n assert_equal('AT LEAST SOME', e[1].to_s)\n assert_equal(\"THIS IS SOURCE CODE\\nAT LEAST SOME\", e[2].to_s)\n assert_equal('Java', e[2].language)\n assert_equal('AT LEAST SOME', e[3].to_s)\n assert_equal('Java', e[3].language)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 4.1', false, false,\n [Domain::Text, Domain::MultipleChoiceQuestions],\n [],\n false) do |e|\n\n assert_equal(false, e[1].inline)\n\n assert_equal('Some text', e[0].to_s)\n assert_equal('A question', e[1].questions[0].text)\n assert_equal(false, e[1].questions[0].correct)\n assert_equal('A correct question', e[1].questions[1].text)\n assert_equal(true, e[1].questions[1].correct)\n assert_equal('A question', e[1].questions[2].text)\n assert_equal(false, e[1].questions[2].correct)\n assert_equal('Some text at the end', e[2].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 4.2', false, false,\n [Domain::Text, Domain::MultipleChoiceQuestions],\n [],\n false) do |e|\n\n assert_equal(true, e[1].inline)\n\n assert_equal('Some text', e[0].to_s)\n assert_equal('A question', e[1].questions[0].text)\n assert_equal(false, e[1].questions[0].correct)\n assert_equal('A correct question', e[1].questions[1].text)\n assert_equal(true, e[1].questions[1].correct)\n assert_equal('A question', e[1].questions[2].text)\n assert_equal(false, e[1].questions[2].correct)\n assert_equal('Some text at the end', e[2].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 5.1', false, false,\n [Domain::Table],\n [],\n false) do |e|\n assert_equal('Dezimal', e[0].headers[0].to_s)\n assert_equal('Binär', e[0].headers[1].to_s)\n assert_equal('Oktal', e[0].headers[2].to_s)\n assert_equal('Hexadezimal', e[0].headers[3].to_s)\n\n row = e[0].rows\n assert_nil(row[0])\n assert_equal('521,125', row[1][0].strip)\n assert_equal('', row[1][1].strip)\n assert_equal('', row[1][2].strip)\n assert_equal('', row[1][3].strip)\n\n assert_equal('', row[2][0].strip)\n assert_equal('1011,11', row[2][1].strip)\n assert_equal('', row[2][2].strip)\n assert_equal('', row[2][3].strip)\n\n assert_equal('', row[3][0].strip)\n assert_equal('', row[3][1].strip)\n assert_equal('15,7', row[3][2].strip)\n assert_equal('', row[3][3].strip)\n\n assert_equal('', row[4][0].strip)\n assert_equal('', row[4][1].strip)\n assert_equal('', row[4][2].strip)\n assert_equal('AC,8', row[4][3].strip)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 5.2', false, false,\n [Domain::Table],\n [],\n false) do |e|\n assert_equal('Dezimal', e[0].headers[0].to_s)\n assert_equal('Binär', e[0].headers[1].to_s)\n assert_equal('Oktal', e[0].headers[2].to_s)\n assert_equal('Hexadezimal', e[0].headers[3].to_s)\n\n row = e[0].rows\n assert_nil(row[0])\n assert_equal('521,125', row[1][0].strip)\n assert_equal('1000001001,001', row[1][1].strip)\n assert_equal('1011,1', row[1][2].strip)\n assert_equal('209,2', row[1][3].strip)\n\n assert_equal('11,75', row[2][0].strip)\n assert_equal('1011,11', row[2][1].strip)\n assert_equal('13,6', row[2][2].strip)\n assert_equal('B,C', row[2][3].strip)\n\n assert_equal('13,875', row[3][0].strip)\n assert_equal('1101,111', row[3][1].strip)\n assert_equal('15,7', row[3][2].strip)\n assert_equal('D,E', row[3][3].strip)\n\n assert_equal('172,5', row[4][0].strip)\n assert_equal('10101100,1', row[4][1].strip)\n assert_equal('254,4', row[4][2].strip)\n assert_equal('AC,8', row[4][3].strip)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 6.1', false, false,\n [Domain::Text, Domain::UnorderedList, Domain::Quote, Domain::Important, Domain::Question],\n [ \"Text using a footnote[^Footnote with number.] and another one[^Footnote with label.].\" ],\n false) do |e|\n assert_equal([ Domain::Footnote.new(\"1\", \"Footnote with number.\"),\n Domain::Footnote.new(\"label\", \"Footnote with label.\"),\n Domain::Footnote.new(\"withquote\", 'Footnote containing a \"quote\"'),\n Domain::Footnote.new(\"2\", \"Footnote with number.\"),\n Domain::Footnote.new(\"label2\", \"Footnote with label.\") ],\n chapter2.footnotes)\n\n assert_equal('In a list[^Footnote with number.]', e[1].entries[0].to_s)\n assert_equal('Or a quote[^Footnote with number.]', e[2].to_s)\n assert_equal('Or Important[^Footnote with number.]', e[3].to_s)\n assert_equal('Or Question[^Footnote with number.]', e[4].to_s)\n assert_equal('Text using a footnote[^Footnote containing a \"quote\"] with a quote inside.', e[5].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 6.2', false, false,\n [Domain::Text],\n [ \"Text using a footnote[^Footnote with number.] and another one[^Footnote with label.].\" ],\n false) do |e|\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 6.3', false, false,\n [Domain::Text, Domain::UnorderedList, Domain::Quote, Domain::Important, Domain::Question],\n [],\n false) do |e|\n\n assert_equal('Text with a [one](https://en.wikipedia.org/wiki/Hobbit#Lifestyle) and another [two](https://en.wikipedia.org/wiki/Hobbit#Lifestyle \"Hobbit lifestyles\")', e[0].to_s)\n assert_equal('[three](https://en.wikipedia.org/wiki/Hobbit#Lifestyle \"Hobbit lifestyles\")', e[1].entries[0].to_s)\n assert_equal('[four](https://en.wikipedia.org/wiki/Hobbit#Lifestyle \"Hobbit lifestyles\")', e[1].entries[1].to_s)\n assert_equal('Quote [five](https://en.wikipedia.org/wiki/Hobbit#Lifestyle \"Hobbit lifestyles\")', e[2].to_s)\n assert_equal('Important [six](https://en.wikipedia.org/wiki/Hobbit#Lifestyle \"Hobbit lifestyles\")', e[3].to_s)\n assert_equal('Question [seven](https://en.wikipedia.org/wiki/Hobbit#Lifestyle \"Hobbit lifestyles\")', e[4].to_s)\n assert_equal('Question [eight](https://en.wikipedia.org/wiki/Hobbit#Lifestyle)', e[5].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 6.4 Comment before slide', false, false,\n [Domain::Comment, Domain::Text, Domain::UnorderedList, Domain::Comment],\n [],\n false) do |e|\n\n assert_equal('This is a comment before the actual slide', e[0].elements[0].to_s)\n assert_equal('BC1', e[0].elements[1].entries[0].to_s)\n assert_equal('BC2', e[0].elements[1].entries[1].to_s)\n assert_equal('Slide Text', e[1].to_s)\n assert_equal('BS1', e[2].entries[0].to_s)\n assert_equal('BS2', e[2].entries[1].to_s)\n assert_equal('End Comment', e[3].elements[0].to_s)\n assert_equal('BE1', e[3].elements[1].entries[0].to_s)\n assert_equal('BE2', e[3].elements[1].entries[1].to_s)\n end\n\n slide_index += 1\n check_slide(slides[slide_index], 'Slide 6.5 Just a plain slide', false, false,\n [Domain::Text],\n [],\n false) do |e|\n\n assert_equal('With some text', e[0].to_s)\n end\n end", "def parse_paragraph; end", "def parse(text); end", "def parse\n parts = text.split(/^\\-\\-\\-/)\n\n if parts.size == 1\n data = {}\n #@parts << Part.new(sect[0]) #, *[@stencil, @default].compact.flatten)\n else\n parts.shift if parts.first.strip.empty?\n data = YAML::load(parts.first)\n if Hash === data\n parts.shift\n else\n data = {}\n end\n end\n\n parse_metadata(data)\n\n @parts = parts.map{ |part| Part.parse(self, part) }\n end", "def parse_text(text)\n\n end", "def test_it_can_parse_paragraph\nskip\nchisel = Chisel.new\ntext = '# My Life in Desserts\n\n## Chapter 1: The Beginning\n\n\"You just *have* to try the cheesecake,\" he said. \"Ever since it appeared in\n**Food & Wine** this place has been packed every night.\"'\nassert_equal \"<p>You just *have* to try the cheesecake,\" he said. \"Ever since it appeared in\n**Food & Wine** this place has been packed every night.<p>\", chisel.parse_paragraph(text)\nend", "def parse\n @parts = []\n\n sect = text.split(/^\\-\\-\\-/)\n\n if sect.size == 1\n @header = {}\n @parts << Part.new(sect[0]) #, *[@stencil, @default].compact.flatten)\n else\n sect.shift if sect.first.strip.empty?\n\n head = sect.shift\n head = YAML::load(head)\n parse_header(head)\n\n sect.each do |body|\n index = body.index(\"\\n\")\n formats = body[0...index].strip\n formats = formats.split(/\\s+/) if String===formats\n #formats = @default if formats.empty?\n #formats.unshift(@stencil) if @stencil\n text = body[index+1..-1]\n @parts << Part.new(text, *formats)\n end\n end\n end", "def parse text\n # Extract our headers, if any.\n if text =~ /\\A.*:/\n if text =~ /\\A((?:.|\\n)*?)\\n\\n((?:.|\\n)*)\\z/\n # Headers and body.\n @headers = YAML::load($1)\n content = $2\n else\n # Headers without body.\n @headers = YAML::load(text)\n content = ''\n end\n else\n # Body without headers.\n @headers = {}\n content = text\n end\n\n # Split the body at a <!--more--> marker, if we have one.\n if content =~ /\\A((?:.|\\n)*?)\\n<!--more-->\\s*\\n((?:.|\\n)*)\\z/\n @raw_body = $1\n @raw_extended = $2\n else\n @raw_body = content\n @raw_extended = nil\n end \n end", "def inner_parse text # :nodoc:\n parser = clone\n\n parser.setup_parser text, @debug\n\n parser.peg_parse\n\n doc = parser.result\n\n doc.accept @formatter\n\n doc.parts\n end", "def preprocess_text data\n parse_formatted_text data\n end", "def parse_kramdown(content)\n ::Kramdown::Document.new content, :input => 'QuickStartParser' \n end", "def parse; end", "def parse; end", "def parse; end", "def post_processing_slides( content )\r\n \r\n # 1) add slide break \r\n \r\n if (@markup_type == :markdown && @markdown_libs.first == 'pandoc-ruby') || @markup_type == :rest\r\n content = add_slide_directive_before_div_h1( content )\r\n else\r\n content = add_slide_directive_before_h1( content )\r\n end\r\n\r\n dump_content_to_file_debug_html( content )\r\n\r\n # 2) use generic slide break processing instruction to\r\n # split content into slides\r\n\r\n slide_counter = 0\r\n\r\n slides = []\r\n slide_source = \"\"\r\n \r\n content.each_line do |line|\r\n if line.include?( '<!-- _S9SLIDE_' ) or\r\n line.include?( '<!-- _S9TRANSITION_' ) then\r\n if slide_counter > 0 then # found start of new slide (and, thus, end of last slide)\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer\r\n end\r\n slide_counter += 1\r\n end\r\n slide_source << line\r\n end\r\n \r\n if slide_counter > 0 then\r\n slides << slide_source # add slide to slide stack\r\n slide_source = \"\" # reset slide source buffer \r\n end\r\n\r\n ## split slide source into header (optional) and content/body\r\n ## plus check for (css style) classes\r\n\r\n slides2 = []\r\n transition = nil\r\n transitioncount = 0\r\n slides.each do |slide_source|\r\n slide = Slide.new\r\n\r\n ## check for css style classes \r\n from = 0\r\n while (pos = slide_source.index( /<!-- _S9(SLIDE|STYLE|TRANSITION)_(.*?)-->/m, from ))\r\n type = $1.downcase\r\n klass = $2.strip\r\n if $1 == 'TRANSITION'\r\n transition = klass\r\n transitioncount = 0\r\n klass = 'middle'\r\n logger.debug \\\r\n\" adding css classes (plus middle for #{transition}) from pi #{type}: #{klass}\"\r\n slide.transition = transition + '-title'\r\n else\r\n if transition\r\n transitioncount += 1\r\n slide.transition = \"#{transition}[#{transitioncount}]\"\r\n logger.debug \\\r\n\" adding css classes (plus #{transition}) from pi #{type}: #{klass}\"\r\n else\r\n logger.debug \" adding css classes from pi #{type}: #{klass}\"\r\n end\r\n end\r\n\r\n if slide.classes.nil?\r\n slide.classes = klass\r\n else\r\n slide.classes << \" #{klass}\"\r\n end\r\n \r\n from = Regexp.last_match.end(0)\r\n end\r\n \r\n # try to cut off header using non-greedy .+? pattern; tip test regex online at rubular.com\r\n # note/fix: needs to get improved to also handle case for h1 wrapped into div\r\n # (e.g. extract h1 - do not assume it starts slide source)\r\n if slide_source =~ /^\\s*(<h1.*?>.*?<\\/h\\d>)\\s*(.*)/m \r\n slide.header = $1\r\n slide.content = ($2 ? $2 : \"\")\r\n logger.debug \" adding slide with header:\\n#{slide.header}\"\r\n else\r\n slide.content = slide_source\r\n logger.debug \" adding slide with *no* header:\\n#{slide.content}\"\r\n end\r\n slides2 << slide\r\n end\r\n\r\n # for convenience create a string w/ all in-one-html\r\n # no need to wrap slides in divs etc.\r\n \r\n content2 = \"\"\r\n slides2.each do |slide| \r\n content2 << slide.to_classic_html\r\n end\r\n \r\n # make content2 and slide2 available to erb template\r\n # -- todo: cleanup variable names and use attr_readers for content and slide\r\n \r\n @slides = slides2 # strutured content \r\n @content = content2 # content all-in-one \r\n end", "def parse(text)\n parse_references(text) if @project\n parse_emoji(text)\n\n text\n end", "def parse text\n raise \"No parser defined for #{self.class}\"\n end", "def from_text(text)\n parser = ResumeTools::ResumeGrammarParser.new\n result = parser.parse(text)\n \n if result.nil?\n raise ParseException.new(parser.failure_reason)\n end\n \n resume = ResumeTools::Resume.new\n current_section = nil\n current_period = nil\n \n result.elements.each do |element|\n case element.data_type\n when :item\n item = ::ResumeTools::Item.new(:text => element.value)\n if current_period\n current_period.add_item(item)\n elsif current_section\n current_section.add_item(item)\n end\n when :period\n current_period = ::ResumeTools::Period.new(:title => element.value)\n current_section.add_period(current_period) if current_section\n when :section\n current_period = nil # Reset period\n current_section = ::ResumeTools::Section.new(:title => element.value)\n resume.add_section(current_section)\n when :period_location\n current_period.location = element.value if current_period\n when :period_organization\n current_period.organization = element.value if current_period\n when :period_dates\n if current_period\n dates = element.value.split(\"to\", 2).map { |d| d.strip }\n if dates.length == 1\n current_period.dtend = dates[0]\n current_period.dtstart = nil\n elsif dates.length == 2\n current_period.dtstart = dates[0]\n current_period.dtend = dates[1]\n end\n end\n when :paragraph\n current_section.para = element.value if current_section\n when :contact_name\n resume.full_name = element.value\n when :contact_telephone\n resume.telephone = element.value\n when :contact_email\n resume.email = element.value\n when :contact_address\n if resume.address1.blank?\n resume.address1 = element.value\n elsif resume.address2.blank?\n resume.address2 = element.value\n end\n when :contact_url\n resume.url = element.value\n end\n end\n \n resume\n end", "def parse(source); end", "def parse_content(content); end", "def parse_wiki_text(wiki_text)\n wiki_text = parse_nowiki(wiki_text)\n wiki_text = parse_templates(wiki_text)\n wiki_text = parse_paired_tags(wiki_text)\n wiki_text = parse_unpaired_tags(wiki_text)\n wiki_text = parse_non_direct_links(wiki_text)\n wiki_text = parse_external_links(wiki_text) #Has to come after parse_non_direct_links for now\n wiki_text\n end", "def test_the_whole_process\n #changed to return array when i removed splitter and joiner between paragraph and header classes\n pm = ParagraphMarker.new\n assert_equal [\"#Some\", \"<p>of\\nThese</p>\", \"#should\", \"<p>get</p>\", \"#tagged\"], pm.mark_paragraphs(\"#Some\\n\\nof\\nThese\\n\\n#should\\n\\nget\\n\\n#tagged\")\n end", "def parse\n end", "def get_parse(s);end", "def parsed; end", "def parsed; end", "def initialize(raw)\n @raw = raw =~ /\\A!SLIDE/ ? raw : \"!SLIDE\\n#{raw}\"\n extract_classes!\n end", "def parse(str); end", "def parse_text\n @doc = Nokogiri::HTML(wrap(@text)) do |config|\n #config.strict\n end\n rescue Exception => e\n log(\"Error parsing text, couldn't continue. #{e}\")\n end", "def parse(text, options = T.unsafe(nil)); end", "def get_title_from_slide_text(slide_text)\n\n end", "def parse(text)\n text = pre_proccess(text)\n text = pre_normalize(text)\n puts text.inspect if Chronic.debug\n\n tokens = Tokenizer::tokenize(' ' + text + ' ')\n tag(tokens, options)\n\n puts \"+#{'-' * 51}\\n| #{tokens}\\n+#{'-' * 51}\" if Chronic.debug\n\n token_group = TokenGroup.new(tokens, definitions(options), @now, options)\n span = token_group.to_span\n\n guess(span, options[:guess]) if span\n end", "def parse\n\t\t\treturn [] if @string_to_parse.empty?\n\t\t\treturn @parsed unless @parsed.empty?\n\t\t\t@scanner = StringScanner.new @string_to_parse\n\t\t\t@scanner.pos = 0\n\t\t\tif @scanner.scan /\\%PDF\\-[\\d\\-\\.]+/\n\t\t\t\t@version = @scanner.matched.scan(/[\\d\\.]+/)[0].to_f\n\t\t\t\tloop do\n\t\t\t\t\tbreak unless @scanner.scan(/[^\\d\\r\\n]+/)\n\t\t\t\t\tbreak if @scanner.check(/([\\d]+[\\s]+[\\d]+[\\s]+obj[\\n\\r\\s]+\\<\\<)|([\\n\\r]+)/)\n\t\t\t\t\tbreak if @scanner.eos?\n\t\t\t\t\t@scanner.pos += 1\n\t\t\t\tend\n\t\t\tend\n\t\t\t@parsed = _parse_\n\t\t\t# puts @parsed\n\n\t\t\traise \"Unknown PDF parsing error - maleformed PDF file?\" unless (@parsed.select {|i| !i.is_a?(Hash)}).empty?\n\n\t\t\tif @root_object == {}\n\t\t\t\txref_streams = @parsed.select {|obj| obj.is_a?(Hash) && obj[:Type] == :XRef}\n\t\t\t\txref_streams.each do |xref_dictionary|\n\t\t\t\t\t@root_object.merge! xref_dictionary\n\t\t\t\tend\n\t\t\tend\n\t\t\traise \"root is unknown - cannot determine if file is Encrypted\" if @root_object == {}\n\n\t\t\tif @root_object[:Encrypt]\n\t\t\t\tchange_references_to_actual_values @root_object\n\t\t\t\twarn \"PDF is Encrypted! Attempting to decrypt - not yet fully supported.\"\n\t\t\t\tdecryptor = PDFDecrypt.new @parsed, @root_object\n\t\t\t\tdecryptor.decrypt\n\t\t\t\t#do we really need to apply to @parsed? No, there is no need.\n\t\t\tend\n\n\t\t\t## search for objects streams\n\t\t\tobject_streams = @parsed.select {|obj| obj.is_a?(Hash) && obj[:Type] == :ObjStm}\n\t\t\tunless object_streams.empty?\n\t\t\t\twarn \"PDF 1.5 Object streams found - they are not fully supported! attempting to extract objects.\"\n\t\t\t\t\n\t\t\t\tobject_streams.each do |o|\n\t\t\t\t\t## un-encode (using the correct filter) the object streams\n\t\t\t\t\tPDFFilter.inflate_object o \n\t\t\t\t\t## extract objects from stream to top level arry @parsed\n\t\t\t\t\t@scanner = StringScanner.new o[:raw_stream_content]\n\t\t\t\t\tstream_data = _parse_\n\t\t\t\t\tid_array = []\n\t\t\t\t\twhile stream_data[0].is_a? Fixnum\n\t\t\t\t\t\tid_array << stream_data.shift\n\t\t\t\t\t\tstream_data.shift\n\t\t\t\t\tend\n\t\t\t\t\twhile id_array[0] && stream_data[0]\n\t\t\t\t\t\tstream_data[0] = {indirect_without_dictionary: stream_data[0]} unless stream_data[0].is_a?(Hash)\n\t\t\t\t\t\tstream_data[0][:indirect_reference_id] = id_array.shift\n\t\t\t\t\t\tstream_data[0][:indirect_generation_number] = 0\n\t\t\t\t\t\t@parsed << stream_data.shift\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Strings were unified, we can let them go..\n\t\t\t@strings_dictionary.clear\n\n\t\t\t\n\t\t\t# serialize_objects_and_references.catalog_pages\n\n\t\t\t# Benchmark.bm do |bm|\n\t\t\t# \tbm.report(\"serialize\") {1000.times {serialize_objects_and_references} }\n\t\t\t# \tbm.report(\"serialize - old\") {1000.times {old_serialize_objects_and_references} }\n\t\t\t# \tbm.report(\"catalog\") {1000.times {catalog_pages} }\n\t\t\t# end\n\n\t\t\tserialize_objects_and_references.catalog_pages\n\n\t\t\t@info_object = @root_object[:Info] ? (@root_object[:Info][:referenced_object] || @root_object[:Info]) : false\n\t\t\tif @info_object && @info_object.is_a?(Hash)\n\t\t\t\t@parsed.delete @info_object\n\t\t\t\tCombinePDF::PDF::PRIVATE_HASH_KEYS.each {|key| @info_object.delete key}\n\t\t\t\t@info_object.each {|k, v| @info_object = v[:referenced_object] if v.is_a?(Hash) && v[:referenced_object]}\n\t\t\telse\n\t\t\t\t@info_object = {}\n\t\t\tend\n\t\t\t# # # ## remove object streams - if they exist\n\t\t\t# @parsed.reject! {|obj| object_streams << obj if obj.is_a?(Hash) && obj[:Type] == :ObjStm}\n\t\t\t# # # ## remove XREF dictionaries - if they exist\n\t\t\t# @parsed.reject! {|obj| object_streams << obj if obj.is_a?(Hash) && obj[:Type] == :XRef}\n\n\t\t\t@parsed\n\t\tend", "def markup text\n document = parse text\n\n document.accept formatter\n end", "def post_processing_slides( content )\n \n # 1) add slide breaks\n \n if config.slide? # only allow !SLIDE directives fo slide breaks?\n # do nothing (no extra automagic slide breaks wanted)\n else \n if (@markup_type == :markdown && Markdown.lib == 'pandoc-ruby') || @markup_type == :rest\n content = add_slide_directive_before_div_h1( content )\n else\n if config.header_level == 2\n content = add_slide_directive_before_h2( content )\n else # assume level 1\n content = add_slide_directive_before_h1( content )\n end\n end\n end\n\n\n dump_content_to_file_debug_html( content )\n\n # 2) use generic slide break processing instruction to\n # split content into slides\n\n slide_counter = 0\n\n slides = []\n slide_buf = \"\"\n \n content.each_line do |line|\n if line.include?( '<!-- _S9SLIDE_' )\n if slide_counter > 0 # found start of new slide (and, thus, end of last slide)\n slides << slide_buf # add slide to slide stack\n slide_buf = \"\" # reset slide source buffer\n else # slide_counter == 0\n # check for first slide with missing leading SLIDE directive (possible/allowed in takahashi, for example)\n ## remove html comments and whitspaces (still any content?)\n ### more than just whitespace? assume its a slide\n if slide_buf.gsub(/<!--.*?-->/m, '').gsub( /[\\n\\r\\t ]/, '').length > 0\n logger.debug \"add slide with missing leading slide directive >#{slide_buf}< with slide_counter == 0\"\n slides << slide_buf\n slide_buf = \"\"\n else\n logger.debug \"skipping slide_buf >#{slide_buf}< with slide_counter == 0\"\n end\n end\n slide_counter += 1\n end\n slide_buf << line\n end\n \n if slide_counter > 0\n slides << slide_buf # add slide to slide stack\n slide_buf = \"\" # reset slide source buffer \n end\n\n\n slides2 = []\n slides.each do |source|\n slides2 << Slide.new( source, config )\n end\n\n\n puts \"#{slides2.size} slides found:\"\n \n slides2.each_with_index do |slide,i|\n print \" [#{i+1}] \"\n if slide.header.present?\n print slide.header\n else\n # remove html comments\n print \"-- no header -- | #{slide.content.gsub(/<!--.*?-->/m, '').gsub(/\\n/,'$')[0..40]}\"\n end\n puts\n end\n \n \n # make content2 and slide2 available to erb template\n # -- todo: cleanup variable names and use attr_readers for content and slide\n\n ### fix: use class SlideDeck or Deck?? for slides array?\n \n content2 = \"\"\n slides2.each do |slide|\n content2 << slide.to_classic_html\n end\n \n @content = content2\n @slides = slides2 # strutured content\n end", "def parse_text\n text.split(\"\\n\").map { |r| r.scan(/.../) } \n end", "def test_2_text_after_first_corinthians\n sample_text = \"1 Cor. 1:1 testing for new pericopes.\"\n pericopes = Pericope.parse(sample_text)\n assert pericopes.any?, \"Pericope found.\"\n end", "def parse(doc)\n pdoc = PlanR::ParsedDocument.new(name, doc)\n\n begin\n safe_fname = Shellwords.escape(doc.abs_path)\n # FIXME: capture STDERR so these messages disappear:\n # Syntax Error: Invalid object stream\n # Syntax Error: Expected the optional content group list, but wasn't able to find it, or it isn't an Array\n info = %x{#{INFO_UTIL} -enc UTF-8 #{safe_fname}}.chomp\n properties_from_info(pdoc, info)\n # TODO: support pdftotext options?\n text = %x{#{PARSE_UTIL} -q -enc UTF-8 #{safe_fname} - }.chomp\n pdoc.add_text_block(text)\n rescue Exception => e\n # FIXME: log\n $stderr.puts \"[POPPLER] ERROR #{e.message}\"\n $stderr.puts \"INPUT: #{doc.abs_path}\"\n $stderr.puts e.backtrace[0,4].join(\"\\n\")\n end\n pdoc\n end", "def parse_and_process_text(text, parse_options={})\n postprocess(parse_xml(parse_text(text, parse_options)))\n end", "def parse(data); end", "def tt_sections text\n flow = @am.flow text.dup\n\n flow.each do |item|\n case item\n when String then\n @res << item if in_tt?\n when RDoc::Markup::AttrChanger then\n off_tags res, item\n on_tags res, item\n when RDoc::Markup::RegexpHandling then\n @res << convert_regexp_handling(item) if in_tt? # TODO can this happen?\n else\n raise \"Unknown flow element: #{item.inspect}\"\n end\n end\n\n res\n end", "def _test_text ; process_test_case(\"text\") ; end", "def from_s(text)\r\n\t\t@root_vob = \"\"\r\n\t\t@branch = \"\"\r\n\t\t@tag = \"\"\r\n\t\t@checks = []\r\n\t\t@vobs_cfg = {}\r\n\r\n\t\ttext.lines.each do |line|\r\n\t\t\tnext if ! (line =~ /^\\s*element\\s+(.*)/)\r\n\t\t\te = $1.split(/\\s+/)\r\n\t\t\te[0] =~ /[\\/\\\\]([^\\/\\\\]+)[\\/\\\\]\\.\\.\\./\r\n\t\t\tvob = $1\r\n\t\t\ttag = e[1]\r\n\t\t\t\r\n\t\t\tnext if !vob || !tag\r\n\t\t\t@vobs_cfg[vob] = tag\r\n\t\tend\r\n\tend", "def parse(tags); end", "def parse\n return parse_text unless @text.nil?\n return parse_file unless @file.nil? && @file_name.nil?\n return false\n end", "def parse(content)\n TOMLP::Parser.new(content).parse\n end", "def test_5_text_before_first_john\n sample_text = \"This is some text about 1 Jn. 1:1.\"\n pericopes = Pericope.parse(sample_text)\n assert pericopes.any?, \"No pericope found.\"\n end", "def parse()\n #This is a stub, used for indexing\n end", "def parse\n @line_count = 0\n @text.each do |line|\n @line_count += 1\n case line\n \n when /^DATE: ?(.*)/\n save_current_match\n parse_date($1)\n\n when /^PLAYER: ?(.*)/\n parse_player($1)\n\n when /^SET/\n parse_set\n \n when /^GAME: ?(.*)/\n parse_game($1)\n \n when /^(\\d\\w\\w?)/\n parse_point($1)\n end\n end\n \n save_current_match\n return @matches\n end", "def initialize(text=nil)\n @text = text\n @type=nil\n @copy=nil\n @target=nil\n parse unless @text.nil?\n end", "def parslets; end", "def accept_paragraph paragraph\n tt_sections(paragraph.text)\n end", "def parse(text)\n Rdoc.parser.convert(text).force_encoding(\"UTF-8\")\n end", "def post_process_text(s) \n # extract math\n math, arrays = [], []\n s.scan(/\\$([^$]+)\\$/) {|m| math << m } # $$\n s.scan(/\\\\\\[([^$]+)\\\\\\]/) {|m| arrays << m } # \\[ \\]\n # citations\n s = replace_citations(s)\n # listings, algorithms, tables\n s = replace_listings(s)\n # custom \n s = replace_custom_refs(s)\n # texttt\n s = replace_texttt(s)\n # emph\n s = replace_emph(s)\n # textbf\n s = replace_bf(s)\n # urls\n s = replace_urls(s)\n # footnotes\n s = replace_footnotes(s)\n # paragrams\n s = replace_paragraphs(s)\n # chapter refs\n s = replace_chapter_refs(s)\n # section refs\n s = remove_section_refs(s)\n # replace markboth with nothing\n s = replace_markboth(s)\n # remove hypenation suggestions\n s = remove_hyph_suggestions(s)\n # umlats etc\n s = character_processing(s)\n # replace \\% with %\n s = s.gsub(\"\\\\%\", \"\\%\")\n # replace \"\\ \" with a space\n s = s.gsub(\"\\\\ \", \" \")\n # replace \\\" and \\' with nothing\n s = s.gsub(\"\\\\\\\"\", \"\")\n s = s.gsub(\"\\\\\\'\", \"\")\n # replace ~ with space\n s = s.gsub(\"~\", \" \")\n # replace \\$ with $ (testing algorithms)\n s = s.gsub(\"\\\\$\", \"$\")\n # replace \\_ with _ (testing algorithms)\n s = s.gsub(\"\\\\_\", \"_\") \n # replace \\# with # (appendix)\n s = s.gsub(\"\\\\#\", \"#\")\n # replace \\{ with { (appendix)\n s = s.gsub(\"\\\\{\", \"{\")\n # replace \\} with } (appendix)\n s = s.gsub(\"\\\\}\", \"}\") \n # replace \\\\ with <br /> (appendix, de)\n s = s.gsub(\"\\\\\\\\\", \"<br />\") \n # replace \\Latex with LaTex\n s = s.gsub(\"\\\\LaTeX\", \"LaTex\") \n # replace \\copyright with html copyright\n s = s.gsub(\"\\\\copyright\", \"&copy;\")\n # replace \\mybookdate\\ with publication date 2011\n s = s.gsub(\"\\\\mybookdate\", DATE)\n # replace \\mybookauthor with the author ame\n s = s.gsub(\"\\\\mybookauthor\", \"Jason Brownlee\")\n # replace \\mybooktitle with the book title\n s = s.gsub(\"\\\\mybooktitle\", TITLE)\n # replace \\mybooksubtitle with the book subtitle\n s = s.gsub(\"\\\\mybooksubtitle\", SUBTITLE)\n # finally switch ` for ' (late in the subs)\n s = s.gsub(\"`\", \"'\")\n \n # put the math back\n if !math.empty?\n index = 0\n s = s.gsub(/\\$([^$]+)\\$/) do |m|\n index += 1\n \"$#{math[index - 1]}$\"\n end\n end \n if !arrays.empty?\n index = 0\n s = s.gsub(/\\\\\\[([^$]+)\\\\\\]/) do |m|\n index += 1\n \"\\\\[#{arrays[index - 1]}\\\\]\"\n end\n end\n return s\nend", "def create_paragraph(content)\n text = Text.new(content)\n run = Run.new\n run << text\n paragraph = Paragraph.new\n paragraph << run\n paragraph\nend", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def test_parsing_siblings_source_and_result\n to_parse = %q{@html {@body { }@content { }}}.chomp\n assert_source to_parse, %q{_src='';_src.concat('<html>');_src.concat('<body>');_src.concat('</body>');_src.concat('<content>');_src.concat('</content>');_src.concat('</html>');_src;}.chomp\n assert_result to_parse, \"<html><body></body><content></content></html>\"\n end", "def parse_text text\n\n if @debug\n puts \"=== parsing text to find Vacation ===\"\n puts text\n end\n\n text.split(/\\n/).each do |line|\n line.chomp!\n line.strip!\n if line =~ /^=vacation/i\n reset_parsed\n elsif line =~ /=end/i\n @closed = true\n break\n elsif line =~ /^(cancel|deactivate)/i\n cancel\n elsif line =~ /^activate:\\s*(now|jetzt)/i\n self.activated_at = Time.now - 1, freeze=true\n elsif line =~ /^(?:first|start|erster)\\s+(?:day|date|tag):(.+)/i\n self.starts_at = $1\n elsif line =~ /^(?:last|end|letzter)\\s+(?:day|date|tag):(.+)/i\n self.ends_at = $1\n elsif line =~ /^message:(.*)/i\n @message = $1.strip\n @parsing_message = true\n elsif parsing_message?\n @message << \"\\n\" << line\n end\n end\n\n validate\n end", "def completed_text_extraction\n end", "def test_3_text_before_first_corinthians\n sample_text = \"This is some text about 1 Corinthians 1:1.\"\n pericopes = Pericope.parse(sample_text)\n assert pericopes.any?, \"No pericope found.\"\n end", "def parse\n lines = @text.split(\"\\n\")\n head = lines.shift\n head = head.gsub(/[[:punct:]]/, '')\n #head = head.gsub(/[[:space:]]|\\t/, '')\n head_match = Tables::Header_regex.match(head.strip)\n if head_match then\n @die = head_match[2].to_i\n @header = head_match[3].strip\n end\n lines.each { |l|\n l = l.gsub(/[[:punct:]]/, '')\n ti = Tables::Line_regex.match(l.strip)\n if ti then\n @outcomes << TableItem.new(ti.to_s)\n end\n }\n end", "def parse_text(source, rs = nil)\n rs ||= RenderState.new\n \n # check\n case rs.header_id_type\n\t\t\twhen HeaderIDType::MD5, HeaderIDType::ESCAPE\n\t\t\telse\n rs.warnings << \"illegal header id type - #{rs.header_id_type}\"\n\t\t\tend\n \n # Create a StringScanner we can reuse for various lexing tasks\n @scanner = StringScanner::new( '' )\n \n # Make a copy of the string with normalized line endings, tabs turned to\n # spaces, and a couple of guaranteed newlines at the end\n \n text = detab(source.gsub( /\\r\\n?/, \"\\n\" ))\n text += \"\\n\\n\"\n @log.debug \"Normalized line-endings: %p\" % text\n \n #text = Utilities::prePaling(text) #Insert by set.minami 2013-04-27\n #Insert by set.minami 2013-04-03\n text = transform_block_quotes(text, rs)\n nrange = []\n departure = 1\n preproc = Marshal.load(Marshal.dump(text))\n text.clear\n stack = []\n html_text_number = 0\n# Utilities::initNumberStack\n\n preproc.lines { |line|\n html_text_number += 1\n begin\n line.gsub!(/^\\{nrange:(.*?)(;\\d+)??\\}/){ |match|\n #depNum = $2.delete(';').to_i\n #departure = if depNum > 0 then depNum else 1 end\n if /h(\\d)\\-h(\\d)/i =~ $1\n nrange.push($1)\n nrange.push($2)\n if nrange.size > 2 then\n nrange.pop\n nrange.pop\n raise \"Syntax Error!\" \n end\n end\n next\n }\n @log.debug line \n #calculate numbering\n range = nrange[1].to_i - nrange[0].to_i\n if range == 0 then range = 1 end\n if range < 0 then \n p \"AoBane Syntax Error:Header range is WRONG!\" +\n \"@ l.#{html_text_number}\";exit(-1)\n raise FatalError,\"AoBane Syntax Error:Header range is WRONG!\"\n end\n if line =~ /^(%{1,#{range}})(.*?)\\n/ then\n text << Utilities.\n calcSectionNo(nrange.min,range,$1.size,departure,$2,stack) +\n \"\\n\"\n else\n text << line\n end\n @log.debug nrange.minmax\n rescue => e\n @log.warn \"AoBane Syntax WARNING l.#{html_text_number}:#{line.chomp} haven't adopted\" \n @log.warn e \n end\n }\n\n text.gsub!(/\\*\\[(.*?)\\]\\((.*?)(\\|.*?)*(\\/.*?)*\\)/){|match|\n '<font color=\"' +\n if $2.nil? then '' else $2 end\t+'\" ' +\n 'face=\"' +\n if $3.nil? then '' else $3.delete('|') end + '\" ' +\n 'size=\"' +\n if $4.nil? then '' else $4.delete('/') end + '\">' +\n $1 + '</font>'\n }\n #Insert by set.minami 2013-04-21\n text = Utilities::abbrPreProcess(text)\n #Insert by set.minami 2013-04-01\n text.gsub!(/\\\\TeX\\{(.+?)\\\\TeX\\}/){\n begin\n $1.to_mathml\n rescue => e\n puts 'math_ml Error: ' + $1\n puts e\n end\n }\n\n text = Utilities::preProcFence(text,0).join(\"\\n\") #Insert by set.minami 2013-04-27\n #Insert by set.minami 2013-03-30 \n #Insert by set.minami\n\n\t\t\t# Filter HTML if we're asked to do so\n\t\t\tif self.filter_html\n\t\t\t\t#text.gsub!( \"<\", \"&lt;\" )\n\t\t\t\t#text.gsub!( \">\", \"&gt;\" )\n\t\t\t\t@log.debug \"Filtered HTML: %p\" % text\n\t\t\tend\n\n\t\t\t# Simplify blank lines\n\t\t\ttext.gsub!( /^ +$/, '' )\n\t\t\t@log.debug \"Tabs -> spaces/blank lines stripped: %p\" % text\n\n\n\t\t\t# Replace HTML blocks with placeholders\n\t\t\ttext = hide_html_blocks( text, rs )\n\t\t\t@log.debug \"Hid HTML blocks: %p\" % text\n\t\t\t@log.debug \"Render state: %p\" % rs\n\n\n\t\t\t# Strip footnote definitions, store in render state\n\t\t\ttext = strip_footnote_definitions( text, rs )\n\t\t\t@log.debug \"Stripped footnote definitions: %p\" % text\n\t\t\t@log.debug \"Render state: %p\" % rs\n\n\n\t\t\t# Strip link definitions, store in render state\n\t\t\ttext = strip_link_definitions( text, rs )\n\t\t\t@log.debug \"Stripped link definitions: %p\" % text\n\t\t\t@log.debug \"Render state: %p\" % rs\n\n\t\t\t# Escape meta-characters\n\t\t\ttext = escape_special_chars( text )\n\t\t\t@log.debug \"Escaped special characters: %p\" % text\n\n\t\t\t# Transform block-level constructs\n\t\t\ttext = apply_block_transforms( text, rs )\n\t\t\t@log.debug \"After block-level transforms: %p\" % text\n\n\t\t\t# Now swap back in all the escaped characters\n\t\t\ttext = unescape_special_chars( text )\n\t\t\t@log.debug \"After unescaping special characters: %p\" % text\n\n\t\t\t# Extend footnotes\n\t\t\tunless rs.footnotes.empty? then\n\t\t\t\ttext << %Q|<div class=\"footnotes\"><hr#{EmptyElementSuffix}\\n<ol>\\n|\n\t\t\t\trs.found_footnote_ids.each do |id|\n\t\t\t\t\tcontent = rs.footnotes[id]\n\t\t\t\t\thtml = apply_block_transforms(content.sub(/\\n+\\Z/, '') + %Q| <a href=\"#footnote-ref:#{id}\" rev=\"footnote\">&#8617;</a>|, rs)\n\t\t\t\t\ttext << %Q|<li id=\"footnote:#{id}\">\\n#{html}\\n</li>|\n\t\t\t\tend\n\t\t\t\ttext << %Q|</ol>\\n</div>\\n|\n\t\t\tend\n\n\t\t\t# Display warnings\n\t\t\tif @display_warnings then\n\t\t\t\tunless rs.warnings.empty? then\n\t\t\t\t\thtml = %Q|<pre><strong>[WARNINGS]\\n|\n\t\t\t\t\thtml << rs.warnings.map{|x| Util.escape_html(x)}.join(\"\\n\")\n\t\t\t\t\thtml << %Q|</strong></pre>|\n\n\t\t\t\t\ttext = html + text\n\t\t\t\tend\n\t\t\tend\n\n #Insert by set.minami 2013-04-21\n text = Utilities::abbrPostProcess(text)\n #Insert by set.minami 2013-03-30\n text = Utilities::insertTimeStamp(text)\n text = Utilities::postProcFence(text) #Insert by set.minami 2013-04-27\n\n text = Utilities::transformSpecialChar(text) #Insert by set.minami 2013-04-27\n\n return text\n end", "def parse\n while match = @result.match(/\\[((\\w|\\.)+)\\]/)\n @placeholder = match[0] # with brackets - current placeholder\n @field = match[1] # without brackets - current field\n\n check_current_prefix\n\n if @field['.']\n sub_object\n elsif obj.respond_to?(@field) && ( @cur_collection = obj.send(@field) ).is_a?(Array)\n sub_collection\n else\n sub_string\n end\n # If placeholder still exists here, it can't be recognized, sub with error\n @result.gsub!(@placeholder, \"UNKNOWN for #{obj.class.to_s}: #{@field}\")\n end\n @sm.finished_matching\n end", "def parse_text_to_attributes\n # return text as comment, by default\n result = { \"comment\" => self.text, \"problem_id\" => nil, \"value\" => nil }\n \n # process the \"[+4.0:problem_name]\" part\n def parse_value_problem(s_p)\n value_problem = {}\n \n # parse value and problem name\n s_p = s_p[1...-1] # remove starting and trailing brackets\n s_p = s_p.split(\":\", 2) # split on :, at most two parts\n value_text = s_p[0]\n problem_name = s_p[1] # if no : to split on, problem_name is nil\n \n # extract value, return nil if unable to\n value = Float(value_text) rescue nil \n value_problem.update({ \"value\" => value }) if value\n\n # extract problem, ignore problem if problem_name is invalid or not provided\n if problem_name and (problem = self.submission.assessment.problems.find_by_name(problem_name))\n value_problem.update({ \"problem_id\" => problem.id })\n end\n\n return value_problem\n end\n \n # if there is a right bracket (]) at the end\n if self.text.end_with?(\"]\") then\n \n # and a left bracket ([) (find the last one)\n if (l_bracket = self.text.rindex(\"[\"))\n\n # extract value and problem from string between brackets (incl. brackets)\n value_problem = parse_value_problem(self.text[l_bracket..-1])\n result.update(value_problem)\n\n # extract comment\n comment = self.text[0...l_bracket].rstrip\n result.update({ \"comment\" => comment })\n end \n end\n \n return result \n end", "def parse_string (pdef)\n\n pdef = pdef.strip\n\n return parse_xml(pdef) if pdef.match(X_START)\n return YAML.load(pdef) if pdef.match(Y_START)\n\n #(json = (OpenWFE::Json.from_json(pdef) rescue nil)) and return json\n return OpenWFE::Json.from_json(pdef) if pdef.match(J_ARRAY)\n\n #\n # else it's some ruby code to eval\n\n get_tree_checker.check(pdef)\n\n # no exception, green for eval...\n\n ProcessDefinition.eval_ruby_process_definition(pdef)\n end", "def parse(xml_text)\n xml = XmlSimple.xml_in(xml_text, { 'ForceContent' => true })\n parse_block(xml['block'][0])\n end", "def test_paragraph_props_passed_to_runs\n input = '<p style=\"color: #123456\"><b>Lorem</b><span>ipsum</span></p>'\n expected_output = <<-DOCX.strip\n <w:p>\n <w:pPr>\n <w:pStyle w:val=\"Paragraph\" />\n </w:pPr>\n <w:r>\n <w:rPr>\n <w:color w:val=\"123456\" />\n <w:b />\n </w:rPr>\n <w:t xml:space=\"preserve\">Lorem</w:t>\n </w:r>\n <w:r>\n <w:rPr>\n <w:color w:val=\"123456\" />\n </w:rPr>\n <w:t xml:space=\"preserve\">ipsum</w:t>\n </w:r>\n </w:p>\n DOCX\n assert_equal normalize_wordml(expected_output), process(input)\n end", "def parse\n lines = text.lines.to_a\n\n @header = lines.shift.strip\n\n parse_release_stamp(@header)\n\n # remove blank lines from top\n lines.shift until lines.first !~ /^\\s+$/\n\n idx = find_changes(lines)\n\n if idx.nil?\n @notes = lines.join\n @changes = ''\n elsif idx > 0\n @notes = lines[0...idx].join\n @changes = lines[idx..-1].join\n else # hmmm... is this ever used?\n gap = lines.index{ |line| /^\\s*$/ =~ line }\n @changes = lines[0...gap].join\n @notes = lines[gap..-1].join\n end\n end", "def do_adhoc(str)\n str.gsub!(/^\\\\cleardoublepage$/, \"\")\n str.gsub!(/^\\\\plainifnotempty$/, \"\")\n str.gsub!(/^\\\\small$/, \"\")\n str.gsub!(/^\\\\normalsize$/, \"\")\n str.gsub!(/^\\\\centering$/, \"\")\n\n # URL\n str.gsub!(/\\\\verb\\|(.+?)\\|/) do |m|\n s = $1\n if s =~ URI.regexp\n s\n else\n m\n end\n end\n\n text_pairs = {\n %! \\\\vspace*{-0.1\\\\Cvs}! => \"\",\n %!$10^{12} = 1 \\\\mathrm{TB}$! => %!@<raw>#{LBRACE}|html|10<sup>12</sup>#{RBRACE}=1TB!,\n %!$\\\\exists, \\\\forall$! => %!@<raw>#{LBRACE}|html|&exist;, &forall;#{RBRACE}!,\n %!$\\\\lnot,\\\\land,\\\\lor$! => %!@<raw>#{LBRACE}|html|&not;,&and;,&or;#{RBRACE}!,\n %!$>$! => %!@<raw>#{LBRACE}|html|&gt;#{RBRACE}!,\n %!$<$! => %!@<raw>#{LBRACE}|html|&lt;#{RBRACE}!,\n %!B$^+$! => %!@<raw>#{LBRACE}|html|B<sup>+</sup>#{RBRACE}!,\n %!\\\\paragraph{Step 4.} \\\\ ! => %!\\\\paragraph{Step 4.}!,\n %!\\\\verb|http://s2k-ftp.cs.berkeley.edu/ingres/|! => %!http://s2k-ftp.cs.berkeley.edu/ingres/!,\n %!\\\\verb|pc<code.size()|! => %!@<tt>#{LBRACE}pc<code.size()#{RBRACE}!,\n %!\\\\verb|c|! => %!@<tt>#{LBRACE}c#{RBRACE}!,\n %!\\\\verb|m|! => %!@<tt>#{LBRACE}m#{RBRACE}!,\n %!\\\\verb|z|! => %!@<tt>#{LBRACE}z#{RBRACE}!,\n %!$n$! => %!n!,\n %!$\\\\mathrm{O}(1)$! => %!O(1)!,\n %!$\\\\mathrm{O}(n)$! => %!O(n)!,\n %!$\\\\beta$! => %!@<raw>#{LBRACE}|html|&beta;#{RBRACE}!,\n %!$t$! => %!t!,\n %![$^{11}$C]! => %!@<raw>#{LBRACE}|html|[<sup>11</sup>C]#{RBRACE}!,\n }\n\n text_pairs.each do |k,v|\n regex = Regexp.compile(Regexp.quote(k))\n str.gsub!(regex, v)\n end\n\n str.gsub!(/^\\s*\\\\begin\\{lstlisting\\}\\n((?:.|\\n)*?)\\n\\s*\\\\end\\{lstlisting\\}\\n/) do |m|\n \"//emlist{\\n\" + $1 + \"\\n//}\\n\"\n end\n\n str.gsub!(/^\\s*\\\\begin\\{quote\\}\\n((?:.|\\n)*?)\\n\\s*\\\\end\\{quote\\}\\n/) do |m|\n \"//quote{\\n\" + $1 + \"\\n//}\\n\"\n end\n\n str.gsub!(/^\\s*\\\\(begin|end)\\{(minipage|center|figure)\\}.*$/, \"\")\n\n img_refs = Hash.new\n str.gsub!(/^\\s*\\\\includegraphics(?:\\[.*?\\])?\\{(.+?)\\}[\\s\\n]*\\\\caption\\{(.+?)\\}[\\s\\n]*\\\\label\\{(.+?)\\}/) do |m|\n imgfile = $1.strip\n caps = $2.strip\n label = $3.strip\n if imgfile =~ /\\.eps\\Z/\n imgfile = File.basename(imgfile, \".eps\")\n img_refs[label.strip] = imgfile\n \"\\n//image[#{imgfile}][#{caps}]{\\n//}\\n\"\n elsif imgfile =~ /\\.pdf\\Z/\n imgfile = File.basename(imgfile, \".pdf\")\n img_refs[label.strip] = imgfile\n \"\\n//image[#{imgfile}][#{caps}]{\\n//}\\n\"\n else\n m\n end\n end\n\n str.gsub!(/^\\s*\\\\includegraphics(?:\\[.*?\\])?\\{(.+?)\\}[\\s\\n]*\\\\caption\\{(.+?)\\}/) do |m|\n imgfile = File.basename($1.strip)\n caps = $2.strip\n imgfile.gsub!(/\\.\\w+\\Z/, \"\")\n \"\\n//image[#{imgfile}][#{caps}]{\\n//}\\n\"\n end\n\n str.gsub!(/図\\s*\\\\ref\\{([^\\}]*)\\}/) do |m|\n \"@<img>#{LBRACE}#{img_refs[$1.strip] || $1.strip}#{RBRACE}\"\n end\n\n str.gsub!(/^\\s*\\\\begin\\{enumerate\\}((?:.|\\n)*)\\s*\\\\end\\{enumerate\\}/) do |m|\n block = $1\n idx = 0\n if block =~ /\\\\begin/\n block\n else\n items = block.strip.split(/\\\\item\\s*/).select{|s| s.size > 0}\n items_str = \"\\n\"\n items.each do |item|\n items_str += \" \" + (idx += 1).to_s + \". \" + item.gsub(/\\n\\s*/,\"\").strip + \"\\n\"\n end\n items_str\n end\n end\n\n str.gsub!(/^\\s*\\\\begin\\{itemize\\}((?:.|\\n)*)\\s*\\\\end\\{itemize\\}/) do |m|\n block = $1\n if block =~ /\\\\begin/\n block\n else\n items = block.strip.split(/\\\\item\\s*/).select{|s| s.size > 0}\n items_str = \"\\n\"\n items.each do |item|\n items_str += \" * \" + item.gsub(/\\n\\s*/,\"\").strip + \"\\n\"\n end\n items_str\n end\n end\n\n # brainfuck\n str.gsub!(/\\\\verb\\|([-+><,\\.\\[\\] ]+)\\|/) do |m|\n %!@<tt>#{LBRACE}#{$1}#{RBRACE}!\n end\n\n # file url in hoge.tex\n str.gsub!(/\\{\\\\scriptsize((?:.|\\n)+?)\\}/) do |m|\n s = $~[1].strip\n if s.strip =~ URI.regexp && s == $~[0]\n s\n else\n m\n end\n end\n\n str\nend", "def parse_source(raw)\n if raw =~ /^(.*title:\\s.*?)\\n\\n(.*)/m then\n begin\n @data = YAML.load($1)\n @content = $2\n rescue Exception => e\n raise \"Parse Exception: #{e.message}\"\n end\n end\n end", "def parse\n kramdown_doc = parse_to_kramdown_document\n\n # Prepare return value\n kramdown_string = kramdown_doc.send(kramdown_conversion_method_name)\n json_state = JSON::State.new(array_nl: \"\\n\") # to format json output\n {\n 'folio.at' => kramdown_string,\n 'folio.data.json' => @data_output.to_json(json_state) + \"\\n\",\n 'folio.deleted_text.json' => @deleted_text_output.to_json(json_state) + \"\\n\",\n 'folio.notes.json' => @notes_output.to_json(json_state) + \"\\n\",\n 'folio.warnings.json' => @warnings_output.to_json(json_state) + \"\\n\",\n }\n end", "def process_markup()\n [title,content].each do |text|\n next if !text\n clear_webpage(text).scan(PTN_MARKUP).map{|e|e[0].split(PTN_ELEMENT_SEP)}.flatten.each do |element|\n #debug \"[process_markup] element: \"+element.inspect\n next if !element\n ptn = element.scan(PTN_METADATA)\n #debug \"[process_markup] ptn: \"+ptn.inspect\n if ptn.size > 0\n m[ptn[0][0].to_sym] = parse_value(ptn[0][1])\n else\n create_and_link(element, 'tag' , \"t\")\n #add_tags(element, \"m\")\n end\n end#scan\n end#each\n end", "def parse\n @parsed = true\n\n @sections = tomdoc.split(\"\\n\\n\")\n sections = @sections.dup\n\n return false if sections.empty?\n\n parse_description(sections.shift)\n\n if sections.first && sections.first =~ /^\\w+\\s+\\-/m\n parse_arguments(sections.shift)\n end\n\n current = sections.shift\n while current\n case current\n when /^Examples/\n parse_examples(current, sections)\n when /^Yields/\n parse_yields(current)\n when /^(Returns|Raises)/\n parse_returns(current)\n when /^Signature/\n parse_signature(current, sections)\n end\n current = sections.shift\n end\n\n return @parsed\n end", "def test_truth\n assert_kind_of Slide, slides(:first)\n end", "def process_text!\n return if self.processed || self.image.blank?\n\n tesseract_image = RTesseract.new(self.image.path, psm: 4)\n self.box_data = RTesseract::Box.new(self.image.path, psm: 4).words\n self.pdf = File.open(tesseract_image.to_pdf) if File.exist?(tesseract_image.to_pdf)\n self.text = tesseract_image.to_s.downcase\n self.line_count = self.text.split(\"\\n\").size\n\n ReceiptParser.new(self).process\n\n self.processed = true\n self.save!\n end", "def parse\n return @document if @document\n\n @document = super @text, @format\n @document.file = @location\n @document\n end", "def test_to_file\n @parser.text_line :comment, :match => /^#/\n @parser.text_line :blank, :match => /^\\s*$/\n @parser.record_line :record, :fields => %w{name one two}\n\n text = \"# This is a comment\n\njohnny one two\nbilly three four\\n\"\n\n# Just parse and generate, to make sure it's isomorphic.\nassert_nothing_raised do\n assert_equal(text, @parser.to_file(@parser.parse(text)),\n \"parsing was not isomorphic\")\n end\n end", "def parse_kramdown(file)\n ::Kramdown::Document.new File.readlines(file).join, :input => 'QuickStartParser' \n end", "def parse(doc)\n return nil if (! PlanR::Application::JRuby.running?) \n begin\n h = tika_parse(doc.contents)\n\n pdoc = PlanR::ParsedDocument.new(name, doc)\n pdoc.add_text_block (h[:content] || '')\n pdoc.properties[:language] = h[:language]\n (h[:metadata] || {}).each { |k,v| pdoc.properties[k] = v }\n pdoc\n end\n end", "def parslet; end", "def parslet; end", "def parslet; end", "def parslet; end", "def test_parser_recognizer_success\n assert_equal '4', @parser.recognizer(VALID_DIGIT.lines.to_a[1..3].map{|l| l.chomp})\n end", "def validate(doc)\n raw_text = doc.gsub(\"\\n\", '')\n tfr = TextIn::TextTransformer.new(raw_text, @flow_type, nil, nil, nil, 'out')\n res = tfr.parse\n res.nil? # parse returns nil on success\n end", "def scrape_text\n\n end", "def initialize(text)\n @frags = []\n res = nil\n\n text.scan(/(.*?\\w[.!?][\"')\\]}]*)\\s+|(.*)\\s*/) do |res|\n if res[0]\n frag = Frag.new(res[0])\n else\n frag = Frag.new(res[1], true)\n end\n @frags.last.next = frag.cleaned.first unless @frags.empty?\n @frags.push frag\n end\n end", "def pluggable_parser; end", "def parse!(markup)\n doc(markup)\n end", "def process_text(content)\n content\n end", "def Process(text)\n text.to_str.gsub(/:\\(?([a-z0-9\\+\\-_]+)\\)?:/) do |match|\n\t \n # checks, if user wanted an animated smiley or not\n animated = false\n if (match.include?('(') && match.include?(')'))\n animated = true\n end\n\n # proposed image path, if image is locally available\n\tif animated\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'animated', $1 + '.gif')\n else\n local_image = File.join(Dir.pwd, 'public', 'smileys', 'general', $1 + '.png')\n end\n\n # returns image tag, if image locally exists\n if File.exist?(local_image)\n ImageTag($1, animated)\n\n # image doesn't exists locally\n else\n # stores the image and returns image tag, if smiley is valid\n if SmileyExist($1, animated)\n ImageStore($1, animated)\n ImageTag($1, animated)\n else\n if animated\n '('+$1+')'\n else\n ':'+$1+':'\n end\n end\n end\n\n end\n end", "def parse_object\n skip_space_and_comments\n if e = @lexer.scan(/<(true|false|array|dict|data)\\s*\\/>/m)\n case e[/\\w+/]\n when 'true'; true\n when 'false'; false\n when 'array'; []\n when 'dict'; {}\n else; '' # data\n end\n\n elsif e = @lexer.scan(/<(integer|real|string|date|data)\\s*>[^<>]*<\\/\\1\\s*>/m)\n tag = e[/\\w+/]\n content = tag_content e\n\n case tag\n when 'integer'\n content.to_i\n when 'real'\n content.to_f\n when 'string'\n CGI.unescape_html content\n when 'date'\n DateTime.parse content\n else # data\n StringIO.new Base64.decode64 content\n end\n\n elsif e = @lexer.scan(/<array\\s*>/m)\n res = []\n until (skip_space_and_comments; @lexer.scan(/<\\/array\\s*>/m))\n e = parse_object\n syntax_error 'failed to parse array element' if e.nil?\n res << e\n end\n res\n\n elsif e = @lexer.scan(/<dict\\s*>/)\n res = {}\n until (skip_space_and_comments; @lexer.scan(/<\\/dict\\s*>/m))\n key_tag = @lexer.scan(/<key\\s*>[^<>]*<\\/key\\s*>/m)\n syntax_error 'failed to parse dict key' if !key_tag\n\n key = CGI.unescape_html tag_content key_tag\n value = parse_object\n syntax_error 'failed to parse dict value' if value.nil?\n res[key] = value\n end\n res\n\n else\n nil\n end\n end", "def test_parse\n @parser.meta_def(:parse_line) do |line|\n line.split(/\\s+/)\n end\n\n text = \"one line\\ntwo line\"\n should = [%w{one line}, %w{two line}]\n ret = nil\n assert_nothing_raised do\n ret = @parser.parse(text)\n end\n\n assert_equal(should, ret)\n end", "def parse\n raise NotImplementedError\n end", "def step\n start_group :normal, matched if scan( /\\s+/ )\n if @in_tag\n case\n when scan( /([-\\w]+):([-\\w]+)/ )\n start_group :namespace, subgroup(1)\n start_group :punct, \":\"\n start_group :attribute, subgroup(2)\n when scan( /\\d+/ )\n start_group :number, matched\n when scan( /[-\\w]+/ )\n start_group :attribute, matched\n when scan( %r{[/?]?>} )\n @in_tag = false\n start_group :punct, matched\n when scan( /=/ )\n start_group :punct, matched\n when scan( /[\"']/ )\n scan_string matched\n else\n append getch\n end\n elsif ( text = scan_until( /(?=[<&])/ ) )\n start_group :normal, text unless text.empty?\n if scan(/<!--.*?(-->|\\Z)/m)\n start_group :comment, matched\n else\n case peek(1)\n when \"<\"\n start_group :punct, getch\n case peek(1)\n when \"?\"\n append getch\n when \"/\"\n append getch\n when \"!\"\n append getch\n end\n start_group :normal, matched if scan( /\\s+/ )\n if scan( /([-\\w]+):([-\\w]+)/ )\n start_group :namespace, subgroup(1)\n start_group :punct, \":\"\n start_group :tag, subgroup(2)\n elsif scan( /[-\\w]+/ )\n start_group :tag, matched\n end\n @in_tag = true\n when \"&\"\n if scan( /&\\S{1,10};/ )\n start_group :entity, matched\n else\n start_group :normal, scan( /&/ )\n end\n end\n end\n else\n append scan_until( /\\Z/ )\n end\n end", "def parse_text_properties(node,object)\n @text_properties.each do |property|\n if match = node.xpath(property.xpath).first\n unless match.inner_text.empty?\n object.send(\"#{property.name}=\",match.inner_text)\n end\n end\n end\n end", "def parse\n @meta = parse_meta\n @comments = parse_comments\n @sensors = parse_sensors\n @workout = parse_workout\n @intervals = parse_intervals\n @interval_samples = parse_interval_samples\n end" ]
[ "0.76218355", "0.67831904", "0.67454565", "0.65442306", "0.65136373", "0.61860144", "0.61226267", "0.60944426", "0.60568273", "0.60059", "0.59173757", "0.588856", "0.588856", "0.588856", "0.58847", "0.58792", "0.58454305", "0.58378804", "0.5834968", "0.57880366", "0.578626", "0.574043", "0.57316333", "0.57232076", "0.56831586", "0.56831586", "0.5675867", "0.5617026", "0.5611966", "0.55835575", "0.55786043", "0.5557254", "0.5554769", "0.5542815", "0.55410147", "0.5522998", "0.5519021", "0.5499987", "0.54931945", "0.5491363", "0.54574364", "0.5453952", "0.53918314", "0.5385171", "0.53834206", "0.53814816", "0.5367911", "0.53485847", "0.5344062", "0.5335001", "0.53202254", "0.53174037", "0.5308416", "0.5297933", "0.5295059", "0.528612", "0.528612", "0.528612", "0.528612", "0.5260806", "0.5260096", "0.5249447", "0.52481484", "0.5247784", "0.52425075", "0.5234169", "0.52318895", "0.5223833", "0.5220275", "0.5220011", "0.52187884", "0.5213073", "0.52099365", "0.52044445", "0.52002263", "0.5182762", "0.5182618", "0.51806825", "0.51723313", "0.51654446", "0.51599324", "0.51596934", "0.5158685", "0.5158685", "0.5158685", "0.5158685", "0.5153843", "0.51496387", "0.51493806", "0.51455486", "0.5145104", "0.51422834", "0.51420754", "0.5139859", "0.51385915", "0.5137395", "0.5137245", "0.51281446", "0.5123268", "0.5119466" ]
0.7811514
0